Skip to content

Instantly share code, notes, and snippets.

View compare-bytes.go
package main
import "fmt"
func main() {
x := []byte(`{
"hash":"123456",
"order":123456
}`)
x2 := []byte(`{
View calculate.go
newPrice = fmt.Sprintf("%.2f", (current.Price*c.DiscountValue)/100)
current.NewPrice, err = strconv.ParseFloat(newPrice, 64)
if err != nil {
current.Message = "Ocorreu um erro ao calcular o novo valor deste produto: " + err.Error()
}
@gerep
gerep / pg.txt
Created Jun 7, 2017
Some PG commands
View pg.txt
Last Vaccum: select * from pg_stat_all_tables;
Dead tuples: select relname, n_dead_tup, last_vacuum, last_autovacuum from pg_catalog.pg_stat_all_tables where n_dead_tup > 0 and relname = 'precificacao_campanha' order by n_dead_tup desc;
Run Vaccum: VACUUM FULL VERBOSE precificacao;
set search_path to pricing;
View insertion-sort-1.go
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
View triplets.go
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
@gerep
gerep / stdin.go
Last active Feb 23, 2017
Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.
View stdin.go
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
View server.go
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
View production.rb
config.action_mailer.default_url_options = { host: 'domain.com.br' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default charse: 'utf-8'
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587, # ports 587 and 2525 are also supported with STARTTLS
:enable_starttls_auto => false, # detects and uses STARTTLS