Activity Graph

Page 1 of 9 | Next »


[05:38:48] thoraxe: Ping timeout: 245 seconds


[13:41:46] thoraxe: has joined #RubyOnRails
[13:42:21] thoraxe: so, weird question. i see how to use .order for multiple fields (eg: order by 1 then by 2) but I am trying to do "order by the older of 2 dates" and not really understanding how to do it
[13:44:34] thoraxe: Article.all.limit(10).order("LEAST(published_on,created_at)")
[13:44:36] thoraxe: i think this is working
[13:44:38] thoraxe: gotta check
[13:49:47] thoraxe: fox_mulder_cp: that was just something I whipped in console
[13:49:55] thoraxe: but that's a good point, thanks
[21:58:37] thoraxe: has joined #ruby
[21:59:07] thoraxe: so this is perhaps an odd one and my google-fu is failing me. i have an array of objects and each object has 2 date fields (_one, _two) and i'm trying to sort the array of objects on the older of the dates
[21:59:27] thoraxe: in other words, figure out the older of the two dates on each object, and then sort the array on that older one
[22:00:17] thoraxe: i guess i can first make a map of the older dates and the array positions and then sort that map by date?
[22:00:28] thoraxe: or is there a nicer way to do it just with a single sort command
[22:03:03] thoraxe: i think i can make that work
[22:05:09] thoraxe: @sorted_articles = @article_models.sort_by { |h| [h.published_on,h.created_at].min }
[22:05:13] thoraxe: i think that's doing what i want
[22:07:49] thoraxe: havenwood: i'm not a hardcore rubyist so i don't understand the difference


[10:36:56] thoraxe: Ping timeout: 268 seconds


[16:28:00] thoraxe: has joined #RubyOnRails
[16:28:47] thoraxe: so it's been a while for me. i have this recollection that pagination got baked into rails itself a while back, but if i search the rails API i don't see paginate anywhere. i'm working on an existing codebase that uses paginate in a view, but i don't see any gem like will_paginate or anything loaded. short summary is i'm trying to figure out how to set the number of items per page
[16:32:34] thoraxe: ohhh looks like it's kaminari
[17:04:43] thoraxe: IGnorAND: pagy is NOW recommended or WAS recommended in the past? kaminari is what's installed and seems to be working
[17:04:51] thoraxe: in the interest of speed i'll probably keep it
[17:04:56] thoraxe: just took me a minute to figure out that's what it was doing


[02:56:43] thoraxe: Ping timeout: 245 seconds


[00:46:56] thoraxe: has joined #RubyOnRails
[00:47:34] thoraxe: hmm... so i'm using devise, I have jquery vendored in, jquery is definitely working, but the sign_out delete method thing doesn't seem to be working. Chrome is just doing GETs when I click the link
[00:49:52] thoraxe: ohh i think i specifically need rails ujs


[11:35:54] thoraxe: Ping timeout: 272 seconds


[00:53:45] thoraxe: has joined #RubyOnRails
[00:56:07] thoraxe: so i am trying to vendor a jquery into vendor/assets/javascripts. it seems to be working. but when iload my page i am seeing 404s for some Roboto fonts that are being loaded by jquery-1.7.2.min.js but i don't have that file anywhere in my tree, i'm not using the jquery gem, and i don't even see where it's being loaded
[00:59:04] thoraxe: yeah chrome is lying to me
[00:59:08] thoraxe: i see what it is
[01:01:20] thoraxe: there are hardcoded paths in a stylesheet for these fonts and chrome is reporting them as being requested by jquery for some ridiculous reason
[01:32:30] thoraxe: ok i'm confused about the sprocket asset pipeline and controller specific assets (eg: stylesheets)
[01:33:00] thoraxe:
[01:33:29] thoraxe: stylesheet_link_tag params[:controller] ends up giving me an error about devise/sessions.css
[01:33:47] thoraxe: but if I create app/assets/stylesheets/devise/sessions.css then sprockets complains about precompilation
[01:36:11] thoraxe: i would end up needing to add every single controller's stylesheet to the initializers file at that rate???


