I hereby claim:
- I am rip-tyang on github.
- I am quarter2twelve (https://keybase.io/quarter2twelve) on keybase.
- I have a public key ASB7jFDINmcCK_RZyWzAwyNz6FqR822So4rLl1_HgCQMsgo
To claim this, I am signing this object:
# one space between array and no space at the end | |
emojis=(🐶 🐺 🐱 🐭 🐹 🐰 🐸 🐯 🐨 🐻 🐷 🐮 🐵 🐼 🐧 🐍 🐢 🐙 🐠 🐳 🐬 🐥 🍳 🍞 🐓 🐔 🌄 🌲 🌳 🌴 🌵 🌷 🌺 🌸 🌹 🌻 🌼 💐 🌾 🌿 🍀 🍁 🍂 🍃 🍄 ☀️ ⛅️ ☁️ ☔️ 🌈 🌊 🗻 🌍 🌞 💻 🚽 📚 ✂️ 🔪 🍔 🍕 🍖 🍗 🍘 🍙 🍚 🍛 🍜 🍝 🍞 🍟 🍣 🍤 🍥 🍱 🍲 🍳 🍴 🍏 🍇 🍉 🍊 🍌 🍍 🍑 🍒 🍓 🍡 🍢 🍦 🍧 🍨 🍩 🍪 🍫 🍬 🍭 🍮 🍰 🍷 🍸 🍶 🍹 🍺 🍻) | |
# single quote so it will change everytime you hit return | |
function emoji { | |
echo "${emojis[$RANDOM % ${#emojis[@]}]} " | |
} | |
# Get the current ruby version in use with RVM: | |
# if [ -e ~/.rvm/bin/rvm-prompt ]; then | |
# RUBY_PROMPT_="%{$fg_bold[blue]%}rvm:(%{$fg[green]%}\$(~/.rvm/bin/rvm-prompt s i v g)%{$fg_bold[blue]%})%{$reset_color%} " |
#include <stdio.h> | |
int main() { | |
char *s = "#include <stdio.h>%c%cint main() {%c char *s = %c%s%c;%c printf(s, 10, 10, 10, 34, s, 34, 10, 10, 10, 10);%c return 0;%c}%c"; | |
printf(s, 10, 10, 10, 34, s, 34, 10, 10, 10, 10); | |
return 0; | |
} |
I hereby claim:
To claim this, I am signing this object:
class Util | |
@cloneArray: (arr) => | |
if Array.isArray arr | |
_arr = arr.slice 0 | |
return _arr = _arr.map @cloneArray | |
else if typeof arr is 'object' | |
throw Error 'Cannot clone nested array with object' | |
else | |
return arr |
class Util | |
# construct multidimensional array with value or function | |
# @para (size1, size2, size3, ..., value/func) | |
# @func (index1, index2, index3, ...) -> value | |
# example: | |
# Util.arr() -> [] | |
# Util.arr(2) -> [0, 0] | |
# Util.arr(2, 3) -> [3, 3] | |
# Util.arr(2, 3, 0) -> [[0,0,0],[0,0,0]] | |
# Util.arr(2, 3, function (a, b) { return a + b; }) -> [[0,1,2], [1,2,3]] |
class Util | |
# Fisher-Yates (aka Knuth) Shuffle | |
@shuffle: (array) -> | |
currentIndex = array.length | |
# While there remain elements to shuffle... | |
while 0 isnt currentIndex | |
# Pick a remaining element... | |
randomIndex = ~~(Math.random() * currentIndex) | |
--currentIndex | |
# And swap it with the current element. |
class Util | |
@isSquareArray: (arr) -> | |
Array.isArray(arr) && | |
Array.isArray(arr[0]) && | |
arr.length is arr[0].length | |
@rotateArrayClockwise: (arr) -> | |
if not @isSquareArray arr | |
throw Error 'Not a 2 dimensional array' |