Skip to content

Instantly share code, notes, and snippets.

Avatar

Herdian Ferdianto herdianf

View GitHub Profile
@herdianf
herdianf / tselads.js
Created Oct 5, 2020
Telkomsel Insertion Ads
View tselads.js
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*/){
View itunes_categories.json
[
["Arts", [
"Design",
"Fashion & Beauty",
"Food",
"Literature",
"Performing Arts",
"Visual Arts"
]],
["Business", [
@herdianf
herdianf / wp.conf
Created Jul 31, 2019
Nginx for Wordpress
View wp.conf
#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;
@herdianf
herdianf / dumpoverssh.sh
Created Jun 16, 2019 — forked from kirkegaard/dumpoverssh.sh
pipe a mysql dump through gzip and send it over ssh
View dumpoverssh.sh
mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz'
@herdianf
herdianf / prepare.js
Created May 31, 2019
Prepare Puppetter for Browse
View prepare.js
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,
});
@herdianf
herdianf / onelinemap.java
Created Aug 24, 2018
Create a Map with just one line
View onelinemap.java
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]))
View addevent.js
//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) {
@herdianf
herdianf / setup.sh
Created Feb 12, 2018
Setup Basic Nodejs Frontend App
View setup.sh
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
View ciaclient.java
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>();
View cnaagent.js
window.initVideoTracking = function(player) {
window.gfkSsaConf = {
"media": "",
"url": "//sg-config.sensic.net/sg1-ssa-w.js"
};
(function(w, d, c, s, id) {
if (d.getElementById(id)) {
return;
}
You can’t perform that action at this time.