Skip to content

Instantly share code, notes, and snippets.

View ashwell's full-sized avatar

Ryan Bogle ashwell

View GitHub Profile
@ashwell
ashwell / Todo.tsx
Last active December 12, 2022 11:51
Todo
interface Todo {
thing: string;
done: boolean;
}
interface TodoProps {}
export function Todo(props: TodoProps) {
const todos = [];
@ashwell
ashwell / curry.js
Last active June 5, 2019 21:41
Simple Curry in JS
export function curry( fn, arity = fn.length ) {
let args = [];
return function curriedFn( ...newArgs ) {
args = [ ...args, ...newArgs ];
if ( args.length >= arity ) {
return fn( ...args );
}

Keybase proof

I hereby claim:

  • I am ashwell on github.
  • I am ashwe1l (https://keybase.io/ashwe1l) on keybase.
  • I have a public key ASB2ErWRJOIZGGbfLCnD8idFVpDEaCQAy20ZpZ55NzLCSAo

To claim this, I am signing this object:

class SimpleMath {
constructor( n ) {
this.n = n;
}
static given( n ) {
return new SimpleMath( n );
}
@ashwell
ashwell / index.html
Created November 24, 2015 04:42 — forked from anonymous/index.html
JS Bin Fullscreen Coding Challenge // source https://jsbin.com/pogere
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="description" content="Fullscreen Coding Challenge">
<title>JS Bin</title>
<script src="https://cdn.rawgit.com/zloirock/core-js/master/client/shim.min.js"></script>
<style id="jsbin-css">
.vertical-form-group label,
.vertical-form-group select,
@ashwell
ashwell / flatten.js
Last active January 28, 2016 22:45
Flatten with Generators
export default function flatten(arrayOfArrays=[]){
function* flatgen() {
for( let item of arrayOfArrays ) {
if ( Array.isArray( item )) {
yield* flatten(item)
} else {
yield item
}
}
@ashwell
ashwell / create-event.js
Last active May 5, 2016 03:46
Cross platform event creation (ES6)
'use strict';
var
tmpEvent,
createEvent,
createWithConstructor,
createWithInit;
createWithConstructor = function( name, descriptor ) {
return new CustomEvent( name, descriptor );
};