Skip to content

Instantly share code, notes, and snippets.

mralexho / inheritPrototype.js
Created Feb 24, 2015
function that makes the child object inherit from parent object
View inheritPrototype.js
function inheritPrototype(childObject, parentObject){
var parentCopy = Object.create(parentObject.prototype);
parentCopy.constructor = childObject;
childObject.prototype = parentCopy;
mralexho / singleton.pattern.js
Last active Aug 29, 2015
a singleton module
View singleton.pattern.js
var singleton = function() {
var privateVariable;
function privateFunction(x) {
return {
first method: function (a, b) {
second method: function (a, b) {
View homebrew.txt
# To keep the Homebrew itself up-to-date, and fetch the newest version from GitHub use:
brew update
# After updating the brew, check which formulae have an updated version available, display detailed version information to see if you have more than one older version laying around:
brew outdated --verbose
# Remove broken symlinks
brew prune
mralexho /
Last active Mar 7, 2022
Install homebrew, nginx, mysql, php55, and composer on Mac OS X
# install homebrew
ruby -e "$(curl -fsSL"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
View anonymous.pattern.js
* Self-executing JavaScript pattern
// undefined = true; works in javascript
// passing undefined as a param guarantees undefined is “undefined”
(function(window, document, undefined) {
// ...
})(this, document); // this = window
mralexho / option-list-us-states.txt
Created Dec 8, 2014
option list for U.S. States
View option-list-us-states.txt
DC|District Of Columbia
View reflection.php
* PHP Reflection API
* Examines the inner workings of functions, classes, and objects
Reflection::export(new ReflectionClass('class_name'));
mralexho / jquery.plugin-template.js
Created Jun 16, 2014
a template for creating jQuery plugins
View jquery.plugin-template.js
// remember to change every instance of "pluginName" to the name of your plugin!
(function($) {
// here it goes!
$.fn.pluginName = function(method) {
// plugin's default options
var defaults = {
foo: 'bar'
// this will hold the merged default and user-provided properties
// you will have to access the plugin's properties through this object!