/rbg/ Ruby General

Now it's Ruby's turn to have an appreciation thread

Other urls found in this thread:

opalrb.org/
twitter.com/AnonBabble

bump

ruby is python done right.

ruby is deprecated. use python for scripts, node.js for meme webdev

Ruby is fantastic, what books do you guys like?

>ruby is deprecated. use python for scripts, node.js for meme webdev
nice meme
OP, that won't be happening here because everyone wants to be edgy and get into language wars

IMO, ruby is lovely and it's my favorite language, to the point that writing with it is fun

Creepiest fucking movie ever.
Also very good when stoned.

Please OP, stop trying. Clojure already won.

ruby has more users than clojure, you're delusional

Are you high? Ruby has more shit in production than clojure could dream of.

>learn ruby for rails/sinatra
>start learning metasploit
>metasploit also uses ruby
>mfw

>Ruby

never heard of it 2bh

Why don't you call this thread "Girlie Webdev General"?

I once heard of a company that used Clojure. They don't any more, but the point is Clojure has won.

>has won nothing
yes, ofcourse

underage confirmed

I love clojure, but building upon jvm made it less desirable.

>need to install ruby
>website suggest version 2.2.x
>install version 2.2.x
>can't install gems, certificate invalid
>"oh right we're suggesting that version but you need to update the certificate, here's the link"
>404
FUCKING.

>implying clojure has ever been relevant

Are you on windows? You just need to install gem from GitHub. The one in the Windows installer is borked.

Ruby on Rails jobs are still abundant. Prove node is anything but a meme.

Ruby is pure comfy

root@v605:/etc/nginx# free -m
total used free shared buffers cached
Mem: 2010 1775 234 101 156 521
-/+ buffers/cache: 1097 912
Swap: 465 14 451
how would you get the first set of digits after "cahce:" like 1097 in this case using regex?

used = -1
lines.each do |line|
if line =~ /cache:\s+(\d+)\s/
used = $1.to_i
end
end
puts used.to_s

Forgot to stick a "break" at the end of the if statement. Won't mess anything up, other than wasting time, though.

thank you, unlike dpt this thread actually answers

txt = `free -m`
txt.match(/cache: *(\d+)/)[1]

Sorry, meant for:

But note that this will fail if you don't find "cache:", to make it more robust there are two ways:

Catch the nil..
b = (txt.match(/cacche: *(\d+)/) || [0,0])[1]

.or catch the exception:
txt = `free -m`
b = txt.match(/cache: *(\d+)/)[1] rescue "Found nothing.."

p (b == "Found nothing.." ? "Shiiet!!!" : b)

Whenever I feel bored, I try to figure out new ways to write FizzBuzz in ruby. Never gets boring..

100.times do |i|
p i % 15 == 0 ? "FizzBuzz" :
i % 5 == 0 ? "Buzz" :
i % 3 == 0 ? "Fizz" :
i
end

Now have this piece of Art, Sup Forums:

fizz = (1..100).select{ |i| (i%3).zero? }
buzz = (1..100).select{ |i| (i%5).zero? }
fizzbuzz = fizz & buzz

def fuck(me) puts "#{me}" end
you_can = -> b,a {a.include? b}

100 . times do |it|
if you_can . call it, fizzbuzz then (fuck "FizzBuzz"; next) end
(fuck "Fizz"; next) if you_can . call it, fizz
(fuck "Buzz"; next) if you_can . call it, buzz
fuck it
end ; self

Why do you need ruby for this?

free -m | grep "cache: " | awk '{print $3}'

Because.. we can?

result = `free -m | grep "cache: " | awk '{print $3}'`

This is why ruby is the comfiest

Should i go for Anal beads or Butt plug?
Also is Rails still relevant?

>Rails still relevant?
always has been

I love ruby, but setting up ruby environments is not straight forward like python. Is there a ruby equivalent to Python virtual environments?

You mean something like RVM (Ruby Version Manager)?

is ruby a good language to start with?

its the only programming language ive ever tried where the syntax makes sense to me!

The only problem is that I heard that it is dying and node.js is faster?


also this

opalrb.org/

anyone tried this? it uses ruby to compile to javascript which sounds neat, cause i hate js :3

TIMTOWDI

b = txt[/cache: *(\d+)/, 1] || "Found nothing..."

The part that I appretiate most is that there are far more sane alternative implementations and derivates, like mruby or crystal.

the only language fun to program with

yes, it's extremly readable
look into why's ruby book

poignant.guide/book/

crystal sounds badass!!! it could easily beat swift

imagine functional programming with ruby syntax!!

thanks user

I went through a ruby phase. Nowadays though I look back at all the now-broken projects and wonder "holy shit what was I thinking?"

explain how mruby or crystal (nothing sane about a project in alpha) is sane and ruby isn't

Yes and no.
It's good because it's super simple.
It's bad because you won't really appreciate many of it's features and every other language will seem pretty dull to you afterwards.. :)

>The only problem is that I heard that it is dying and node.js is faster?

Nah, years ago Ruby was a big hype, nowadays Node or Go are the hyoe. But that doesn't mean it's dying. It's a great langauge and will always have a place. Undersatnd that there is no "best" langauge in programming, different tools for different purposes.


Why not using CoffeeScript and/or Underscore.JS?
Both were strongly influenced by Ruby..

Haha, noice!

I have a lot of respect of the guys from crystal, they work hard, do a good job adn are pretty humble.

But you can't replace Ruby in it's entirety, because of many reasons. I.e. the huge ecosystem. Also read into their blog, you'll understand that ruby is way more thought out than you would think. It's not easy to get on that level.

Oh well, there is a speed limit with Ruby. Personally I have no problem with that, but it _would_ be nice if you could opt to precompile shit and go Java-like speed. We'll see what Ruby3 will bring to us... Matzuuu, don't let us down!!!

what's the best ruby book for someone coming from OOP?

"The Well-Grounded Rubyist" by D. Black is pretty decent. A lot of people start with it.

rvm and bundler does the trick

>ruby is deprecated. use python for scripts, node.js for meme webdev
Ruby, Python and Javascript all do different things, they all complement eachother, they all have a different approach that makes them each better at their use case than the others.

Python is more imperative than the others, it takes a classic Pascal approach of being variable based. For this reason there is usually one and only one best way of doing something in Python.

Ruby is more functional in that objects are immutable and difficult to impossible to change values. Most methods in Ruby are non-destructive. The OO in Ruby takes ecapsulation to the extreme to where even objects and classes are just different objects. Scoping in Ruby objects dont leak out or let anything see in. The result is that Ruby is very much a DSL language.

Javascript is not as OO based as Ruby and so Javascript functions are much more powerful than Ruby methods and act like objects themselves. Javascript functions can very easily be passed around and dynamically instantiated whereas the only way to pass methods in Ruby is through embedding blocks in a Proc.

People who say that one of these languages are better than the other are basement dwellers who have never used these languages professionally.

Is anyone able to comment on what the job situation for Ruby is like in the UK?

the same as the job situation for any programmer job in the UK, you're underpaid and treated with the same respect as a secretary

dont work in the UK if you want to be a programmer, it's a complete waste of your time

already a britcuck so it's too late
at least the pajeets aren't taking our jobs, right?

job search in germany/london, more competitive salary