which represent the simplest entities the language is concerned with,
by which compound elements are built from simpler ones, and
| # U Suck At Coding Exercise: Tree Comparison | |
| # Feb 28 2012 | |
| # @loganlinn | |
| class TreeNode | |
| attr_accessor :value, :left, :right | |
| def initialize v | |
| @value = v | |
| end |
| function bust () { | |
| document.write = ""; | |
| window.top.location = window.self.location; | |
| setTimeout(function() { | |
| document.body.innerHTML = ''; | |
| }, 0); | |
| window.self.onload = function(evt) { | |
| document.body.innerHTML = ''; | |
| }; | |
| } |
| # not finished | |
| ack -i --flush --nocolor --nogroup '[^\w]?todo[^\w]' | awk -F\: '{print "-L " $2 "," $2 " -- " $1}' | xargs -L 1 git blame | grep -i `git config --get user.name` |
| for i in 50 100 250 500; do echo "String length: $i"; php strcmpbench.php $i; php strcasecmpbench.php $i; echo "\n"; done | |
| # Example run: | |
| # | |
| # String length: 50 | |
| # ************************ | |
| # * strcomp + strtolower * | |
| # ************************ | |
| # Time: 0.000082 | |
| # Memory: 1456 |
| <?php | |
| class Foo { | |
| const NUM_FOOS = 42; | |
| } | |
| class Bar { | |
| public $foo; | |
| function __construct() { |
| git log --author=`git config user.name` --shortstat --since=yesterday | grep 'files changed' | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "", files, "files changed,", inserted, "insertions(+),", deleted, "deletions(-)"}' |
| git branch -r --merged master | sed 's/ *origin\///' | grep -v -E '(release|master$)' | xargs -I_ git log -1 --format='_ %ct' origin/_ | awk '{ if ($2 < '$(date -v-1y +%s)') print $1 }' |
| <?php | |
| $a = array( | |
| 'foo' => 'asdf', | |
| 'bar' => 'fdsa', | |
| 'baz' => 'test' | |
| ); | |
| end($a); | |
| echo "Last key: " . key($a) . "\n"; |
| <?php | |
| class Test { | |
| public $concrete = "concrete"; | |
| public function __get($prop) { | |
| printf("%s(%s)\n", __FUNCTION__, $prop); | |
| if ($prop == "magic") { | |
| return $prop; | |
| } |