Skip to content

Instantly share code, notes, and snippets.

View killtheliterate's full-sized avatar

Garrett Dawson killtheliterate

View GitHub Profile
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@ivenmarquardt
ivenmarquardt / lazy-evaluation.js
Last active May 18, 2018 20:37
Lazy evaluation, lazy getters, eta reduction, function composition, implicit thunks through deferred type
// Lazy Getters
/* What enables Tail Recursion Modulo Cons in Javascript is a thunk in Weak Head Normal Form.
An expression in weak head normal form has been evaluated to the outermost data constructor,
but contains sub-expressions that may not have been fully evaluated. In Javascript only thunks
can prevent sub-expressions from being immediately evaluated. */
const cons = (head, tail) => ({head, tail});
@donabrams
donabrams / checklist.txt
Last active April 25, 2018 23:16
General JWT approach that usually isn't terrible checklist
☐ Put JWT in a cookie
☐ HTTPOnly cookie
☐ Secure cookie
☐ Domain w/ a subdomain (never root)
☐ No authorization in the JWT body (look it up serverside ya lazy asses)
☐ Userid in cookie should NOT exist anywhere but auth service
☐ Short window ( < 15 min) for JWT authentication token
☐ Ability to deauthorize a refresh token chain serverside (but long life on a refresh token is OK)
☐ Ability to monitor requests by refresh token chain
@busypeoples
busypeoples / Simplified-Redux-Reducers.js
Created January 2, 2018 23:21
Simplified Redux Reducers
import Maybe from 'folktale/maybe';
const Inc = 'Inc';
const Dec = 'Dec';
const IncBy = 'IncBy';
const IncFn = state => state + 1;
const DecFn = state => state - 1;
const IncByFn = (state, action) => state + action.incBy;
@milankorsos
milankorsos / redux-actions.ts
Last active November 10, 2022 10:58
Correct TypeScript typing example for Redux Thunk actions
import {Action, ActionCreator, Dispatch} from 'redux';
import {ThunkAction} from 'redux-thunk';
// Redux action
const reduxAction: ActionCreator<Action> = (text: string) => {
return {
type: SET_TEXT,
text
};
};
@gcanti
gcanti / fp-ts-technical-overview.md
Last active March 11, 2024 02:40
fp-ts technical overview

Technical overview

A basic Option type

// Option.ts

// definition
export class None {
  readonly tag: 'None' = 'None'
@ateucher
ateucher / setup-gh-cli-auth-2fa.md
Last active May 3, 2024 11:06
Setup git on the CLI to use 2FA with GitHub

These are instructions for setting up git to authenticate with GitHub when you have 2-factor authentication set up. This authentication should be inherited by any GUI client you are using. These are intentionally brief instructions, with links to more detail in the appropriate places.

  1. Download and install the git command-line client (if required).

  2. Open the git bash window and introduce yourself to git (if required):

    git config --global user.name 'Firstname Lastname'
    git config --global user.email 'firstname.lastname@gov.bc.ca'
    
@hartzis
hartzis / Image.jsx
Last active April 15, 2019 23:17
react image component - utilizing recompose, handles errors
import React, { Component, PropTypes } from 'react';
import { setPropTypes, withState, lifecycle, mapProps, compose } from 'recompose';
export const ImageComponent = compose(
setPropTypes({ src: PropTypes.string.isRequired }),
withState('imgState', 'updateImgState', ({ src }) => ({ origSrc: src, currentSrc: src })),
lifecycle({
componentWillReceiveProps(nextProps) {
// if Image components src changes, make sure we update origSrc and currentSrc
if (nextProps.src !== nextProps.imgState.origSrc) {
@hew
hew / _readme.md
Last active June 10, 2022 19:13
Operator Mono w/ Italics on OSX VIm

Operator Mono w/ Italics on OSX Vim

@cbankston
cbankston / .env.service
Created February 23, 2016 20:08
Node Docker Project
RDS_HOSTNAME=db
RDS_USERNAME=root
RDS_PASSWORD=some_pass
NODE_PATH=/app
MESSAGE_SERVICE_USERNAME=guest
MESSAGE_SERVICE_PASSWORD=guest
MESSAGE_SERVICE_PORT=5672
MESSAGE_SERVICE_VHOST=/
MESSAGE_SERVICE_HOST=rabbit