Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

gaoryrt gaoryrt

💭
I may be slow to respond.
Block or report user

Report or block gaoryrt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gaoryrt
gaoryrt / fib.js
Last active May 21, 2019
nth fib
View fib.js
const fib = num => num < 3
? 1
: fib(num - 1) + fib(num - 2)
console.log(fib(7))
@gaoryrt
gaoryrt / fibArr.js
Last active Apr 12, 2019
fibArr of length num
View fibArr.js
const sumOfPrev = arr => {
let len = arr.length
return arr[len - 1] + arr[len - 2]
}
const fib = num => {
if (num === 1) return [1]
else if (num === 2) return [1, 1]
else {
const prev = fib(num - 1)
@gaoryrt
gaoryrt / flat.js
Last active May 11, 2019
flatten a nested array
View flat.js
const isArr = arg => Object.prototype.toString.call(arg) === '[object Array]'
const flat = inputAny =>
(
isArr(inputAny[0])
? flat(inputAny[0])
: [inputAny[0]]
)
.concat(
inputAny.length > 1
? flat(inputAny.slice(1))
@gaoryrt
gaoryrt / inline-img.txt
Last active Mar 31, 2018
smalles 1px * 1px transparent image in base64
View inline-img.txt
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==
data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E
data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg"/%3E
http://png-pixel.com/
You can’t perform that action at this time.