Skip to content

Instantly share code, notes, and snippets.

<script>
src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=abc"
type="text/javascript">
</script>
GENERATES (what I want):
<script>
" src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=abc" type="text/javascript"> "
</script>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.apache.httpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/httpd/bin/apachectl</string>
<string>start</string>
We couldn’t find that file to show.
class ApplicationController < ActionController::Base
helper_method :admin?
helper_method :user?
protected
def admin?
session[:password] == 'imcool'
end
require 'rubygems'
require 'postgres'
conn = PGconn.connect("localhost", 5432, '','', "db", "user", nil)
def route_to_poly_controller(polymorphic_type, polymorphic_id, action = :show)
return {:controller => polymorphic_type.tableize, :action => action, :id => polymorphic_id}
end
DateTime::DAYNAMES[DateTime::ABBR_DAYNAMES.index("Sun")].downcase
def html_safe_ajax_partial(name, partial, div)
link_to_remote name, :url => new_session_url(:partial => partial, :format => 'js'), :update => div, :method => :get, :html => { :href => new_session_url(:partial => partial) }
end
#html_safe_ajax_partial('Hello', 'hi', 'coolstuff')
#The above properly generates http://domain/session/new?partial=hi in the coolstuff div with text 'Hello'
#<a onclick="new Ajax.Updater('page_contents', 'http://localhost:3001/session/new.js?partial=hi', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('U44dXFOJa2g4cpjYTL+SwSySN3lh0jo9dD8joocNEgo=')}); return false;" href="http://localhost:3001/session/new?partial=about">Hello</a>
#I want one to generate:
#<a onclick="new Ajax.Updater('page_contents', 'http://localhost:3001/session/new.js?partial=hi', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('U44dXFOJa2g4cpjYTL+SwSySN3lh0jo9dD8joocNEgo=')}); return false;"
development:
adapter: sqlite3
database: db/development.sqlite3
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
timeout: 5000
def create
@custom_errors = Array.new
@chain = current_user.chain
@chain.advertisers.each { |advertiser|
@deal = Deal.new(params[:deal])
@deal.advertiser_id = advertiser.id
@deal.advertiser.ripper = false
@deal.advertiser.category_id = advertiser.category.parent_id
@deal.advertiser.category_parent_id = advertiser.category.parent_id
if @deal.save