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
abstract class Tree | |
case class Leaf(value: String) extends Tree | |
case class Branch(left: Tree, right: Tree) extends Tree | |
def walk(t: Tree): Unit = | |
t match { | |
case Branch(Stub, _) => println("branch-with-stub-on-the-left") | |
case Branch(left, right) => { | |
println("\nbranch-leaf") | |
walk(left) |
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 | |
// the array | |
$array = array('foot', 'bike', 'my'=>'car', 'plane', 'roller'); | |
// seek position | |
$pos="my"; | |
// seek array pointer, behaves end($array) if $pos is no array key | |
for($a=&$array,reset($a);key($a)!==$pos&&each($a);); | |
// should print "car" | |
echo ">".current($array)."<\n"; |
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
set autoindent " automatic indentation | |
set expandtab " expand tabs to spaces | |
set hlsearch " highlight searches | |
set incsearch " do incremental searching | |
set ls=1 " allways show status line | |
set nobackup " disable leaving backup files around | |
set nocompatible " use vim defaults | |
set noignorecase " don't ignore case when searching | |
set nostartofline " don't jump to first character when paging | |
set novisualbell " turn off visual bell |
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
## | |
## SCM info | |
## | |
scm_info() { | |
local bzr_info=`bzr revno --tree 2> /dev/null` | |
if [ ${bzr_info} ]; then | |
if [ "$(bzr st -S)" ]; then | |
local bzr_color='\033[1;31m' | |
else | |
local bzr_color='\033[1;36m' |
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 | |
// set include path to library | |
set_include_path(implode(PATH_SEPARATOR, array( | |
'/opt/ZendFramework-1.10.1/library', | |
get_include_path(), | |
dirname(__FILE__) | |
))); | |
require_once 'Zend/Loader/Autoloader.php'; |
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 SnafuController | |
extends Zend_Rest_Controller { | |
public function indexAction() { | |
// Zend Dispatcher routes to indexAction on every get request | |
// so pass over to getAction | |
$this->getAction(); | |
} |
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 zendphy.php | |
Hello, World |