Skip to content

Instantly share code, notes, and snippets.

View rikyperdana's full-sized avatar
💭
Alhamdulillah

Riky Perdana rikyperdana

💭
Alhamdulillah
View GitHub Profile
@rikyperdana
rikyperdana / matrix.js
Last active April 19, 2024 02:36
Matrix Operations in JS
withAs = (obj, cb) => cb(obj)
sum = arr => arr.reduce((a, b) => a + b)
mul = arr => arr.reduce((a, b) => a * b)
sub = arr => arr.splice(1).reduce((a, b) => a - b, arr[0])
deepClone = obj => JSON.parse(JSON.stringify(obj))
shifter = (arr, step) => [
...arr.splice(step),
...arr.splice(arr.length - step)
]
@rikyperdana
rikyperdana / statistics.js
Last active September 25, 2021 03:46
Statistics in JS with Functional Paradigm
var
withThis = (obj, cb) => cb(obj),
get = prop => obj => obj[prop],
add = array => array.reduce((acc, inc) => acc + inc),
sub = array => array.reduce((acc, inc) => acc - inc),
mul = array => array.reduce((acc, inc) => acc * inc),
pow = asc => num => Math.pow(num, asc),
range = array => Math.max(...array) - Math.min(...array),
between = (low, middle, high) =>
(low <= middle) && (middle <= high),
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 29, 2024 08:12
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname