{{ message }}

Instantly share code, notes, and snippets.

Serge HelfrichPygmalion69

Created Feb 29, 2020
A Tour of Go - Exercise: Reader
 // https://tour.golang.org/methods/22 package main import "golang.org/x/tour/reader" type MyReader struct{} func (r MyReader) Read(b []byte) (int, error) { for i := range b { b[i] = 65
Last active Feb 29, 2020
A Tour of Go - Exercise: Errors
View exercise-errors.go
 // https://tour.golang.org/methods/20 package main import ( "fmt" ) type ErrNegativeSqrt float64 func (e ErrNegativeSqrt) Error() string {
Created Feb 29, 2020
A Tour of Go - Exercise: Stringers
View exercise-stringer.go
 // https://tour.golang.org/methods/18 package main import "fmt" type IPAddr [4]byte func (ip IPAddr) String() string { return fmt.Sprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]) }
Last active Feb 28, 2020
A Tour of Go - Exercise: Fibonacci closure
View exercise-fibonacci-closure.go
 // https://tour.golang.org/moretypes/26 package main import "fmt" // fibonacci is a function that returns // a function that returns an int. func fibonacci() func() int { a, b := 1, 0 return func() int {
Created Feb 28, 2020
A Tour of Go - Exercise: Maps
View exercise-maps.go
 // https://tour.golang.org/moretypes/23 package main import ( "strings" "golang.org/x/tour/wc" ) func WordCount(s string) map[string]int { m := make(map[string]int)
Created Feb 28, 2020
A Tour of Go - Exercise: Slices
View exercise-slices.go
 // https://tour.golang.org/moretypes/18 package main import "golang.org/x/tour/pic" func Pic(dx, dy int) [][]uint8 { pic := make([][]uint8, dy) for y := range pic { pic[y] = make([]uint8, dx) for x := range pic[y] {
Created Apr 27, 2018
View sumeria.c
 /* Govern ancient Sumeria. Heavily modified by Mike Arnautov 1975. * Converted from Basic to PR1ME Fortran (mode 32R) MLA 1979. * Rev.19.1, GGR version 14 Oct 83. MLA * Converted to ANSI C December 2001. MLA */ #include #include #include #include
Created Apr 18, 2018
View LockScreenOrientation.java
 /** * Lock the screen to the current orientation on Android * https://stackoverflow.com/questions/4553650/how-to-check-device-natural-default-orientation-on-android-i-e-get-landscape * https://stackoverflow.com/a/14150037/959505 * */ private void lockOrientation() { int orientation = 0; WindowManager windowService = (WindowManager) getSystemService(Context.WINDOW_SERVICE); if (windowService != null) {
Created Jan 18, 2018
Android .travis.yml
View .travis.yml
 language: android android: components: - tools # to get the new `repository-11.xml` - tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943) - platform-tools - build-tools-26.0.2 - android-22 - android-26
Created Jan 18, 2018
.travis.yml by BanzaiMan
View .travis.yml
 language: android jdk: oraclejdk8 #sudo: false android: components: # Uncomment the lines below if you want to # use the latest revision of Android SDK Tools - tools
You can’t perform that action at this time.