Skip to content

Instantly share code, notes, and snippets.

View tiagobbraga's full-sized avatar

Tiago Braga tiagobbraga

View GitHub Profile
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;
@tiagobbraga
tiagobbraga / correct-scrolltop.js
Created August 7, 2013 12:56
Valor corrigido do scrollTop
var elemScroll = null; // elemento que tem definido no css a altura desejada
$(function()
{
elemScroll = $('#way');
function setScrollTop()
{
var heightDiff = $(window).height();
@tiagobbraga
tiagobbraga / scaleImage.m
Created September 23, 2013 02:06
Escala imagem de acordo com o tamanho da View
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:@"image.png"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
@tiagobbraga
tiagobbraga / .gitignore
Last active December 28, 2015 15:19
Quando o .gitignore é esquecido dos primeiros commits, é possível fazer ele funcionar seguindo os seguintes passos.
git rm -r --cached .
git add .
git commit -m ".gitignore agora está funcionando"
@tiagobbraga
tiagobbraga / height
Last active December 28, 2015 15:19
UITextView com altura 'Auto' ou '100%'Códigos originais em: http://stackoverflow.com/questions/50467/how-do-i-size-a-uitextview-to-its-content
// Para funcionar no iOS6
textview.scrollEnabled = NO;
@tiagobbraga
tiagobbraga / remove homebrew
Last active December 30, 2015 09:19
Remover Homebrew
cd `brew --prefix`
rm -rf Cellar
brew prune
rm `git ls-files`
rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions
rm -rf .git
rm -rf ~/Library/Caches/Homebrew
@tiagobbraga
tiagobbraga / standby.cs
Last active December 31, 2015 12:59
Tela de espera para aplicativos Surface(PixelSense)
#region Properties of Class
private readonly DispatcherTimer _activityTimer;
private readonly double minutesInactivity = 3; // 3 minutes
#endregion
#region Inside of Method Constructor or of another local
InputManager.Current.PreProcessInput += OnActivity;
_activityTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(minutesInactivity), IsEnabled = true };
_activityTimer.Tick += OnInactivity;
#endregion
@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];