Here's the simplest example showing how to do functional options in Golang.
They're a great way to enable users to set options and ease adding new options later.
package main
import (
"flag"
"fmt"| func CreatePDFFromHTML(inputHTML []byte) ([]byte, error) { | |
| dirName, err := ioutil.TempDir("", "pdf-generator") | |
| if err != nil { | |
| return nil, err | |
| } | |
| // remove this and log the dirName if you need to debug the HTML | |
| defer os.RemoveAll(dirName) | |
| // log.Println(dirName) |
| function nSecToTime(s) { | |
| let seconds = s | |
| s = Math.abs(s) | |
| let t = [0, 0, 0] | |
| let r = s % 3600 | |
| t[0] = Math.floor(s / 3600) | |
| t[1] = Math.floor(r / 60) | |
| r = r % 60 |
| package main | |
| import ( | |
| "encoding/csv" | |
| "image/color" | |
| "os" | |
| "sort" | |
| "strconv" | |
| "gonum.org/v1/plot" |
| package main | |
| import ( | |
| "sync" | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| lock := sync.Mutex{} |
| // Tensorflow Serving Go client for the inception model | |
| // go get github.com/golang/protobuf/ptypes/wrappers google.golang.org/grpc | |
| // | |
| // Compile the proto files: | |
| // | |
| // git clone https://github.com/tensorflow/serving.git | |
| // git clone https://github.com/tensorflow/tensorflow.git | |
| // | |
| // mkdir -p vendor |
Here's the simplest example showing how to do functional options in Golang.
They're a great way to enable users to set options and ease adding new options later.
package main
import (
"flag"
"fmt"| # Official framework image. Look for the different tagged releases at: | |
| # https://hub.docker.com/r/library/node/tags/ | |
| image: node:6 | |
| before_script: | |
| - npm install | |
| # This folder is cached between builds | |
| # http://docs.gitlab.com/ce/ci/yaml/README.html#cache | |
| cache: |
| quicksort :: (Ord a) => [a] -> [a] | |
| quicksort [] = [] | |
| quicksort (x:xs) = | |
| let smallerSorted = quicksort (filter (<=x) xs) | |
| biggerSorted = quicksort (filter (>x) xs) | |
| in smallerSorted ++ [x] ++ biggerSorted |
| package main | |
| import ( | |
| "bytes" | |
| "encoding/json" | |
| "fmt" | |
| "strconv" | |
| ) | |
| func main() { |
| var mongodb = require("mongodb"); | |
| var MongoClient = mongodb.MongoClient; | |
| var fs = require("fs"); | |
| var Transform = require("stream").Transform; | |
| var name_surname_email_filter = new Transform({readableObjectMode:true, writableObjectMode:true} ); | |
| name_surname_email_filter._transform = function(data, enc, cb) { | |
| //console.log(data); | |
| var newdata = { first_name: data.first_name, |