Skip to content

Instantly share code, notes, and snippets.

View idiogo's full-sized avatar

Diogo Carneiro idiogo

View GitHub Profile
@idiogo
idiogo / String+Additions.swift
Created January 28, 2017 12:48 — forked from perlmunger/String+Additions.swift
Some helpful string extensions in Swift 2
extension String
{
var length: Int {
get {
return self.characters.count
}
}
func contains(s: String) -> Bool {
return self.rangeOfString(s) != nil ? true : false
@idiogo
idiogo / install-git-completion.sh
Created January 24, 2017 15:02 — forked from johngibb/install-git-completion.sh
Mac OS X - Install Git Completion
URL="https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash"
PROFILE="$HOME/.profile"
echo "Downloading git-completion..."
if ! curl "$URL" --silent --output "$HOME/.git-completion.bash"; then
echo "ERROR: Couldn't download completion script. Make sure you have a working internet connection." && exit 1
fi
@idiogo
idiogo / .gitconfig
Created January 24, 2017 14:50
Git Configuration for colors and aliases
[alias]
s = status
cm = commit -am
lll = !git log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
ll = !git log --stat --abbrev-commit
l = !git log --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
[color]
diff = auto
status = auto
sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods
*Don’t animate opening applications from the Dock*
`defaults write com.apple.dock launchanim -bool false`
*Speed up Mission Control animations*
`defaults write com.apple.dock expose-animation-duration -float 0.1`
*Remove the auto-hiding Dock delay*
`defaults write com.apple.dock autohide-delay -float 0`
*Remove the animation when hiding/showing the Dock*
@idiogo
idiogo / gravatar.rb
Created August 25, 2016 17:10
Ruby multithread script to bulk download gravatars from email list files.
require 'open-uri'
require 'digest'
SAVE_TO = './gravatars/'
threads = Array.new
Dir.foreach('./emails') do |item|
next if item == '.' or item == '..'
@idiogo
idiogo / UIView+CMExtras.h
Created April 13, 2016 16:59 — forked from chrismiles/UIView+CMExtras.h
UIView class extension with some of my handy convenience methods
//
// UIView+CMExtras.h
//
// Created by Chris Miles on 9/06/11.
// Copyright 2011 Chris Miles.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@idiogo
idiogo / onlynumbers.sh
Created April 13, 2016 16:50
Extrating numbers from string in terminal... (p/ boletos)
echo "875.28.6.33/556-54" | tr -cd [:digit:]
<html>
<head>
<base href="http://dropbox.com/"></base>
</head>
<?php
//set POST variables
$url = 'https://www.dropbox.com/login';
$headers = array(
@idiogo
idiogo / gist:8133756
Created December 26, 2013 13:19
repeating some string n times
@interface NSString (Repeat)
- (NSString *)repeatTimes:(NSUInteger)times;
@end
@implementation NSString (Repeat)
- (NSString *)repeatTimes:(NSUInteger)times {
return [@"" stringByPaddingToLength:times * [self length] withString:self startingAtIndex:0];