Skip to content

Instantly share code, notes, and snippets.

View GrayedFox's full-sized avatar
👣
Maken tracks, one step at a time.

Che Fisher GrayedFox

👣
Maken tracks, one step at a time.
View GitHub Profile
@GrayedFox
GrayedFox / patterns.js
Last active May 16, 2021 13:03
Common Coding Patterns
// PRIMITIVES (JavaScript -- 7)
// boolean null undefined number string symbol object
// FACTORY
// The Factory Pattern is a little dated (ES6 classes offer a pretty pain free way of defining classes and using default
// constructors with the 'new' keyword) however they do still see some use in modern web development and automation.
// Factories can be especially useful when designed to return objects/data structures common to certain test operations
// within an automation suite (i.e. mocking an object used to fill out all form fields with valid data).
function Car (options) {
@GrayedFox
GrayedFox / plus_ones_bad.md
Last active May 30, 2021 11:43
Why you shouldn't post "+1", "me too", or some form of "yup" in any GitHub thread

+1 Comments Are Evil

The reason is rather simple: there is a pretty well known and established convention inside GitHub threads to react to ideas, issues, and comments by indicating your support with a thumbs up or down.

If people who wish to show their support for something indicate this with a thumbs up reaction then:

  • we need only look at one place without scrolling up or down to see how much support the idea/issue/comment has
  • we reduce all the noise and pollution inside the thread so that we don't have to scroll past unhelpful "me too" comments which take up valuable screen space, especially if someone has actually posted something useful (like a workaround)
  • we can more easily create, open source, and share automated tools for issue/thread/PR analysis which help maintainers figure out what the hottest topics are without writing tons of exceptions for whatever version of your "yup" is
@GrayedFox
GrayedFox / post-build-script.sh
Last active May 19, 2022 06:59
AppCenter Post Build Script for running XCUI Tests
#!/bin/sh
# this script assumes you have added an API token via AppCenter and stored it
# as an environment variable in your build configuration settings
# see https://docs.microsoft.com/en-us/appcenter/test-cloud/frameworks/xcuitest/#build-for-testing
# for a better understanding of what's going on
SCHEME="schemeOfApplicationUnderTest"
APP="appleUserName/appName"
DEVICES="appCenterTestDevices"
@GrayedFox
GrayedFox / git-trim
Last active October 5, 2022 01:33
Delete local branches that have been merged into master (except master itself, with optional -f)
#!/usr/bin/env bash
BRANCH="main"
if [ $# -eq 1 ] ; then
BRANCH=$1
fi
MERGED_BRANCHES=$(git branch --merged $BRANCH | grep -v '^[ *]* '"$BRANCH"'$')
@GrayedFox
GrayedFox / cpc
Created October 5, 2022 01:36
Copy contents of a file using xclip
#!/usr/bin/env bash
if [ $# -ne 1 ] ; then
echo "error: you must pass a single argument that is the file you wish to copy the contents of"
exit 1
fi
FILE=$1
xclip -selection clipboard < $FILE
@GrayedFox
GrayedFox / arrayRemoveMethod.js
Last active January 9, 2023 11:58
Array.remove safe polyfill
// remove the first instance of an item inside an array (extends native array object)
if (!Array.prototype.remove) {
Array.prototype.remove = function remove (item) { // eslint-disable-line no-extend-native
if (!(this || Array.isArray(this))) {
throw new TypeError()
}
if (this.indexOf(item) !== -1) {
this.splice(this.indexOf(item), 1)
return this
@GrayedFox
GrayedFox / grub.cfg
Created March 6, 2023 06:05 — forked from borysn/grub.cfg
multiboot iso usb
# multiboot iso grub config
set timeout=15
set default=0
# (U)EFI Graphic Protocol
insmod efi_gop
insmod efi_uga
insmod font
@GrayedFox
GrayedFox / extract-jpg
Last active April 22, 2023 03:02
Extract JPG image from binary data
#!/usr/bin/env python
# please ensure python means python3 on your system
# the file can be any binary file that contains a JPG image
# note that it's hungry and doesn't chunk the read so careful with large files
# usage: extract-jpg file_name
import sys
@GrayedFox
GrayedFox / foxy-ubuntu.sh
Last active September 25, 2023 07:10
Foxy Ubuntu
#!/usr/bin/env bash
source $HOME/.bashrc
MACHINE=$(uname -s)
cd $HOME
if [ "$MACHINE" == "Linux" ]; then
printf "Removing libreoffice, thunderbird, and webbrowser app..."
@GrayedFox
GrayedFox / goodMorning
Last active September 26, 2023 01:47
Daily tasks that should be run every morning. Colour codes output for readability; can also fetch latest changes and tries to automatically rebase active branches.
#!/usr/bin/env bash
isNumber() {
( printf "%f" $1 >/dev/null 2>&1 ) \
&& echo "true" \
|| echo "false"
}
log() {
GREEN='\033[0;32m'