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
name := "mysqltest" | |
version := "1.0" | |
scalaVersion := "2.10.6" | |
libraryDependencies += "org.jooq" % "jooq" % "3.7.1" | |
libraryDependencies += "org.jooq" % "jooq-scala" % "3.7.1" |
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
Normal: | |
:change: -1 | |
:decay: [0] | |
Sulfuras, Hand of Ragnaros: | |
:eternal: true | |
Aged Brie: | |
:change: +1 | |
:decay: [0] | |
Backstage passes to a TAFKAL80ETC concert: | |
:change: +1 |
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 GildedRose < Struct.new(:name, :days_remaining, :quality) | |
def tick | |
return if name == 'Sulfuras, Hand of Ragnaros' | |
self.days_remaining -= 1 | |
case name | |
when 'Aged Brie' then | |
increase_quality |
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 ThreadSafeWrapper < Delegator | |
def initialize(obj) | |
super | |
@mutex = Mutex.new | |
end | |
def method_missing(m, *args, &block) | |
@mutex.synchronize { super } | |
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
require 'gir_ffi-gtk3' | |
Gtk.init | |
app = Gtk::Application.new('org.gtk.example', :flags_none) | |
app.signal_connect('startup') do | |
window = Gtk::ApplicationWindow.new(app) | |
menu = Gtk::Menu.new |
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
def make_change amount, coins = [1,2,5,10,20,50,100,200] | |
tree = Hash[coins.zip(coins)] | |
while tree[amount].nil? do | |
tree.keys.each do |value| | |
coins.each {|coin| tree[value + coin] ||= coin} | |
end | |
end | |
deep = lambda{|a| (coin = tree[a]) ? [coin] + deep[a - coin] : []} | |
deep[amount].sort.reverse |
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
def digit_to_roman digit, one, five, ten | |
case d = digit % 10 | |
when 0..3 then one * d | |
when 4 then one + five | |
when 5..8 then five + one * (d - 5) | |
when 9 then one + ten | |
end | |
end | |
def to_roman n |
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
#Maybe it's not the way you would do it in ruby and code is not that | |
#beautiful and everyone knows how to read file line by line and how to make | |
#validation of inputs and how to use methods, global and local variables | |
#but I am sure my idea is genuis. Engoy | |
class Test | |
str=ARGV[0] | |
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 'number_converter' | |
ARGV.each do |input_number| | |
result = NumberConverter.new(input_number).convert | |
puts "#{input_number} = #{result}" | |
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
p "Hi, what is your name ?" | |
@name = gets.chomp | |
p "Welcome to the quiz, #{@name}! " + "Please enter a Roman numeral with value between 1 and 4 here:" | |
a = gets.to_i | |
if a == 1 | |
p "I" | |
end | |
if a == 2 |
NewerOlder