Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Morris mikemorris

View GitHub Profile
@mikemorris
mikemorris / each_with_index.js
Created Sep 28, 2012 — forked from burin/each_with_index.coffee
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
View each_with_index.js
// <ul data-length="{{records.length}}">
// {{#each_with_index records}}
// <li class="legend_item{{this.index}}" z-index="{{this.reverse}}"><span></span>{{this.name}}</li>
// {{/each_with_index}}
// </ul>
Handlebars.registerHelper("each_with_index", function(array, options) {
var buffer = "";
for (var i = 0, j = array.length; i < j; i++) {
var item = array[i];
View symfony.sh
#!/bin/bash
# Expand globs to null when there are no matches
shopt -s nullglob
# Look for either a '<subdir>/console' or a 'symfony' file
until
file=(*/console symfony); [[ -f "$file" ]] && php "$file" "$@" && exit;
do
[[ "$PWD" == "/" ]] && break;