Skip to content

Instantly share code, notes, and snippets.

View joemccann's full-sized avatar
💭
Thinking

Joe McCann joemccann

💭
Thinking
View GitHub Profile
(function ($) {
$.event.special.textchange = {
setup: function (data, namespaces) {
$(this).bind('keyup', $.event.special.textchange.handler);
$(this).bind('cut paste input', $.event.special.textchange.delayedHandler);
},
teardown: function (namespaces) {
#!/usr/bin/python2.4
import httplib, urllib, sys
# ('code_url', sys.argv[1]) if we wanted to actually pass in a value from command line -> say u wanted to compress a different file...
params = urllib.urlencode([
('code_url', 'http://github.com/getify/LABjs/raw/master/LAB.src.js'),
('compilation_level', 'SIMPLE_OPTIMIZATIONS'),
('output_format', 'text'),
('output_info', 'compiled_code'),
#!/usr/bin/python2.4
import httplib, urllib, sys
twitter_handle = 'joemccann'
params = urllib.urlencode([
('screen_name', twitter_handle)
])
function coda
{
codaPath='/Applications/Coda.app'
open -a $codaPath $1
}
svn st | grep "^?" | awk '{ print $2}' | while read f; do svn add "$f"; done
@joemccann
joemccann / gist:631328
Created October 17, 2010 21:42
Create local.properties file in the root of Android project where AndroidManifest.xml lives.
android update project -p ./
@joemccann
joemccann / nginx + node setup.md
Created October 25, 2010 02:06
Set up nginx as a reverse proxy to node.js.

The idea is to have nginx installed and node installed. I will extend this gist to include how to install those as well, but at the moment, the following assumes you have nginx 0.7.62 and node 0.2.3 installed on a Linux distro (I used Ubuntu).

In a nutshell,

  1. nginx is used to serve static files (css, js, images, etc.)
  2. node serves all the "dynamic" stuff.

So for example, www.foo.com request comes and your css, js, and images get served thru nginx while everything else (the request for say index.html or "/") gets served through node.

  1. nginx listens on port 80.
@joemccann
joemccann / bitly-node.md
Created October 26, 2010 13:59
Bitly shortening from the command line with node, motherfuckers.
@joemccann
joemccann / git-rm-all.sh
Created October 26, 2010 23:47
Remove all removed/deleted files from git repo.
for i in `git status | grep deleted | awk '{print $3}'`; do git rm $i; done
@joemccann
joemccann / handy-js-snippets.js
Created October 28, 2010 15:12
Just my list of cool code snippets I find on the web a la view source.
// http://ralphwhitbeck.com/CommentView,guid,cd8e241c-11d1-43ff-9557-70fab698ea1f.aspx
String.prototype.linkify = function() {
return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
return m.link(m);
});
};
String.prototype.atify = function() {
return this.replace(/@[\w]+/g, function(m) {