This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.replace('?', '') | |
.split('&') | |
.reduce((accumulator, currentValue) => { | |
const pos = currentValue.indexOf('='); | |
const key = currentValue.slice(0, pos); | |
const value = currentValue.slice(pos+1); | |
accumulator[key] = value; | |
return accumulator; | |
}, {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Model = Backbone.Model.extend({}); | |
var CollectionModel = Backbone.Model.extend({}); | |
var Collection = Backbone.Collection.extend({ | |
model: CollectionModel | |
}); | |
var View = Backbone.Marionette.ItemView.extend({ | |
tagName : 'li', | |
template: _.template("Number = <%= number %>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --tags --simplify-by-decoration --pretty="format:%d %ai %d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m SimpleHTTPServer 31337 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"directory": "components" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// runs parameter function on all collection models (including children). Expects child collection to be defined in model as "nodes". | |
applyRecursive: function(func) { | |
// takes the last given function parameter - recursion makes arguments array more complex, se need to flatten it out. | |
var lastArg = _.chain(arguments).toArray().flatten().last().value(); | |
this.each(function(model) { | |
func.call(model, func, lastArg); // run function in context of the model. | |
// if has nodes, apply function to nodes. | |
if ((typeof model.nodes !== 'undefined') && (typeof model.nodes.models !== 'undefined') && (model.nodes.models.length > 0)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can manage multiple argumets for function, but can compose only 2 functions... | |
function compose($a, $b) { | |
return function() use ($a, $b) { | |
return $a(call_user_func_array($b, func_get_args())); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
script#tmpl-tree-node(type='text/template') | |
<li><%= nodeName %></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#searchTerm').fastLiveFilter('#eventList', { | |
callback:function(total) { | |
$('#myList').unhighlight(); | |
searchTerm = $("#searchTerm").val(); | |
if (searchTerm.length > 0) { | |
$('#myList').highlight(searchTerm); | |
} | |
} | |
}); |