Skip to content

Instantly share code, notes, and snippets.

View egermano's full-sized avatar
🏠
Working from home

Bruno Germano egermano

🏠
Working from home
View GitHub Profile
@egermano
egermano / ie-fix.js
Created November 26, 2013 22:05
ECMA Script fixes for IE
'use strict';
// Add ECMA262-5 method binding if not supported natively
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
@egermano
egermano / README.md
Last active December 15, 2017 01:59
Align Directive for AngularJS

Align

Align a element base on multiples values, like a, top, bottom, middle, right, left and center.

Usage

<div class="recipes clearfix" align="middle center" align-watch="recipes">
    ...
</div>
@egermano
egermano / README.md
Last active December 28, 2015 05:39
Responsive Hide, for AngularJS

Responsive Hide.

Hide a element based on a breakpoint.

Usage

 <div class="recipe" ng-repeat="(index, recipe) in recipes" responsive-hide="{{ (288 * (index+1)) }}" responsive-hide-watch="recipes">
      ...
 </div>
@egermano
egermano / gist:7240614
Created October 30, 2013 21:28
Validação de digitação de campos de texto. Valida apenas letras, números, undescore, ífen, ponto, um arroba seguido e um espaço seguido.
$('#form-email').unbind('keypress.pogMask').bind('keypress.pogMask', function(e){
return !!String.fromCharCode(e.keyCode).match(/^[a-z0-9_@\-\. ]+$/gi);
}).unbind('keyup.pogMask').bind('keyup.pogMask', function(){
$(this).val($(this).val().replace(/@{2,}/g, '@'));
$(this).val($(this).val().replace(/\s{2,}/g, ' '));
});
@egermano
egermano / gist:7240592
Created October 30, 2013 21:27
Validação de digitação de campos de texto. Valida apenas letras e um espaço seguido.
$('#form-name, #form-surname').unbind('keypress.pogMask').bind('keypress.pogMask', function(e){
return !!String.fromCharCode(e.keyCode).match(/^[a-z ]+$/gi);
}).unbind('keyup.pogMask').bind('keyup.pogMask', function(){
$(this).val($(this).val().replace(/\s{2,}/g, ' '));
});
@egermano
egermano / pre-commit
Created July 24, 2013 16:48
geocommit save my geoloxalization ever commit
#!/usr/bin/env ruby
require 'socket'
=begin
Current workflow...
Geomit opens (TCP Server loads)
Pre-commit hook triggers
Pre-commit opens CWD/contributors.geojson
if something
Pre-commit hook sends CWD/contributors.geojson and hangs
@egermano
egermano / jQuery.validator.cpf.js
Created June 20, 2013 19:28
Validator Algorithm for jQuery Validator Plugin
//validação do formulario
jQuery.validator.addMethod("cpf", function(value, element) {
log("jquery.validator CPF", value);
var cpf = value.replace(/\./g,'').replace(/\-/,'');
var numeros, digitos, soma, i, resultado, digitos_iguais;
digitos_iguais = 1;
if (cpf.length < 11)
@egermano
egermano / pre-commit.sound
Created June 20, 2013 15:43
git commit sound
#!/bin/sh
afplay -v 0.1 /System/Library/Sounds/Tink.aiff > /dev/null 2>&1
@egermano
egermano / post-commit.sound
Created June 20, 2013 15:40
Play sound on commit
#!/bin/sh
afplay -v 0.1 /System/Library/Sounds/Pop.aiff > /dev/null 2>&1
@egermano
egermano / pre-push
Last active December 18, 2015 03:08
Solicitação de Deploy por ftp... Abre o Trasnmit...
#!/bin/sh
terminal-notifier -message "Pra abrir o Transmit para fazer é só clicar aqui!" -title "Vai fazer deploy?" -group 1911 -execute "open /Applications/Transmit.app/"