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
content_ids = Document.where("slug like 'deleted-%'").pluck(:content_id); nil | |
File.open('/tmp/whitehall-deleted-content-ids.txt', 'w') { |f| f.write content_ids.join("\n") } |
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 'open-uri' | |
apps = %w{ | |
asset-manager | |
bouncer | |
business-support-api | |
business-support-finder | |
calculators | |
calendars | |
collections |
We can't make this file beautiful and searchable because it's too large.
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
/14-19prospectus,https://www.gov.uk/courses-qualifications | |
/16-19bursary,https://www.gov.uk/1619-bursary-fund | |
/16to19transport,https://www.gov.uk/subsidised-college-transport-16-19 | |
/2007budget,"" | |
/a-z,"" | |
/about,"" | |
/accessibility,http://www.direct.gov.uk/en/hl1/help/accessibility/index.htm | |
/accesstowork,https://www.gov.uk/access-to-work | |
/actonc02,"" | |
/actonco2,"" |
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 'json' | |
require 'open-uri' | |
require 'cgi' | |
def subsection_uris | |
uri = URI.parse("https://contentapi.production.alphagov.co.uk/tags.json?type=section") | |
json = JSON.parse(uri.open.read) | |
subsections = json["results"].select do |section_tag| | |
! section_tag["parent"].nil? | |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML.parse(open("http://www.songmeanings.net/songs/view/101453/")) | |
doc.css('script').remove | |
song_text_node = doc.at("#songText2") | |
lines_by_paragraph = song_text_node.inner_html.gsub(/\n/, "").split(/<br><br>/).map do |paragraph| | |
paragraph.split(/<br>/) | |
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
action: "show" | |
backtrace: undefined | |
baseUrl: "<CENSORED>" | |
cgi_data: undefined | |
component: "campaigns" | |
data: undefined | |
error: Object | |
action: "show" | |
component: "campaigns" | |
message: jQuery.Event |
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 Hoptoad = { | |
VERSION : '0.1.0', | |
NOTICE_XML : '<?xml version="1.0" encoding="UTF-8"?><notice version="2.0"><api-key></api-key><notifier><name>hoptoad_notifier_js</name><version>0.1.0</version><url>http://hoptoadapp.com</url></notifier><error><class>EXCEPTION_CLASS</class><message>EXCEPTION_MESSAGE</message><backtrace>BACKTRACE_LINES</backtrace></error><request><url>REQUEST_URL</url><component>REQUEST_COMPONENT</component><action>REQUEST_ACTION</action></request><server-environment><project-root>PROJECT_ROOT</project-root><environment-name>production</environment-name></server-environment></notice>', | |
ROOT : window.location.protocol + '//' + window.location.host, | |
BACKTRACE_MATCHER : /^(.*)\@(.*)\:(\d+)$/, | |
backtrace_filters : [/notifier\.js/], | |
notify: function(error) { | |
var xml = escape(Hoptoad.generateXML(error)); | |
var host = Hoptoad.host || 'hoptoadapp.com'; |
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
def current_git_branch | |
`git symbolic-ref HEAD`.gsub("refs/heads/", "") | |
end | |
def prompt_with_default(message, default) | |
response = Capistrano::CLI.ui.ask "#{message} Default is: [#{default}] : " | |
response.empty? ? default : response | |
end | |
def set_branch |
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
#! /bin/csh | |
# Adapted from: http://www.tuaw.com/2010/06/21/ios-4-0-firmware-release-expected-momentarily-quick-terminal-ti/ | |
curl -s -L http://phobos.apple.com/version | grep -i Restore | grep -i iPhone | grep -i "\_4\.2\_" | |
if ($? == 1) then | |
echo "Nothing yet..." | |
else | |
say "FOUR POINT TWO FIRMWARE IS NOW AVAILABLE" | |
endif | |
sleep 30 |
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
# http://stackoverflow.com/questions/1740308/create-a-daemon-with-double-fork-in-ruby | |
# Example double-forking Unix daemon initializer. | |
raise 'Must run as root' if Process.euid != 0 | |
raise 'First fork failed' if (pid = fork) == -1 | |
exit unless pid.nil? | |
Process.setsid | |
raise 'Second fork failed' if (pid = fork) == -1 |
NewerOlder