xco

Activity Graph

Page 1 of 15 | Next »

2019-06-25

[14:42:08] xco: has joined #RubyOnRails
[14:42:19] xco: hi all just a general question
[14:42:47] xco: in the terminal let’s assume you type something like this
[14:43:28] xco: git checkout -b some_very_long_branch_name
[14:43:44] xco: and the cursor is at the last end of this text at “e”
[14:44:03] xco: how do you in the fewest keys strokes delete “some_very_long_branch_name”
[14:44:25] xco: so you don’t have to hold down backspace, which is annoying, not to mention very a huge waste of life
[14:44:40] xco: i know more experience devs will have a way around htis
[14:44:45] xco: and would like to learn it
[14:46:19] xco: is there something that works on MacOS with the trackpad?
[14:48:41] xco: i don’t press delete multiple time though but yeah i want to delete a block of text in a faster way
[14:48:53] xco: maybe something similar to they way one would do it in vim
[14:57:07] xco: Quit: xco
[15:08:46] xco: has joined #ruby
[15:08:46] xco: has joined #RubyOnRails
[21:49:12] xco: Ping timeout: 245 seconds

2019-06-23

[00:00:24] xco: has joined #ruby
[00:00:24] xco: has joined #RubyOnRails
[00:04:49] xco: Ping timeout: 248 seconds

2019-06-22

[08:13:07] xco: has joined #ruby
[08:13:07] xco: has joined #RubyOnRails
[10:02:13] xco: Quit: xco
[11:31:18] xco: has joined #ruby
[11:31:18] xco: has joined #RubyOnRails
[11:58:13] xco: Quit: xco
[15:36:33] xco: has joined #RubyOnRails
[15:36:34] xco: has joined #ruby
[21:01:28] xco: Ping timeout: 268 seconds
[21:08:55] xco: has joined #ruby
[21:08:55] xco: has joined #RubyOnRails
[22:58:24] xco: Ping timeout: 272 seconds
[23:14:52] xco: has joined #ruby
[23:14:52] xco: has joined #RubyOnRails
[23:43:30] xco: Quit: xco

2019-06-21

[08:03:00] xco: has joined #ruby
[08:03:46] xco: i forgot :P
[08:03:46] xco: what’s this new experimental thing called in Ruby? the one with the @1, @2 as args?
[08:03:51] xco: and don’t even know what to type in google
[08:07:49] xco: al2o3-cr: yes!
[08:07:56] xco: that’s it thanks :)
[09:33:48] xco: Quit: xco
[10:47:29] xco: has joined #RubyOnRails
[10:47:30] xco: has joined #ruby
[10:49:03] xco: Client Quit
[10:56:00] xco: has joined #ruby
[10:56:00] xco: has joined #RubyOnRails
[11:23:18] xco: Quit: xco
[12:00:24] xco: has joined #ruby
[12:00:24] xco: has joined #RubyOnRails
[15:20:55] xco: Quit: xco
[15:21:24] xco: has joined #ruby
[15:21:24] xco: has joined #RubyOnRails
[15:25:47] xco: Client Quit
[15:53:33] xco: has joined #ruby
[15:53:33] xco: has joined #RubyOnRails
[21:50:22] xco: Quit: xco

2019-06-18

