Skip to content

Instantly share code, notes, and snippets.

View barbosa's full-sized avatar
:octocat:

Gustavo Barbosa barbosa

:octocat:
View GitHub Profile
Verifying that "barbosa.id" is my Blockstack ID. https://onename.com/barbosa
import UIKit
protocol ReusableView: class {
static var defaultReuseIdentifier: String { get }
}
protocol NibLoadableView: class {
static var nibName: String { get }
}
import UIKit
final class MyViewController: UIViewController {
func loadView() {
view = MyView.fromNib()
}
}
final class MyView: UIView, NibLoadableView {
protocol Resource {
associatedtype ResourceFinderType
static var localObjects: ResourceFinderType { get }
}
extension Resource {
static var localObjects: ResourceFinder<Self> {
return ResourceFinder()
}
}
@barbosa
barbosa / jenkins-xcodebuild
Created January 2, 2015 23:13
Shell script to archive and distribute IPA files
# source: http://www.raywenderlich.com/downloads/jenkins_shell_steps.txt
#####################
# JENKINS step #1
# add to it's own execute shell section
#####################
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
xcodebuild -target GuildBrowserLogicTests \
Pod::Spec.new do |s|
s.name = 'JSONKit'
s.version = '1.6'
s.summary = 'A Very High Performance Objective-C JSON Library.'
s.homepage = 'https://github.com/johnezang/JSONKit'
s.author = 'John Engelhart'
s.source = { :git => 'https://github.com/creativemess/JSONKit.git' }
s.source_files = 'JSONKit.*'
end
#ifndef IOSVersionMacros_h
#define IOSVersionMacros_h
#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_IPHONE_5 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 568.0f)
#define IS_IPHONE_4 (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 480.0f)
#define IS_RETINA ([[UIScreen mainScreen] scale] == 2.0f)
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
@barbosa
barbosa / .bash_profile
Created July 22, 2013 22:29
A simple .bash_profile file
source ~/.git-prompt.sh
# aliases
# ------------------------------
alias ls='ls -G'
alias ll='ls -al'
# colors
# ------------------------------
##################
@barbosa
barbosa / robot.js
Created December 3, 2012 17:05
W00t #1 YEAH!!!! (Zolmesiter)
var Robot = function(robot){
robot.turnLeft(robot.angle % 90);
//robot.turnGunRight(90);
robot.clone();
this.direction = 1;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(1);
if (robot.parentId) {
@barbosa
barbosa / bootstrap.sh
Created January 14, 2012 19:44 — forked from anonymous/bootstrap.sh
Django on Heroku with Celery and Sentry
virtualenv --no-site-packages .
source bin/activate
bin/pip install Django psycopg2 django-sentry
bin/pip freeze > requirements.txt
bin/django-admin.py startproject mysite
cat >.gitignore <<EOF
bin/
include/
lib/
EOF