This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on: http://stackoverflow.com/a/17887889/529418 | |
// On Android I get the max 2.5M characters in localStorage (Strings in JavaScript are UTF-16). | |
var localStorageUsedSpace = function(){ | |
var allStrings = ''; | |
for(var key in window.localStorage){ | |
if(window.localStorage.hasOwnProperty(key)){ | |
allStrings += window.localStorage[key]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export PATH="$HOME/.rbenv/bin:$PATH" # Add rbenv to PATH | |
eval "$(rbenv init -)" # init rbenv to enable shims and autocompletion | |
###### | |
# | |
# Oh my gems! | |
# | |
export ORIG_GEM_PATH=${GEM_PATH:-} | |
export ORIG_GEM_HOME=${GEM_HOME:-} | |
export ORIG_PATH=${PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# controller action | |
def find_cep | |
begin | |
# Ex: ['Avenida', 'das Americas', 'Barra da Tijuca', 'Rio de Janeiro', 'RJ', 22640100] | |
address = BuscaEndereco.por_cep params[:cep] | |
street = "#{address.fetch(0)} #{address.fetch(1)}" | |
neighborhood = address.fetch(2) | |
city = address.fetch(3) | |
state = address.fetch(4) | |
data = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires | |
<% routes = Rails.application.routes.url_helpers %> | |
$(function () { | |
$('#place_postal_code').on('change', function() { | |
var $label = $('label[for=place_postal_code]'), | |
value = $(this).val(); | |
var onSuccess = function(r) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is basically the same Ryan Davis's script | |
# (http://blog.zenspider.com/blog/2012/09/ohmygems.html) with a bug fix and some | |
# modifications. | |
# | |
# This should be added after rbenv config lines on your .profile or .bashrc file. | |
# | |
export ORIG_GEM_PATH=${GEM_PATH:-} | |
export ORIG_GEM_HOME=${GEM_HOME:-} | |
export ORIG_PATH=${PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding : utf-8 -*- | |
# | |
# Rodrigo Soares Manhães, professor homenageado pelos formandos da turma de 2007 | |
# do curso de Ciência da Computação da UENF. | |
# | |
# 20/09/2012 | |
# | |
## | |
class Aluno < ActiveRecord::Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[color] | |
ui = auto | |
[alias] | |
br = branch | |
ci = commit | |
co = checkout | |
st = status | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
[diff] | |
external = /home/hugo/.config/git_meld_diff.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# a2pdf: Script to convert all kind of files in a directory to pdf | |
# | |
# Author: Hugo Maia Vieira <[email protected]> | |
# | |
# Dependencies: tree, cedilla, ps2pdf | |
# | |
# TODO: Separar em funções "concatenar", "converter" e "concatenar e converter" | |
# para poderem ser chamadas separadamente. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Verify it a website is back, or the internet access is back. When it is back, | |
# an alarm rings. | |
# | |
# Depends of ticktimer: https://github.com/algorich/ticktimer | |
# | |
# Author: Hugo Maia Vieira <[email protected]> | |
# | |
while : | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Salve este script no diretório /etc/cron.hourly e dê permissão | |
# de execução a ele. Desse modo a cada hora sera verificada se a | |
# porcentagem de memória utilizada pelo sistema atingiu o valor definido | |
# na variável 'percent'. Caso positivo, o script informará ao kernel | |
# que este deverá alterar o valor da opção 'drop_caches' para 3. | |
# | |
# Mais detalhes: 'man proc' -> /proc/sys/vm/drop_caches. | |
PATH="/bin:/usr/bin:/usr/local/bin" |
NewerOlder