Skip to content

Instantly share code, notes, and snippets.

View elijahmanor's full-sized avatar
😀

Elijah Manor elijahmanor

😀
View GitHub Profile
@elijahmanor
elijahmanor / polyfill.element.matches.js
Last active September 30, 2025 12:47
Element matches Polyfill
if (Element && !Element.prototype.matches) {
var proto = Element.prototype;
proto.matches = proto.matchesSelector ||
proto.mozMatchesSelector || proto.msMatchesSelector ||
proto.oMatchesSelector || proto.webkitMatchesSelector;
}
@elijahmanor
elijahmanor / pros-cons-npmscripts-vs-gulp.md
Last active September 27, 2025 02:39
Pros and Cons of `npm scripts` vs Gulp

Comparison of npm scripts vs Gulp

npm scripts

Pros

  • npm scripts are low-level and leverage the actual library you want to use (example: "lint": "eslint ./")
  • package.json is a central place to see what scripts are available (also npm run will list all scripts)
  • When things get too complicated you can always defer to another file (example: "complex-script": "babel-node tools/complex-script.js")
  • npm scripts are more powerful than one might first think (pre/post hooks, passing arguments, config variables, chaining, piping, etc...)
@elijahmanor
elijahmanor / index-0-non-debounced.js
Last active August 6, 2025 13:41
React Debouncing Events
import React, { Component } from "react";
import { render } from "react-dom";
import "./index.css";
class Widget extends Component {
state = { text: "" };
handleChange = (e) => {
this.setState({ text: e.target.value });
};
render() {
@elijahmanor
elijahmanor / README.md
Last active November 21, 2024 16:43
Export @code Extensions to a Markdown List

You can run either of the following snippets in your terminal to generate a markdown list of your VS Code extensions.

code --list-extensions | awk '{ print "* [" $1 "](https://marketplace.visualstudio.com/items\?itemName\=" $1 ")" }'

npx https://gist.github.com/elijahmanor/7f9762a4c2296839ad33e33513e88043

NOTE: You can append | pbcopy to either of the above commands to pipe the output to your Mac's copy/paste buffer.

@elijahmanor
elijahmanor / index.html
Last active August 10, 2024 22:48
Reveal.js External Markdown
<!doctype html>
<html lang="en">
<!-- ... -->
<body>
<div class="reveal">
<div class="slides">
<section data-markdown="slides.md"
data-separator="^\n---\n$"
data-vertical="^\n------\n$"
data-notes="^Notes:"
@elijahmanor
elijahmanor / readme.text
Last active July 10, 2024 04:31
My GitHub Atom Packages
atom-beautify@0.28.21
atom-css-comb@3.0.0
caniuse@0.9.0
easy-motion-redux@1.0.0
editorconfig@1.2.4
emmet@2.4.1
git-blame@0.4.8
git-plus@5.12.1
git-time-machine@1.2.3
jscs-fixer@1.0.2
@elijahmanor
elijahmanor / jokes.md
Last active February 18, 2024 05:02
Front-End Web Dev Jokes

Front-End Web Dev Jokes

Authored by Elijah Manor

  • q. How do you comfort a JavaScript bug? a. You console it

  • When a JavaScript date has gone bad, "Don't call me, I'll callback you. I promise!"

  • Dev1 saw a strange JavaScript function & asked, "What is this?". Dev2 responded, "I don't know. I would've called you, but I was in a bind"

@elijahmanor
elijahmanor / index.js
Last active September 21, 2023 21:07
Audit Single Package
#!/usr/bin/env node
const shell = require("shelljs");
function audit(name) {
const tempDir = `${shell.tempdir()}/audit/${name}`;
shell.mkdir("-p", tempDir);
shell.cd(tempDir);
shell.exec("npm init -y", { silent: true });
shell.exec(`npm install ${name}`, { silent: true });
@elijahmanor
elijahmanor / custom-array-like-object.js
Last active August 9, 2023 12:10
jQuery Array-like Object
var array_like = {};
array_like[ 0 ] = "test 0";
array_like[ 1 ] = "test 1";
array_like[ 2 ] = "test 2";
array_like[ 3 ] = "test 3";
array_like.length = 4;
array_like.splice = [].splice;
@elijahmanor
elijahmanor / README.md
Last active May 6, 2023 23:47
OCR from macOS Terminal

I was reviewing a PR and there was a screenshot of the terminal that had output I wanted in text form.

Terminal Screenshot

So, I installed an OCR tool locally (called tesseract) and converted the PNG into TEXT.

# Install the OCR tool
brew install tesseract tesseract-lang