Skip to content

Instantly share code, notes, and snippets.

View tiagobbraga's full-sized avatar

Tiago Braga tiagobbraga

View GitHub Profile
module.exports = function (app, db) {
var module = {};
module.auth = function (req, res) {
// This will be available 'outside'.
// Authy stuff that can be used outside...
};
// Other stuff...
module.pickle = function(cucumber, herbs, vinegar) {
@tiagobbraga
tiagobbraga / script
Created November 28, 2015 00:26
CFBundleShortVersionString with CFBundleVersion
#!/bin/bash
cV=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE")
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
b=${bN##*.}
bN=$((b += 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $cV.$bN" "$INFOPLIST_FILE"
@tiagobbraga
tiagobbraga / steps target emulate ios
Created December 7, 2015 15:21
ionic emulate ios
I've just installed ionic and I used this syntax to select the device to emulate:
ionic emulate ios --target="iPhone-4s"
To find out available emulations I run this:
ios-sim showdevicetypes
This command will return a list something like this:
iPhone-4s, 8.4
iPhone-5, 8.4
@tiagobbraga
tiagobbraga / contact.m
Created March 10, 2016 12:37 — forked from willthink/contact.m
Using CNContactStore in Objective C to query contacts info
#import <Contacts/Contacts.h>
@implementation ContactsScan
- (void) contactScan
{
if ([CNContactStore class]) {
//ios9 or later
CNEntityType entityType = CNEntityTypeContacts;
if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)
@tiagobbraga
tiagobbraga / version-build
Last active June 29, 2018 17:55
Put Version Build according with Version app
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=`echo $buildNumber +1|bc`
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@tiagobbraga
tiagobbraga / todo-fixme
Last active May 17, 2016 12:04
MARK to TODO and FIXME
#!/bin/bash
TAGS="TODO:|FIXME:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@tiagobbraga
tiagobbraga / reset
Last active July 19, 2016 01:31
Vagrant Not Starting Up
bash
sudo vagrant up
@tiagobbraga
tiagobbraga / Steps.md
Last active July 29, 2016 21:06 — forked from Godoy/Steps.md
deploy ruby on rails 4 with capistrano nginx unicorn - ubuntu 14.04

Steps

These steps were made with Ubuntu 14.04 e ruby 2.2.2. To enjoy the ease of step-by-step, I suggest not change folders and application name - just change the server ip and git

Create user to deploy

# Server console
sudo adduser deployer
sudo gpasswd -a deployer sudo
# show all processes
lsof -wni tcp:3000
# kill process
kill -9 NUMBER_OF_PROCESS
# http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-cmd-commands.html
# http://stackoverflow.com/questions/31171048/how-do-i-change-users-in-the-eb-cli
# add this lines in ~/.aws/config
[PROFILE_NAME]
aws_access_key_id = xxx
aws_secret_access_key = xxx
# and init
eb init --profile PROFILE_NAME