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
void simpleReplace(std::string& str, const std::string& oldStr, const std::string& newStr) | |
{ | |
size_t pos = 0; | |
while((pos = str.find(oldStr, pos)) != std::string::npos) | |
{ | |
str.replace(pos, oldStr.length(), newStr); | |
pos += newStr.length(); | |
} | |
} |
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/sh | |
convertibles=('À' 'Á' 'Ả' 'Ã' 'Ạ' 'Ằ' 'Ắ' 'Ẳ' 'Ẵ' 'Ặ' 'Ă' 'Ầ' 'Ấ' 'Ẩ' 'Ẫ' 'Ậ' 'Â' 'È' 'É' 'Ẻ' 'Ẽ' 'Ẹ' 'Ề' 'Ế' 'Ể' 'Ễ' 'Ệ' 'Ê' 'Ì' 'Í' 'Ỉ' 'Ĩ' 'Ị' 'Ò' 'Ó' 'Ỏ' 'Õ' 'Ọ' 'Ồ' 'Ố' 'Ổ' 'Ỗ' 'Ộ' 'Ô' 'Ờ' 'Ớ' 'Ở' 'Ỡ' 'Ợ' 'Ơ' 'Ù' 'Ú' 'Ủ' 'Ũ' 'Ụ' 'Ừ' 'Ứ' 'Ử' 'Ữ' 'Ự' 'Ư' 'Ỳ' 'Ý' 'Ỷ' 'Ỹ' 'Ỵ' 'Đ' 'à' 'á' 'ả' 'ã' 'ạ' 'ằ' 'ắ' 'ẳ' 'ẵ' 'ặ' 'ă' 'ầ' 'ấ' 'ẩ' 'ẫ' 'ậ' 'â' 'è' 'é' 'ẻ' 'ẽ' 'ẹ' 'ề' 'ế' 'ể' 'ễ' 'ệ' 'ê' 'ì' 'í' 'ỉ' 'ĩ' 'ị' 'ò' 'ó' 'ỏ' 'õ' 'ọ' 'ồ' 'ố' 'ổ' 'ỗ' 'ộ' 'ô' 'ờ' 'ớ' 'ở' 'ỡ' 'ợ' 'ơ' 'ù' 'ú' 'ủ' 'ũ' 'ụ' 'ừ' 'ứ' 'ử' 'ữ' 'ự' 'ư' 'ỳ' 'ý' 'ỷ' 'ỹ' 'ỵ' 'đ') | |
#Usage: convertTo charsetName id | |
function convertTo() { | |
printf "${convertibles[$2]}" | uvconv -f UTF-8 -t $1 | hexdump -e '1/1 "%02X"' | |
} | |
#Usage: makeTable charsetName |
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
(defn fact [n] | |
(loop [n n x (dec n)] | |
(if (= 1 x) | |
n | |
(recur (* n x) (dec x))))) | |
(apply + (->> (bigint 100) | |
fact | |
str | |
(map #(Integer. (str %1))))) |
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
# download word counts | |
wget http://norvig.com/ngrams/count_1w.txt | |
# removed the appended frequency counts | |
sed 's/\t[0-9]*//g' count_1w.txt > count_1w | |
# generate list of words available in WyabdcRealPeopleTTS | |
find /usr/share/WyabdcRealPeopleTTS/ -iname '*.wav'|xargs -I {} basename {} .wav|sort > words.txt | |
#generate most popular English words | |
# load file content to a var |
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
(defn set-term-title | |
"Sets title of current terminal window." | |
[new-title] | |
(printf "%s]2;%s%s" (char 27) new-title (char 7)) | |
(println)) |
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
/* | |
AngularJS v1.1.4 | |
(c) 2010-2012 Google, Inc. http://angularjs.org | |
License: MIT | |
*/ | |
(function(M,V,s){'use strict';function gc(){var b=M.angular;M.angular=hc;return b}function o(b,a,c){var d;if(b)if(I(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==o)b.forEach(a,c);else if(!b||typeof b.length!=="number"?0:typeof b.hasOwnProperty!="function"&&typeof b.constructor!="function"||b instanceof P||ca&&b instanceof ca||Da.call(b)!=="[object Object]"||typeof b.callee==="function")for(d=0;d<b.length;d++)a.call(c,b[d], | |
d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function rb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function ic(b,a,c){for(var d=rb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function sb(b){return function(a,c){b(c,a)}}function Ea(){for(var b=Z.length,a;b;){b--;a=Z[b].charCodeAt(0);if(a==57)return Z[b]="A",Z.join("");if(a==90)Z[b]="0";else return Z[b]=String.fromCharCod |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://cl2-plnkr.herokuapp.com/dev/script.cl2"></script> | |
</head> | |
<body> | |
<h1>Should yell at an unknown error while compiling!</h1> | |
</body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://cl2-plnkr.herokuapp.com/dev/script.cl2"></script> | |
</head> | |
<body> | |
<h1>Should yell an "Error expanding macro"!</h1> | |
</body> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://cl2-plnkr.herokuapp.com/dev/script.cl2"></script> | |
</head> | |
<body> | |
<h1>Should yell at timeout error while compiling!</h1> | |
</body> |
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
<!DOCTYPE html> | |
<html ng-app="plunker"> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js"></script> | |
<script src="http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0-SNAPSHOT.js"></script> | |
<script src="http://cl2-plnkr.herokuapp.com/dev/prelude.js"></script> | |
<script src="http://cl2-plnkr.herokuapp.com/dev/script.cl2"></script> | |
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> | |
</head> | |
<body> |
OlderNewer