Skip to content

Instantly share code, notes, and snippets.

Jared Grippe deadlyicon

View GitHub Profile
@deadlyicon
deadlyicon / bash.sh
Created Jun 11, 2019
do this to stop Epic Games Launcher from starting at launch boot
View bash.sh
launchctl unload ~/Library/LaunchAgents/com.epicgames.launcher.plist
rm ~/Library/LaunchAgents/com.epicgames.launcher.plist
@deadlyicon
deadlyicon / CropImage.js
Created Jun 17, 2020
Example of using ReactCrop react-image-crop
View CropImage.js
import React, { useRef, useState } from 'react'
import PropTypes from 'prop-types'
import ReactCrop from 'react-image-crop'
import 'react-image-crop/dist/ReactCrop.css'
export default function CropImage({
className = '',
src,
height,
width,
@deadlyicon
deadlyicon / RawHTML.js
Last active Jun 9, 2020
Rendering raw HTML as Preact components
View RawHTML.js
import { h, Fragment } from 'preact'
import { memo } from 'preact/compat'
import PropTypes from 'prop-types'
import Link from 'components/Link'
const RawHTML = memo(({source = '', ignoreNodes = []}) => {
const parser = new global.DOMParser()
const doc = parser.parseFromString(source, "text/html")
const options = {
View benchmark_example.js
#!/usr/bin/env node
function sortSortedWithArrayManipulation(a, b){
a = [...a]
b = [...b]
const sorted = []
while (a.length || b.length){
if (a.length === 0){
sorted.push(...b)
break
View 5e-spell-alernatives.js
#!/usr/bin/env node
const fs = require('fs')
const words = fs.readFileSync('/usr/share/dict/words').toString().split(/\n+/g)
const spells = ["Abi-Dalzim’s Horrid Wilting","Absorb Elements","Acid Splash","Aganazzar’s Scorcher","Aid","Alarm (Ritual)","Alter Self","Animal Friendship","Animal Messenger (Ritual)","Animal Shapes","Animate Dead","Animate Objects","Antilife Shell","Antimagic Field","Antipathy/Sympathy","Arcane Eye","Arcane Gate","Arcane Lock","Armor of Agathys","Arms of Hadar","Astral Projection","Augury (Ritual)","Aura of Life","Aura of Purity","Aura of Vitality","Awaken","Bane","Banishing Smite","Banishment","Barkskin","Beacon of Hope","Beast Bond","Beast Sense (Ritual)","Bestow Curse","Bigby’s Hand","Blade Barrier","Blade Ward","Bless","Blight","Blinding Smite","Blindness/Deafness","Blink","Blur","Bones of the Earth","Booming Blade","Branding Smite","Burning Hands","Call Lightning","Calm Emotions","Catapult","Catnap","Cause Fear","Ceremony (Ritual)","Chain Lightning","Chaos Bolt","Charm Monster",
@deadlyicon
deadlyicon / knapsack_amend.rb
Created Apr 11, 2016
# Monkey Patch Knapsack to merge reports instead of overwrite
View knapsack_amend.rb
# Monkey Patch Knapsack to merge reports instead of overwrite
begin
class Knapsack::Report
alias_method :save_without_leading_existing_report, :save
def save
Knapsack::Presenter.existing_report = open
save_without_leading_existing_report
end
end
@deadlyicon
deadlyicon / gists_modeling.sql
Last active May 11, 2019
Data modeling for gist clone service
View gists_modeling.sql
CREATE EXTENSION IF NOT EXISTS uuid-ossp;
CREATE TABLE IF NOT EXISTS users (
user_id uuid PRIMARY KEY DEFAULT uuid_generate_v1mc(),
email text UNIQUE,
password_hash text,
username text,
avatar_url text
);
View bears.js
alert('🏂');
alert('🏂');
alert('🏂');
alert('🏂');
View better_sprockets_coffee_script_syntax_errors.rb
class << Sprockets::CoffeeScriptProcessor
SYNTAX_ERROR_MESSAGE = /SyntaxError: \[stdin\]:(\d+):(\d+)/
def call_with_better_errors(input)
call_without_better_errors(input)
rescue ExecJS::RuntimeError => error
raise error unless error.message.match(SYNTAX_ERROR_MESSAGE)
line, col = $1, $2
message = "SyntaxError: #{input[:filename]}:#{line}:#{col}"
message += "\n\n#{add_line_numbers(input[:data])}"
@deadlyicon
deadlyicon / README.md
Last active May 17, 2018
A subclass of the Spec reporter that prints the details of a test failure as soon as it fails
View README.md

Customer Mocha Reporter

…that prints the details of the test failure error as soon as a test fails.

Why? I hate having to wait until my long test suite finishes to begin debugging why a test fails.

You can’t perform that action at this time.