View helpers.php
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 | |
class helper { | |
//is_array & is associative array | |
public function is_array_asso($a) { | |
return $this->is_asso($a, 1); | |
} | |
// is associative array | |
public function is_asso($a, $strict = FALSE) { |
View helper_prototype_methods.js
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
Node.prototype.addBefore = function(newElement) { | |
this.parentNode.insertBefore(newElement,this); | |
} | |
Node.prototype.addAfter = function (newElement) { | |
this.parentNode.insertBefore(newElement, this.nextSibling); | |
} | |
Node.prototype.setProperties = function(props){ | |
var i,p,c,k,j; | |
for(i in props) { | |
p = props[i]; |
View array_(blacklist|whitelist)(_assoc).php
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
if(!function_exists('array_blacklist_assoc')){ | |
/** | |
* Returns an array containing all the entries from array1 whose keys are not present in any of the other arrays when using their values as keys. | |
* @param array $array1 The array to compare from | |
* @param array $array2 The array to compare against | |
* @return array $array2,... More arrays to compare against | |
*/ |
View gist:0478dc6fb9fc882c6f84bece44ed6f4a
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
old='ubuntu-desktop' | |
new='elementary-desktop' | |
repo='ppa:elementary-os/stable' | |
sudo add-apt-repository $repo --yes --update | |
sudo apt remove $old | |
sudo apt install $new | |
sudo apt autoremove |
View tkheader.php
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
/* | |
* @info https://www.w3.org/TR/tracking-dnt/#tracking-status-value | |
*/ | |
function getRequestTrackingStatusValue(){ | |
return "N"; | |
/* |
View .bash_alias_osx
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
alias refreshFinder='echo "Refreshing Finder . ."; killall Finder /System/Library/CoreServices/Finder.app' | |
alias showFiles='echo "Showing All Files . ."; defaults write com.apple.finder AppleShowAllFiles YES; refreshFinder;' | |
alias hideFiles='echo "Hiding Files . ."; defaults write com.apple.finder AppleShowAllFiles NO; refreshFinder;' | |
alias toggleFiles='yn=$(defaults read com.apple.finder AppleShowAllFiles); if [ $yn = "YES" ]; then hideFiles; else showFiles; fi' | |
View .bash_function_append
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 append(){ | |
count=$#; | |
filename=${!count} | |
for i in "$@"; do | |
if ! [[ "$filename" = "$i" ]]; then | |
grep -q -F "$i" $filename || echo "$i" >> $filename | |
fi | |
done | |
} |
View install-composer-bash
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
# for name in {bash,curl,git,php} ; do which $name ; done | |
mkdir -p /usr/local/bin | |
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer |
View install-wp-cli
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
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod +x wp-cli.phar | |
sudo mv wp-cli.phar /usr/local/bin/wp |
View AbstractSingleton.php
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 | |
abstract class AbstractSingleton implements SingletonInterface | |
{ | |
final public static function getInstance() | |
{ | |
static $instance; | |
return $instance = $instance ?: new \static(); | |
} | |
final private function __construct() {} |
OlderNewer