What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-07 20:49:12
filter 2d array javascript
function filterByPosition(array, number, position) { return array.filter(innerArray => innerArray[position - 1] !== number); } const items = [ [1, 1, 2, 4], [2, 1, 4, 6], [5, 6, 4, 1], [1, 6, 3, 1] ]; const newItems1 = filterByPosition(ite... Add solution -
CSS 2021-11-07 15:22:11
should you disable embed scripts in wordpress
function disable_embeds_code_init() { // Remove the REST API endpoint. remove_action( 'rest_api_init', 'wp_oembed_register_route' ); // Turn off oEmbed auto discovery. add_filter( 'embed_oembed_discover', '__return_false' ); // Don't filter oEmbed... Add solution -
Javascript 2021-11-07 11:15:13
javascript password generator example
function generatePassword(passwordLength) { var numberChars = "0123456789"; var upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var lowerChars = "abcdefghijklmnopqrstuvwxyz"; var allChars = numberChars + upperChars + lower... Add solution -
Javascript 2021-11-07 00:42:10
quick sort in javascript
function quicksort(array) { if (array.length <= 1) { return array; } var pivot = array[0]; var left = []; var right = []; for (var i = 1; i < array.length; i++) { array[i] < pivot ? left.push(array[i]) : right.push(array... Add solution -
Python 2021-11-06 09:26:13
python numpy find nearest value
import numpy as np def find_nearest(array, value): array = np.asarray(array) idx = (np.abs(array - value)).argmin() return array[idx] array = np.random.random(10) print(array) # [ 0.21069679 0.61290182 0.63425412 0.84635244 0.91599191 0.... Add solution -
PHP 2021-11-01 15:47:16
wordpress change posts archive
add_action('init', 'post_slug_rewrite'); /* You can change "blog" to any slug you prefer. line 10 and 12. */ function post_slug_rewrite() { $args = objectToArray( get_post_type_object('post') ); $args['has_archive'] = 'blog'; $args['rewr... Add solution