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 | |
# To install: | |
# about:config | |
# create a new boolean network.protocol-handler.external.txmt with value true | |
# create a new string network.protocol-handler.app.txmt with value path to the script | |
require 'rubygems' | |
require 'cgi' | |
require 'uri' |
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
gem_cmd = "/opt/ruby-enterprise/bin/ruby /opt/ruby-enterprise/bin/gem --no-ri --no-rdoc" | |
a = %x(gem list) | |
gems = [] | |
a.each_line do |l| | |
gem, *versions = l.gsub(/\(|\)|,/,"").split | |
versions.each do |v| | |
gems << "#{gem} -v #{v}" | |
end | |
end | |
%x(sudo #{gem_cmd} install #{gems.join(" ")}) |
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 File.dirname(__FILE__) + '/../../../spec_helper' | |
describe Common::Deploy::ImportTranslations do | |
describe 'try' do | |
it 'should try' do | |
1.should == 1 | |
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
f = UserFeed.find_by_name("HomeCompany") | |
languages = Lang.prepared | |
c = ActionController::Base.new | |
Housing.find_each(:conditions => { :rss_source_id => f.id }) do |item| | |
languages.each do |language| | |
c.expire_fragment "#{language.code}/item/#{item.class}/#{item.id}/half" | |
c.expire_fragment "#{language.code}/item/#{item.class}/#{item.id}/short" | |
c.expire_fragment "#{language.code}/item/#{item.class}/#{item.id}/full/true" | |
c.expire_fragment "#{language.code}/item/#{item.class}/#{item.id}/full/false" | |
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
trans "(use a new line for each item)","common.message.use_new_line" | |
trans "About me","common.about_me" | |
trans "Accept Invitation","common.accept_invitation" | |
trans "Accept this invitation","common.accept_this_invitation" | |
trans "Accepted friend invitations","common.accepted_friend_invitations" | |
trans "Account deletion is permanent and there is no way to recover any information (all messages, ads, posts, friends, etc) after you confirm this step.", "account.message.deletion_warning" | |
trans "Add a language...","common.add_language" | |
trans "Add another community","common.add_another_profile" | |
trans "Add sport from list", "common.add_interest_sport" | |
trans "Add to my discussions","common.add_to_discussions" |
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
desc "Transform translations" | |
task :tt => :environment do | |
Translation.transaction do | |
require RAILS_ROOT + "/trans.rb" | |
end | |
end | |
def trans(st, scope_key, options={}) | |
scope_key =~ /(.*)\.(.*)\Z/ | |
scope = $1 |
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
(defun rinari-generate-tags() | |
(interactive) | |
(let ((my-tags-file (concat (rinari-root) "TAGS")) | |
(root (rinari-root))) | |
(message "Regenerating TAGS file: %s" my-tags-file) | |
(if (file-exists-p my-tags-file) | |
(delete-file my-tags-file)) | |
(shell-command | |
(format "find %s -type f -iname \"*.rb\" | xargs ctags-exuberant -a -e -f %s" | |
root my-tags-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
def gem_list(bin) | |
a = %x(#{bin} list) | |
gems = [] | |
a.each_line do |l| | |
gem, *versions = l.gsub(/\(|\)|,/,"").split | |
versions.each do |v| | |
gems << "#{gem} -v #{v}" | |
end | |
end | |
gems |
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 Polynomial | |
def initialize(polynomial) | |
if polynomial.length < 2 | |
raise ArgumentError.new("Need at least 2 coefficients") | |
else | |
@polynomial = [] | |
polynomial.reverse.each_with_index do |x, i| | |
@polynomial << Term.new(x, i, (i == (polynomial.size - 1))) | |
end | |
end |