What do you want to save?
Add Code snippet
New code examples
-
Other 2021-11-08 16:29:12
map in javascript
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution -
Python 2021-11-08 08:29:14
python numpy find local minima
import numpy as np from scipy.signal import argrelextrema import matplotlib.pyplot as plt x = np.array([6, 3, 5, 2, 1, 4, 9, 7, 8]) y = np.array([2, 1, 3 ,5 ,3 ,9 ,8, 10, 7]) # sort the data in x and rearrange y accordingly sortId = np.argsort(x) x = x[... Add solution -
Javascript 2021-11-08 06:59:08
javascript binary search
const arr = [1, 3, 5, 7, 8, 9]; const binarySearch = (arr, x , start=0, end=arr.length) => { // If the item does not exist, return -1 if(end < start) return -1; // Calculate middle index of the array let mid = Math.floor((start + end) / 2... Add solution -
Shell/Bash 2021-11-07 17:45:20
git get stash on another pc
# 1. Stash current changes git stash # 2. Create stash as patch (0 is the index of the stash) # If you have multiple stashes, you can use >> to append the next # stash to the same file # e.g. .. "stash@{1}" -p >> changes.patch # ..... Add solution -
Other 2021-11-06 20:46:17
unity set dropdown value
IndexOf: // returns a list of the text properties of the options var listAvailableStrings = dropdown.options.Select(option => option.text).ToList(); // returns the index of the given string dropdown.value = listAvailableStrings.IndexOf("an Optio... Add solution -
Javascript 2021-11-05 08:35:19
map function javascript
const myArray = ['Sam', 'Alice', 'Nick', 'Matt']; // Appends text to each element of the array const newArray = myArray.map(name => { return 'My name is ' + name; }); console.log(newArray); // ['My name is Sam', 'My Name is Alice', ...] // Appends ... Add solution