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 | |
date_default_timezone_set('Asia/Bangkok'); | |
echo date('d-m-Y H:i:s'); | |
?> |
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
# for delete all .DS_Store in folder | |
>find . -name '*.DS_Store' -type f -delete |
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
curl -A "Mozilla" "http://translate.google.com/translate_tts?tl=en&q=hello+world" > hello.mp3 |
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
cat .git/config |
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
// Android check orientation | |
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { | |
// landscape | |
} else { | |
// portrait | |
} |
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
// The callback interface | |
interface MyCallback { | |
void callbackCall(); | |
} | |
// The class that takes the callback | |
class Worker { | |
MyCallback callback; | |
void onEvent() { |
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 | |
$data = | |
[ | |
'page_title' => 'Login', | |
'second_item' => 'value' | |
... | |
]; | |
return View::make('authentication/login', $data); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
in Route.php | |
<?php | |
Route::get('/listing/{params?}', 'CarController@listing')->where('params', '(.*)'); | |
?> | |
in Controller | |
<?php | |
public function listing($params = null) | |
{ | |
if($params) |
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
package xredis | |
// BLPop is a blocking list pop primitive. | |
// It is the blocking version of LPOP | |
// because it blocks the connection when there are no elements to pop from any of the given lists. | |
// An element is popped from the head of the first list that is non-empty, | |
// with the given keys being checked in the order that they are given. | |
// A nil multi-bulk when no element could be popped and the timeout expired. | |
// A two-element multi-bulk with the first element being the name of the key where an element was popped | |
// and the second element being the value of the popped element. |
OlderNewer