A Pen by Alfred Westerveld on CodePen.
This file contains hidden or 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"; | |
| const Queue = module.exports = function () { | |
| this.queue = [] | |
| this.awaiting = [] | |
| } | |
| Queue.prototype = { | |
| take: function () { | |
| let queue = this.queue, |
This file contains hidden or 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" | |
| const readLine = require ("readline") | |
| const options = { | |
| input: process.stdin, | |
| output: process.stdout | |
| } | |
| const rl = readLine.createInterface (options) | |
| const onSIGINT = function () { | |
| console.log('sigint') |
This file contains hidden or 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
| // With a perfectly even distribution | |
| // http://stackoverflow.com/a/1527820/11926 | |
| function getRandomInt(min, max) { | |
| return Math.floor(Math.random() * (max - min + 1)) + min | |
| } |
This file contains hidden or 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
| #!/usr/bin/env node | |
| function quit(status) { | |
| process.exit(status || 0); | |
| } | |
| function print(s) { | |
| console.log('%s', s); | |
| } |
This file contains hidden or 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
| /*jslint node: true, maxerr: 50, indent: 4 */ | |
| (function () { | |
| "use strict"; | |
| var EventEmitter = require('events').EventEmitter, | |
| Queue = module.exports = function Queue() { | |
| /* Constructor is doing work..?? | |
| */ | |
| var _emitter = this._emitter = new EventEmitter(), | |
| _awaiting = this._awaiting = [], |
This file contains hidden or 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 express = require('express'), | |
| app = express.createServer(), | |
| sio = require('socket.io'), | |
| redis = require("redis"), | |
| client = redis.createClient(), | |
| io = null; | |
| /** | |
| * Used to parse cookie | |
| */ |
This file contains hidden or 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
| Directory layout | |
| ---------------- | |
| app.js | |
| views/layout.jade | |
| views/home.jade | |
| Configure | |
| ----------------- | |
| Setup settings at Facebook and FacebookId and FacebookSecret in app.js. Also make sure you map `Site URL` correctly at Facebook and in app.js. |
This file contains hidden or 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
| // app.js | |
| var express = require('express'), | |
| app = express.createServer(), | |
| RedisStore = require('connect-redis'), | |
| redis = require('redis'), | |
| client = redis.createClient(); | |
| var auth = require('connect-auth'); | |
| var userStrategy = require('./userStrategy'); |
This file contains hidden or 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 lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>jQuery UI Autocomplete - Default functionality</title> | |
| <link rel="stylesheet" href="jquery-ui-1.8.9.custom/css/ui-lightness/jquery-ui-1.8.9.custom.css"> | |
| <script src="jquery-ui-1.8.9.custom/js/jquery-1.4.4.min.js"></script> | |
| <script src="jquery-ui-1.8.9.custom/js/jquery-ui-1.8.9.custom.min.js"></script> | |
| <script> | |
| $(function() { |