A PolicyResult
class to help collect the status
and message
from a policy check
class PolicyResult
attr_reader :message, :status
def initialize(params)
@status = params.fetch(:status, false)
A PolicyResult
class to help collect the status
and message
from a policy check
class PolicyResult
attr_reader :message, :status
def initialize(params)
@status = params.fetch(:status, false)
A queue just preserves the order in which items arrived into it. This helps model real world problems around waiting in your turn or in line.
Directions: Write a ruby script to do the following with a queue.
Scenario: you have a store and you're writing a script to help calculate a quick receipt. The one problem is that every 3rd
and 5th
item a customer buys is on sale. Every 3rd
item is 10%
off and every 5th
item is 20%
off, but also, an item that is both a 3rd
and 5th
item is 30%
off.
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.blue { | |
background-color: blue; | |
color: white; |
Hey everyone,
This is a live coding document created by Stypi that will allow me to share code with you as we discuss materials. You should be seeing these changes as I type.
I'll try to use a markdown style for our discussion so that we can just put this session into the notes repo for reference later. Cool?
Please use the sidebar for chatting
Pick one lesson you've given this week, and use it to answer the following questions. Give yourself a moment to reflect upon the following before answering.
After working with random strings of text all day in your office you start to wonder if there is an easier way to store the text. What you end up with is an idea for compression that you want to implement. You decided to replace repeated characters with their count followed by the character, i.e. AAAABBBCD
becomes 4A3BCD
.
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Food Tracker</title> | |
</head> | |
<body> | |
<form id="new_food_item"> | |
<div> | |
<input type="text" name="food[name]" placeholder="Name"> |