[05:38:13] xco: has joined #ruby
[05:38:13] xco: has joined #RubyOnRails
[08:28:01] xco: Ping timeout: 246 seconds
[09:20:47] xco: Read error: Connection reset by peer
[09:20:59] xco: has joined #ruby
[09:20:59] xco: has joined #RubyOnRails
[12:04:27] xco: hi all! Let’s say I have a Person model, person has name, occupation, nationality attributes for example. now any time i update any attribute on Person, the udpated_at of Person changes. Is there a way in Rails I can check when a particular attribute was changed?
[12:05:05] xco: updated_at gives when ANY attribute was modified, can i get when say occupation changed on the Person model?
[12:05:32] xco: if occupation was never changed, then the date would be, as i’d hope the created_at of when the Person was created
[12:06:13] xco: if name was changed then the date of the name change will match the updated_at of that particular Person model
[12:14:25] xco: i quick googling is telling making me think i’ll have to implement this https://api.rubyonrails.org/classes/ActiveModel/Dirty.html to get what i want. i’m assuming there’s not “built-in” feature in rails to get this done, if not then i’ll go ahead to implement Active Model Dirty
[20:00:47] xco: <%= f.number_field :package_size, min: 0, step: 1, class: "form-control form-control-sm" %>
[20:00:47] xco: i’m seeing this in a some source code
[20:01:00] xco: what are “min” and “step”?
[20:04:15] xco: found it https://apidock.com/rails/ActionView/Helpers/FormTagHelper/number_field_tag
[20:04:32] xco: options are not listed in docs for number_field
[22:03:06] xco: Quit: xco
[22:07:55] xco: has joined #ruby
[22:07:55] xco: has joined #RubyOnRails
[22:20:46] xco: Quit: xco

2019-06-17

[02:43:08] xco: Quit: xco
[19:54:57] xco: has joined #ruby
[19:56:37] xco: Hi is there a way i can have this %w(Some Brand Ferrari Toyota) come out as an array of [“Some Branhd”, “Ferrari”, “Toyota”]?
[19:57:02] xco: I believe I saw a method about a week ago but can’t remember if it’s from rails or Ruby itself
[20:02:02] xco: i think there’s an option to split (with some arg) to achieve that
[20:02:06] xco: i blieve i saw that somewhere
[20:02:08] xco: i’m looking
[20:09:44] xco: "Toyota Ferrari Aston Marton".split(' ',3)
[20:09:44] xco: adam12: this is what i was looking for
[20:09:57] xco: => ["Toyota", "Ferrari", "Aston Marton"]
[20:14:07] xco: Agree it’s brittle in fact i haven’t seen anyone use it like this before
[20:16:44] xco: leftylink: let me think about this a bit
[20:23:28] xco: GarethAdams: my vain efforts trying to remember #split(‘ ‘, 3)
[20:24:20] xco: by showing what i was i had hopes that someone could remind me of #split(‘ ‘, 3) which i actually learned about about a week or two ago
[20:27:18] xco: "Toyota Ferrari Aston Martin".split(' ',3) IS what i wanted
[20:28:20] xco: if you have something i don’t know about i’d be happy to know through
[20:28:27] xco: is there anything better than "Toyota Ferrari Aston Martin".split(' ', 3)
[20:28:41] xco: in the end i want to see this ["Toyota", "Ferrari", "Aston Martin"]
[20:28:51] xco: no i’m not
[20:29:18] xco: ok i know what you mean
[20:29:50] xco: but i always know that i’ll be sending #split to this "Toyota Ferrari Aston Martin"
[20:29:57] xco: it’s NOT going to change
[20:30:09] xco: how about that?
[20:31:40] xco: you think it’s weird the the collection of cars is fixed? :D
[20:32:34] xco: yes i ended up doing BRANDS = [“Toyota”, “Ferrari”, “Aston Martin”] since GarethAdams said it’s brittle to which i agree
[20:32:59] xco: which brings up another question
[20:33:23] xco: how else can #split(‘ ‘, N) be used and not be considered brittle? 🤔
[20:34:21] xco: does it mean that signature is useless?
[20:39:25] xco: ok, thanks for the input gentlemen! appreciated
[21:48:59] xco: Quit: xco

2019-06-16

