Skip to content

Instantly share code, notes, and snippets.

View Mparaiso's full-sized avatar

mparaiso Mparaiso

View GitHub Profile
@Mparaiso
Mparaiso / apiexamples.js
Created May 9, 2012 01:44 — forked from jrburke/apiexamples.js
Description of browser-friendly module APIs: AMD and Loader Plugins
//*******************************************
// Level 1, basic API, minimum support
//*******************************************
/*
Modules IDs are strings that follow CommonJS
module names.
*/
//To load code at the top level JS file,
//or inside a module to dynamically fetch
@Mparaiso
Mparaiso / jquery-pubsub.js
Created May 16, 2012 04:13 — forked from bentruyman/jquery-pubsub.js
Simple Pub/Sub Implementation for jQuery
/*
* Simple Pub/Sub Implementation for jQuery
*
* Inspired by work from Peter Higgins (https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js)
*
* This is about the simplest way to write a pubsub JavaScript implementation for use with jQuery.
*/
(function( $ ) {
// Cache of all topics
@Mparaiso
Mparaiso / hideaddrbar.js
Created June 12, 2012 03:26 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@Mparaiso
Mparaiso / Configuration.php
Created September 19, 2012 09:50 — forked from Lumbendil/Configuration.php
"Recursive" configuration in Symfony2 Config Component
<?php
namespace FashionWeb\DynamicRoutingBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
/**
* This is the class that validates and merges configuration from your app/config files
@Mparaiso
Mparaiso / awesome-php.md
Created September 19, 2012 17:00 — forked from ziadoz/awesome-php.md
Awesome PHP Libraries

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should be using:

@Mparaiso
Mparaiso / Add field to an existing Django app with South
Created October 10, 2012 16:29 — forked from DaveEveritt/Add field to an existing Django app with South
quickly add field(s) to existing Django models with South
====================================================================
Simple-as-possible instructions to add a field (or more) using South
to an existing Django model with existing data.
====================================================================
Two versions:
1. Super-condensed (the bare minimum - jfdi)
2. Detailed-but-brief (if you want more information).
Notes:
@Mparaiso
Mparaiso / currycompose.coffee
Created November 30, 2012 00:01 — forked from twfarland/currycompose.coffee
Currying / Function composition in coffeescript
arr = Array::
arrSlice = arr.slice
curry = ->
args = arrSlice.call arguments
->
args2 = arrSlice.call arguments
args[0].apply @, args.slice(1).concat(args2)
sum = ->

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

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

Sample PHP+Mongo app on Heroku

  1. Install any of the Mongo add-ons available at http://addons.heroku.com

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

    https://github.com/wuputah/heroku-libraries/raw/master/php/mongo/mongo.so
    

    Add it to a folder like "ext".

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++){