Skip to content

Instantly share code, notes, and snippets.

James Browning Jamesernator

View GitHub Profile
View api-cheatsheet-array.md

Array<T>

Array<T>.prototype.*

  • concat(: (T | Array<T>)[]): T[]
    concat(items) 🔒
    • Returns a new array that is the concatenation of this and all items. Non-array parameters are treated as if they were arrays with single elements.
    • ES3
    • ['a'].concat('b', ['c', 'd']) → [ 'a', 'b', 'c', 'd' ]
  • copyWithin(:number, :number, ?:number): this
View drawLine.js
async function drawCircles(mousedownEvent) {
const { top, left } = theCanvas.getBoundingClientRect()
for await (const clickEvent of clicks(theCanvas)) {
const radius = Math.random() * 19 + 1 // Circles between 1-20 inclusive
const color = randomColor()
drawCircle(
theCanvas,
clickEvent.clientX - left,
clickEvent.clientY - top,
radius,
View yieldfromasync.py
async def yieldfromexample():
RESULT = yield from EXPR
# Would become
async def yieldfromexample():
_i = aiter(EXPR)
try:
_y = await anext(_i)
except StopAsyncIteration as _e:
_r = _e.value
@Jamesernator
Jamesernator / steam_names
Last active Jul 27, 2018
This is All Names I've Gone By On Steam Since Choosing Music Names
View steam_names
Boris the Spider
Swamp
Dry County
White Lightning
Murder By Numbers
Dreadmonboogaloo
Expresso Love
Lizard Life
Fuzzbox Voodoo
Makin' Thunderbirds
You can’t perform that action at this time.