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'; | |
| var fs = require('fs'), | |
| path = require('path'), | |
| hogan = require('hogan'); | |
| var adapter = (function() { | |
| var dir = 'templates', | |
| partials_dir = dir + '/partials', | |
| extension = '.hogan', | |
| partials = {}, |
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
| Convert Unix time in seconds to a fuzzy timestamp since the current time: 4s, 9m, 2d, 1m, etc. | |
| var fuzzy_time = function (a) { | |
| var b = new Date, | |
| c = parseInt(((b.getTime() / 1e3) - a), 10), | |
| d = ""; | |
| return c < 60 ? d = c + "s" : c < 120 ? d = "1m" : c < 2700 ? d = parseInt(c / 60, 10).toString() + "m" : c < 7200 ? d = "1h" : c < 86400 ? d = "" + parseInt(c / 3600, 10).toString() + "h" : c < 172800 ? d = "1d" : d = parseInt(c / 86400, 10).toString() + "d", d | |
| } |
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 extend = function (object) { | |
| var index, result = object; | |
| if (!object) return result; | |
| for (var source, sourceIndex = 1, length = arguments.length; sourceIndex < length; sourceIndex++) { | |
| source = arguments[sourceIndex]; | |
| var skipProto = typeof source == 'function'; | |
| for (index in source) { | |
| if (!(skipProto && index == 'prototype')) { | |
| object[index] = source[index]; | |
| } |
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
| //binary search | |
| var search = function(array, i) { | |
| var min = 0, | |
| max = array.length - 1, | |
| mid = Math.floor((min + max)/ 2); | |
| while (max >= min) { | |
| if(array[mid] < i) { | |
| min = mid + 1; | |
| } else if(array[mid] > i) { |
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 fs = require('fs'), | |
| path = require('path'), | |
| hogan = require('hogan.js'); | |
| var dir = 'templates', | |
| partials_dir = dir + '/partials', | |
| extension = '.hogan', | |
| partials = {}; | |
| //cache partials |
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
| description "My NodeJS Server" | |
| author "Nathan Rajlich" | |
| # Upstart has nothing in $PATH by default | |
| env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| # Keep the server running on crash or machine reboot | |
| respawn | |
| start on runlevel [23] |
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
| require.config({ | |
| name: 'libs/almond/almond', | |
| baseUrl: '/js/', | |
| paths: { | |
| 'lodash' : 'libs/lodash/lodash', | |
| 'Backbone' : 'libs/backbone/backbone', | |
| 'Hogan' : 'libs/hogan/hogan', | |
| 'App' : 'views/App', | |
| 'SessionView' : 'views/Session', | |
| 'SessionModel' : 'models/Session', |
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
| #!/bin/bash | |
| #mac osx / system with netcat in path | |
| #echo "flush_all" | nc localhost 11211 | |
| #other means | |
| #telnet localhost 11211; | |
| #flush_all; | |
| #exit; |
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
| class EventEmitter | |
| def initialize() | |
| @callbacks = {} | |
| end | |
| def on(event, &callback) | |
| @callbacks[event] ||= [] | |
| @callbacks[event].push(callback) | |
| end |
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> | |
| <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
| <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
| <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
| <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
| <title></title> | |
| <meta name="description" content=""> |
OlderNewer