Skip to content

Instantly share code, notes, and snippets.

View acauamontiel's full-sized avatar

Acauã Montiel acauamontiel

View GitHub Profile
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="old@email.com"
CORRECT_NAME="Correct Name"
CORRECT_EMAIL="correct@email.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
/*
* requestAnimationFrame pollyfill
*/
if (!window.requestAnimationFrame) {
window.requestAnimationFrame = (window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (callback) {
return window.setTimeout(callback, 1000 / 60);
});
}
/*!
$file = '.\fileName.lst' # Caminho relativo do arquivo
$oldName = 'Old Name' # Nome a ser alterado
$newName = Read-Host 'Novo nome'
(gc $file).replace($oldName, $newName) | sc $file
@acauamontiel
acauamontiel / index.js
Created July 31, 2014 19:32
Simple server example with Hapi.js and Express.js
/////////////////////////
// Running //
// node . hapi|express //
/////////////////////////
var Example = {
hapi: function () {
var Hapi = require('hapi'),
server = new Hapi.Server('localhost', 8000);
@acauamontiel
acauamontiel / problem1.js
Created July 24, 2014 12:37
Project Euler problems solved using JavaScript
/*
* Problem 1
* http://projecteuler.net/problem=1
*/
for (var i = sum = 0; i < 1000; i++)
if ((i % 3) === 0 || (i % 5) === 0) sum += i;
console.log(sum);
@acauamontiel
acauamontiel / Math-between.js
Last active August 29, 2015 14:03
Useful mathematical methods
/**
* The Math.between() function returns only numbers between the smallest and largest number
* @example
* // returns 2
* Math.between(2, 1, 3);
* @example
* //returns 3
* Math.between(4, 1, 3);
* @example
* //returns 1
@acauamontiel
acauamontiel / mixins.styl
Last active May 5, 2018 12:28
Useful mixins for Stylus
/*
* Clearfix
*/
clearfix()
&:before,
&:after
content ' '
display table
&:after
@acauamontiel
acauamontiel / Default (OSX).sublime-keymap
Last active December 27, 2020 20:32
Sublime Text Configuration
[
{ "keys": ["shift+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
@acauamontiel
acauamontiel / Email
Last active December 31, 2015 11:19
Regex Snippets
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i