This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var makeSealer = function () { | |
var users = [], passwords = []; | |
return { | |
sealer: function (username, password) { | |
var i = users.length, | |
user = {username: username}; | |
users[i] = user; | |
passwords[i] = password; | |
return user; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babel = require('babelify'); | |
function compile(watch) { | |
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sync: ( method, collection, options ) -> | |
content = localStorage.getItem( @url() ) if localStorage | |
if content and not navigator.onLine | |
options.success JSON.parse content | |
else | |
return Backbone.sync( method, collection, options ).done ( response ) => | |
localStorage.setItem( @url(), JSON.stringify( response ) ) if localStorage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add dataset support to elements | |
* No globals, no overriding prototype with non-standard methods, | |
* handles CamelCase properly, attempts to use standard | |
* Object.defineProperty() (and Function bind()) methods, | |
* falls back to native implementation when existing | |
* Inspired by http://code.eligrey.com/html5/dataset/ | |
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js ) | |
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below) | |
* All code below is Licensed under the X11/MIT License |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<div id="output_h"></div> | |
<div id="output_v"></div> | |
<script src="virtual-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modules | |
var lwip = require('lwip'), | |
path = require('path'), | |
fs = require('fs'), | |
rstream = require('stream').Readable; | |
// config | |
var placesPath = '/Users/apx/Downloads/places'; | |
// helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function() { | |
var v0 = new Vertex("0"); | |
var v1 = new Vertex("1"); | |
var v2 = new Vertex("2"); | |
var v3 = new Vertex("3"); | |
var v4 = new Vertex("4"); | |
var v5 = new Vertex("5"); | |
var v6 = new Vertex("6"); | |
var v7 = new Vertex("7"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = function() { | |
var v0 = new Vertex("0"); | |
var v1 = new Vertex("1"); | |
var v2 = new Vertex("2"); | |
var v3 = new Vertex("3"); | |
var v4 = new Vertex("4"); | |
var v5 = new Vertex("5"); | |
var v6 = new Vertex("6"); | |
var v7 = new Vertex("7"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with | |
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This | |
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise. | |
var gulp = require('gulp'), | |
spawn = require('child_process').spawn, | |
node; | |
/** | |
* $ gulp server | |
* description: launch the server. If there's a server already running, kill it. |
OlderNewer