Skip to content

Instantly share code, notes, and snippets.

View pokutuna's full-sized avatar
👁️
👄👁👂

pokutuna pokutuna

👁️
👄👁👂
View GitHub Profile
class BoxMuller
def initialize(average, deviation)
@pos = -1
@ave = average
@dev = deviation
@buf = Array.new
end
def get(position = @pos)
return @buf[position]
class File
def self.actual_path(file = nil)
file = __FILE__ if file == nil
file = File.expand_path(file)
if File.ftype(file) == 'link' then
actpath = File.readlink(file)
file = File.actual_path(actpath)
end
return file
module Latin1Conv
require 'cgi'
LATIN1_CONVERT_TABLE = {
' ' => ' ',
'¡' => '¡',
'¢' => '¢',
'£' => '£',
'¤' => '¤',
# -*- coding: utf-8 -*-
require 'date'
require 'monitor'
WAIT_TIME = 10
class BDALogger
attr_accessor :today, :logfile
ティップ
Giga Pointsがいいらしい
バレル
真鍮(ブラス)は飲み食いしながらはマズそう
安いのいくつか買うべき?
グリップ力の違い
*グリップ弱いほうが好みそう
形状による感覚の違い
細く長い: 重く感じる
ぐちゃぐちゃなコードは開発を遅くする
生産性を守るためにはコードを常に綺麗な状態に保つ
書くのは1回、読むのは何回も
2章 意味のある名前
意図が明確な名前にする
なぜそれが存在するのか、何をするのか、どのように使用するのか
もし名前に解説が必要なら、意図が明確な名前ではない
int d //日単位の経過時間
require 'formula'
class Nano <Formula
url 'http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz'
homepage 'http://www.nano-editor.org/'
md5 '03233ae480689a008eb98feb1b599807'
depends_on 'ncursesw'
def install
repos = [
'~/dotfiles',
'~/termtter',
'~/privaterepos',
'~/pokutuna_misc',
'~/btproject',
'~/scala-query',
'~/Documents/scala-collections-impl-doc-ja',
'~/Documents/scala-actors-doc-ja',
# -*- coding: utf-8 -*-
raise ArgumentError unless ARGV.size >= 2
def prompt(message)
puts "#{message} [Y/n]"
answer = STDIN.gets.chomp
answer == 'Y' ? true : false
end
# -*- coding: utf-8 -*-
@turu = { :head => 1, :leg => 2, :wing => 2 }
@kame = { :head => 1, :leg => 4, :wing => 0 }
@tonbo = { :head => 1, :leg => 6, :wing => 4 }
raise ArgumentError if [@turu, @kame, @tonbo].any? { |a| a[:head] != 1 }
def calc(head, leg, wing)
(0..head).each do |t|