This file contains hidden or 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
[['Apparel', 1036592],['Appliances', 2619525011],[ 'ArtsAndCrafts', 2617941011],[ 'Automotive', 15690151],[ 'Baby', 165796011],[ 'Beauty', 11055981],[ 'Books', 1000],[ 'Classical', 301668],[ 'Collectibles', 4991425011],[ 'DigitalMusic', 195208011],[ 'DVD', 2625373011],[ 'Electronics', 493964],[ 'ForeignBooks', ''],[ 'Garden', ''],[ 'GourmetFood', 3580501],[ 'Grocery', 16310101],[ 'HealthPersonalCare', 3760931],[ 'Hobbies', ''],[ 'Home', ''],[ 'HomeGarden', 285080],[ 'HomeImprovement', ''],[ 'Industrial', 228239],[ 'Jewelry', 3880591],[ 'KindleStore', 133141011],[ 'Kitchen', 1063498],[ 'Lighting', ''],[ 'Magazines', 599872],[ 'Miscellaneous', 10304191],[ 'MobileApps', 2350149011],[ 'MP3Downloads', 195211011],[ 'Music', 301668],[ 'MusicalInstruments', 11091801],[ 'OfficeProducts', 1084128],[ 'OutdoorLiving', 1063498],[ 'PCHa |
This file contains hidden or 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
pre. | |
Text here | |
Line in pre |
This file contains hidden or 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
# Let's create table 'content_types' that will store logic name of table,: Movies, Cities... | |
create_table :content_types do |t| | |
t.integer :user_id | |
t.string :name, :null => false | |
t.timestamps | |
end | |
add_index :content_types, [:user_id, :name], :unique => true | |
class ContentType |
This file contains hidden or 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
# Remove .svn from project | |
rm -rf `find . -type d -name .svn` |
This file contains hidden or 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
# helper method | |
def link_to_delete(title, url, options = {}) | |
options.merge!(:onclick => "return method_delete('Confirm Album Deletion', 'Are you sure you want to delete this album? There is no undo.', this);") | |
link_to title, url, options | |
end | |
# javascript function | |
function method_delete(title, text, context){ | |
var dialog = new Dialog(); | |
dialog.showChoice(title, text, 'OK', 'Cancel'); |
This file contains hidden or 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 ResizeImageError < StandardError;end | |
IMAGE_SIZE = "720x720>" | |
def resize_image | |
result_path = File.dirname(self.file_path) + "/#{self.user_id}_#{Time.now.to_i}_#{(rand * 10000000).to_i}.jpg" | |
cmd = %(convert -strip "#{self.file_path}" -resize "#{IMAGE_SIZE}" "#{result_path}") | |
output = `#{cmd}` | |
unless $?.exitstatus == 0 | |
raise ResizeImageError, "Error while resize image #{cmd}" | |
end |
This file contains hidden or 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
namespace :server do | |
desc "restart server" | |
task :restart do | |
system "thin restart -C /etc/thin/#{server_name}.yml" | |
end | |
desc "stop server" | |
task :stop do | |
system "thin stop -C /etc/thin/#{server_name}.yml" | |
end |
This file contains hidden or 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
upstream uploader_cluster { | |
server unix:/tmp/thin.uploader.0.sock; | |
server unix:/tmp/thin.uploader.1.sock; | |
server unix:/tmp/thin.uploader.2.sock; | |
server unix:/tmp/thin.uploader.3.sock; | |
server unix:/tmp/thin.uploader.4.sock; | |
} | |
server { |
This file contains hidden or 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
upstream uploader_cluster { | |
server unix:/tmp/thin.uploader.0.sock; | |
server unix:/tmp/thin.uploader.1.sock; | |
server unix:/tmp/thin.uploader.2.sock; | |
server unix:/tmp/thin.uploader.3.sock; | |
server unix:/tmp/thin.uploader.4.sock; | |
} | |
server { |
This file contains hidden or 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
upstream uploader_cluster { | |
server unix:/tmp/thin.uploader.0.sock; | |
server unix:/tmp/thin.uploader.1.sock; | |
server unix:/tmp/thin.uploader.2.sock; | |
server unix:/tmp/thin.uploader.3.sock; | |
server unix:/tmp/thin.uploader.4.sock; | |
} | |
server { |