Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
func main() {
x := []byte(`{
"hash":"123456",
"order":123456
}`)
x2 := []byte(`{
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 June 7, 2017 20:50
Some PG commands
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;
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
package main
import (
"bufio"
"fmt"
"log"
"os"
"strconv"
"strings"
)
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
@gerep
gerep / stdin.go
Last active February 23, 2017 19:50
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.
package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
package main
import (
"fmt"
"log"
"net/http"
"html/template"
"github.com/gorilla/sessions"
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