$ gsutil ls
gs://ano-auth-test-bucket/
gs://ano-static-site-bucket/
This is based on:
Also, you have to have a paid plan for this to work. I have the cheapo $7/mo plan.
| /********************************************************************* | |
| || Import required modules | |
| *********************************************************************/ | |
| import {fromJS} from 'immutable' | |
| import Keen from 'keen-js' | |
| var client = new Keen({ | |
| projectId: "your-project-id", | |
| writeKey: "your-write-key" | |
| }) |
If you're using Redux and connect, this is a nice syntax for creating connected components:
export default connect((state) => state)(React.createClass({
render: function() {
...
this.props.Projects.get("ProjectName") // access the state tree provided by combineReducers
}
})
I really liked @tjvantoll article Handling Failed HTTP Responses With fetch(). The one thing I found annoying with it, though, is that response.statusText always returns the generic error message associated with the error code. Most APIs, however, will generally return some kind of useful, more human friendly message in the body.
Here's a modification that will capture this message. The key is that rather than throwing an error, you just throw the response and then process it in the catch block to extract the message in the body:
fetch("/api/foo")
.then( response => {
if (!response.ok) { throw response }
return response.json() //we only get here if there is no error
})
I was trying to pass config variables from a backend written in Go to a single page app (SPA) written in react. For example, I wanted to set an "Env" flag to dev or prod or control whether you have to log in or not. Here's an example of the /api/config route that supplies this data:
{
"Auth0ClientDomain": "odewahn.auth0.com",
"Auth0ClientID": "gcSxq9GfpUdVWNIvYiOsP7rh1s8u6ftA",
"ClientBrowser": "HTTPie",
"ClientOS": "darwin",
"Env": "dev",
"FirstClientLoad": "true",
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "github.com/samalba/dockerclient" | |
| ) | |
| // Helpful: |
How do we make it easy (well, easier) for users to run pre-built Docker containers?
Desktop GUI for publishing and running containers.
| package main | |
| import ( | |
| "crypto/rand" | |
| "fmt" | |
| "log" | |
| "github.com/fsouza/go-dockerclient" | |
| ) |
| package main | |
| import ( | |
| "fmt" | |
| "os/exec" | |
| "strings" | |
| ) | |
| func runCmd(cmdArgs []string) ([]string, error) { | |
| cmdName := "docker-machine" |