This file contains 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
<% @taxons = @product.taxons | |
@taxons.find(:all).each do |a| | |
Product.in_taxons(a).each do |product| | |
%> | |
<p> | |
<%= product.name %> | |
</p> | |
<% end %> | |
<% end %> |
This file contains 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 add_image_handlers = function() { | |
$('ul.thumbnails li').eq(0).addClass('selected'); | |
$('ul.thumbnails li a').click(function() { | |
$("#main-image").data('selectedThumb', $(this).attr('href')); | |
$('ul.thumbnails li').removeClass('selected'); | |
$(this).parent('li').addClass('selected'); | |
return false; | |
}).hover( | |
function() { |
This file contains 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" | |
require "coffee-script" | |
get '/js/:scriptname' do | |
coffee params[:scriptname].intern | |
end | |
get "/" do | |
"<script src='/js/test'></script>" | |
end |
This file contains 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
error 404 do | |
link = "http://dl.dropbox.com/u/#{dropboxid}/#{public_folder}"+request.path_info | |
uri = URI.parse(link) | |
response = nil | |
Net::HTTP.start(uri.host, uri.port) { |http| | |
response = http.head(uri.path.size > 0 ? uri.path : "/")} | |
if response.code == "200" | |
redirect link | |
else | |
redirect '/' #any place you like, can be 404 page. |
This file contains 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
フレームワークを作る。 | |
s - "script" | |
d - "database" | |
e - "template" | |
c - "css" | |
padrino g project blog -s jquery -d activerecord -e haml -c sass | |
cd blog | |
bundle install |
This file contains 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
$(document).ready -> | |
### | |
place-holder for animation loop | |
### | |
animate = "" | |
### | |
set canvas to a variable | |
### | |
canvas = document.getElementById("canvas") |
This file contains 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
# | |
# Adapted from http://pastebin.com/FL5KeQQH | |
# | |
# As mentioned on the link above put this on app/helpers/pagination.rb | |
# and you can use in your view | |
# | |
# =will_paginate @posts | |
# | |
# I'm also using this https://gist.github.com/837683 | |
# |
This file contains 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
#map_canvas{:style=>"width: 400px; height: 400px"} | |
%script{:type => "text/javascript", :src=>"http://maps.google.com/maps/api/js?sensor=false"} | |
= javascript_include_tag 'map' | |
:javascript | |
$(document).ready(function(){mappit("#{address}")}); |
This file contains 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
#map_canvas{:style=>"width: 400px; height: 400px"} | |
%script{:type => "text/javascript", :src=>"http://maps.google.com/maps/api/js?sensor=false"} | |
= javascript_include_tag 'map' | |
:javascript | |
$(document).ready(function(){mappit("#{address}")}); |
This file contains 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
request: | |
@sales = Sale.includes([{:shop => :prefecture},:brands]) | |
.order('finish DESC').where("finish > ?", Date.today) | |
.joins(:shop => { :city => :prefecture }) | |
.select('sales.*, DISTINCT prefecture.id') | |
"Sale Load (62.0ms) SELECT "sales"."id" AS t0_r0, "sales"."title" AS t0_r1, "sales"."description" | |
AS t0_r2, "sales"."invite" AS t0_r3, "sales"."shop_id" AS t0_r4, "sales"."start" AS t0_r5, "sales"."finish" | |
AS t0_r6, "sales"."created_at" AS t0_r7, "sales"."updated_at" AS t0_r8, "shops"."id" AS t1_r0, "shops"."name" |
OlderNewer