Skip to content

Instantly share code, notes, and snippets.

$(function() {
//run the accordion plugin, set height of sections to height of content
$("#accordion").accordion({ autoHeight: false });
});
;(function($) {
//write new sammy application
var app = new Sammy.Application(function() {
with(this) {
//corresponds to routes such as #/section/1
get('#/section/:section_id', function() { with(this) {
//get first part of current url, without hash
var base_path = window.location.href.split("#")[0];
var real_id = 0;
var current_page;
;(function($) {
//create new sammy app
var app = new Sammy.Application(function() {
with(this) {
//corresponds to routes like #/slide/1
get('#/slide/:page_id', function() { with(this) {
var next_path;
var form_stages;
var check_a;
var check_s;
var prev_path;
var field_val;
;(function($) {
var app = new Sammy.Application(function() {
with(this) {
get('#/stage/:id', function() { with(this) {
require 'sinatra'
require 'pathname'
get "/" do
html = "<h1>Your files, sir.</h1>"
dir = "./files/"
Dir[dir+"*"].each do |file|
html+=file_link(file)
end
html
stop();
// this sets the component's pageName param to
// something we'll define in the next step
cmp_omn.pageName = _root.clickedItem;
// check it's working
trace(cmp_omn.pageName);
// this waits for 0.3 seconds and then calls the
// declare your variable
var clickedItem:String;
// clickable_mc can obviously be the
// instance name of anything you want
// the user to click
clickable_mc.onRelease = function() {
// set the variable to anything - this
// will be grabbed in mc_omn and assigned
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<div xmlns:dc="http://purl.org/dc/elements/1.1/#" about="http://www.example.com/books/my_great_book.pdf">
<p>
<span property="dc:title">My Great Book</span> by
<span property="dc:creator">Joe Corcoran</span>, published
<span property="dc:date">2009-10-01</span>.
</p>
</div>
@joecorcoran
joecorcoran / gist:186552
Created September 14, 2009 08:00
Multiple select helper for Rails
def multi_select(id, name, objects, selected_objects, value, content = {})
options = ""
objects.each do |o|
selected = selected_objects.include?(o) ? " selected=\"selected\"" : ""
option_value = escape_once(o.send(value))
text = [option_value]
unless content[:text].nil?
text = []
content[:text].each do |t|
text << o.send(t)