Skip to content

Instantly share code, notes, and snippets.

@take
take / InfoPlist.strings
Last active December 17, 2015 16:09 — forked from mps/InfoPlist.strings
/* Localized versions of Info.plist keys */
"Credits" = "クレジット";
"Here are some great libraries I used to create this application:" = "これらの素晴らしいライブラリを使ってこのアプリを開発しました:";
"About" = "このアプリについて";
"Thank You" = "ありがとう";
"Thank you to the amazing team at GitHub for creating a great product, without their hard work, none of this would have been possible." = "GitHub社の皆さんにお礼を言いたいと思います。GitHubのスタッフの大変な苦労が無ければ、このようなアプリは作れませんでした。";
"About the Developer" = "このアプリのデベロッパーについて";
"Icon Design" = "アイコンのデザイン";
@take
take / database.yml
Created January 3, 2013 11:06
database.yml mysql adapter
<%
socket = ["/tmp/mysqld.sock",
"/tmp/mysql.sock",
"/var/run/mysqld/mysqld.sock",
"/var/lib/mysql/mysql.sock",
"/opt/local/var/run/mysql5/mysqld.sock"
].detect{|socket| File.exist?(socket)}
%>
development:
@take
take / gist:4078932
Created November 15, 2012 14:38
ruby-lang.org
# Ruby knows what you
# mean, even if you
# want to do math on
# an entire Array
cities = %w[ London
Oslo
Paris
Amsterdam
Berlin ]
visited = %w[Berlin Oslo]
@take
take / spec_helper.rb
Created October 9, 2012 16:33 — forked from pauljamesrussell/spec_helper.rb
RSpec matcher for ensuring a model is accepting nested attributes for an association, and accepting/rejecting the right values.
# Use: it { should accept_nested_attributes_for(:association_name).and_accept({valid_values => true}).but_reject({ :reject_if_nil => nil })}
RSpec::Matchers.define :accept_nested_attributes_for do |association|
match do |model|
@model = model
@nested_att_present = model.respond_to?("#{association}_attributes=".to_sym)
if @nested_att_present && @reject
model.send("#{association}_attributes=".to_sym,[@reject])
@reject_success = model.send("#{association}").empty?
end
model.send("#{association}").clear
@take
take / gist:3849060
Created October 7, 2012 17:50
rails, about master data
Takehiro: like theres a table which contains all the state ( = states table )
Takehiro: and theres User table
Takehiro: which contains state_id
Takehiro: when u create a new user, u need to get all the state data to show a select box or something right
pduersteler: Takehire yes. for that you can provide a :collection to your select
Takehiro: oh
Takehiro: kk thx :P
pduersteler: :)
Takehiro: so if i provide :collection to my select, when i do @user = User.new
Takehiro: i get all the data from states aswell?
# Description:
# tanshiba
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands: