-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
--- | ||
# Feel free to add content and custom Front Matter to this file. | ||
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults | ||
|
||
layout: page | ||
title: Welcome! | ||
layout: default | ||
--- | ||
# {{ page.title | default: site.title }} | ||
|
||
# Hi | ||
<div id="post-list" class="flex-grow-1 px-xl-1"> | ||
<article class="card-wrapper card"> | ||
<a href="/techdemos" class="post-preview row g-0 flex-md-row-reverse"> | ||
{% assign card_body_col = '12' %} | ||
<div class="col-md-{{ card_body_col }}"> | ||
<div class="card-body d-flex flex-column"> | ||
<h1 class="card-title my-2 mt-md-0">Tech Demos</h1> | ||
<div class="card-text content mt-0 mb-3"> | ||
<p>Try various tech demos</p> | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</article> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
# Feel free to add content and custom Front Matter to this file. | ||
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults | ||
|
||
layout: page | ||
title: Encoder/Decoder | ||
--- | ||
#### Input | ||
<textarea id="inputText" rows="10" class="panel" spellcheck="false" style="resize:none; width:100%;"></textarea> | ||
|
||
#### Options | ||
Mode: | ||
<select name="mode" id="mode" style="width: 100%"> | ||
</select> | ||
|
||
<button id="encode" style="width: calc(50% - 2px);">Encode</button> | ||
<button id="decode" style="width: calc(50% - 2px);">Decode</button> | ||
<input type="checkbox" id="livemode" name="livemode"> | ||
<label for="livemode"> Live mode</label><br> | ||
|
||
#### Output | ||
<textarea id="outputText" rows="10" class="panel" spellcheck="false" style="resize:none; width:100%;"></textarea> | ||
|
||
<!-- Encode/Decode --> | ||
<script type="text/javascript"> | ||
const mode = document.getElementById("mode"); | ||
const encode = document.getElementById("encode"); | ||
const decode = document.getElementById("decode"); | ||
const livemode = document.getElementById("livemode"); | ||
const input = document.getElementById("inputText"); | ||
const output = document.getElementById("outputText"); | ||
|
||
const codes = { | ||
"Base64": { | ||
encode: text => btoa(text), | ||
decode: text => atob(text) | ||
}, | ||
"URL": { | ||
encode: text => encodeURI(text), | ||
decode: text => decodeURI(text) | ||
}, | ||
"URL (component)": { | ||
encode: text => encodeURIComponent(text), | ||
decode: text => decodeURIComponent(text) | ||
} | ||
} | ||
|
||
for (const code in codes) { | ||
let element = document.createElement("option"); | ||
element.value = code; | ||
element.innerText = code; | ||
mode.appendChild(element); | ||
} | ||
|
||
encode.addEventListener("click", () => { | ||
output.value = codes[mode.value].encode(input.value); | ||
}); | ||
|
||
decode.addEventListener("click", () => { | ||
input.value = codes[mode.value].decode(output.value); | ||
}); | ||
|
||
input.addEventListener("input", () => { | ||
if (livemode.checked) { | ||
output.value = codes[mode.value].encode(input.value); | ||
} | ||
}); | ||
|
||
output.addEventListener("input", () => { | ||
if (livemode.checked) { | ||
input.value = codes[mode.value].decode(output.value); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
# Feel free to add content and custom Front Matter to this file. | ||
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults | ||
|
||
title: Tech Demos | ||
layout: default | ||
--- | ||
# {{ page.title | default: site.title }} | ||
|
||
<div id="post-list" class="flex-grow-1 px-xl-1"> | ||
<article class="card-wrapper card"> | ||
<a href="encode" class="post-preview row g-0 flex-md-row-reverse"> | ||
{% assign card_body_col = '12' %} | ||
{% assign image = '/assets/img/previews/encode.png' %} | ||
{% if image %} | ||
{% assign src = image %} | ||
{% assign alt = 'Preview Image' %} | ||
<div class="col-md-5"> | ||
<img src="{{ src }}" alt="{{ alt }}" {{ lqip }}> | ||
</div> | ||
{% assign card_body_col = '7' %} | ||
{% endif %} | ||
<div class="col-md-{{ card_body_col }}"> | ||
<div class="card-body d-flex flex-column"> | ||
<h1 class="card-title my-2 mt-md-0">Encoder/Decoder</h1> | ||
<div class="card-text content mt-0 mb-3"> | ||
<p>Encode and decode text with various encodings.</p> | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</article> | ||
</div> | ||
|