ActiveRecord cheat sheet / EXAMPLES
$ gem install activerecord in GEMFILE: gem ‘activerecord’
require ‘active_record’
package main | |
import ( | |
"bytes" | |
"compress/gzip" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
"path/filepath" |
Total 54 (delta 6), reused 52 (delta 6) | |
-----> Go app detected | |
-----> Installing go1.2... done | |
-----> Running: godep go install -tags heroku ./... | |
-----> Discovering process types | |
Procfile declares types -> web | |
-----> Compiled slug size is 1.9M | |
-----> Building Docker image | |
remote: Sending build context to Docker daemon 2.079 MB |
#!/bin/bash | |
# Create an Iframe index from HLS segmented streams | |
# $1: Filename to be created | |
# $2: Location of segmented ts files | |
# Check how many arguments | |
if [ $# != 2 ]; then | |
echo "Usage: $0 [Input filename] [Location of segmented streams]" | |
exit 1; | |
fi |
# _/Users/fabrizio/workspace/stackoverflow | |
./struct_test.go:19: &Country literal escapes to heap | |
./struct_test.go:13: BenchmarkMapPointer b does not escape | |
./struct_test.go:15: BenchmarkMapPointer make(map[string]*Country, 0) does not escape | |
./struct_test.go:32: BenchmarkMapNoPointer b does not escape | |
./struct_test.go:34: BenchmarkMapNoPointer make(map[string]Country, 0) does not escape | |
./struct_test.go:63: &BigCountry literal escapes to heap | |
./struct_test.go:57: BenchmarkMapBigStructPointer b does not escape | |
./struct_test.go:59: BenchmarkMapBigStructPointer make(map[string]*BigCountry, 0) does not escape | |
./struct_test.go:76: BenchmarkMapBigStructNoPointer b does not escape |
// Default HTTP handler | |
type Handler func(ctx *Context, w http.ResponseWriter, r *http.Request) error | |
// ServeHTTP implements http.Handler for our custom type Handler | |
func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |
ctx = NewContext(r) | |
defer ctx.Cancel() | |
err := h(ctx, w, r) |
/* | |
* This is an example provided by Facebook are for non-commercial testing and | |
* evaluation purposes only. | |
* | |
* Facebook reserves all rights not expressly granted. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | |
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
12 17 26 43 48 24 | |
5 7 24 31 39 7 | |
2 3 13 16 35 27 | |
44 45 47 50 51 8 | |
10 16 18 29 45 19 | |
17 22 30 46 56 16 | |
18 21 25 28 29 16 | |
2 22 32 45 56 12 | |
4 12 14 21 55 7 | |
6 8 43 48 50 7 |