Skip to content

Instantly share code, notes, and snippets.

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jboner
jboner / latency.txt
Last active April 27, 2024 16:42
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@PatrickHeneise
PatrickHeneise / gist:2132062
Created March 20, 2012 06:38
passport.js with flatiron.js, union and director
var flatiron = require('flatiron')
, connect = require('connect')
, path = require('path')
, fs = require('fs')
, plates = require('plates')
, director = require('director')
, util = require('util')
, keys = require('./auth_keys')
, passport = require('passport')
, TwitterStrategy = require('passport-twitter').Strategy
@steeleforge
steeleforge / index.js
Created September 27, 2011 19:03 — forked from iamnoah/index.js
Simple node.js webserver with logging. Serves whatever files are reachable from the directory where node is running. [support for Node for Windows]
/*
* Fork & Refactor of https://gist.github.com/246761
* -> Credit: Noah Sloan <http://noahsloan.com>
*/
/**
* Simple webserver with logging. Serves whatever files are reachable from
* the directory where node is running. Supports Windows port of node.
*/
var fs = require('fs'),
@jashkenas
jashkenas / gist:994057
Created May 26, 2011 20:53 — forked from steeleforge/gist:993924
SC 2.0a To-Do's coffee-script
Todos = SC.Application.create()
Todos.Todo = SC.Object.extend
title: null
isDone: false
Todos.todosController = SC.ArrayProxy.create
content: []
createTodo: (title) ->