Looks like you have to use gob to register the types you want to stow when
using stow.NewStore.
Compare original example using stow.NewJsonStore.
See this post for context.
| <html> | |
| <head> | |
| <meta charset='utf-8' /> | |
| <title>Mapbox GL JS Easing</title> | |
| <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | |
| <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.8.0/mapbox-gl.js'></script> | |
| <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.8.0/mapbox-gl.css' rel='stylesheet' /> | |
| <link href='https://www.mapbox.com/base/latest/base.css' rel='stylesheet' /> | |
| <style> | |
| body { margin:0; padding:0; } |
Looks like you have to use gob to register the types you want to stow when
using stow.NewStore.
Compare original example using stow.NewJsonStore.
See this post for context.
Useful articles describing how to configure vim:
coming home to vim — nice post on vim plugins, config, etc.
how i boosted my vim — decent intro to vim configuration.
modern vim config with pathogen — how to use pathogen for package management.
Note that you can do a GET request to construct query strings with curl.
# GET http://acme.org/tasks?status=overdue&since=today
curl --get http://acme.org/tasks -d status=overdue -d since=today
# GET http://httpbin.org/get?status=overdue&since=today&contains=bob%20jones
curl -d status=overdue \
-d since=today \
--data-urlencode "contains=bob jones" \
Working with time in Go is pretty straightforward.
Get the current local time:
now := time.Now() // 02 Apr 15 14:03
Construct a time with Date(y, m, d, h, m, s, ns, loc):
Quick demo showing how to to simulate a simple REST API.
Credit where due: this demo is based on this example from Ardan Studios' training materials. We're using httprouter for routing and added a retrieve handler for retrieving users by ID (/users/:id).
See also this example, reflecting basic practices for designing a REST API.
Start the server:
Simple demo of how to decode JSON data coming from an http POST request.
Run the server with go run server.go and then make a curl request:
. post.sh
... or ...
curl -d @- http://localhost:8080/user
{
An introduction to curl using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
Includes HTTP-Header information in the output
Below are a few examples of POSTing form data and file-uploads with curl.
For guidance on when to use which method, see form-data vs -urlencoded.
For details and more examples, see the POST section of the official tutorial.
In the examples below, suppose we need to POST data to https://foo.io/users/joyrexus/shoes, the canonical address for the shoes resource (a "collection" resource, in REST-speak) of a particular user (joyrexus):