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
<script type="text/javascript"> | |
<!-- | |
jq(function(){ | |
var form = jq('form'); | |
jq('a.submit').each(function(){ | |
var a = jq(this); | |
var click = a.click; | |
a.click(function(){ |
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 cache document | |
FileUtils.mkdir_p File.join(RAILS_ROOT, 'private') | |
basename = File.basename(document.filename) | |
pathname = File.join(RAILS_ROOT, 'private', document.id.to_s, basename) | |
cached = | |
begin | |
File.stat(pathname).mtime <= document.created_at | |
rescue | |
false |
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 CreateDbFiles < ActiveRecord::Migration | |
################################################################################ | |
def self.up | |
create_table(:db_files) do |t| | |
t.column(:data, :binary) | |
t.timestamps | |
end | |
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
def local_request?() | |
return true if %w( development test ).include?(RAILS_ENV) | |
local = %w( | |
0.0.0.0 | |
127.0.0.1 | |
localhost | |
localhost.localdomain | |
) |
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 local_request?() | |
return true if %w( development test ).include?(RAILS_ENV) | |
local = %w( | |
0.0.0.0 | |
127.0.0.1 | |
localhost | |
localhost.localdomain | |
) |
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
# True if the request came from localhost, 127.0.0.1. Override this | |
# method if you wish to redefine the meaning of a local request to | |
# include remote IP addresses or other criteria. | |
def local_request? #:doc: | |
request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST | |
end | |
LOCALHOST = '127.0.0.1'.freeze |
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
# generates a div that will load itself with content from an ajax request. | |
# the request is un-altered so, if you don't want it wrapped in the | |
# header/footer you may need to pass in 'partial=true' with the query string | |
# | |
# eg: ajax_content_for :url => '/content/some-path' | |
# | |
# eg: ajax_content_for '/content/some-path' | |
# | |
def ajax_content_for *args | |
options = args.options |
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
# generates a div that will load itself with content from an ajax request. | |
# the request is un-altered so, if you don't want it wrapped in the | |
# header/footer you may need to pass in 'partial=true' with the query string | |
# | |
# eg: ajax_content_for :url => '/content/some-path' | |
# | |
# eg: ajax_content_for '/content/some-path' | |
# | |
def ajax_content_for *args | |
options = args.options |
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 collection_matrix options = {}, &block | |
collection = options.getopt(:collection, @collection) | |
matrix = collection.matrix | |
table_(:class => 'simple collection matrix'){ | |
thead_{ | |
td_{ '-' } | |
matrix.cols.each do |col| | |
td_(:class => 'col name'){ h col.name } | |
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
=erl_crash_dump:0.1 | |
Sat Dec 20 15:27:00 2008 | |
Slogan: init terminating in do_boot () | |
System version: Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [kernel-poll:true] | |
Compiled: Fri Aug 1 22:34:59 2008 | |
Atoms: 5641 | |
=memory | |
total: 3017465 | |
processes: 455124 | |
processes_used: 451516 |