Skip to content

Instantly share code, notes, and snippets.

View ahoward's full-sized avatar
💭
probably outside if i'm not hacking.

ara.t.howard ahoward

💭
probably outside if i'm not hacking.
View GitHub Profile
<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(){
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
class CreateDbFiles < ActiveRecord::Migration
################################################################################
def self.up
create_table(:db_files) do |t|
t.column(:data, :binary)
t.timestamps
end
end
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
)
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
)
# 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
# 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
# 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
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
=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