Skip to content

Instantly share code, notes, and snippets.

View elijahmanor's full-sized avatar
😀

Elijah Manor elijahmanor

😀
View GitHub Profile
@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
@elijahmanor
elijahmanor / .zshrc
Last active May 5, 2023 17:26
ghpr function
function ghpr() {
GH_FORCE_TTY=100% gh pr list | fzf --query "$1" --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 3 | awk '{print $1}' | xargs gh pr checkout
}
# awesome!
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
@elijahmanor
elijahmanor / index-0-non-debounced.js
Last active December 20, 2022 21:14
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 / ChatGTP.js
Created December 4, 2022 19:01
Chat GTP: Show JavaScript code that will reverse a string and take the first 5 characters and uppercase them
function reverseString(str) {
// Step 1: Use the split() method to return a new array
let splitString = str.split(""); // split() method splits a string into an array of substrings
// Step 2: Use the reverse() method to reverse the new created array
let reverseArray = splitString.reverse(); // reverse() method reverses an array in place
// Step 3: Use the join() method to join all elements of the array into a string
let joinArray = reverseArray.join(""); // join() method joins all elements of an array into a string
@elijahmanor
elijahmanor / index.html
Last active October 21, 2022 18:25
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 / gist:4197877
Created December 3, 2012 20:45
Quote: Clever Code
“Debugging is twice as hard as writing the code
in the first place. Therefore, if you write the
code as cleverly as possible, you are, by
definition, not smart enough to debug it.”
--Brian Kernighan