[00:11:33] xco: has joined #ruby
[00:11:33] xco: has joined #RubyOnRails
[00:40:33] xco: Quit: xco
[14:25:17] xco: has joined #ruby
[14:25:17] xco: has joined #RubyOnRails
[15:08:49] xco: hi i’m reading the ruby style guide. aren’t these two (leading and trailing .) contradicting themselves? https://rubystyle.guide/#leading-dot-in-multi-line-chains
[15:11:52] xco: havenwood: got a link to that please?
[15:12:58] xco: IGnorAND: it’s confusing they included it at all then. the guide should have one style, if it’s giving different styles then it makes no sense in my opinion because every style they posted has ANOTHER style yet they chose the style they chose
[15:13:04] xco: havenwood: thanks
[15:13:18] xco: havenwood: oh that’s in the new upcoming ruby version! nice
[15:14:56] xco: havenwood: right. i’ve used Rubocop so much so that naturally i write Ruby code that’s consistent with Rubocop itself :D
[15:15:04] xco: IGnorAND: i agree
[15:15:29] xco: IGnorAND: to this “and make a .rubocop.yml to change the opinion :P”
[15:15:56] xco: like picking one style and enforcing it with Rubcop for consistency across board
[15:18:03] xco: havenwood: i kind of like the |> what do you make of it?
[15:20:44] xco: “I kinda consider it a <|, personally.” it looks like that to me because i think in Elixir it’s the opposite of what it is in Ruby 2.7
[15:23:52] xco: “42 |> Integer(exception: false)” this looks weird though, to me. looks like you’d be doing 42.Integer(exception: false) right?
[15:23:56] xco: havenwood: ^
[15:24:16] xco: and not Integer(42, exception: false)
[15:24:37] xco: ah ok i was thinking about Ruby 2.7
[15:25:15] xco: i hated OCaml in school for it’s syntax and now there’s a reference to it again :P
[15:25:45] xco: Elixir is the only functional lang that made me kinda of like functional reasoning
[15:30:45] xco: yeah i was about to ask if you alread made a proposal :D
[15:33:30] xco: that’s a strong and fair argument
[15:35:56] xco: also i think ruby has started to get a few ideas from the functional style; one recent one is this pattern matching which i understand is experimental…so going for |> shouldn’t come as a surprise i guess
[15:37:01] xco: it’s clearly evident, but that’s fine because Elixir itself has been heavily influenced by Ruby

2019-06-15

[08:19:22] xco: has joined #ruby
[08:19:22] xco: has joined #RubyOnRails
[14:43:00] xco: Quit: xco
[20:06:22] xco: has joined #ruby
[20:06:22] xco: has joined #RubyOnRails
[23:21:54] xco: Quit: xco

2019-06-14

[05:35:24] xco: has joined #ruby
[05:35:24] xco: has joined #RubyOnRails
[08:42:54] xco: Quit: xco
[08:43:32] xco: has joined #ruby
[08:43:32] xco: has joined #RubyOnRails
[10:37:52] xco: Quit: xco
[10:38:14] xco: has joined #ruby
[10:38:14] xco: has joined #RubyOnRails
[12:56:33] xco: Quit: xco
[15:48:29] xco: has joined #ruby
[15:48:29] xco: has joined #RubyOnRails
[16:05:49] xco: Quit: xco
[16:44:56] xco: has joined #ruby
[16:44:56] xco: has joined #RubyOnRails
[17:43:57] xco: Quit: xco

2019-06-13

[00:07:50] xco: Quit: xco
[01:03:36] xco: has joined #ruby
[01:03:36] xco: has joined #RubyOnRails
[01:17:01] xco: Quit: xco
[06:05:19] xco: has joined #ruby
[06:05:19] xco: has joined #RubyOnRails
[14:14:31] xco: Quit: xco
[15:11:35] xco: has joined #ruby
[15:11:35] xco: has joined #RubyOnRails
[17:10:02] xco: hi. How do i check the value of a check_box in a model for example?
[17:11:31] xco: yes but i want to run a validation only if a checkbox is checked
[17:11:39] xco: otherwise the validation should run
[17:12:22] xco: perhaps i could do it with params
[17:13:04] xco: like `validation if params[:checkbox_param][value] == ticked`
[17:16:26] xco: Exuma: what is “x”?
[17:17:23] xco: but you said “that shouldnt happen in a model”
[17:17:34] xco: but `validates :something, presence: true, if: Proc.new{|x| x.some_field?` is done in the model right?
[17:17:39] xco: that’s contradictory
[17:17:55] xco: ah right
[17:22:47] xco: Exuma: thanks :)
[22:32:52] xco: Quit: xco

