$ curl -gs http://localhost:8081/rpc/index?a_nsp=public
{
"success": true,
"result": [
{
package main | |
import "fmt" | |
func main() { | |
fmt.Printf("hello, world\n") | |
} |
package main | |
// Code from http://go-macaron.com/docs/middlewares/templating | |
import ( | |
"gopkg.in/macaron.v1" | |
"github.com/skratchdot/open-golang/open" | |
) | |
func main() { |
<h1>Hello {{.Name}}</h1> |
# Link from https://golang.org/dl/ | |
wget https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz | |
tar -xzf go1.5.2.linux-amd64.tar.gz | |
sudo mv go /usr/local/go-1.5.2 | |
cd /usr/local | |
sudo ln -s go-1.5.2 go | |
for b in go godoc gofmt ; do ln -s /usr/local/go/bin/$b bin/$b ; done |
package main | |
/* | |
hookex.go - Hook response parsing example | |
Use: | |
echo '{"output":"Hook start\nProcessing event (push)\nError fired by secret\n","error":"exit status 1"}' | go run hookex.go | |
*/ |
window.onerror = function (msg, url, line, col, error) { | |
var x = new (this.XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0'); | |
var req = 'msg=' + encodeURIComponent(msg) + '&url='+encodeURIComponent(url) + '&line=' + line + '&col=' +col; // + '&error=' + encodeURIComponent(error); | |
x.open('GET', '/blank.png?' + req, 1); | |
x.send(); | |
}; |
CREATE OR REPLACE FUNCTION template(tmpl TEXT, vars JSONB) RETURNS TEXT IMMUTABLE LANGUAGE 'plpgsql' AS | |
$_$ | |
DECLARE | |
r RECORD; | |
BEGIN | |
FOR r IN SELECT * from jsonb_each_text(vars) LOOP | |
tmpl := regexp_replace(tmpl,'{{\s*' || r.key || '\s*}}', r.value); | |
END LOOP; | |
RETURN tmpl; | |
END; |
/* | |
concat - sample function for dbrpc demo | |
See https://github.com/LeKovr/dbrpc | |
*/ | |
CREATE OR REPLACE FUNCTION concat( | |
a_arg1 TEXT | |
, a_arg2 TEXT DEFAULT '' | |
) RETURNS TEXT IMMUTABLE LANGUAGE 'plpgsql' AS | |
$_$ | |
BEGIN |