Skip to content

Instantly share code, notes, and snippets.

@pope
pope / gist:1119056
Created August 1, 2011 21:32 — forked from 8bitorange/gist:1119051
my hello world
/**
* Handling all dom and instantiation of all other js
*
*/
// include dom
goog.require('goog.dom');
goog.require('goog.style');
goog.require('goog.iter');
BEGIN {loop {callcc {|cc| begin sleep; ensure cc.call end}}}
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@pope
pope / url_dsl.rb
Created December 28, 2009 11:12 — forked from defunkt/url_dsl.rb
require 'open-uri'
# url dsl -- the ultimate url dsl!
#
# You just can't beat this:
#
# $ irb -r url_dsl
# >> include URLDSL
# => Object
# >> http://github.com/defunkt.json
@pope
pope / gist:262117
Created December 22, 2009 22:27 — forked from ezmobius/gist:262085
require 'rubygems'
require 'redis'
require 'json'
require 'eventmachine'
class RedisLoop
class << self
attr_accessor :queues
def start(opts={}, &blk)
EM.run {
@pope
pope / echo.c
Created October 19, 2009 23:48 — forked from paulsmith/echo.c
/**
* A simple preforking echo server in C.
*
* Building:
*
* $ gcc -Wall -o echo echo.c
*
* Usage:
*
* $ ./echo
# requires "isightcapture" in the cwd (http://www.intergalactic.de/pages/iSight.html)
require "eventmachine"
INTERVAL = 20
EM::run do
timer = EM::PeriodicTimer.new(INTERVAL) do
time = Time.now.strftime("%Y%m%d%H%M%S")
system "./isightcapture #{time}.jpg &"
puts time
=begin
host_ip_info.rb (http://gist.github.com/169374)
Copyright (c) 2009 Jason L Perry
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#!/usr/bin/env ruby
#
# A hook script to verify that only syntactically valid ruby code is commited.
# Called by git-commit with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# Put this code into a file called "pre-commit" inside your .git/hooks
# directory, and make sure it is executable ("chmod +x .git/hooks/pre-commit")
#
@pope
pope / .bashrc
Created July 8, 2009 19:17 — forked from defunkt/.bashrc
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# (Thanks to @anildigital and @grundprinzip for curl-fu)
function tweet {
curl -n -d status="$*" https://twitter.com/statuses/update.xml --insecure &> /dev/null
echo "tweet'd"