Skip to content

Instantly share code, notes, and snippets.

@pentaphobe
pentaphobe / l-system.evy
Created November 15, 2023 12:20
L-System example in evylang
pi := 3.14159
// --- starting position and size of the tree
// trunk length
startSize := 30
// pointing upwards!
startAngle := radians 90
// --- specifies the tree colours
rootColor := {hue:25 sat:64 light:20}
@pentaphobe
pentaphobe / README.md
Last active December 1, 2019 11:02
Testing compiled array functions in JS

Picked up an old experiment which is so far somewhat promising

Background

I love the sugar of using map/filter/reduce type functions on arrays, but the old-school owner of a 286 machine is bothered by the implied nested loops they incur

The experiment was simply:

at least filter and map should be able to be compiled into a single loop

Keybase proof

I hereby claim:

  • I am pentaphobe on github.
  • I am pentaphobe (https://keybase.io/pentaphobe) on keybase.
  • I have a public key ASAs58BXpQtHBLzJS2i_HCeFqEcvZUk_q2Gx8ahVyDwSgQo

To claim this, I am signing this object:

@pentaphobe
pentaphobe / first.js
Created April 27, 2018 01:55
accessibility outline solution thoughts
/**
* Assumes all elements have had outline style removed
*/
;(() => {
let accessibilityMode = false;
let oldOutlineStyle;
let lastModifiedElement;
let mouseTimeoutHandle;
@pentaphobe
pentaphobe / remark.md
Last active March 23, 2018 05:51
Remark slideshow test

Intro

  1. Write slides in markdown in a gist
  2. Get a development link to your gist from rawgit
  3. Use remarkise to view it
  4. ???

Showing source

import {flowRight, set} from 'lodash-fp'
const foo = (obj) => flowRight(
set('noodles', 'yes please'),
({a, b, c}) => {
console.log(a,b,c);
return obj
}
)
@pentaphobe
pentaphobe / ads-declarative.js
Created September 27, 2017 03:58
Integration test files
'use strict';
// here is where we'd bring in our glue library
//
// (this is just a placeholder for same)
let ADS_COMPONENT = `data-ads-component`;
let E_DEPENDENCY = 'Either include as an external script, or as a bundled dependency';
let E_NO_REACT = 'No React found.';
'use strict';
var _templateObject = _taggedTemplateLiteral(['\n @media screen and (min-width: 980px){\n ', '\n }\n '], ['\n @media screen and (min-width: 980px){\n ', '\n }\n ']),
_templateObject2 = _taggedTemplateLiteral(['\n @media screen and (min-width: 768px) {\n ', '\n }\n '], ['\n @media screen and (min-width: 768px) {\n ', '\n }\n ']),
_templateObject3 = _taggedTemplateLiteral(['\n @media screen and (min-width:480px) {\n ', '\n }\n '], ['\n @media screen and (min-width:480px) {\n ', '\n }\n ']),
_templateObject4 = _taggedTemplateLiteral(['\n *, ::after, ::before {\n box-sizing: border-box;\n }\n\n body {\n margin: 0;\n font-family: \'myriad-pro\', sans-serif;\n color: ', ';\n -webkit-font-smoothing: antialiased;\n min-width: 320px;\n }\n\n a {\n color: ', ';\n text-decoration: none;\n\n &:hover,\n &:focus {\n text-decoration: underl
@pentaphobe
pentaphobe / zipInterleaved.js
Last active August 1, 2017 10:37
ZIP interleaved array into object
function zipInterleaved(arr) {
return arr.reduce( (prev, cur, idx) => {
if (idx % 2 == 0) {
return {obj:prev, key:cur};
} else {
let obj = prev.obj;
obj[prev.key] = cur;
return prev.obj;
}
}, {});
@pentaphobe
pentaphobe / matchAll.js
Created August 1, 2017 10:27
JS regex matchAll
'use strict';
function matchAll(re, str) {
let result = [], tmp;
while ( (tmp = re.exec(str)) !== null ) {
tmp.shift();
result = result.concat(tmp);
}
return result;
}