Skip to content

Instantly share code, notes, and snippets.

Avatar
🐛
squashin bugs.

nick comer nkcmr

🐛
squashin bugs.
View GitHub Profile
@nkcmr
nkcmr / proposal.md
Last active Jul 17, 2019
Informal Golang Proposal: `catch` block as an alternative to `if err != nil`
View proposal.md

Informal Golang Proposal: catch block as an alternative to if err != nil

PLEASE NOTE: I am not a language designer or have any experience in implementing or mainting a language or compiler. So, I would love to write out the EBNF syntax for what I am about to propose, but alas, I wouldn't know where to start. So, please forgive the informal nature of the proposal and feel free to ask questions; hopefully I'll be able to keep up with actual experts in this field and if not I apologize for my naivety in advance!

When the try() proposal was closed, I was relieved. There is a problem to be solved here, but try, to me at least, created more problems while trying to solve one.

The main problems, I think it created were the following:

  • try reduced the visiblility of failures. For example:
View bindata-pack.go
package main
import (
"fmt"
"io/ioutil"
"math"
"os"
"strconv"
"strings"
"text/template"
View keybase.md

Keybase proof

I hereby claim:

  • I am nkcmr on github.
  • I am nkcmr (https://keybase.io/nkcmr) on keybase.
  • I have a public key whose fingerprint is BBCA B79B BD4A 436E DA81 E4CF DD79 7F0B 1769 BCA1

To claim this, I am signing this object:

@nkcmr
nkcmr / authr-rule.json
Last active May 11, 2018
JSON schema for authr rules as of authr-v1.1.1
View authr-rule.json
{
"type": "object",
"additionalProperties": false,
"required": [
"access",
"where"
],
"properties": {
"access": {
"type": "string",
View keybase.md

Keybase proof

I hereby claim:

  • I am nkcmr on github.
  • I am nkcmr (https://keybase.io/nkcmr) on keybase.
  • I have a public key whose fingerprint is 82D8 9697 B0E4 8E64 4E78 259A 1423 50B6 4205 77DE

To claim this, I am signing this object:

View goto.sh
#!/bin/bash
goto() {
# create the shortcuts dir if necessary
if [ ! -d "$HOME/.shortcuts" ] ; then
mkdir -p "$HOME/.shortcuts"
fi
if [[ "$1" == "--list" ]] ; then
for f in "$HOME/.shortcuts/"* ; do
echo "$(basename "$f") -> $(tr -d '\n' < "$f")"
@nkcmr
nkcmr / main.go
Created Jun 11, 2017
a concurrent network diagnostic tool of sorts
View main.go
package main
import (
// "io/ioutil"
"bytes"
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
@nkcmr
nkcmr / ad-tracker-block.js
Last active Aug 10, 2016
ad/tracker blocker that works at a system level
View ad-tracker-block.js
'use strict'
const blacklist = [
/analytics/,
/fullstory/,
/amplitude/,
/crashlytics\.com/,
/doubleclick\.net/,
/chartbeat\.(net|com)/,
/deepintent\.com/,
@nkcmr
nkcmr / bmrk.php
Created Aug 10, 2016
poor man's php benchmark
View bmrk.php
<?php
define("BENCH_ITERATIONS", 1000);
$scenarios = [];
// scenario one
$scenarios['one'] = function () {
$start = microtime(true);
// do stuff in between the microtimes
return microtime(true) - $start;
View keybase.md

Keybase proof

I hereby claim:

  • I am nkcmr on github.
  • I am nkcmr (https://keybase.io/nkcmr) on keybase.
  • I have a public key ASBCQWHPkNbeLwUL7moC-LL6vSSGgGzDRtkFuR6covWMXQo

To claim this, I am signing this object: