Skip to content

Instantly share code, notes, and snippets.

View gsampaio's full-sized avatar

Guilherme Martinez Sampaio gsampaio

View GitHub Profile
@gsampaio
gsampaio / UIKit+Injection.swift
Created December 14, 2018 15:53
Injection Extensions for View Coding
extension UIViewController {
@objc func injected() {
for subview in self.view.subviews {
subview.removeFromSuperview()
}
loadView()
viewDidLoad()
}
}
@gsampaio
gsampaio / clean_up.rb
Created January 10, 2018 17:19
Find duplicated swift files in a folder
#!/usr/bin/env ruby
def check(folder)
swift_files = Dir.glob("#{folder}/**/*").select { |file| file.end_with? "swift" }
fileForPaths = {}
for file in swift_files
fileName = file.split('/').last
# If we find a file with the same name we add the path
@gsampaio
gsampaio / keybase.md
Created August 24, 2016 16:37
keybase.md

Keybase proof

I hereby claim:

  • I am gsampaio on github.
  • I am gsampaio (https://keybase.io/gsampaio) on keybase.
  • I have a public key whose fingerprint is AE5F 724E 291E 7CFA 90CF EA2D 2F3E 6CAB CC18 B3A3

To claim this, I am signing this object:

@gsampaio
gsampaio / tools.md
Last active August 16, 2017 02:44
CocoaHeads CPS - Painel Tools

CocoaHeads Campinas Painel de Tools

Aqui se encontra a lista de tools que citamos no painel do ultimo CocoaHeads de Campinas (Jul/16). Tentei organizar minamente o que por sessão e esta organização esta sujeita mudanças. Se você tiver alguma duvida ou sugestão deixe um comentario no gist ou me pingue no twitter @gsampaio

CI

Fastlane

Snapshot

Frame it

@gsampaio
gsampaio / roudtrip.json
Created September 10, 2013 00:23
Roadtrip
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gsampaio
gsampaio / gist:5256908
Last active December 15, 2015 11:59
NSTimer snippet
NSInvocation *timerSelectorInvocation = [[NSInvocation alloc] init];
[timerSelectorInvocation setSelector:@selector(tapRecognizer:)];
[timerSelectorInvocation setArgument:NULL atIndex:0];
[NSTimer scheduledTimerWithTimeInterval:2 invocation:timerSelectorInvocation repeats:YES];
@gsampaio
gsampaio / growl-xcode.scpt
Created September 4, 2012 19:50
Xcode Debug Action Crash Growl Apple Script
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
-- Create the crash notification
set the allNotificationsList to ¬
{"Xcode Notification"}
@gsampaio
gsampaio / instagram_recent_feed.js
Created January 8, 2012 15:59
Instagram Recent Feed Javascript
/**
* A simple javascript script to get the lastest images from your instagram account.
* Require an app to acess instagram api in order to get the access_token and user_id
* Require jquery for the ajax and dom manipulation
*/
var settings = {
user : 'ENTER_YOUR_USER_ID_HERE',
access_token : 'ENTER_YOUR_USER_ACCESS_TOKEN_HERE'
};
@gsampaio
gsampaio / stdmail.js
Created December 7, 2011 02:12
Node Daemon to watch file change and send to email
/*
Node filewatch to email module by Guilherme Martinez Sampaio
require npm, daemon and mail
Make sure to change the configuration object
To install:
npm: curl http://npmjs.org/install.sh | sh
daemon: npm install daemon
mail: npm install mail
@gsampaio
gsampaio / mc548.sh
Created December 3, 2011 04:51
MC548 Grades Calculator
#!/usr/bin/env bash
curl "http://www.ic.unicamp.br/~fkm/disciplinas/mc548/old/2011s2/notas.txt" 2>|/dev/null | grep 73177 | sed s/\,/./ | awk '{OFMT="%.2f";print(((3*(($2)+($3)))+(4*(($4)+($5))))/14)}'