Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import sys, os | |
import httplib # JSON Retrieval | |
import simplejson # JSON Parsing | |
class Story(object): | |
""" | |
Class to represent a single Reddit story. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
cd GGR && git pull && cd .. | |
cd GGRServices && git pull && cd .. | |
cd KVHx && git pull && cd .. | |
cd KVHxServices && git pull && cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
up = !sh -c 'git checkout master && git pull && git merge $0 && git push && git checkout $0' | |
down = !sh -c 'git checkout master && git pull && git checkout $0 && git merge master' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name replace star by profile icon | |
// @namespace http://ss-o.net/ | |
// @description replace star by profile icon (for Firefox3) | |
// @include http://*.hatena.ne.jp/* | |
// @version 1.3 | |
// ==/UserScript== | |
location.href = 'javascript:(' + function(){ | |
var COLOR = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JavaScriptTest { | |
public static void main(String[] args) throws Exception { | |
ScriptEngineManager factory = new ScriptEngineManager(); | |
ScriptEngine engine = factory.getEngineByName("JavaScript"); | |
engine.eval("print('hello, world!')"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppleScriptTest { | |
public static void main(String[] args) throws Exception { | |
ScriptEngineManager factory = new ScriptEngineManager(); | |
ScriptEngine engine = factory.getEngineByName("AppleScript"); | |
engine.eval("tell application \"Finder\"\n display dialog \"Who cares?\"\n end tell"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shoes.app :width => 600, :height => 400 do | |
flow :width => 400, :height => 400, :margin => 20 do | |
fill '#dfd' | |
stroke '#ddd' | |
rect 0, 0, 200, 200 | |
background white | |
end | |
background black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person | |
def greet | |
"how are you?" | |
end | |
end | |
en = Person.new | |
it = Person.new # but we wish an italian greeting | |
fr = Person.new # french | |
ar = Person.new # argentinian |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.class_eval do | |
def deep_clone | |
Marshal::load(Marshal.dump(self)) | |
end | |
end | |
Array.class_eval do | |
def sum | |
self.inject(0) { |sum, element| sum += element } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :mod_rails do | |
desc <<-DESC | |
Restart the application altering tmp/restart.txt for mod_rails. | |
DESC | |
task :restart, :roles => :app do | |
run "touch #{release_path}/tmp/restart.txt" | |
end | |
end | |
namespace :deploy do |