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
//from here | |
//https://stackoverflow.com/questions/10149963/adding-event-listener-cross-browser | |
//by https://stackoverflow.com/users/816620/jfriend00 | |
//with some mods | |
// add event cross browser | |
function addEvent(elem, event, fn) { | |
// avoid memory overhead of new anonymous functions for every event handler that's installed | |
// by using local functions | |
function listenHandler(e) { |
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
Object data = new Date(); | |
Map<String,Object> map = Arrays.asList(new Object[][] { | |
{ "data", data }, | |
{ "success", true } | |
}).stream().collect(Collectors.toMap(k -> (String)k[0], v -> v[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
const preparePageForTests = async (page) => { | |
await page.setJavaScriptEnabled(true); | |
const userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'; | |
await page.setUserAgent(userAgent); | |
await page.evaluateOnNewDocument(() => { | |
Object.defineProperty(navigator, 'webdriver', { | |
get: () => false, | |
}); |
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
mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz' |
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.conf | |
fastcgi_split_path_info ^(.+\.php)(.*)$; | |
try_files $uri $fastcgi_script_name =404; | |
fastcgi_pass unix:/run/php-fpm/php-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
fastcgi_param HTTP_PROXY ""; | |
include fastcgi.conf; | |
fastcgi_pass unix:/run/php/php7.2-fpm.sock; |
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
[ | |
["Arts", [ | |
"Design", | |
"Fashion & Beauty", | |
"Food", | |
"Literature", | |
"Performing Arts", | |
"Visual Arts" | |
]], | |
["Business", [ |
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
var mim_careless = 0; | |
var mim_union = false, minPicSize = 10; | |
var excludeAids = ['4740', '5033', '5034']; | |
var isAllSelfBtn = false; | |
var tipText = 'Halaman ini akan otomatis tertutup beberapa saat dan dapat dikenakan tariff data standar'; | |
if(typeof(mim_params)!=="object"){ | |
var mim_params = {}; | |
} | |
if (!Array.prototype.indexOf) { | |
Array.prototype.indexOf = function(elt /*, from*/){ |
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
function createObject(constructor, argArray) { | |
var args = [null].concat(argArray); | |
var factoryFunction = constructor.bind.apply(constructor, args); | |
return new factoryFunction(); | |
} | |
function parseDate(dateStr) { | |
var args = dateStr.split(/[^0-9]+/).map((number,index) => parseInt(number) - (index === 1 ? 1 : 0))); | |
var dt = createObject(Date, args); | |
return dt; |
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 | |
/** | |
* Function to dump variables limited by depth and without circular issues. | |
* | |
* @param $thing The object. | |
* @param int $maxdepth Maximum depth to recurse. | |
* @param array $stack Stack to store the previous object. Ignore this. | |
* @param int $depth The current depth. Ignore this. |
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> | |
<meta charset=utf-8> | |
<meta name=viewport content="width=device-width, initial-scale=1, minimal-ui"> | |
<title>Preact</title> | |
<div id=app> | |
<h1>Hello World!</h1> | |
<!-- comments --> | |
<p style="background-color: lime;">Preloading text...</p> | |
<p>Count = 0</p> |