Skip to content

Instantly share code, notes, and snippets.

View gsmaverick's full-sized avatar

Gavin Schulz gsmaverick

  • San Francisco, CA
View GitHub Profile
@gsmaverick
gsmaverick / spec.wren
Last active August 29, 2015 14:13
Simple unit testing in wren.
// Simple unit testing in wren.
class Spec {
new(description, body) {
_description = description
_body = body
}
description { _description }
@gsmaverick
gsmaverick / spec.wren
Created January 18, 2015 02:32
Simple unit testing in wren.
// Simple unit testing in wren.
class Spec {
new(description, body) {
_description = description
_body = body
}
description { _description }
@gsmaverick
gsmaverick / spec.wren.dart
Created January 18, 2015 02:33
Simple unit testing in wren.
// Simple unit testing in wren.
class Spec {
new(description, body) {
_description = description
_body = body
}
description { _description }
// Simple unit testing in wren.
class Spec {
new(description, body) {
_description = description
if (_body.type == Fiber){
_body = body
} else {
_body = new Fiber(body)
case class S3File(id: String, path: String)
object S3File {
implicit def s3FileFormat: Format[S3File] = Json.format[S3File]
def generateSignedLink(path: String): String = ???
}
import S3File
object HelloWorldController extends Controller {
def index = {
val file = S3File("id", "path/to/file")
val json = Json.toJson(file)(S3File.linkSigningS3FileWrites)
Ok(json)
}
}
@gsmaverick
gsmaverick / exception.c
Created March 14, 2012 20:47
Exception Handler
// exception.cc
// Entry point into the Nachos kernel from user programs.
// There are two kinds of things that can cause control to
// transfer back to here from user code:
//
// syscall -- The user code explicitly requests to call a procedure
// in the Nachos kernel. Right now, the only function we support is
// "Halt".
//
// exceptions -- The user code does something that the CPU can't handle.
@gsmaverick
gsmaverick / gist:2312413
Created April 5, 2012 16:39
Handling tree-like layouts in Backbone
var TreeItemView = Backbone.View.extend({
tagName: 'div',
className: 'tree-item',
render: function() {
var self = this;
// Some function that retrieves an array of children for this model
var children = TreeCollection.children(this.model.get('id'));
// Render this tree item
@gsmaverick
gsmaverick / gist:2791604
Created May 26, 2012 01:17
CSS3 Transition Events With Backbone
var NewView = Backbone.View.extend({
events: {
'webkitTransitionEnd div': 'afterTransitionEvt_'
},
//...
afterTransitionEvt_: function(evt) {
// do things after the animation is finished.
}