Skip to content

Instantly share code, notes, and snippets.

View montogeek's full-sized avatar

Fernando Montoya montogeek

View GitHub Profile
@thomastheyoung
thomastheyoung / review.md
Last active December 5, 2016 23:36
Javascript Templates Comparison: Hogan, dust, doT, underscore

JavaScript Templates Engines

A quick comparison/ benchmark between Hogan, Dust, doT and underscore

Presentation and Readability

Hogan.js

Developed by Twitter (same team as Bootstrap), use exactly the same syntax as Mustache, but more performant and more stuff available server side.

My name is {{ name }}

@driesvints
driesvints / laravel-weekly-23-quick-tip.php
Last active October 23, 2018 07:52
Laravel Weekly #23 - Quick Tip
<?php
# Create a list with numbers ranging from 10 to 20.
Form::selectRange('number', 10, 20);
# Create a list with years ranging from 1900 to 2000.
Form::selectYear('year', 1900, 2000);
# Creates a list with month names.
Form::selectMonth('month');
@max-mapper
max-mapper / index.js
Last active May 9, 2021 02:20
fast loading of a large dataset into leveldb
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
@turboladen
turboladen / psql_encoding.sql
Created October 2, 2013 08:46
Script for dealing with creating Postgres databases that complain with: ``` PG::InvalidParameterValue: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. ``` ...when trying to create the production DB. Taken from: http://stackoverflow.com/questions/13115692/encoding-utf8-does-not-match-…
sudo su postgres
psql
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';
@mnshankar
mnshankar / macros
Last active March 17, 2021 19:51
Laravel 4 (Twitter Bootstrap 3.0 compliant) form macros that I commonly use
<?php
/*********************************************************************************************
* Example usage (In view)
* <div class="welcome">
<?php echo Form::open(array('route'=>'process','class'=>'form-horizontal'))?>
<?php echo Form::textField('first_name')?>
<?php echo Form::textField('last_name')?>
<?php echo Form::emailField('email')?>
<?php echo Form::passwordField('password')?>
<?php echo Form::selectField('select_one', array('1'=>'abc', '2'=>'def'))?>
@montogeek
montogeek / gist:7617765
Created November 23, 2013 17:54
FK a varias tablas
Tienes tablas Proveedores, Usuarios, Clientes, todos tienen varios telefonos.
Entonces se crea la tabla Telefonos y una FK a las llaves primarias de esas tablas, perooooo, resulta que eso no se puede porque no se sabe a que llave primaria referencia.
So?
Como lo solucionaría?
@PavelPolyakov
PavelPolyakov / routes.php
Last active October 2, 2016 21:06
Complete example of the named routes for the Route::controller, Laravel 4.
<?php
// for Laravel 4.1.*
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
'postCreate'=>'dashboard.bank-accounts.create.post'));
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
// for Laravel 4.0.* it was possible to do like this
Route::get('bank-accounts', array('as' => 'dashboard.bank-accounts', 'uses' => 'Dashboard_BankAccountsController@getIndex'));
Route::controller('bank-accounts', 'Dashboard_BankAccountsController', array('getCreate'=>'dashboard.bank-accounts.create',
@kbirmhrjn
kbirmhrjn / Learning Resources
Created January 7, 2014 16:50
Resources for learning tons of stuffs!
http://tutorialzine.com/
http://teamtreehouse.com/dashboard https://tutsplus.com/
http://hub.tutsplus.com/
http://www.codeschool.com/ https://peepcode.com/screencasts
http://www.udemy.com/
http://learncodethehardway.org/
http://www.programr.com/
http://www.codecademy.com/#!/exercises/0
http://www.bloc.io/
https://www.phpacademy.org/
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
@elijahmanor
elijahmanor / CSS-Hamburger-Icon.markdown
Last active April 14, 2018 11:48
A Pen by Elijah Manor.