Skip to content

Instantly share code, notes, and snippets.

View meaganewaller's full-sized avatar

Meagan Waller meaganewaller

View GitHub Profile
@meaganewaller
meaganewaller / gist:8221972
Created January 2, 2014 16:36
JRuby & Sinatra
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
$ 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)
@meaganewaller
meaganewaller / gist:8442025
Last active January 3, 2016 09:19
pair commit
$ 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
@meaganewaller
meaganewaller / coin_changer.rb
Created February 3, 2014 23:43
Coin Changer Kata
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
(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"})
one_through_five = *1..5
print one_through_five
#=> [1,2,3,4,5]
super_simple_rack_proc = lambda { puts 'Super Simple Rack App' }
super_simple_rack_proc.call
@meaganewaller
meaganewaller / before_clojure.clj
Created January 1, 2015 00:38
Conditional Binding in Clojure
(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}}))
@meaganewaller
meaganewaller / wishlist-spec.clj
Last active August 29, 2015 14:12
Mocking Functions in Clojure
(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"})
@meaganewaller
meaganewaller / 1.clj
Created January 1, 2015 00:51
clojure fizzbuzz
(ns fizzbuzz.core-spec
(:require [speclj.core :refer :all]
[fizzbuzz.core :refer :all]))
(describe "fizzbuzz"
(it "1 is 1"
(should=1 (fizzbuzz 1))))