Skip to content

Instantly share code, notes, and snippets.

View alfredwesterveld's full-sized avatar

Alfred Westerveld alfredwesterveld

View GitHub Profile
"use strict";
const Queue = module.exports = function () {
this.queue = []
this.awaiting = []
}
Queue.prototype = {
take: function () {
let queue = this.queue,
"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')
// With a perfectly even distribution
// http://stackoverflow.com/a/1527820/11926
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min
}
#!/usr/bin/env node
function quit(status) {
process.exit(status || 0);
}
function print(s) {
console.log('%s', s);
}
/*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 = [],
var express = require('express'),
app = express.createServer(),
sio = require('socket.io'),
redis = require("redis"),
client = redis.createClient(),
io = null;
/**
* Used to parse cookie
*/
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.
// 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');
<!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() {