Skip to content

Instantly share code, notes, and snippets.

View eiel's full-sized avatar

HIMURA Tomohiko eiel

View GitHub Profile
<?php
namespace RadioControllerCar;
/* ラジコンの抽象クラス */
interface CarInterface
{
public function send($message);
}
@eiel
eiel / random_problem.rb
Last active May 3, 2016 01:57 — forked from Nyoho/random_problem.rb
重複のない整数対の配列を作る
def random_problem(n)
a = [*1..5]
a.product(a)
.shuffle[0..n]
.each do |e0, e1|
puts "$#{e0} + #{e1} = $ \n\n \\vfill"
end
end
/*
* Adds the serialNumber property to the UIDevice class
*
* The implementation uses undocumented (for iOS) IOKit functions,
* so handle with caution and be prepared for nil.
*/
#import <UIKit/UIDevice.h>
@interface UIDevice (serialNumber)
@eiel
eiel / player_02.5.2.rb
Last active December 12, 2015 08:59 — forked from Shinpeim/player_02.rb
https://gist.github.com/Shinpeim/4745446 へ変化するコードなのだけど、リファクタリング的にみると飛躍があってその中間をかくとどうなるか。 というのを考えてみる。パターン2。 いきなりStateパターンへの方向転換を試みる。コピペして修正。という流れになる。 これもStateパターンと名前がついてる方向があるので迷わず済むのかなー。リファクタリングのステップを検討するのはなかなか面白い。
# -*- coding: utf-8 -*-
class Player
class Normal
# move の内容をもってきて、いらない caseを削除
# return を追加
# x_speed, y_speed を展開すれば 03のコードに向う
def move(direction, position)
x_speed = 10
y_speed = 10
@eiel
eiel / player_02.5.rb
Last active December 12, 2015 08:59 — forked from Shinpeim/player_02.rb
https://gist.github.com/Shinpeim/4745446 へ変化するコードなのだけど、リファクタリング的にみると飛躍があってその中間をかくとどうなるか。 というのを考えてみる。パターン1。 なかなか興味深くて、こういうプログラムをかける人はレアな気がする。 故にStateパターンと名前がついてる方向があるので迷わず済むのかなとか思った。 蛇足だけど、 @moving_mode には Rubyなら普通は シンボルを突っ込む気がする。
# -*- coding: utf-8 -*-
class Player
attr_reader :position
# Cで言うenum的なやつ
module MOVING_MODE
NORMAL = 1
FAST = 2
KANI = 3 #蟹モードが増えた
end
var links = document.getElementsByTagName("a");
for ( var i = 0 ; i < links.length ; i++ ){
(function() {
var n = i;
var link = links[i];
link.href = "#";
link.onclick = function(){ alert( n ) };
link.innerHTML = n;
})()
(custom-set-variables
'(org-display-custom-times t)
'(org-time-stamp-custom-formats (cons (concat "<%Y/%m/%d " (substring (current-time-string) 0 3) ">")
(concat "<%Y/%m/%d " (substring (current-time-string) 0 3) " %H:%M>")))
)
;;; 訂正版
(custom-set-variables
'(org-time-stamp-custom-formats (quote ("<%Y/%m/%d %a>" . "<%Y/%m/%d %a %H:%M>")))
)