This file contains 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 'csv' | |
require 'bigdecimal' | |
require 'byebug' | |
class Transaction | |
attr_reader :date, :description, :debit_amount, :credit_amount, :balance | |
attr_accessor :exchange_rate | |
def initialize(date, description, debit_amount, credit_amount, exchange_rate, date_format:"%m/%d/%Y") |
This file contains 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
<h2>Our Bacon</h2> | |
<table> | |
<thead> | |
<th>Name</th> | |
<th>Quantity</th> | |
</thead> | |
<tbody> | |
<tr data-foreach-bacon="bacons"> | |
<td data-bind="bacon.name"></td> | |
<td data-bind="bacon.quantity"></td> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>BaconTracker</title> | |
<%= stylesheet_link_tag "application", media: "all" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> |
This file contains 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
class BaconsController < ApplicationController | |
before_action :set_bacon, only: [:show, :edit, :update, :destroy] | |
# GET /bacons | |
# GET /bacons.json | |
def index | |
respond_to do |format| | |
format.html { render text: "", layout: "application" } | |
format.json { render json: Bacon.all } | |
end |
This file contains 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
class BaconTracker.Bacon extends Batman.Model | |
@resourceName: 'bacon' | |
@persist Batman.RailsStorage | |
@encode 'name', 'quantity' |
This file contains 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
class BaconTracker.BaconController extends Batman.Controller | |
routingKey: 'bacon' | |
index: -> | |
@set 'newBacon', new BaconTracker.Bacon | |
BaconTracker.Bacon.load (err, bacons) => | |
@set 'bacons', BaconTracker.Bacon.get('loaded') | |
createBacon: (bacon) -> | |
bacon.save (err, bacon) => |
This file contains 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
Batman.extend Batman.config, | |
pathToHTML: "assets/html" | |
class window.BaconTracker extends Batman.App | |
@resources 'bacon' | |
@root 'bacon#index' |
This file contains 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
// This is a manifest file that'll be compiled into application.js, which will include all the files | |
// listed below. | |
// | |
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | |
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. | |
// | |
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | |
// compiled file. | |
// | |
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details |
This file contains 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
source 'https://rubygems.org' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0.rc2' | |
# Use sqlite3 as the database for Active Record | |
gem 'sqlite3' | |
# Use SCSS for stylesheets | |
gem 'sass-rails', '~> 4.0.0.rc2' |
This file contains 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
(function () { | |
function loadScript(url, callback) { | |
var script = document.createElement("script") | |
script.type = "text/javascript"; | |
if (script.readyState) { //IE | |
script.onreadystatechange = function () { | |
if (script.readyState == "loaded" || script.readyState == "complete") { | |
script.onreadystatechange = null; |
NewerOlder