This file contains 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 service | |
import ( | |
"fmt" | |
"sync" | |
) | |
type key int | |
type Service func() interface{} |
This file contains 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
// Copyright 2016 The Nanoninja Authors. All rights reserved. | |
package main | |
import ( | |
"io" | |
"log" | |
"os" | |
) |
This file contains 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
// Copyright 2016 Vincent Letourneau. | |
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func AuthMiddleware(next http.Handler) http.Handler { |
This file contains 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
<?php | |
$dom = simplexml_load_string( | |
'<root> | |
<langage>PHP</langage> | |
<version>7</version> | |
<parent> | |
<version>5</version> | |
</parent> | |
</root>' |
This file contains 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" | |
func main() { | |
ch := make(chan string) | |
go func(c chan string) { | |
ch <- "Hello Gopher" | |
}(ch) |
This file contains 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" | |
"golang.org/x/net/context" | |
"log" | |
"net/http" | |
"os" | |
) |
This file contains 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" | |
"log" | |
"net/http" | |
) | |
func myHandler(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("myHandler\n")) |
This file contains 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
<?php | |
// Get random data | |
function getRandScore($nb = 10) { | |
$data = array(); | |
for ($i = 0; $i < $nb; $i++) { | |
$data[] = rand(5, 299); | |
} | |
return $data; | |
} |
This file contains 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
// Copyright 2015 The Nanoninja Authors. All rights reserved. | |
package box | |
import "time" | |
// ServiceFunc registers the service function. | |
type ServiceFunc func(b *Box) interface{} | |
type Box struct { |
This file contains 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
// Copyright 2015 The Nanoninja Authors. All rights reserved. | |
package container | |
// ServiceFunc registers the service function. | |
type ServiceFunc func(c *container) interface{} | |
type container struct { | |
name string | |
services map[string]interface{} |