Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
chris-ramon / main.go
Created September 10, 2018 15:48
full working example PR#388 + PR#393
/*
2018/09/09 20:33:22 [GetCustomerBatchFn] batch size: 3
2018/09/09 20:33:22 [GetCustomerAffiliationsBatchFn] batch size: 3
2018/09/09 20:33:22 [GetGroupBatchFn] batch size: 4
2018/09/09 20:33:22 [GraphQL result] total customers: 3
2018/09/09 20:33:22 [GraphQL result]:
{"data":{"CustomerVisit":{"items":[{"customer":{"affiliations":{"items":[{"group":{"id":1,"name":"first group"}},{"group":{"id":4,"name":"fourth group"}}]},"first_name":"first customer","id":1,"last_name":"first customer last name"}},{"customer":{"affiliations":{"items":[{"group":{"id":2,"name":"second group"}},{"group":{"id":4,"name":"fourth group"}}]},"first_name":"second customer","id":2,"last_name":"second customer last name"}},{"customer":{"affiliations":{"items":[{"group":{"id":3,"name":"third group"}},{"group":{"id":4,"name":"fourth group"}}]},"first_name":"third customer","id":3,"last_name":"third customer last name"}}]}}}
*/
package main
@chris-ramon
chris-ramon / main.go
Last active October 24, 2019 20:37
Alternative solution to concurrent resolvers
/*
$ go run main.go
rootObject() | took: 1.000260951s
graphql.Do() | took: 367.401µs
graphql.Do() | result: {"data":{"me":{"github":{"issues":[{"id":"100"},{"id":"101"}],"pullRequests":[{"id":"200"},{"id":"201"}]}}}}
*/
package main
import (
@chris-ramon
chris-ramon / jessfraz.md
Created August 5, 2018 04:02 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper
@chris-ramon
chris-ramon / aes256-gcm.go
Created July 25, 2016 17:38 — forked from kkirsche/aes256-gcm.go
AES-256 GCM Encryption Example in Golang
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@chris-ramon
chris-ramon / main.go
Created July 25, 2016 17:38 — forked from manishtpatel/main.go
GoLang Encrypt string to base64 and vice versa using AES encryption.
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
@chris-ramon
chris-ramon / reflection.go
Created June 26, 2016 21:46 — forked from drewolson/reflection.go
Golang Reflection Example
package main
import (
"fmt"
"reflect"
)
type Foo struct {
FirstName string `tag_name:"tag 1"`
LastName string `tag_name:"tag 2"`
@chris-ramon
chris-ramon / py3.py
Last active January 9, 2016 04:12
python 3 / django - notes
# create an venv
python3 -m venv myvenv
# activate it
python3 -m venv myvenv
# initial migrate
python manage.py migrate
# run migrations
python manage.py makemigrations myapp
@chris-ramon
chris-ramon / sketch.sh
Last active January 7, 2016 22:08
sketch notes
# plugin to adjust (alt - arrows) margins
# nudg.it
# clone + guide lines
alt - click
# clone
cmd - d
# grid layout
@chris-ramon
chris-ramon / gql.go
Created January 6, 2016 00:46
graphql go new api
//
package main
import (
"log"
"github.com/graphql-go/graphql"
)
type Schema struct {
@chris-ramon
chris-ramon / dev.txt
Last active December 16, 2015 05:37
chrome dev tools shortcuts
# inspect element
cmd + shift + c
# navigate through tabs
cmd + [
cmd + ]