__desmondhume

Activity Graph

Page 1 of 2 | Next »

2015-11-11

[08:37:47] __desmondhume: has joined #ruby
[08:37:48] __desmondhume: has joined #RubyOnRails
[12:31:04] __desmondhume: extinguishing enthusiasm at its finest
[12:52:06] __desmondhume: i agree with certainty btw, i'm new to IRC and it's not something you give for granted if you've never used it
[12:52:16] __desmondhume: sorry, with camilasan
[12:52:23] __desmondhume: f*ck campestrini
[12:52:31] __desmondhume: wrong quote. lol
[16:26:35] __desmondhume: has joined #RubyOnRails
[16:26:49] __desmondhume: meatchicken: we're looking for full-time fullstack rails dev
[16:27:21] __desmondhume: http://mozestudio.com/
[16:27:49] __desmondhume: if anybody's interested, here's the open positions https://moze.workable.com/
[16:44:58] __desmondhume: sylario: ":api" will be replaced with the params[:api] value
[18:42:51] __desmondhume: Remote host closed the connection
[19:02:36] __desmondhume: has joined #RubyOnRails
[19:02:36] __desmondhume: has joined #ruby
[20:54:45] __desmondhume: Read error: Connection reset by peer
[20:55:13] __desmondhume: has joined #RubyOnRails
[20:55:13] __desmondhume: has joined #ruby
[21:16:02] __desmondhume: Remote host closed the connection

2015-11-10

