Skip to content

Instantly share code, notes, and snippets.

View lancejpollard's full-sized avatar
🐢
Code

Lance Pollard lancejpollard

🐢
Code
View GitHub Profile
@lancejpollard
lancejpollard / lex.js
Created September 22, 2012 03:09 — forked from tj/lex.js
/**
* Scan the given `str` returning tokens.
*
* @param {String} str
* @return {Array}
* @api public
*/
module.exports = function(str) {
var indents = [0]
@lancejpollard
lancejpollard / preflightApi.js
Created September 20, 2012 17:14 — forked from j-mcnally/preflightApi.js
Express Middleware for CORS access.
module.exports = function preflightApi(){
return function preflightApi(req, res, next){
//this is where the magic happens
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, OPTIONS');
res.header('Access-Control-Allow-Headers', 'User-Agent, Accept-Language, Accept-Encoding, Accept-Charset, Connection, Content-Length, Origin, Pragma, Accept-Charset, Cache-Control, Accept, Content-Type, Sessionid');
res.header('Access-Control-Max-Age', '1000');
@lancejpollard
lancejpollard / lyrics.rb
Created September 10, 2012 20:55 — forked from clarkware/lyrics.rb
Random Lyrics
#!/usr/bin/env ruby
# API Documentation at http://api.wikia.com/wiki/LyricWiki_API
require 'open-uri'
require 'json'
require 'tmpdir'
ARTIST = "Johnny Cash"
@lancejpollard
lancejpollard / gist:3586229
Created September 1, 2012 20:26 — forked from edubkendo/gist:3585506
Sublime Text Plugins
Aug 30 11:02:59 <e_dub> luckysmack, what editor do you use?
Aug 30 11:03:31 <luckysmack> for basic stuff I use sublime text. but my main ide is idea.
Aug 30 11:03:47 <e_dub> https://github.com/wuub/SublimeREPL
Aug 30 11:03:55 <luckysmack> http://www.jetbrains.com/idea/http://www.jetbrains.com/idea/
Aug 30 11:04:15 <e_dub> coffeescript REPL with syntax highlighting and autocompletion , etc
Aug 30 11:04:25 <luckysmack> oh ive seen that before. but never really looked at it.
Aug 30 11:04:34 <luckysmack> nice
Aug 30 11:05:07 <e_dub> it works like a charm, of course I already use sublime's ability to run arbitrary code, build stuff, etc, but this is really sweet
@lancejpollard
lancejpollard / admin.html
Created August 21, 2012 23:47 — forked from kmiyashiro/admin.html
Mocha HTML spec
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="mocha"></div>
<script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script>
@lancejpollard
lancejpollard / dev_view.coffee
Created August 21, 2012 09:25 — forked from charlesjolley/dev_view.coffee
Adding event locks to Ember
# example view implements a simple dragging for mouse events.
Wall.DevView = Ember.View.extend
mouseDown: (ev) ->
ev.dispatcher.lock @, 'mouseMove', 'mouseUp'
@_mouseDown = @$().offset()
@_mouseDown.pageX = ev.pageX
@_mouseDown.pageY = ev.pageY
@_mouseDown.dispatcher = ev.dispatcher
console.log 'mouseDown'
eric@edub:~/projects/projects/experiments  $ tower new myApp
path.existsSync is now called `fs.existsSync`.
   create : myApp/.gitignore
   create : myApp/.npmignore
   create : myApp/.slugignore
   create : myApp/Cakefile
   create : myApp/app/client/config/bootstrap.coffee
   create : myApp/app/client/stylesheets/application.styl
   create : myApp/app/client/controllers/applicationController.coffee
@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 <[email protected]>",
"keywords": [
"framework",
"rails",
@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 / 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) {