= Testing embedding the Birth Choice image on a Baby Centre site.
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
namespace :spree do | |
task destroy_duplicate_shipments: :environment do | |
# These are the orders with duplicate shipments | |
orders = Spree::Order. | |
select("spree_orders.id, spree_orders.number"). | |
joins(:shipments). | |
group("spree_orders.id, spree_orders.number"). | |
having("COUNT(spree_shipments.id) > 1") | |
orders.each do |order| |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Where to give birth - BabyCentre</title><meta content="Hospital or home birth? Our comprehensive guides will help you make the right decision for you. Find out more. - BabyCentre" name="description"/><meta content="hospital birth, home birth, birth choices, labour and birth" name="keywords"/><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> | |
<!-- thirdPartyIncludes --> | |
<!-- Begin comScore Tag --> | |
<script>var _comscore=_comscore||[];var bcComscoreAccount='6035600';_comscore.push({c1:"2",c2:bcComscoreAccount});(function(){var s=document.createElement("script"),el=document.getElementsByTagName("script")[0];s.async=true;s.src=(document.location.protocol=="https:"?"https://sb":"http://b")+".scorecardresearch.com/beacon.js";el.parentNode.insertBefore(s,el);})();</script> | |
<noscript> | |
<img src="http://b.scorecardresearch.com/ |
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 'instagram' | |
require 'pp' | |
Instagram.configure do |config| | |
config.client_id = 'your-client-id-goes-here' | |
config.proxy = ENV['http_proxy'] if ENV['http_proxy'] | |
end | |
p Instagram.tag '6musictshirtday' |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Radio TV</title> | |
<script src="require.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
bbcRequireMap = { | |
'jquery-1' : 'http://static.bbci.co.uk/frameworks/jquery/0.1.8/sharedmodules/jquery-1.6.2', | |
'swfobject-2' : 'http://static.bbci.co.uk/frameworks/swfobject/0.1.3/sharedmodules/swfobject-2', | |
'demi-1' : 'http://static.bbci.co.uk/frameworks/demi/0.9.8/sharedmodules/demi-1' |
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 'open-uri' | |
require 'json' | |
require 'date' | |
require 'pp' | |
brand_pids = ['b0100rp6', 'b0072lb2', 'b006tmr6', 'b01mrh21', 'b006wr19'] | |
brand_pids.each do |brand_pid| | |
now = Time.now | |
url = "http://www.bbc.co.uk/programmes/#{brand_pid}/episodes/#{now.year}/#{now.month}.json" |
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
# encoding: utf-8 | |
module CodeRay | |
module Encoders | |
class Prawn < Encoder | |
NBSP = ' ' | |
register_for :prawn | |
def text_token text, kind | |
text.gsub!('<', '<') |
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 'curb' | |
require 'openssl' | |
require 'nokogiri' | |
cert_path = "/Users/sinclp01/.certificates/dev.pem" | |
certificate = File.read(cert_path) | |
curb = Curl::Easy.new | |
curb.cert = cert_path | |
curb.cert_key = cert_path |
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 'prawn' | |
dir = '../music-example' | |
files = Dir.glob("#{dir}/*") + Dir.glob("#{dir}/**/*") | |
pdf = Prawn::Document.new(:page_size => 'A4') | |
pdf.font "Courier" | |
stats = { :files => 0, :lines => 0, :chars => 0 } |
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 'jsonpath' | |
require 'pp' | |
# TODO: is there a cleaner way of doing this? | |
class Capybara::Driver::Mechanize < Capybara::Driver::RackTest | |
def post_body(url, body, headers = {}) | |
if remote?(url) | |
process_remote_request(:post, url, body, headers) | |
else | |
register_local_request |
NewerOlder