Skip to content

Instantly share code, notes, and snippets.

@colinmegill
colinmegill / curry.js
Created February 13, 2013 20:42
This is a forge gist for the advanced javascript workshop on currying.
function curry(callback, context) {
var curryArgs = Array.prototype.slice.call(arguments, 2);
return function() {
var args = Array.prototype.slice.call(arguments);
callback.apply(context, curryArgs.concat(args));
}
}
@colinmegill
colinmegill / Bootcamp Handlebars each block
Created April 17, 2013 16:19
This is an example each block
{{#each models}}<!-- the each block iterates like a foreach block over the given context models -->
<div>
{{this.attributes.name}}<!--this refers to the current model in the array models -->
</div>
{{/each}}
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" src="jquery.js"></script>
</body>
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<!-- create your template... below, this will evaluate myContextObject.title -->
<script id="entry-template" type="text/x-handlebars-template">
<!DOCTYPE html>
<html>
<head></head>
<body>
<script type="text/javascript" src="handlebars.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<!-- this evaluates myContextObject.title -->
this is a test gist
/* The capitalized 'Note' defines the data structure that every lowercase 'note' instance will inherit from */
/* 'initialize' is called when you create a new instance of the class using the 'new' keyword */
/* when you initialize a new instance of the class, each property of the default object becomes a property of the instance */
var Note = Backbone.Model.extend({
initialize: function() { ... },
methodOne: function() {...}
asdfsadfsadf
//Colin working on issue #159
it('should render div tag even if div tag is the last element before the closing collection helper', function(){
var dummyCollection = new Thorax.Collection({ // create collection
})
var view = new Thorax.View({
template: Handlebars.compile('{{collection dummyCollection}}<div> </div>{{/collection}}')