Skip to content

Instantly share code, notes, and snippets.

#!/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;
@mikemorris
mikemorris / each_with_index.js
Created September 28, 2012 17:02 — forked from burin/each_with_index.coffee
each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
// <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];