Skip to content

Instantly share code, notes, and snippets.

@teknixstuff
teknixstuff / readme.md
Last active May 12, 2022 01:32
Require for client-side JS

Example

<script src="https://gist.githubusercontent.com/teknixstuff/320485a455e5a6fb9c2f4467a5374b4c/raw/require.js">
<script>
require('github:medialize/sass.js/dist/sass.sync.js');
require('npm:jquery@3');
</script>
@teknixstuff
teknixstuff / index.html
Last active May 31, 2022 22:41
Attribute selector not working when combined with other selectors
<script src="https://unpkg.com/petite-vue" defer init></script>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/gh/medialize/sass.js/dist/sass.sync.js"></script>
<script src="https://cdn.jsdelivr.net/gh/LeaVerou/prefixfree/prefixfree.min.js"></script>
<script>
window.addEventListener("load",(async()=>{const t=t=>new Promise(((e,n)=>Sass.compile(t,(t=>{0==t.status?e(t.text):n(t.formatted)})))),e=document.querySelectorAll('style[type="text/tailwindscss"]');for(var n=0;n<e.length;n++)e[n].innerHTML=await t(e[n].innerHTML),e[n].type="text/tailwindcss";const s=document.querySelectorAll('style[type="text/scss"]');for(n=0;n<s.length;n++)s[n].innerHTML=await t(s[n].innerHTML),s[n].type="text/css"}));
AIO={};
AIO.loadSCSS = async(url)=>{const t=t=>new Promise(((e,n)=>Sass.compile(t,(t=>{0==t.status?e(t.text):n(t.formatted)}))));var x=document.createElement('style');x.innerHTML=await t(await (await fetch(url)).text());document.head.appendChild(x);};
</script>
@teknixstuff
teknixstuff / database.js
Created June 15, 2022 14:38
JS database
function Database(...cols) {
const arrayEquals = (a1,a2)=>a1.every(e=>a2.includes(e))&&a2.every(e=>a1.includes(e));
var databaseRaw = [];
var database = new Proxy(databaseRaw,{
set(obj, prop, val) {
if (!(Number.isInteger(Number(prop)) && Number(prop) > 0)) {
return Reflect.set(obj, prop, val);
}
if (typeof val !== 'object') {
throw new TypeError('Database entry must be an object.');
d-i debian-installer/local string en_GB.UTF-8
d-i debian-installer/language string en
d-i debian-installer/country string GB
d-i keyboard-configuration/xkb-keymap select gb
d-i keyboard-configuration/toggle select No toggling
d-i hw-detect/load_firmware boolean true
d-i mirror/protocol string http