aws s3 sync s3://mybucket .
Using FTP to backup a large S3 bucket is slow. That's because FTP creates a new request for each file, downloads the file, and closes the request. That adds a lot of time to your download.
| # Want to show hidden files and folders in your TextMate project drawer? Simple, just modify the file and folder patterns in TextMate's preferences. | |
| # Instructions: | |
| # Go to TextMate > Preferences... | |
| # Click Advanced | |
| # Select Folder References | |
| # Replace the following: | |
| # File Pattern |
| # Add this to config/environments/development.rb | |
| # Limit your development log file to 5 MB | |
| config.logger = Logger.new(config.paths["log"].first, 1, 5242880) # 5 megabytes |
| # So you have a collection of records you want to display in rows of 3. | |
| # Use Enumerable's each_slice method: | |
| <%= content_tag :div, :class => :thumbs do %> | |
| <% @thumbs.each_slice(3) do |slice| %> | |
| <%= content_tag :div, :class => :thumbs_row do %> | |
| <% slice.each do |thumb| %> | |
| <%= render 'thumb' %> | |
| <% end %> |
aws s3 sync s3://mybucket .
Using FTP to backup a large S3 bucket is slow. That's because FTP creates a new request for each file, downloads the file, and closes the request. That adds a lot of time to your download.
| # Load Twitter Widgets | |
| window.twttr = ((d, s, id) -> | |
| js = undefined | |
| fjs = d.getElementsByTagName(s)[0] | |
| unless d.getElementById(id) | |
| js = d.createElement(s) | |
| js.id = id | |
| js.src = "//platform.twitter.com/widgets.js" | |
| fjs.parentNode.insertBefore js, fjs | |
| window.twttr || t = { _e: [], ready: (f)-> t._e.push(f) } |
| # Gemfile | |
| gem 'rails', '4.0.0' | |
| gem 'pg' | |
| gem 'sass-rails', '~> 4.0.0' | |
| gem 'compass-rails', github: 'Compass/compass-rails', branch: 'rails4-hack' | |
| gem 'uglifier', '>= 1.3.0' | |
| gem 'coffee-rails', '~> 4.0.0' | |
| # etc... | |
| # config/initializers/compass.rb |
| rm -rf ~/Library/Application\ Support/TextMate/Cache/* |
| // Simple SCSS mixin for adding colored bullets to your <li> elements | |
| @mixin colored-bullet($color){ | |
| list-style:none; | |
| text-indent:-19px; // Adjust the text-indent to your specific needs based on your font-size and the typeface you're using | |
| &:before{ | |
| content:"\002022\00a0\00a0\00a0"; // Add a bullet character and three spaces before your <li> content starts | |
| color:$color; // Add color to the bullet | |
| } | |
| } |
| if reflection.options[:conditions] | |
| reflection_table = (reflection.options[:class_name] || reflection.options[:source] || reflection.name).gsub('::', '_').tableize | |
| if reflection.options[:conditions].to_s.include?("#{reflection_table}") | |
| send(through.name).select("DISTINCT #{through.quoted_table_name}.#{primary_key}").joins(reflection.options[:source]).where(reflection.options[:conditions]).map! { |r| r.send(primary_key) } | |
| else | |
| send(through.name).select("DISTINCT #{through.quoted_table_name}.#{primary_key}").where(reflection.options[:conditions]).map! { |r| r.send(primary_key) } | |
| end | |
| else | |
| send(through.name).select("DISTINCT #{through.quoted_table_name}.#{primary_key}").map! { |r| r.send(primary_key) } |
| # Validator: | |
| # /app/validators/date_validator.rb | |
| class DateValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| unless value.to_s =~ /^\d{4}-\d{2}-\d{2}$/i | |
| record.errors[attribute] << (options[:message] || "is an invalid date") | |
| end | |
| end | |