Javascript ecosystem is changing every minute, but let's try to catch up with it at least once a year.
Ask your questions as a comments to the gist :)
Since ruby is mature language now, many apps we are working on are big, enterprise projects. Yeah, DDD and all, but in the end, we have to implement it. There are many frameworks/libraries which help us with that. What are your questions to authors of such tools and people working on enterprise rails apps?
Ask your questions as a comments to the gist :)
#!/bin/sh | |
DIR=examples/CPS | |
echo "=== Compiling..." | |
make | |
if [ $? -ne 0 ] | |
then | |
echo "Compilation failed." | |
fi |
str = "The quick fox and dog trololo" | |
/fox/.match(str) | |
def search2(str) | |
/and/.match(str) | |
puts "Inside method2: #{$&}" | |
end | |
def search(str) | |
/dog/.match(str) |
t1 = Thread.new do | |
f = File.open("bar", "w") | |
sleep(rand(5) + 2) | |
f.write("test_1") | |
f.close | |
end | |
t2 = Thread.new do | |
f = File.open("bar", "w") |
~% echo "" > bar | |
~% cat bar | |
~% irb | |
1.9.3-p547 :001 > f = File.open("bar", "w") | |
=> #<File:bar> | |
1.9.3-p547 :002 > f.write("test1") | |
=> 5 | |
1.9.3-p547 :003 > | |
zsh: suspended irb |
type ast = Cons of ast * ast | |
| Write | |
| Read | |
open Printf | |
open Scanf | |
let myVar = ref 0 | |
let set_myVar x = |
1.9.3p362 :002 > [1,2,3,4,5].find_and_replace(:odd?, &:to_s) | |
=> ["1", 2, "3", 4, "5"] | |
1.9.3p362 :003 > [1,2,3,4,5].find_and_replace(Proc.new(&:odd?), &:to_s) | |
=> ["1", 2, "3", 4, "5"] | |
1.9.3p362 :005 > [1,2,3,4,5].find_and_replace(->(x) { x.odd? }, &:to_s) | |
=> ["1", 2, "3", 4, "5"] | |
1.9.3p362 :006 > [1,2,3,4,5].find_and_replace(->(x) { x.odd? }) do |x| | |
1.9.3p362 :007 > x.to_s | |
1.9.3p362 :008?> end | |
=> ["1", 2, "3", 4, "5"] |
def before_save(model) | |
model.class.columns.each do |column| | |
if column.type == :decimal | |
int_part, frac_part = model.send(column.name).to_s.split(".") | |
new_value = [int_part, frac_part[0...column.scale]].join(".") | |
model.send("#{column.name}=", new_value) | |
end | |
end | |
end |
params[:foo] = DecimalSupport.parse_model_decimals(params[:foo], Foo) |