Skip to content

Instantly share code, notes, and snippets.

View codahale's full-sized avatar
🦆
Look at all these chickens

Coda Hale codahale

🦆
Look at all these chickens
View GitHub Profile
@codahale
codahale / gist:41459
Created December 30, 2008 00:45 — forked from damon/gist:41453
def whack(objects)
return Hash[*objects.map{ |o| [o.send("table_name"), o.send("delete_all")] }.flatten]
end
// Scala 2.7.7, immutable map, uses foldLeft to loop over files/words
import java.io._
import scala.io._
def time(f: => Unit) = {
val t1 = System.currentTimeMillis
f
((System.currentTimeMillis - t1)/1000.0)
}
protected def ![A <: ColumnContainer](implicit consistency : ReadConsistency) : Seq[(String, Seq[A])] = {
ks.pool.withConnection { conn =>
val results = conn.client.get_range_slices(ks.name,
cp,
predicate,
range,
consistency.thrift)
results.map { ks =>
(ks.key, ks.columns.map{ container => new A(container)})