[02:00:22] thoraxe: *.net *.split


[01:48:06] thoraxe: so this is a super dumb webpacker/webpack question, but i just have a vanilla javascript file i want to insert. it's not an npm module or anything. i tried putting the javascript in index.js in a folder (mdb) inside app/javascripts but when I try = = javascript_pack_tag 'mdb' I get an error about it not being in the manifest
[02:23:52] thoraxe: IGnorAND: `main.js` ?
[02:25:30] thoraxe: so you could be talking about any number of things right now
[02:26:06] thoraxe: i don't believe that application.js is used in the traditional sense when using webpack
[02:30:38] thoraxe: so i inherited this app and i haven't done much ruby in quite some time so i am really drowning a bit
[02:30:53] thoraxe: there are several javascript_pack_tags in the header
[02:31:05] thoraxe: they seem to correspond with a few different folders in app/javascript
[02:31:27] thoraxe: so i figure hey, i'll add a folder that looks like the other folders and then javascript_pack_tag mdb
[02:31:33] thoraxe: but then it complains about mdb not being in the manifest
[02:31:43] thoraxe: restarting the server doesn't change that.
[02:32:12] thoraxe: but i don't really see where any of the folders that ARE pulled with javascript_pack_Tag are configured to whatever


[00:51:39] thoraxe: has joined #ruby
[00:52:02] thoraxe: has joined #RubyOnRails
[00:52:30] thoraxe: Quit: WeeChat 2.2
[00:53:20] thoraxe: has joined #RubyOnRails
[00:54:19] thoraxe: so i am digging into an inherited codebase and i've never worked with webpack before. I've read some of the docs and blogs but I'm still confused. I see: = javascript_pack_tag 'manifest'
[00:54:37] thoraxe: but there's nothing in app/javascript/manifest -- that folder doesn't even exist
[00:54:55] thoraxe: i'm guessing it has something to do wiht yarn but my google-fu is failing me
[01:01:28] thoraxe: hmm maybe its' webpack-manifest-plugin
[01:05:23] thoraxe: aha... webpacker.
[01:24:50] thoraxe: hmm ok i feel like now i'm oing in circles with bootstrap-sass, bootstrap gem, webpack, bootstrap npm...
[01:25:12] thoraxe: bootstrap-sass npm says for bs4 you should use the rubygem
[01:25:28] thoraxe: but bootstrap4 site for webpack says use bootstrap npm
[01:25:46] thoraxe: can't seem to find an example or docs on webpack+webpacker+bootstrap(gem)
[02:15:26] thoraxe: yeah that's what i'm trying
[02:15:58] thoraxe: i'm now trying to add the mdbootstrap javascript and failing miserably
[02:18:17] thoraxe: gist kinda sorta coming up
[02:22:36] thoraxe:
[02:22:59] thoraxe: if i just load the js without webpack (like a pure html file) i don't get any errors
[02:23:12] thoraxe: it's like webpack is doing something to the js when it does its thing and it breaks/gets confused


[00:05:09] thoraxe: has joined #ruby
[00:05:44] thoraxe: soooo weird question. but i'm trying to look for some kind of ruby gem that "distills the dom" a'la -- basically want to scrape a site but simplify its content for reader-type stuff
[00:22:44] thoraxe: there's a ruby port of readability
[00:22:46] thoraxe: but it's kinda old
[00:23:02] thoraxe: there's python newspaper3k and a fresher python port of readability
[00:23:33] thoraxe: i could probably either make a flask python microservice or do some horrific python-from-ruby incantation
[00:23:38] thoraxe: but it doesn't look like there's a good pure ruby solution
[00:23:59] thoraxe: i think i did some horrible ruby-python stuff back in the day


[14:26:05] thoraxe: Ping timeout: 240 seconds


