Skip to content

Instantly share code, notes, and snippets.

View garbles's full-sized avatar
🇨🇦

Gabe garbles

🇨🇦
View GitHub Profile
import {sample, sampleOne} from 'babel-plugin-transform-flow-to-gen/api';
type Person = {
name: string,
age: number
}
// creates a generator
const personGen = Person();
{
"presets": ["es-2015"],
"plugins": ["syntax-flow"],
"env": {
"development": {
"plugins": ["strip-flow-types"]
},
"test": {
"plugins": ["flow-to-gen", "strip-flow-types"]
}
// From http://stackoverflow.com/questions/11381673/javascript-solution-to-detect-mobile-browser#answer-13819253
var isMobile = {
Android: navigator.userAgent.match(/Android/i),
BlackBerry: navigator.userAgent.match(/BlackBerry/i),
iOS: navigator.userAgent.match(/iPhone|iPad|iPod/i),
Opera: navigator.userAgent.match(/Opera Mini/i),
Windows: navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i)
};
@garbles
garbles / BaseStore.js
Created December 23, 2014 01:34
Base Store class with ES6 and CommonJS for Flux
let EventEmitter = require('events').EventEmitter;
const CHANGE_EVENT = 'CHANGE_EVENT';
class BaseStore extends EventEmitter {
emitChange () {
this.emit(CHANGE_EVENT);
}
addChangeListener (callback) {
@garbles
garbles / shadow-root.html
Last active August 29, 2015 14:08
Example directive for creating elements wrapped in a `#shadow-root`
<shadow-root style="app/styles/isolated-styles.css">
<div some-directive></div>
</shadow-root>