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
| $ git clone git://github.com/matsuda/plot.git myplot | |
| $ cd myplot | |
| $ heroku create | |
| $ git push heroku master | |
| $ heroku open |
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
| =begin | |
| チルダ問題 | |
| | \xE3\x80\x9C | 0x301c | | |
| | \xEF\xBD\x9E | 0xff5e | | |
| | \x7E | 0x7e | | |
| | \xCB\x9C | 0x2dc | | |
| | \xE2\x88\xBC | 0x223c | |
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 ActiveModel | |
| module ValidationsStepFu | |
| extend ActiveSupport::Concern | |
| private | |
| def validates_step_by(*attrs) | |
| attrs = attrs.map(&:to_sym) | |
| self.class.validators.each do |validator| | |
| if (validator.attributes & attrs).present? | |
| validator.validate(self) |
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
| # -*- coding: utf-8 -*- | |
| module I18n | |
| class << self | |
| # | |
| # nilの場合は無視する | |
| # | |
| def localize_with_nil(object, options = {}) | |
| return if object.nil? | |
| locale = options.delete(:locale) || config.locale | |
| format = options.delete(:format) || :default |
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
| /* | |
| UIWebViewのUserAgentを取得 | |
| */ | |
| UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectZero]; | |
| NSString *ua = [webView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; | |
| NSLog(@"userAgent >>> %@", ua); | |
| [webView release]; | |
| // ASIHTTPRequestにUserAgentを設定 | |
| // [ASIHTTPRequest setDefaultUserAgentString:ua]; |
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
| #import <Foundation/Foundation.h> | |
| @interface UIImage (Resize) | |
| - (CGFloat)aspectRatio:(CGSize)size; | |
| - (CGSize)resizedSize:(CGSize)size; | |
| - (UIImage *)resizedImage:(CGSize)size; | |
| @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
| /* | |
| [self sizeOfText:text withFont:[UIFont systemFontOfSize:14] inWidth:200] | |
| */ | |
| - (CGSize)sizeOfText:(NSString *)text withFont:(UIFont *)font inWidth:(NSInteger)width | |
| { | |
| UITextView *t = [[[UITextView alloc] initWithFrame:CGRectMake(0, 0, width, 0)] autorelease]; | |
| t.font = font; | |
| t.text = text; | |
| [t sizeToFit]; | |
| return t.contentSize; |
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 --cocoa emacs | |
| ==> Downloading http://ftpmirror.gnu.org/emacs/emacs-23.3a.tar.bz2 | |
| ######################################################################## 100.0% | |
| ==> Downloading patches | |
| ######################################################################## 100.0% | |
| ######################################################################## 100.0% | |
| ######################################################################## 100.0% | |
| ######################################################################## 100.0% | |
| ######################################################################## 100.0% | |
| ==> Patching |
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 readline | |
| ==> Downloading http://ftpmirror.gnu.org/readline/readline-6.2.tar.gz | |
| ######################################################################## 100.0% | |
| ==> Downloading patches | |
| ######################################################################## 100.0% | |
| ==> Patching | |
| patching file vi_mode.c | |
| patching file callback.c | |
| ==> ./configure --prefix=/usr/local/Cellar/readline/6.2.1 --mandir=/usr/local/Cellar/readline/6.2.1/share/man --infodir=/usr/local/Cellar/readline/6.2.1/share/info --enable-multibyte | |
| ==> make install |
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
| ######################################################################## | |
| # https://github.com/sstephenson/rbenv | |
| ######################################################################## | |
| $ brew install rbenv | |
| ==> Downloading https://github.com/sstephenson/rbenv/tarball/v0.2.1 | |
| ######################################################################## 100.0% | |
| /usr/local/Cellar/rbenv/0.2.1: 32 files, 156K, built in 2 seconds | |
| $ brew install ruby-build |