Skip to content

Instantly share code, notes, and snippets.

View jeffdrumgod's full-sized avatar

Jefferson Rafael Kozerski jeffdrumgod

View GitHub Profile
@jeffdrumgod
jeffdrumgod / js_icons_Shares.js
Last active August 29, 2015 14:00
Base de funções para share icons
// https://gist.github.com/jeffdrumgod/11414145
var Shares_custom = new function() {
this.updateUrl = function(url){
if(url){
share_url = url;
}else{
share_url = location.href;
}
return encodeURIComponent(this.share_url);
@jeffdrumgod
jeffdrumgod / returnStateName.js
Created July 4, 2014 18:45
Retorna nome do Estado ao passar sigla para a função
// https://gist.github.com/jeffdrumgod/b9c074ad5bc9aa0e94e0
function returnStateName(state){
var states = [ 'AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA', 'MT', 'MS', 'MG', 'PA', 'PB', 'PR', 'PE', 'PI', 'RJ', 'RN', 'RS', 'RO', 'RR', 'SC', 'SP', 'SE', 'TO'],
statesNames = ["Acre", "Alagoas", "Amapá", "Amazonas", "Bahia", "Ceará", "Distrito Federal", "Espirito Santo", "Goiás", "Maranhão", "Mato Grosso", "Mato Grosso do Sul", "Minas Gerais", "Pará", "Paraíba", "Paraná", "Pernambuco", "Piauí", "Rio de Janeiro", "Rio Grande do Norte", "Rio Grande do Sul", "Rondônia", "Roraima", "Santa Catarina", "São Paulo", "Sergipe", "Tocantins"],
position = states.indexOf(state.toUpperCase());
if(position > -1){
return statesNames[position];
}
}
#!/bin/bash
# Download all VMWare Fusion machines from Modern.IE Website to test your Website/Web Application in Microsoft Internet Explorer on Mac OSX. All VM's and other VM's for Windows and Linux and other Virtual Manager's such as VirtualBox can be found at http://modern.ie/
# Don't have cURL or want to learn more, visit http://curl.haxx.se/.. are you really a Developer? First part of that sentence comes from the MS site.
read -p "--> Downloading Internet Explorer 6-10 on Windows XP/7/8 Appliances for VMWare Fusion. Large downloads ahead. (Press Enter to continue)."
echo "--> Download Internet Explorer 6 on Microsoft Windows XP Appliance for VMWare Fusion."
curl --progress-bar -O "http://virtualization.modern.ie/vhd/IEKitV1_Final/VMWare_Fusion/IE6_XP/IE6.XP.For.MacVMware.sfx"
echo "--> Download Internet Explorer 8 on Microsoft Windows XP Appliance for VMWare Fusion."
jQuery.validator.addMethod("cnpj", function (cnpj, element) {
cnpj = jQuery.trim(cnpj);
// DEIXA APENAS OS NÚMEROS
cnpj = cnpj.replace('/', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('-', '');
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
/*
Var cores exemplo está localizado em: https://docs.google.com/spreadsheets/d/1Uswq4e7GerdcI--K0z0EmLKKTegkDNgUNgr9x-XNRMU
Na célula D1 existe o objeto JSON gerado para utilizar.
Como usar este gist:
1) Copiar o conteúdo da célula.
2) Executar no console do navegador, como Firebug, ou Chrome Develper Tools.
3) Após executar o passo dois, copiar o conteúdo abaixo deste comentário e executar no console do navegador.
4) Após executar o passo três, o conteúdo da página em questão será gerado o conteúdo do arquivo .css será forçado o download em seu browser com nome 'store-colors.css'
*/
@jeffdrumgod
jeffdrumgod / cpf_validate.js
Created July 2, 2015 00:20
cpf validation
function cpf_validate(value){
value = value.replace(/[^\d]+/g,'');
if(value === '') return false;
// Elimina CPFs invalidos conhecidos
if (value.length != 11 ||
value == "00000000000" ||
value == "11111111111" ||
value == "22222222222" ||
value == "33333333333" ||
value == "44444444444" ||
@jeffdrumgod
jeffdrumgod / cnpj_validate.js
Created July 2, 2015 00:24
cpnj validation
function cpnj_validate(value){
value = value.replace('.','');
value = value.replace('.','');
value = value.replace('.','');
value = value.replace('-','');
value = value.replace('/','');
var cnpj = value;
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
digitos_iguais = 1;
if (cnpj.length < 14 && cnpj.length < 15)
@jeffdrumgod
jeffdrumgod / gist:158daac41eabf6b612ce
Last active August 29, 2015 14:27 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@jeffdrumgod
jeffdrumgod / test.txt
Created May 16, 2012 02:50
teste: teste
test
@jeffdrumgod
jeffdrumgod / _pems.scss
Created November 3, 2012 14:52 — forked from arielsalminen/_pems.scss
PX to EMs conversion in Sass
/* See http://mrdanadams.com/2012/pixel-ems-css-conversion-sass-mixin/ */
/* Default font size in pixels if not overridden. */
$baseFontSize: 16;
/* Convert PX units to EMs.
Ex: margin-right: pem(16);
*/
@function pem($pxval, $base: $baseFontSize) {
@return #{$pxval / $base}em;