npm list -g --depth=0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript Document | |
//adiciona mascara de cnpj | |
function MascaraCNPJ(cnpj){ | |
if(mascaraInteiro(cnpj)==false){ | |
event.returnValue = false; | |
} | |
return formataCampo(cnpj, '00.000.000/0000-00', event); | |
} | |
//adiciona mascara de cep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example to use list comprehensions with python, the pythonic mode. | |
def double_of_odds(list): | |
return [x*2 for x in list if x%2] | |
list = [1,2,3,4,5,6,7,8,9,10] | |
double_of_odds(list) | |
# out: [2, 6, 10, 14, 18] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dict comprehensions | |
list = [1,2,3,4,5,6,7,8,9,10] | |
doubles_of_odds_dict = {'number_'+str(i):i*2 for i in list if i%2} | |
doubles_of_odds_dict | |
# out: {'number_1': 2, 'number_3': 6, 'number_5': 10, 'number_7': 14, 'number_9': 18} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
show_name_and_age(*args, **kwargs): | |
for name in args: | |
print('My name is: {}'.format(name)) | |
for name in kwargs.keys(): | |
print('{} has {} years old.'.format(name, kwargs[name])) | |
show_name_and_age('Josh', 'Hannah', Josh=19, Hannah=26) | |
# out | |
# My name is: Josh | |
# My name is: Hannah | |
# Hannah has 26 years old. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# === EDITOR === | |
Pry.editor = 'vim' | |
# == Pry-Nav - Using pry as a debugger == | |
Pry.commands.alias_command 'c', 'continue' rescue nil | |
Pry.commands.alias_command 's', 'step' rescue nil | |
Pry.commands.alias_command 'n', 'next' rescue nil | |
Pry.commands.alias_command 'r!', 'reload!' rescue nil | |
Pry.config.color = true |
Escolhi tratar sobre esse assunto hoje simplesmente porque foi uma das primeiras coisas que me perguntei "como eu faço isso?" no mundo ruby. Acredito que muita gente se pergunte a mesma coisa e espero que eu possa ajudar em algo para elas. 😀
Bem, se você é um programador java, você chama sua gem de jar, se você é um programador C#, você chama de dll. Resumindo, é uma lib, uma biblioteca contendo códigos que você pode reaproveitar importando em outros projetos.
E usar gems no ruby é muito fácil, se você já deu uma brincada com rails por exemplo, é só você adicionar o código gem 'nome_da_gem'
no arquivo Gemfile
que está no root, depois executar o comando bundle install
para baixar sua gem do repositório e pronto, só sair usando a biblioteca!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* angucomplete-alt | |
* Autocomplete directive for AngularJS | |
* This is a fork of Daryl Rowland's angucomplete with some extra features. | |
* By Hidenari Nozaki | |
*/ | |
/*! Copyright (c) 2014 Hidenari Nozaki and contributors | Licensed under the MIT license */ | |
(function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Simple AngularJS App</title> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script> | |
<script src="app.js"></script> | |
</head> | |
<body ng-app="nameApp"> | |
<div ng-controller="NameCtrl" class="container"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://docs.docker.com/install/linux/docker-ce/ubuntu/ | |
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
sudo apt-get update | |
sudo apt-get install docker-ce | |
# https://docs.docker.com/compose/install/ |