Skip to content

Instantly share code, notes, and snippets.

View groundwater's full-sized avatar
:electron:
Performing Alchemy

Groundwater groundwater

:electron:
Performing Alchemy
View GitHub Profile
@groundwater
groundwater / axon-bug.js
Created October 29, 2012 21:28
Message Buffering Bug
var axon = require('axon')
var PORT1 = 8900;
var PORT2 = 8901;
var push1 = axon.socket('push')
push1.bind(PORT1)
var push2 = axon.socket('push')
push2.bind(PORT2)
@groundwater
groundwater / client.js
Created October 27, 2012 21:24
ZeroMQ Async Weirdness
var zmq = require('zmq')
function sockit(name){
var sock = zmq.socket('req');
sock.connect('tcp://127.0.0.1:9000');
sock.on('message', function(res){
console.log("%s: %s",name,res.toString())
});
return sock;
}
everyauth.everymodule.submodule('c9')
.get('callbackPath',
'the url that c9 returns')
.step('findOrCreateUser')
.accepts('req res next')
.promises(null)
.callbackPath('/auth/c9')
.findOrCreateUser(function(req, res, next){
console.log("c9 Auth");
})
@groundwater
groundwater / Model.proto
Created August 27, 2012 08:29
Protobuf Schema Generator
message Client {
required string uuid = 5;
optional string accountid = 1;
optional string email = 2;
optional string status = 3;
optional AccessToken token = 4;
required int64 amount = 6;
}
@groundwater
groundwater / gist:3457225
Created August 24, 2012 23:33
Today's Record Stack Trace
java.io.FilterInputStream.read(FilterInputStream.java:116)
java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:221)
scalax.io.ResourceAdapting$ReadableChannelAdapter.read(ResourceAdapting.scala:75)
scalax.io.support.FileUtils$.copy(FileUtils.scala:130)
scalax.io.traversable.Sliceable.toArray(Sliceable.scala:75)
scalax.io.traversable.ByteResourceTraversable$$anonfun$toArray$2.apply(ByteResourceTraversable.scala:50)
scalax.io.traversable.ByteResourceTraversable$$anonfun$toArray$2.apply(ByteResourceTraversable.scala:50)
scalax.io.CloseableIterator$.withIterator(CloseableIterator.scala:124)
scalax.io.traversable.ByteResourceTraversable.toArray(ByteResourceTraversable.scala:50)
scalax.io.Input$class.byteArray(Input.scala:81)
@groundwater
groundwater / Application.scala
Created August 24, 2012 20:46
Action that parses protocol buffers
object Put extends Controller {
def index = DecodeProtobuf(classOf[MyProtobuf]) { stack :MyProtobuf =>
Action {
// do something with stack
}
}
}
@groundwater
groundwater / blah.scala
Created August 6, 2012 18:18 — forked from mostlygeek/blah.scala
Some Scala
abstract class Prize {
def * (int x) = {
val list = List()
for (i=0; i<x; i++){
list.append( this )
}
list
}
}
case class CoinPrize(multipler: Int) extends Prize
@groundwater
groundwater / .gitignore
Created July 20, 2012 05:09
iOS Git Ignore
# Exclude the build directory
build/*
# Exclude temp nibs and swap files
*~.nib
*.swp
# Exclude OS X folder attributes
.DS_Store
@groundwater
groundwater / blog.md
Created May 18, 2012 14:50
Why Method Overloading Sucks in Scala

Introduction

Method overloading sucks in Scala because it actually detracts from your flexibility. An implicit conversion is a feature of Scala that let's the compiler look up how to convert objects between types at compile time.

Let's say I define a method with the following signature:

def doSomething( action: Action )

Somewhere else in the code I write:

@groundwater
groundwater / README.md
Created April 29, 2012 04:29
Fetch Content from Crunchbase in Google Spreadsheets

Instructions

  1. Create a script in Google Spreadsheets and paste the code.
  2. Create a trigger to run fetch whenever the document is edited
  3. Go to the spreadsheet, type a company name in the A column and hit enter

The script should take the name, fetch data from crunchbase and insert a row with the requested data.