mynameisbrian

Activity Graph

Page 1 of 1

2016-06-20

[20:06:55] mynameisbrian: has joined #ruby
[20:07:20] mynameisbrian: is it uncommon to have an instance attribute as an array?
[20:07:44] mynameisbrian: I wanted to do: obj.prop = 'hello' and then 'hello' gets pushed onto the array
[20:08:12] mynameisbrian: what about that setter syntax? Or is a method to add onto the array more common?
[20:08:28] mynameisbrian: because then there would be no way to delete, and so I would have to provide a method for this
[20:09:23] mynameisbrian: I have a list of folders I want to generate, so I'm just trying to think of the best way to store the folder names
[20:27:11] mynameisbrian: Quit: Page closed

2016-06-13

[01:57:13] mynameisbrian: has joined #ruby
[01:57:57] mynameisbrian: if I run: ruby -w on my script, it displays a warning. But if I run: ruby -cw on my script, it just says "Syntax OK". It seems like the c flag is negating the w flag. what's happening here?
[01:58:09] mynameisbrian: The book im reading recommends to use -cw for checking sytnax
[02:06:46] mynameisbrian: nevermind. my program has an error. I thought the error was a warning. -c doesn't run program, but -w does, so I thought -w was giving me a warning.
[02:07:43] mynameisbrian: -c says the syntax is fine, because it is, but in this case it's calling an undefined method

2016-06-02

[19:00:45] mynameisbrian: has joined #ruby
[19:02:47] mynameisbrian: anyone read "Design patterns in Ruby"?
[19:02:55] mynameisbrian: is that a good first Ruby book to read
[19:03:02] mynameisbrian: for someone who knows how to program
[19:03:45] mynameisbrian: I'm looking for a book to learn Ruby. I know a tiny bit of it and want to expand. I was going to use Eloquent Ruby but now I'm seeing that it should be the second book you read
[19:05:41] mynameisbrian: norc, eloquent ruby is one that you read second though. it's covering syntax I haven't learned yet.
[19:05:50] mynameisbrian: thanks hxegon ill take a look
[19:09:15] mynameisbrian: p calls inspect
[19:09:25] mynameisbrian: so maybe pp calls to_str
[19:12:27] mynameisbrian: Quit: Page closed

2016-05-25

[21:32:03] mynameisbrian: has joined #ruby
[21:32:34] mynameisbrian: Hey guys. I finished the begginer course for Ruby Monk. What resource do you recommend from here? I want an advanced book on Ruby
[21:32:39] mynameisbrian: A book for someone who already programs
[21:33:24] mynameisbrian: TANKS!!!!! TANKS U VRY MUCH
[21:34:01] mynameisbrian: yeah I know I can google it, but people in here usually have good advice so I figured I'd ask
[21:34:31] mynameisbrian: alfie I'm a bit bored with it. It's nice, but I want to try something else
[21:35:08] mynameisbrian: I don't know, I just don't want a begginers book. like "variables store data..... 1+1 = 2"
[21:36:18] mynameisbrian: yeah I keep seeing Eloquent Ruby. Isn't it old though? Looks like it was last published 2010
[21:36:38] mynameisbrian: okay, that's what I thought
[21:37:00] mynameisbrian: I'll check that one out then. That was my only concern
[21:38:04] mynameisbrian: Now I just have to find it free online I mean buy it on amazon
[21:38:33] mynameisbrian: "Design patterns in Ruby" looks nice too, by same author
[21:39:31] mynameisbrian: thanks, I'll take a look
[21:40:38] mynameisbrian: cool. is that on github?
[21:41:04] mynameisbrian: okay, that's what came up. ill star it
[21:41:46] mynameisbrian: im out of here, thanks for all the info guys!

2016-05-17

[20:43:31] mynameisbrian: has joined #ruby
[20:43:49] mynameisbrian: self.each { |current_num| result = yield(result, current_num) }
[20:44:00] mynameisbrian: is there a better way to write that? I don't want each's return value, I want result
[20:44:15] mynameisbrian: so if I write a method, I would have to put result after each
[20:44:56] mynameisbrian: I'm rewriting it just to learn how to do it
[20:46:00] mynameisbrian: https://gist.github.com/anonymous/9159f68b15edd21aa2729bf98ede7f73
[20:47:25] mynameisbrian: does inject have other features?
[20:48:10] mynameisbrian: well yeah it just does that
[20:51:37] mynameisbrian: yeah mine only handles arrays, I haven't learned about ranges yet
[20:53:34] mynameisbrian: well when I added it to Range it still worked for that example
[20:59:20] mynameisbrian: yeah I'll try that
[20:59:30] mynameisbrian: do people commonly use loop?
[20:59:34] mynameisbrian: loop do and so on
[21:01:19] mynameisbrian: I see, thanks for all the info Papierkorb
[21:01:48] mynameisbrian: I need to find another learning resource. I'm using Perl Monk, when I'm finished, I'll read a book or something
[21:01:57] mynameisbrian: I'm only on the beginnner of Perl Monk right now though
[21:02:28] mynameisbrian: yeah I have some project ideas
[21:04:29] mynameisbrian: well that's what I mean, I have ideas of things I'm going to build
[21:07:08] mynameisbrian: Quit: Page closed

