Skip to content

Instantly share code, notes, and snippets.

View mborromeo's full-sized avatar

Marco Borromeo mborromeo

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwY1YldkzNXPLi14dMl+MFh9Z85OY/DJIxOe86TdYfjLZ0UeDDby9MNWr4o0H7xyQ/XyDb3huppjjM/knVX8E5WPGrm6sAOS/RzK/FEPmurbtlXW18K4v9fiHbQSMd1SJxpwd8b4kICMFwaprLotqkUSlZevaRM/1T/FCUlXJ46OMAvJ9yYcjnxipMksIKLKhRFBES1z4E3PwBecQ1OPGgzsbahyFPGb8zJfWlZdOPI9eSTRlzl3HGEwMjZEwNpAmjdfr4ZrvyS+7u7Uacdnx9Qk/KI/746VDbRdFRheta2Wwz3soEIMGMmySJeoqL0lCHcmZvjtyhlYJxzmLfToImw== marco@Marco-Borromeos-MacBook-Pro.local
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxNQjrBv/O7X3zBorloD9U0bEUbKUFOUwpck2oHObHAKV1ATxHO7L6vgfcXkqbUr7MrNgapq8jI1jlyQv9Kays33PtDEQpbhKg8t4zX/0tU4XqZAhrMjmFWzaN0w5DjJeHriSArn4P54UHrOgzFGM8RISKCpGb5nL6RUK4WPcPhWYYUJmhhGx7p+CUX6T+r7hVz65cu8M8KjzEJGnjyORLOxXCOAj6EbdUDGDP8ZW8eM1N+xjsXt0p/s13VmIPy5WZ866iURWeZrgn4aXVyukRtmrAAI62eTJb+eILn3dOLX9ijBuYh1mgjDSO5zG47rxV1ETwTXsGUUfxMt31n8CMQ== marco@macbook-di-marco-borromeo.local
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwY1YldkzNXPLi14dMl+MFh9Z85OY/DJIxOe86TdYfjLZ0UeDDby9MNWr4o0H7xyQ/XyDb3huppjjM/knVX8E5WPGrm6sAOS/RzK/FEPmurbtlXW18K4v9fiHbQSMd1SJxpwd8b4kICMFwaprLotqkUSlZevaRM/1T/FCUlXJ46OMAvJ9yYcjnxipMksIKLKhRFBES1z4E3PwBecQ1OPGgzsbahyFPGb8zJfWlZdOPI9eSTRlzl3HGEwMjZEwNpAmjdfr4ZrvyS+7u7Uacdnx9Qk/KI/746VDbRdFRheta2Wwz3soEIMGMmySJeoqL0lCHcmZvjtyhlYJxzmLfToImw== marco@Marco-Borromeos-MacBook-Pro.local
@mborromeo
mborromeo / iphone-sdk-network-activity-indicator.c
Created February 15, 2010 08:41
[iPhone SDK] Shows/Hides the network activity indicator
/*
Shows/Hides the network activity indicator
(the little rotating icon between status bar time and network operator)
*/
UIApplication* uiApp = [UIApplication sharedApplication];
uiApp.networkActivityIndicatorVisible = YES; // to hide indicator, set this to NO
@mborromeo
mborromeo / iphone-sdk-show-alert.c
Created February 15, 2010 09:10
[iPhone SDK] Shows a simple alert box
/*
Shows a simple alert box
*/
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Alert message"
delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
@mborromeo
mborromeo / iphone-sdk-navigationbar-hide-back-button.c
Created February 16, 2010 13:12
[iPhone SDK] Hide back button into navigation bar
self.navigationItem.hidesBackButton = YES;
@mborromeo
mborromeo / iphone-sdk-tableview-set-cell-height.c
Created February 16, 2010 13:14
[iPhone SDK] Set table view cell height
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [indexPath row] * 20;
}
@mborromeo
mborromeo / load-html-and-assets-from-local-path
Created March 10, 2010 11:27
[iPhone SDK] Load html and assets from local file
// Load html from local file
NSString *imagePath = [[NSBundle mainBundle] resourcePath];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];
imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"localpage" ofType:@"html"];
NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString: [NSString stringWithFormat:@"file:/%@//",imagePath]]];
@mborromeo
mborromeo / force-pop-to-root-tabbarcontroller-on-change.c
Created March 26, 2010 11:31
[iPhone] Force a view to pop to its root when a UITabBarController button is pressed
// This function will force a view to pop to its root when a UITabBarController button is pressed
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController {
// self is Application Delegate
[[self navigationController] popToRootViewControllerAnimated:NO];
if ([viewController isKindOfClass:[UINavigationController class]]) {
[(UINavigationController *)viewController popToRootViewControllerAnimated:NO];
}
@mborromeo
mborromeo / env.rb
Created May 14, 2010 23:03
My (working) mongoid + cucumber env.rb
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
# files.
ENV["RAILS_ENV"] ||= "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/formatter/unicode' # Remove this line if you don't want Cucumber Unicode support
@mborromeo
mborromeo / rails-3-mongo-devise.rb
Created May 20, 2010 23:19
Rails 3 Master + MongoDB + Devise template
# This Rails template will generate a Rails 3 (MASTER) application, with MongoDB as ORM and Devise for authentication.
# You will require ruby 1.9.2-HEAD to run generated app.
file 'Gemfile', <<-GEMS
source 'http://gemcutter.org'
gem "rails", :git => "git://github.com/rails/rails.git"
gem "mongoid", "2.0.0.beta4"
gem "bson_ext", "0.20.1"
gem "inherited_resources"
gem "devise", :git => "git://github.com/plataformatec/devise.git"