Skip to content

Instantly share code, notes, and snippets.

Dustan Kasten iamdustan

Block or report user

Report or block iamdustan

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
@iamdustan
iamdustan / restore-form.js
Created Nov 21, 2018
Automatically saves and restores form data on a page. Written for Webflow.com custom code integration.
View restore-form.js
<script>
(() => {
const debounce = (fn) => {
let timeout;
let arg;
const later = () => {
timeout = null;
fn(arg);
arg = null;
};
View README.md

Setup

Array length of 131,027 items.

let videos = [{
  "id": 65432445,
  "title": "The Chamber"
}, {
@iamdustan
iamdustan / rollup.config.js
Created Apr 4, 2017
rollup with react-reason starter repo
View rollup.config.js
var rollup = require('rollup').rollup;
var commonjs = require('rollup-plugin-commonjs');
var nodeResolve = require('rollup-plugin-node-resolve');
var replace = require('rollup-plugin-replace');
const entry = 'simple/simpleRoot';
const results = [];
const dest = 'bundle.js';
const ENV = 'development';
// const ENV = 'production';
@iamdustan
iamdustan / error.log
Last active Dec 19, 2016
Flow union functions?
View error.log
result.js:17
17: callback(null, {value: Math.random()});
^^^^ null. This type is incompatible with the expected param type of
14: callback : ResultCallback<V, E>
^ Error
result.js:19
19: callback(new Error('Lolnope'));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function call
19: callback(new Error('Lolnope'));
View gist:58088fea51752b8abce0e85e6520a4f3
import scriptjs from 'scriptjs';
const scripts = {};
const withScript = (script, Comp) => {
class WithScript extends React.Component {
state = {
ready: !!scripts[script]
};
componentDidMount() {
View watson.sh
#!/usr/bin/env node
/**
* This script will generate a JavaScript program to interact with the IBM
* Watson API. Try it out yourself!
*
* ```
* $ git clone https://gist.github.com/2e36a440b5702e14376bfba56d303427.git watson
* $ cd watson
* $ chmod +x watson.sh
* $ ./watson.sh > output.js
View hello_world.re
/* Converting https://github.com/rgrinberg/opium#hello-world to Reason */
open Opium.Std;
type person = {
name: string,
age: int,
};
let json_of_person {name, age} => Ezjsonm.(dict [("name", string name), ("age", int age)]);
View incremental-reconciler.md

Half-baked thoughts on React’s Incremental Reconciler

Both React’s incremental reconciler and Angular’s digest cycle have the property that additional work will be scheduled outside of the consumers control.

Arguably with React this has always been true and the incremental reconciler is simply another layer for scheduling work.

To date, React’s reconciler has been an implementation detail that I’ve never had to consider while developing applications. Neither have I ever heard someone

View incremental-reconciler.md

Half-baked thoughts on React’s Incremental Reconciler

Both React’s incremental reconciler and Angular’s digest cycle have the property that additional work will be scheduled outside of the consumers control.

Arguably with React this has always been true and the incremental reconciler is simply another layer for scheduling work.

To date, React’s reconciler has been an implementation detail that I’ve never had to consider while developing applications. Neither have I ever heard someone

You can’t perform that action at this time.