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
[{"id":1,"level":3,"word":"anguine","definition":"snakelike"}, | |
{"id":2, "level":1,"word":"cardinal","definition":"of fundamental importance"}, | |
{"id":3, "level":3,"word":"detersion","definition":"act of cleansing"}, | |
{"id":4, "level":3,"word":"exiguous","definition":"meager"}, | |
{"id":5, "level":2,"word":"fraternise","definition":"associate with"}, | |
{"id":6, "level":2,"word":"masticate","definition":"chew"}, | |
{"id":7, "level":2,"word":"prognosticate","definition":"predict"}, | |
{"id":8, "level":2,"word":"abscond","definition":"leave hurriedly"}, | |
{"id":9, "level":2,"word":"accoutrements","definition":"personal clothing and accessories"}, | |
{"id":10,"level":1,"word":"dollop","definition":"shapeless mass"}, |
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
// This will hang, and you'll never see "done" because it doesn't drain the `res` Readable Stream. | |
var http = require('http'); | |
var server = http.createServer(function (req, res) { | |
res.writeHead(404); | |
res.end(); | |
}); | |
server.listen(3000, function () { | |
http.get('http://localhost:3000/', function (res) { |
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 constants = require('../constants'); | |
var ChirpStore = module.exports = require('./store').extend({ | |
init: function () { | |
this.bind(constants.RECEIVE_CHIRPS, this.loadChirps); | |
this.bind(constants.CREATED_CHIRP, this.loadChirps); | |
}, | |
loadChirps: function (data) { | |
data = ({}).toString.call(data).indexOf('Array') > 0 ? data : [data]; | |
data.forEach(ChirpStore.add.bind(ChirpStore)); |
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
'use strict'; | |
var db = require('mongoose').connection; | |
var credential = require('credential'); | |
var User = require('./models/user'); // the mongoose model | |
exports.createUser = function createUser(userAttrs, callback) { | |
db.once('open', function () { | |
User.findOne({ username: userAttrs.username }, 'username', function (err, person) { | |
if (err) return callback(err); | |
if (person) { |
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 test = require('tape'); | |
var execSync = require('child_process').execSync; | |
test('ls', function (t) { | |
var output = execSync('ls').toString(); | |
t.equal(output, 'node_modules\ntest.js\n'); | |
t.end(); | |
}); |
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 array = ["one", "two", "three", "four", "five"]; | |
document.writeln(array + "<br />"); | |
var newArray = shuffle(array); | |
document.writeln(newArray); | |
function shuffle (arr) { | |
var copy = arr.concat(), |
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
sample gist |
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
(function ($) { | |
$.fn.chromeFade = function (opts) { | |
var defs = { msTilFade : 2000, fadeSpeed : 500, fadeTo : 0.01 }, | |
sets = $.extend({}, defs, opts), | |
elems = this, | |
fadeFunc = function () { | |
elems.fadeTo(sets.fadeSpeed, sets.fadeTo); | |
}, | |
fadeTimer = setTimeout(fadeFunc, sets.msTilFade); | |
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>Page Title some change </title> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script> | |
</head> | |
<body> |
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 myObj = (function () { | |
var data = { | |
products : ["foobar", "bazquirk", "gizmo"], | |
services : ["widgets", "other", "last"] | |
}; | |
return { | |
__noSuchMethod__ : function (id, args) { | |
if (id === 'all_products') return data.products; | |
if (id === 'all_services') return data.services; |
OlderNewer