content stringlengths 44 6.13M | membership stringclasses 2
values |
|---|---|
package systems
import (
"image"
"sync"
"golang.org/x/image/colornames"
"github.com/brunoga/robomaster/sdk"
"github.com/EngoEngine/ecs"
"github.com/EngoEngine/engo"
"github.com/EngoEngine/engo/common"
)
type systemVideoEntity struct {
ecs.BasicEntity
*common.SpaceComponent
*common.RenderComponent
}
type... | member |
package main
import (
"bufio"
"encoding/binary"
"flag"
influxdb2 "github.com/influxdata/influxdb-client-go/v2"
"github.com/influxdata/influxdb-client-go/v2/api"
"log"
"math"
"net"
"os"
"strings"
"time"
)
const hostname = "0.0.0.0" // Address to listen on (0.0.0.0 = all interfaces)
const port = "... | non-member |
package transformer
import (
"regexp"
"strings"
"unicode"
"unicode/utf8"
)
type capitalization int
const (
noCapitalization capitalization = iota
firstCapitzlized
allCapitalized
)
// Regexes for handling how to split messages into usable components.
var wordSplitRegex = regexp.MustCompile(`(\w+\b-+|\S+)[\n]*... | non-member |
package main
import (
"testing"
)
func TestActivityNotifications(t *testing.T) {
cases := []struct {
result int
expected int
}{
{
countInversions([]int{1, 1, 1, 2, 2}), 0,
},
{
countInversions([]int{2, 1, 3, 1, 2}), 4,
},
}
for _, c := range cases {
if c.result != c.expected {
t.Errorf("... | non-member |
package mysqlparse
import (
"bytes"
"fmt"
"io"
"strings"
"github.com/xwb1989/sqlparser"
)
// Parse blabla
func Parse(sql string) {
tokens := sqlparser.NewTokenizer(strings.NewReader(sql))
for {
stmt, err := sqlparser.ParseNext(tokens)
if err == io.EOF {
// t.Error(err)
break
}
fmt.Println(parseS... | non-member |
// user.go
package main
import (
"crypto/x509"
"database/sql"
"errors"
"fmt"
"strings"
"sync"
"github.com/golang/glog"
)
// -----------------------------------------------
type TUserProfil int
const (
ProfilNone = iota
ProfilAdmin
ProfilUser
)
// -----------------------------------------------
var user... | non-member |
//go:build !windows
// +build !windows
package ledgerbackend
import (
"os"
"github.com/pkg/errors"
)
// Posix-specific methods for the StellarCoreRunner type.
func (c *stellarCoreRunner) getPipeName() string {
// The exec.Cmd.ExtraFiles field carries *io.File values that are assigned
// to child process fds co... | member |
package main
// #cgo CPPFLAGS: -I/usr/local/modsecurity/include
// #cgo LDFLAGS: /usr/local/modsecurity/lib/libmodsecurity.so
// #include "modsec.c"
import "C"
import (
"encoding/json"
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
"net/http/httputil"
"net/url"
"time"
"unsafe"
)
func HomeFunc(w http.Respon... | non-member |
package msg
import (
"bufio"
"encoding/gob"
"fmt"
"io"
"sync"
)
// Reader : simple bufio.Reader safe for goroutines...
type Reader struct {
b *bufio.Reader
m sync.Mutex
}
// NewReader : constructor
func NewReader(rd io.Reader) *Reader {
s := new(Reader)
s.b = bufio.NewReader(rd)
return s
}
// ReadString :... | non-member |
package panda
import (
"net/http"
"github.com/LeeEirc/httpsig"
)
const (
signHeaderRequestTarget = "(request-target)"
signHeaderDate = "date"
signAlgorithm = "hmac-sha256"
)
type ProfileAuth struct {
KeyID string
SecretID string
}
func (auth *ProfileAuth) Sign(r *http.Request) error {
... | non-member |
package linux
import (
"net"
)
func LocalIp() (string, error) {
localIp := "N/A"
adders, err := net.InterfaceAddrs()
if err != nil {
return localIp, err
}
for _, addr := range adders {
if ipNet, ok := addr.(*net.IPNet); ok &&
!ipNet.IP.IsLinkLocalUnicast() && !ipNet.IP.IsLoopback() && ipNet.IP.To4() != n... | non-member |
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"runtime"
"stashbox/pkg/archive"
"stashbox/pkg/crawler"
)
func usage() {
fmt.Println("Usage: stashbox <command> <options>")
fmt.Println("")
fmt.Println(" Where command is one of:")
fmt.Println(" add -- add a url to the archive")
fmt.Println(" li... | non-member |
package valuechangevalidationfuncinfo
import (
"testing"
"golang.org/x/tools/go/analysis"
)
func TestValidateAnalyzer(t *testing.T) {
err := analysis.Validate([]*analysis.Analyzer{Analyzer})
if err != nil {
t.Fatal(err)
}
}
| non-member |
package main
import (
"flag"
"log"
"net"
"strconv"
)
func main() {
port := flag.Int("port", 8080, "Port to accept connections on.")
host := flag.String("host", "0.0.0.0", "Host or IP to bind to")
flag.Parse()
l, err := net.Listen("tcp", *host+":"+strconv.Itoa(*port))
if err != nil {
log.Panicln(err)
}
l... | non-member |
package lib
import (
"errors"
"fmt"
"runtime"
"strings"
"testing"
)
func TestF테스트_중(t *testing.T) {
t.Parallel()
F테스트_모드_종료()
F테스트_거짓임(t, F테스트_모드_실행_중())
F테스트_모드_시작()
F테스트_참임(t, F테스트_모드_실행_중())
}
func TestF테스트_참임(t *testing.T) {
//t.Parallel() // 화면 출력 중지 로 인하여 병렬 실행 불가.
F테스트_참임(t, true)
모의_테스트 := n... | non-member |
package main
import (
"fmt"
"sync"
)
func greeter(wg *sync.WaitGroup, name string) {
fmt.Printf("Hallo %s\n", name)
wg.Done()
}
func main() {
wg := &sync.WaitGroup{}
wg.Add(1)
go greeter(wg, "Alice")
wg.Wait()
}
| non-member |
package hexaring
import (
"hash"
"math/big"
)
// CalculateRingVertexes returns the requested number of vertexes around the ring
// equi-distant from each other except for potentially the last one which may be larger
func CalculateRingVertexes(hash []byte, count int64) []*big.Int {
var circum big.Int
//circum.SetB... | non-member |
package main
import (
"fmt"
"github.com/formicidae-tracker/zeus/internal/zeus"
flags "github.com/jessevdk/go-flags"
)
type VersionCommand struct {
Args struct {
Config flags.Filename
} `positional-args:"yes"`
}
func (c *VersionCommand) Execute(args []string) error {
fmt.Printf("%s\n", zeus.ZEUS_VERSION)
re... | non-member |
package build
import (
"io"
"text/template"
"github.com/benpate/html"
)
// StepInlineSaveButton represents an action-step that can build a Stream into HTML
type StepInlineSaveButton struct {
ID *template.Template
Class string
Label *template.Template
}
// Get builds the Stream HTML to the context
func (ste... | non-member |
/*
* @Description: 前置重贴标签算法中图的节点类型 FrontFlowVertex
* @Author: wangchengdg@gmail.com
* @Date: 2020-02-18 10:31:22
* @LastEditTime: 2020-03-13 22:27:34
* @LastEditors:
*/
package GraphVertex
/*!
*
* FrontFlowVertex 继承自 FlowVertex,它比FlowVertex顶点多了一个`N_List`数据成员,表示邻接链表
*
* relabel_to_front 算法中,每一个FrontFlowVertex顶点位于... | non-member |
package main
import (
"log"
)
func main() {
log.SetFlags(log.Ldate | log.Lmicroseconds | log.Llongfile)
name := "q0phi80"
log.Println("Demo app")
log.Printf("%s is here!", name)
log.Print("Run")
}
| non-member |
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"github.com/eniehack/persona-server/config"
"github.com/eniehack/persona-server/handler"
"github.com/go-chi/cors"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
migrate "github.com/ruben... | non-member |
package models
type NoSuchObjectError struct {
Info string
}
func (e NoSuchObjectError) Error() string {
return e.Info
}
func NewNoSuchObjectError(s string) NoSuchObjectError {
return NoSuchObjectError{Info: s}
}
| member |
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"github.com/pkg/errors"
)
func repoNameToRegistryImageTuple(repo string) (string, string, error) {
s := strings.Split(repo, "/")
var registryURL, image string
switch len(s) {
case 2:
registryURL = "registry.hub.docker.com"
image = ... | non-member |
package cpu
/*
will be useful for debugging
func getMode(mode uint8) string {
switch mode {
case ModeInvalid: return "ModeInvalid"
case ModeZeroPage: return "ModeZeroPage"
case ModeIndexedZeroPageX: return "ModeIndexedZeroPageX"
case ModeIndexedZeroPageY: return "ModeIndexedZeroPageY"
case ModeAbsolute: return "... | member |
package cluster
import (
"testing"
"github.com/ditrit/gandalf/core/cluster"
)
func TestNewClusterMember(t *testing.T) {
const (
logicalName string = "test"
databasePath string = "test"
logPath string = "test"
shosetType string = "cl"
)
connectorMember := cluster.NewClusterMember(logicalName, da... | non-member |
package main
import (
"flag"
"log"
"net/http"
"os"
"github.com/nsmith5/vgraas/pkg/middleware"
"github.com/nsmith5/vgraas/pkg/vgraas"
)
func main() {
var (
addr = flag.String("api", ":8080", "API listen address")
)
flag.Parse()
var api http.Handler
{
repo := vgraas.NewRAMRepo()
api = vgraas.NewAPI(r... | non-member |
package util
import (
"fmt"
"testing"
)
func TestGenerateRandomString(t *testing.T) {
for _, length := range []int{0, 10, 25} {
t.Run(fmt.Sprintf("length_%d", length), func(t *testing.T) {
rnd := GenerateRandomString(length)
if len(rnd) != length {
t.Errorf("GenerateRandomString() = %v, want %v", len(r... | non-member |
package web
import "testing"
func TestIndexHandler(t *testing.T) {
rr := testHandler(createRouter(), "GET", "/", nil)
if rr.Code != 200 {
t.Fatalf("Expected index to respond with 200, got %d instead", rr.Code)
}
}
| non-member |
package uix
import (
"git.kirsle.net/SketchyMaze/doodle/pkg/shmem"
"git.kirsle.net/go/render"
"git.kirsle.net/go/ui"
)
/*
Functions for the Crosshair feature of the game.
NOT dependent on Canvas!
*/
type Crosshair struct {
LengthPct float64 // between 0 and 1
Widget ui.Widget
}
func NewCrosshair(child ui.W... | non-member |
package polyglot
var zobristHashes = [781]uint64{
0x9D39247E33776D41, 0x2AF7398005AAA5C7, 0x44DB015024623547, 0x9C15F73E62A76AE2,
0x75834465489C0C89, 0x3290AC3A203001BF, 0x0FBBAD1F61042279, 0xE83A908FF2FB60CA,
0x0D7E765D58755C10, 0x1A083822CEAFE02D, 0x9605D5F0E25EC3B0, 0xD021FF5CD13A2ED5,
0x40BDF15D4A672E32, 0x011... | non-member |
package stencil
import (
"fmt"
"strings"
"github.com/harrowio/harrow/domain"
)
// CapistranoRails sets up default tasks and environments for working
// with a RubyOnRails application using capistrano.
type CapistranoRails struct {
conf *Configuration
}
func NewCapistranoRails(configuration *Configuration) *Capi... | non-member |
package parser
// https://github.com/SatisfactoryModdingUE/UnrealEngine/blob/4.22-CSS/Engine/Source/Runtime/Core/Public/Misc/FrameNumber.h#L16
type FFrameNumber struct {
Value int32 `json:"value"`
}
func (parser *PakParser) ReadFFrameNumber() *FFrameNumber {
return &FFrameNumber{
Value: parser.ReadInt32(),
}
}
| non-member |
package events
type (
Event struct {
stopped bool
}
)
// StopPropagation Stops the propagation of the event to further event listeners
func (e *Event) StopPropagation() {
e.stopped = true
}
// IsPropagationStopped returns whether further event listeners should be triggered
func (e *Event) IsPropagationStopped()... | non-member |
package mysqlutil
import (
"database/sql/driver"
"fmt"
"log"
"net/url"
"strings"
"github.com/leizongmin/go/sqlutil"
)
type ConnectionOptions struct {
Host string
Port int
User string
Password string
Database string
Charset string
Timezone string // +8:00
ParseTime bool
Auto... | non-member |
package types
import (
"regexp"
"whapp-irc/ircconnection"
"whapp-irc/whapp"
)
const messageIDListSize = 750
var (
numberRegex = regexp.MustCompile(`^\+[\d ]+$`)
nonNumberRegex = regexp.MustCompile(`[^\d]`)
)
// A Participant is an user on WhatsApp.
type Participant whapp.Participant
// FullName returns the... | non-member |
package subsonic
import (
"errors"
"net/http"
"time"
"github.com/navidrome/navidrome/model"
"github.com/navidrome/navidrome/model/request"
"github.com/navidrome/navidrome/server/subsonic/responses"
"github.com/navidrome/navidrome/utils/req"
"github.com/navidrome/navidrome/utils/slice"
)
func (api *Router) Ge... | non-member |
package iterables
import (
"container/heap"
"fmt"
)
func (i Iterable[T]) Sort(cmp func(T, T) int) Iterable[T] {
gen := sort[T]{tHeap[T]{cmpFunc: cmp}}
for true {
item, err := i.Next()
if (err == IterationStop{}) {
break
} else if err != nil {
invalid := invalidIterable[T]{InvalidSort{err}}
return ... | non-member |
package main
import "fmt"
func filter(in, out chan int) {
go func() {
for n := range in {
if n%2 == 0 {
out <- n
}
}
close(out)
}()
}
func main() {
done := make(chan struct{})
ch := gen(done)
f := make(chan int)
filter(ch, f)
quadratChannel := sq(f)
fmt.Println(<-quadratChannel)
fmt.Println(<... | non-member |
package k8sutil
import (
"context"
"time"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
// UpdatePodCondition updates the given condition type of the given pod with the new status and reason
func UpdatePodCondition(pod *corev1.Pod, condTy... | non-member |
// Pictures fetcher
package pictures
import (
"fmt"
"io/ioutil"
"log"
"math/rand"
"github.com/PeterCxy/gotelegram"
"github.com/PeterCxy/gotgbot/support/types"
)
type Pictures struct {
tg *telegram.Telegram
pic string
debug bool
}
func Setup(t *telegram.Telegram, config map[string]interface{}, modules ... | non-member |
package telegram
import (
"main/pkg/constants"
tele "gopkg.in/telebot.v3"
)
func (reporter *Reporter) GetHelpCommand() Command {
return Command{
Name: "help",
Query: constants.ReporterQueryHelp,
Execute: reporter.HandleHelp,
}
}
func (reporter *Reporter) HandleHelp(c tele.Context) (string, error) {
... | non-member |
package jsonrpc
import (
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/yellomoon/web3tool"
"github.com/yellomoon/web3tool/testutil"
)
func TestSubscribeNewHead(t *testing.T) {
testutil.MultiAddr(t, func(s *testutil.TestServer, addr string) {
if strings.HasPrefix(addr, "http") {... | non-member |
package admin_controller
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/y-transport-server/pkg/app"
"github.com/y-transport-server/pkg/e"
"github.com/y-transport-server/service/admin_service"
)
type login struct {
User string `json:"user" valid:"Required; MaxSize(20);"` // 用户名 也是... | member |
package users
import (
"Office-Booking/app/config"
mid "Office-Booking/delivery/http/middleware"
domain "Office-Booking/domain/users"
"Office-Booking/domain/users/request"
"Office-Booking/domain/users/response"
"net/http"
"strconv"
"github.com/labstack/echo/v4"
)
type UserController struct {
UserUsecase dom... | non-member |
package dtclient
import (
"encoding/json"
"github.com/pkg/errors"
)
type ConnectionInfo struct {
TenantUUID string
TenantToken string
Endpoints string
}
type ActiveGateConnectionInfo struct {
ConnectionInfo
}
type OneAgentConnectionInfo struct {
ConnectionInfo
CommunicationHosts []CommunicationHost
}
/... | member |
package aomx
import (
"net/url"
)
// MustUrl enables parsing and dereferencing a URL in one line.
// It returns a panic if err is not nil.
// Call it for example when you want to dereference the pointer to a parsed URL
// and assign the value to a variable in one line of code.
// This can be useful when initializing... | non-member |
package main
import "testing"
var TestCases = []struct {
Str string
WordExpected string
SentenceExpected string
}{
{"a", "a", "a"},
{"word", "drow", "word"},
{"word1 word2", "2drow 1drow", "word2 word1"},
{"sentence, with. punctuation;", ";noitautcnup .htiw ,ecnetnes", "punctuation; with. sentence,"},
}
func ... | non-member |
package db
import (
"database/sql"
"errors"
"github.com/google/uuid"
"strconv"
"tide/common"
"tide/pkg/custype"
)
type Item struct {
StationId uuid.UUID `json:"station_id" binding:"required"`
Name string `json:"name" binding:"max=20"`
Type string ... | non-member |
package verification
type Type int
const (
Registration Type = 0
Recovery Type = 1
)
| non-member |
package database
import (
"testing"
"os"
"flag"
"database/sql"
)
var databaseFlag = flag.Bool("database", false, "run database integration tests")
var messageQueue = flag.Bool("messageQueue", false, "run message queue integration tests")
var integration = flag.Bool("integration", false, "run all integration tests... | member |
package model
import (
"fmt"
"gorm.io/gorm"
)
type ArticleView struct {
gorm.Model
Title string `gorm:"type:varchar(50) not null;commit:标题"`
Content string `gorm:"type:text not null;commit:内容"`
CategoryID uint8 `gorm:"type:smallint not null;commit:分类ID"`
CategoryName string `gorm:"type:varchar(2... | member |
package wally
import (
"errors"
"fmt"
"github.com/google/gousb"
"io/ioutil"
"time"
)
type status struct {
bStatus string
bwPollTimeout int
bState string
iString string
}
func dfuCommand(dev *gousb.Device, addr int, command int, status *status) (err error) {
var buf []byte
if command == ... | member |
package utils
import (
"github.com/dgrijalva/jwt-go"
"pledge-bridge-backend/config"
"time"
)
func CreateToken(username string) (string, error) {
at := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"username": username,
"exp": time.Now().Add(time.Hour * 24 * 30).Unix(),
})
token, err := at.Si... | non-member |
package main
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context"
)
func main() {
app := iris.New()
none := app.None("/invisible/{username}", func(ctx context.Context) {
ctx.Writef("Hello %s with method: %s", ctx.Values().GetString("username"), ctx.Method())
if from := ctx.Values().GetString... | non-member |
package workflow_error
import (
"time"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
)
type BusinessError struct{}
func (be BusinessError) Error() string {
return "business error"
}
func ExperimentalWorkflow(ctx workflow.Context) error {
ctx = defineActivityOptions(ctx, "some")
err := workflow.... | non-member |
package psql_test
import (
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/dobermanndotdev/dobermann/internal/app/query"
"github.com/dobermanndotdev/dobermann/internal/domain"
"github.com/dobermanndotdev/dobermann/internal/domain/monitor"
"github.com/do... | non-member |
package finder
import (
"testing"
)
func TestFunction_elemInSlice(t *testing.T) {
var elem string = "elem"
var slice = []string{"elem", "foo", "bar"}
if !elemInSlice(slice, elem) {
t.Errorf("Failure: Expected to find element 'elem' in slice!")
}
elem = "elem"
slice = []string{"foo", "bar"}
if elemInSlice... | non-member |
package transfer_test
import (
"testing"
)
func TestAccTransfer_serial(t *testing.T) {
testCases := map[string]map[string]func(t *testing.T){
"Access": {
"disappears": testAccAccess_disappears,
"EFSBasic": testAccAccess_efs_basic,
"S3Basic": testAccAccess_s3_basic,
"S3Policy": testAccAccess_s3_... | non-member |
package utils
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"minirpc/Model"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
"unsafe"
)
type StackInfo struct {
Name string `json:"name"`
Code string `json:"code"`
Ocode string `json:"ocode"`
Gcode string `json:"gcode"`
Val string `json:"val"... | non-member |
package files
import (
"fmt"
"github.com/alexcoder04/iserv2go/iserv/types"
"github.com/studio-b12/gowebdav"
)
type FilesClient struct {
config *types.ClientConfig
davClient *gowebdav.Client
}
func (c *FilesClient) Login(config *types.ClientConfig) error {
c.config = config
c.davClient = gowebdav.NewClien... | non-member |
package currency
import (
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson/bsontype"
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
)
func (a Big) MarshalBSONValue() (bsontype.Type, []byte, error) {
return bsontype.String, bsoncore.AppendString(nil, a.String()), nil
}
func (a *Big) UnmarshalBSONValue(t ... | non-member |
package main
import (
glog "github.com/Sirupsen/logrus"
"k8s.io/apimachinery/pkg/api/resource"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/pkg/api/v1"
)
// Load nodes
func LoadNodes() []v1.Node {
nodes, err := GetKubeCli().CoreV1().Nodes().List(meta_v1.ListOptions{})
if err != nil {
panic... | member |
package types
import (
log "github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/types"
)
/*
* 交易相关类型定义
* 交易action通常有对应的log结构,用于交易回执日志记录
* 每一种action和log需要用id数值和name名称加以区分
*/
// action类型id和name,这些常量可以自定义修改
const (
TyUnknowAction = iota + 100
TyAddAction
TySubAction
TyMulAction
TyDivAction
N... | member |
package runner
import (
"errors"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"testing"
"time"
)
func TestIsDirRootPath(t *testing.T) {
result := isDir(".")
if result != true {
t.Errorf("expected '%t' but got '%t'", true, result)
}
}
func TestIsDirMainFile(t *tes... | non-member |
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
)
type Numverify struct {
Valid bool `json:"valid"`
Number string `json:"number"`
LocalFormat string `json:"local_format"`
InternationalFormat string `json:"international_format"`
CountryPrefix string `jso... | member |
package neurons
import (
"fmt"
"strings"
"sync"
)
type Client struct {
Mu sync.Mutex
Uid string
Hostname string
Username string
Response chan []byte
Jobs chan string
Transfer chan string
Pulse chan struct{}
}
type ClientList struct {
Mu sync.Mutex
List map[string]*Client // str... | non-member |
package strat
import "github.com/curusarn/resh/pkg/records"
// RecentBash prediction/recommendation strategy
type RecentBash struct {
histfile []string
histfileSnapshot map[string][]string
history map[string][]string
}
// Init see name
func (s *RecentBash) Init() {
s.histfileSnapshot = map[strin... | member |
package redactr
import (
"encoding/base64"
"fmt"
"os"
"regexp"
"github.com/dhoelle/redactr/aes"
"github.com/dhoelle/redactr/exec"
"github.com/dhoelle/redactr/vault"
"github.com/hashicorp/vault/api"
)
// A Tool can be used to redact and unredact secrets.
// If you want to use redactr as a library, you probabl... | member |
package katana
import (
"testing"
)
func TestMarkup( t *testing.T ){
data := []struct {
in, out string
errors int
} {
{ "", "", 0 },
{ "texto", "texto", 0 },
{ "texto @e(emph) @b(bold)", "texto emph bold", 0 },
{ "@e(algo<>emph) @b(bold)", "emph bold", 0 },
{ "n", "n", 0 },
{ "b"... | non-member |
package db
import (
pb "github.com/shuza/packet-service/proto"
"github.com/stretchr/testify/mock"
"sync"
)
/**
* := create date: 31-May-2019
* := (C) CopyRight Shuza
* := shuza.ninja
* := shuza.sa@gmail.com
* := Code : Coffee : Fun
**/
type MockDb struct {
mu sync.RWMutex
packets []*pb.Pack... | member |
package globals
import (
"io/ioutil"
)
const (
// ConnAddr is a string constant specifying where the job creator connects to.
ConnAddr = "localhost"
// ConnPort is a string constant specifying the port the job creator runs on
ConnPort = 7777
// ConnType specifies the connection type for the job creat... | non-member |
package cluster
import (
"fmt"
"github.com/guillaumemichel/ipfs-local/config"
)
func main() {
instances := config.LoadInstances("save0")
fmt.Println(instances)
}
| non-member |
package driver
import (
"github.com/graphql-go/graphql"
)
//Deprecate
//CreateVolActionHandler : Only Create volume action,
func CreateVolActionHandler(params graphql.ResolveParams) (interface{}, error) {
// logger.Logger.Println("Resolving: create_volume")
// if params.Args["use_type"] == "" || params.Args["serve... | non-member |
package odoo_api_wrapper
import (
"fmt"
)
// ProjectTask represents project.task model.
type ProjectTask struct {
Id *Int `xmlrpc:"id,omptempty"`
Name *String `xmlrpc:"name,omptempty"`
ProjectId *Many2One `xmlrpc:"project_id,omptempty"`
ParentId ... | non-member |
package main
import "fmt"
const UNITED_STATE_STATES = 50
func main() {
statesNeeded := []string{"mt", "wa", "or", "id", "nv", "ut", "ca", "az"}
stations := make(map[string][]string)
stations["kone"] = []string{"id", "nv", "ut"}
stations["ktwo"] = []string{"wa", "id", "mt"}
stations["kthree"] = []string{"or", "n... | non-member |
// Copyright 2020 Delving B.V.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... | member |
package leetcode
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/lijinglin3/algorithm-go/leetcode"
)
func TestLevelOrder(t *testing.T) {
cases := []*leetcode.Node{
leetcode.NodeExample1,
{},
nil,
}
results := [][][]int{
{{0}, {1, 2, 3}, {4, 5, 6}},
{{0}},
nil,
}
for i := ran... | non-member |
package usercommands
import (
"fmt"
"github.com/volte6/gomud/mobs"
"github.com/volte6/gomud/rooms"
"github.com/volte6/gomud/users"
)
func Zap(rest string, user *users.UserRecord, room *rooms.Room) (bool, error) {
if rest != `` {
playerId, mobId := room.FindByName(rest)
if mobId > 0 {
mob := mobs.Get... | non-member |
package api
import (
"encoding/json"
"net/http"
"testing"
"github.com/photoprism/photoprism/internal/i18n"
"github.com/stretchr/testify/assert"
)
func TestCancelImport(t *testing.T) {
t.Run("successful request", func(t *testing.T) {
app, router, _ := NewApiTest()
CancelImport(router)
r := PerformRequest(... | non-member |
package configuration
/*
实现common.Configuration接口
应用端通过System获取接口对象
*/
import (
"github.com/muidea/magicCenter/common"
"github.com/muidea/magicCenter/common/configuration/bll"
)
func init() {
localConfigurationMap = make(map[string]common.Configuration)
}
// GetConfiguration 获取指定的Configuration
func GetConfigura... | member |
package model
import (
"strings"
)
func MarketConverter(market, typ string) (string, string) {
var x, y string
if strings.Index(strings.ToUpper(market), "/") >= 0 {
arr := strings.Split(strings.ToUpper(market), "/")
x = arr[0]
y = arr[1]
} else if strings.Index(strings.ToUpper(market), "-") >= 0 {
arr := ... | non-member |
package newtype
import "errors"
var (
ErrTypeMissmatch = errors.New("type missmatch")
ErrUnknownType = errors.New("unknown type")
)
| non-member |
package teaconfigs
import (
"github.com/go-yaml/yaml"
"github.com/iwind/TeaGo/Tea"
"github.com/iwind/TeaGo/lists"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/types"
"io/ioutil"
"path/filepath"
"strings"
)
// 本地监听服务配置
type ListenerConfig struct {
Key string // 区分用的Key
Address string
Http bo... | member |
package xhttp
import (
"github.com/gin-gonic/gin"
"net/http"
)
type Response struct {
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
func SuccessResponse(ctx *gin.Context, data interface{}) {
ctx.JSON(http.StatusOK, Response{
Msg: "OK",
Data: data,
})
}
func BadRequestResponse(ctx *gin.Co... | non-member |
package main
import (
"fmt"
"os"
"github.com/sonm-io/core/insonmnia/worker/gpu"
)
var appVersion string
func main() {
fmt.Printf("sonm lspgu %s\r\n", appVersion)
cards, err := gpu.CollectDRICardDevices()
if err != nil {
fmt.Printf("cannot collect card devces: %v\r\n", err)
os.Exit(1)
}
for _, card := r... | non-member |
package myzap
import (
"os"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"github.com/natefinch/lumberjack"
)
type ZapLogger struct {
Logger *zap.Logger
}
func NewLogger() *ZapLogger {
return NewLoggerWithEncoder(zapcore.ISO8601TimeEncoder, GrpcCallerEncoder)
}
func NewLoggerWithEncoder(timeEncoder zapcore.Ti... | non-member |
package transxchange
import "errors"
type RouteSection struct {
ID string `xml:"id,attr"`
RouteLinks []RouteLink `xml:"RouteLink"`
}
func (r *RouteSection) GetRouteLink(ID string) (*RouteLink, error) {
for _, routeLink := range r.RouteLinks {
if routeLink.ID == ID {
return &routeLink, nil
}
}
return ni... | non-member |
package integration
import (
"github.com/hellgate75/k8s-deploy/log"
"github.com/hellgate75/k8s-deploy/model"
)
type kubernetesFilesRepositoryManager struct {
repository model.Repository
dataFolder string
logger log.Logger
files []model.KubernetesFileInfo
}
const (
repositoryKubernetesFilesIndexTempla... | non-member |
package sdk
import (
"context"
"encoding/json"
"strings"
)
const (
CampaignMinimumBudget = 1
CampaignMaximumBudget = 300
CampaignMaximumImpBudget = 100000
)
// Campaign is a QoL alias for campaigns.Campaign
type Campaign struct {
ID string `json:"id"`
OwnerID string `json:"ownerID"`
Active bool `js... | member |
package logg
import "github.com/zerodha/logf"
type LoggOpts struct {
Debug bool
Caller bool
Color bool
}
func NewLogg(o LoggOpts) logf.Logger {
loggConfig := logf.Opts{
EnableColor: o.Color,
EnableCaller: o.Caller,
}
if o.Debug {
loggConfig.Level = logf.DebugLevel
} else {
loggConfig.Level = logf.... | non-member |
package payreq
import (
"fmt"
"strings"
"unicode"
"github.com/btcsuite/btcd/chaincfg"
)
// Currency is a type representing a cryptocurrency. It has a name and
// parameters defining the chain of the cryptocurrency.
type Currency struct {
Name string
Chaincfg *chaincfg.Params
}
var (
// liteCoinParams con... | member |
// +build linux
package redir
import (
"encoding/binary"
"errors"
"net"
"syscall"
)
const (
IPV6_TRANSPARENT = 0x4b
IPV6_RECVORIGDSTADDR = 0x4a
)
func setsockopt(c *net.UDPConn, addr string) error {
isIPv6 := true
host, _, err := net.SplitHostPort(addr)
if err != nil {
return err
}
ip := net.ParseI... | non-member |
package client
import (
"context"
"fmt"
"strconv"
"testing"
"time"
"github.com/ory/dockertest/v3"
"github.com/stretchr/testify/require"
"github.com/rudderlabs/rudder-go-kit/kafkaclient/testutil"
"github.com/rudderlabs/rudder-go-kit/tcpproxy"
"github.com/rudderlabs/rudder-go-kit/testhelper"
"github.com/rud... | non-member |
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
type Storehouse struct {
StoreCode string
Capacity int
}
type ClothingInfo struct {
ClothingCode string
Size string
Price int
ClothingType string
}
type Supplier struct {
SupplierCode string
Supplier... | non-member |
package cmd
import (
"fmt"
"github.com/cloudfauj/cloudfauj/api"
"github.com/cloudfauj/cloudfauj/environment"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
var envCreateCmd = &cobra.Command{
Use: "create --config PATH",
Short: "Create a new Environment",
Long: `
This command lets you create a new e... | non-member |
package server
import (
"fmt"
"net/http"
"github.com/labstack/echo/v4"
"github.com/faroukelkholy/bank/internal/service/customer"
"github.com/faroukelkholy/bank/internal/service/models"
"github.com/faroukelkholy/bank/internal/storage/postgres"
)
func CCAHandler(srv customer.Service) echo.HandlerFunc {
return ... | member |
package login
import (
"RainbowRunner/internal/message"
"RainbowRunner/internal/serverconfig"
"fmt"
log "github.com/sirupsen/logrus"
"net"
)
func StartLoginServer() {
listen, err := net.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", serverconfig.Config.Network.LoginServerPort))
if err != nil {
panic(err)
}
defe... | non-member |
package storage
func IsCloud(path string) bool {
return IsS3(path) || IsGCS(path)
}
func IsCloudDir(path string) bool {
return IsS3Dir(path) || IsGCSDir(path)
}
| non-member |
package mocks
import (
"github.com/makerdao/vdb-mcd-transformers/backfill/repository"
)
type EventsRepository struct {
GetForksError error
GetForksForksToReturn []repository.Fork
GetForksPassedStartingBlock int
GetFrobsError error
GetFrobsFrobsToReturn []repository.Frob
... | non-member |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.