[14:21:04] thoraxe: has joined #ruby
[14:21:25] thoraxe: hmm... been a while since I've done any ruby-ing. Had an old sinatra app that used the trello gem and it no longer works, but probably because there's some syntax change
[14:21:44] thoraxe: sprint_lists[0].cards[0].card_labels = ["54d4de9c74d650d5671cb3c7"]
[14:21:52] thoraxe: so, that's an array with one element
[14:22:16] thoraxe: sprint_lists[0].cards[0].card_labels.any? { |label| label["id"] == TRELLO_PROJECT_ID } <-- this comes back as false
[14:22:39] thoraxe: TRELLO_PROJECT_ID == "54d4de9c74d650d5671cb3c7" <-- this is true, though
[14:23:44] thoraxe: sprint_lists[0].cards[0].card_labels.include?(TRELLO_PROJECT_ID)
[14:24:43] thoraxe: havenwood: pulling from ENV
[14:25:02] thoraxe: i think this include will fix it
[14:25:08] thoraxe: testing now


[15:18:16] thoraxe: Ping timeout: 255 seconds


[08:47:18] thoraxe: *.net *.split
[09:31:16] thoraxe: has joined #ruby


[02:01:09] thoraxe: has joined #ruby
[02:01:28] thoraxe: so, it's been a while since I've rubied... but I am missing something when it comes to sass and sinatra and dynamic complication of .sass
[02:01:37] thoraxe: or do i manually have to do something
[02:04:16] thoraxe: just made a change
[02:04:18] thoraxe: gist in a moment
[02:06:24] thoraxe:
[02:06:34] thoraxe: adam12: ^^ i'm sure i'm missing something goofy
[02:06:39] thoraxe: just running "bundle exec rackup"
[02:07:17] thoraxe: it's loading the css...
[02:08:52] thoraxe: adam12: pebcak. thanks for the help, though! )


[14:26:27] thoraxe: Ping timeout: 240 seconds


[00:14:17] thoraxe: has joined #ruby
[00:17:06] thoraxe: *.net *.split
[00:22:48] thoraxe: has joined #ruby


[00:50:05] thoraxe: Ping timeout: 240 seconds


[16:01:30] thoraxe: has joined #ruby


[20:43:02] thoraxe: Ping timeout: 244 seconds
[21:36:10] thoraxe: has joined #ruby


[23:08:29] thoraxe: Ping timeout: 250 seconds
[23:48:30] thoraxe: has joined #ruby


[08:12:02] thoraxe: Ping timeout: 244 seconds
[08:13:44] thoraxe: has joined #ruby


[12:23:16] thoraxe: Ping timeout: 264 seconds
[12:30:22] thoraxe: has joined #ruby


[06:48:04] thoraxe: Ping timeout: 240 seconds
[07:16:37] thoraxe: has joined #ruby


[16:02:12] thoraxe: Ping timeout: 272 seconds
[16:08:49] thoraxe: has joined #ruby


[05:51:12] thoraxe: Ping timeout: 258 seconds
[05:52:05] thoraxe: has joined #ruby


[20:14:16] thoraxe: Ping timeout: 264 seconds
[20:14:58] thoraxe: has joined #ruby


[16:54:07] thoraxe: Ping timeout: 244 seconds
[16:56:16] thoraxe: has joined #ruby


[01:37:00] thoraxe: has joined #ruby


[21:45:40] thoraxe: *.net *.split


[09:07:39] thoraxe: Ping timeout: 246 seconds
[09:09:43] thoraxe: has joined #ruby


[08:42:28] thoraxe: Ping timeout: 264 seconds
[08:42:57] thoraxe: has joined #ruby


[05:11:34] thoraxe: Ping timeout: 244 seconds
[05:36:13] thoraxe: has joined #ruby


[18:36:17] thoraxe: has joined #ruby
[21:49:59] thoraxe: hmm... not sure if this is a better question for rubygems specifically, but i'm trying to install charlock_holmes on centos7 and i feel like I've got all the right deps but to no avail
[21:50:03] thoraxe:
[21:50:35] thoraxe: i have libicu-devel installed
[21:50:46] thoraxe: i'm using bundler: bundle install --without test --without development --deployment
[21:52:01] thoraxe: installing
[21:52:08] thoraxe: jhass: is something bundler doing trying to use that?
[21:52:38] thoraxe: this is also inside a docker container (Extra fun) so yeah which wasn't installed.
[21:52:53] thoraxe: there we go!
[21:53:06] thoraxe: Installing charlock_holmes 0.7.3 with native extensions
[21:55:11] thoraxe: jhass: ahh. gotcha. thanks!


