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
| Started GET "/foreign-travel-advice/spain" for ::1 at 2016-02-24 16:35:21 +0000 | |
| Processing by TravelAdviceController#show as HTML | |
| Parameters: {"country_slug"=>"spain"} | |
| Rendered govuk_component/breadcrumbs (0.7ms) | |
| Rendered govuk_component/title (1.0ms) | |
| Rendered travel_advice/_travel_advice_navigation.html.erb (7.7ms) | |
| Rendered govuk_component/metadata (8.9ms) | |
| Rendered govuk_component/govspeak (0.8ms) | |
| Rendered travel_advice/_country_summary.html.erb (54.9ms) | |
| Rendered govuk_component/related_items (2.0ms) |
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
| DraftContentItem.where(publishing_app: "email-campaign-frontend").each do |content_item| | |
| content_item.update_attributes!(publishing_app: "share-sale-publisher") | |
| payload = Presenters::ContentStorePresenter.present(content_item) | |
| ContentStoreWorker.perform_async( | |
| content_store: Adapters::DraftContentStore, | |
| base_path: content_item.base_path, | |
| payload: payload, | |
| ) | |
| 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 'open-uri' | |
| require 'json' | |
| buff = '' | |
| open('https://api.github.com/repos/alphagov/smart-answers/pulls') { |f| f.each_line { |line| buff << line } } | |
| pulls = JSON.parse(buff) | |
| puts pulls.first['user'] |
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
| ENV["RAILS_ENV"] = "test" | |
| require File.expand_path('../../config/environment', __FILE__) | |
| require File.dirname(__FILE__) + '/blueprints' | |
| require 'faker' | |
| require 'rails/test_help' | |
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| class MiniTest::Unit::TestCase | |
| include MiniTest::ActiveRecordAssertions |
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
| use Rack::Parser, :content_types => { | |
| 'application/json' => Proc.new { |body| ::MultiJson.decode body } | |
| } |
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
| module MiniTest | |
| module Assertions | |
| module ActiveRecord | |
| # assert_association User, :has_many, :editables, :polymorphic => true | |
| # | |
| def assert_association(clazz, association, associate, options={}) | |
| reflected_assoc = clazz.reflect_on_association(associate) |
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
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| # Passenger Ruby 1.9.3 Mysql AR create | |
| # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| Server Software: Apache/2.2.14 | |
| Server Hostname: perf-test.local | |
| Server Port: 80 | |
| Document Path: /message | |
| Document Length: 0 bytes |
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 Encryption = (function() { | |
| function generateKey(seed) { | |
| var key = "" | |
| while (key.length < seed) key += Math.srand(seed) | |
| return key | |
| } | |
| /* | |
| * @param 'val' - a String to encode or a byte[] to decode. |
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
| /** | |
| * Given the String "Foo.who.bar" this function returns the function bar() from the context of Foo.who | |
| * handy when you need to call or apply a namespaced function from a String representation. | |
| */ | |
| var stringToFunction = function(str) { | |
| var nsArr = str.split("."), | |
| parentNs = window, | |
| len = nsArr.length; | |
| for (var idx = 0; idx < len; idx++) { | |
| parentNs = parentNs[nsArr[idx]]; |