Skip to content

Instantly share code, notes, and snippets.


Sam Bessalah samklr

Block or report user

Report or block samklr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2909633
samklr /
Created Aug 5, 2012 — forked from loicdescotte/
How to push 2 mixed searches from twitter with Scala, Play2, Iteratee and Comet


We will see how to mix 2 twitter searches and push the results to the browser in real time.

First, checkout this mini project

To try it, you need to install Play 2.0


samklr / ExtremeStartup.scala
Created Sep 7, 2012 — forked from mikkelbd/ExtremeStartup.scala
BEKK kodekveld - Extreme Startup - refac
View ExtremeStartup.scala
import util.matching.Regex
object ExtremeStartup {
def answer(q: String): Any = {
if (q.contains("what is your name"))
return "Mikkel"
if (q.contains("which city is the Eiffel tower in"))
return "Paris"
samklr / RandomFun.scala
Created Sep 12, 2012
Random Stuff in Scala
View RandomFun.scala
def swap (x : Int; y : Int) = {
var a = x; var b =y;
a= a -b; b= b+a; a= b -a;
def fibonacci(n : Int) = recursiveFib(n, 1, 0)
def recursiveFib ( n : Int, next : Int, result : Int) : Int = {
n match {
View TontonMartin.scala
object FuncourseWithUncleMartin{
object Setsss{
def contains(s: Set, elem: Int): Boolean = s(elem)
def singleton(elem: Int): Set = Set(elem)//(x :Int) => x == elem
def union(s: Set, t: Set): Set = (x : Int) => s(x) || t(x)
View extreme_st.rb
require 'sinatra'
require 'logger'
log =
log.level = Logger::DEBUG
get '/' do
if params[:q]
sz_q = params[:q].split(": ")[1]
View gol.rb
class GOL
def initialize
@cells =,
for i in 0..9
for j in 0..9
@cells[i][j] = 0
(*s {\bf Anagrams.} The following program finds all the anagrams of a given
set of characters among a dictionary. Such a dictionary can be built by
the following program given a list of files containing words (one per
line). *)
(*s The dictionary is implemented as a \emph{trie}. It is a multi-branching
tree, where branches are labelled with characters. Each node contains
a boolean which says if the word corresponding to the path from the root
belongs to the dictionary. The branches are implemented as maps from
characters to dictionaries. *)
View Huffm.scala
package patmat
import common._
import scala.collection.immutable._
* Assignment 4: Huffman coding
object Huffman {
samklr /
Created Dec 6, 2012
Cassandra stuff
// Instanciate cluster then connect
Cluster cluster =new Cluster.Builder()
.addContactPoints( addr1, addr2)
Session session = cluster.connect()
You can’t perform that action at this time.