Skip to content

Instantly share code, notes, and snippets.

View DeedleFake's full-sized avatar

DeedleFake

View GitHub Profile
@DeedleFake
DeedleFake / count.go
Last active August 29, 2015 14:19
Counts how many times an outfit tag appears.
package main
import (
"bufio"
"bytes"
"container/heap"
"fmt"
"io"
"os"
"regexp"
@DeedleFake
DeedleFake / fib.rs
Last active August 29, 2015 14:25
A (mostly) straight port of the Go examples at https://golang.org/doc/play to Rust.
fn fib() -> Box<FnMut() -> i32> {
let (mut a, mut b) = (0, 1);
Box::new(move || {
let c = a + b;
a = b;
b = c;
a
})
@DeedleFake
DeedleFake / test.cpp
Last active December 18, 2015 17:10
A little test to try to figure out a way to deal with C++ classes using the new C++ support in CGo.
#include <iostream>
#include "test.h"
class Test
{
protected:
const char *str;
public:
@DeedleFake
DeedleFake / delta
Created March 28, 2016 19:53
go1 benchmarks devel +cabf73f
BenchmarkBinaryTree17-4 5022008650 -6.02%
BenchmarkFannkuch11-4 4645926951 -23.40%
BenchmarkFmtFprintfEmpty-4 84.9 -7.30%
BenchmarkFmtFprintfString-4 266 -20.30%
BenchmarkFmtFprintfInt-4 264 -20.08%
BenchmarkFmtFprintfIntInt-4 420 -24.05%
BenchmarkFmtFprintfPrefixedInt-4 391 -17.65%
BenchmarkFmtFprintfFloat-4 549 -16.58%
BenchmarkFmtManyArgs-4 1711 -20.86%
BenchmarkGobDecode-4 12907474 -9.27%
@DeedleFake
DeedleFake / Percentage Difference
Last active May 10, 2016 02:05
Go1 Benchmark (1.6 vs. devel +9af8346)
BenchmarkFannkuch11-4 -18.05
BenchmarkFmtFprintfEmpty-4 -8.89
BenchmarkFmtFprintfString-4 -20.36
BenchmarkFmtFprintfInt-4 -22.18
BenchmarkFmtFprintfIntInt-4 -28.06
BenchmarkFmtFprintfPrefixedInt-4 -20.63
BenchmarkFmtFprintfFloat-4 -19.17
BenchmarkFmtManyArgs-4 -22.47
BenchmarkGobDecode-4 -12.68
BenchmarkGobEncode-4 -11.14
diff --git a/PKGBUILD b/PKGBUILD
index 8ef2f13..10f59e4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,9 +20,11 @@ build() {
# Force our own git checkout
export GOPATH="$srcdir"
mkdir -p "$GOPATH/src/github.com/spf13"
ln -s `pwd` "$GOPATH/src/github.com/spf13/hugo"

Keybase proof

I hereby claim:

  • I am deedlefake on github.
  • I am deedlefake (https://keybase.io/deedlefake) on keybase.
  • I have a public key ASBAslmyHWY1vLJG-aQw5Nnc2ElZK0zwqk2ipj5EJB9kMQo

To claim this, I am signing this object:

@DeedleFake
DeedleFake / check.md
Last active February 20, 2019 04:17
Possible Solution to check Awkwardness with Chained Method Calls

Syntax Problem

One of the issues with the syntax of check, as proposed, is that chaining method calls with error returns will look really, really bad. For example, check (check (check v.m1()).m2()).m3(). The common way around this in many languages, as mentioned in the draft, is the use of ? as a postfix operator instead of prefix keyword, but this has other problems, including resulting in similar illegibility if there are nested function calls, such as in f1(f2(f3()?)?)?. It also would make it unique amongst the various Go control flow modifiying language structures as all of the other ones are keywords.

Proposed Solution

When check is given a compound function expression, such as nested function calls or chained methods, it applies to all calls in the expression, not just the one it was specifically attached to. The previous two examples then become check v.m1().m2().m3() and check f1(f2(f3())), respectively. All other aspects of check remain the same,

@DeedleFake
DeedleFake / err.go2
Last active August 28, 2020 01:44
Generic testing sandbox.
package main
import (
"fmt"
)
type Pair[T1 any, T2 any] struct {
First T1
Second T2
}
@DeedleFake
DeedleFake / client.go
Created June 3, 2021 21:09
QUIC Echo Server Test
package main
import (
"context"
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"os"