Skip to content

Instantly share code, notes, and snippets.

@jaredhanson
jaredhanson / gist:3989193
Created October 31, 2012 19:13
Node Knockout 2012 - Getting Started with Passport
var express = require('express'),
passport = require('passport'),
TwitterStrategy = require('passport-twitter').Strategy,
ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn,
app = express();
app.use(express.static(__dirname + '/public'));
app.use(express.cookieParser());
app.use(express.session({ secret: 'keyboard cat' }));
app.use(passport.initialize());
@anantn
anantn / datachannels.js
Created October 31, 2012 22:48
Data Channel Example
/**
* Assume we've connected a PeerConnection with a friend - usually with audio
* and/or video. For the time being, always at least include a 'fake' audio
* stream - this will be fixed soon.
*
* connectDataConnection is a temporary function that will soon disappear.
* The two sides need to use inverted copies of the two numbers (eg. 5000, 5001
* on one side, 5001, 5000 on the other)
*/
pc.connectDataConnection(5001, 5000);
@quandyfactory
quandyfactory / Red Fedora
Created November 2, 2012 15:30
A very cheesy parody of Red Barchetta.
My uncle has a country place
That no one knows about
It used to be a server farm
Before the Data Law
And on Sundays I elude the Eyes
And hop the Turbine Freight
To Far outside the Lockdown Web
Where my white-haired uncle waits
@DavidBruant
DavidBruant / gist:4066406
Created November 13, 2012 15:39
Figure out max vibration value
"use strict";
(function(global){
if(typeof global.navigator.vibrate === 'function')
return;
var MAX = Math.floor(1000000*Math.random());
console.log('MAX', MAX);
@boblemarin
boblemarin / dabblet.css
Created December 4, 2012 14:58 — forked from Aqro/dabblet.css
Filters, filters everywhere. (c) aqro
/**
* Filters, filters everywhere. (c) aqro
*/
* {margin: 0; padding: 0;}
html, body {height: 100%; width: 100%;}
body {
overflow: hidden;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
@addyosmani
addyosmani / pubsub.js
Created December 5, 2012 16:04
Pub/Sub latest
/*
A basic implementation of the Publisher/Subscriber design pattern.
Developed by @addyosmani and @integralist
Example Usage:
// Create subscriber function to be called when topic publishes an event
var testSubscriber = function (topics, data) {
console.log(topics + ': ' + data);
};
@zhchbin
zhchbin / index.html
Created February 10, 2013 10:55
Node-Webkit API Demo: Window.capturePage
<html>
<body style="background: #333">
<script >
var gui = require('nw.gui');
var win = gui.Window.get();
function takeSnapshot() {
win.capturePage(function(img) {
var popWindow = gui.Window.open('popup.html',
{width: 420, height: 300});
popWindow.on('loaded', function() {
@erichonorez
erichonorez / rest_api.js
Created February 10, 2013 19:09
A simple REST API with Node.js and Express
/**
* TaskRepository class deals with task persistence
*/
function TaskRepository() {
this.tasks = [];
this.nextId = 1;
}
/**
* Find a task by id
* Param: id of the task to find
@19h
19h / reset.js
Created February 19, 2013 22:51
Node.js — Clear Terminal / Console. Reset to initial state.
console.reset = function () {
return process.stdout.write('\033c');
}
@max-mapper
max-mapper / readme.md
Last active January 28, 2024 18:11
How-to: Write a node module with voxel.js

Writing node modules with voxel.js

This is a short guide that will teach you the workflows that have been figured out by the voxel.js community for writing node modules + sharing them on NPM and Github. It is assumed that you have a basic understanding of JavaScript, github and the command line (if not you can check out an introduction to git and the command line or learn JS basics from JavaScript for Cats)

The voxel-tower repository on github contains all the example code from this guide.

Table of contents