This file contains hidden or 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
#include <stdio.h> | |
#include <math.h> | |
double hero(double a,double b,double c){ | |
double s,T; | |
if(a+b<c || b+c<a || c+a<b){ | |
return -1; | |
}else{ | |
s=(a+b+c)/2; | |
T=sqrt(s*(s-a)*(s-b)*(s-c)); |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
int sum(int*, int); | |
int ave(int*, int); | |
int min(int*, int); | |
int max(int*, int); | |
int main(void){ | |
int n; |
This file contains hidden or 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 models | |
import ( | |
"reflect" | |
"strings" | |
) | |
func contains(ss []string, s string) bool { | |
for _, v := range ss { | |
if v == s { |
This file contains hidden or 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
$ go get github.com/shimastripe/go-api-sokushukai | |
$ cd $GOPATH/src/github.com/shimastripe/go-api-sokushukai | |
$ go get ./... | |
$ go build -o bin/server | |
$ bin/server | |
# => http://localhost:8080/api/users?pretty |
This file contains hidden or 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
fetch("http://localhost:8080/api/users", | |
{ | |
headers: { | |
'Accept': 'application/json; version=0.5', | |
'Content-Type': 'application/json' | |
}, | |
method: "GET" | |
}) | |
.then(function(res){ return res.json(); }) | |
.then(function(json){console.log(json);}) |
This file contains hidden or 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
curl -i -H "Accept: application/json; version=0.5" -X GET http://localhost:8080/api/users |
This file contains hidden or 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
if version.Range(ver, "<", "1.0.0") { | |
// conditional branch by version. | |
// this version < 1.0.0 !! | |
c.JSON(400, gin.H{"error": "this version (< 1.0.0) is not supported!"}) | |
return | |
} |
This file contains hidden or 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
{ | |
"data": [ | |
... Endpoint data is here | |
], | |
"paging": { | |
"cursors": { | |
"after": "MTAxNTExOTQ1MjAwNzI5NDE=", | |
"before": "NDMyNzQyODI3OTQw" | |
}, | |
"previous": "https://graph.facebook.com/me/albums?limit=25&before=NDMyNzQyODI3OTQw", |
This file contains hidden or 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
HTTP/1.1 200 OK | |
Content-Type: application/json; charset=utf-8 | |
Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=15>; rel="next", | |
<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last", | |
<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1>; rel="first", | |
<https://api.github.com/search/code?q=addClass+user%3Amozilla&page=13>; rel="prev" | |
Date: Mon, 01 Aug 2016 03:33:50 GMT | |
Content-Length: 5 |
This file contains hidden or 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
fetch("http://localhost:8080/api/users?limit=2", | |
{ | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
method: "GET" | |
}) | |
.then(function(res){ console.log(res.headers.get('Link')); return res.json(); }) | |
.then(function(json){console.log(json);}) |
OlderNewer