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
bunyan = require 'bunyan' | |
restify = require 'restify' | |
requireDir = require 'require-dir' | |
middleware = requireDir './middleware' | |
routes = requireDir './routes' | |
settings = require './settings' | |
app = restify.createServer | |
name: 'Foo Bar API' |
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
// preserve Twitter's style of JSON string encoding... | |
// escape higher value unicode (lowercase hex) | |
// escape < and > (uppercase hex) | |
// escape / in strings (\/) | |
// hugs! https://gist.github.com/1306986 | |
// http://stackoverflow.com/questions/4901133/json-and-escaping-characters | |
function escapedStringify(s, emit_unicode) { | |
var json = JSON.stringify(s); | |
return emit_unicode ? json : json.replace(/\//g, | |
function(c) { |
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 express = require('express'), | |
requirejs = require('requirejs'), | |
app = module.exports = express.createServer(); | |
app.configure('development', function(){ | |
// Use development version of static files | |
app.use(express.static(__dirname + '/public')); | |
}); | |
app.configure('production', function(){ |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
// Usage: http://localhost:8080/image.jpg/100x50 | |
var http = require('http'); | |
var spawn = require('child_process').spawn; | |
http.createServer(function(req, res) { | |
var params = req.url.split('/'); | |
var convert = spawn('convert', [params[1], '-resize', params[2], '-']); | |
res.writeHead(200, {'Content-Type': 'image/jpeg'}); | |
convert.stdout.pipe(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
app.get('/', function(req, res){ | |
var ua = req.header('user-agent'); | |
if(/mobile/i.test(ua)) { | |
res.render('mobile.html'); | |
} else { | |
res.render('desktop.html'); | |
} | |
}); |
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
/* | |
* jQuery selectbox plugin | |
* | |
* Copyright (c) 2007 Sadri Sahraoui (brainfault.com) | |
* Licensed under the GPL license and MIT: | |
* http://www.opensource.org/licenses/GPL-license.php | |
* http://www.opensource.org/licenses/mit-license.php | |
* | |
* The code is inspired from Autocomplete plugin (http://www.dyve.net/jquery/?autocomplete) | |
* |
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
interval: function (duration, callback){ | |
var baseline = undefined; | |
return { | |
run: function() { | |
if( baseline === undefined ) { | |
baseline = new Date().getTime(); | |
} | |
callback(); | |
var end = new Date().getTime(); | |
baseline += duration; |
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 Interval(func,duration){ | |
if(typeof func !== "function") throw new TypeError("Expected function"); | |
else if(typeof duration !== "number") throw new TypeError("Expected number"); | |
this.func = func; | |
this.duration = duration; | |
this.baseline = +new Date(); | |
(function(_this){ | |
_this.timer = setTimeout(function(){ |
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 is a template .gitignore file for git-managed WordPress projects. | |
# | |
# Fact: you don't want WordPress core files, or your server-specific | |
# configuration files etc., in your project's repository. You just don't. | |
# | |
# Solution: stick this file up your repository root (which it assumes is | |
# also the WordPress root directory) and add exceptions for any plugins, | |
# themes, and other directories that should be under version control. | |
# | |
# See the comments +below for more info on how to add exceptions for your |
OlderNewer