This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Installation | |
| # ============ | |
| # Installation of Ubuntu Server is automated by | |
| # 'preseeding' configuration options with the values expected for vagrant. | |
| # Clock and Timezone | |
| # ------------------ | |
| # ### Hardware Clock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "net/http" | |
| ) | |
| func main() { | |
| http.Handle("/", http.FileServer(http.Dir("public"))) | |
| log.Println("About to start the server on port 8014") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "active_support" | |
| require "active_support/key_generator" | |
| require "json" | |
| # Based on https://gist.github.com/mattetti/7624413 | |
| module JsonSessionSerializer | |
| def self.load(value) | |
| begin | |
| JSON.parse(value) | |
| rescue JSON::ParserError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Hack to change the Rails cookie serializer from Marshal to JSON and therefore allow the session | |
| # to be shared between different languages but also avoid that someone knowing the | |
| # cookie secret key could execute arbitrary code on the server by unmarshalling | |
| # modified Ruby code added to the session/permanent cookie. | |
| # | |
| # Note that all users will beed to login again since both the remember me cookie and the session cookies | |
| # won't be valid. Note also that the remember me cookie is tested multiple times per request even when it fails. | |
| # for performance reasons you might want to delete it if these extra cycles are too costly for you. | |
| # | |
| # Rails 4 (not tested on Rails 3). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ go test -cover fmt | |
| # testmain | |
| /var/folders/cw/ybbv7rqj16b5jxr5k69zq7xw0000gn/T/go-build683876954/fmt/_test/_testmain.go:142: undefined: testing.CoverBlock | |
| /var/folders/cw/ybbv7rqj16b5jxr5k69zq7xw0000gn/T/go-build683876954/fmt/_test/_testmain.go:168: undefined: testing.CoverBlock | |
| /var/folders/cw/ybbv7rqj16b5jxr5k69zq7xw0000gn/T/go-build683876954/fmt/_test/_testmain.go:170: undefined: testing.CoverBlock | |
| /var/folders/cw/ybbv7rqj16b5jxr5k69zq7xw0000gn/T/go-build683876954/fmt/_test/_testmain.go:184: undefined: testing.RegisterCover | |
| /var/folders/cw/ybbv7rqj16b5jxr5k69zq7xw0000gn/T/go-build683876954/fmt/_test/_testmain.go:184: undefined: testing.Cover | |
| FAIL fmt [build failed] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| // import whatever is needed | |
| // define the types | |
| // skipped for this example | |
| func main() { | |
| var count int | |
| err := Db.Query(`SELECT count(id) FROM stuff`).Rows(&count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gems = [] | |
| `bundle list`.split("\n").each do |line| | |
| gem = line[/\*\s(.*)\s\(/, 1] | |
| gems << gem | |
| end | |
| `bundle exec ruby -e "puts Gem.path"`.split("\n").each do |path| | |
| gems.each do |gem| | |
| licenses = Dir.glob("#{path}/gems/#{gem}*/LICEN*") | |
| if licenses.empty? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package models | |
| import ( | |
| "bitbucket.org/splice/splice_go/splice/logger" | |
| "time" | |
| ) | |
| type DbTime struct { | |
| String string | |
| Time time.Time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To run this code, start create a MySQL DB named "jet-mysql-repro" | |
| // and edit the setupDB variables to use the right connection settings. | |
| package main | |
| import ( | |
| "fmt" | |
| "github.com/eaigner/jet" | |
| _ "github.com/go-sql-driver/mysql" | |
| "log" | |
| "time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Signal.trap("SIGINT"){ puts " Ciao!"; exit } | |
| task :default => :test | |
| desc "Compile the app" | |
| task :compile do | |
| run_cmd "go build -ldflags \"-X main.Build #{short_sha1}\" <replace with path to app>" | |
| end | |
| desc "Cross compile the app and dump the binaries in the binaries submodule" |