Skip to content

Instantly share code, notes, and snippets.

@atog
atog / .gitignore
Created September 17, 2008 11:04
Backup your iTunes library to Amazon S3
itunes-s3.yml
@janv
janv / add_attachment_data_to_wrapper.rb
Created November 2, 2009 16:30 — forked from Traz/add_attachment_data_to_wrapper.rb
Small tips for building a polymorphic usage of Paperclip, with video to flv, video thumbnail, mp3 tag extraction, zip file listing processors.
class AddAttachmentsDataToWrapper < ActiveRecord::Migration
def self.up
add_column :wrappers, :data_file_name, :string
add_column :wrappers, :data_content_type, :string
add_column :wrappers, :data_file_size, :integer
add_column :wrappers, :data_updated_at, :datetime
end
def self.down
remove_column :wrappers, :data_file_name
[paperclip] identify '-format' '%wx%h' '/tmp/stream,4458,0.JPG[0]' 2>/dev/null
[paperclip] convert '"/tmp/stream,4458,0.JPG[0]" -resize "x100" -crop "100x100+16+0" +repage "/tmp/stream,4458,0,4458,0[0]"' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the watermark for stream,4458,0>
[paperclip] identify '-format' '%wx%h' '/tmp/stream,4458,0.JPG[0]' 2>/dev/null
[paperclip] composite '-gravity Center /home/olek/projekty/shotmix/public/images/watermark.png "/tmp/stream,4458,0.JPG[0]" -resize "640x480>" "/tmp/stream,4458,0,4458,1[0]"' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::PaperclipError: There was an error processing the watermark for stream,4458,0>
@steffentchr
steffentchr / Combination version (not pretty, but functional)
Created October 30, 2010 06:11
Example on how to embed and interact with 23 Video players via JA API through both Flash and HTML5
<div id="videoContainer"></div>
<script src="http://stream.umbraco.org/resources/um/script/swfobject/swfobject.js"></script>
<script>
function getFlexApp(appName) {
if (navigator.appName.indexOf ("Microsoft") !=-1) {
@tomash
tomash / pulp_rate.rb
Created April 27, 2011 09:28
Spree shipping cost calculator
class Calculator::PulpRate < Calculator
preference :category1_rate, :decimal, :default => 0
preference :category2_rate, :decimal, :default => 0
preference :category3_rate, :decimal, :default => 0
preference :category4_rate, :decimal, :default => 0
preference :category5_rate, :decimal, :default => 0
WEIGHT_RANGES = {
0..350 => :preferred_category1_rate,
351..500 => :preferred_category2_rate,
@nicolasblanco
nicolasblanco / gist:1069378
Created July 7, 2011 12:07
Rails i18n framework for your meta tags

Rails i18n framework for your meta tags

Here is a convenient method for page titles and other meta tags.

One common solution is to use "yield" and some kind of helpers that would call content_for (like in this Railscasts).

The problem is that for Search Engines Optimization, you should change all your meta tags for every page to avoid duplicate content, and call your helpers on every page...

This workaround uses the i18n framework and tries to find the good tags depending on the page you are, so you don't have to call any helper by default.

@aronwoost
aronwoost / README.md
Created July 25, 2011 19:46
How to install LAMP on a EC2 Amazon AMI

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

@gonzedge
gonzedge / application_controller.rb
Created January 5, 2012 02:34
Rails 3.1 - Adding custom 404 and 500 error pages
class ApplicationController < ActionController::Base
# ...
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: lambda { |exception| render_error 500, exception }
rescue_from ActionController::RoutingError, ActionController::UnknownController, ::AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, with: lambda { |exception| render_error 404, exception }
end
private
def render_error(status, exception)
@rwest
rwest / README
Created January 9, 2012 16:42 — forked from symposion/README
Convert OS X Keychain exported entries into logins for 1Password import
These two files should help you to import passwords from mac OS X keychains to 1password.
Assumptions:
1) You have some experience with scripting/are a power-user. These scripts worked for me
but they haven't been extensively tested and if they don't work, you're on your own!
Please read this whole document before starting this process. If any of it seems
incomprehensible/frightening/over your head please do not use these scripts. You will
probably do something Very Bad and I wouldn't want that.
2) You have ruby 1.9.2 installed on your machine. This comes as standard with Lion, previous
versions of OS X may have earlier versions of ruby, which *may* work, but then again, they
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">