Skip to content

Instantly share code, notes, and snippets.

View leandono's full-sized avatar

Leandro D'Onofrio leandono

  • Buenos Aires, Argentina
View GitHub Profile
@leandono
leandono / SiteController.php
Created March 19, 2014 22:44
[Yii] Saving data into Google Spreadsheet using JGoogleAPI & php-google-spreadsheet-client
<?php
Yii::import('application.vendors.*');
require_once 'Google/Spreadsheet/Autoloader.php';
class SiteController extends CController
{
/**
* Index
@leandono
leandono / each_with_index.js
Created June 7, 2012 16:41 — forked from gabrielstuff/each_with_index.js
[handlebars] each_with_index handlebars helper, adds an {{index}} prop accessible from within the block
// {{#each_with_index records}}
// <li class="legend_item{{index}}"><span></span>{{Name}}</li>
// {{/each_with_index}}
Handlebars.registerHelper("each_with_index", function(array, fn) {
var total = array.length;
var buffer = "";
//Better performance: http://jsperf.com/for-vs-foreach/2
for (var i = 0, j = total; i < j; i++) {