This file contains hidden or 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 | |
define('LOGIN', 'xxxxx'); | |
define('API_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); | |
define('END_POINT', 'http://api.bit.ly/v3'); | |
function getShortUrl($longUrl) | |
{ | |
$query = http_build_query( | |
array( | |
'login' => LOGIN, |
This file contains hidden or 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 | |
# Closure Sample PHP >= 5.3 | |
$var = 'FRESH_'; | |
$func = function($str) use ($var) | |
{ | |
return $var.strtoupper($str); | |
}; | |
This file contains hidden or 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
$ adb devices #check connected device | |
$ adb uninstall <package name> | |
$ adb install <apk filename> |
This file contains hidden or 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
SampleTask task = new SampleTask(this); | |
task.execute(stringValues); | |
//check task status | |
if(task.getStatus() != AsyncTask.Status.FINISHED) { | |
if(!task.isCancelled) { | |
//call SampleTask.onCancelled() | |
task.cancel(); | |
} | |
} |
This file contains hidden or 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 (!function_exists('http_post_contents')) { | |
function http_post_contents($url, $params) { | |
$content = http_build_query($params, '', '&'); | |
$header = array( | |
"Content-Type: application/x-www-form-urlencoded", | |
"Content-Length: ".strlen($content) | |
); | |
$options = array( |
This file contains hidden or 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 | |
define('USERNAME', 'xxxxxxxx'); | |
define('PASSWORD', 'xxxxxxxxxxxxxx'); | |
define('END_POINT', 'http://im.kayac.com/api/post/'.USERNAME); | |
$postMessage = urlencode('東京スカイツリーにきたよ!'); | |
$data = array( | |
'message' => 'Push from im.kayac.com', |
This file contains hidden or 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
$ find . -type f | xargs -n 10 nkf -w -Lu --overwrite |
This file contains hidden or 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
try { | |
Process ps = Runtime.getRuntime().exec("ps"); | |
BufferedReader reader = new BufferedReader(new InputStreamReader(ps.getInputStream())); | |
int read; | |
char[] buffer = new char[4096]; | |
StringBuffer output = new StringBuffer(); | |
while ((read = reader.read(buffer)) > 0) { | |
output.append(buffer, 0, read); |
This file contains hidden or 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
$ find . -depth -name '.DS_Store' -exec git rm --cached '{}' \; -print |
This file contains hidden or 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
# start emulator shell | |
$ adb shell | |
# on emelator | |
setprop net.dns1 8.8.8.8 | |
setprop net.dns2 8.8.4.4 |
OlderNewer