Skip to content

Instantly share code, notes, and snippets.

🤡
They told me I can't code for shit

Kerry Snyder krry

View GitHub Profile
View hexagrams.json
{
"0b111111": {
"hexagram": "䷀",
"kingwen": 1,
"name": {
"chinese": "乾",
"pinyin": "Qián",
"english": "The Creative (Heaven)"
},
"trigramPair": {
@krry
krry / accessibility.css
Last active Apr 7, 2019
Helper classes for building inclusive, accessible interfaces/experiences
View accessibility.css
/* from
https://inclusive-components.design/tooltips-toggletips/
"The visually-hidden class corresponds to some special CSS we've discussed before on Inclusive Components.
It hides the <span> visually without stopping it from being read out in screen readers."
*/
.visually-hidden {
clip-path: inset(100%);
@krry
krry / exercise-web-crawler.go
Created Mar 4, 2019
An Answer to A Tour of Go Exercise: Web Crawler Concurrency
View exercise-web-crawler.go
// only touching the Crawl func, as instructed
// https://tour.golang.org/concurrency/10
// Crawl uses fetcher to recursively crawl
// pages starting with url, to a maximum of depth.
func Crawl(url string, depth int, fetcher Fetcher) {
m := map[string]bool{url: true}
var mx sync.Mutex
var wg sync.WaitGroup
var subcrawl func(string, int)
@krry
krry / exercise-equivalent-binary-trees.go
Created Mar 4, 2019
An Answer to A Tour of Go Exercise: Equivalent Binary Trees
View exercise-equivalent-binary-trees.go
package main
import (
"golang.org/x/tour/tree"
"fmt"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int) {
@krry
krry / exercise-images.go
Created Mar 4, 2019
An answer to A Tour of Go: Exercise: Images
View exercise-images.go
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
"math/rand"
"fmt"
)
@krry
krry / exercise-rot13-reader.go
Created Mar 4, 2019
An answer to A Tour of Go Exercise: Rot13 Reader
View exercise-rot13-reader.go
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
@krry
krry / exercise-readers.go
Created Mar 4, 2019
An answer to A Tour of Go Exercise: Readers
View exercise-readers.go
package main
import "golang.org/x/tour/reader"
type MyReader struct{}
// TODO: Add a Read([]byte) (int, error) method to MyReader.
func (reader MyReader) Read(b []byte) (int, error) {
for i := range b {
b[i] = 'A'
@krry
krry / exercise-error.go
Created Mar 4, 2019
An Answer to A Tour of Go Exercise: Errors
View exercise-error.go
package main
import (
"fmt"
"math"
)
type ErrNegSqrt float64
func (e ErrNegSqrt) Error() string {
@krry
krry / exercise-slices.go
Last active Mar 3, 2019
An answer to the Slices exercise in A Tour of Go
View exercise-slices.go
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
line := make([]uint8, dx)
grid := make([][]uint8, dy)
for y := range grid {
for x := range line {
line[x] = uint8(y-x)
@krry
krry / figlet_wiggle.sh
Last active Feb 22, 2019
One-line Random Figlet Font Fortune
View figlet_wiggle.sh
brew install figlet coreutils # for OSX
figlet -f $(ls $(brew --prefix figlet)/share/figlet/fonts/ | grep ".flf" | shuf -n 1) "Atmanaut"
You can’t perform that action at this time.