Skip to content

Instantly share code, notes, and snippets.

# Below are some examples of what I love about Ruby
# Code that reads like English
10.times { print 'Hello' }
this_variable_is_true = true
print 'Something' if this_variable_is_true
# Metaprogramming
class Integer
/*
* Below are the type definitions
* I used to store the data that
* makes up these skill pages!
*/
export type SkillStats = {
years: number | string;
used: string;
likes: string;
@TaylorBeeston
TaylorBeeston / example.js
Last active July 16, 2020 16:20
Javascript Examples
/*
* Below are some examples of the kind of Javascript I like to write
* (Please note, these are contrived examples that might be silly in real life)
*/
// Big Arrow Notation
const addNumbers = (num1, num2) => num1 + num2;
// Object Destructuring and String Interpolation
const anyOrderArgs = ({ title = 'Title', body = 'Body' }) =>
@TaylorBeeston
TaylorBeeston / photoOptimizer.js
Last active July 11, 2022 20:39
Optimize photos client-side
const MAX_WIDTH = process.env.PHOTO_MAX_WIDTH || 800;
const QUALITY = process.env.PHOTO_QUALITY || 0.9;
const readPhoto = async (photo) => {
const canvas = document.createElement('canvas');
const img = document.createElement('img');
// create img element from File object
img.src = await new Promise((resolve) => {
const reader = new FileReader();