Skip to content

Instantly share code, notes, and snippets.

View maxim's full-sized avatar
🛠️

Max Chernyak maxim

🛠️
View GitHub Profile
-- here's my start.sh --
cd /var/www/tshirts/current && nohup thin start -e production -p6000 -s3 -d && cd /var/www/tshirts/current && nohup rake jaxer:sync:staging; export DISPLAY=":80" && nohup Xvfb :80 -screen 0 1280x1024x24 & nohup /opt/AptanaJaxer/scripts/start.sh
-- here's my cap deploy:start --
task :start, :roles => [:web, :db, :app] do
run "#{deploy_to}/current/config/start.sh"
end
class Color
def hex
[@red, @green, @blue].map do |el|
r = el.to_s(16)
r = '0' + r if r.size < 2
r
end.join
end
alias_method :to_s, :hex
class PagesController < ApplicationController
def index
respond_to do |format|
format.js { render :template => "pages/#{params['path']}"}
end
end
end
# step 1
def index
respond_to do |format|
format.js {render_erb}
end
end
# step 2
def index
Paperclip::Attachment.interpolations[:hashed_id_3x3] = lambda do |attachment, style|
hash = Digest::MD5.hexdigest(attachment.instance.id.to_s)
hash_path = ''
3.times { hash_path += '/' + hash.slice!(0..2) }
hash_path(1..12)
end
Paperclip::Attachment.interpolations[:hashed_id] = lambda do |attachment, style|
Digest::MD5.hexdigest(attachment.instance.id.to_s)
end
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:ApplyBreakingRules /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:UseFELayout /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:\"\\@SimSun\"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:\"\"; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:\"Times New Roman\"; mso-fareast-font-family:SimSun;} @p
- [F] sqlite3-ruby
- [F] flexmock
- [F] turn
- [ ] hoe = 1.8.2
- [ ] rubyforge = 1.0.1
- [I] rake = 0.8.3
- [F] rcov
- [F] paperclip
- [F] mime-types
- [R] rubyzip = 0.9.1
gem_plugin (0.2.3)
gemsonrails (0.7.2)
rubygems-update (1.3.1, 1.3.0, 1.2.0, 1.1.1)
# The test
setup do
@asset = Asset.new({:kind => 'image',
:user_rights => 3,
:everyone_rights => 1,
:description => "nice dragon",
:object => File.new(File.expand_path(File.dirname(__FILE__) + '/asset_test/dragon.svg'))
})
end
class AddConstraintsToAssets < ActiveRecord::Migration
def self.up
execute "alter table #{Asset.table_name}
add constraint assets_check_kind
check (kind in (#{ Asset::KINDS.collect{|a| "'#{a}'"}.join(',') }));".to_line
end
def self.down
execute "alter table #{Asset.table_name}
drop constraint assets_check_kind;".to_line