Skip to content

Instantly share code, notes, and snippets.

@m3nd3s
m3nd3s / NERDTree.mkd
Last active November 23, 2023 13:45
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
* Foco sidebar
** CTRL + 0
* Mostrar ou esconder barra
** CMD + K + B || CTRL + ALT + CMD +D
* Full screen
** CMD + CTRL + F
* Distraction free
@pzurek
pzurek / Twelve_Go_Best_Practices.md
Last active March 16, 2024 14:19
Twelve Go Best Practices
@paulopatto
paulopatto / README.md
Last active January 18, 2024 23:57
Converter taxa de cambio entre Moedas com Google SpreadSheet

Cotação de moedas com Planilhas do Google SpreadSheet

Hoje enquanto eu tentava criar minha calculadora de importação de produtos (com tributos, Taxa ilegal de processamento de encomendas internacionais e IOF). Com isso precisava de dados de conversão autmática de valores em Dollar americano para o Real brasileiro (USD -> BRL). A melhor solução que encontrei foi efetuar a pesquisa de cotação na url do google finance convert em https://www.google.com/finance/converter?a=1&from=USD&to=BRL. Bem tendo a url que nos retorna um documento HTML vamos pegar o dados com a função IMPORTXML

ImportXML(url; xpath query)

Importa dados de qualquer um dos vários tipos de dados estruturados, incluindo XML, HTML, CSV, TSV e XML de feeds RSS e Atom.

Com isso tenho o resultado como texto, ai tive de converter a planilha para formatação U.S.A para usar ponto como separador decimal e usar a formula de regex [0-9]*\.[0-9]+[0-9]+para extrair apenas o valor numérico. Minha formula completa

{
"snippets": [
{
"match": {"global": true, "pkgname": ".", "fn": ".*_test.go"},
"snippets": [
{"text": "func Test", "title": "", "value": "func Test${1:ObjectName}${2:TestName}(t *testing.T) {\n\t$0\n}"},
{"text": "func Benchmark", "title": "", "value": "func Benchmark${1:ObjectName}${2:BenchmarkName}(b *testing.B) {\n\n\tb.StopTimer()\n\n\t$0\n\n\tb.StartTimer()\n\n\tfor i := 0; i < b.N; i++ {\n\t\t\n\t}\n\n}"},
{"text": "func Example", "title": "", "value": "func Example${1:ObjectName}${2:ExampleName}() {\n\n\t$0\n\n\t// Output:\n\t// \n\n}"}
]
}
@todgru
todgru / elasticsearch-setup-apple-macbook-pro-m1.md
Created February 9, 2023 23:52
Install Elasticsearch 7.x on Apple Macbook Pro M1 Ventura 13.2

Elasticsearch Setup Apple MacBook Pro M1

Apple MacBook Pro M1, 32 GB, Ventura 13.2

Documentation based on comments in this Github Elasticsearch issue.

Install Homebrew