Skip to content

Instantly share code, notes, and snippets.


mparaiso Mparaiso

View GitHub Profile
View gist:3d0b9deab6f5969c354b

Hello World!

###this is a gist test

  • with
  • a
  • list
  • that
  • works
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
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.
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'];
View perlin-noise-classical.js
// Ported from Stefan Gustavson's java implementation
// Read Stefan's excellent paper for details on how this code works.
// Sean McCullough
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.