Skip to content

Instantly share code, notes, and snippets.

@kafeltz
kafeltz / get-npm-package-version
Created July 15, 2016 20:13 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@kafeltz
kafeltz / txt
Last active October 22, 2017 15:25
Fix ubuntu ć
Open the file: /etc/environment
Append this line: GTK_IM_MODULE=cedilla QT_IM_MODULE=cedilla
Restart the computer.
https://askubuntu.com/questions/363115/how-to-type-latin-small-letter-c-with-cedilla
@kafeltz
kafeltz / gist:cc1ccb82bc0301f6ef7f72cf01221cb1
Created August 23, 2019 14:03
Procedimento pra migrar do Mercurial pro Git
Criar o dockerfile abaixo
-----------------------------------------------------------
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y \
&& apt-get install ssh -y \
&& apt-get install mercurial -y \
&& apt-get install git -y
@kafeltz
kafeltz / .bashrc
Last active March 15, 2020 22:15
bash_profile
alias ll='ls -lah -G'
alias gt='git status'
alias gd='git diff'
alias gb='git branch'
alias gla='git log --decorate --all --graph --stat'
alias gl='git log --decorate --graph --stat'
alias gf='git fetch --all'
export PATH="$(yarn global bin):$PATH"
export PATH=$PATH:/usr/local/go/bin
@kafeltz
kafeltz / Convert float to string
Last active November 20, 2022 15:48
Solução brutalmente simples pra formatar moeda brasileira (BRL) de float pra string. Sem framework ou lib. Altere conforme a necessidade.
// http://blog.tompawlak.org/number-currency-formatting-javascript
// http://www.javascripter.net/faq/tofixed.htm
function _format(num)
{
return num.toFixed(2).replace(".", ",").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.");
}