Skip to content

Instantly share code, notes, and snippets.

View masuidrive's full-sized avatar

Yuichiro MASUI masuidrive

View GitHub Profile
@masuidrive
masuidrive / render_filter.rb
Last active January 3, 2016 18:19
viewが実行される前にアクションを差し込むbefore_renderフィルタ。 app/controllers/concerns/下に置いてお使いください。
module RenderFilter
extend ActiveSupport::Concern
included do
define_callbacks :process_render
end
public
def render(*args)
run_callbacks :process_render do
@masuidrive
masuidrive / geohash4jp.csv
Created June 12, 2013 13:33
geohash 4桁の市区町村マップ
wu24 24.345703125 123.92578125 沖縄県 八重山郡 竹富町 47381
wudv 26.279296875 127.79296875 沖縄県 中頭郡 中城村 47328
wuep 26.630859375 128.14453125 沖縄県 国頭郡 東村 47303
wvh1 28.388671875 129.55078125 鹿児島県 奄美市 46222
wvku 30.322265625 130.60546875 鹿児島県 熊毛郡 屋久島町 46505
wvmj 30.498046875 130.95703125 鹿児島県 熊毛郡 中種子町 46501
wvmn 30.673828125 130.95703125 鹿児島県 西之表市 46213
wvsc 31.201171875 130.60546875 鹿児島県 指宿市 46210
wvt1 31.201171875 130.95703125 鹿児島県 肝属郡 肝付町 46492
wvsd 31.376953125 130.25390625 鹿児島県 南さつま市 46220
// 取得するJSONのURL
var url = "http://api.openweathermap.org/data/2.5/weather?lat=35.65858&lon=139.745433";
// データを保存するシート
var data_sheet_name = 'data';
// アップデートするチャートの名前
var chart_sheet_name = 'charts';
var chart_name = 'Temps';
@masuidrive
masuidrive / gist:5320809
Created April 5, 2013 16:50
mruby-tracer spec
Tracer.server PORT, HOST, :wait => true
Tracer.client PORT, HOST, :wait => true
@masuidrive
masuidrive / view.rb
Created March 30, 2013 13:57
Proposal MobiRuby APIs
app.on(:resume) do
...
end
# app code
tableView = TableView.new
tableView.on(:select) do |v|
...
end
tableView.on(:cell) do |v, index|
@masuidrive
masuidrive / gist:5231110
Created March 24, 2013 08:45
clang options
OVERVIEW: LLVM 'Clang' Compiler: http://clang.llvm.org
USAGE: clang -cc1 [options] <inputs>
OPTIONS:
-### Print the commands to run for this compilation
--analyze Run the static analyzer
--migrate Run the migrator
--relocatable-pch Build a relocatable precompiled header
--serialize-diagnostics <value>
@masuidrive
masuidrive / gist:5169096
Created March 15, 2013 11:11
nodeとmrubyのissuesとcommentsの単語分布
1, this, 17544
2, that, 15950
3, have, 9742
4, with, 9584
5, http, 8688
6, node, 6024
7, should, 5743
8, error, 4285
9, test, 4209
10, work, 4175
@masuidrive
masuidrive / get_mrubysize.rb
Last active December 14, 2015 18:28
Process of bin/mruby size
#!/usr/bin/env ruby
# result
# https://docs.google.com/spreadsheet/ccc?key=0AldcEqcUVyo4dGZNOE9fTlE0YkZ2U2NTSF9jTmlJbkE&usp=sharing
require 'date'
filesizes = []
date = Date.new(2012,5,1)
while date < Date.today
@masuidrive
masuidrive / gist:5020507
Created February 23, 2013 17:13
Generate iOS Xcode project
# -*- coding: utf-8 -*-
#
require 'rubygems'
require 'xcodeproj'
FRAMEWORKS = %w{
AudioToolbox
CFNetwork
CoreGraphics
CoreLocation
@masuidrive
masuidrive / gist:4495001
Last active December 10, 2015 21:28
mruby_build.rake
class Command
def initialize(default_options = {})
...
end
def run(options, params={})
...
end
end