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 | |
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
//\u000A\u002F\u002A | |
class PhpJava { | |
static function main() { | |
echo(//\u000A\u002A\u002F | |
"Hello World!"); | |
}} | |
//\u000A\u002F\u002A | |
PhpJava::main(); |
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
git checkout --orphan gh-pages | |
git rm -rf | |
rm '.gitignore' | |
git commit -a -m "commit" | |
git push -f origin gh-pages |
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
//source: http://stackoverflow.com/questions/5186441/javascript-drag-and-drop-for-touch-devices | |
function touchHandler(event) { | |
var touch = event.changedTouches[0]; | |
var simulatedEvent = document.createEvent("MouseEvent"); | |
simulatedEvent.initMouseEvent({ | |
touchstart: "mousedown", | |
touchmove: "mousemove", | |
touchend: "mouseup" | |
}[event.type], true, true, window, 1, |
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
$page = ! empty( $_GET['page'] ) ? (int) $_GET['page'] : 1; | |
$total = count( $yourDataArray ); //total items in array | |
$limit = 20; //per page | |
$totalPages = ceil( $total/ $limit ); //calculate total pages | |
$page = max($page, 1); //get 1 page when $_GET['page'] <= 0 | |
$page = min($page, $totalPages); //get last page when $_GET['page'] > $totalPages | |
$offset = ($page - 1) * $limit; | |
if( $offset < 0 ) $offset = 0; | |
$yourDataArray = array_slice( $yourDataArray, $offset, $limit ); |
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
//prevent to go back | |
history.pushState(null, null, location.href); | |
window.onpopstate = function(event) { | |
history.go(1); | |
}; |
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
//convert image binary | |
function files_to_urls(files, callback) { | |
if (files.length > 0) { | |
var promises = [].map.call(files, function (file) { | |
return new Promise(function (ok, ng) { | |
var reader = new FileReader(); | |
reader.onload = function (ev) { | |
ok(reader.result); | |
}; | |
reader.onabort = function (ev) { |
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
sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist |
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
sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start |
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
Install Composer: curl -sS https://getcomposer.org/installer | php | |
Move to global: sudo mv composer.phar /usr/local/bin/composer | |
Check Composer: php composer.phar | |
Install Laravel: composer create-project laravel/laravel (directory) | |
cd (directory) | |
run on port: php -S localhost:8000 -t public |
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
input, textarea { | |
outline: none; | |
border:1px solid #ccc !important; | |
box-shadow:none !important; | |
} |