Skip to content

Instantly share code, notes, and snippets.

View crutchcorn's full-sized avatar
Writing like whoa

Corbin Crutchley crutchcorn

Writing like whoa
View GitHub Profile
function fn(arg) {
return arg("Hello, world");
const passThru = fn(arg => funct => funct(arg));
crutchcorn / Awesome Windows
Last active April 20, 2017 17:08
Yes, I know it already exists. It also has nothing new on it
  • Foxit Reader
  • RenameIt!
  • Paint.Net
  • SmartGit
  • AIMP (with YouTube and Soundcloud plugins)
  • MediaMonkey
  • Typora
  • AquaSnap
  • PicPick
  • OBS
crutchcorn / .bashrc
Last active February 1, 2019 18:21
WSL Setup File
# Switch to ZSH shell
if test -t 1; then
exec zsh
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
recursive = (el) => el.children && el.children.length !== 0 ? Array.from(el.children).reduce((prev, child) => [...prev, ...recursive(child)], Array.from(el.children)) : [el];
$$('.js-hotel-result').forEach(hotelEl => {
const isBad = recursive(hotelEl).reduce((prev, el) => prev || !!(/^ ?[2-9][0-9](?:\.[0-9]+)? miles.*/).exec(el.innerText), false);
if (isBad) {
crutchcorn /
Created October 31, 2018 03:24
Dashpass Golf

c='children',l='reduce' - This creates two variables that I can reuse. Obviously, l is shorter than reduce, so I want to create aliases for the things we're gonna reuse. What these strings do will be explained later

r=e=> is creating a function called r that takes an argument e and returns what's after => (which I'm about to explain in a second)

e[c]&&e[c].length>0 - Remember that c = 'children'. We're checking that the argument supplied to function r (e) both has a property called children and that it contains more than 1 element in the list (the purpose of r (also called recurse for normal code version) is to be able to go down a tree of elements in a webpage and return a list of every child of any element)

[...e[c]] - We're taking the children of the argument and turning it into an array (previously, it was a list a lot LIKE an array, but it didn't have the reduce function we'll need to call in a second)


* @callback objectMapCallback
* @param value - The value of the key that is currently being modified. Added as an attempt to duplicate `value`
* @param {string} key - The key that is currently being modified. Added as an attempt to duplicate `index`
* @param object - The original untouched object that the map function is being called on. Added as an attempt to duplicate `array`
* Map through all keys in an object and call a CB. Assign that CB's return value to the key in question
* @param object - The object to make this call on. This would otherwise be bound to `Object.prototype` but I don't like breaking the web
crutchcorn / scroll.js
Last active December 18, 2018 16:48
Ya ever want to scroll to the top of a page to take a screenshot on a 3rd party website? No? Oh. Okay.
a = setInterval(() => window.scrollTo(0, document.body.scrollHeight), 100);
crutchcorn /
Last active January 21, 2019 21:27
Anxiety Advice
  • Force deep and very slow breaths even if it feels a tiny bit like you can't breath (don't do so to the point where you're sufficating, but a minor discomfort is perfect normal (for me, since the intended effect is to be able to bypass your want to retract and panic) and okay. The intended effect is to slow the heart-rate which tricks your brain to calm down)
    • Inhale thru the nose, out the mouth.
    • Breath out through your mouth slowly, feel free to breath in more quickly but don't do that too fast either
  • Take slow movements
  • Sit up straight, don't lock up your shoulders (this reminds your brain that you're alright instead of instinctually locking up and reinforcing the anxiety)
  • Exhale super deeply until you can't exhale anymore, as if you were squeezing out all the oxygen from a bottle. This will allow your
crutchcorn / typescript-generics.ts
Created December 4, 2018 03:28
Typescript generics rough intro
// So, let's say you have a function that you want to accept any function type and return that type
// Don't worry about why right away, just
function returnSelf(a: any): any {
return a;

Before we can dive into how many front-end frameworks that you may have heard of work, we need to set a baseline of information. If you're already familiar with how the DOM represents a tree and how the browser takes that information and utilizes it, great! You're ready to read ahead! Otherwise, it's strongly suggested that you take a look at our post introducing the concepts required to understanding some of the baseline to this post

You may have heard about various frameworks and libraries that modern front-end developers utilize to build large-scale applications. Some of these frameworks you may have heard of are Angular, React, and Vue. While each of these libraries bring their own strengths and weaknesses, many of the core concepts are shared between them.

With this series of articles, we're going to be outlining core concepts that are shared between them and how you can implement them in code in all three of the frameworks. This should p