This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cs_action_view.yml | |
cs: | |
number: | |
# Used in number_with_delimiter() | |
# These are also the defaults for 'currency', 'percentage', 'precision', and 'human' | |
format: | |
# Sets the separator between the units, for more precision (e.g. 1.0 / 2.0 == 0.5) | |
separator: "," | |
# Delimets thousands (e.g. 1,000,000 is a million) (always in groups of three) | |
delimiter: "," |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cs_active_support.yml | |
cs: | |
date: | |
formats: | |
# Use the strftime parameters for formats. | |
# When no format has been given, it uses default. | |
# You can provide other formats here if you like! | |
default: "%d. %m. %Y" | |
short: "%d. %m. %y" | |
long: "%A, %d. %B %Y" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cs_active_record.yml | |
cs: | |
activerecord: | |
errors: | |
# The values :model, :attribute and :value are always available for interpolation | |
# The value :count is available when applicable. Can be used for pluralization. | |
messages: | |
inclusion: "není obsaženo v seznamu možností" | |
exclusion: "je rezervováno a nemůže být zvoleno" | |
invalid: "je chybné" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LabeledFormBuilder < ActionView::Helpers::FormBuilder | |
%w[text_field collection_select select date_select password_field | |
text_area].each do |method_name| | |
alias :"plain_#{method_name}" :"#{method_name}" | |
# Define field helper without label | |
define_method(:"#{method_name}_without_label") do |field_name, *args| | |
field_content_tag(send(:"plain_#{method_name}", field_name, *args) + | |
field_error(field_name)) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Delete unnecessary files | |
run "rm README" | |
run "rm public/index.html" | |
run "rm -f public/javascripts/*" | |
## | |
# Download JQuery | |
run "curl -s -L http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js > public/javascripts/jquery.js" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# haml2erb | |
require 'rubygems' | |
require 'haml' | |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
files = Dir["app/stylesheets/**/*"] | |
files.each do |file_name| | |
next unless File.file?(file_name) | |
puts "- reading file #{file_name}" | |
content = open(file_name).read | |
tokens = content.scan(/(url\(.+\))/i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rack middleware. Strips unecessary whitespaces from HTML output. | |
class HtmlOutputStripper | |
def initialize(app, options = {}) | |
@app = app | |
end | |
def call(env) | |
status, headers, response = @app.call(env) | |
if headers["Content-Type"] =~ /text\/html|application\/xhtml\+xml/ | |
body = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Configures the git author to a list of developers when pair programming | |
# | |
# Usage: pair lm bh (Sets the author to 'Luke Melia and Bryan Helmkamp') | |
# pair (Unsets the author so the git global config takes effect) | |
# | |
# Author: Bryan Helmkamp (http://brynary.com) | |
####################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongomapper' | |
class Media | |
include MongoMapper::EmbeddedDocument | |
key :file, String | |
end | |
class Video < Media | |
key :length, Integer | |
end |
OlderNewer