This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP Reflection API | |
* Examines the inner workings of functions, classes, and objects | |
*/ | |
Reflection::export(new ReflectionClass('class_name')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AL|Alabama | |
AK|Alaska | |
AZ|Arizona | |
AR|Arkansas | |
CA|California | |
CO|Colorado | |
CT|Connecticut | |
DE|Delaware | |
DC|District Of Columbia | |
FL|Florida |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var singleton = function() { | |
var privateVariable; | |
function privateFunction(x) { | |
...privateVariable... | |
} | |
return { | |
first method: function (a, b) { | |
...privateVariable... | |
}, | |
second method: function (a, b) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inheritPrototype(childObject, parentObject){ | |
var parentCopy = Object.create(parentObject.prototype); | |
parentCopy.constructor = childObject; | |
childObject.prototype = parentCopy; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find out what version of Linux (distro) you are running | |
$ cat /etc/*-release | |
# find out kernel, version number, machine hardware name | |
$ uname -mrs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myNamespace = (function () { | |
var myPrivateVar = 0; | |
var myPrivateMethod = function (someText) { | |
console.log(someText); }; | |
return { | |
myPublicVar: "foo", | |
myPublicFunction: function (bar) { | |
myPrivateVar++; | |
myPrivateMethod(bar); | |
} }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myArr.sort(function(a, b) { | |
var aName = a.text.toLowerCase(); | |
var bName = b.text.toLowerCase(); | |
return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
OlderNewer