Skip to content

Instantly share code, notes, and snippets.


Beth Hitch dfoverdx

View GitHub Profile
dfoverdx / touched-input.jsx
Created Nov 13, 2018
Reactstrap Input that doesn't validate or invalidate until the element has been touched
View touched-input.jsx
import React, { PureComponent } from 'react';
import { Input } from 'reactstrap';
* A wrapper for reactstrap's Input which prevents the `invalid` and `valid` props from being displayed until the user
* has touched the input (via `onBlur`). Also handles setting `invalid` if it is not defined as a property, but
* other HTML5 input validation properties are (`pattern`, `required`, `min`, etc).
export default class TouchedInput extends PureComponent {
constructor(props) {
dfoverdx / _app.tsx
Last active Jan 17, 2019
React Context Factory for Next.js
View _app.tsx
import App, { Container } from 'next/app';
import React, { Component } from 'react';
import { ExampleContextProvider, ExampleContextType } from './example-context';
interface Props {
pageProps: {};
Component: Component;
exampleContext?: ExampleContextType;
dfoverdx / async-database-client.js
Last active Jun 3, 2019
JavaScript/TypeScript Data Access Layer that automatically asserts the connection is ready, or waits for the connection to become ready
View async-database-client.js
import Client from 'some-database-api';
import { connectionInfo } from './config';
class AsyncDatabaseClient {
constructor() {
this._connection = null;
this._initialized = Client.connect(connectionInfo).then(c => this.connection = c);
return new Proxy(this, {
get(target, prop, receiver) {
dfoverdx / AngularJS Tutorial Quora
Created May 1, 2020
AngularJS Tutorial Quora Question
View AngularJS Tutorial Quora

I'm an expert JS/ReactJS dev learning AngularJS to work on legacy code. What (or where) is a succinct rundown of high- and mid-level concepts I need to know?

I've been trying to watch a YouTube series called Angularjs Tutorial - Complete (Fundamentals to Advanced.

AngularJS YouTube Series

This series is probably great for people who know nothing about JavaScript frameworks, but it is far too slow/thorough for me. For example, AngularJS: Understanding Scope Inheritance is a half hour video that could have been a single sentence: The $scope of a nested controller inherits the properties of its parent's $scope.

It's possible that later videos in the playlist will cover more advanced topics with the assumption that you know what you're doing in JavaScript, b

View Impossible Cape Level

Impossible Cape Level Slightly Antagonistic FAQs

  • Is this your level?

    Yes. That's why I'm clearing it.

  • Can you show us the rest of the level?

    No. But here's what it looked like. Preview video.\

View What happens

This is a continuation of a Facebook post but a digression from the intent of the post. It is mere postulation of what could happen if the police brutality goes unaddressed by the government.

What happens next

If left undealt with, to my discernment, one of two things will happen.

1) The People give up. They determine that continued protesting is not worth the risk of the bodily harm and very lives of so many people. They disperse. The putrid status quo is maintained. No justice is served.

2) Things escalate. The People determine a violent overthrow of the government is warranted and obligatory. People take sides. Civil war erupts. Hundreds of thousands die.

dfoverdx / Permutations.ts
Last active Feb 24, 2021
TypeScript Permutations Type
View Permutations.ts
* @document Permutations.ts
* I wanted to figure out, just for the challenge of it, whether I could, given an array type `A`, produce a type that
* matches any array with every element of `A` exactly once in any order. I *love* abusing the TS typing engine. It
* insulted my mother once.
* Returns an array type that includes every element of `T` exactly once in any order.
dfoverdx / JavaScript Members Not Bound to
Last active Jun 14, 2021
Why JavaScript class members are not automatically bound to the instance of the class
View JavaScript Members Not Bound to

It took a few years, but I finally understand why member functions of classes in JavaScript aren't automatically bound to their objects, in particular when used in callback arguments.

In most object-oriented languages, functions are members of a class--they exist in memory only once, and when they are called, this is simply a hidden argument of the function which is assigned to the object that's calling it. Python makes this explicit by requiring that the first argument of a class's member function be self (Python's equivalent of this--you can name self whatever you want, but self is the convention).

class MyClass: