Skip to content

Instantly share code, notes, and snippets.

View stivenson's full-sized avatar
🏠
Working from home

Stivenson stivenson

🏠
Working from home
View GitHub Profile
@stivenson
stivenson / app.js
Created May 13, 2017 06:30 — forked from tobyzerner/app.js
Mithril ES6 Components
import Component from './component';
class Widget extends Component {
init(ctrl) {
var props = this.props;
ctrl.counter = props.initialValue;
ctrl.increment = function() {
ctrl.counter++;
@stivenson
stivenson / account.js
Created May 12, 2017 16:07 — forked from fernandez14/account.js
Mithril 1.x component example.
import m from 'mithril';
import stream from 'mithril/stream';
import {Button} from '../../ui';
import {Account} from '../../models';
export const FormAccountPublicPage = {
oninit(vnode) {
this.loading = true;
this.saving = false;
this.errors = false;
@stivenson
stivenson / 1-sleep-es7.js
Created May 1, 2017 02:40 — forked from danharper/1-sleep-es7.js
ES7's async/await syntax.
// ES7, async/await
function sleep(ms = 0) {
return new Promise(r => setTimeout(r, ms));
}
(async () => {
console.log('a');
await sleep(1000);
console.log('b');
})()
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@stivenson
stivenson / fillfortesting.js
Last active August 12, 2016 17:13 — forked from jonkemp/prepopulate.html
Fill your forms with random data. For testing forms. Requires jQuery.
$( function() {
$('form').find('input:text').val( function(i, val) {
return randomText();
});
$('form').find('input[type="number"]').val( function(i, val) {
return randomInt();
});