Skip to content

Instantly share code, notes, and snippets.

View ujjwalt's full-sized avatar

Ujjwal Thaakar ujjwalt

View GitHub Profile
@ujjwalt
ujjwalt / sieve_of_eratosthenes.go
Last active October 13, 2015 03:57
A concurrent implementation of Sieve of Eratosthenes
package main
import (
"fmt"
"os"
"strconv"
)
func main() {
if len(os.Args) != 2 {
@ujjwalt
ujjwalt / collection_routing_test.rb
Last active December 22, 2015 23:49
My valiant attempt at writing a routing test - have no clue how to write one
require 'abstract_unit'
require 'controller/fake_controllers'
class TestCollectionRouting < ActionDispatch::IntegrationTest
test "collection option" do
with_routing do |set|
set.draw do
resources :posts, collection: true
end
assert_routing "/posts/1", {controller: "posts", action: "show", id: "1"}
@ujjwalt
ujjwalt / snakes-ladders.clj
Last active September 20, 2015 10:59
Snakes and Ladders. #FnConf15
(def cells 30) ; Number of cells on the board
; Map of snakes swallowing you at the key and shitting you out at the value
(def snakes {27 1
21 9
19 7
17 4})
; Map of ladders bottom to top cell
(def ladders {3 22