Skip to content

Instantly share code, notes, and snippets.

View myokoym's full-sized avatar
💭
hi

Masafumi Yokoyama myokoym

💭
hi
View GitHub Profile
@myokoym
myokoym / 5374-sources.rb
Last active August 29, 2015 14:06
札幌市のゴミの日データを生成するRubyスクリプト(作成中) https://github.com/myokoym/5374
module Gominashi
SOURCES = [
{
name: "chuo_1",
areas: [
"中央区 南4条西7丁目・8丁目(南4条通の南側のみ),札幌センター1",
"中央区 南5条~8条の西7丁目・8丁目,札幌センター1",
"中央区 南9条西4丁目~6丁目(南9条通の南側のみ),札幌センター1",
"中央区 南9条西7丁目~12丁目,札幌センター1",
"中央区 南10条~13条の西5丁目~12丁目,札幌センター1",
@myokoym
myokoym / groonga-database-viewer-gtk.rb
Last active August 29, 2015 14:04
RroongaとRuby/GTK2を使った、Groonga用のDBビューアー(試作中)。DBのパスを指定するだけで、レコード内容をテーブルごとに一覧表示する。検索やソートもできる。
require "groonga"
require "gtk2"
class Window < Gtk::Window
def initialize(db_path)
super()
set_default_size(640, 480)
@grn_database = Groonga::Database.open(db_path)
signal_connect("destroy") do
@grn_database.close unless @grn_database.closed?
require "clutter"
require "gdk_pixbuf2"
module Pixlutter
class Window
attr_reader :files
def initialize(file)
@files = [file]
@stage = create_stage
@box = create_box(@stage)
function fib(n) {
var a = 0;
var b = 1;
for (var i = 0; i < n; i++) {
var _a = a;
a = b;
b = _a + b;
}
return a;
}
% git pull
remote: Counting objects: 127, done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 42 (delta 33), reused 0 (delta 0)
Unpacking objects: 100% (42/42), done.
From git://toshia.dip.jp/mikutterなんぞ
7aed49a..0790823 master -> origin/master
7aed49a..0790823 develop -> origin/develop
* [new branch] hotfix/3.0 -> origin/hotfix/3.0
* [new tag] 3.0.1 -> 3.0.1
@myokoym
myokoym / rice.rb
Last active August 29, 2015 14:02
require "cairo"
# http://www.dafont.com/ubuntu-title.font
FONT = "Ubuntu-Title"
# http://www.dafont.com/fifa-welcome.font
#FONT = "FIFA Welcome"
def draw(context, width, height, text)
context.save do
context.set_source_color(:black)
@myokoym
myokoym / bowl.rb
Last active August 29, 2015 14:02
I'm trying to draw a bowl by rcairo.
require "cairo"
def draw_bowl(context, width, height)
context.save do
context.set_source_color(:black)
context.scale(width, height)
context.line_width = 0.01
fill_inner(context)
fill_outer(context)
@myokoym
myokoym / hidoka.rab
Created May 29, 2014 02:39
ひどか(仮)
= ひどか(仮)
= ひどかとは
* 「ひ」とり
* 「ど」くしょ(読書)
* 「か」い(会)
= 読書とは
require "test-unit"
class RegexpTest < Test::Unit::TestCase
def setup
@regexp = /\bCairo(?:::[A-Z][\w\d_]+)*(?:[#.][\[_@\w\d]*(?:[=?!_*+\-\]]|\b)|\b)/
end
def test_front
line = "Cairo::Contextはrcairoで描画するときに使用する主要なオブジェ\n"
assert_equal(["Cairo::Context"], line.gsub(@regexp).to_a)
@myokoym
myokoym / cairo-graph.rb
Last active August 29, 2015 14:01
This script automatically generates a graph. Using rcairo ( http://rcairo.github.io/ ).
require "cairo"
module Cairo
class Context
def show_graph(graph)
graph.draw(self)
end
end
class Graph