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
#!/bin/bash | |
LINE_COLOR=`echo -en '\e[92m'` | |
LINE_COLOR_RESET=`echo -en '\e[00m'` | |
MATCH_COLOR=`echo -en '\e[1m\e[33m'` | |
MATCH_COLOR_RESET=`echo -en '\e[22m\e[92m'` | |
PATTERN="" | |
if [ $# = 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
#!/bin/bash | |
TARGET=$1 | |
SVNROOT=`svn info | grep -h 'Repository Root: .*' | sed 's/Repository Root: //g'` | |
REVISION=`svn log --limit 1 --quiet $TARGET | grep -oh '^r.*' | sed 's/r\([0-9]*\).*/\1/g'` | |
svn log --limit 1 $TARGET | |
svn diff -c $REVISION $SVNROOT | source-highlight --out-format=esc --src-lang=diff |
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
#!/bin/bash | |
svn diff "$@" | source-highlight --out-format=esc --src-lang=diff |
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
#!/usr/bin/env sh | |
print_usage() { | |
printf "Usage: %s [-t=TESTFILE] [-w=WATCHDIR]\n" $(basename $0) | |
echo " TESTFILE Command to run test" | |
echo " WATCHDIR Dir to watch for changes" | |
exit 2 | |
} | |
# you need these dependencies: | |
# sudo apt-get install inotify-tools |
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
#!/usr/bin/env bash | |
# find and replace by regexp in many files | |
PRUNE="" | |
REPLACE="" | |
print_usage() { | |
echo "USAGE: $(basename $0) [--prune EXTENSIONS] [--replace REPLACE] SEARCH" | |
echo " EXTENSIONS Comma separated list of file extensions to ignore" | |
exit 1 | |
} | |
while true |
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
phpsh (c)2006 by Charlie Cheever and Dan Corson and Facebook, Inc. | |
type 'h' or 'help' to see instructions & features | |
New Feature: You can use the -c option to turn off coloring | |
php> var_dump(null > 10); | |
bool(false) | |
php> var_dump(null < 10); | |
bool(true) | |
php> var_dump(null == 10); | |
bool(false) | |
php> var_dump(null == null); |
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
#!/bin/sh | |
[ $# -eq 2 ] || echo "USAGE $0 REPOSITORY DESTINATION" && exit 1 | |
REPOSITORY=$1 | |
DESTINATION=$2 | |
TMPNAME="/tmp/$(basename $REPOSITORY).$$" | |
git clone $REPOSITORY $TMPNAME | |
rm -rf $TMPNAME/.git | |
mkdir -p $DESTINATION | |
cp -r $TMPNAME/* $DESTINATION | |
rm -rf $TMPNAME |
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
require 'uri' | |
require 'cgi' | |
require 'net/https' | |
cert_file = feed_source.certificate_absolute_path | |
raise "Cert file required" if cert_file.nil? || !(File.exists?(cert_file) && !File.directory?(cert_file)) | |
request = Net::HTTP.new(feed_source.url, 443) | |
request.use_ssl = true |
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 | |
function mysql_bind($sql, $params = array()) { | |
$buffer = array(); | |
$tokens = preg_split('/(:[a-z0-9_]+)/', $sql, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); | |
foreach ($tokens as $token) { | |
if (preg_match('/:[a-z0-9_]+/', $token)) { | |
if (!array_key_exists($token, $params)) { | |
trigger_error("Missing parameter '$token'"); | |
} elseif (!isset($params[$token])) { | |
$buffer[] = "null"; |
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 Foo { | |
protected static $blah; | |
static function stuff() { | |
static $cuux = null; | |
if ($cuux === null) { | |
echo "It's null.\n"; | |
$cuux = 42; | |
} else { | |
echo "It's not null anymore.\n"; |