View catht.awk
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
#!/usr/bin/awk -f | |
BEGIN { | |
line = 0 | |
split_line_outed = 0; | |
arr[1] = ""; | |
} | |
{ | |
line = NR |
View tokenize.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 | |
function tokenize($str, $minLength = 3) { | |
$strLength = mb_strlen($str); | |
if ($strLength <= $minLength) { | |
return [ | |
"[{$str}", | |
"{$str}]", | |
"[{$str}]" | |
]; |
View Recognize_Score_Model.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 if (!defined('BASEPATH')) exit('No direct script access allowed'); | |
class Recognize_Score_Model extends CI_Model | |
{ | |
private $phashCacheDir; | |
private $phashMap = array(); | |
protected $imgMap = array( | |
'1334x750' => array( | |
'score' => array( | |
'left' => array(468, 87, 66, 35), |
View oneByOne.js
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
/** | |
* call iterate one by one | |
* @param {array|object} collection | |
* @param {function} iterate | |
* @param {function} cb the finished callback | |
*/ | |
function oneByOne(collection, iterate, cb) { | |
var failed = false, | |
completed = 0, // record the count of completed iterate | |
len = 0, |
View execSync
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
var fs = require('fs'); | |
var exec = require('child_process').exec; | |
/** | |
* execSync | |
* | |
* simple version of execSync | |
* refer to 'shelljs -> exec', https://github.com/arturadib/shelljs/blob/master/src/exec.js | |
* @param {String} cmd | |
* @param {Object} option |
View enoughtodo.js
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 goals to do | |
* | |
* Usage: | |
* | |
* var meet = enoughToDo('a', 'b', function(goals) { | |
* // Congratulations! All goals met | |
* // It's enough to do the final callback | |
* console.log(goals); | |
* }); |