Skip to content

Instantly share code, notes, and snippets.

@jcole
jcole / gist:5818081
Last active December 18, 2015 17:19
$stacheCachedTemplates = {}
# Over-ride stache gem, 1.0.0
require 'mustache'
module Stache
module Mustache
class View < ::Mustache
# Redefine where Stache::View templates locate their partials
comment update
username: "sassyann"
user_id: 38
message: "commented on Which Movie Should I see"
votes update
pollID:
poll: {id: }
lastVoter{
id: 123
comment update
username: "sassyann"
user_id: 38
message: "commented on Which Movie Should I see"
votes update
pollID: 234
caption: "Which Movie should I see"
imageURL: "..."
firstOption:
@jcole
jcole / gist:2182511
Created March 24, 2012 13:01
Example of removing an object from EaselBox
# Example for how to remove an object:
obj = @world.addEntity( type: 'dynamic',radiusPixels: 30) # first, create the object
@world.removeEntity(obj) # now, remove it
# What "removeEntity" does:
removeEntity: (object) ->
@box2dWorld.DestroyBody(object.body)
@jcole
jcole / gist:2155060
Created March 22, 2012 01:40
Example of moving background with Angry Birds clone in JS
class window.GhostsAndMonstersGame
# to set up Easel-Box2d world
PIXELS_PER_METER = 30
gravityX = 0
gravityY = 10
# game-specific
frameRate = 20
forceMultiplier = 5
constructor: (canvas, debugCanvas, statsCanvas) ->