Skip to content

Instantly share code, notes, and snippets.

View sethlivingston's full-sized avatar

Seth Livingston sethlivingston

View GitHub Profile
module Components.Tab exposing (Model, Msg, init, view, update)
import Html exposing (Html, div, text, i)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
-- MODEL
type alias Model =
{ icon : String

A box (or discriminated union) is just a context in which to apply functions.

.map(f) is really not about traversal, but rather applying a function or transformation within a context (of a box).

.fold(f, ...) is similar to map, except the return value is unboxed.

  • Formally, folding is the application of a combining function to reduce a structure or collection to a single value.
  • For boxes like Either, fold usually takes multiple functions, one to apply to each type of the union.

.chain(f) is similar to .map(f), but it should be used when f returns a box instead of a raw value. That way, the result of the function will be a box(a) instead of a box(box(a)).

NAT (Network Address Translation): Translates between public IP address, such as the one being used by a cable modem at home, to IP addresses on the internal network. Hides internal devices; without it, internal devices would each need their own public IP address.

DHCP (Dynamic Host Configuration Protocol): Provides devices with IP addresses and TCP/IP configuration information like the address of the DNS server and the address of the router that provides a path to the internet. The router address is known as the default gateway.

LAN (Local Area Network): A group of computers in the same geographic location.

Mbps, Gbps (megabit, gigabits per second): Bits transferred per second. Wired LANs today are 100 Mbps or 1,000 Mbps (1 Gbps). Bits, lowercase b, are for network speeds. Bytes, uppercase B, are for RAM capacity (4 GB) and other measurements.

AD DS (Active Directory Domain Services): Hosts user and computer objects in one place instead of having each workstation store them as the

set nocompatible
" Load plugins
call plug#begin('~/vimfiles/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'rakr/vim-one'
Plug 'pangloss/vim-javascript'
Plug 'tomtom/tcomment_vim'
@sethlivingston
sethlivingston / Elm Template for Page with Multiple Views
Created June 24, 2018 21:34
Elm Template for Page with Multiple Views
# Definitely will be needed
NoRedInk/elm-decode-pipeline
elm-lang/core
elm-lang/dom
elm-lang/html
elm-lang/http
elm-lang/navigation
evancz/url-parser
lukewestby/elm-http-builder
@sethlivingston
sethlivingston / Template.elm
Last active March 29, 2020 17:07
Elm template for a Browser.element app
module TemplateModule exposing (main)
import Browser
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
-- MODEL
@sethlivingston
sethlivingston / diff.ts
Created July 14, 2021 21:16
Object diff
// Adapted from https://stackoverflow.com/a/61406094/521662
export interface ObjectComparison {
added?: Record<any, any>;
updated?: Record<string, Change>;
removed?: Record<any, any>;
}
export interface Change {
oldValue: any;
@sethlivingston
sethlivingston / logImmerReducer.ts
Created July 14, 2021 21:18
Logs a reducer that uses Immer
import { Reducer } from "react";
import { current } from "immer";
import { diff } from "helpers/diff"; // See my "Object diff" gist
const quickPayloadTypes = ["boolean", "number", "string"];
export function logImmerReducer(reducer: Reducer<any, any>): Reducer<any, any> {
if (process?.env?.JEST_WORKER_ID) return reducer;
if (vkDoSomething() != VK_SUCCESS) {
// throw exception or write to std::cerr
}
VkResult result = vkDoSomething();
if (result != VK_SUCCESS) {
// result is an integer error value you
// can look up in vulkan_core.h
}