Skip to content

Instantly share code, notes, and snippets.

@jeisenberg
jeisenberg / movie.md
Last active October 10, 2021 23:47 — forked from laser/movie.md

Movie Ticket Kata

What Are We Building?

Write a program that calculates purchase price for movie tickets using any language you like. It should not be a full-blown web app; it can be a simple class or collection of methods invokable by your test suite. We'll provide you with some requirements, test-cases, and even a sample interface - all you have to do is give us some software.

Base Admission Rate

The Base Admission Rate cover movies to be viewed on a regular weekday (see "Special Movie Day" below), in 2D, with a length of <= 120 minutes, viewed from the main seating area (there is also a balcony seating area, which is much fancier).

Keybase proof

I hereby claim:

  • I am jeisenberg on github.
  • I am jeisenberg (https://keybase.io/jeisenberg) on keybase.
  • I have a public key whose fingerprint is EF87 DB82 2BA4 BFE5 0205 6D4A 803A D5F7 008D B944

To claim this, I am signing this object:

def update(conn, %{"id" => id, "uploaded_image" => uploaded_image}) do
contents = uploaded_image.path
|> File.read!()
response = S3.put_object(System.get_env("AWS_BUCKET"), uploaded_image.filename, contents)
|> ExAws.request!()
case response do
%{status_code: 200} ->
# do something here after s3 uploads successfully
def edit(conn, %{"id" => _id, "type" => "image"}) do
conn
|> render("image.html", action: "/resource/#{conn.assigns.resource.id}", changeset: conn.assigns.resource)
end
def edit(conn, %{"id" => _id}) do
conn
|> render("edit.html", changeset: conn.assigns.resource)
end
def humanizing_operating_hours_without_pipes(hours_map) do
grouped = Enum.group_by(hours_map, fn(x) -> elem(x, 1) end, fn(x) -> elem(x,0) end)
as_list = Enum.into(grouped, [])
final = Enum.map(as_list, fn(x) ->
v = elem(x, 1)
v_upcase = Enum.map(String.upcase(v))
v_final = Enum.join(v, ", ")
v_final
end)
end
def humanizing_operating_hours_with_pipes(hours_map) do
Enum.group_by(hours_map, fn(x) -> elem(x, 1) end, fn(x) -> elem(x,0) end)
|> Enum.into([])
|> Enum.map(fn(x) ->
v = elem(x, 1)
|> Enum.map(&(String.upcase(&1)))
|> Enum.join(", ")
end)
end
defmodule MyModule do
using do
quote do
def my_macro() do
# do something here
end
unquote
end
<h1 class="preview-title">
<span>The following <strong>challenge</strong> has been approved for</span>
<span class="agency-name"><strong><span id="agency-toggle">Agency Name</span></strong></span>
<span>by the Google Partners Program of North America</span>
</h1>
package lib
import (
"appengine"
"appengine/urlfetch"
"config"
"crypto/hmac"
"crypto/sha1"
// "encoding/base64"
"encoding/hex"
<div class="input-prepend">
<div class="btn-group">
<select name="[]">
<option value="">All</option>
<?php foreach($user->getPreferredMedias() as $media) :
$checked = Yii::app()->session['search_' . Item::getMediaJsName($media)] == 1;
?>
<option value="<?php echo Item::getMediaJsName($media);?>"><?php echo Item::getMediaJsName($media);?></option>
<?php endforeach;?>
</select>