Skip to content

Instantly share code, notes, and snippets.

View tiagobbraga's full-sized avatar

Tiago Braga tiagobbraga

View GitHub Profile
@tiagobbraga
tiagobbraga / timezone-simulator
Last active August 29, 2015 14:22
Android - Change timezone simulator
If you use IntelliJ you can do that from Run/Edit Configurations window. Go to Emulator tab and add this to "Additional command line options":
-timezone Europe/Helsinki
Android document gives this info:
-timezone Set the timezone for the emulated device to , instead of the host's timezone. must be specified in zoneinfo format. For example: "America/Los_Angeles" "Europe/Paris"
Zoneinfo format is also known as tz database. So to find you specific timezone, you can use the Wikipedia list here:
http://en.wikipedia.org/wiki/List_of_tz_database_time_zone
For android studio 0.5.7, volley was successfully imported as a library project following these steps:
Create a directory named "libraries"(whichever you want) under your project root
Clone volley using git under the directory created in step 1, command is "git clone https://android.googlesource.com/platform/frameworks/volley". Now the project structure looks like:
[Project root]
|- [Your module]
|- libraries
|- volley
Import volley through : Right click project root -> Open Module Settings -> Click "+"(New Module) in the up left corner -> Import existing project -> Select volley source directory -> Next After step 3, volley is imported, but dependency on library project volley is not setup yet.
@tiagobbraga
tiagobbraga / Add and remove view of View Controller
Last active August 29, 2015 14:23 — forked from tomohisa/gist:2897676
Add and Remove View of ViewController
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc willMoveToParentViewController:nil];
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 / Executar Testes RestKit
Created March 7, 2013 12:39
Antes de executar os testes do RestKit, executar esses comandos.
rvm gemset create RestKit
git submodule update --init --recursive
@tiagobbraga
tiagobbraga / gist:5110874
Created March 7, 2013 19:14
Observar modificações no elemento
$("#someDiv").bind("DOMSubtreeModified", function() {
alert("tree changed");
});
#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)
// UIBarButtonItem+Custom.h
// Created by Jason Larsen on 6/21/12.
#import <UIKit/UIKit.h>
@interface UIBarButtonItem (Custom)
- (void)customViewButtonWithImage:(NSString *)imageName target:(id)target action:(SEL)selector;
@end