Skip to content

Instantly share code, notes, and snippets.

View lancejpollard's full-sized avatar
😍
Lots of coding

Lance Pollard lancejpollard

😍
Lots of coding
View GitHub Profile
@lancejpollard
lancejpollard / gist:1086568
Created July 16, 2011 17:28
Kramdown+Albino(Pygments)でハイライト
require "rubygems"
require "kramdown"
require "albino"
class Kramdown::Parser::AlbinoKramdown < Kramdown::Parser::Kramdown
def replace_code(code, ptrn, f = false)
if /\A\|(.+?)(!?)\|(?!\Z)/ =~ code then
lang = $1
run = $2
@lancejpollard
lancejpollard / GridModel.coffee
Created August 24, 2011 04:49 — forked from d4tocchini/GDOM.coffee
JQML Responsive Grid API demo
class GridModel extends RW.Model
defaults:
area:
selector: '.G_area'
dimensions: ['h', 'v']
h:
unit: null
count: 12
gutter: 20
@lancejpollard
lancejpollard / data-markdown.user.js
Created November 8, 2011 19:09 — forked from paulirish/data-markdown.user.js
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.
@lancejpollard
lancejpollard / .gitignore
Created March 23, 2012 09:28 — forked from mbleigh/.gitignore
MongoMapper::TokenKeys, a simple way to generate tokens for MongoMapper models.
Gemfile.lock

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route "/",
/**
* A `tail -f` implementation in Node.js.
*
* Bratish Goswami
* bratishgoswami AT gmail DOT com
*
*/
var sys = require("sys"),
fs = require('fs'),
@lancejpollard
lancejpollard / Procfile
Created June 25, 2012 22:31 — forked from todoubled/Procfile
Getting Kue working on Heroku
web: node app.js
worker: node consumer.js
@lancejpollard
lancejpollard / hello-node.js
Created July 7, 2012 08:54 — forked from nf/hello-node.js
Hello world web server that scales across multiple processors
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {
@lancejpollard
lancejpollard / gist:3198254
Created July 29, 2012 12:12 — forked from danparsons/gist:3195652
How to stream the London 2012 Olympics

How to stream the London 2012 Olympics

There have been several HOWTOs posted regarding streaming the 2012 Olympics using HTTP / SOCKS proxies via SSH and other similar methods. None of these actually work using the latest Flash on Mountain Lion (with Firefox, Chrome or Safari). Additionally, the third-party streaming sites don't provide BBC's amazing interface, which lets you quickly skip to individual competitors and events. However, setting up an OpenVPN server does work, with some tweaks. You'll get the exact same UX that people in England receive.

@lancejpollard
lancejpollard / package.json
Created August 4, 2012 08:29 — forked from edubkendo/package.json
package.json that works when installing tower/development
{
"name": "tower",
"version": "0.4.1",
"description": "Full Stack Web Framework for Node.js and the Browser",
"homepage": "http://viatropos.github.com/tower",
"main": "./index.js",
"author": "Lance Pollard <lancejpollard@gmail.com>",
"keywords": [
"framework",
"rails",