Skip to content

Instantly share code, notes, and snippets.

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*\/.*)$/)
<!-- 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();
function testIndex() {
$result = $this->testAction('/clients/index');
debug($result);
}
ArgumentError in HomeController#index
key too long "rack:session:BAh7CyIKc29ydHN7ByIOZG93bmxvYWRzewYiD3VwZGF0ZWRfYXQiCURFU0MiEG1hcmtldHBsYWNlewYiF2Rvd25sb2FkaW5nc19jb3VudCIJZGVzYzoPc2Vzc2lvbl9pZCIlNjdhNzZiZTVmZjg2ZTc0ZTMyZTgxZDFlNTk5Yjg2ODIiDGZpbHRlcnN7B0AIewYiDGxpY2Vuc2UiDWZyZWV3YXJlIhBtYXJrZXRwbGFjZXsGIgxsaWNlbnNlIg9jb21tZXJjaWFsOhJzaG9wcGluZ19jYXJ0bzoJQ2FydAc6C0BwcmljZWYIOTk5OgxAb3JkZXJzewZpAqImbzoKT3JkZXIKOhZAYXR0cmlidXRlc19jYWNoZXsAOhhAY2hhbmdlZF9hdHRyaWJ1dGVzewgiD3Byb2R1Y3RfaWQwIg1xdWFudGl0eTAiD3VuaXRfcHJpY2UwOg1AcHJvZHVjdG86NUFjdGl2ZVJlY29yZDo6QXNzb2NpYXRpb25zOjpCZWxvbmdzVG9Bc3NvY2lhdGlvbgk6DEBsb2FkZWRUOgxAdGFyZ2V0bzoMUHJvZHVjdAc7C3sAOhBAYXR0cmlidXRlc3sPIgluYW1lIg1VUyBOYXZ5ICILYnlsaW5lIlFJdCdzIHRoZSBjb2xsZWN0aW9uIGZvciBVUyBOYXZ5Lg0KVGhlIGZvbGxvd2luZyBhaXJjcmFmdCBhcmUgaW5jbHVkaW5nLA0KLi4uIhRwcm9kdWN0X29mX3R5cGUiCUl0ZW0iCnByaWNlIgs5OTkuMDAiC3dlaWdodDAiEW9yZGVyc19jb3VudDAiB2lkIgk5ODkwIhBkZXNjcmlwdGlvbiIBkEl0J3MgdGhlIGNvbGxlY3Rpb24gZm9yIFVTIE5hdnkuDQpUaGUgZm9sbG93aW5nIGFpcmNyYWZ0IGFyZSBpbmNsdWRpbmcsDQpGL
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"
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
@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]
public static void postThumbnail() throws IOException, MalformedURLException {
final WebClient webClient = new WebClient();
webClient.addRequestHeader("ACCEPT", "text/xml");
final String userhash = Base64Coder.encodeString("username:password");
webClient.addRequestHeader("Authorization", "Basic " + userhash);
final HtmlPage page1 = (HtmlPage)webClient.getPage("http://www.creativecrash.com/assets/cg_thumbnail");
<?xml version="1.0" encoding="UTF-8"?>
<product>
<information>
<name>test</name>
<mature>false</mature>
<media_type>3D Models</media_type>
<keywords>sdg </keywords>
<price_modality>Fixed</price_modality>
<price_dollars>0.00</price_dollars>
<price_euros>0.00</price_euros>
@twinge
twinge / CC Categories
Created November 22, 2009 14:42
Categories
[{"Aircraft" => [
{"Civilian" => ["Commercial", "Helicopter", "Jet", "Private", "Propellers", "Sport", "Baloon", "Blimp"]},
{"Historic" => []},
{"Military" => ["Bomber", "Fighter", "Helicopter", "Recon", "Transport"]},
{"Parts" => ["Bomb", "Engine", "Parachute", "Propeller", "Weapons", "Wings"]}
]},
{"Anatomy" => [
{"Body" => []},
{"Extremity" => []},
{"Head" => []},