Skip to content

Instantly share code, notes, and snippets.

Avatar

mparaiso Mparaiso

View GitHub Profile
View FooController.php
<?php
// src/Foobar/Controller/FooController.php
namespace Foobar\Controller;
class FooController
{
public function helloAction($request)
{
View perlin-noise-classical.js
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
View perlin-noise-classical.js
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/
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 frontendDevlopmentBookmarks.md
@Mparaiso
Mparaiso / ServiceProviderDumper.php
Last active Dec 16, 2015
dump bundles into service provider
View ServiceProviderDumper.php
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@Mparaiso
Mparaiso / .travis.yml
Created Mar 30, 2013
travis config file for haxe / NME
View .travis.yml
language: node_js
node_js:
- 0.6
before_install:
- 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
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
Mparaiso / charge.js
Created Mar 9, 2013
Charge.js : simple script loader
View charge.js
/**
* @module Charge
* @author M.Paraiso
*/
(function(ns){
"use strict";
var C = {};
C.getXmlHttp = function(method,callback){
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange(function(event){
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++){