Skip to content

Instantly share code, notes, and snippets.

@TomK
TomK / remove trailing whitespaces
Created February 7, 2011 09:35
git commit hook to remove trailing whitespaces
#!/bin/sh
#
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#
# found on http://snipplr.com/view/28523/git-precommit-hook-to-fix-trailing-whitespace/
#
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
#!/usr/bin/ruby
# REQUIRES:
# * rooted android, as otherwise you can't read the applications private data
# * to display the qr code "qrencode" (http://fukuchi.org/works/qrencode/)
# and "display" from ImageMagick
# This script "decrypts" the token from the internal state of the
# Battle.net Mobile Authenticator on android application, converting
# it into an "otpauth" url (https://code.google.com/p/google-authenticator/wiki/KeyUriFormat)
@TomK
TomK / gist:9335d1d92b8f5334d4f6
Created April 30, 2015 17:41
public read acl
[
{
"entity": "project-owners-527096463570",
"projectTeam": {
"projectNumber": "527096463570",
"team": "owners"
},
"role": "OWNER"
},
{
@TomK
TomK / .bash_profile
Last active August 29, 2015 14:21
Bash aliases for PHP CLI XDebug remote debugging and profiling
alias phpx="php -d xdebug.remote_enable=1 -d xdebug.idekey=PHPSTORM -d xdebug.remote_autostart=1 -d xdebug.remote_connect_back=1"
alias phpp="php -d xdebug.profiler_enable=1"
@TomK
TomK / php7.sh
Created May 14, 2015 11:10
Build PHP7 on OSX
#!/bin/sh
brew install bison recode aspell gmp autoconf
ln -s /usr/local/Cellar/bison/3.0.4/bin/bison /usr/local/bin/bison
git clone https://github.com/php/php-src
cd php-src
./buildconf
./configure --prefix=$HOME/tmp/usr --with-config-file-path=$HOME/tmp/usr/etc --enable-mbstring --enable-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-curl --with-mcrypt --with-iconv --with-gmp --with-pspell --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --enable-gd-jis-conv --with-openssl --with-mysql=/usr/local/bin/mysql_config --with-pdo-mysql=/usr/local/bin/mysql_config --with-gettext=/usr/local/opt/gettext --with-zlib=/usr --with-bz2=/usr --with-recode=/usr --with-mysqli=/usr/local/bin/mysql_confi
make
make inst
@TomK
TomK / php70-xdebug.sh
Last active September 16, 2015 14:41
Install xdebug from Derick Rethans' development fork
#!/bin/bash
# make sure you switch to php70
brew unlink php56 && brew link php70
# checkout and build
git clone [email protected]:derickr/xdebug php7-xdebug
cd php7-xdebug
phpize
./configure
#install datastax php-driver (and cpp-driver) on osx
brew install https://raw.githubusercontent.com/datastax/cpp-driver/master/packaging/homebrew/cassandra-cpp-driver.rb
@TomK
TomK / php70-apcu.sh
Last active March 21, 2016 11:15
PHP7 APCU
#!/bin/bash
# make sure you switch to php70
brew unlink php56 && brew link php70
# checkout and build
git clone [email protected]:krakjoe/apcu
cd apcu
git checkout seven
make clean
@TomK
TomK / jsClass.js
Last active February 15, 2016 12:17
Javascript object method with working private and static
/** METHOD ONE **/
/** DOES NOT WORK WITH instanceof **/
var MyClass = (function ()
{
/* STATIC */
// private static
var _privateStatic = 'static private initial';
@TomK
TomK / phpunit
Created April 18, 2016 09:37
Run PHPUnit from the vendor folder
#!/bin/bash
if [ ! -f vendor/phpunit/phpunit/phpunit ]; then
echo 'No PHPUnit installed in vendor directory'
exit 1
fi
echo 'Executing `phpunit '$@'`...'
vendor/phpunit/phpunit/phpunit $@