Skip to content

Instantly share code, notes, and snippets.

@jagmitg
jagmitg / index.html.erb
Created October 22, 2011 19:10
index.html.erb
<ul>
<% @links.each do |l| %>
<li><%= link_to l[:name], l[:url] %></li>
<% end %>
</ul>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Action Controller: Exception caught</title>
<style>
body { background-color: #fff; color: #333; }
body, p, ol, ul, td {
font-family: helvetica, verdana, arial, sans-serif;
@jagmitg
jagmitg / cinema_sites.rb
Created October 22, 2011 19:23
cinema_sites.rb
class CinemaSites
def self.get_cinema_links
doc = Nokogiri::XML(open('http://www.cineworld.co.uk/syndication/cinemas.xml'))
doc.xpath('//cinemas/name').map do |i|
{name: i['name'], url: i['url']}
end
end
end
@jagmitg
jagmitg / cinema_site.rb
Created October 22, 2011 20:10
problem
require 'nokogiri'
class CinemaSite
def self.get_cinema_links
doc = Nokogiri::XML(open('http://www.cineworld.co.uk/syndication/cinemas.xml'))
doc.xpath('//cinemas/name').map do |i|
{name: i['name'], url: i['url']}
end
end
end
require 'nokogiri'
class CinemaSite
def self.get_cinema_links
doc = Nokogiri::XML(open('http://www.cineworld.co.uk/syndication/cinemas.xml'))
doc.xpath('//cinemas/name').map do |i|
{name: i['name'], url: i['url']}
end
end
end
require 'nokogiri'
class CinemaSite
def self.get_cinema_links
doc = Nokogiri::XML(open('http://www.cineworld.co.uk/syndication/cinemas.xml'))
doc.xpath('//cinemas/name').map do |i|
{name: i['name'], url: i['url']}
end
end
end
def create
@user = User.new(params[:user])
a = "https://www.example.com"
url = URI.parse(a)
http = Net::HTTP.new( url.host, url.port )
http.use_ssl = true if url.port == 443
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
/cinemas
require 'nokogiri'
require 'open-uri'
class CinemaSite
def self.get_cinema_links
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/cinemas.xml'))
doc.xpath('//cinema[@name]').map do |i|
{name: i['name'], url: i['url']}
end
require 'nokogiri'
require 'open-uri'
class CinemaSite
def self.get_cinema_links
doc = Nokogiri::XML(open('http://jagmit.co.uk/ruby/cinemas.xml'))
doc.xpath('//cinema[@name]').map do |i|
{name: i['name'], url: i['url']}