Skip to content

Instantly share code, notes, and snippets.

View spencerwi's full-sized avatar

Spencer Williams spencerwi

View GitHub Profile
@spencerwi
spencerwi / Response.md
Last active July 29, 2016 22:33
In response to Wayne Grudem, regarding his endorsement of voting for Donald Trump as "morally good"

I also have found Grudem to be respectable in his Systematic Theology, but I'm disappointed in this article.

In summary, Grudem's points are:

  • Trump's not really that bad, is he? His sins, even though he wears them proudly, shouldn't be offensive to Christians.
  • Trump is the lesser of two evils. You don't want Hillary to win, do you? (Put another, even-more-cliched way, "not voting is the same as voting for Hillary" -- which is false, if I was never going to vote for Trump in the first place).
  • Christianity means doing what's best for America (and Trump is what's best for America).

I disagree with these premises; I do think the sins that Trump wears not just unrepentantly, but proudly, should be offensive to Christians, and should be more offensive to Grudem than they are; he minimizes outright insults that Trump has doubled-down on as "careless remarks" rather than the more Biblical "out of overflow of the heart, the mouth speaks" (as Jesus said in Luke 6).

Yes, Trump is egotistical. That fault can

@spencerwi
spencerwi / Mappable.java
Created May 6, 2016 15:23
HigherKindedTypes blog post code
public interface Mappable<A> {
public <B> Mappable<B> map(Function<A, B> f);
}
@spencerwi
spencerwi / Main.elm
Last active February 24, 2016 22:36
Simple Elm FRP square demo
import Html exposing (div, text)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import StartApp as StartApp
import Signal as Signal
import Mouse as Mouse
import Effects as Effects
app = StartApp.start
{ init = (init, Effects.none)
@spencerwi
spencerwi / ips.ml
Last active September 9, 2015 02:11
Get IPs in OCaml (using only stdlib)
module StringSet = Set.Make(String)
let addr_to_string = function
| Unix.ADDR_UNIX s -> s
| Unix.ADDR_INET (iaddr, _) -> Unix.string_of_inet_addr iaddr
let get_local_ips () =
Unix.getaddrinfo "localhost" "" []
|> List.map (fun x -> x.Unix.ai_addr)
@spencerwi
spencerwi / tmux.conf
Last active August 29, 2015 14:16
tmux.conf
#Colors
BACKGROUND=black
FOREGROUND=white
setw -g status-bg $BACKGROUND
setw -g status-fg $FOREGROUND
setw -g window-status-current-bg $FOREGROUND
setw -g window-status-current-fg $BACKGROUND
set -g pane-active-border-bg default
set -g pane-active-border-fg $FOREGROUND
@spencerwi
spencerwi / FoldMapAndFilter.clj
Last active May 16, 2020 03:30
Any place I have first-class functions and recursion, I can build foldLeft (reduce), with which I can build map and filter.
(defn fold_ [f initial [head & the-rest :as arr]]
(cond
(empty? arr) initial
:else (recur f (f initial head) the-rest)))
(defn map_ [f arr]
(let [applyF (fn [previous current] (conj previous (f current)))]
(fold_ applyF [] arr)))
(defn filter_ [predicate arr]
@spencerwi
spencerwi / propsToEnvVars.hs
Last active August 29, 2015 14:14
Convert Java properties to environment variables (naively)
#!/usr/bin/env runhaskell
module JavaPropsToEnvVars where
import Data.List (break, stripPrefix)
type PropertyName = String
type PropertyValue = String
type Property = (PropertyName, PropertyValue)
@spencerwi
spencerwi / ips.cl
Created January 19, 2015 02:55
Quick util to print out the IP addresses on a machine. Requires Quicklisp.
(ql:quickload :ip-interfaces)
(defun ip-as-string (interface)
(format nil "~{~A~^~.~}" (map 'list (lambda (x) x) (ip-interfaces:ip-interface-address interface))))
(defun print-interface-ip (interface)
(format t "~A: ~A~%" (ip-interfaces:ip-interface-name interface) (ip-as-string interface)))
(loop for interface in (ip-interfaces:get-ip-interfaces)
do (print-interface-ip interface))
@spencerwi
spencerwi / Java8Demo.java
Created February 21, 2014 15:21
Quick demo playing with Java 8 streams, lambdas, and aggregate operations.
import java.util.List;
import java.util.ArrayList;
import java.util.stream.*;
import java.util.Comparator;
import java.util.Collections;
import java.util.Optional;
import java.util.Random;
class Java8Demo {
private static final String[] poolOfFirstNames = { "Joe", "Paul", "John", "Samantha", "Amanda", "Karen" };
@spencerwi
spencerwi / displayNone.js
Created November 13, 2013 20:21
Poor-man's DocumentFragment using display:none
/* Again, the assumption: arrayOfElements is an array of DOM nodes created from a template or otherwise. */
/* We can set our targetNode to "display:none", change it, and then reset it, making it into a poor man's DocumentFragment */
var targetNode = document.getElementById('target');
var previousDisplayValue = targetNode.style.display;
targetNode.style.display="none"; /* 1 reflow */
var appendToNode = targetNode.appendChild.bind(targetNode);
arrayOfElements.forEach(appendtoTargetNode); /* 0 reflows */