I hereby claim:
- I am ezeql on github.
- I am ezeql (https://keybase.io/ezeql) on keybase.
- I have a public key ASA9hFkjMeBG8ex4daWtqQZcDDbnOb8AjDa20_8_cL017wo
To claim this, I am signing this object:
// read ten numbers from the standard input and print the smallest and largest number. | |
package main | |
import "fmt" | |
func main() { | |
var n int | |
var min, max int | |
for i := 0; i < 10; i++ { | |
print("Enter a number: ") |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
I hereby claim:
To claim this, I am signing this object:
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
func main() { | |
// Set up a done channel that's shared by the whole pipeline, |
//package ... | |
import( | |
//... | |
"github.com/garyburd/redigo/redis" | |
"os" | |
) | |
//.... |
func ProxyBuilder(repoFunction func(int) ([]interface{}, error)) func(c *gin.Context) { | |
return func(c *gin.Context) { | |
ID, _ := strconv.Atoi(c.Param("id")) | |
if results, err := repoFunction(ID); err == nil { | |
c.JSON(http.StatusOK, &results) | |
} else { | |
c.JSON(http.StatusBadRequest, err.Error()) | |
} | |
} |
var tint = TPath( { pack : [], name : "String", params : [], sub : null } ); | |
var typeILang = { name:"ILang", pack:[], pos:pos, meta:[], params:[], isExtern:false, kind:TDClass(null, [], true), fields:[] }; | |
typeILang.fields = [ { pos:pos, meta:[], name:"hello", doc:null, access:[APublic], kind:FVar(tint) } ]; | |
Context.defineType(typeILang); | |
test/LangMan.hx:10: characters 2-7 : Field hello needed by ILang is missing |