This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testing() { | |
return [1, 2, 3]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Kaelan's Data Language Prototype | |
*/ | |
JSON_text | |
= ws members:member* ws { return members; } | |
begin_array = ws "[" ws | |
begin_member = ws "{" ws | |
end_array = ws "]" ws |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a?.b // undefined if `a` is null/undefined, `a.b` otherwise. | |
a == null ? undefined : a.b // using ternary operators |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for await (const line of readLines(filePath)) { | |
console.log(line); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* readLines(path) { | |
let file = await fileOpen(path); | |
try { | |
while (!file.EOF) { | |
yield await file.readLine(); | |
} | |
} finally { | |
await file.close(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import deepcopy as copy | |
from pprint import PrettyPrinter | |
pp = PrettyPrinter(indent=4) | |
echo = pp.pprint | |
class Change: | |
def __init__(self, type, key, value=None): | |
self.type = type | |
self.key = key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { component } from 'hn-core/utils'; | |
import template from './template.html'; | |
component({ | |
name: 'NerdAvatar', | |
bindings: { nerd: '=' }, | |
template | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sample = [(1,1), (1,2), (1,3), (1,4), (1,5), (1,6), | |
(2,4), (2,5), (2,6), | |
(3,1), (3,4), (3,5), (3,6), | |
(4,1), (4,2), (4,3), (4,4), (4,5), (4,6), | |
(6,1), (6,2), (6,3), (6,4), (6,5), (6,6)] | |
def separate(data): | |
""" Separates a list of coordinates into a list of list of coordinates by adjacency """ | |
# create a dict filled with Nones to make loooking up easier |