Skip to content

Instantly share code, notes, and snippets.

View unostar's full-sized avatar

Alexei Danilchik unostar

View GitHub Profile
@unostar
unostar / filter array
Last active January 23, 2022 14:47
Filter out multi-dimensional arrays
console.time("filter");
let cat = ([].concat.apply([], this.transits.map(item => item.categories))).filter((value, index, self) => self.indexOf(value) === index);
console.timeEnd("filter");
console.time("set");
let cat2 = [...new Set([].concat.apply([], this.transits.map(item => item.categories)))];
console.timeEnd("set");
console.time("flat")
let cat3 = [...new Set(this.transits.map(item => item.categories).flat())];
// Replace bundled WP version of jQuery with the latest one
function replace_core_jquery_version() {
if (!is_admin()) {
wp_deregister_script( 'jquery-core' );
wp_register_script( 'jquery-core', "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js", array(), '3.2.1' );
wp_deregister_script( 'jquery-migrate' );
wp_register_script( 'jquery-migrate', "https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.0.1/jquery-migrate.min.js", array(), '3.0.1' );
}
}
add_action('init', 'replace_core_jquery_version' );
@unostar
unostar / fcop
Created September 10, 2009 10:32
fcop
<title>Keygen & ScriptDecryptor</title>
<form method="post">
<input type="file" name="path"><br>
<input type="submit" name="decrypt" value="Decrypt">
</form>
<form method="post">
<input type="file" name="path"><br>
<input type="submit" name="encrypt" value="Encrypt">
</form>
<form method="post">