[01:49:42] thoraxe: Ping timeout: 276 seconds


[00:11:21] thoraxe: Ping timeout: 276 seconds
[00:12:31] thoraxe: has joined #ruby


[02:34:23] thoraxe: has joined #ruby
[14:25:37] thoraxe: Ping timeout: 260 seconds
[14:27:12] thoraxe: has joined #ruby


[01:50:39] thoraxe: Ping timeout: 246 seconds


[17:17:01] thoraxe: has joined #ruby


[13:46:47] thoraxe: Quit: reboot


[04:43:01] thoraxe: Ping timeout: 244 seconds
[04:50:22] thoraxe: has joined #ruby


[17:43:26] thoraxe: is there a way with haml to set the heading depth programmatically?
[17:43:33] thoraxe: %h#{varname} doesn't seem to work
[17:43:41] thoraxe: at least not buried in asciidoctor
[18:01:29] thoraxe: smathy: ah ok. there's also haml_tag
[18:01:34] thoraxe: but i will look at content_tag that might work better for me
[18:02:02] thoraxe: is content_tag a rails thing? I'm not using rails.
[18:26:43] thoraxe: so, using haml_tag inside a haml document seems to be giving me grief
[18:26:48] thoraxe:


[16:13:17] thoraxe: has joined #ruby
[16:13:49] thoraxe: hmm... trying to use middleman+asciidoc(tor) and having a hell of a time figuring out how to customize the template/generated output for stuff (titles/headings, specifically)
[17:40:01] thoraxe: hmm I'm really close here...


[15:59:05] thoraxe: Ping timeout: 276 seconds


[10:39:25] thoraxe: Ping timeout: 260 seconds
[14:56:55] thoraxe: has joined #ruby


[18:50:51] thoraxe: Ping timeout: 260 seconds
[19:03:18] thoraxe: has joined #ruby


[23:26:06] thoraxe: given that I am repeating this block of stuff several times, is there a way to define it somewhere else and then just call one command?
[23:26:47] thoraxe: it's like i'm doing the same sequence of actions, which to me smells a lot like a block, but I'm not sure what ruby-fu I would need to put that... uh... block of stuff into some kind of variable and then execute it within the block I'm already in
[23:26:52] thoraxe: i'm really bad at asking these kinds of questions
[23:30:30] thoraxe: Ox0dea: ?
[23:31:43] thoraxe: i'll give that a whirl


[00:00:55] thoraxe: Remote host closed the connection
[00:06:40] thoraxe: has joined #ruby


[11:42:50] thoraxe: Ping timeout: 265 seconds
[11:49:44] thoraxe: has joined #ruby


