This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type customError struct { | |
| statusCode int | |
| description string | |
| details interface{} | |
| } | |
| type CustomError interface { | |
| error | |
| StatusCode() int | |
| Details() interface{} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func TestValidate(t *testing.T) { | |
| validRawToken := jwtBytes(testJWT()) | |
| expiredToken := testJWT() | |
| expiredToken.Claims().SetExpiration(time.Now().Add(-24 * time.Hour)) | |
| expiredRawToken := jwtBytes(expiredToken) | |
| badRawToken := []byte("You know I'm bad, I'm bad - you know it") | |
| testCases := []struct { | |
| name string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package pool | |
| import ( | |
| "errors" | |
| "fmt" | |
| "log" | |
| "sort" | |
| "time" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "os" | |
| "os/signal" | |
| "strconv" | |
| "sync" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func sliceUp(s []string, size int) [][]string { | |
| total := len(s) | |
| var result [][]string | |
| for i := 0; ; i++ { | |
| first := size * i | |
| if first > total { | |
| break | |
| } | |
| last := size * (i + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bind P paste-buffer | |
| bind-key -T copy-mode-vi v send-keys -X begin-selection | |
| bind-key -T copy-mode-vi y send-keys -X copy-selection | |
| bind-key -T copy-mode-vi r send-keys -X rectangle-toggle | |
| bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -sel clip -i" | |
| set -g mouse on | |
| set -s escape-time 0 | |
| set-window-option -g mode-keys vi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "os" | |
| "os/signal" | |
| "syscall" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "swagger": "2.0", | |
| "info": { | |
| "title": "TGEN (The Game Engine) API documentation", | |
| "version": "1.0" | |
| }, | |
| "consumes": [ | |
| "application/json" | |
| ], | |
| "produces": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| var ( | |
| dateTimeISO8601format1 = "2006-01-02T15:04:05.999Z07:00" | |
| dateTimeISO8601format2 = "2006-01-02T15:04:05.999-07:00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function deepValue(obj, path) { | |
| // allow path to be passed as a string | |
| if (!Array.isArray(path)){ | |
| path = path.split(".") | |
| } | |
| var segment = path[0] | |
| path = path.slice(1, path.length); | |
| obj = obj[segment] |