puts 'The best way to log and share programmers knowledge.'
puts 'The best way to log and share programmers knowledge.'
また、コードをインライン表示することも可能です。
#===sample | |
# | |
#MP3プレイヤーのProductのmaker名をレコード数の多い順に並べてその結果のハッシュのkeyであるmaker名を配列として取得 | |
# | |
Product.where(category: "MP3 Player").group(:maker).order('count_maker desc').count('maker').keys |
//そのobjがどのクラスに属するか | |
NSLog(@"%@",NSStringFromClass([obj class])); | |
//frame | |
NSLog(@"%@",NSStringFromCGRect(startFrame)); | |
//メソッド名とクラス名と行番号 | |
NSLog(@"%s #%04d", __PRETTY_FUNCTION__, __LINE__); | |
//インスタンスのクラス名 |
Build Settings > Apple LLVM compiler - Preprocessing > Preprocessor Macros | |
Debug: DEBUG=1 | |
Release: (DEBUG未定義) | |
みたいな感じ設定 | |
コード内で | |
// デバッグ用マクロ |
get Xcode | |
preferences -> download -> commandLintTools install | |
sudo mkdir /usr/local/src | |
sudo chmod 0777 /usr/local/src | |
cd /usr/local/src | |
curl -O http://ftp.gnu.org/gnu/wget/wget-1.14.tar.gz | |
tar -zxvf wget-1.14.tar.gz |
failed | |
! Heroku client internal error. | |
! Search for help at: https://help.heroku.com | |
! Or report a bug at: https://github.com/heroku/heroku/issues/new | |
Error: Unable to verify certificate, please set `Excon.defaults[:ssl_ca_path] = path_to_certs`, `Excon.defaults[:ssl_ca_file] = path_to_file`, or `Excon.defaults[:ssl_verify_peer] = false` (less secure). (Excon::Errors::SocketError) | |
Backtrace: /Users/name/.rvm/gems/ruby-1.9.3-p392/gems/excon-0.25.1/lib/excon/ssl_socket.rb:69:in `connect' | |
/Users/name/.rvm/gems/ruby-1.9.3-p392/gems/excon-0.25.1/lib/excon/ssl_socket.rb:69:in `initialize' | |
/Users/name/.rvm/gems/ruby-1.9.3-p392/gems/excon-0.25.1/lib/excon/connection.rb:365:in `new' | |
/Users/name/.rvm/gems/ruby-1.9.3-p392/gems/excon-0.25.1/lib/excon/connection.rb:365:in `socket' |
- (void) popToBeforeHogeViewController | |
{ | |
// HogeViewController のインデックスを探す | |
NSInteger targetIndex = -1; | |
for (int i = 0; i < self.viewControllers.count; i++) | |
{ | |
if ([self.viewControllers[i] isKindOfClass:[HogeViewController class]]) | |
{ | |
targetIndex = i - 1; | |
break; |
//encoding | |
NSString *escapedUrlString = (NSString *)CFURLCreateStringByAddingPercentEscapes( | |
NULL, | |
(CFStringRef)plainString, | |
NULL, | |
(CFStringRef)@"!*'();:@&=+$,/?%#[]", | |
kCFStringEncodingUTF8 ); | |
//decoding | |
NSString *decodedUrlString = (NSString *) CFURLCreateStringByReplacingPercentEscapesUsingEncoding( |
#import <Foundation/Foundation.h> | |
@interface NSArray (quickSort) | |
- (NSArray*)quickSort; | |
@end |
#import <Foundation/Foundation.h> | |
@interface NSArray (grep) | |
- (NSArray *)grep:(BOOL(^)(id))block; | |
@end |