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 | |
| type Box interface { | |
| Width() int | |
| } | |
| type Square struct { | |
| w int | |
| } |
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 ( | |
| "bufio" | |
| "fmt" | |
| "os" | |
| "time" | |
| ) | |
| /* simple go app showing the use of a buffered writer */ |
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 'net/http' | |
| require 'net/https' | |
| class Woot | |
| def foo | |
| uri = URI.parse("https://www.google.fr/?q=example") | |
| https = Net::HTTP.new(uri.host,uri.port) | |
| https.use_ssl = true | |
| req = Net::HTTP::Get.new(uri.path) | |
| res = https.request(req) |
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 'rubygems' | |
| require './post' | |
| run Sinatra::Application |
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 ( | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "os" | |
| "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
| package main | |
| import ( | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "os" | |
| ) | |
| func handler(w http.ResponseWriter, r *http.Request) { |
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
| find . -type f -name "*.go" -exec chmod a-x {} + |
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
| #!/bin/sh | |
| DIR="$(basename $(PWD))" | |
| DIR="${DIR/-/_}" | |
| if [ "$1" == "execute" ] | |
| then | |
| if [ ! -f 'dump.db' ] | |
| then | |
| echo "downloading backup" | |
| curl `heroku pgbackups:url` > dump.db |
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
| def parse_phone(string) | |
| (Phoner::Phone.parse(string) || Phoner::Phone.parse('+' + string) rescue 'failed') | |
| end | |
| def verify_phones | |
| CSV.generate do |csv| | |
| Trip.all.each do |t| | |
| csv << [t.mobile, parse_phone(t.mobile)] | |
| end | |
| end |
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 'openssl' | |
| require 'base64' | |
| # Generate with this: OpenSSL::Cipher::Cipher.new("des-ede-cbc").tap{|c| c.encrypt}.random_key | |
| key = "\xBEB\xBA;\xA5\xEA-\x1A4\x0E8\xAC\x13\xF1s9\xB2\x87\xD3D\x9A\xC2\xA8\xC7" | |
| def encrypt(message, key) | |
| des_cbc=OpenSSL::Cipher::Cipher.new("des-ede-cbc") | |
| des_cbc.encrypt |
OlderNewer