This file contains hidden or 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 | |
| // double any value whose key starts with 'b' | |
| $arr = array('a'=>1, 'b1'=>2, 'b2'=>3, 'c'=>4, 'd'=>5); | |
| $non_array = null; | |
| // Normal usage with an array | |
| print "Test 1:\n"; | |
| foreach ($arr as $key => $val) { | |
| print "Key $key, Value $val\n"; |
This file contains hidden or 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
| .image { | |
| /* image properties */ | |
| } | |
| .image:hover { | |
| -o-transition-duration: .33s; | |
| -o-transition-property: border, color, opacity, -moz-opacity; | |
| -webkit-transition-duration: .33s; | |
| -webkit-transition-property: border, color, opacity, -moz-opacity; | |
| filter:alpha(opacity=50); |
This file contains hidden or 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 if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler"); else ob_start(); ?> |
This file contains hidden or 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 | |
| $ua = $_SERVER['HTTP_USER_AGENT']; | |
| if (strpos($ua,'MSIE') != false && strpos($ua,'Opera') === false) | |
| { | |
| if (strpos($ua,'Windows NT 5.2') != false) | |
| { | |
| if(strpos($ua,'.NET CLR') === false) return; | |
| } | |
| if (substr($ua,strpos($ua,'MSIE')+5,1) < 7) | |
| { |
This file contains hidden or 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
| //add to ~/.gitconfig | |
| [alias] | |
| cp = cherry-pick | |
| st = status -s | |
| ci = commit | |
| br = branch | |
| co = checkout | |
| df = diff --wrod-diff | |
| lg = log -pm |
This file contains hidden or 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
| wget -O - 'http://www.elektroda.pl/' | \ | |
| grep -o '<img src=['"'"'"][^"'"'"']*['"'"'"]' | \ | |
| sed -e 's/^<img src=['"'"'"]//' -e 's/["'"'"']$//' | |
| wget -O - http://stackoverflow.com | \ | |
| grep -o '<a href=['"'"'"][^"'"'"']*['"'"'"]' | \ | |
| sed -e 's/^<a href=["'"'"']//' -e 's/["'"'"']$//' |
This file contains hidden or 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
| git rm $(git ls-files --deleted) |
This file contains hidden or 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
| //vim ~/.bashrc | |
| /add | |
| alias l='ls -Ahq --group-directories-first --color' | |
| //run with full details files | |
| l -l |
This file contains hidden or 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 | |
| /* | |
| ** Merge sort algorithm | |
| * | |
| * @author: Sven Anders Robbestad | |
| * | |
| * These are algorithms I'm writing as part | |
| * of a course on Stanford called | |
| * Algorithms: Design and Analysis by Tim Roughgarden |
This file contains hidden or 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
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " Hacks, etc. | |
| """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
| " statusline | |
| set laststatus=2 | |
| "let g:lightline = { 'colorscheme': 'wombat', 'component': { 'readonly': '%{&readonly?"⭤":""}', } } | |
| let g:lightline = { | |
| \ 'colorscheme': 'wombat', | |
| \ 'component': { | |
| \ 'readonly': '%{&readonly?"⭤":""}', |