Skip to content

Instantly share code, notes, and snippets.

View mhanberg's full-sized avatar
🏎️
Vroom

Mitchell Hanberg mhanberg

🏎️
Vroom
View GitHub Profile
function toggleTheme() {
const theme = window.localStorage.getItem("theme");
if (theme === "light") {
setTheme("#262b2f", "white", "🌝", "dark");
} else {
setTheme("white", "#262b2f", "🌚", "light");
}
}
:root {
--background-color: #262b2f;
--text-color: white;
}
.theme {
background: var(--background-color);
color: var(--text-color);
transition: all 250ms ease;
}
#!/usr/bin/env bash
# Write a code snippet in your preferred editor, upload to a GitHub Gist,
# and then open the snippet in Carbon with the gist url in your clipboard.
#
# Remember to login first with `gist --login`
hash gist || exit 1
file_name=$1
echo "hot"
#!/usr/bin/env bash
# Write a code snippet in your preferred editor, upload to a GitHub Gist,
# and then open the snippet in Carbon with the gist url in your clipboard.
#
# Remember to login first with `gist --login`
hash gist || exit 1
file_name=$1
#!/usr/bin/env bash
new thing
@mhanberg
mhanberg / benchmarks.md
Last active December 10, 2018 04:02
AOC18 Benchmarks

Day 1

Name             ips        average  deviation         median         99th %
part_1       23.14 K       43.21 μs    ±11.10%          42 μs          61 μs
part_2          8.94      111.84 ms     ±6.75%      111.31 ms      132.18 ms

Day 2

@mhanberg
mhanberg / sharepoint.ex
Created August 18, 2018 23:51
How to Subscribe to SharePoint RSS Feeds Without NTLM Authentication
# Elixir source code
def get(%Rss{is_sharepoint: true, url: url}) do
match = Regex.named_captures(~r{(?<protocol>http://|https://)(?<sharepoint_url>.*)}, url)
url_with_creds =
match["protocol"] <> System.get_env("SHAREPOINT_CREDS") <> "@" <> match["sharepoint_url"]
Logger.info("Fetching sharepoint feed with #{url_with_creds}")
@mhanberg
mhanberg / elm-snippet.elm
Created March 8, 2018 23:26
elm-snippet-building-with-elm-at-sep-makes
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
main =
Html.beginnerProgram { model = 0, view = view, update = update }
type Msg = Increment | Decrement
update msg model =
case msg of
@mhanberg
mhanberg / Mix.lock
Last active January 23, 2018 13:24
Error implementing JaSerializer
%{"apex": {:hex, :apex, "1.2.0", "2da5035ef5fc59da2c24187a880b1b6d38b6b67c19b89a6265f5986ff0e85b1f", [:mix], [], "hexpm"},
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], [], "hexpm"},
"bcrypt_elixir": {:hex, :bcrypt_elixir, "1.0.5", "cca70b5c8d9a98a0151c2d2796c728719c9c4b3f8bd2de015758ef577ee5141e", [:make, :mix], [{:elixir_make, "~> 0.4", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm"},
"comeonin": {:hex, :comeonin, "4.0.3", "4e257dcb748ed1ca2651b7ba24fdbd1bd24efd12482accf8079141e3fda23a10", [:mix], [{:argon2_elixir, "~> 1.2", [hex: :argon2_elixir, repo: "hexpm", optional: true]}, {:bcrypt_elixir, "~> 0.12.1 or ~> 1.0", [hex: :bcrypt_elixir, repo: "hexpm", optional: true]}, {:pbkdf2_elixir, "~> 0.12", [hex: :pbkdf2_elixir, repo: "hexpm", optional: true]}], "hexpm"},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm"},
"cowboy": {:hex