Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
class Parenthesis extends TerminalExpression { | |
protected $precidence = 6; | |
public function operate(Stack $stack) { | |
} | |
public function getPrecidence() { | |
return $this->precidence; |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
<?php | |
class A | |
{ | |
public static $var = "I'm set in A!<br>"; | |
public static function getStatic() { | |
echo static::$var; | |
} | |
public static function getSelf() { |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
#!/bin/bash | |
# args | |
MSG=${1-'deploy from git'} | |
BRANCH=${2-'trunk'} | |
# paths | |
SRC_DIR=$(git rev-parse --show-toplevel) | |
DIR_NAME=$(basename $SRC_DIR) | |
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH |
# If you are using the MySQL 5.6 version of mysqldump on an older MySQL database, you might get the error message. | |
mysqldump: Couldn't execute 'SELECT @@GTID_MODE': Unknown system variable 'GTID_MODE' (1193) | |
# This error is in part due to the introduction of Global Transaction Identifiers (GTIDs) in MySQL 5.6. GTIDs make it simple to # track and compare replication across a master-slave topology. | |
# mysqldump tries to query this system variable, which doesn’t exist in earlier versions, and then fails. The solution is to add # –set-gtid-purged=OFF in the mysqldump command. It should look something like | |
mysqldump -h dbHost -u dbuser dbName --set-gtid-purged=OFF |
#!/bin/bash | |
# Usage: $0 username | |
# e.g.: | |
# $ ./twitter_user_to_image coates | |
# https://si0.twimg.com/profile_images/1597362183/me.jpg | |
curl -sL http://twitter.com/$1 | grep profile_images | head -n1 | perl -p -e's/.*?http/http/;s/".*//;s/_bigger//' |