Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View elijahmanor's full-sized avatar
😀

Elijah Manor elijahmanor

😀
View GitHub Profile
@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 / 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 / .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!
@elijahmanor
elijahmanor / realtime-twitter-banner.json
Created June 5, 2022 17:12
Real-time Twitter Banner Config
{
"editor": "source",
"widgets": [
{
"data": {
"type": "user"
},
"type": "background"
},
{
@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 / main.go
Last active February 18, 2022 22:25
Tmux Status Right
package main
import (
"fmt"
"strings"
"os/exec"
"strconv"
)
const white = "#f8f8f2"
@elijahmanor
elijahmanor / index.html
Last active January 10, 2022 14:31
Fill JavaScript Array #jsbench #jsperf (http://jsbench.github.io/#2bcdfb2f21a686a56efc07d17e471a85) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Fill JavaScript Array #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@elijahmanor
elijahmanor / firebase.js
Created September 24, 2020 12:40
Firebase Code inside a Next.js API Function
const firebase = require("firebase");
// Required for side-effects
require("firebase/firestore");
const firebaseConfig = { /* ... */ };
try {
firebase.initializeApp(firebaseConfig);
} catch (error) {
/*
@elijahmanor
elijahmanor / index.html
Last active March 12, 2020 16:11
react-playground
<div id="app"></div>
@elijahmanor
elijahmanor / agnoster.zsh-theme
Created January 2, 2020 15:23
agnoster.zsh-theme with random emoji
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline