Skip to content

Instantly share code, notes, and snippets.

View gabrielrinaldi's full-sized avatar
👨‍💻

Gabriel Rinaldi gabrielrinaldi

👨‍💻
View GitHub Profile
//
// MKMapViewZoomLevel.swift
//
// Created by Johannes Rudolph on 10.05.17.
// Based on http://troybrant.net/blog/2010/01/set-the-zoom-level-of-an-mkmapview/
//
import Foundation
import MapKit
@gabrielrinaldi
gabrielrinaldi / slack_base16_chalk-dark
Last active August 29, 2015 14:19
Slack Base16 Chalk (Dark)
#151515,#202020,#505050,#E1A3EE,#303030,#FB9FB1,#12CFC0,#ACC267
@gabrielrinaldi
gabrielrinaldi / pr.md
Last active August 29, 2015 14:14 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@gabrielrinaldi
gabrielrinaldi / keybase.md
Created September 30, 2014 05:52
keybase.md

Keybase proof

I hereby claim:

  • I am gabrielrinaldi on github.
  • I am gabriel_rinaldi (https://keybase.io/gabriel_rinaldi) on keybase.
  • I have a public key whose fingerprint is 1F9D 3AC4 895E 3805 61ED 9025 9F37 7213 63DF 7276

To claim this, I am signing this object:

@gabrielrinaldi
gabrielrinaldi / tag.rb
Last active August 29, 2015 14:02
Build tagging
#/bin/ruby
# Check if version file exists
check = %x( [ -e .version ] && echo 'found' || echo 'miss' ).delete!("\n")
unless check.eql? 'found'
abort('Cannot find version file. Aborting.')
end
# Get major and minor version from version file
version = %x( head -n 1 .version ).delete!("\n")

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
sqlite3_stmt *statement = NULL;
sqlite3_prepare_v2(db, "SELECT strftime('%s', ?);", -1, &statement, NULL);
sqlite3_bind_text(statement, 1, [dateString UTF8String], -1, SQLITE_STATIC);
sqlite3_step(statement);
sqlite3_int64 interval = sqlite3_column_int64(statement, 0);
NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
sqlite> SELECT strftime("%s", "2013-09-07T23:45:00Z");
1378597500
@gabrielrinaldi
gabrielrinaldi / roulette.sh
Created January 28, 2013 22:30
Russian Roulette
[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*
@gabrielrinaldi
gabrielrinaldi / s3_delete_bucket.rb
Created February 17, 2011 21:35
Delete all files from S3 bucket
require 'aws/s3'
AWS::S3::Base.establish_connection!(
:access_key_id => 'access_key_id',
:secret_access_key => 'secret_access_key'
)
bucket = AWS::S3::Bucket.find('bucket')
while(!bucket.empty?)