Skip to content

Instantly share code, notes, and snippets.

View SauloSilva's full-sized avatar

Saulo Santiago SauloSilva

View GitHub Profile
@SauloSilva
SauloSilva / inset_jquery_on_page.js
Created September 27, 2013 13:02
Inset jquery on page via inspector element.
var jq = document.createElement('script');
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
jQuery.noConflict();
@SauloSilva
SauloSilva / resize_vm.txt
Created September 17, 2013 19:10
resize_vm
/Applications/VirtualBox.app/Contents/MacOS/VBoxManage modifyhd YOUR_HARD_DISK.vdi –resize SIZE_IN_MB
@SauloSilva
SauloSilva / ms_to_days.js
Last active December 21, 2015 17:38
Transform ms in days, hours, minutes and seconds.
// example 1: format "Days" : days, "Hours" : hours, "Minutes" : minutes, "Seconds" : seconds
millisToTime = function(ms) {
x = ms / 1000;
seconds = Math.round(x % 60);
x /= 60;
minutes = Math.round(x % 60);
x /= 60;
hours = Math.round(x % 24);
x /= 24;
days = Math.round(x);
@SauloSilva
SauloSilva / resize.js
Created August 1, 2013 19:14
Resize, element html, pure javascript.
var object = undefined
, minimum = undefined
, count = 0
, limit = 0
, skip = 5
, interval = undefined;
function expand(width) {
object = document.getElementById('super');
minimum = object.offsetWidth;
@SauloSilva
SauloSilva / config_sublime
Created April 8, 2013 12:34
configuration sublime.
{
"auto_complete": true,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
@SauloSilva
SauloSilva / Add multiple buildpacks heroku
Created December 11, 2015 03:02
Add multiple buildpacks heroku
heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nodejs.git
@SauloSilva
SauloSilva / git_pc
Last active October 18, 2015 14:21
git pc
#!/bin/bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
COMMIT_MESSAGE=$1
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git status
echo -e "\n$(tput setaf 2)\n** Executing add command$(tput sgr0)"
git add .
@SauloSilva
SauloSilva / yml_checker.yml
Created August 3, 2015 12:52
yml compare
require 'yaml'
ymls = Dir['config/locales/**/*.yml'].sort.each_slice(2).to_a
def get_keys(object)
if object.is_a? Hash
(object.keys + get_keys(object.values)).flatten.uniq
elsif object.is_a? Array
object.collect{ |value| get_keys value }
else
@SauloSilva
SauloSilva / git-clean-up
Created July 30, 2015 03:33
Git clean up
#!/bin/bash
MAIN_BRANCH=${1-master}
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git branch --merged | grep -v "\*" | grep -v $MAIN_BRANCH | grep -v dev | xargs -n 1 git branch -d
@SauloSilva
SauloSilva / git-amend
Last active August 29, 2015 14:23
git commit --amend
#!/bin/bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git add .
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git commit --amend $1