Skip to content

Instantly share code, notes, and snippets.

- base_url = "http://#{request.host_with_port}"
!!! XML
%urlset{:xmlns => "http://www.sitemaps.org/schemas/sitemap/0.9"}
- @pages_to_visit.each do |page|
%url
%loc #{base_url}#{page[:url]}
- if page[:updated_at].present?
%lastmod= page[:updated_at]
%changefreq= page[:changefreq].present? ? page[:changefreq] : "monthly"
%priority= page[:priority].present? ? page[:priority] : "0.5"
@starflyer59
starflyer59 / gist:2505474
Created April 27, 2012 03:24
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
######### _stars.html.erb ###################
<div id="starRating">
<%= form_for(rating_ballot, :html => { :class => 'rating_ballot' }) do |f| %>
<%= f.label("value_1", content_tag(:span, '1'), {:class=>"rating", :id=>"1"}) %>
<%= radio_button_tag("rating[value]", 1, current_user_rating == 1, :class => 'rating_button') %>
<%= f.label("value_2", content_tag(:span, '2'), {:class=>"rating", :id=>"2"}) %>
<%= radio_button_tag("rating[value]", 2, current_user_rating == 2, :class => 'rating_button') %>
@starflyer59
starflyer59 / gist:1683298
Created January 26, 2012 15:33
jQuery dialog problems
Gist Outline:
(1) fablemaker partial
(2) create.js.erb
(3) leftsidebar partial (which links to the fablemaker partial)
(4) application.js
(5) routes
@starflyer59
starflyer59 / gist:1585556
Created January 9, 2012 23:14
Page Source for Form
<!DOCTYPE html>
<html>
<head>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link href="/assets/application.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/themes/ui-lightness/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" />
<script src="https://js.stripe.com/v1/" type="text/javascript"></script>
@starflyer59
starflyer59 / Code
Created January 9, 2012 22:45
Stripe attempt
Four code pages:
(1) The Error
(2) The Order/form
(3) the CoffeeScript
(4) The create action in the Orders_Controller
___________________________________________________________
The ERROR:
Stripe::InvalidRequestError in OrdersController#create
@starflyer59
starflyer59 / gist:1518475
Created December 24, 2011 22:30
Giggle Output
<span id="vote_button">
<form action="/punchlines/91/votes" class="button_to" data-remote="true" method="post"><div><input type="submit" value="giggle" /><input name="authenticity_token" type="hidden" value="jy3K2aHMY8dCGzriC4XXmqx3RMqEDaXkJqaMdm7nt2Q=" /></div></form>
</span>
@starflyer59
starflyer59 / Stripe Code Errors
Created December 18, 2011 07:44
Stripe Code in the SHow Action
class CartsController < ApplicationController
# GET /carts
# GET /carts.xml
def index
@carts = Cart.all
@cart = current_cart
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @carts }