Skip to content

Instantly share code, notes, and snippets.

Avatar

Masakuni Kato mackato

View GitHub Profile
@mackato
mackato / devise_preview.rb
Created Mar 10, 2014
Rails 4.1.0.rc1でdeviseのメールをプレビューする ref: http://qiita.com/mackato/items/3f1e8b78fc80164ddcd6
View devise_preview.rb
class DevisePreview < ActionMailer::Preview
def confirmation_instructions
Devise::Mailer.confirmation_instructions(User.new, Devise.friendly_token[0,20])
end
end
View as3-commons-maven-repository.xml
<!--
as3-commons repository
@see http://code.google.com/p/as3-commons/source/browse/trunk/pom.xml
-->
<repository>
<id>yoolab.org-releases</id>
<url>http://dev.yoolab.org/maven/content/repositories/releases/</url>
<releases>
<enabled>true</enabled>
</releases>
View server.rb
require 'rubygems'
require 'sinatra'
use Rack::Static, :urls => ["/images"], :root => "src/public"
View rails_3.0.0.beta3_rspec_2.patch
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/te
index 34499fa..aed493a 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -18,6 +18,7 @@ module ActionController
ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, fi
path = payload[:layout]
+ @layouts ||= Hash.new(0)
@layouts[path] += 1
View mongoid_sord_by_id.rb
Person.order_by([[:_id, Mongo::DESCENDING]])
@mackato
mackato / eeepub_maker_assets_subdir.diff
Created Jun 4, 2010
EeePub maker.rb assets subdir diff
View eeepub_maker_assets_subdir.diff
78c78,79
< FileUtils.cp(file, dir)
---
> FileUtils.mkdir_p(File.join(dir, file[:dir])) if file[:dir]
> FileUtils.cp(file[:path], File.join(dir, (file[:dir] || '')))
98c99,101
< :manifest => @files.map{|i| File.basename(i)},
---
> :manifest => @files.map{|i|
> i[:dir] ? File.join(i[:dir], File.basename(i[:path])) : File.basename(i[:path])
@mackato
mackato / docrails_guides_epub.diff
Created Jun 4, 2010
Ruby on Rails Guides ePub diff
View docrails_guides_epub.diff
diff --git a/railties/guides/assets/stylesheets/main.css b/railties/guides/assets/stylesheets/main.css
index bab0b7a..5889d24 100644
--- a/railties/guides/assets/stylesheets/main.css
+++ b/railties/guides/assets/stylesheets/main.css
@@ -72,20 +72,20 @@ table th {
--------------------------------------- */
body {
- text-align: center;
- font-family: Helvetica, Arial, sans-serif;
View insert_new_section_or_row_to_tableview.m
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
if (newSectionIndex != nil)
[self.tableView insertSections:newSectionIndex
withRowAnimation:UITableViewRowAnimationFade];
else
[self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
withRowAnimation:UITableViewRowAnimationFade];
@mackato
mackato / coredata.rb
Created Sep 20, 2010
ruby coredata access class
View coredata.rb
require 'rubygems'
require 'sqlite3'
class Coredata
attr_accessor :db
def initialize(app_name)
pattern = File.join("#{ENV['HOME']}",
"/Library/Application Support/iPhone Simulator/*",
"/Applications/*/Documents/#{app_name}.sqlite")
@mackato
mackato / git-jira-post-commit.rb
Created Sep 26, 2010
Git post commit hook for JIRA.
View git-jira-post-commit.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'jira4r'
$KCODE = 'u'
config = {}
log = {}
open("|git config --list | grep 'jira.*=*'").each_line do |line|