Skip to content

Instantly share code, notes, and snippets.

View micrypt's full-sized avatar

Seyi Ogunyemi micrypt

View GitHub Profile
@tommorris
tommorris / gist:437512
Created June 14, 2010 10:05
talking to oauth-out-of-band fireeagle using scala's databinder dispatch oauth
// Welcome to Scala version 2.7.5.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20).
// Type in expressions to have them evaluated.
// Type :help for more information.
scala> import dispatch._
import dispatch._
scala> import oauth._
import oauth._
/* Traits: a simple way to make fake objects for testing. */
/* Because Mockito is cool but my brain says no to mocking libraries! ;-) */
/* Here's our simple Foo class with an expensive
call that is network dependent - getFromApi() */
class Foo {
def getFromApi() {
http(blargh)
include $(GOROOT)/src/Make.$(GOARCH)
TARG=wsbench
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=2
GOFILES=\
wsbench.go\
include $(GOROOT)/src/Make.pkg
.mouse, #preview{
position: absolute;
background-repeat: no-repeat;
height: 22px;
min-width: 15px;
z-index: 100;
}
.mouse{
background-image: url('../images/cursor.png');
package dining.hakkers
//Akka adaptation of
//http://www.dalnefre.com/wp/2010/08/dining-philosophers-in-humus/
import se.scalablesolutions.akka.actor.{Scheduler, ActorRef, Actor}
import se.scalablesolutions.akka.actor.Actor._
import java.util.concurrent.TimeUnit
/*
@mblondel
mblondel / lda_gibbs.py
Last active October 9, 2023 11:31
Latent Dirichlet Allocation with Gibbs sampler
"""
(C) Mathieu Blondel - 2010
License: BSD 3 clause
Implementation of the collapsed Gibbs sampler for
Latent Dirichlet Allocation, as described in
Finding scientifc topics (Griffiths and Steyvers)
"""
@petermarks
petermarks / GuessGame-abstracted.hs
Created August 22, 2010 22:21
Number guessing game
module Main where
import System.Random
import Data.Function
processGuess :: Int -> IO () -> IO ()
processGuess answer cont = do
n <- getLine
case compare (read n) answer of
EQ -> putStrLn "Awesome!!!!"
@dahlia
dahlia / lisp.rb
Created September 2, 2010 07:52
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
#!/usr/bin/env ruby
%w{rubygems hmac-sha1 base64 cgi net/https uri openssl}.each{ |f| require f }
KEY = '<YOUR KEY>';
SECRET = '<YOUR SECRET>';
# encodes strings that make twitter oauth happy
def encode( string )
URI.escape( string, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]") ).gsub('*', '%2A')
end
/* The world's smallest Brainfuck interpreter in C, by Kang Seonghoon
* http://j.mearie.org/post/1181041789/brainfuck-interpreter-in-2-lines-of-c */
s[99],*r=s,*d,c;main(a,b){char*v=1[d=b];for(;c=*v++%93;)for(b=c&2,b=c%7?a&&(c&17
?c&1?(*r+=b-1):(r+=b-1):syscall(4-!b,b,r,1),0):v;b&&c|a**r;v=d)main(!c,&a);d=v;}