This file contains hidden or 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 | |
function array_change_key_type(array $array, $type = T_STRING_CAST ) | |
{ | |
if($token === T_STRING_CAST) { | |
$obj = new stdClass(); | |
foreach($array as $key => $value){ | |
$obj->{$key} = $value; | |
} | |
return (array) $obj; |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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
#!/usr/bin/env zsh | |
datadir=${XDG_DATA_HOME:-$HOME/.local/share}/windows | |
mkdir -m 0700 -p $datadir | |
git -C $datadir init | |
logfile=$datadir/windows-vms | |
exec >>$logfile | |
date=$(date) | |
echo | |
echo "# $date" | |
curl -fsSL https://developer.microsoft.com/en-us/microsoft-edge/api/tools/vms/ | \ |
This file contains hidden or 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() {} |
This file contains hidden or 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 |
This file contains hidden or 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 |
This file contains hidden or 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 | |
} |
This file contains hidden or 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' | |
This file contains hidden or 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"; | |
/* |
This file contains hidden or 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 |