Skip to content

Instantly share code, notes, and snippets.

View joemsak's full-sized avatar

Joe Sak joemsak

View GitHub Profile
def create
@gallery = Gallery.find(params[:gallery_id])
@photo = @gallery.photos.new(:swfupload_file => params[:Filedata])
if @photo.save
render :partial => 'image', :object => @photo
else
render :text => "error"
end
end
<div class="message">
Add photos to <%= @gallery.name %>
</div>
<div class="buttons">
<button id="browse" class="browse">Browse</button>
<button id="upload" class="upload">Upload Files</button>
<div id="btnPlaceHolder"></div>
</div>
<% div_for(image) do -%>
<%= link_to image_tag(image.image.url(:medium), :class => 'thumb'), image.image.url(:large) %>
<p>
<%= link_to_remote 'Delete', :url => image, :html => { :class => 'lnk-del' }, :confirm => 'You cannot undo this. Are you sure?', :method => :delete %>
</p>
<% end -%>
<%= stylesheet_link_tag 'swfupload' %>
<script src="http://www.google.com/jsapi"></script>
<script>
google.load('jquery','1.3.2');
</script>
<%= javascript_include_tag 'swfupload', 'upload' %>
<script>
var swfu;
// Dom Ready
script/generate scaffold gallery title:string
class User
#...
def before_create
uid = OAuth.prepare_user(???).uid #???
return true if not User.find_by_uid(uid)
end
#...
end
@joemsak
joemsak / books.feature (a)
Created December 7, 2009 22:43
books.feature.a
Feature: Books
So that I can add books
With due dates
The system will allow me to
Create and manage a list of books
So I can get reminders before they're due back
Scenario: Create a book
<style type="text/css">
#myDiv{
padding-top:10px;
background:url(/images/brushline.gif) repeat-x;
}
</style>
<div id="myDiv">
<p>Hello, World!</p>
</div>
When /^I add a new booking with:$/ do |table|
booking_info = table.hashes.first
visit new_booking_path
booking_info.each do |field, value|
if field == 'Start Date' || field == 'End Date'
fill_in(field, :with => value)
elsif field != 'Contractors'
select(value, :from => field)
else
INSERT INTO "attachments" ("attachment_file_name", "created_at", "attachment_content_type", "attachment_file_size", "updated_at", "attachable_type", "attachable_id", "attachment_updated_at") VALUES(NULL, '2010-02-17 17:40:08', NULL, NULL, '2010-02-17 17:40:08', 'Booking', 11, NULL)