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
$("*[contenteditable]").live({ | |
blur: function(){ | |
var model = $(this).attr("data-model"), | |
attribute = $(this).attr("data-attribute") || $(this).attr("class"), | |
value = $(this).text(), | |
path = $(this).attr("data-path"), | |
updateData = {}; | |
updateData[model] = {}; | |
updateData[model][attribute] = value; | |
$.ajax({ |
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
TITLEBAR="\[\e]0;\u@\h \w\007\]" | |
export PS1='\[\e]0;\u@\h \w\007\]\ | |
\[\e[0;32m\]\u@\h\[\e[0m\] \ | |
\[\e[1;34m\]\w\[\e[0m\]\ | |
\[\e[1;35m\]$(__git_ps1)\[\e[0m\] \ | |
\[\e[1;37m\]$\[\e[0m\] ' |
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 'spec_helper' | |
require 'carrierwave/test/matchers' | |
describe CoverArtUploader do | |
include CarrierWave::Test::Matchers | |
before do | |
CoverArtUploader.enable_processing = true | |
@uploader = CoverArtUploader.new(CoverArt.create, :image) | |
@uploader.store!(File.open("#{Rails.root}/spec/uploaders/fruit.jpg", "r")) |
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
CarrierWave.configure do |config| | |
config.fog_credentials = { | |
:provider => 'AWS', | |
:aws_access_key_id => ENV['S3_KEY'], | |
:aws_secret_access_key => ENV['S3_SECRET'] | |
} | |
config.fog_directory = 'superfuntimes' | |
config.fog_host = 's3.amazonaws.com' # optional, defaults to nil | |
config.fog_public = true # optional, defaults to true | |
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} |
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
# encoding: utf-8 | |
class CoverArtUploader < CarrierWave::Uploader::Base | |
# Include RMagick or ImageScience support: | |
# include CarrierWave::RMagick | |
# include CarrierWave::ImageScience | |
# Choose what kind of storage to use for this uploader: | |
# storage :file |
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
Fog.credentials_path = Rails.root.join('config/fog_credentials.yml') | |
CarrierWave.configure do |config| | |
config.permissions = 0666 | |
config.fog_credentials = { provider: 'AWS' } | |
config.fog_directory = 'buckets-r-us' | |
# config.fog_host = 's3.amazonaws.com' # optional, defaults to nil | |
config.fog_public = true # optional, defaults to true | |
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {} |
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
Fog.mock! | |
Fog.credentials_path = Rails.root.join 'config/fog_credentials.yml' | |
connection = Fog::Storage.new provider: 'AWS' | |
connection.directories.create key: 'buckets-r-us' |
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
default: | |
aws_access_key_id: <%= ENV['S3_KEY'] %> | |
aws_secret_access_key: <%= ENV['S3_SECRET'] %> |
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 'spec_helper' | |
require 'carrierwave/test/matchers' | |
describe CoverArtUploader do | |
include CarrierWave::Test::Matchers | |
before do | |
@uploader = CoverArtUploader.new(CoverArt.create, :image) | |
@uploader.store!(File.open("#{Rails.root}/spec/uploaders/fruit.jpg", "r")) | |
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
context "widget" do | |
setup do | |
@request.stubs(:cookies).returns(@request.cookie_jar) | |
end | |
should "have sensible defaults" do | |
widget = widget 'title' do | |
haml_concat('this is my content') | |
end | |
assert_match %r{<section class='widget'><div class='widget'><header><a tabindex='0' title='click to show/hide'><h3>}, widget | |
assert_match %r{<h3>title</h3>}, widget |