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
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
[ | |
["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
#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
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
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
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
//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
npm init -y | |
npm i babel-core babel-preset-env babel-loader babel-preset-es2015 webpack webpack-config-utils webpack-dev-server webpack-dev-middleware webpack-hot-middleware webpack-node-externals html-webpack-plugin extract-text-webpack-plugin copy-webpack-plugin copy-webpack-plugin style-loader css-loader sass-loader node-sass cross-env rimraf --save-dev |
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
private Map<String, Object> processResponse(Map<String, Object> map, | |
final String payload) { | |
//noinspection unchecked | |
final List<Map<String, Object>> namedEntities = (List<Map<String, Object>>) map.remove("namedEntities"); | |
final List<Map<String, Object>> semanticKeywords = (List<Map<String, Object>>) map.remove("semanticKeywords"); | |
final List<Map<String, Object>> taxonomies = (List<Map<String, Object>>) map.remove("taxonomy"); | |
//filter duplicates | |
List<Map<String,Object>> entities = new ArrayList<Map<String, Object>>(); | |
Map<String,Object> keys = new HashMap<String, Object>(); |