Skip to content

Instantly share code, notes, and snippets.

View YurePereira's full-sized avatar
😀
Out sick

Yure Pereira YurePereira

😀
Out sick
View GitHub Profile
@YurePereira
YurePereira / mymodal.js
Created December 19, 2016 14:55
Modal with bootstrap
var MyModal = (function() {
var alert = function(options) {
var modalConfirm = $('#modal_alert'),
titleModal = modalConfirm.find('.title-modal')
messageModal = modalConfirm.find('.message-modal'),
buttonOk = modalConfirm.find('.model-button-ok');
titleModal.text(options.title);
@YurePereira
YurePereira / hexa_html_to_decimal.php
Created October 6, 2016 15:43
Converte código HTML hexadecimal para decimal.
/**
* Converte código HTML hexadecimal para decimal.
*
* @param $code String código HTML hexadecimal.
*
* @return Array
*/
function hexaHtmlToDecimal($code) {
if (strlen($code) == 7) {
@YurePereira
YurePereira / loading_image.js
Last active March 7, 2017 19:22
Loading process image
var j = jQuery.noConflict();
var loadingImage = (function ($) {
var loadImage = $('body img.load-image');
var configDefault = {
callbacks: {
show: function() {},
hide: function() {}
@YurePereira
YurePereira / foreign_key_mysql.sql
Last active September 28, 2016 20:06
Using Foreign Key with MySql and Constraint
-- Using Foreign Key with MySql and Constraint:
alter table <name_table>
add constraint <fk_name_constraint_1>
foreign key (<column_name_this_table>)
references <table_references> (<column_name_table_references>);
-- Not tested:
alter table <name_table>
add constraint <fk_name_constraint>
@YurePereira
YurePereira / validar_cnpj_remotamente.js
Created July 15, 2016 13:30
Validar CNPJ remotamente com jQuery Validation
//Adicionar validação do CNPJ.
function adicionarValidacaoCNPJ(valid) {
var cnpjEmpresa = $('#cliente_prop_cli_nr_cnpj_empresa');
cnpjEmpresa.rules('remove', 'remote');
if (valid) {
cnpjEmpresa.rules('add', {
/**
* Função para criar constantes no JavaScript (ECMAScript 5).
*
* @param name {string} nome da constante.
* @param value {*} valor da constante.
*
*/
function define(name, value) {
Object.defineProperty(window, name, {
@YurePereira
YurePereira / checked_input_check_with_attr_jquery.js
Last active June 19, 2019 14:52
Ways to check if an input Checkbox is checked
var myCheckbox = $('#my_checkbox:checked');
//Checando com o selector :checked
if (myCheckbox.val()) {
console.log('Checked!');
} else {
console.log('Not checked!');
}
@YurePereira
YurePereira / for_simple.js
Last active March 26, 2021 19:55
Formas de percorrer array's e objetos com Javascript e jQuery
//Um simples array com valores para se fazer uma média aritmética simples.
var mediaAritmetica = new Array(8, 7, 10, 9);// [8, 7, 10, 9]
//Percorrendo com laço FOR simples em Javascript puro:
for (var i = 0, l = mediaAritmetica.length; i < l; i++) {
console.log(mediaAritmetica[i]);
}
@denisson
denisson / Testando PHP com Cucumber.md
Last active November 3, 2016 14:34
Teste de aceitação, fitnesse, Cucumber, Capybara, Behat, Codeception

Hoje no trabalho eu decidi aprender a fazer testes de aceitação no projeto que eu estou trabalhando. Fiz uma pesquisa rápida sobre ferramentas e a primeira que encontrei foi uma tal de http://fitnesse.org/. Eu nunca tinha ouvido falar. Dei uma lida, mas não achei tão interessante. Foi quando eu lembrei do Cucumber e pesquisei no google "cucumber acceptance testing php".

A primeira página que veio foi http://matthewdaly.co.uk/blog/2012/11/03/testing-php-web-applications-with-cucumber/. Eu fiz uma leitura dinâmica e depois decidi preparar o ambiente na minha máquina e seguir o tutorial dele, porém já adaptando a um teste real que eu queria fazer no sistema de patrimônio: testar a inclusão de bens.

Instalei o ruby via http://rubyinstaller.org/, e comecei a seguir o tutorial. Fiz o Cucumber acessar a página de cadastro de bens, preencher o código de barras do bem e enviar os dados para cadastrar. Quando fiz isso, a primeira vez que eu executava o teste, ele passava, mas na segunda, não. Pois, o cod barra já ti

@ricardobarantini
ricardobarantini / README.md
Last active April 24, 2024 18:00
Hack para centralizar div do Bootstrap

Modo de usar

Bootstrap 3

Basta chamar a classe "centered" nas divs com a classe "col-lg-", "col-md-", "col-sm-" ou "col-xs-" (1-12).