Skip to content

Instantly share code, notes, and snippets.

# Uses https://github.com/chrishunt/rubiks-cube
# $ gem install rubiks_cube
# $ ruby exOLL.rb
#
require 'rubiks_cube'
class RubiksCube::Cube
# SOLVED_STATE = %w(
# UF UR UB UL FL FR BR BL DF DR DB DL UFL URF UBR ULB DLF DFR DRB DBL
f = fn(a){ fn(b){ b }}
myif = fn(p){ fn(a){ fn(b){ p(a)(b) }}}
print(inspect(myif(t)(1)(2)))
@yhara
yhara / a.rb
Last active August 29, 2015 14:07
Dijkstra search implemented in Ruby
MAP = "
*************
* S *
* ** * *** *
** * * **
* **** * ***
* * ** * ***
* * ** * ***
* * * *G *
* *
@yhara
yhara / rub
Created October 16, 2014 10:18
Never mind the annoying typo (eg. $ rub y-e 'p 1' just works as you want)
#!/usr/bin/env ruby
s = ARGV.join(' ')
if s[0] != "y"
puts "usage: rub y-v"
else
exec "ruby #{s.sub(/^./, '')}"
end
@yhara
yhara / gist:c18b6b22f870b3037b1d
Last active August 29, 2015 14:08
「プログラミング言語の基礎理論」を読む
#!/usr/bin/env ruby
#
# `git pr-get 37` => Fetch Pull Resuest #37 and create branch `pr-37`
#
# Requirements:
# Ruby
#
# Install:
# $ chmod +x git-pr-get
# $ mv git-pr-get (somewhere listed in PATH)
@yhara
yhara / a.md
Last active August 29, 2015 14:16
  • a

  • #b c

# twitter gem 5.x
# https://apps.twitter.com/
#
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "..."
config.consumer_secret = "..."
config.access_token = "..."
config.access_token_secret = "..."
end
持ってる? 種類 名前 メイン ブランド 付きやすい 付きにくい 初期スロット数
アタマ スカッシュバンド 攻撃力アップ アイロニック スーパージャンプ時間短縮 復活時間短縮 1
アタマ サムライヘルメット 攻撃力アップ amiibo 2
アタマ ダイバーゴーグル 攻撃力アップ フォーリマ スペシャル時間延長 インク効率アップ(サブ) 2
アタマ ヤコメッシュ 防御力アップ ヤコ スペシャル増加量アップ スペシャル時間延長 1
アタマ スプラッシュゴーグル 防御力アップ フォーリマ スペシャル時間延長 インク効率アップ(サブ) 2
アタマ パワードマスク 防御力アップ amiibo 2
アタマ ショートビーニー インク効率アップ(メイン) シグレニ 防御力アップ 攻撃力アップ 1
アタマ スタジオヘッドホン インク効率アップ(メイン) フォーリマ スペシャル時間延長 インク効率アップ(サブ) 2
アタマ サファリハット インク効率アップ(メイン) ホッコリー インク効率アップ(サブ) インク回復力アップ 3
@yhara
yhara / zipper.rb
Created August 7, 2008 07:41
Ruby implementation of Zipper (and its spec)
#
# Zipper has @left and @right.
# When a zipper represents [1, 2, 3, <cursor>, 4, 5],
# @left == [3, [2, [1, []]]], @right == [4, [5, []]]
# Note that @left is in reverse order.
#
class Zipper
include Enumerable
def self.make(*vals)