Skip to content

Instantly share code, notes, and snippets.

M. Andrew Darts Mandrewdarts

Block or report user

Report or block Mandrewdarts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Mandrewdarts
Mandrewdarts / separate.js
Created Mar 12, 2019
Separate function that takes in an array and a list of predicates to separate the array.
View separate.js
const separate = (a, ...predicates) => {
const p = [];
predicates.forEach((pred, i) => {
const res = a.filter(pred);
if(res && !p[i]) {
p[i] = [];
}
if (res) {
p[i] = [...p[i], res];
}
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@Mandrewdarts
Mandrewdarts / classnames.js
Created Dec 28, 2016
Utility function for composing class lists
View classnames.js
function classnames(...classes) {
const Classes = classes.reduce((prev, item) => {
if (typeof item === 'object') {
let c = Object.keys(item)
.filter(inneritem => item[inneritem] === true)
let res = prev.concat(c)
@Mandrewdarts
Mandrewdarts / image-loader.js
Last active Dec 12, 2016
Image Loader Element
View image-loader.js
class ImageLoader extends HTMLElement {
constructor() {
super();
this.styles = { '-webkit-filter': 'blur(10px)', 'filter': 'blur(10px)' };
}
createdCallback() {
You can’t perform that action at this time.