2019-06-12

[06:12:42] xco: has joined #ruby
[07:35:50] xco: hi! I need help making this if clause a one-liner https://gist.github.com/xcobar/23d919440b2779cf10c7c88a87a0076f
[07:43:41] xco: possibly with early return?
[09:03:26] xco: phaul: thanks, but got it figured out. there are stuff after the if clause
[09:03:28] xco: so i just did
[09:03:37] xco: return if something? && do_something!
[09:05:37] xco: which is what i want :D
[09:05:47] xco: do_something! will ALWAYS be execute
[09:07:50] xco: you have a good point
[09:08:01] xco: thing is, i KNOW do_something! always returns TRUE
[09:08:15] xco: but that’s bad i guess because i shouldn’t take that into consideration
[09:08:36] xco: i shouldn’t make it known in the code what do_something! does
[10:11:05] xco: NL3limin4t0r: thanks. i ended up doing `return do_something! if something?` anyway :)
[14:55:20] xco: Quit: xco
[14:55:49] xco: has joined #RubyOnRails
[14:55:50] xco: has joined #ruby
[14:56:23] xco: Client Quit
[17:12:27] xco: has joined #ruby
[17:12:27] xco: has joined #RubyOnRails
[19:51:16] xco: Quit: xco
[19:51:40] xco: has joined #RubyOnRails
[19:51:41] xco: has joined #ruby
[21:47:29] xco: Quit: xco
[22:15:45] xco: has joined #ruby
[22:15:45] xco: has joined #RubyOnRails
[22:35:06] xco: Quit: xco
[22:36:25] xco: has joined #ruby
[22:36:25] xco: has joined #RubyOnRails
[23:02:01] xco: Quit: xco
[23:03:22] xco: has joined #ruby
[23:03:22] xco: has joined #RubyOnRails
[23:14:39] xco: Quit: xco
[23:45:18] xco: has joined #RubyOnRails
[23:45:19] xco: has joined #ruby
[23:48:33] xco: Client Quit
[23:49:25] xco: has joined #ruby
[23:49:25] xco: has joined #RubyOnRails

2019-06-11

[10:57:35] xco: do_something and return
[10:58:25] xco: well then i’m confused. what i want to achieve is, i want to return, but before return do_something
[10:58:40] xco: and thought the best way to do this would be to use &
[10:58:43] xco: as opposed to &&
[10:58:58] xco: which is logic AND
[10:59:18] xco: so no, i meant & not &&
[10:59:39] xco: so in this cause it’d be
[10:59:46] xco: do_something && return
[11:00:01] xco: do_something and return
[11:00:31] xco: leftylink: what?! :D
[11:01:33] xco: which means && is best practice i’d assume
[11:02:22] xco: it’s a method
[11:03:09] xco: `do_something\nreturn` makes sense but i find it a bit weird to have the return all by itself like that
[11:17:53] xco: phaul: i only understood it as do_something \nreturn is the best way to go
[11:18:45] xco: so i got more confused then
[11:18:50] xco: better questin would be
[11:19:19] xco: aaaah ok
[11:19:37] xco: but executing a method is almost always true? no?
[11:22:49] xco: phaul: this is what i’m talking about https://gist.github.com/xcobar/23d919440b2779cf10c7c88a87a0076f
[11:23:10] xco: i want something? to be check first, once it’s satisfied, the whole method should stop
[11:23:43] xco: and not even check for another_thing?
[11:24:41] xco: no i don’t, i just want it to be done
[13:18:39] xco: Quit: xco
[13:24:43] xco: has joined #ruby
[14:00:03] xco: Quit: xco
[17:53:01] xco: has joined #ruby
[19:49:08] xco: Quit: xco
[21:01:11] xco: has joined #ruby
[22:50:27] xco: Quit: xco