Skip to content

Instantly share code, notes, and snippets.

View igorcosta's full-sized avatar
:octocat:
I may be slow to respond.

Igor Costa igorcosta

:octocat:
I may be slow to respond.
View GitHub Profile
@igorcosta
igorcosta / build_npm.sh
Created May 23, 2016 04:32
Auto increment version of npm and git tagging
#! /bin/bash
npm version patch
version=`git diff HEAD^..HEAD -- "$(git rev-parse --show-toplevel)"/package.json | grep '^\+.*version' | sed -s 's/[^0-9\.]//g'`
git add *;
git commit -m "Commit message"
if [ "$version" != "" ]; then
git tag -a "v$version" -m "`git log -1 --format=%s`"
echo "Created a new tag, v$version"
@igorcosta
igorcosta / fp_debugger.sh
Created September 3, 2015 18:21
Flash Player 11.2 Debugger for Firefox on Ubuntu
sudo apt-get install ia32-libs nspluginwrapper
sudo mkdir /usr/lib/flash-plugin/
wget http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_plugin_debug.i386.tar.gz
tar xzvf flashplayer_11_plugin_debug.i386.tar.gz
sudo cp libflashplayer.so /usr/lib/flash-plugin/
sudo chmod 775 /usr/lib/flash-plugin/libflashplayer.so
cd /usr/lib/mozilla/plugins
rm -rf npwrapper.libflashplayer.so # Not sure if this part is necessary or not
sudo ln -s /usr/lib/flash-plugin/libflashplayer.so .
sudo chmod 777 libflashplayer.so
@igorcosta
igorcosta / grunt for ubuntu
Created April 2, 2015 19:10
When grunt breaks on Ubuntu 14.x
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@igorcosta
igorcosta / designer.html
Last active August 29, 2015 14:08
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
<script type="text/javascript">
// First let's create an array of JavaScript Date
// objects.
// More info about the Date class:
// http://w3schools.com/js/js_obj_date.asp
var dates = [
new Date(2010, 4, 10, 10, 07, 16),
new Date(2010, 4, 8, 9, 16, 09),
new Date(2010, 3, 30, 0, 15, 49),
@igorcosta
igorcosta / deploy_bob_war
Last active August 29, 2015 14:05
Deploy bob war file to tomcat for linux users
function dpbob(){
BOB_DIR=/home/igorcosta/dev/bobportalpai
WEBAPPS_DIR=/home/igorcosta/bin/apache-tomcat-8.0.9/webapps
cd ${BOB_DIR}
git stash
git pull origin mock_server
echo "Pull do repositorio feito"
cd ${BOB_DIR}
mvn clean package
if [-d ${WEBAPPS_DIR}/bobportalapi ];then
@igorcosta
igorcosta / converter_images.bat
Created July 15, 2014 23:04
Convert Images from your Camera SD card into web size pictures for Windows Users
@echo off
echo To use you need imageMagick, you can find at http://www.imagemagick.org/
Set timefmt=%time%
Set timefmt=%TIMEFMT:~0,2%%TIMEFMT:~3,2%%TIMEFMT:~6,2%
Set timefmt=%TIMEFMT: =0%
Set diretorio=temp
Set /p inicio=Image range from:
Set /p fim=Imagem range to:
Set /p diretorio=Which directory, if you leave empty it will create automatically:
if NOT exist %diretorio% ( Set diretorio=%timefmt% mkdir %diretorio%) else (mkdir %diretorio%)
@igorcosta
igorcosta / url_validar
Created July 8, 2014 15:11
Regex para Validar URL
'^(http|https|ftp)\\://([a-zA-Z0-9\\.\\-]+(\\:[a-zA-Z0-9\\.&amp;%\\$\\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\?\\+&amp;%\\$#\\=~_\\-]+))*$
@igorcosta
igorcosta / clear_number_mask
Created June 27, 2014 18:21
Removing all chars from a masked input and considering only numbers
var str = value.replace(/[^0-9]+/g,'');
return str;
@igorcosta
igorcosta / cpf_cnpj_validator
Created June 26, 2014 19:13
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo