Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@mxcl
mxcl / uninstall_homebrew.sh
Created August 26, 2011 11:25
Uninstall Homebrew
#!/bin/sh
# Just copy and paste the lines below (all at once, it won't work line by line!)
# MAKE SURE YOU ARE HAPPY WITH WHAT IT DOES FIRST! THERE IS NO WARRANTY!
function abort {
echo "$1"
exit 1
}
set -e
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@kmpm
kmpm / fabfile.py
Created September 8, 2011 15:22
Fabric deployment of Node.js on Ubuntu
from __future__ import with_statement
from fabric.api import env
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.project import upload_project
import ubuntu
import protobuf
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@defunkt
defunkt / gitio
Created September 11, 2011 08:11
Turn a github.com URL into a git.io URL.
#!/usr/bin/env ruby
# Usage: gitio URL [CODE]
#
# Turns a github.com URL
# into a git.io URL
#
# Copies the git.io URL to your clipboard.
url = ARGV[0]
code = ARGV[1]
@chocokanpan
chocokanpan / gist:1211245
Created September 12, 2011 13:30
DevQuiz Google Apps Script
function inportJsonByGdd2011() {
var data = UrlFetchApp.fetch("http://gdd-2011-quiz-japan.appspot.com/apps_script/data?param=3800952189735731210");
// var data = UrlFetchApp.fetch("http://gdd-2011-quiz-japan.appspot.com/apps_script/sample");
var json = Utilities.jsonParse(data.getContentText());
var ss = SpreadsheetApp.getActiveSpreadsheet();
for(var i in json){
var city = json[i];
ss.insertSheet(city["city_name"]);
var sheet = ss.getActiveSheet();
@abachman
abachman / gist:1224386
Created September 17, 2011 21:20
conway.coffee
class World
constructor: (@cells, @display) ->
@height = @cells.length
@width = @cells[0].length
@neighbor_matrix = [
[ [-1, -1], [0, -1], [1, -1]]
[ [-1, 0] , [1, 0] ]
[ [-1, 1], [0, 1], [1, 1] ]
]
def run_in_terminal(cmd, title, background=[0,0,0])
# see http://www.nach-vorne.de/2007/11/22/terminal-trick
# and http://onrails.org/articles/2007/11/28/scripting-the-leopard-terminal
# and http://blog.cbciweb.com/articles/2008/05/02/scripting-mac-terminal-using-ruby
begin
puts yellow("!> #{cmd}")
term = app('Terminal')
term.activate()
current_window = term.windows.first
old_tab = current_window.selected_tab.get()
@malthe
malthe / hyphenation.py
Created September 22, 2011 13:11
Dictionary-based HTML hyphenation using soft hyphen
import os
import re
from htmlentitydefs import name2codepoint
# Must install the `hyphenator` library from PyPi!
from hyphenator import Hyphenator
# Firefox comes with an English hyphenation dictionary
path = os.popen('locate hyph_en_US.dic').readlines()[0].strip()
@torufurukawa
torufurukawa / gist:1255594
Created October 1, 2011 04:29
App Engine's ReferenceProperty that does not raise ReferencePropertyResolveError.
from google.appengine.ext import db
class ReferenceProperty(db.ReferenceProperty):
"""A property that represents a many-to-one reference to another model.
This acts as identical to google.appengine.ext.db.ReferenceProperty,
except objects returns None when referenced entity does not exist
instead of raising ReferencePropertyResolveError.
"""
def __get__(self, *args, **kw):