Skip to content

Instantly share code, notes, and snippets.

@groundwater
groundwater / asynchbase.scala
Created April 20, 2012 17:47
Demo Adapting asynchbase to Scala
package ca.underflow.hbase
import org.hbase.async._
import com.stumbleupon.async._
object Demo extends App {
// This let's us pass inline functions to the deferred
// object returned by most asynchbase methods
@groundwater
groundwater / HBaseTest.scala
Created April 20, 2012 09:32
HBase Coprocessor Test with Mocked HTableInterface and CoprocessorEnvironment
import org.specs2.mutable._
import org.specs2.mock._
import ca.underflow.MyApp
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.CoprocessorEnvironment
import org.apache.hadoop.hbase.client.{ HTableInterface, Put }
class HelloWorldSpec extends Specification with Mockito {
@groundwater
groundwater / TransactionalCoprocessors.scala
Created April 20, 2012 06:02
Coprocessor Transactions in HBase and Scala
/** This builds a transactional layer into HBase via coprocessors.
*
* Transactions can be performed by sending a group of mutations,
* to a coprocessor. The coprocessor modifies the table using a
* special mutation protocol that ensures anyone using the same
* protocol will only view atomic commits.
*
* Querying the table directly does not guaruntee atomicity. You
* _must_ query using the provided protocol.
*
@groundwater
groundwater / Application.scala
Created April 12, 2012 08:12
Play with HBase
package controllers
import play.api._
import play.api.mvc._
import com.googlecode.protobuf.format._
import org.apache.hadoop.hbase.HBaseConfiguration
import org.apache.hadoop.hbase.client.{ HTable, Put, Scan, Get }
import org.apache.hadoop.hbase.util.Bytes
javascript:
/* tldr.js copyright Seth Raphael 2011 */
void(initsumm());
function initsumm() {
initStopList();
var paragraphs = document.getElementsByTagName('p');
var rootContent;
if (!rootContent) rootContent = document.getElementById('post');
/*blogs*/
if (!rootContent) rootContent = document.getElementById('content');
@groundwater
groundwater / Application.scala
Created April 11, 2012 05:34
Scala Anorm and Google Protocol Buffers
package controllers
import anorm._
import anorm.SqlParser._
import play.api.db.DB
import play.api.Play.current
import play.api._
import play.api.mvc._