Skip to content

Instantly share code, notes, and snippets.

View hidakatsuya's full-sized avatar
🏡
Working from home

Katsuya HIDAKA hidakatsuya

🏡
Working from home
View GitHub Profile
@hidakatsuya
hidakatsuya / README.md
Last active August 29, 2015 13:56
ThinReports でテキストを回転させるハック

ThinReports でテキストを回転させる

動作確認環境

  • ThinReports 0.7.6
  • Ruby 1.9.3, 2.0
  • Rails 3.2, 4.0

準備

@hidakatsuya
hidakatsuya / Capifile
Created March 25, 2014 17:20
Capistrano3 で deploy_via :copy する ref: http://qiita.com/hidakatsuya/items/4d097416516afc229199
$:.unshift File.expand_path(File.dirname(__FILE__) + '/lib') # << 必ず先頭に追加
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
# :
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
@hidakatsuya
hidakatsuya / foo_controller.rb
Created May 1, 2014 18:06
CSV や Excel 等のエクスポート処理の終了を検知して JavaScript で何かする方法 ref: http://qiita.com/hidakatsuya/items/1b970d17ecb016dddec7
class FooController < ApplicationController
def export
csv_data = CSV.generate do |csv|
# (CSV データを作る処理)
end
# exported という名前で cookie を作成
cookies[:exported] = { value: 'yes', expires: 1.minutes.from_now }
send_data csv_data, disposition: 'attachment',
@hidakatsuya
hidakatsuya / result.txt
Last active August 29, 2015 14:04
ThinReports Test
Result: Avg. 89 seconds
$ ruby test.rb
user system total real
81.500000 0.320000 81.820000 ( 81.891870)
$ ruby test.rb
user system total real
93.640000 0.540000 94.180000 ( 95.164552)
$ ruby test.rb
user system total real
@hidakatsuya
hidakatsuya / class-based-implementation.md
Last active August 29, 2015 14:04
Thinreports の新しい API を考える

クラスベースの実装

Generator API が使いにくい問題の解決策として、クラスベースの実装方法を考える。 なお、クラスベースでの利用は Generator の当初の設計思想に含まれているが、現状ではいろいろ足りていない。

注意: 下記コードは、実装の提案のためのものであり、実際に動作するものではない。

Report 定義

// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@hidakatsuya
hidakatsuya / gist:0c896b0ba4da9c133fa0
Created August 25, 2014 03:46
Git の remote origin URL を変更する
$ git remote set-url origin git@git.example.com:foo/bar.git
@hidakatsuya
hidakatsuya / list-of-problem.md
Last active August 29, 2015 14:17
Problem of thinreports-generator internal
  • Shape::Interface/Internal な実装(分ける必要なし)
  • Shape::List の実装が全体的にダメ
  • Report::Base.generate の引数が混沌としすぎ generator: {}, report: {}
@hidakatsuya
hidakatsuya / setup.md
Created July 15, 2015 18:05
db:migrate しない Rails アプリでテスト DB を準備する
$ rake db:schema:dump
$ rake db:test:prepare
@hidakatsuya
hidakatsuya / thinreports-php-addPage-API.md
Last active September 7, 2015 08:02
Report#addPage でレイアウトファイルを指定するときの仕様案

はじめに

これは thinreports-php の v0.8.0 で実装される複数レイアウト機能の API の仕様案。 以下の仕様を踏まえて「ver-A.php」「ver-B.php」のどちらの案が良いか検討。

仕様

複数ファイルの仕様

  • Thinreports\Report のコンストラクタで指定されたレイアウトは、デフォルトレイアウトとなる