This file contains hidden or 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
require 'time' | |
require 'json/pure' # require 'json/ext' segfaults for me | |
require 'twitter' | |
# There’s probably a way to get the path out of RubyGems itself, but I don’t know how, and the RubyGems | |
# documentation is a clusterfuck. )’= | |
require '/Users/elliottcable/.rvm/gems/ruby-1.9.2-preview1/gems/twitter-0.9.7/examples/helpers/config_store.rb' | |
######################################################################################################## Welcome! | |
# This file is ugly as fuck. Get over it, I was tired… not to mention that I hadn’t written any Ruby in, like, a |
This file contains hidden or 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
# If you work with git, you've probably had that nagging sensation of not knowing what branch you are on. Worry no longer! | |
PS1='\[\033[01;32m\]\h \[\033[01;34m\]\W' #\$ \[\033[00m\]' | |
PS1=$PS1"\$(git branch 2>/dev/null | grep '^*' | colrm 1 2 | xargs -I {} echo ' (\[\033[01;31m\]'{}'\[\033[01;34m\])')" | |
export PS1=$PS1" \$ \[\033[00m\]" | |
# This will change your prompt to display not only your working directory but also your current git branch, if you have one. Pretty nifty! | |
# host ~/code/web (beta_directory) $ git checkout master |
This file contains hidden or 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
import com.google.protobuf.DescriptorProtos; | |
import com.google.protobuf.Descriptors; | |
import com.google.protobuf.DynamicMessage; | |
import com.google.protobuf.Message; | |
import java.util.HashMap; | |
/** | |
* ProtobufEnvelope - allows creating a protobuf message without the .proto file dynamically. | |
* |
This file contains hidden or 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
// create job, set properties etc. | |
// instead of job.waitForCompletion(true), just do: | |
job.submit(); | |
// set time out: | |
long maxDuration = 1000 * 120; // 120 seconds | |
String lastReport = null; | |
long start = System.currentTimeMillis(); | |
long current = start; |
This file contains hidden or 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
\usepackage{algorithm} | |
\usepackage{algorithmic} | |
\usepackage{amssymb} | |
\algsetup{indent=2em} | |
\newcommand{\factorial}{\ensuremath{\mbox{\sc Factorial}}} | |
\newcommand{\emit}{\ensuremath{\mbox{\sc Emit}}} | |
\begin{algorithm}[h!] \caption{$\factorial(n)$}\label{alg:factorial} \begin{algorithmic}[1] | |
\REQUIRE An integer $n \geq 0$. \ENSURE The value of $n!$. |
This file contains hidden or 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
/* | |
From: http://devoracles.com/the-best-method-to-check-for-internet-explorer-in-javascript | |
"I declared a new variable, called IE, which has the value a comment block followed by ‘false‘. | |
The above variable will be understood by IE: var IE = !false, because Internet Explorer uses | |
JScript — a Javascript-like dialect of the standard ECMAScript — instead of Javascript which is | |
used by all the other browsers. JScript can parse the comments, just like Internet Explorer (see | |
conditional HTML comments post). This is a unique feature of IE, none of the other browsers can do it, | |
so Firefox, Chrome, Safari, Opera, all will understand the above declaration as IE = false." | |
*/ |
This file contains hidden or 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
# a messy hack written by Edd Dumbill. http://twitter.com/edd | |
# You may need to rerun this script if you hit a Twitter Error because you | |
# use up API rate limiting. That's why we pickle the results, so we can resume | |
# where we left off. | |
# get the twitter module using 'easy_install twitter' | |
from twitter.api import Twitter, TwitterError | |
from twitter.oauth import OAuth |
This file contains hidden or 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
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView | |
{ | |
if(_reachedEndOfFeed) return; | |
if(!_dynamicFeed) return; | |
DLog(); | |
if (!reloading) | |
{ | |
checkForRefresh = YES; // only check offset when dragging | |
} |
This file contains hidden or 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
var _ = require('underscore')._, | |
events = require('events'); | |
var Actor = function Actor(object) { | |
var postman = new events.EventEmitter(), | |
mailbox = [], | |
that = this, | |
monitor = function monitor() { | |
var data = mailbox.shift(); | |
if (data) { |
This file contains hidden or 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
// Scraping Made Easy with jQuery and SelectorGadget | |
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga) | |
// by David Trejo | |
// | |
// Install node.js and npm: | |
// http://joyeur.com/2010/12/10/installing-node-and-npm/ | |
// Then run | |
// npm install jsdom jquery http-agent | |
// node numresults.js | |
// |
OlderNewer