Skip to content

Instantly share code, notes, and snippets.

View easierbycode's full-sized avatar

▓▒░ ♔ Daniel ♔ ░▒▓ easierbycode

View GitHub Profile
@easierbycode
easierbycode / changes_collection.js
Created May 4, 2012 18:18
backbone 'changes' collection
var Book = Backbone.Model.extend({});
var Library = Backbone.Collection.extend({
model: Book,
url: '/books',
initialize: function() {
this.on('add', function(model) {
console.log('added: ', model);
})
@easierbycode
easierbycode / gist:2731426
Created May 19, 2012 16:33 — forked from Chris-Murphy/gist:2394143
MapBlips abridged
var Blips = new Meteor.Collection("blips");
if (Meteor.is_client) {
var handle = Meteor.subscribe('blips', function () {});
var handleClient = Meteor.subscribe('blips_' + clientID, function () {});
Meteor.call('mapBlips', box, clientID, function (error, result){
BlipsClient = new Meteor.Collection('blips_' + clientID);
blips_client = BlipsClient.find({});
}
@easierbycode
easierbycode / install_vertx_on_lion.md
Created June 5, 2012 19:58
install Vert.x on Lion
@easierbycode
easierbycode / index.html
Created July 26, 2012 22:34
A web page created at CodePen.io.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CodePen &middot; A Pen by adhd360</title>
<!--
Copyright (c) 2012 adhd360, http://codepen.io/adhd360
Permission is hereby granted, free of charge, to any person obtaining
@easierbycode
easierbycode / SnippetFile
Created September 7, 2012 04:37
function 'arguments' object
function logStuff() {
for(var n = 0; n < arguments.length; n++) {
console.log(arguments[n]);
}
}
logStuff('a','b','c',1,2,3,{name:'Daniel'});
@easierbycode
easierbycode / basic_set_ops.rb
Created September 11, 2012 18:24 — forked from scottaj/basic_set_ops.rb
Set operations
require 'set'
# Union
Set[1,2,3] | Set[3,4,5]
#=> #{1,2,3,4,5}
# Intersection
Set[1,2,3] & Set[2,3,4,5]
#=> #{2,3}
@easierbycode
easierbycode / google_map_stubs.coffee
Created September 25, 2012 22:29
google map stubs
#=require underscore
window.google =
maps:
event:
jasmine.createSpyObj('google.maps.event', ['addListener', 'Ke', 'removeListener', 'clearListeners', 'clearInstanceListeners', 'trigger', 'addDomListener', 'addDomListenerOnce', 'T', 'bind', 'addListenerOnce', 'forward', 'Ga', 'Og', 'Nj'])
LatLngBounds: ->
jasmine.createSpyObj('google.maps.LatLngBounds', ['getCenter', 'toString', 'toUrlValue', 'b', 'equals', 'contains', 'intersects', 'extend', 'union', 'getSouthWest', 'getNorthEast', 'toSpan', 'isEmpty'])
it "Can use an events hash to wire up view methods to DOM elements.", ->
viewElt = undefined
runs ->
$("#todoList").append todoView.render().el
waitsFor (->
viewElt = $("#todoList li input.check").filter(":first")
viewElt.length > 0
), 1000, "Expected DOM Elt to exist"
@easierbycode
easierbycode / teamcity_reporter.html
Created September 28, 2012 01:43 — forked from rdingwall/teamcity_reporter.html
Jasmine PhantomJS event based exit
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Console Reporter Spec</title>
<link rel="stylesheet" href="../ext/jasmine.css" type="text/css" />
<script type="text/javascript" src="../ext/jasmine.js"></script>
<script type="text/javascript" src="../ext/jasmine-html.js"></script>
@import url(http://fonts.googleapis.com/css?family=Questrial);
@import url(http://fonts.googleapis.com/css?family=Arvo);
body { font: 100%/1.5 Questrial, sans-serif; }
h1 { font: 100% Rockwell, Arvo, serif; }