This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Simple Slideshow</title> | |
<style type='text/css'> | |
#slideshow { position: relative; } | |
#slideshow img { position: absolute; top: 0; left: 0; } | |
</style> | |
<script src="jquery.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var image_counter = -1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
class Kazoo::Sinatra < Sinatra::Base | |
def render(engine, data, options = {}, *args) | |
if !options[:views] && data.is_a?(Symbol) && !data.to_s.match('/') | |
data = :"#{decamelize(self.class.name)}/#{data}" | |
options[:layout] ||= :'layouts/application' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def interleave(other) | |
arr = [] | |
size.times { |i| arr << self[i]; arr << other[i] unless i + 1 > other.size } | |
left = other[size - 1 .. -1] | |
arr += left if left | |
arr | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ree-1.8.7-2010.02 > post = Post.all[3] | |
typewhat_production['posts'].find({}, {}) | |
=> #<Post _id: 4d2f69c90190bd17a7000001, created_at: Thu Jan 13 21:08:25 UTC 2011, image_filename: "captcha-hindi.png", title: "Zepplin 4?", updated_at: Thu Jan 13 21:15:27 UTC 2011, user_url: nil, approved: false, user_id: nil, user_name: "", approved_at: nil, user_email: "", : ""> | |
ree-1.8.7-2010.02 > post.approve! | |
=> Thu, 13 Jan 2011 21:17:50 +0000 | |
ree-1.8.7-2010.02 > post.save | |
MONGODB typewhat_production['posts'].update({"_id"=>BSON::ObjectId('4d2f69c90190bd17a7000001')}, {"$set"=>{"updated_at"=>Thu Jan 13 21:17:52 UTC 2011, "approved"=>true, "approved_at"=>Thu Jan 13 21:17:50 UTC 2011}}) | |
=> true | |
ree-1.8.7-2010.02 > post.reload | |
typewhat_production['posts'].find({:_id=>BSON::ObjectId('4d2f69c90190bd17a7000001')}, {}).limit(-1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var application = { | |
page_loaded : false, | |
page_init : function() { | |
var i; | |
application.page_loaded = true; | |
// Load scripts that have not already been loaded. | |
var script; | |
for (i=0; script = application.scripts_to_load[i]; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="jqueryFileTree" style="display: none;"> | |
<% @dirs.each do |dir| %> | |
<li class="directory collapsed"><a href="#" rel="<%= params[:dir] / dir %>"><%= dir %></a></li> | |
<% end %> | |
<% @files.each do |file| %> | |
<li class="file ext_<%= File.extname(file)[1..-1] %>"><a href="#" rel="<%= params[:dir] / file %>"><%= file %></a></li> | |
<% end %> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Routes | |
match '/javascripts/ckeditor/plugins/filemanager/connectors/rb/filemanager.rb', :to => 'filemanager#show' | |
match '/javascripts/ckeditor/plugins/filemanager/scripts/jquery.filetree/connectors/jqueryFileTree.rb', :to => 'filemanager#filetree' | |
# Duck punching | |
class Pathname | |
def /(other); File.join(self, other) end | |
end | |
class String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MiniRouter | |
class << self | |
def routes; @routes ||= [] end | |
def named_routes; @named_routes ||= {} end | |
def context; @context ||= Context.new(self) end | |
def add_routes(&blk) | |
raise 'add_routes requires a block' unless block_given? | |
context.instance_eval(&blk) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Testing</title> | |
</head> | |
<body> | |
<form action="./" method="post"> | |
<input type="text" name="question[id]"/> | |
<input type="text" name="question[text]" /> | |
<input type="text" name="question[user][email]" /> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
include DataMapper::Resource | |
property :id, Serial | |
property :priority, Integer | |
end | |
class Posting | |
property :id, Serial |