Skip to content

Instantly share code, notes, and snippets.

Ian Patrick Badtrousers tucnak

Block or report user

Report or block tucnak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tucnak
tucnak / output.txt
Last active Feb 12, 2019
Schema takes too long to load trivial objects with depth=0 and doesn't load certain structs
View output.txt
2019/02/12 05:04:03 n = 10
2019/02/12 05:04:03
2019/02/12 05:04:03 [find n critiques] started
2019/02/12 05:04:04 found 10 crits
2019/02/12 05:04:04 elapsed: 11.835827ms
2019/02/12 05:04:04
2019/02/12 05:04:04 [get n actors + depth=0] started
2019/02/12 05:04:04 found 10 actors
listening...
- 1 2019-02-09 18:27:29.214357 +0200 EET
@tucnak
tucnak / signals.upd
Created Nov 16, 2015
Signal-slot concept in an imaginary Upd programming language
View signals.upd
package stuff
import {
"fmt"
"github.com/tucnak/pipes" // пасхалка
}
class A {
slots:
View groups_demo.go
package main
import (
"github.com/tucnak/climax"
)
func plain(group, name, brief string) *climax.Command {
return &climax.Command{
Name: name,
Brief: brief,
View groups.diff
diff --git a/application.go b/application.go
index 3bf7d8f..6226dd2 100644
--- a/application.go
+++ b/application.go
@@ -3,7 +3,6 @@ package climax
import (
"fmt"
"os"
- "strings"
)
@tucnak
tucnak / range-by-reference.go
Created Oct 28, 2015
Range by reference? Haha.
View range-by-reference.go
package main
import "fmt"
func main() {
numbers := []int{0, 1, 2, 3, 4}
for _, number := range numbers {
number++
}
@tucnak
tucnak / interface-slice.go
Created Oct 28, 2015
First-class support of interface slices!
View interface-slice.go
package main
import (
"fmt"
"strconv"
)
type FancyInt int
func (x FancyInt) String() string {
@tucnak
tucnak / shadowing.go
Created Oct 28, 2015
I am really into variable shadowing in Go!
View shadowing.go
package main
import "fmt"
func Secret() (int, error) {
return 42, nil
}
func main() {
number := 0
@tucnak
tucnak / i-love-interfaces.go
Created Oct 28, 2015
Nil errors are not always nil :)
View i-love-interfaces.go
package main
import "fmt"
type MagicError struct{}
func (MagicError) Error() string {
return "[Magic]"
}
@tucnak
tucnak / slices.go
Created Oct 28, 2015
Meet the Slice!
View slices.go
// Some numbers, please!
numbers := []int{1, 2, 3, 4, 5}
log(numbers) // 1. [1 2 3 4 5]
log(numbers[2:]) // 2. [3 4 5]
log(numbers[1:3]) // 3. [2 3]
// Fun fact: you can’t use negative indices!
//
// numbers[:-1] from Python won’t work. Instead,
@tucnak
tucnak / gist:77c6d21d299f3c73ee7e
Created Jul 12, 2015
Unable to build Go1.5beta1 from Git on OSX 10.10.4
View gist:77c6d21d299f3c73ee7e
[tucnak@atlantis:src]$ go version
go version go1.4.2 darwin/amd64
[tucnak@atlantis:src]$ go env
GOARCH="amd64"
GOBIN=""
GOCHAR="6"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
You can’t perform that action at this time.