Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
stay home, save lives

gaoryrt gaoryrt

🏠
stay home, save lives
View GitHub Profile
@gaoryrt
gaoryrt / 🎵 My Spotify Top Track
Last active Feb 7, 2022
🎧 My music over 4 weeks
View 🎵 My Spotify Top Track
Seven Nation Army - The The White Stripes
Make You Feel My Love Adele
Tired Adele
Daydreamer Adele
Hometown Glory Adele
Best For Last Adele
My Same Adele
Right As Rain Adele
Crazy For You Adele
Chasing Pavements Adele
View gist:490316fd2208f98a1281c248ca24c016
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%">
    <defs>
      <filter id="noise" x="0" y="0" width="100%" height="100%" filterUnits="objectBoundingBox" primitiveUnits="userSpaceOnUse" color-interpolation-filters="linearRGB">
        <feTurbulence type="fractalNoise" baseFrequency=".45 .45" numOctaves="1" seed="1" stitchTiles="noStitch" x="0%" y="0%" width="100%" height="100%" result="turbulence1"/>
        <feBlend mode="multiply" x="0%" y="0%" width="100%" height="100%" in="SourceGraphic" in2="turbulence1" result="blend"/>
      </filter>
    </defs>
  </svg>
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/