Skip to content

Instantly share code, notes, and snippets.

View pol's full-sized avatar

pol llovet pol

View GitHub Profile
it "should have acts_as_list functionality" do
@sec1 = sections(:teaching)
@sec2 = sections(:scholarship)
@sec1.should be_in_list
@sec2.should be_in_list
(@sec1.position < @sec2.position).should be_true
@sec2.move_higher
(@sec1.position > @sec2.position).should be_true
end
<% form_for @survey do |f| %>
<%= observe_form "edit_survey_#{@survey.id}",
:url => survey_path(@survey),
:method => :put,
:frequency => 5,
:update => 'savedat_time'
%>
<%#= the form... %>
<script type="text/javascript">
//<![CDATA[
//haHA This works! It could probably use some refactoring.
$(document).ready(function(){
$(".help_icon").click(function(){
help_icon = $(this);
help_container = help_icon.parent();
help = help_icon.siblings('.help_dialog');
help.css('display','block')
help.dialog({
@pol
pol / gist:11477
Created September 18, 2008 20:34
server quote
OPTION 1 : Dell Server (slightly more expensive, more warranty support)
PowerEdge SC1435
Dual Core AMD Opteron® 2212; 2.0GHz,2X1MB Cache,1Ghz HyperTransport x2 (dual dual core)
2GB, 667MHz, 4x512MB Single Ranked DIMMs (FREE UPGRADE!)
No Operating System
2-Post Rails for Non Dell Rack
Onboard SATA, 2 Drives connected to Onboard SATA Controller - NO RAID
250GB 7.2K RPM Serial ATA 3Gbps 3.5-in Cabled Hard Drive
250GB 7.2K RPM Serial ATA 3Gbps 3.5-in Cabled Hard Drive (Discounted upgrade!)
@pol
pol / gist:12961
Created September 25, 2008 22:14
namespace :passenger do
desc "Restart Application"
task :restart do
run "touch #{current_path}/tmp/restart.txt"
end
desc "Create Symlink For App"
task :add_symlink do
run "ln -nfs /home/publicrecon/rails/#{application}/current /home/publicrecon/rails/app"
end
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Results of Survey</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1 align="center">Results of Survey</h1>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
# Connect to the db
$connection = mysql_connect("localhost","root","");
# makes sure that all of the monsters and characters have participants
def update_participants
epm = {}
# make sure each character is accounted for, each one is only in there once.
self.participants.each do |p|
unless p.is_monster? || self.characters.include?(p.character)
self.add_participants([p], :type => :character)
elsif p.is_monster?
epm[p.monster_id] = epm[p.monster_id] ? 0 : epm[p.monster_id] + 1 # build a monster count hash
end
# makes sure that all of the monsters and characters have participants
def update_participants
epm = {}
# make sure each character is accounted for, each one is only in there once.
self.participants.each do |p|
unless p.is_monster? || self.characters.include?(p.character)
self.add_participants([p], :type => :character)
elsif p.is_monster?
epm[p.monster_id] = epm[p.monster_id] ? 0 : epm[p.monster_id] + 1 # build a monster count hash
end
## Data returned when you go to http://localhost:8080/Class/Class ##
({"id":"Class",
"data":{"$ref":""},
"description":"Classes in the system, every class has a table of the instances of the class",
"properties":{
},
"prototype":{"$ref":"../s$0"}
})
## ActiveResource Model ##