Skip to content

Instantly share code, notes, and snippets.

View webarthur's full-sized avatar
✌️

Arthur Ronconi webarthur

✌️
View GitHub Profile
@webarthur
webarthur / install-docker.sh
Last active June 12, 2017 20:09
Debian - install docker in Debian Stratch
apt-get update
apt-get upgrade
# CA certificates
apt-get install apt-transport-https ca-certificates dirmngr -y
# public key
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# repo
$ sudo npm install -g cordova
$ cordova create <folder>
$ cordova platform add browser
$ cordova plugin add cordova-plugin-browsersync
$ cordova run -- --live-reload
# update platforms/android/project-properties
target=android-17
# create ~/.bash_profile
// install
sudo npm install -g webdriver-manager
// update webdriver
sudo webdriver-manager update
// run selenium
webdriver-manager start --standalone
// copy drivers to PATH
@webarthur
webarthur / Date.isValid.js
Last active February 24, 2017 01:59
Ideal.js
// from Ideal.js (https://github.com/webarthur/ideal.js/blob/master/src/Date.isValid.js)
Date.isValid = function (s) {
var l = s.length
var j = 0
var dt = { 0: '', 1:'', 2:'' }
// dias de cada mês
var n = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
// divide a data para o objeto "dt"
@webarthur
webarthur / init.coffee
Created February 23, 2017 20:09
Atom author comment (Ctrl + Shift + E)
# init.coffee
atom.commands.add 'atom-text-editor', 'webarthur:comment', ->
return unless editor = atom.workspace.getActiveTextEditor()
selection = editor.getLastSelection()
selection.insertText('// Arthur Araújo ' + new Date().toLocaleDateString() + ' ')
# keymap.cson
'atom-workspace atom-text-editor:not([mini])':
'ctrl-e': 'editor:toggle-line-comments'
// from Ideal.js (https://github.com/webarthur/ideal.js)
window.location.getQueryParams = function(query) {
// se o parâmetro query não foi definido pega o parâmetro da URL
if (!query) {
query = window.location.search.substring(1)
}
var l = query.length
var q = {} // objeto a ser retornado
// from Ideal.js (https://github.com/webarthur/ideal.js)
window.location.getQueryParam = function(name, query) {
// se o parâmetro query não foi definido pega o parâmetro da URL
if (!query) {
query = window.location.search
}
var l = query.length
var n = '' // nome
@webarthur
webarthur / limpar-linux.sh
Created February 22, 2017 23:57
Elimina pacotes, dependências e bibliotecas sem uso no Ubuntu
# A partir da versão 12.04 - remover todos os kernels de versões antigas sem uso
# Elimina arquivos antigos (incluindo kernels).
sudo apt-get autoclean
# Elimina tudo o que foi baixado e guardado no diretório de cache do apt
sudo apt-get clean
# Procura por pacotes, dependências e bibliotecas sem uso e remove caso necessário
sudo apt-get autoremove
@webarthur
webarthur / is_cpf.js
Created February 22, 2017 01:20
Valida CNPJ - Função em JavaScript
function is_cpf (c) {
if((c = c.replace(/[^\d]/g,"")).length != 11)
return false;
if (c == "00000000000")
return false;
var r;
var s = 0;
@webarthur
webarthur / install-nodejs.sh
Created February 12, 2017 15:00
Instação do node js via PPA para Ubuntu
cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
// opicional
sudo apt-get install build-essential
// fonte: https://www.digitalocean.com/community/tutorials/como-instalar-o-node-js-no-ubuntu-16-04-pt