Skip to content

Instantly share code, notes, and snippets.

View r-k-b's full-sized avatar

Robert K. Bell r-k-b

View GitHub Profile
@r-k-b
r-k-b / CodecStyleRoutes.elm
Last active September 6, 2020 10:13
how can we keep route encoding/decoding in sync?
module RouteCodec exposing (..)
import Url exposing (Url)
import Url.Parser as UP exposing ((</>), Parser, s)
type Route
= Home
| Settings
| User String UserRoute
@r-k-b
r-k-b / README.md
Last active May 14, 2022 18:35
nix shell for a development environment for a Gradle project

I was getting errors like...

$ ./gradlew build
... snip ...
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSearchableOptions'.
> A problem occurred starting process 'command '/home/rkb/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbrx-8u202-linux-x64-b1483.49/jre/bin/java''
@r-k-b
r-k-b / elm-like languages.md
Last active August 31, 2020 01:52
the world needs more Elm!

Ordered roughly (and subjectively) most- to least-Elm-like.

Rust

  • Sum types ✓
  • No exceptions ✓
  • No shared mutable state(?) ✓
  • Exhaustive pattern matching ✓
@r-k-b
r-k-b / 001 notes on dotnet and mono on nixos.md
Last active July 21, 2020 08:31
blocked on dotnet errors (nix, hippo)

this is as close as I've gotten to building Hippo in NixOS

Can't get past the errors:

MSB4242: The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed to run

and

warning NU1701: Package was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
@r-k-b
r-k-b / stop-cherry-picking-start-merging__index.md
Last active June 4, 2020 06:41
Working index of links to the Stop Cherry Picking, Start Merging articles by Raymond Chen
@r-k-b
r-k-b / expand-entries-in-elm-debugger.js
Last active February 6, 2020 04:04
Expand all the entries in an Elm Debugger window.
// Intended to be run from the Snippets panel in Chrome Dev Tools, targeting the Elm Debugger popout window.
// https://gist.github.com/r-k-b/9e341370159e87b7f8b09200660e93ea
(() => {
// these are multiple megabytes in size, too big to diff
const blacklist = ['lookup', 'repository', 'historyDetail', 'templateInfos'];
const getChevrons = () => {
const all = [...document.querySelectorAll('span[style*="width: 2ch"]')]
.map(node => ({node, label: node.nextSibling.textContent}))
.filter(chev => !blacklist.includes(chev.label));
@r-k-b
r-k-b / keep-awake.sh
Created July 12, 2019 04:42
Keep a .net site primed.
#!/bin/sh
# https://gist.github.com/r-k-b/f0d3ac22760da2795e928d8f105134cc
while true;
do
printf '.';
# You can get all this curl noise form the Chrome Devtools, Network panel, the main request, then select "Copy as curl (bash)"
curl 'http://baf.robert.test/' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3842.0 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3' -H 'Referer: http://baf.robert.test/login.aspx?ReturnUrl=%2f' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' -H 'Cookie: _ga=GA1.2.1267220546.1560392349; _gid=GA1.2.1075512879.1562207502; _gat=1; .buildaformAuth=668344A8E90D04C8A897DD22F5D37165B113948EE420D4FC7364FDDAFDDB9BA0B92ABA5AA5126307D365B541A14F00355B21620D3ED1F5DEFB85A19AB8EB2CDEE7A64
@r-k-b
r-k-b / count-warning-types.md
Last active April 3, 2019 03:23
one-liner to extract & count the types of warnings from a c# build
cat build-output.txt | sed -rn 's/^.*\[([A-Z]+[0-9]+)\].*$/\1/p' | sort | uniq -c | sort -nr

Explanation:

                       ↑                                           ↑      ↑         ↑
                       a                                           b      c         d
@r-k-b
r-k-b / quick-keepalive.js
Created March 21, 2019 02:35
js one-liner to prevent session timeout
setInterval(() => {fetch('/').then(() => {console.debug('keepalive tick')}).catch(err => {console.warn('tick exploded!', {err})})}, 30e3);
@r-k-b
r-k-b / _README.md
Created March 11, 2019 23:57
Prevent accidental commits of files

copy pre-commit into the repo's .git/hooks/ folder, then try committing a file that has the string DO_NOT_COMMIT_THIS in it.