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 / tomcat-tool.sh
Created September 5, 2014 23:01
Tool to start dynamically tomcat
#!/bin/bash
# limpa a pasta antiga
rm -rf ~/Sites/apache-tomcat-6.0.37/work/Catalina/localhost/
FOLDER=$(pwd)
LocalHostFolder="~/Sites/apache-tomcat-6.0.37/conf/Catalina/localhost/"
ROOTFile=$LocalHostFolder"ROOT.xml"
XMLTemplate="<Context docBase=\"$FOLDER/web\" path=\"\">
</Context>"
@egermano
egermano / parsley-cpf.js
Created September 4, 2014 22:22
Parsley CPF validator
window.ParsleyConfig = {
validators: {
cpf: {
fn : function ( val, req) {
val = $.trim(val);
val = val.replace('.','');
val = val.replace('.','');
cpf = val.replace('-','');
while(cpf.length < 11) cpf = "0"+ cpf;
@egermano
egermano / YT-tracker.html
Created August 25, 2014 21:53
GTM Youtube Tracker
<script src="//www.youtube.com/player_api"></script>
<script type="text/javascript">
// attach our YT listener once the API is loaded
//
var $ = jQuery;
// listen for play/pause, other states such as rewind and end could also be added
// also report % played every second
function onPlayerStateChange(e) {
// e["data"] == YT.PlayerState.PLAYING && ;
@egermano
egermano / check-cpf.js
Created August 19, 2014 21:47
Validate CPF
function checkCPF( val ) {
val = $.trim(val);
val = val.replace('.','');
val = val.replace('.','');
cpf = val.replace('-','');
while(cpf.length < 11) cpf = "0"+ cpf;
var expReg = /^0+$|^1+$|^2+$|^3+$|^4+$|^5+$|^6+$|^7+$|^8+$|^9+$/;
var a = [];
var b = new Number;
@egermano
egermano / Default (OSX).sublime-keymap
Created May 27, 2014 19:04
HTML Entities Key bind for Sublime Text 2
{"keys": ["super+shift+h"], "command": "encode_html_entities"}
@egermano
egermano / _placehoder.scss
Created May 19, 2014 15:42
Input Placeholder Compass Mixin
@mixin placeholder() {
&::-webkit-input-placeholder {
@content;
}
&:-moz-placeholder {
@content;
}
&::-moz-placeholder {
@egermano
egermano / ytevents.js
Created May 13, 2014 14:38
YT Embed API events implements
var thePlayer = new YT.Player('yt-embed', {
height: '360',
width: '540',
videoId: 'bScJ8bbwMNM',
events: {
'onStateChange': function(e){
switch (e.data) {
case YT.PlayerState.ENDED:
clearWatcherVideo();
break;
@egermano
egermano / chosen.js
Last active December 29, 2015 18:39
Chosen Directive for AngularJS
angular.module('myApp')
.directive('chosen',function(){
'use strict';
var linker = function(scope, element, attrs) {
var config = scope.$eval(attrs['chosen']),
list = attrs['chosenCollection'];
_.extend(config, {inherit_select_classes: true});
@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>