Skip to content

Instantly share code, notes, and snippets.

@pingyen
pingyen / ascii.js
Created January 15, 2016 06:50
Get ASCII code of characters in a string
var a = [];
'abcdefghijk'.split('').forEach(function(c) {
a.push(c.charCodeAt(0));
});
console.log(a);
@pingyen
pingyen / googlePlayLangs.json
Created January 6, 2016 03:17
Google Play Language List
[
"Afrikaans – af",
"Amharic – am",
"Arabic – ar",
"Armenian – hy-AM",
"Azerbaijani – az-AZ",
"Basque – eu-ES",
"Belarusian – be",
"Bengali – bn-BD",
"Bulgarian – bg",
@pingyen
pingyen / regionCountryLanguage.json
Created January 5, 2016 07:12
Apple App Store regionCountryLanguage.json
{
"data":[
{
"region":"EUR",
"storeFronts":[
{
"storeFront":"Albania",
"country":"AL",
"supportedLocaleCodes":[
"en-GB"
@pingyen
pingyen / countryName.json
Created January 4, 2016 03:41
Country Code to Country Name Map
{
"BD":"Bangladesh",
"BE":"Belgium",
"BF":"Burkina Faso",
"BG":"Bulgaria",
"BA":"Bosnia and Herzegovina",
"BB":"Barbados",
"WF":"Wallis and Futuna",
"BL":"Saint Barthelemy",
"BM":"Bermuda",
@pingyen
pingyen / countryCodes.json
Created January 4, 2016 03:39
Country Name to Country Code Map
{
"Bangladesh":"BD",
"Belgium":"BE",
"Burkina Faso":"BF",
"Bulgaria":"BG",
"Bosnia and Herzegovina":"BA",
"Barbados":"BB",
"Wallis and Futuna":"WF",
"Saint Barthelemy":"BL",
"Bermuda":"BM",
@pingyen
pingyen / formatJSON.php
Created August 11, 2015 06:22
JSON Formatter
<?php
$path = '/path/to';
foreach(scandir($path) as $file) {
if (substr($file, -5) === '.json') {
$path2 = "$path/$file";
file_put_contents($path2, shell_exec("cat $path2 | python -m json.tool"));
}
}
?>
@pingyen
pingyen / xgettext.text
Created June 10, 2015 15:22
xgettext Example
$ xgettext -L PHP *.php includes/*.php -p languages/zh-Hant-TW/LC_MESSAGES -n --default-domain=default --from-code=UTF-8
@pingyen
pingyen / emscripten.txt
Created June 9, 2015 05:26
Emscripten Installation Guide
$ sudo apt-get install python-software-properties
$ sudo apt-add-repository ppa:chris-lea/node.js
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install nodejs default-jre
$ sudo apt-get install gcc-4.8 g++-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
$ wget http://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.tar.gz
$ tar zxvf cmake-3.2.3-Linux-x86_64.tar.gz
@pingyen
pingyen / fbUserDump.php
Last active August 29, 2015 14:20
Download Facebook User Feed
<?php
$access_token = isset($argv[1]) ? $argv[1] : 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456';
$user_id = 'me';
/* feed */
$until = time();
$since = intval(substr(array_values(array_filter(scandir(__DIR__ . '/feed/', true), function($val) { return substr($val, -5) === '.json'; }))[0], 0, -5));
@pingyen
pingyen / fbGroupDump.php
Last active August 29, 2015 14:20
Download Facebook Group Feed, Memebers, & About
<?php
ini_set('date.timezone', 'Asia/Taipei');
$access_token = isset($argv[1]) ? $argv[1] : 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456';
$group_id = 123456789012345;
/* feed */