Skip to content

Instantly share code, notes, and snippets.

@Rosa-Fox
Rosa-Fox / gist:e45fe41083fb7bbe760b
Created June 10, 2015 16:42
Error elastic search
Elasticsearch::Transport::Transport::Errors::BadRequest at /categories/defend-market-share
[400] {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[iPIrRP8XRjKSCa9MqWJSDw][contagiousfeed_development_feed_articles][0]: SearchParseException[[contagiousfeed_development_feed_articles][0]: from[0],size[10]: Parse Failure [Failed to parse source [{\"from\":0,\"size\":10,\"filter\":{\"and\":[{\"term\":{\"published\":true}},{\"terms\":{\"categories\":[\"defend-market-share\"]}}]},\"query\":{\"function_score\":{\"functions\":[{\"script_score\":{\"script\":\"(0.25/ ((3.16*pow(10,-11)) * abs(DateTime.now().getMillis() - doc['published_at'].date.getMillis()) + 0.05)) + _score\"}}],\"query\":{\"query_string\":{\"query\":\"Defend market share\",\"default_operator\":\"and\"}}}},\"sort\":[{\"published_at\":\"desc\"}],\"aggs\":{\"all_categories\":{\"filter\":{\"and\":[{\"term\":{\"published\":true}}]},\"aggs\":{\"categories\":{\"terms\":{\"field\":\"categories\",\"size\
Elasticsearch::Transport::Transport::Errors::BadRequest at /categories/defend-market-share
[400] {"error":"SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[oCuMYEy9Rs2FBhw6lBqTUA][contagiousfeed_development_feed_articles][0]: SearchParseException[[contagiousfeed_development_feed_articles][0]: from[0],size[10]: Parse Failure [Failed to parse source [{\"from\":0,\"size\":10,\"filter\":{\"and\":[{\"term\":{\"published\":true}},{\"terms\":{\"categories\":[\"defend-market-share\"]}}]},\"query\":{\"function_score\":{\"functions\":[{\"script_score\":{\"script\":\"(0.25/ ((3.16*pow(10,-11)) * abs(DateTime.now().getMillis() - doc['published_at'].date.getMillis()) + 0.05)) + _score\"}}],\"query\":{\"query_string\":{\"query\":\"Defend market share\",\"default_operator\":\"and\"}}}},\"sort\":[{\"published_at\":\"desc\"}],\"aggs\":{\"all_categories\":{\"filter\":{\"and\":[{\"term\":{\"published\":true}}]},\"aggs\":{\"categories\":{\"terms\":{\"field\":\"categories\",\"size\
@Rosa-Fox
Rosa-Fox / tip_user_input.rb
Created September 18, 2015 21:40
Script to print total cost of a bill with tip included. This is based on user input to the terminal.
puts "How much does the bill come to?"
bill_amount = gets.chomp.to_i
while bill_amount == 0
puts "Please enter a valid number for the bill amount:"
bill_amount = gets.chomp.to_i
end
while bill_amount < 0
puts "Please enter a positive number:"
puts bill_amount = gets.chomp.to_i
end
@Rosa-Fox
Rosa-Fox / tip.rb
Created September 18, 2015 21:47
Bill Calculator - OOP approach
class Tip
attr_reader :tip
def initialize(bill, tip)
@bill = bill
@tip = tip
end
def get_amount
@bill_amount = @bill.to_i
if @bill_amount == 0
@Rosa-Fox
Rosa-Fox / gist:eec4ecb0a82c15766eb3
Last active October 9, 2015 14:41
She Codes Brighton - Lets Get Physical - Arduino Workshop

Lets Get Physical - Arudino Workshop

She Codes Brighton is a social meet up group for female developers co-organised by Happy Bear Software developer Rosa (me) along with Wendy Armstrong and Seren Matthews. In September 2015 She Codes held an event under the umbrella of The Brighton Digital Festival..

Entering its 5th year, the Brighton Digital festival aggregated more than 140 events across the course of September. The festival makes for a great opportunity to meet like minded people and delve into something new, as there are multiple events held every night across the city.

In discussing ideas for our event, She Codes members expressed that they wanted to learn hardware skills to couple with their coding knowledge. Having an understanding of how to build projects with hardware would mean that we could diverge from creating interactions solely via screen which would open up new development possibilities.

The Internet of Things

<%= render partial: "attachments/breadcrumbs"%>
<h1 class="page-header">Edit attachment</h1>
<%= render(partial: "shared/attachments_form", locals: {
attachment: @attachment,
url: document_attachment_path(
params[:document_type_slug],
params[:document_content_id],
params[:attachment_content_id]
<% presenter = ActionsPresenter.new(@document, policy(@document)) %>
<div class="row">
<div class="col-md-8">
<h2>Actions</h2>
<div class="well">
<%= link_to "Edit document", presenter.edit_path, class: "btn btn-success" %>
</div>
<% if i == truncate_at_count - 1 %>
<tr class="table-header">
<td colspan="3" class="js-toggle-target text-center">
<strong><a href="#expand-table" class="js-toggle">…and
<%= attachments.count - (truncate_at_count - 1) %> more</a>
</strong>
</td>
</tr>
<% end %>
vagrant@ /var/govuk/development (master) $ bowl whitehall www --without rummager-publishing-listener --without panopticon --without rummager
I, [2016-12-15T09:24:46.778237 #19623] INFO -- : Starting static, content-store, draft-content-store, router-api, publishing-api-worker, publishing-api, rummager-sidekiq, whitehall, router, www...
09:24:46 rummager-sidekiq.1 | started with pid 19669
09:24:46 static.1 | started with pid 19672
09:24:46 whitehall.1 | started with pid 19675
09:24:46 router.1 | started with pid 19679
09:24:46 router-api.1 | started with pid 19682
09:24:46 content-store.1 | started with pid 19687
09:24:46 publishing-api.1 | started with pid 19695
09:24:46 publishing-api-worker.1 | started with pid 19698