Skip to content

Instantly share code, notes, and snippets.

@twinge
twinge / CreativeCrash API
Created September 11, 2009 20:24
Creative Crash API
Create New Model:
target url: http://www.creativecrash.com/downloads/cg_publish
post parameters:
download[title]
download[version] (you do not have this field, so it is optional, but it would be a string with 3 places like '1.2.5')
download[category_id_list]
download[short_description]
download[description]
download[tag_list] (keywords in your tool)
download[price]
require 'pstore'
# Rails controller that responds to proxy generating ticket callbacks from the CAS server and allows
# for retrieval of those PGTs.
class CasProxyCallbackController < ActionController::Base
# Receives a proxy granting ticket from the CAS server and stores it in the database.
# Note that this action should ALWAYS be called via https, otherwise you have a gaping security hole.
# In fact, the JA-SIG implementation of the CAS server will refuse to send PGTs to non-https URLs.
def receive_pgt
set :target, ENV['TARGET'] || 'gcx'
case target
when 'gcx'
set :host, "192.168.100.149" #"app2.mygcx.org"
set :ssh_options, { :forward_agent => true}
set :deploy_to, "/var/www/panda"
set :scm_verbose, true
when 'amazon'
# Your instance's address
set :host, ENV['INSTANCE_DNS'] || "ec2-174-129-185-7.compute-1.amazonaws.com"
ArgumentError in HomeController#index
key too long "rack:session:BAh7CyIKc29ydHN7ByIOZG93bmxvYWRzewYiD3VwZGF0ZWRfYXQiCURFU0MiEG1hcmtldHBsYWNlewYiF2Rvd25sb2FkaW5nc19jb3VudCIJZGVzYzoPc2Vzc2lvbl9pZCIlNjdhNzZiZTVmZjg2ZTc0ZTMyZTgxZDFlNTk5Yjg2ODIiDGZpbHRlcnN7B0AIewYiDGxpY2Vuc2UiDWZyZWV3YXJlIhBtYXJrZXRwbGFjZXsGIgxsaWNlbnNlIg9jb21tZXJjaWFsOhJzaG9wcGluZ19jYXJ0bzoJQ2FydAc6C0BwcmljZWYIOTk5OgxAb3JkZXJzewZpAqImbzoKT3JkZXIKOhZAYXR0cmlidXRlc19jYWNoZXsAOhhAY2hhbmdlZF9hdHRyaWJ1dGVzewgiD3Byb2R1Y3RfaWQwIg1xdWFudGl0eTAiD3VuaXRfcHJpY2UwOg1AcHJvZHVjdG86NUFjdGl2ZVJlY29yZDo6QXNzb2NpYXRpb25zOjpCZWxvbmdzVG9Bc3NvY2lhdGlvbgk6DEBsb2FkZWRUOgxAdGFyZ2V0bzoMUHJvZHVjdAc7C3sAOhBAYXR0cmlidXRlc3sPIgluYW1lIg1VUyBOYXZ5ICILYnlsaW5lIlFJdCdzIHRoZSBjb2xsZWN0aW9uIGZvciBVUyBOYXZ5Lg0KVGhlIGZvbGxvd2luZyBhaXJjcmFmdCBhcmUgaW5jbHVkaW5nLA0KLi4uIhRwcm9kdWN0X29mX3R5cGUiCUl0ZW0iCnByaWNlIgs5OTkuMDAiC3dlaWdodDAiEW9yZGVyc19jb3VudDAiB2lkIgk5ODkwIhBkZXNjcmlwdGlvbiIBkEl0J3MgdGhlIGNvbGxlY3Rpb24gZm9yIFVTIE5hdnkuDQpUaGUgZm9sbG93aW5nIGFpcmNyYWZ0IGFyZSBpbmNsdWRpbmcsDQpGL
function testIndex() {
$result = $this->testAction('/clients/index');
debug($result);
}
<!-- Initial screen -->
These links demonstrate the Ajax object:<br />
<a href="#" onclick="do_ajax('http://mt.score.26am.com'); return false;">Test of subdomain 1</a><br />
<a href="#" onclick="do_ajax('http://www.score.26am.com'); return false;">Test of subdomain 2</a><br />
<div id="ajax1">Div content before ajax call</div>
<script><!--
function do_ajax(server) {
var ajax = new Ajax();
def process_text(text, field)
return if instance_variable_get("@#{field}_processed")
return if text.blank?
processed_text = returning(text.dup) do |processed_text|
text.to_s.scan(/(<img[^>]*src="[^"]*"[^>]*>)/).each do |image| image = image.first
original_image_content = image.dup
image.to_s.scan(/src="([^"]*)"/).each do |url| url = url.first
# First pass, import/stage images from user directory into a real asset
if match = url.match(/^(.*)(\/uploads\/\d*\/.*)$/)
>> u = User.first
~ (0.047365) SELECT `id`, `login`, `password`, `email`, `salt`, `crypted_password`, `access_key_id`, `secret_access_key`, `updated_at`, `created_at`, `videos_domain`, `s3_videos_bucket`, `state_update_url`, `upload_redirect_url`, `current_instance`, `instance_state`, `instance_deployed`, `admin` FROM `users` ORDER BY `id` LIMIT 1
=> #<User id=1 login="gsfn" password="" email=nil salt="d8f0664a761d2af7975d01ed9890043cde0b06b8" crypted_password="199a3d419aac77fc44dab7717d73e14779322f99" access_key_id="14HQMMGK282G8WB4SD02" secret_access_key="WN7pl2Qvp2wXt9MKRQpsA689UqK6h8A2gWUIXvml" updated_at=Thu, 21 May 2009 14:07:02 -0500 created_at=Thu, 14 May 2009 15:20:34 -0500 videos_domain="s3.amazonaws.com/gsfnvideo" s3_videos_bucket="gsfnvideo" state_update_url="http://localhost:4001/videos/$id/status_update" upload_redirect_url="http://localhost:4000/videos/$id/done" current_instance="i-c12b6ea8" instance_state="running" instance_deployed=false admin=true>
>> u.instance_state = nil
=> nil
>> u.save
user panda;
worker_processes 1;
events {
worker_connections 1024;
}
http {
~/htdocs/panda[ers*]$ irb
>> require 'rubygems'; require 'do_mysql'
=> true
>> exit
~/htdocs/panda[ers*]$ merb
Loading init file from /Users/josh/htdocs/panda/config/init.rb
Loading /Users/josh/htdocs/panda/config/environments/development.rb
~
~ FATAL: The file do_mysql was not found
~