[15:25:02] __desmondhume: has joined #RubyOnRails
[15:25:02] __desmondhume: has joined #ruby
[15:27:50] __desmondhume: shouldn't be enough to add Gemfile and Gemfile.lock and let Gemfile.plugins do his job when deploying && bundling on the server?
[15:28:57] __desmondhume: I would go for a hook after the deploy that runs bundle install (if it's not already like that)
[15:31:35] __desmondhume: gem pristine --all
[15:31:51] __desmondhume: yeah it should
[15:32:09] __desmondhume: oh ok, sorry i misread it
[15:32:34] __desmondhume: i think the best way then would be to check in the updated Gemfile.lock
[15:33:31] __desmondhume: well, it IS the best practice, so that's the way to go (and that's the way i usually go :) )
[15:54:43] __desmondhume: I don't use rails
[15:54:43] __desmondhume: shevy loads up wordpress inside an iframe in his rails projects
[15:57:53] __desmondhume: what about rifles?
[15:58:25] __desmondhume: but i'm from italy
[15:58:29] __desmondhume: where people die for taxes
[15:59:13] __desmondhume: fine about taxes? lol
[16:00:04] __desmondhume: yeah i work in milano, but i just moved to my hometown
[16:00:12] __desmondhume: remote work is cool
[16:01:16] __desmondhume: the best part of having meeting from home is wearing just ashirt
[16:01:26] __desmondhume: could u please stand up? well no
[16:02:23] __desmondhume: humor is getting better and better
[16:03:05] __desmondhume: isn't it like a naked women thing?
[16:03:31] __desmondhume: lol i'm just asking guys
[16:03:34] __desmondhume: what is penthouse?
[16:04:07] __desmondhume: sorry havenwood
[16:07:29] __desmondhume: do you guys read medium?
[16:08:03] __desmondhume: blogging platform
[16:08:54] __desmondhume: aka 57M investment for dunno-why
[16:09:11] __desmondhume: btw, i wrote an article on that lol
[16:09:21] __desmondhume: wanted to share
[16:09:27] __desmondhume: https://medium.com/moze-stories/developer-by-accident-e8963bdfdcfe
[16:09:40] __desmondhume: yeah, the editor is really good tbh
[16:15:14] __desmondhume: i wouldn't go with rails, tons of useless stuff for that kind of thing, and theming is not a feature
[16:15:57] __desmondhume: Jekyll is also good for seo things, you can do pretty good stuff with slugs and permalinks
[16:16:21] __desmondhume: (http://desmondhume.github.io/ <- Jekyll too)
[16:17:27] __desmondhume: I think he's trying to avoid api limits
[16:17:48] __desmondhume: not so polite tbh
[16:19:45] __desmondhume: plain nokogiri should be enough
[16:20:07] __desmondhume: well, if you want to do it dirty :D
[16:20:16] __desmondhume: i'd go with some queue
[16:20:34] __desmondhume: or multithread if you need speed...
[16:20:47] __desmondhume: it's just fetching so you don't need to worry about race conditions
[16:21:07] __desmondhume: you could do it in few lines with an .each loop
[16:21:52] __desmondhume: or do something better with a minimum setup (redis+sidekiq to enable multiple workers to process the pages)
[16:21:58] __desmondhume: dunno your needs
[16:22:33] __desmondhume: or just install a scraper gem lol
[16:22:40] __desmondhume: https://www.ruby-toolbox.com/categories/Web_Content_Scrapers
[16:28:26] __desmondhume: ruby-lang383: has been jailed lol
[16:30:07] __desmondhume: index on the order_by column?
[16:33:38] __desmondhume: (i'm not an expert of db, but i'm interested to know more)
[16:38:14] __desmondhume: because it's ordering after the limit 50, right?
[16:38:56] __desmondhume: i can't get the point of ` WHERE "followings"."following_id" = 3198216` AND `... OR followings.following_id = 3198216`
[16:40:28] __desmondhume: is it generated from AR?
[16:41:31] __desmondhume: couldn't it be it's just a slow query because of the huge table?
[16:49:43] __desmondhume: try adding a attr_readable :device_count
[17:07:56] __desmondhume: but is it a redis concern?
[17:08:07] __desmondhume: I mean, that level of security
[17:08:35] __desmondhume: or is it delegated to conscious devops?
[17:09:14] __desmondhume: lol ruby is becoming a selfpromoting channel
[17:12:38] __desmondhume: do you guys know if there's any resource on this kind of setup?
[17:12:49] __desmondhume: I'm looking for some kind of devops checklist to make apps secure
[17:13:02] __desmondhume: or, at least, secure at a minimum level :'D
[17:13:31] __desmondhume: I know it's a noob question, but I'm mostly a rails dev, and i have to get devops done on our production servers
[17:21:56] __desmondhume: isn't it a rails feature?
[17:22:15] __desmondhume: don't know if it's implement as a db constraint
[17:22:22] __desmondhume: not in the migrations at least
[17:23:12] __desmondhume: cool, didn't know about this
[17:28:09] __desmondhume: yeah, i agree with you, sorry for that
[17:28:42] __desmondhume: i was just asking if there are some *basic* practices to know about when setting up a production machine
[17:29:02] __desmondhume: if you have no ops people in your team
[17:30:16] __desmondhume: and about database, for example, restricting access to the localhost
[17:30:24] __desmondhume: so that it can't be accessed from the outside, right?
[17:30:53] __desmondhume: oh, i do it by db ports to the public
[17:32:58] __desmondhume: *closing db ports
[17:33:34] __desmondhume: i feel so n00b, gosh...
[17:34:12] __desmondhume: "the other shit" is pretty accurate
[17:47:35] __desmondhume: Remote host closed the connection
[18:57:51] __desmondhume: has joined #RubyOnRails
[18:57:51] __desmondhume: has joined #ruby
[19:18:21] __desmondhume: n_e_o: is right...I'm currently just saving Time.zone today with the correct 24hr time
[19:18:33] __desmondhume: and hiding the date in the view
[19:19:25] __desmondhume: otherwise you can do weird stuff like saving minutes from the beginning of the day, like 11:30 am => 690 (mins)
[19:21:21] __desmondhume: oh, didn't know Time was h:m:s
[19:25:33] __desmondhume: n_e_o: i'm doing like that, yes
[19:26:41] __desmondhume: also active_admin automatically knows it
[19:26:49] __desmondhume: that datetime == hours + minutes
[19:28:28] __desmondhume: n_e_o: are you sure 10:00 is correctly interpreted while parsing fixture?
[19:30:08] __desmondhume: Time.zone.parse("10:00") might do the trick
[19:31:49] __desmondhume: it's yml, maybe you need some evaluation tag
[19:32:08] __desmondhume: <%= Time.zone.parse("10:00") %>
[19:32:46] __desmondhume: it sets the date to today
[19:32:53] __desmondhume: if you pass just a time string
[19:33:32] __desmondhume: i think fixtures do not handle Timezone...
[19:34:18] __desmondhume: how about <%= Time.now.utc %>
[19:35:51] __desmondhume: that's correct i guess
[19:36:14] __desmondhume: don't give up!
[19:36:21] __desmondhume: if you achieve this i'll switch to time fields too
[19:36:33] __desmondhume: the problem here is fixtures
[19:36:41] __desmondhume: they suck so much man...
[19:36:55] __desmondhume: and try from there
[19:36:55] __desmondhume: fire up a rails console
[19:37:17] __desmondhume: 'cause if it's a fixture problem, then you can jump right into 2015 and use FactoryGirl lol
[19:37:28] __desmondhume: just kidding, try from the console btw
[19:39:18] __desmondhume: just noticed that mysql is actually converting that 10:00 into seconds from the beginning of the day as integer lol
[19:41:27] __desmondhume: lagweezle: i agree
[19:41:40] __desmondhume: it has so much sugar i could die for diabete
[19:42:15] __desmondhume: you mean how does it know what type each field is?
[19:42:48] __desmondhume: matthewd: i agree
[19:42:58] __desmondhume: full date is never a problem
[19:43:18] __desmondhume: man, just drop fixtures
[19:44:26] __desmondhume: lagweezle: afaik, n_e_o needs to store opening times, so like 9-12 am
[19:44:40] __desmondhume: as opening hour / closing hour
[19:45:37] __desmondhume: http://stackoverflow.com/a/11894584/1491613
[19:45:42] __desmondhume: lagweezle: there you go
[19:45:49] __desmondhume: the best I could find in months lol
[19:48:00] __desmondhume: n_e_o: I think it's just the YML thing
[19:48:50] __desmondhume: i could be wrong, but if the console is fine, probably you can go confident using a decent library for fixtures
[19:48:54] __desmondhume: like FactoryGirl
[19:49:14] __desmondhume: which is plain ruby, so you can evaluate blocks and so on
[19:49:45] __desmondhume: Time fields are always a big pain in the ass
[19:50:52] __desmondhume: > I'll generate it in the tests itself for now
[19:51:02] __desmondhume: i hope your test suite is small
[19:51:23] __desmondhume: getting started with factory girl should take too long
[19:51:40] __desmondhume: *shouldn't lol
[19:52:23] __desmondhume: yes, it's like 2 mins configuration, and then you just port your fixtures to different files
[19:53:15] __desmondhume: are you using rspec?
[19:55:09] __desmondhume: arup_r: you're missing a ? and a &
[19:55:21] __desmondhume: {a: "", b: ""}.values.all?(&:blank?)
[19:56:22] __desmondhume: oh sorry, i misread it
[19:57:34] __desmondhume: n_e_o: i'm reading the docs
[19:57:46] __desmondhume: i think you can achieve what you need without porting it to factory girl right now
[19:59:04] __desmondhume: it's the rails official doc
[19:59:06] __desmondhume: http://guides.rubyonrails.org/testing.html
[19:59:19] __desmondhume: got to the "2.3.3 ERB'in It Up" section
[19:59:43] __desmondhume: the same thing you do in the console, parsing the "10:00", can be achieved in rails fixtures
[20:01:36] __desmondhume: what did you write exactly?
[20:02:33] __desmondhume: try with <%= Time.parse("14:00") %>
[20:02:40] __desmondhume: i think fixtures have problems with Time.zone
[20:04:13] __desmondhume: now, port it to FactoryGirl lol
[20:04:34] __desmondhume: read here http://technopragmatica.blogspot.it/2014/01/timezone-in-rails.html
[20:05:00] __desmondhume: Scriptonaut: it's not a good practice, but you could just include helpers
[20:08:45] __desmondhume: rhizome: i know, sorry, i'll try to condens messages.
[20:10:50] __desmondhume: i tend to speak like it's face to face, my fault
[20:13:56] __desmondhume: Remote host closed the connection
[21:10:42] __desmondhume: has joined #RubyOnRails
[21:10:42] __desmondhume: has joined #ruby
[22:11:08] __desmondhume: Anubix: what does it mean?
[22:13:27] __desmondhume: Anubix: "Do you know any good source with connectin JS or JSON and Rails?" <- this
[22:14:44] __desmondhume: Anubix: ok so you need to find a way to get data from rails via js?
[22:17:00] __desmondhume: Anubix: create an endpoint in your rails app, which return a json with the towns' list, make an AJAX call to that endpoint
[22:19:31] __desmondhume: you can create an action in your controller, that renders a json with towns
[22:20:03] __desmondhume: so instead of rendering an html, it renders the json, like "format.json { render json: @towns }"
[22:20:31] __desmondhume: Anubix: http://guides.rubyonrails.org/layouts_and_rendering.html
[22:21:04] __desmondhume: go to "2.2.9 Rendering JSON" section. I don't know how you're crafting the @towns array, but still, this is the way to go
[22:22:45] __desmondhume: if the towns list request is limited to the controller you're working on, put it in that controller. Otherwise (I know, it's a bit boilerplat-ish, but at least it's restful) you can create a TownsController, with an index action, returning that list
[22:23:59] __desmondhume: Anubix: you just need an endpoint, doesn't need to be the same action the form is rendered by
[22:24:34] __desmondhume: (new action has only one job, rendering the form to create a new record)
[22:28:08] __desmondhume: Define a towns action in the MayorsController, put the render json in that action. Use mayors/towns.json as typeahead source and you're done
[22:28:54] __desmondhume: of course create the route for towns, so put `get /towns, to: 'mayors#towns'` in your routes.rb file
[22:29:22] __desmondhume: Stevefaust: i think helpa is a bot
[22:29:28] __desmondhume: Stevefaust: !ubuntu
[22:31:27] __desmondhume: I thought writing !ubuntu would show that help message about installing rails on ubuntu, but maybe i was wrong lol
[22:33:18] __desmondhume: Stevefaust: https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04
[22:33:52] __desmondhume: check out digital ocean step by step guides, they're always copy&paste 100% working
[22:34:31] __desmondhume: Stevefaust: np man
[22:35:39] __desmondhume: https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md#remote
[22:35:39] __desmondhume: Anubix: you should use `remote` instead of `local` when setting up bloodhound
[22:36:33] __desmondhume: so remote { url: 'mayors/towns.json' }
[22:38:51] __desmondhume: Anubix: the routes / controllers / actions configuration is up to you, I don't know your actual codebase, so I'm just trying to give the best option to "scale" your js in the case you have hundreds or thousands of towns in the future
[22:39:11] __desmondhume: Anubix: exactly
[22:39:37] __desmondhume: and also, local: @towns <- this is not the way you should print towns
[22:40:01] __desmondhume: Town.all returns an AR Relation, which is not an array of town names :)
[22:41:15] __desmondhume: if you want to keep local and give it a try, just set @towns = Town.pluck(:name), or whatever column_name you want to index for typeahead
[22:42:53] __desmondhume: this way you'll have an array containing only the names of the towns. Also, don't forget to wrap @towns in <%= %> erb tag
[22:43:00] __desmondhume: it's not remote: true
[22:43:55] __desmondhume: remote is an object, containing url key, which is the endpoint url, so just replace your `local: @towns` with `remote: { url: "yourRouteToTowns" }`
[22:49:38] __desmondhume: the identify function is what you're looking for
[22:51:21] __desmondhume: Anubix: http://stackoverflow.com/questions/28102146/working-twitter-typeahead-example
[22:52:14] __desmondhume: google for some examples of rails + typeahead, there's plenty of them. Typeahead is a bit tricky at the beginning, but it's nothing fancy
[22:54:28] __desmondhume: Remote host closed the connection