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 | |
# Default variable if not set | |
[ -z "${var:-}" ] && var="Default..." | |
echo "$var" | |
# array declaration |
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 | |
$contents = file_get_contents('http://nod123.cn/'); | |
preg_match_all('/username:\s?([A-Za-z0-9-]+)/i', $contents, $usernames); | |
preg_match_all('/password:\s?([A-Za-z0-9-]+)/i', $contents, $passwords); | |
foreach ($usernames[1] as $key => $username) { | |
if (isset($passwords[1][$key])) { | |
printf("%s:%s\n", $username, $passwords[1][$key]); | |
} | |
} | |
?> |
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 Collection extends SplObjectStorage { | |
public function __construct($mixed = array()) { | |
if ($mixed) { | |
$this->add($mixed); | |
} | |
} | |
public function add($mixed) { |
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
sandbox.git | |
test-project.git |
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
diff --git a/Layout.php b/Layout.php | |
index 46de129..bfd5ded 100644 | |
--- a/Layout.php | |
+++ b/Layout.php | |
@@ -29,6 +29,25 @@ | |
*/ | |
class Zend_Layout | |
{ | |
+ | |
+ /** |
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 Zend_View_Helper_AddLayout { | |
protected $_plugin; | |
public function __construct() { | |
$this->_getPlugin(); | |
} | |
protected function _getPlugin() { |
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
git ls-files | while read f; do git blame -M -- "$f"; done | perl -pe 's/^\^?[a-f0-9]*(?:[^(]* )?\((.*?) +200.*/$1/' | sort | uniq -c | sort -n | tee stats; perl -ne '$s += $1 if /(\d+)/; END{print "$s\n"}' < stats |
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
@admins = one two three | |
@users = five six @admins | |
@admin = project1 project2 | |
repo @admin | |
RW = @users | |
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/zsh | |
[ -z "$1" ] && { | |
echo "What directory do you want me to look in?" | |
exit 1 | |
} | |
[ -d "$1" ] || { | |
echo "'$1' doesn't look like a directory" | |
exit 1 |