Skip to content

Instantly share code, notes, and snippets.

View nicholasren's full-sized avatar

Xiaojun Ren nicholasren

View GitHub Profile
@codingricky
codingricky / dius_bowling.md
Last active December 13, 2018 04:33
DiUS Bowling Exercise

DiUS is starting a bowling club. To help with the club, we have engaged you to program a scoring system.

The features on the system are:

  • One player only
  • In each frame, the bowler has 2 tries to knock down all the pins
  • If in 2 tries, the bowler fails to knock down all the pins, their score is the sum of the number of pins they've knocked down in the 2 attempts

E.g, if a bowler rolls, 4,4

@opyate
opyate / ConsistentHash.scala
Last active July 18, 2022 06:33
Consistent Hashing in Scala
// scalac -unchecked -optimise ConsistentHash.scala && scala CHApp
import scala.collection.immutable.LinearSeq
import java.util.{TreeMap => JTreeMap}
import java.util.{SortedMap => JSortedMap}
/**
* Inspired by http://www.lexemetech.com/2007/11/consistent-hashing.html
*/
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment: