Skip to content

Instantly share code, notes, and snippets.

View ricealexander's full-sized avatar

Alex Rice ricealexander

View GitHub Profile
@ricealexander
ricealexander / real_javascript_names.js
Last active January 2, 2021 00:29
A collection of prototype methods that have a different name than their original proposal
// Array.prototype.contains: https://esdiscuss.org/topic/having-a-non-enumerable-array-prototype-contains-may-not-be-web-compatible
// Array.prototype.flatten: https://developers.google.com/web/updates/2018/03/smooshgate
// String.prototype.contains: https://bugzilla.mozilla.org/show_bug.cgi?id=1102219
// globalThis: https://github.com/tc39/proposal-global/blob/master/NAMING.md
Array.prototype.all = Array.prototype.every
Array.prototype.any = Array.prototype.some
Array.prototype.contains = Array.prototype.includes
Array.prototype.flatten = Array.prototype.flat
@ricealexander
ricealexander / getCommitsByWeekday.js
Created January 19, 2020 01:35
Run on a Github profile to get commit counts by day of week
function getCommits () {
const days = Array.from(document.querySelectorAll('rect.day'))
return days
.map(({dataset}) => {
const date = new Date(`${dataset.date} 00:00:00`)
return {
count: dataset.count,
weekday: date.toLocaleDateString('en-US', { weekday: 'long' }),

🧮 🩹 🧑 🧑‍🎨 🇦🇨 🧑‍🚀 🛺 🪓 🦡 🥯 👨‍🦲 👩‍🦲 🩰 🪕 🧺 🧔 🧃 🧢 👱‍♂️ 👱 👱‍♀️ 🟦 🦴 ⛹️‍♂️ ⛹️ ⛹️‍♀️ 🇧🇻 🥣 🧠 🤱 🧱 🥦 🧹 🟤 🤎 🟫 🧈 🥫 🤸 🇪🇦 🪑 ♟️ 🧒 🥢 🧗 🧗‍♂️ 🧗‍♀️ 🇨🇵 🧥 🥥 🥶 🧭 🧑‍🍳 💏 🏏 🥤 🧁 🥌 👨‍🦱 👩‍🦱 🤬 🥩 🧏‍♂️ 🧏 🧏‍♀️ 🇩🇬 🤿 🪔 🧬 🩸 🥟 🦻 ⏏️ 🧝 🧝‍♂️ 🧝‍♀️ :engla

@ricealexander
ricealexander / emoji-list.md
Last active March 31, 2025 18:44 — forked from rxaviers/gist:7360908
Comprehensive list of GitHub-supported emojis
@ricealexander
ricealexander / objectHasProperty.js
Created December 29, 2019 22:01
Ways to determine if an object has a property
const colors = {
seashell: '#FFF5EE',
cornsilk: '#FFF8DC',
lemonchiffon: '#FFFACD',
floralwhite: '#FFFAF0',
snow: '#FFFAFA',
lightyellow: '#FFFFE0',
ivory: '#FFFFF0',
}
const target = 'ivory'
@ricealexander
ricealexander / gallery-class.js
Created December 28, 2019 16:43
/exercises/58 - Gallery/gallery.js Refactor of Gallery to use Class syntax
@ricealexander
ricealexander / getFormData.js
Created December 11, 2019 01:00
Ways to get values of form elements
const form = document.querySelector('form')
// Our hypothetical form has the following elements:
// input[type="text"][name="fname"]
// input[type="text"][name="lname"]
// input[type="text"][name="zip"]
// input[type="email"][name="email"]
// Ways to Get Form Values:
@ricealexander
ricealexander / project_settings.json
Last active August 18, 2021 20:44
VSCode settings with rationale
// Project settings should contain only settings that have an impact on the codebase
// These settings may change how editor interacts with files. All settings that have to do
// with UI or opinionated editor behavior that doesn't affect code should go in user settings
// Editor Settings
// editor.insertSpaces, editor.tabSize: Prefer 2️⃣space indentation
// ESLint Settings
// editor.codeActionsOnSave Auto-correct ESLint code
@ricealexander
ricealexander / .eslintrc.json
Last active June 21, 2021 23:16
Personal ESLint preferences with rationale
// DEPRECATED! SEE https://github.com/ricealexander/eslint-config-webtrinkets for up-to-date version
// Some Symbols used:
// ⭐️ - very strong preference
// 🤔 - very loose preference
// 🔥 - disabled and would not consider enabling
// ⚗ - testing out a rule
// 💔 - could not be configured in desired way
// 🐝 - did not work as expected or caused clashes with other rules
@ricealexander
ricealexander / array-quiz.md
Last active November 29, 2019 18:20
Arrays Quiz

(1.) Which of the following are valid arrays (Answer all that apply)

const A = ["Harder", "Better", "Faster", "Stronger"];
const B = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89];
const C = [
  "Urban Chestnut",
  2009,
  "4Hands",
 2011,