- GitHub Trending http://github.com/trending
- The Changelog http://thechangelog.com
- Hacker News http://news.ycombinator.com
- FripFrap http://fripfrap.io/
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
import glob | |
index = dict() | |
for (i, filename) in enumerate(glob.glob('collection/*.txt')): | |
print "%d %d" % (len(index.keys()), i) | |
with open(filename) as f: | |
for line in f: | |
words = line.strip().split(' ') | |
for word in words: | |
try: | |
index[word] += 1 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 10 columns, instead of 6. in line 4.
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
Stage, Ref L max, Ref L avg, Ref D max, Ref D avg, MT L max, MT L avg, MT D max, MT D avg, | |
Role id, 0.959, 0.803, 0.778, 0.582, 0.956, 0.795, 0.667, 0.501, | |
Role class, 0.862, 0.715, 0.574, 0.466, 0.881, 0.721, 0.525, 0.434, | |
Actions, 0.979, 0.821, 0.917, 0.650, 0.971, 0.839, 0.700, 0.577, | |
Actions align, 0.908, 0.737, 0.429, 0.332, | |
Role align, 0.709, 0.523, 0.378, 0.266, |
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
(function() { | |
var id_counter = 1; | |
Object.defineProperty(Object.prototype, "__uniqueId", { | |
writable: true | |
}); | |
Object.defineProperty(Object.prototype, "uniqueId", { | |
get: function() { | |
if (this.__uniqueId == undefined) | |
this.__uniqueId = id_counter++; | |
return this.__uniqueId; |
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 preg_match_callback($expression, $subject, $callback) { | |
static $matches_count = 0; | |
preg_replace_callback($expression, function($matches) use($callback) { | |
call_user_func($callback, $matches); | |
}, $subject, -1, $matches_count); | |
return $matches_count; | |
} |
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 Colorize { | |
static $foreground_colors = array( | |
'bold' => '1', 'dim' => '2', | |
'black' => '0;30', 'dark_gray' => '1;30', | |
'blue' => '0;34', 'light_blue' => '1;34', | |
'green' => '0;32', 'light_green' => '1;32', | |
'cyan' => '0;36', 'light_cyan' => '1;36', |
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 | |
// A short example of my current bot API usage | |
hear("/^close( issue)? #(?P<id>\d+)/iu", function($bot, $msg, $matches) { | |
// This bot likes to work with Redmine | |
$issue = new \Redmine\Issue(); | |
$issue = $issue->find($matches['id']); | |
// Is issue present? |
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 loop($count, $callback) { | |
if (is_int($count)) { | |
for ($i = 0; $i < $count; $i++) { | |
$callback($i); | |
} | |
} | |
elseif(is_array($count)) { | |
$_copy = $count; |
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 | |
// How can foreach be implemented with while? | |
while (list($key, $value) = each($array)) { | |
print "$key is $value".PHP_EOL; | |
} | |
// How to get rid of @ in foreach (@$arr .. ) ? | |
// (this is always a bad practice, but anyway) |
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
CMS: | |
Database configurator: Propel (http://www.propelorm.org/), only migrations? | |
Model: Paris (https://github.com/j4mie/paris) | |
Controller: own, with given tools | |
Router: Klein (https://github.com/chriso/klein.php) | |
Packaging: Composer | |
View: Twig vs Smarty | |
User management: ?? | |
Application: ?? |