Skip to content

Instantly share code, notes, and snippets.

Avatar

Masakuni Kato mackato

View GitHub Profile
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"
@mackato
mackato / closure_singleton.as
Created Mar 26, 2010
ActionScript Singleton pattern
View closure_singleton.as
public class Singleton {
public static var getInstance:Function = function():Singleton {
var instance:Singleton = new Singleton();
getInstance = function():Singleton {
return instance;
};
return getInstance();
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 / 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;
@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 / rails_guides_to_epub.rb
Created Jun 4, 2010
Ruby on Rails Guides ePub convert ruby script
View rails_guides_to_epub.rb
require 'rubygems'
require 'nokogiri'
require 'eeepub'
DOC_TITLE = 'Ruby on Rails Guides'
def get_pages(src_dir)
index_file = File.join(src_dir, 'index.html')
section = nil
pages = [{ :section => section, :title => DOC_TITLE, :path => index_file }]
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")