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 'rubygems' | |
require 'spec' | |
require 'spec/autorun' | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.app = proc { |env| [200, {}, "Hello World"]} | |
Spec::Runner.configure do |config| | |
config.include Capybara |
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 | |
# Written by Kieran P | |
# http://github.com/KieranP | |
# http://twitter.com/k776 | |
# http://k776.tumblr.com | |
# | |
# Feel free to fork and modify. | |
# If you do, send me a message on | |
# Github details changes and I'll |
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
body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;background-color:#E6E0D9;} | |
body a{color:#336699;} | |
body h2{padding-bottom:12px;font-weight:bold;} | |
body h3{padding-bottom:10px;} | |
#container{width:80%;margin:20px auto;overflow:hidden;} | |
#header{background-color:#900209;padding:30px 10px 20px 10px;border-bottom:2px solid #EC9A94;overflow:hidden;} | |
#header h1{float:left;color:#ECEBC3;font-size:2.3em;font-weight:bold;} | |
#header ul.menu{margin-left:80px;margin-top:10px;float:left;overflow:hidden;} | |
#header ul.menu li{float:left;margin-right:20px;padding-bottom:5px;} | |
#header ul.menu li a{font-size:1.2em;color:#DFF6FC;text-decoration:none;} |
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 'test_helper' | |
class Shop < ActiveRecord::Base | |
end | |
class ItemDetail < ActiveRecord::Base | |
set_primary_key :id | |
data_miner do | |
import 'A csv file with no identifier', :url => 'http://imports.s3.amazonaws.com/products_no_id.csv', :errata => 'http://spreadsheets.google.com/pub?key=tF58sAgqkY214EFBMdYCIUw', :delimiter => ';' do |
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
# | |
# node ---------------> ~/.nvm/<node-version>/bin/node | |
# node-libraries -----> ~/.node_libraries | |
# node-binaries ------> ~/.node_binaries | |
# | |
aptitude install g++ curl libssl-dev apache2-utils make | |
git clone git://github.com/creationix/nvm.git ~/.nvm | |
vi ~/.bashrc | |
NVM_DIR=$HOME/.nvm | |
. $NVM_DIR/nvm.sh |
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
#config/initializers/carrierwave.rb | |
CarrierWave.configure do |config| | |
if Rails.env.production? or Rails.env.development? | |
config.storage :cloud_files | |
config.cloud_files_username = "your_username" | |
config.cloud_files_api_key = "your_key" | |
config.cloud_files_container = "test" | |
config.cloud_files_cdn_host = "c0012345.cdnn.cloudfiles.rackspacecloud.com" | |
def store_dir |
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 ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
def store_dir | |
if "#{version_name}" == "" | |
"images/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/#{model.name_file_name}" | |
else | |
"images/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}/#{version_name}_#{model.name_file_name}" |
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
Copyright (c) 2011 YOUR_NAME_HERE, YOUR_URL_HERE | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including | |
without limitation the rights to use, copy, modify, merge, publish, | |
distribute, sublicense, and/or sell copies of the Software, and to | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: | |
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
#!/bin/bash | |
APP_NAME="your-app-name-goes-here" | |
APP_PATH=/home/deploy/${APP_NAME} | |
# Production environment | |
export RAILS_ENV="production" | |
# This loads RVM into a shell session. Uncomment if you're using RVM system wide. | |
# [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" |
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 Product < ActiveRecord::Base | |
has_many :material_product_mappings, :dependent => :destroy, :inverse_of => :product | |
has_many :materials, :through => :material_product_mappings, :autosave => true | |
#... | |
rails_admin do | |
list do | |
field :material_product_mappings do |