This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ScaledImageView.h" | |
#import "UIImageView+WebCache.h" | |
@implementation ScaledImageView | |
- (id)initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) { | |
// Initialization code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rotate view by 45 degrees | |
myUIView.transform = CGAffineTransformMakeRotation(M_PI/4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reate and use the new RVM gemset | |
$ rvm use --create 1.9.3@awesome_rails_project | |
# install rails into the blank gemset | |
$ gem install rails | |
# generate the new rails project | |
$ rails new awesome_rails_project | |
# go into the new project directory and create an .rvmrc for the gemset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGRect rect; | |
// Get screen dimensions | |
rect = [[UIScreen mainScreen] bounds]; | |
NSLog(@"Bounds: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); | |
// Get application frame dimensions (basically screen - status bar) | |
rect = [[UIScreen mainScreen] applicationFrame]; | |
NSLog(@"App Frame: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); | |
// Get status bar frame dimensions | |
rect = [[UIApplication sharedApplication] statusBarFrame]; | |
NSLog(@"Statusbar frame: %1.0f, %1.0f, %1.0f, %1.0f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSInteger controllerIndex = 2; | |
UIView *fromView = self.tabBarController.selectedViewController.view; | |
UIView *toView = [[self.tabBarController.viewControllers objectAtIndex:controllerIndex] view]; | |
// Get the size of the view area. | |
CGRect viewSize = fromView.frame; | |
BOOL scrollRight = controllerIndex > self.tabBarController.selectedIndex; | |
// Add the to view to the tab bar view. | |
[fromView.superview addSubview:toView]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Opal.class('DateTime', { | |
'hours': function() { | |
return this._hours; | |
}, | |
'hours=': function(v) { | |
this._hours = v; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Greeter = Opal.class('Greeter', { | |
'initialize': function(name) { | |
this.set_first_name(name); | |
}, | |
'greet': function() { | |
this.puts('Hi, ' + this.first_name()); | |
}, | |
'first_name': function() { | |
return this._first_name; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mapOptions = { | |
center: new google.maps.LatLng(-34.397, 150.644), | |
zoom: 8, | |
mapTypeId: google.maps.MapTypeId.ROADMAP | |
}; | |
var map = new google.maps.Map(document.getElementById("map_canvas"), | |
mapOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.class_eval do | |
class_attribute :no_serialize_update | |
self.no_serialize_update = false | |
end | |
ActiveRecord::AttributeMethods::Dirty.class_eval do | |
# Serialized attributes should always be written in case they've been | |
# changed in place. | |
def keys_for_partial_update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<gpx version="1.1" creator="Xcode"> | |
<wpt lat="40.7475" lon="-73.9725"> | |
<name>Murray_Hill</name> | |
</wpt> | |
</gpx> |