Skip to content

Instantly share code, notes, and snippets.

View lucaschen's full-sized avatar
🤔
dord

Lucas Chen lucaschen

🤔
dord
View GitHub Profile
@lucaschen
lucaschen / test output.txt
Last active December 3, 2019 01:42
Apparently JSON.parse is faster than an object literal. If that's the case, then why am I getting these results?
Object literal took 54ms
JSON.parse took 204ms
@lucaschen
lucaschen / circle.js
Created March 17, 2018 11:55
Drawing an ASCII circle
const drawASCIICircle = radius => {
// x^2 + y^2 = radius^2 draws a circle
const expectedValue = radius ** 2;
// imagine a graph with the centre of a circle right on point (0, 0)
for (let y = -radius; y <= radius; y++) {
// y first, because we go across before we go down (inner loop runs more often)
for (let x = -radius; x <= radius; x++) {
const computedValue = x ** 2 + y ** 2;
@lucaschen
lucaschen / My favourite Atom packages.txt
Created February 3, 2018 03:31
My favourite Atom packages
close-other-tabs
css-declaration-sorter
file-icons
language-babel
language-dotenv
language-gitignore
minimap
minimap-highlight-selected
prettier-atom
@lucaschen
lucaschen / snippets.cson
Last active February 8, 2018 07:58
Atom snippets for React and React Native development
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#