Skip to content

Instantly share code, notes, and snippets.

View brentonannan's full-sized avatar

Brenton Annan brentonannan

View GitHub Profile
class Policy
def price
@price = Settings.policy.base_rate + Settings.policy.extra_traveller_discount * (@travellers.length - 1)
@travellers.each do |traveller|
@price += @destination.day_rate(traveller.age) * (@end_date - @start_date).to_i
end
end
end
class Destination
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: ['filter'],
actions: {
filterAdded(value) {
var queryParams = this.get('queryParams');
queryParams['filter'] = {reference: {contains: value}};
this.transitionToRoute({ queryParams: queryParams });
@brentonannan
brentonannan / client.ex
Created November 9, 2015 00:27
Creating a mock HTTPoison client
defmodule Client do
# This doesn't work!
use Application.get_env(:my_app, :http_client_base, HTTPoison.Base)
defp process_url(url) do
url |> URI.parse |> Map.put(:scheme, "https") |> URI.to_string
end
defp process_request_body(body) do
body