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
My task is take my existing Sinatra application (http://tttsinatra.herokuapp.com/) Code (https://github.com/meaganewaller/tttsinatra) and allow an option for a user to choose to play either the ruby version (exisiting) or the java version (https://github.com/meaganewaller/java-ttt). | |
I need to run my Sinatra application with JRuby & if the user wants to play the Java TTT game the Java TTT should create game and have routes that call out to my Java TTT jarfile. I need to modify my existing Sinatra TTT to support this. | |
I'm not sure if I'm heading in the correct direction, I've written blog posts to mark what I've done, but I feel like I'm missing something, because I'm not sure what the next step should be. | |
http://blog.meaganwaller.com/sinatra-with-jruby-warbler-jetty | |
http://blog.meaganwaller.com/jruby-with-sinatra | |
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
$ jruby -S rb | |
irb(main):001:0> require 'java-ttt/play.jar' | |
=> true | |
irb(main):002:0> Board = Java::com.ttt.Board | |
=> Java::ComTtt::Board | |
irb(main):003:0> java_import 'com.ttt.Board' | |
=> [Java::ComTtt::Board] | |
irb(main):004:0> board = Java::com.ttt.Board.new(3) | |
=> #<Java::ComTtt::Board:0x79cda784> | |
irb(main):005:0> board = Board.new(3) |
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
$ pair | |
user.name = Meagan Waller | |
user.email = meaganewaller@gmail.com | |
$ pair bigtiger devn mathias | |
user.name = Jim Remsik, Devin Walters, and Matt Gauger | |
user.email = dev+bigtiger+devn+mathias@bendyworks.com | |
$ pair | |
user.name = Jim Remsik, Devin Walters, and Matt Gauger | |
user.email = dev+bigtiger+devn+mathias@bendyworks.com |
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 CoinChanger | |
def initialize | |
@purse = Hash.new(0) | |
@coin_values = { :quarter => 25, :dime => 10, :nickel => 5, :penny => 1} | |
end | |
def make_change(amount) | |
@coin_values.each_value do |value| | |
if amount >= value |
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
(ns wishes.wishlist-spec | |
(:require | |
[wishes.wishlist :refer all] | |
[speclj.core :refer all])) | |
(describe "Wishlist" | |
(with fake-wishlist | |
{:name "Fake Wishlist" | |
:description "My Fake Wishlist"}) | |
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
one_through_five = *1..5 | |
print one_through_five | |
#=> [1,2,3,4,5] |
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
super_simple_rack_proc = lambda { puts 'Super Simple Rack App' } | |
super_simple_rack_proc.call |
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
(defn first-function [args] | |
(let [first (first/suggest (:input args))] | |
{:status 200 :headers {"Content-Type" "application/json"} :body {:first-entity | |
first}})) | |
(defn second-function [args] | |
(let [second (second/suggest (:input args))] | |
{:status 200 :headers {"Content-Type" "application/json"} :body {:second-entity | |
second}})) |
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
(ns wishes.wishlist-spec | |
(:require | |
[wishes.wishlist :refer all] | |
[speclj.core :refer all])) | |
(describe "Wishlist" | |
(with fake-wishlist | |
{:name "Fake Wishlist" | |
:description "My Fake Wishlist"}) | |
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
(ns fizzbuzz.core-spec | |
(:require [speclj.core :refer :all] | |
[fizzbuzz.core :refer :all])) | |
(describe "fizzbuzz" | |
(it "1 is 1" | |
(should=1 (fizzbuzz 1)))) |