2016-05-16

[01:26:31] mynameisbrian: has joined #ruby
[04:29:04] mynameisbrian: has joined #ruby
[04:29:57] mynameisbrian: if I do: c = Proc.new { |num| num * 2 }
[04:30:10] mynameisbrian: shouldn't I have to use: &c to pass it?
[04:30:22] mynameisbrian: for some reason I get an error
[04:30:52] mynameisbrian: I can just pass it normally using c
[04:38:31] mynameisbrian: I'm seeing tutorials saying to pass procs that way
[04:38:53] mynameisbrian: http://www.eriktrautman.com/posts/ruby-explained-blocks-procs-and-lambdas-aka-closures
[05:35:53] mynameisbrian: Ropeney, if you're still there, thanks
[05:36:05] mynameisbrian: that link explained everything.
[05:36:30] mynameisbrian: passed it as first argument, and I see that the & is optional
[23:10:26] mynameisbrian: has joined #ruby

2016-05-15

[05:00:04] mynameisbrian: has joined #ruby
[05:04:29] mynameisbrian: https://gist.github.com/brianbower/04001c8573da358ada1f70a1dde87e84 why would we call it: greet['hello'] and not: greet.['hello'] ?
[05:04:41] mynameisbrian: since [] is basically the method name
[05:05:07] mynameisbrian: also, do people actually use this?
[05:05:31] mynameisbrian: I'm just learning about it since I'm reading about Hash[1,2,3,4]
[05:05:53] mynameisbrian: wait, I mean... greet.[]('hello')
[05:06:50] mynameisbrian: well, we can call it that way. But I don't know why greet['hello'] works in this case.
[05:09:16] mynameisbrian: yeah I figured its something like that
[05:09:40] mynameisbrian: at first I thought greet.[]('hello') wasn't working so I was confused
[05:10:16] mynameisbrian: I think I did: greet.['hello'] instead of greet.[]('hello') so it just made me confused about the entire thing.
[05:10:39] mynameisbrian: yeah that's what I was thinking
[05:11:37] mynameisbrian: Do you see people using it? I think it could be useful as some default way like Hash and Array work
[05:12:46] mynameisbrian: I forgot what the term was so I couldn't look it up
[05:13:41] mynameisbrian: I"m having a lot of fun learning ruby
[05:13:49] mynameisbrian: haven't learned a language in awhile
[05:15:25] mynameisbrian: well actually I think "operator overload" doesn't work in this case, since [] is a method name and not being used as an operator
[05:16:03] mynameisbrian: but since [] commonly follows without the dot operator it looks like they just made it work that way
[05:16:44] mynameisbrian: just like 1 + 1 works and we don't have to do 1.+(1) every time
[05:27:03] mynameisbrian: Why do we need splat operator when I can simply do: c = 1, 2, 3 ?
[05:27:24] mynameisbrian: and then c is an array
[05:29:36] mynameisbrian: I know what the splat operator does, but I don't know why the last parameter wouldn't eat up the rest of the arguments, when you can do that with a variable: c = 1, 2, 3
[05:30:08] mynameisbrian: >> c = (1, 2, 3)
[05:30:16] mynameisbrian: >> c = 1, 2, 3
[05:30:27] mynameisbrian: okay, I see now
[05:34:02] mynameisbrian: well, I still don't see
[05:35:03] mynameisbrian: I guess I picture 1,2,3,4 as a datatype, such as a list, and so if I can pass it to a variable, it seems like it should work that way in a method invocation too
[23:42:49] mynameisbrian: has joined #ruby
[23:43:53] mynameisbrian: Hey guys. I'm confused about what a block is exactly. is do ... end always a block? I see a lot of resources differentiating lambda's and blocks, but I can do this: l = lambda do | num | num * 2 end
[23:45:24] mynameisbrian: so what makes it a block?
[23:46:26] mynameisbrian: so in my example, it's both a block and a lambda?
[23:47:58] mynameisbrian: okay, I understand now, thanks.
[23:49:12] mynameisbrian: I get confused with the arguments. the fact we're passing do and end. I was seeing it as an entire construct

2016-05-10

