This file contains hidden or 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
| class UIWebView | |
| alias_method :original_init, :init | |
| def initWithScrollView | |
| original_init | |
| unless self.respond_to?(:scrollView) | |
| def scrollView | |
| self.subviews.each do |view| | |
| return view if view.kind_of?(UIScrollView) | |
| end | |
| end |
This file contains hidden or 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
| def loadView | |
| self.view = UIView.new.tap do |v| | |
| bg_image = UIImage.imageNamed('bg_black.png') | |
| v.backgroundColor = UIColor.colorWithPatternImage(bg_image) | |
| end |
This file contains hidden or 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
| anim = CABasicAnimation.animationWithKeyPath('transform') | |
| anim.fromValue = 0 | |
| anim.toValue = 2 * Math::PI | |
| anim.valueFunction = CAValueFunction.functionWithName(KCAValueFunctionRotateZ) | |
| anim.duration = 2 | |
| anim.repeatCount = Float::MAX | |
| =begin | |
| 2012-08-16 15:01:39.964 ruby[37392:f0b] unrecognized runtime type `{_CMTime=qiIq}' (TypeError) | |
| Can't compile stub for selector `setDuration:': unrecognized runtime type `{_CMTime=qiIq}' (TypeError) |
This file contains hidden or 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
| class SelectableImageView < UIImageView | |
| include BW::KVO | |
| attr_accessor :is_selected | |
| def initWithFrame(rect) | |
| super | |
| @is_selected = false | |
| observe(self, :is_selected) do |old_val, new_val| | |
| if old_val != new_val |
This file contains hidden or 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
| class HogeSweeperObserver < ActionController::Caching::Sweeper | |
| observe Hoge | |
| def after_update(hoge) | |
| expire_cache_for(hoge) | |
| end | |
| private | |
| def expire_cache_for(hoge) | |
| ActionController::Base.expire_page( |
This file contains hidden or 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
| # $ brew install reattach-to-user-namespace してから | |
| set-option -g default-command "reattach-to-user-namespace -l zsh" |
This file contains hidden or 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
| set mailserver smtp.gmail.com port 587 | |
| username "user@example.com" password "password" | |
| using tlsv1 | |
| with timeout 30 seconds |
This file contains hidden or 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
| class MyViewController < UIViewController | |
| def viewDidLoad | |
| super | |
| view.backgroundColor = UIColor.whiteColor | |
| end | |
| def viewDidAppear(animated) | |
| super | |
| if TWTweetComposeViewController.canSendTweet | |
| tw = TWTweetComposeViewController.new.tap do |c| |
This file contains hidden or 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
| module MigrateOneToTwo | |
| module_function | |
| def store_path | |
| File.join(App.documents_path, 'store.sqlite') | |
| end | |
| def tmp_store_path | |
| File.join(App.documents_path, 'store_tmp.sqlite') | |
| end |
This file contains hidden or 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
| config.logger = ActiveSupport::TaggedLogging.new(Logger.new(config.paths['log'].first)) | |
| config.logger.formatter = lambda {|severity, datetime, progname, msg| | |
| "%s, [%s #%d], %5s -- %s\n" % [severity[0..0], datetime.strftime('%Y-%m-%d %H:%M:%S')+('.%06d' % datetime.usec), $$, severity, msg] | |
| } | |
| config.logger.level = Logger::DEBUG |