Skip to content

Instantly share code, notes, and snippets.

#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
<!DOCTYPE html>
<!--
Copyright 2010 Google Inc.
All rights reserved.
Original slides:
Marcin Wichary
Modifications:
Ernest Delgado
Alex Russell
require 'rubygems'
require 'sinatra'
require 'redis'
# To use, simply start your Redis server and boot this
# example app with:
# ruby example_note_keeping_app.rb
#
# Point your browser to http://localhost:4567 and enjoy!
#
require 'rubygems'
require 'neo4j'
include Neo4j
Transaction.new
# create some people
andreas = Node.new :name => 'andreas'
peter = Node.new :name => 'peter'
kalle = Node.new :name => 'kalle'
# 1) Put this file in your working directory
# 2) run 'sudo gem install active_support grit'
# 3) run 'ruby git-line-count.rb'
# 4) run 'open loc.html'
# 5) yay
require 'rubygems'
require 'active_support'
require 'grit'
require 'open-uri'
#!/usr/bin/python
WhatThisIS="""
This is a hacked together script to connect to all of your running EC2 instances, and to provide a single SSH prompt amongst all of them, and to assist in uploading, splitting, and downloading files. email me at winniningham at and email server called gmail.com :P
"""
import paramiko
from numpy import *
<!DOCTYPE html>
<html>
<head>
<title>JRuby IRB</title>
<meta charset="utf-8">
<style type="text/css">
.code {font-family: "Courier New", Courier, mono;}
</style>
</head>
<body>
estimatePi <- function(numDraws){
r <- .5 #radius... in case the unit circle is too boring
x <- runif(numDraws, min=-r, max=r)
y <- runif(numDraws, min=-r, max=r)
inCircle <- ifelse( (x^2 + y^2)^.5 < r , 1, 0)
return(sum(inCircle) / length(inCircle) * 4)
}
@atiw003
atiw003 / gist:731204
Created December 6, 2010 23:34 — forked from nahi/gist:730361
require 'java'
require 'twitter4j-core-2.1.8-SNAPSHOT.jar'
include_class 'twitter4j.TwitterFactory'
include_class 'twitter4j.http.AccessToken'
ck = "XXX"
cs = "XXX"
ak = "XXX"
as = "XXX"