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
\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 / app.coffee
Created November 11, 2010 21:53
this is coffee script template for a soca app
soca = ($) ->
app = $.sammy '#container', () ->
this.use 'Couch', 'st'
this.get '#/', (ctx) ->
# do something with ctx
$ () ->
app.run('#/')
soca jQuery
Starting CouchDB...
Eshell V5.7.5 (abort with ^G)
1> Apache CouchDB 1.0.1 (LogLevel=info) is starting.
1> [error] [<0.105.0>] {error_report,<0.35.0>,
{<0.105.0>,crash_report,
[[{initial_call,{mochiweb_socket_server,init,['Argument__1']}},
{pid,<0.105.0>},
{registered_name,[]},
{error_info,{exit,eaddrinuse,
[{gen_server,init_it,6},
@rmetzler
rmetzler / pom.xml
Created December 9, 2010 12:53
using log4j with the maven-jetty-plugin
<!-- Run the application using "mvn jetty:run" -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<scanIntervalSeconds>5</scanIntervalSeconds>
<contextPath>/</contextPath>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
@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
//
@rmetzler
rmetzler / my_posterous_theme.html
Created February 6, 2011 11:56
This is my version of the Slate theme from Posterous
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{PageTitle}</title>
<link rel="icon" href="/images/favicon.png" type="image/x-png"/>
<style type="text/css">
* {border:0;padding:0;margin:0;}
img {border:0;}