[16:29:30] thoraxe: - given an array of objects like these, I'm trying to find any object in the array that has a particular list id **and** a particular card label with a particular id
[16:30:17] thoraxe: so in essence I'm trying to find objects in somearray where :list_id=>"565c88490972e1a33c359a6d" and :card_labels has an element with "id"=>"54d4de9c74d650d5671cb3c7"
[16:30:25] thoraxe: i can do this with iteration, but I'm sure there's a more sexy ruby way to do it
[16:44:39] thoraxe: looks like enumerable/select
[16:44:43] thoraxe: just trying to figure out the combination
[16:55:35] thoraxe: sprint_lists[1].cards[1].card_labels.include? ("id"=>"54d4de9c74d650d5671cb3c7") hmm this doesn't work
[17:01:04] thoraxe: yeah i think i need some weird find nested with something else
[17:01:34] thoraxe: sprint_lists[1].cards.find { |card| card.card_labels.any? { |label| label["id"] == "54d4de9c74d650d5671cb3c7" } }
[17:02:21] thoraxe: apeiros: well this is all using the trello gem
[17:02:26] thoraxe: which has proper classes, i think
[17:02:47] thoraxe: eg
[17:02:59] thoraxe: well, depends on what you mean by "proper"
[17:03:41] thoraxe: not sure what you know about trello, but basically a card can have labels. those labels themselves are a bunch of key/value info
[17:04:01] thoraxe: so, with this particular gem, the card's object has a card_labels attribute that is an array of hashes
[17:04:22] thoraxe: i am trying to find all cards (given an array of card objects) who have a particular label
[17:04:31] thoraxe: yes, but i am not trying to find a card by id.
[17:04:40] thoraxe: i am trying to find cards who have a particular label
[17:04:49] thoraxe: and that LABEL has an id
[17:04:54] thoraxe: card.find(id) works fien.
[17:05:05] thoraxe: i want card.find_by_label_id which...
[17:05:37] thoraxe: except there's an added constraint in my case that the card has to be on a particular list
[17:05:57] thoraxe: no label itself appears to be a class too
[17:06:21] thoraxe: i guess i need to look at .where
[17:08:29] thoraxe: well, i didn't write the gem or the classes, so i'm just trying to make do with what is here, and given a list of card objects the ugly find/select/whatever I was trying to do seemed like the quickest resolution
[17:08:46] thoraxe: i'm not even sure how to go about extending the card class to support finding cards by list and card id
[17:08:53] thoraxe: err label id
[17:09:05] thoraxe: because behind the scenes i would expect to end up writing the same exact ugly function
[17:10:33] thoraxe: i guess i don't really understand what you're suggesting, apeiros
[17:10:37] thoraxe: i'm not really a programmer
[17:11:16] thoraxe: so given what i'm working with, what do you suggest?
[17:11:44] thoraxe: so instead of an ugly command or two, i should rewrite all the things?
[17:13:03] thoraxe: sprint_lists[1].cards.find { |card| card.card_labels.any? { |label| label["id"] == "54d4de9c74d650d5671cb3c7" } } <- this seems to be close to what I want, but it's only returning the first card
[17:39:15] thoraxe: apeiros: it's basically one line of code if i can figure out the right incantation of enum methods
[17:39:41] thoraxe: apeiros: otherwise it's a small loop over a small list of objects and reject any that don't have some stuff, which is slow, but works and this can be super low performance


[10:13:02] thoraxe: *.net *.split


[06:55:16] thoraxe: has joined #RubyOnRails
[06:55:19] thoraxe: has left #RubyOnRails: ()
[06:55:21] thoraxe: has joined #ruby
[06:55:49] thoraxe: so i am using the trello gem and messing with lists and cards and etc. and there doesn't appear to be a direct way to "get all cards with a specific label" so it sounds like I will have to do a lot of iterating
[06:56:10] thoraxe: i'm mainly thinking out loud right now, hah
[07:53:38] thoraxe: given an array with hashes inside, is there a way to check if any of the array items' hashes include a particular key:value?
[07:53:44] thoraxe: for example, the array :card_labels=>[{"id"=>"54d4de9c74d650d5671cb3c7", "idBoard"=>"54d4de9c73b36543ddf7d5b9", "name"=>"Project", "color"=>"green", "uses"=>49}]
[07:54:18] thoraxe: normally you can do something like ['cat','dog','bird'].include? 'dog' but doing .include? {"id"=>"blah"} doesn't seem to work
[07:56:32] thoraxe: whoops, gotta go


[10:11:04] thoraxe: Ping timeout: 240 seconds


[07:10:46] thoraxe: Ping timeout: 260 seconds
[07:39:03] thoraxe: has joined #RubyOnRails


[00:09:59] thoraxe: Ping timeout: 260 seconds
[00:11:09] thoraxe: has joined #RubyOnRails


[07:56:13] thoraxe: *.net *.split
[08:13:05] thoraxe: has joined #RubyOnRails
[19:01:53] thoraxe: *.net *.split
[19:08:08] thoraxe: has joined #RubyOnRails


[19:14:52] thoraxe: has joined #RubyOnRails