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
// Load Ember into the global scope by requiring it | |
require('ember'); | |
// Go have fun | |
var app = Ember.Application.create(); |
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
// browserify | |
var browserify = require('browserify'); | |
var es6ify = require('es6ify'); | |
// gulp stuff | |
var gulp = require('gulp'); | |
var livereload = require('gulp-livereload'); | |
var source = require('vinyl-source-stream'); | |
var jshint = require('gulp-jshint'); | |
var livereload = require('gulp-livereload'); | |
var watch = require('gulp-watch'); |
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
//1) Given two arrays (e.g. 'red' and 'black'), interleave them into one array which has alternating red and black until one runs out, then the remaining elements of the other color. | |
// where black.length is shorter | |
// var red = ["red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red"]; | |
// var black = ["black","black","black","black","black","black","black","black","black","black","black","black","black","black",]; | |
// where red.length is shorter | |
var red = ["red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red","red"]; | |
var black = ["black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","blac |
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 http = require('http'); | |
var url = require('url'); | |
var items = ["mow the lawn", "do the dishes", "scoop the litter box"]; | |
var completed = []; | |
var server = http.createServer(function (req, res) { | |
var pathRequested = url.parse(req.url, true).pathname; | |
console.log(pathRequested); |
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 http = require('http'); | |
// var contact = {"name": "Ben", "age": 31}; | |
var server = http.createServer(function (req, res) { | |
var outputString = ''; | |
req.setEncoding('utf8'); |
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 fruits = { | |
apple: "apple", | |
orange: "orange", | |
fruitAction: function (nameOfAction, cb) { | |
console.log("you ran " + nameOfAction); | |
var callB = cb.bind(this); | |
callB(); | |
} | |
} |
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
/* | |
* Angular JS Multi Select | |
* Creates a dropdown-like button with checkboxes. | |
* | |
* Project started on: Tue, 14 Jan 2014 - 5:18:02 PM | |
* Current version: 2.0.1 | |
* | |
* Released under the MIT License | |
* -------------------------------------------------------------------------------- | |
* The MIT License (MIT) |
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 path = require('path'); | |
var net = require('net'); | |
var multilevel = require('multilevel'); | |
var level = require('level'); | |
exports.register = function (server, options, next) { | |
var dbClient, con; | |
var db = level(options.dbPath, { | |
valueEncoding: 'json', |
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
// main.js | |
const vel = require('vel') | |
const testElement = require('./test-element') | |
const el = vel(function (h, state) { | |
return <div> | |
<h1>clicked {String(state.n)} times</h1> | |
<button onclick={onclick}>click me!</button> | |
{testElement(h, state, el)} |
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
const users = [{name: 'Ben', age: 32}, {name: 'Nina', age: 31}] | |
const agedUsers = users.map(user => Object.assign({}, user, {age: user.age + 1})) | |
const addUser = (currentUsers, newUser) => [newUser, ...currentUsers] | |
const updatedUserList = addUser(agedUsers, {name: 'Jack', age: 2}) | |
console.log(updatedUserList) |
OlderNewer