Skip to content

Instantly share code, notes, and snippets.


mparaiso Mparaiso

View GitHub Profile
View gist:4974884

Sublime Text 2 – Useful Shortcuts (Mac OS X)


⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
Mparaiso / gist:5055440
Last active May 15, 2020 — forked from pedro/gist:1288447
Sample PHP+Mongo app on Heroku
View gist:5055440

Sample PHP+Mongo app on Heroku

  1. Install any of the Mongo add-ons available at

  2. Vendor the Mongo driver with your application. You can download it here:

    Add it to a folder like "ext".

View script.js
var colors = ['#580201','#d9bd6a','#d9d49a','#037f8b','#025e73'];
var elems = [];
var body = document.getElementsByTagName('body')[0];
var xElems = window.innerWidth/30,
yElems = body.clientHeight/10,
fragment = document.createDocumentFragment();
for(var j = 0 ; j<yElems;j++){
Mparaiso / charge.js
Created Mar 9, 2013
Charge.js : simple script loader
View charge.js
* @module Charge
* @author M.Paraiso
"use strict";
var C = {};
C.getXmlHttp = function(method,callback){
var xmlHttp = new XMLHttpRequest();
Mparaiso / gist:5159788
Created Mar 14, 2013
symfony/form validation constraint
View gist:5159788
// I am trying to put a validation constraint on an input field for inputting a username that it be unique -
//if the name is already present in the database I want the validation to fail.
//Is there an obvious way to go about this? Any hint in the right direction would be appreciated.
Here's an example from one of my projects. This is from a registration
form, to check if the email is already used.
First, I make "app" a required option of my form type:
Mparaiso / .travis.yml
Created Mar 30, 2013
travis config file for haxe / NME
View .travis.yml
language: node_js
- 0.6
- sudo apt-get install python-software-properties -y # for the next command
- sudo add-apt-repository ppa:eyecreate/haxe -y
- sudo apt-get update
- sudo apt-get install haxe -y
- sudo apt-get install gcc-multilib g++-multilib -y # since VM is 64bit but hxcpp builds 32bit by default
Mparaiso / ServiceProviderDumper.php
Last active Dec 16, 2015
dump bundles into service provider
View ServiceProviderDumper.php
* This file is part of the Symfony package.
* (c) Fabien Potencier <>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.

Backend Architectures



ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

View authRoute.js
authRouteProvider.$inject = ['$routeProvider'];
function authRouteProvider ($routeProvider) {
* Creates a controller bound to the route, or wraps the controller in param
* so the authentication check is run before the original controller is executed
* @param currentController
* @return {Function} The wrapper controller
function redirectCtrlFactory (currentController) {
_ctrl.$inject = ['currentUser__', 'userRole__', '$location'];