話しをしたいポイントは3つ。
- 条件分岐を避けましょう
- 一時変数の使い方に注意しましょう
- 状態の使い方に気を使いましょう
これを徹底することで、バグの入り込む余地を最小限に保つプログラミングをしましょう。
# Copyright 1999-2009 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: $ | |
EAPI="2" | |
inherit elisp-common eutils mercurial toolchain-funcs | |
DESCRIPTION="The Go Programming Language" | |
HOMEPAGE="http://golang.org/" | |
SRC_URI="" |
/*! | |
* jQuery TextChange Plugin | |
* http://www.zurb.com/playground/jquery-text-change-custom-event | |
* | |
* Copyright 2010, ZURB | |
* Released under the MIT License | |
*/ | |
(function ($) { | |
$.event.special.textchange = { |
gem 'rails3-generators' | |
gem 'mongoid', '>= 2.0.0.beta' | |
gem 'bson_ext' | |
gem 'haml' | |
gem 'hirb', :group => :development | |
gem 'what_methods', :group => :development | |
gem 'rspec-rails', '>= 2.0.0.beta', :group => :test | |
gem 'rr', :group => :test |
require 'rubygems' | |
require 'rack' | |
run(lambda do | |
system 'killall X' | |
[200, { 'Content-Type' => 'text/plain' }, ['Goodbye!']] | |
end) |
require 'rspec' | |
require 'rr' | |
module RR | |
module Adapters | |
module Rspec | |
def self.included(mod) | |
RSpec.configuration.backtrace_clean_patterns.push(RR::Errors::BACKTRACE_IDENTIFIER) | |
end | |
end |
Links and Notes from my Classy Git RubyConf talk:
require 'drb' | |
require 'pp' | |
require 'net/https' | |
require 'oauth' | |
require 'json' | |
class JSONStream | |
def initialize(drop) | |
@buf = '' | |
@drop = drop |
" Factories and Configuration | |
Rnavcommand config config -suffix=.yml -default=application | |
Rnavcommand factory spec/factories test/factories -suffix=.rb -default=model() | |
" Backbone | |
Rnavcommand bmodel app/assets/javascripts/backbone/models -suffix=.coffee -default=model() | |
Rnavcommand bview app/assets/javascripts/backbone/views -suffix=.coffee | |
" Apotomo Widgets (Cells) | |
Rnavcommand widget app/widgets -suffix=_widget.rb |
" Shortcuts for backbone.js via the asset pipeline | |
autocmd User Rails Rnavcommand bbmodel app/assets/javascripts/backbone/models -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand bbhelper app/assets/javascripts/backbone/helpers -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand bbmixin app/assets/javascripts/backbone/mixins -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand bbrouter app/assets/javascripts/backbone/routers -suffix=.js.coffee -glob=* | |
autocmd User Rails Rnavcommand bbtemplate app/assets/javascripts/backbone/templates -suffix=.jst.hbs -glob=**/* | |
autocmd User Rails Rnavcommand bbview app/assets/javascripts/backbone/views -suffix=.js.coffee -glob=**/* | |
" Shortcuts for less.js via the asset pipeline | |
autocmd User Rails Rnavcommand less app/assets/stylesheets/less -suffix=.less -glob=**/* |