Skip to content

Instantly share code, notes, and snippets.

View rmetzler's full-sized avatar
💭
Recruiters should mention the role and salary range if you spam me.

Richard Metzler rmetzler

💭
Recruiters should mention the role and salary range if you spam me.
View GitHub Profile
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
# 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
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.
*
// 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;
\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!$.
/*
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."
*/
@rmetzler
rmetzler / friends.py
Created December 14, 2010 10:07 — forked from ewilderj/friends.py
# 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
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if(_reachedEndOfFeed) return;
if(!_dynamicFeed) return;
DLog();
if (!reloading)
{
checkForRefresh = YES; // only check offset when dragging
}
@rmetzler
rmetzler / actor.js
Created January 26, 2011 12:38 — forked from yonkeltron/actor.js
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) {
// 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
//