i18n_backend_database
Database Backend for Rails I18n
i18n_db_admin
Demo application including admin interface for Rails translations using i18n_db
ReTweeter = { | |
initialize: function() { | |
$(".status").each(function(count,status) { | |
var actions = $(status).find("td.actions div"); | |
var link = $("<a/>").attr({href:"/home/?status="+ReTweeter.reTweetOf(status)}); | |
link.append( $("<img/>").attr({src:"http://railslove.com/rt.gif", alt:"REtweet this"}) ) | |
link.bind("click",function(e){ | |
e.preventDefault(); | |
var status = $(this).parents(".status"); | |
$("#status").val(ReTweeter.reTweetOf(status)); |
# RAILSLOVE.com template | |
# | |
# with help and ideas from: | |
# http://gist.github.com/33337 By Peter Cooper | |
# http://github.com/jeremymcanally/rails-templates/tree/master/suspenders.rb Suspenders by Thoughtbot Nathan Esquenazi | |
if yes?("symlink local rails copy to vendor?") | |
path = ask("what's the directory of your local rails copy?") | |
inside('vendor') { run "ln -s #{path} rails" } |
on handle_string(tweet) | |
tell application "Keychain Scripting" | |
set twitter_key to first Internet key of current keychain whose server is "twitter.com" | |
set twitter_login to quoted form of (account of twitter_key & ":" & password of twitter_key) | |
end tell | |
set twitter_status to quoted form of ("status=" & tweet) | |
set results to do shell script "curl --user " & twitter_login & " --data-binary " & twitter_status & " http://twitter.com/statuses/update.json" | |
-- display dialog results | |
return nothing | |
end handle_string |
# legacy User class to import users from a vbulletion database | |
class LegacyUser < LegacyModel | |
# important! please change: | |
self.model = User # which is the new Rails model | |
self.table_name = "vbulletin_user" # the vbulletin table name | |
# attribue mapping: {:rails => :vbulletin} | |
self.attribute_mapping = {:legacy_id => :userid, :name => :username, :email => :email, :password => :email, :password_confirmation => :email} # map old vbulletin attrbute names to new rails attribute names {:rails => :vbulletin} | |
attr_accessor *self.attribute_mapping.values |
// simple textarea resizing script for prototype | |
var ResizingTextArea = Class.create({ | |
min_height: 40, | |
rowHeight: 16, | |
padding: 4, | |
unit: "px", | |
initialize: function(field,options){ | |
Object.extend(this,(options||{})); | |
this.element = $(field); |
Uploader = Class.create({ | |
fileList: null, | |
handler: null, | |
uploaded:0, | |
allowMultipleFiles: true, | |
simUploadLimit: 1, | |
parameterName: "file", | |
filter: { | |
images:{description:"Images", extensions:"*.jpg;*.JPG;*.png;*.PNG"}, | |
office:{description:"Office Document", extensions:"*.doc;*.DOC;*.docx;*.DOCX;*.xls;*.XLS;*.xlsx;*.XLSX;*.ppt;*.PPT;*.pptx;*.PPTX"} |
hashed_result = ["a","b","a"].inject(Hash.new(0)) {|hash,value| hash[value]+=1; hash} | |
hashed_result.sort{|a,b| b[1] <=> a[1]}.collect{|e| e[0]} |
i18n_backend_database
Database Backend for Rails I18n
i18n_db_admin
Demo application including admin interface for Rails translations using i18n_db
before_filter :find_domain | |
def find_domain | |
if request.host == DEFAULT_HOST | |
redirect_to(frontpage_url) if request.path == "/" | |
return true | |
end | |
@domain = Domain.find_by_host(request.host) | |
redirect_to(frontpage_url( :host=> DEFAULT_HOST)) and return false unless @domain | |
instance_variable_set("@company".to_sym, @domain.company) |