Skip to content

Instantly share code, notes, and snippets.

View ainame's full-sized avatar

Satoshi Namai ainame

View GitHub Profile
class HogeScreen < TabScreenBase
tab_icon icon: "fuga_image"
end
# -*- coding: utf-8 -*-
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(TestController.alloc.init)
@window.makeKeyAndVisible
end
end
class TestController < UITableViewController
@ainame
ainame / gist:5898143
Created July 1, 2013 03:16
RubyMotionを使うにあたって書いてる設定
(require 'motion-mode)
(add-to-list 'ac-modes 'motion-mode)
(add-hook 'ruby-mode-hook 'motion-recognize-project)
(define-key motion-mode-map (kbd "C-c C-c") 'motion-execute-rake)
(define-key motion-mode-map (kbd "C-c C-o") 'motion-dash-at-point)
(push '("*motion-rake*" :position bottom :height 10) popwin:special-display-config)
(add-to-list 'auto-mode-alist '("Guardfile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))
class GithubScreen < PM::WebViewScreen
include SingletonClass
def on_load
open_url 'http://github.com'
end
end
module SingletonClass
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def new
super
instance
end
@ainame
ainame / a.rb
Last active December 17, 2015 18:09
rubymotionバグ? block_given?がブロックの中で評価すると値が変わる
def callback_caller(&block)
p block_given?
callback_caller2 do
p block_given?
block.call if block_given?
end
end
def callback_caller2(&block)
block.call
module MethodCallerLogger
module ClassMethods
LOG_FORAMT = "%s at %s:L%s"
def parse_caller(_caller)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ _caller
file = $1
line = $2.to_i
method = $3
[file, line, method]
@ainame
ainame / gist:a4f8dc30400f0dc05c96
Created April 30, 2013 11:52
チートシート

extreme fish bowl

問題

extreme fish bowlルール説明

  1. 2人1組になってプログラムを書く
  2. 書く人(ドライバー)と、横で考える人(ナビゲーター)は随時入れ替える
  3. コーディングするときは必ず何を書こうとしているのか喋りながら書く
  4. 15分の作業が終わる前にgit commitして、速やかに次のペアに席を譲る
  5. コーディング中のペア以外の人達は以下の様に何でも良いのでその場で口を出して良い。ただし、質問が優先されるべき。
  • 技術的な質問(このメソッド何なの?みたいな)
use strict;
use warnings;
use Test::More;
use Test::More::Hooks;
subtest "xxxxxxxxxxx" => sub {
my $subject;
before { $subject = Foo->new; };
after { undef $subject; };
@ainame
ainame / gist:5475802
Created April 28, 2013 03:49
blog用
use strict;
use warnings;
use Test::Pretty;
use Test::More;
use Test::Warn;
my $class;
BEGIN {
$class = "Bowling::Scorer";