This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.
The example is updated with the current version of mithril, though.
| <!-- Code snippet --> | |
| <div class="form-group"> | |
| <div class="col-md-12 text-center"> | |
| <span class="glyphicon glyphicon-refresh glyphicon-refresh-animate"></span> | |
| </div> | |
| </div> |
| package main | |
| import ( | |
| "encoding/json" | |
| "log" | |
| "net/http" | |
| "reflect" | |
| "time" | |
| "github.com/gorilla/context" |
This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.
The example is updated with the current version of mithril, though.
| // keepDoingSomething will keep trying to doSomething() until either | |
| // we get a result from doSomething() or the timeout expires | |
| func keepDoingSomething() (bool, error) { | |
| timeout := time.After(5 * time.Second) | |
| tick := time.Tick(500 * time.Millisecond) | |
| // Keep trying until we're timed out or got a result or got an error | |
| for { | |
| select { | |
| // Got a timeout! fail with a timeout error | |
| case <-timeout: |
| package main | |
| import ( | |
| "log" | |
| "net/smtp" | |
| ) | |
| func main() { | |
| send("hello there") | |
| } |
| $ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4 |
| package main | |
| import ( | |
| "crypto/rand" | |
| "log" | |
| "math/big" | |
| ) | |
| func sixDigits() int64 { | |
| max := big.NewInt(999999) |
| // Implementation in ES6 | |
| function pagination(c, m) { | |
| var current = c, | |
| last = m, | |
| delta = 2, | |
| left = current - delta, | |
| right = current + delta + 1, | |
| range = [], | |
| rangeWithDots = [], | |
| l; |
| How to Completely Remove Android Studio | |
| Execute these commands from the terminal | |
| rm -Rf /Applications/Android\ Studio.app | |
| rm -Rf ~/Library/Preferences/AndroidStudio* | |
| rm ~/Library/Preferences/com.google.android.studio.plist | |
| rm -Rf ~/Library/Application\ Support/AndroidStudio* | |
| rm -Rf ~/Library/Logs/AndroidStudio* |