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 Paperclip::Attachment | |
def save | |
flush_deletes | |
oldpath = @path | |
@path = '/:attachment/:id/:style/:filename' | |
puts 'patching the path...' | |
flush_writes | |
@path = oldpath | |
@dirty = false |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | |
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" /> | |
<script src="http://code.jquery.com/jquery-1.5.min.js"></script> | |
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script> | |
<title>Search Input Issue</title> | |
</head> |
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
puts [1,2,3].map {|x|x+1}.inspect | |
#[2, 3, 4] | |
puts [1,2,3].map do |x|x+1 end.inspect | |
#<Enumerator:0x00000100868110> |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'pp' | |
class XMLToArr < Nokogiri::XML::SAX::Document | |
def XMLToArr.parse str, hsh | |
[].tap do |returning| | |
Nokogiri::XML::SAX::Parser.new(self.new(returning, hsh)).parse(str) | |
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
desc "Start a console" | |
task :console do | |
require 'irb' | |
ARGV.clear | |
IRB.start | |
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
# | |
# Short words in Rails locale files with åäö become binary! | |
# But the _why oneliner seems to work. The problem is probably elsewhere. Logging this for reference. | |
# | |
# http://stdlib.rubyonrails.org/libdoc/yaml/rdoc/classes/String.html | |
# File yaml/rubytypes.rb, line 145 | |
# def is_binary_data? | |
# ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) unless empty? |
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
/** C grade styles for jquery mobile **/ | |
body,html { font-family: Helvetica,Arial,sans-serif; padding: 0; margin: 0; background: #F0F0F0; } | |
h1 { margin: 0; width: 100%; background: #111111; color: #ffffff; font-size: 16px; line-height: 39px; text-align: center; margin-bottom: 30px; } | |
p { margin: 20px 15px 20px 15px; color: #333333; font-size: 16px; } | |
a { color: #2489CE; font-weight: bold; } | |
h2,h3,h4,h5,h6,img,pre,form,table,ul { margin: 0 15px 0 15px; } | |
dt { margin: 20px 15px 0 15px; } | |
dd { margin: 0 30px 0 30px; } | |
ul { list-style-type: none; border-bottom: 1px solid #cccccc; padding: 0; font-size: 14px; } |
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
diff --git a/js/jquery.mobile.js b/js/jquery.mobile.js | |
index 86f8472..c9c7e3c 100644 | |
--- a/js/jquery.mobile.js | |
+++ b/js/jquery.mobile.js | |
@@ -478,7 +478,7 @@ | |
} | |
to | |
- .attr( "id", fileUrl ) | |
+ .attr( "id", fileUrl.replace(".", "") ) |
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
#!/usr/bin/env ruby | |
# backup script for postgresql databases | |
# connects via ssh and copies the file to a local path | |
@ssh_host = "" | |
@ssh_user = "" | |
@ssh_pass = "" | |
@db_name = "" |
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 :delayed_job do | |
task :ensure, :roles => :app do | |
pid_from_file = capture("cat #{current_path}/tmp/pids/delayed_job.pid").strip | |
running_pids = capture("ps -ef | grep [d]elayed_job").split("\n").map { |x| x.split[1] } | |
if pid_from_file != running_pids.first || running_pids.size != 1 | |
puts ("-"*80).console_purple | |
puts "Something is terribly wrong with delayed job!".console_red | |
puts "Running_pid: #{pid_from_file}" | |
puts "Running delayed job processes: #{capture("ps -ef | grep [d]elayed_job")}" | |
puts ("-"*80).console_purple |