View channels.go
package main
import (
"fmt"
"sync"
"sync/atomic"
)
// Fill Channel with int values
func fillChan(number int) <-chan int {
View mid.go
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/asaskevich/govalidator"
"github.com/gorilla/schema"
View ipdb.go
package main
import (
"net"
"time"
"github.com/fiorix/freegeoip"
)
// IPDatabase Wrapper Struct
View gongular_test.go
package main
import (
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
View logger.js
const { createLogger, format, transports } = require("winston");
// https://github.com/winstonjs/winston#logging
// { error: 0, warn: 1, info: 2, verbose: 3, debug: 4, silly: 5 }
const level = process.env.LOG_LEVEL || "debug";
function formatParams(info) {
const { timestamp, level, message, ...args } = info;
const ts = timestamp.slice(0, 19).replace("T", " ");
View exceptions.js
// You can catch an exception, modify it, then throw again. Handy for passing information (like SQL queries or state) up the chain of error handlers.
function doSomething(user) {
return Promise.resolve()
.then(() => {
throw new Error("Some Problem");
})
.catch(err => {
throw new Error("Child: " + err.message + ' User:' + user);
});
}
View c_code_in_golang.go
package main
/*
#include <stdio.h>
#include <sys/time.h>
int plus(int x, int y)
{
return x + y;
}
View generate_stellar_keys.go
package main
import (
"fmt"
"log"
"runtime"
"sync"
"sync/atomic"
"time"
View json-responder.go
// Copyright 2016 Noel Cower. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// at the end of the file.
// This file is intended to demonstrate writing a general-purpose HTTP handler
// where the input and output are known to be JSON, follow a particular error
// convention, and so on. It falls apart in particular with GET requests where
// request bodies are uncommon, at best.
//
// The responder handlers mimic gRPC's error code/response format, but does not
View apps.md