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
| 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
| 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
| 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
| 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
| 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
| require 'pp' | |
| require 'pathname' | |
| input_dir = 'orig' | |
| output_dir = 'out' | |
| Pathname.glob("#{input_dir}/**/*.png").sort.each do |path| | |
| dist = Pathname(path.to_s.gsub(input_dir, output_dir)) | |
| dist.dirname.mkpath unless dist.dirname.exist? | |
| system('cp %s %s' % [path.to_s, dist.to_s.gsub('.png', '@2x.png')]) |
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 | |
| button = UIButton.buttonWithType(UIButtonTypeRoundedRect).tap do |b| | |
| b.frame = [[30.0, 30.0], [200.0, 30.0]] | |
| b.setTitle("Click", forState:UIControlStateNormal) | |
| b.addTarget(self, action: 'open_action_sheet:', forControlEvents: UIControlEventTouchUpInside) | |
| 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
| { | |
| "font_face": "Ricty-Regular", | |
| "font_size": 16.0, | |
| "highlight_line": true, | |
| "tab_size": 2, | |
| "translate_tabs_to_spaces": true, | |
| "word_wrap": true | |
| } |
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
| # ./lib/motion/project/config.rb | |
| # RakefileからrequireすればOK | |
| # そのうち直るとは思うけれどもとりあえず。。。 | |
| class Motion::Project::Config | |
| def target(platform) | |
| File.join(platform_dir(platform), 'Developer/SDKs', | |
| platform + deployment_target + '.sdk') | |
| end | |
| def frameworks_dependencies |