Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Sam Bessalah samklr

🎯
Focusing
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
https://mypoi-hack.googlecode.com/svn/trunk/
Uq7qS2Uy7Ag5
@samklr
samklr / MixedTweets.md
Created Aug 5, 2012 — forked from loicdescotte/MixedTweets.md
How to push 2 mixed searches from twitter with Scala, Play2, Iteratee and Comet
View MixedTweets.md

##MixedTweets

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

###Controller

@samklr
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
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 = Logger.new(STDOUT)
log.level = Logger::DEBUG
get '/' do
if params[:q]
log.debug(params[:q])
sz_q = params[:q].split(": ")[1]
View gol.rb
class GOL
def initialize
@cells = Array.new(10,Array.new(10))
for i in 0..9
for j in 0..9
@cells[i][j] = 0
end
View anagrams.ml
(*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
samklr / Cass.java
Created Dec 6, 2012
Cassandra stuff
View Cass.java
// Instanciate cluster then connect
Cluster cluster =new Cluster.Builder()
.addContactPoints( addr1, addr2)
.build()
Session session = cluster.connect()
session.execute(query)
You can’t perform that action at this time.