[19:05:37] mynameisbrian: has joined #ruby
[19:06:23] mynameisbrian: Why can't I do: puts {}.methods.sort; since everything in Ruby is an object, shouldn't the hash literal work with that syntax?
[19:06:40] mynameisbrian: If I put paranthesis around it, it works
[19:09:53] mynameisbrian: it's not working for my version?
[19:10:03] mynameisbrian: >> puts {}.methods
[19:10:09] mynameisbrian: oh okay, something with puts
[19:10:28] mynameisbrian: thanks matled haha
[19:10:56] mynameisbrian: >> puts ({}).methods
[19:11:39] mynameisbrian: yeah, I understand.
[19:16:00] mynameisbrian: Quit: Page closed

2016-05-09

[18:57:04] mynameisbrian: has joined #ruby
[18:57:39] mynameisbrian: Hey guys. If you're bored, check out this code. Look at the comments at the top to see input/output. I'm new to Ruby, and just wondering if there's a better way to code this small program. https://gist.github.com/anonymous/306f0a1fe2a694c9a0b54ba41e244b71
[18:59:00] mynameisbrian: Ignore the .py in the first comment. The program was in Python and I converted it to Ruby
[19:00:33] mynameisbrian: awesome, thanks for the advice
[19:01:04] mynameisbrian: I'm using Ruby Monk's course to learn
[19:03:09] mynameisbrian: It's really amazing so far. I'm used to PHP, and this language just makes sense. It's designed really well. I love how everything is an object, and just works that way. Even allowing weird things like 1.*(5), because well, it's an object and it should work even that way
[19:05:23] mynameisbrian: I basically want a language that I can become a master of. Right now I just kind of fuck around and use them when I need to. I don't even really know PHP, I just sort of use it and look things up when I need to. I decided that Ruby would be the language I'll learn really well and everything about
[19:06:01] mynameisbrian: I do know JavaScript well too, but I need a general purpose language
[19:08:40] mynameisbrian: cool, thanks. yeah the only part of that syntax I don't know so far is the @ for the properties. Otherwise I knew .new and the constructure initialize. I'm just about to read up on classes in this Monk's course
[19:11:20] mynameisbrian: yeah that looks much better, I figured there would be a way to get rid of the ugly coupon = ''
[19:11:36] mynameisbrian: php is much easier than perl
[19:13:01] mynameisbrian: shevy's comment above
[19:13:27] mynameisbrian: peanut butter! C is cool! php is easy!
[19:14:25] mynameisbrian: hahah yeah true
[19:18:40] mynameisbrian: 0x0dea which part of the code is making sure the | isn't put on last?
[19:19:58] mynameisbrian: I think it's the step part
[19:28:12] mynameisbrian: thanks. that code just really shows the power of ruby, so fancy
[19:28:30] mynameisbrian: all the little ugly parts of coding are gone
[19:29:02] mynameisbrian: Don't fully understand how it works, I'll just keep going through the tutorial. Need to learn about ranges and such
[19:32:46] mynameisbrian: that's the exact reason why I chose Ruby over Python. I do like Python's one way philosophy. But a language that I want to master... I need more freedom and more fun.
[19:54:05] mynameisbrian: >> language = 'ruby'; puts 'fun' unless language == 'PHP'
[20:23:56] mynameisbrian: Ox0dea how can I access mysql in batch
[20:24:50] mynameisbrian: I'm just making fun of that other user
[20:25:09] mynameisbrian: <BlacksmithMetash> how i can access sqlite in bash?

2014-12-09

[02:20:39] mynameisbrian: hey guys, I want to build a chat server in ruby. so like those "live chat" things you see on websites for customer service. can any of you point me in the right direction, what kind of networking api I can look into?

2014-12-01

[15:00:25] mynameisbrian: I really can't decide whether I should learn Ruby or Python, this is difficult. there are many pros and cons for both
[15:02:07] mynameisbrian: if anyone has any good links comparing the languages send them my way

2014-10-07

[18:08:06] mynameisbrian: can someone provide a resource for learning ruby, for an advanced programmer? http://learnrubythehardway.org is a little annoying to go through. and Ruby's core docs are weird
[18:09:06] mynameisbrian: well I found programming ruby, I guess I can use this

2014-09-30

[13:52:56] mynameisbrian: has anyone tried treehouse to learn ruby?
[13:53:45] mynameisbrian: why not gerep_?
[13:54:52] mynameisbrian: ah okay. I'll check out pluralsight then
[13:56:16] mynameisbrian: hmm okay. yeah ill probably use Ruby mostly for web development, but I want a general language to use for random shit.
[13:56:34] mynameisbrian: I do mostly front end work so I don't actually "know" a language. I know them, but I'm not a master of one.