hfp

Activity Graph

Page 1 of 8 | Next »

2018-09-08

[03:05:37] hfp: Quit: bye

2018-09-04

[12:15:17] hfp: has joined #ruby
[12:26:34] hfp: Ping timeout: 250 seconds
[12:32:48] hfp: has joined #ruby

2018-08-29

[20:43:54] hfp: Quit: bye

2018-08-17

[11:34:21] hfp: has joined #ruby
[11:37:24] hfp: Hi all, someone asked me the other day how to do this in Ruby and I'm curious what the actual solution is: assuming you have a function that takes two arguments: arg1 and library. You can pass that function any library to operate on arg1, but you don't know the API to library when writing the function. How do you make that function do its thing with arg1 when passing any arbitrary library? So I though you could
[11:37:29] hfp: add a third argument to the signature and make it a block which you'd run within the function, and it's the user's responsibility to write that block using library's API to manipulate arg1. Was a right? Is there a better way?
[11:38:12] hfp: And can the code within the block access the function's arguments when it's executed?
[13:08:52] hfp: ineb: thanks, totally forgot about yield

2017-06-22

[21:48:17] hfp: has left #ruby: ()

2017-06-20

[00:17:23] hfp: *.net *.split
[00:23:06] hfp: has joined #ruby

2017-06-12

[20:10:28] hfp: Ping timeout: 240 seconds
[20:12:45] hfp: has joined #ruby
[20:17:35] hfp: Ping timeout: 240 seconds
[20:20:16] hfp: has joined #ruby

2017-06-09

[19:29:41] hfp: Quit: bye
[19:32:22] hfp: has joined #ruby

2017-06-07

[21:31:46] hfp: Ping timeout: 240 seconds
[21:34:42] hfp: has joined #ruby

2017-06-05

[06:03:19] hfp: Ping timeout: 246 seconds
[06:30:45] hfp: has joined #ruby

2017-06-03

[01:08:24] hfp: Quit: bye
[01:11:03] hfp: has joined #ruby
[16:32:23] hfp: Ping timeout: 260 seconds
[16:34:40] hfp: has joined #ruby

2017-05-23

[12:11:47] hfp: Ping timeout: 260 seconds
[12:14:46] hfp: has joined #ruby

2017-05-14

[02:36:10] hfp: Quit: bye
[02:41:04] hfp: has joined #ruby

2017-04-12

[17:08:57] hfp: Ping timeout: 245 seconds
[17:11:45] hfp: has joined #ruby

2017-04-10

[06:21:17] hfp: Ping timeout: 252 seconds
[06:24:02] hfp: has joined #ruby

2017-04-09

[01:10:16] hfp: Ping timeout: 260 seconds
[01:38:22] hfp: has joined #ruby

2017-04-08

[20:38:04] hfp: Ping timeout: 260 seconds
[20:39:19] hfp: has joined #ruby

2017-04-03

[23:49:06] hfp: One more question... In my .profile, I'm setting a variable within an if statement with `_myvar=true`. Then I try to use it in my .bashrc and in the terminal with `echo $_myvar` but I'm getting an empty var. What am I missing?
[23:56:16] hfp: hekin: I'm sorry, did I ask a bash question here just now? If so, I meant to post it in #bash :s
[23:58:05] hfp: haha sorry about that, bash is /4 in my IRC client, and ruby is /14... I guess I got confused

2017-03-30

[15:46:42] hfp: has joined #ruby
[15:47:51] hfp: Hey, I'm using schacon's ruby-git gem. Is there a way to get the name for the currently checked out branch with it? I want to save the name, checkout master, pull/merge master, and then checkout the branch that was originally checked out
[18:37:30] hfp: I switched to rugged, but I still don't see how can I pull and rebase the master branch programatically
[18:37:53] hfp: (from Ruby, manipulating a git repo on disk)

2016-07-30

[13:09:45] hfp: Ping timeout: 244 seconds
[20:48:47] hfp: has joined #ruby
[20:48:47] hfp: has joined #RubyOnRails

2016-06-20

[12:14:25] hfp: Ping timeout: 260 seconds
[12:23:08] hfp: has joined #ruby
[12:23:08] hfp: has joined #RubyOnRails

2016-06-15

[23:12:59] hfp: *.net *.split

2016-05-30

[07:48:29] hfp: Ping timeout: 264 seconds
[07:50:43] hfp: has joined #RubyOnRails
[07:50:44] hfp: has joined #ruby

2016-05-25

[00:51:38] hfp: Ping timeout: 244 seconds
[00:53:22] hfp: has joined #ruby
[00:53:22] hfp: has joined #RubyOnRails

2016-05-03

[07:58:16] hfp: Ping timeout: 276 seconds
[07:59:23] hfp: has joined #ruby
[07:59:23] hfp: has joined #RubyOnRails

2016-05-01

[01:34:36] hfp: has joined #ruby
[01:34:36] hfp: has joined #RubyOnRails

2016-04-30

[01:03:13] hfp: Remote host closed the connection
[01:05:51] hfp: has joined #ruby
[01:05:51] hfp: has joined #RubyOnRails
[02:06:47] hfp: Ping timeout: 260 seconds
[12:46:50] hfp: Quit: bye

2016-04-29

[02:44:58] hfp: has joined #ruby
[02:44:58] hfp: has joined #RubyOnRails
[02:58:09] hfp: Remote host closed the connection
[03:11:52] hfp: has joined #ruby
[03:11:52] hfp: has joined #RubyOnRails

2016-03-02

[04:39:14] hfp: Ping timeout: 260 seconds

2016-02-27

[22:40:57] hfp: Ping timeout: 240 seconds
[22:53:54] hfp: has joined #ruby
[22:53:54] hfp: has joined #RubyOnRails

2016-02-23

[13:55:28] hfp: Ping timeout: 255 seconds
[13:58:41] hfp: has joined #ruby
[13:58:41] hfp: has joined #RubyOnRails

2016-02-15

[07:03:54] hfp: *.net *.split
[07:04:28] hfp: has joined #RubyOnRails
[07:04:29] hfp: has joined #ruby
[14:24:37] hfp: *.net *.split
[15:25:16] hfp: Ping timeout: 248 seconds
[15:25:51] hfp: has joined #ruby
[15:25:51] hfp: has joined #RubyOnRails
[20:04:24] hfp: Hi, as part of a refactor, I want to test for an object's class name. So I do `if self < MyClass' and this fails. When I call `self.class.name', it returns `Class`. Helpful. Why is it returning `Class`? If I do `self.inspect', I can see the correct class name so why can't I get it in my if?

2016-02-12

[16:54:53] hfp: Hi, what do double asterisks mean? As in `def foo(**args)'
[16:55:50] hfp: EdwardIII: How is it different from `def foo(*args)' ?

2016-02-09

[00:07:51] hfp: Hi, does anyone else encounter this issue when running bundle install? Gem::RemoteFetcher::FetchError: bad response Forbidden 403 (https://rubygems.global.ssl.fastly.net/gems/rb-inotify-0.9.6.gem)
[00:07:57] hfp: Or is it only me
[00:19:33] hfp: Hi, does anyone else encounter this issue when running bundle install? Gem::RemoteFetcher::FetchError: bad response Forbidden 403 (https://rubygems.global.ssl.fastly.net/gems/rb-inotify-0.9.6.gem)
[00:20:09] hfp: Does anyone else get this too? I can install 0.9.7 just fine with `gem install rb-inotify` but not 0.9.6 with bundle install.
[00:21:10] hfp: rubygems website says the gem has been yanked
[00:23:21] hfp: sorry if this is a stupid question, it just never happened to me before :)
[00:45:56] hfp: havenwood: Indeed, I didn't think about checking the page. Never happened to me before, I was confused... I updated my bundle and it's fine now.
[01:44:07] hfp: How do I test that a Job runs another job in the after_perform callback?
[01:44:28] hfp: I tried ` expect { ScrapConcertsJob.perform_later }.to have_enqueued_job(GetArtistSampleJob)
[01:44:49] hfp: ` as per the RSpec docs but it says ActiveJob doesn't ahve an `enqueued_job` method

2016-02-08

[03:33:38] hfp: Hi, I'm scraping a webpage with a job and I'd like to check in a test that the model created by the job contains the right data. If I use a factory with `build` and match with `eq`, the test fails because the ids, created_at, updated_at and the instance id dont match. How can I test the job creates the model and that it has the correct data in it?
[03:54:58] hfp: Ropeney: Yeah I guess I should have one test per field instead of testing all the fields at once

2016-01-24

[14:15:11] hfp: Ping timeout: 264 seconds

2016-01-23

[17:24:11] hfp: Ping timeout: 264 seconds
[17:25:29] hfp: has joined #ruby
[17:25:29] hfp: has joined #RubyOnRails
[20:50:06] hfp: Ping timeout: 240 seconds
[20:51:50] hfp: has joined #ruby
[20:51:50] hfp: has joined #RubyOnRails

2016-01-12

[21:03:31] hfp: Hi, any idea why `bundle exec rake teaspoon` would fail locally but run just fine on travis? It fails with `unable to load fixture`.
[21:06:10] hfp: norc: ha, could be, thanks. I'll try with an older phantomjs

2016-01-09

[06:05:26] hfp: Ping timeout: 240 seconds
[06:13:01] hfp: has joined #ruby
[06:13:01] hfp: has joined #RubyOnRails

2015-12-18

[15:35:26] hfp: Ping timeout: 246 seconds
[15:36:45] hfp: has joined #ruby
[15:36:45] hfp: has joined #RubyOnRails

2015-12-17

[21:24:43] hfp: Hi all, is there a more idiomatic way to write `Hash.reject { |el| !foo.include? el }' ?
[21:42:10] hfp: thanks jhass

2015-12-16

[18:03:37] hfp: Hi all, I have a module whose private methods I'd like to test. I saw that you can use :send for objects to reach private methods but will it also work for a module? A module has no instance so on what do I call the send method?
[18:04:25] hfp: >> def width(size); size; end; width(50) # ChameleonSix
[18:05:39] hfp: ChameleonSix: I think they mean to put the result of `get_answer()` into a variable
[18:06:19] hfp: so something like `answer = get_answer()`. Then your `answer` variable will hold whatever get_answer() returned and you can then parse it further

2015-12-12

[16:17:10] hfp: I have a controller that creates a model, marks it as Model.pending = true and then runs a job that marks it as Model.pending = false once its done. How can I assert that the Model is created with pending = true before the job runs and changes it?
[16:19:39] hfp: I'm using ActionController::TestCase
[16:20:04] hfp: and no testing framework, so Minitest I think?

2015-12-10

[15:07:10] hfp: Hi all! With Active Job, does it matter which queuing backend I use or are they all interchangeable?
[15:21:54] hfp: matthewd: Thanks
[19:57:18] hfp: I'm confused between what delayed_job and active_job do. Which one performs the actual processing?
[20:00:25] hfp: johnnegron: right... so where do I put the actual code that will be executed? Inside the ActiveJob::Base object or within the delayed_job object?
[20:04:11] hfp: johnnegron: I read that guide and thought I understood but then I read this: https://github.com/collectiveidea/delayed_job/tree/v4.1.1#custom-jobs
[20:06:11] hfp: johnnegron: I see, thanks
[20:19:19] hfp: johnnegron: yup, thanks
[20:22:32] hfp: I'm facing another problem now... My use case is that a user can upload a file with up to 750k lines. Each line contains a word. My goal is to find the longest word sequence that starts with a 4 chars word and where each word contains all the previous word's letters + 1. So I split it in two jobs: first I extract every word sequence from the file in one job. Then I pass each sequence to another job that c
[20:22:38] hfp: hecks if they are valid sequences. But now I'm stuck because I don't know how to return the longest sequence since I can only do it once I'm done checking every sequence... How do I know when I have processed all the sequences? Should that be a third job?
[20:42:06] hfp: rhizome: I think the engineering team uses it sometimes when hiring
[22:28:33] hfp: I think I don't understand how carrierwave works. I want to process a text file using carrierwave with active_job. So I have defined my processing function within the uploader and I'm calling it with `process: process_func`. All the process function does is pass the uploaded file's location to an ActiveJob for processing. And it never gets there because it seems the processing function inside the Uploader
[22:28:39] hfp: is never called. I haven't used ActiveJob before and I'm very confused. This is what I have: https://gist.github.com/anonymous/8e0612a419b11a466a4d
[22:29:35] hfp: I'm using delayed_job and carrierwave_backgrounder
[22:32:09] hfp: I'm also wondering if I need carrierwave at all, considering I only use the uploaded file to process it and then never use it again
[22:37:37] hfp: cnk: I am analyzing the text file, its structure and then running a small algorithm on it to validate or reject subsets of the file.
[22:42:45] hfp: carrierwave lets you define a function to call to process the uploaded file. This function never gets called so no processing is ever happening. It's what I'm stuck with at the moment
[22:45:09] hfp: I dont think so. I put a `puts` in the function as the first statement to see if it ever gets run and nope
[22:48:12] hfp: cnk: Same thing, no logs in the console or in the logfile :(

2015-12-09

[16:18:16] hfp: has joined #RubyOnRails
[16:23:08] hfp: Hi! I'd like to build a small rails app where I can upload a huge text file (up to 750k lines) and then process it in the backend to return a chain of lines matching a particular algorithm. Is it a good idea to use carrierwave/refile/paperclip for that or are these gems intended for image upload only?
[16:27:08] hfp: jmarchello, matthewd: I'm not clear if they're expected to put the uploaded file in an ORM or if that's optional
[16:32:16] hfp: matthewd: Thanks
[18:29:47] hfp: has joined #ruby
[18:35:00] hfp: Hi, I'm trying to write an algorithm that checks if a sequence of words matches the following rule: the next word in the sequence must be composed of all the letters from the previous word + 1 letter. This is what I have: https://gist.github.com/anonymous/b0cef050eaaefd747410. It works well except when there is a word that contains the same letter twice because Array#uniq discards the double letter. Any pointers
[18:35:06] hfp: how I could make the code work with the third case too?
[20:57:51] hfp: I'm learning how to count the big O for functions. Could someone tell me if I got it right on this one: https://gist.github.com/anonymous/bdf3a70f4dee578b2d23 ? I think it's an O(n).
[21:01:32] hfp: eam: Yes, I meant it's O(n) and depends on how long word_chain is. Thanks
[21:02:42] hfp: How can I know what's the O of built-in methods?
[21:03:38] hfp: hmm so O(mn) is bad, isn't it?
[21:05:43] hfp: Any comments on my implementation? I'm checking whether a given list of words follows the rule: the next word must be 1 char longer than the previous one and contain all chars from the previous word. Chars order doesn't matter/
[21:07:54] hfp: slash_mode: is it? I'll go check
[21:18:18] hfp: Is it a safe way to check my big O result by feeding the script a list of say 4 elements, run it, see how long it takes. Then rerun it but with 8 elements and see how much longer it takes and use these two times to verify if it's linear or not?
[21:21:54] hfp: norc: How do you make sure you calculated your big O properly then?
[21:22:35] hfp: slash_mode: Oh right, O(mn) is the same as O(n) as far as big O is concerned, isn't it?
[21:22:59] hfp: norc: haha no stopwatch, I wanted to use `time ruby script.rb`
[21:23:58] hfp: norc: so if I wanted to do that, I should use Ruby's Benchmark
[21:25:21] hfp: This puzzle is a lot more complicated than I initially thought
[21:27:15] hfp: I first thought I could solve it with a regex but the fact that letters can change order made this impractical. So then I decided to split every word in the array, call uniq on it and make sure the result was the same length as the last entry in the word_chain array. But no dice, because words with the same letter twice broke it. So then I came up with the current implementation which I think is linear depending
[21:27:21] hfp: on the word_chain size
[21:28:30] hfp: It's a puzzle I was asked to solve and one of the parameters of the puzzle is that the input can be as long as 750k words long
[21:28:45] hfp: So I have to pay attention to performance
[21:29:12] hfp: Although the input is composed of several word chains, so no word chain would be that long most of the time
[21:31:13] hfp: norc: I see, thanks for the tip. Will I still get something out of using a profiler for a short list of 8 words or should I make it much longer for the profiler to be of any use?
[21:31:32] hfp: zacts: yup

2015-10-22

[12:48:50] hfp: Ping timeout: 244 seconds
[12:50:49] hfp: has joined #RubyOnRails
[14:37:31] hfp: Ping timeout: 256 seconds

2015-10-21

[01:24:51] hfp: Ping timeout: 256 seconds
[01:25:42] hfp: has joined #RubyOnRails
[01:29:59] hfp: Ping timeout: 244 seconds
[01:31:43] hfp: has joined #RubyOnRails

2015-10-20

[13:24:47] hfp: Ping timeout: 264 seconds
[13:26:57] hfp: has joined #RubyOnRails
[14:04:26] hfp: Ping timeout: 260 seconds
[14:05:01] hfp: has joined #RubyOnRails
[14:52:27] hfp: Ping timeout: 255 seconds
[14:55:06] hfp: has joined #RubyOnRails
[15:06:05] hfp: Ping timeout: 250 seconds
[15:07:07] hfp: has joined #RubyOnRails

2015-10-19

[17:54:48] hfp: Ping timeout: 272 seconds
[17:56:54] hfp: has joined #RubyOnRails
[18:14:51] hfp: Ping timeout: 256 seconds
[18:16:25] hfp: has joined #RubyOnRails
[18:23:18] hfp: Ping timeout: 260 seconds

2015-10-18

[05:02:51] hfp: *.net *.split

2015-10-17

[16:28:59] hfp: Ping timeout: 264 seconds
[16:31:30] hfp: has joined #RubyOnRails

2015-10-16

[00:16:11] hfp: has joined #RubyOnRails
[01:17:49] hfp: I don't get it. When I run my app in production, I get a 500 error. I set the option to consider all requests local so I have the error output in the browser and it says it can't find the table for my model. I made sure to run `rake db:migrate` in production, i deleted the schema.rb to make sure it's recreated and up to date... I don't know where else to look. Any ideas?
[01:19:09] hfp: This is a prototype app running in production mode in a docker container locally so I'm using WEBrick as the webserver and sqlite. I know these aren't meant for heavy traffic and it's fine, it's just to toy around with but I'd like it to run in production mode

2015-10-15

[00:45:06] hfp: I'm trying to remove a comma that's between two digits. I have `'2,899.00'.gsub(/\d(,)\d/, '')` but instead of returning 2899.00 it returns 99.00. How can I remove just the comma? I need to make sure it's between digits because I can also have 'foo, bar' as input, in which case I want to keep the comma
[01:36:36] hfp: Radar: a CSV file filter
[01:37:07] hfp: Aeyrix: ^
[02:58:04] hfp: When I send a file via a form POST, the URL in the browser changes for an ugly one with the xss token, the utf8 checkmark etc. I remember reading it's possible to post a form and still have a pretty URL without showing all the query's params but I can't remember how to do it. Any pointers?
[03:01:51] hfp: Code: https://gist.github.com/Coaxial/120bf994c389bf90f695
[03:02:02] hfp: This form messses the URL
[03:05:23] hfp: arup_r: thanks
[12:46:05] hfp: So picking up my issue from last night. What is the proper way to have a drop down to select the number of records to show on page? This is what I'm doing right now: https://gist.github.com/Coaxial/120bf994c389bf90f695 but it messes the URL. Someone suggested a POST but I don't think it should be, I'm not passing anything to update any record so I think it should be a GET. Any pointers?
[12:52:13] hfp: matthewd: is there a commonly accepted best practice?
[15:04:55] hfp: How can I count how many records were just created by my controller (it's not the same as the total number of records so Record.count won't cut it)?
[15:14:55] hfp: elaptics: https://gist.github.com/Coaxial/b65f0491b41c329f7cc9
[15:20:44] hfp: elaptics: that makes sense, but how do I get the model to report that?
[15:21:52] hfp: elaptics: Ok, I thought there was a built in method. I'll try to do it myself and ask for more help if I get stuck
[15:34:51] hfp: elaptics: My way doesnt work :( https://gist.github.com/Coaxial/246ec33e042d9b157bf5
[15:35:36] hfp: it doesn't show the count
[15:36:34] hfp: elaptics: Do I `return create_count`? Will it be enough?

2015-10-14

[15:28:00] hfp: has joined #RubyOnRails
[15:29:40] hfp: Hi all, I'm trying to import a csv file into my model. I have a column named 'payee_name' in my schema and 'payee name' in my csv. I import with `Model.create! row.to_hash` but I'm getting an error "unknown attribute 'payee name' for Model". Doesn't it convert 'payee name' to 'payee_name' automatically?
[15:32:20] hfp: tubbo: duh I think I got confused between to_hash and to_s
[15:32:32] hfp: i mean to_sym
[16:50:06] hfp: *.net *.split
[19:30:01] hfp: I'd like to group my paginated activerecords by year and month so I can add the 'spending' column from every entry and get a monthly total. I'm not sure how to do that though. for now I have `@model.group_by{ |m| m.date.strftime('%Y-%m')}`. I can extract `year-month` in my view with that but I don't know how to add the totals for specific columns in the controller instead of passing an array of records to
[19:30:07] hfp: my view

2015-09-20

[00:06:14] hfp: has left #ruby: ()

2015-09-15

[00:17:00] hfp: Ping timeout: 264 seconds
[00:37:01] hfp: has joined #ruby
[15:29:03] hfp: Do you bump a gem's version when adding a homepage and editing the description in a gemspec file?
[15:33:20] hfp: shevy: Thanks, that's what I thought

2015-09-11

[02:19:06] hfp: Quit: bye
[02:21:10] hfp: has joined #ruby

2015-09-07

[02:34:41] hfp: Ping timeout: 272 seconds

2015-08-27

[06:19:09] hfp: Ping timeout: 246 seconds
[06:21:00] hfp: has joined #ruby
[07:12:34] hfp: Ping timeout: 255 seconds
[07:14:34] hfp: has joined #ruby
[09:29:51] hfp: Ping timeout: 260 seconds
[09:37:20] hfp: has joined #ruby

2015-08-22

[14:02:05] hfp: I'm doing an app just for myself and family. I want it to be clean but it's not mission critical
[14:02:23] hfp: yes it works fine with fs :)
[14:03:15] hfp: I can relate... The original version of this app is written in plain asterisk dialplan... no framework, nothing. it's a spaghetti mess now
[14:03:49] hfp: I didnt know any better back then
[14:04:14] hfp: I'm adding a lot of functionality so I dont think Asterisk dialplan would cut it anymore
[14:04:33] hfp: let me look it up
[14:05:49] hfp: oh right, I'm not writing the webapp just yet; I'm writing the voice part for now. The prompts, what happens to the calls, how they are connected or disconnected to each other etc
[14:06:08] hfp: and one function is to be able to record a call then upload it to s3 and receive it by email
[14:06:34] hfp: and I think the easiest way to then display this in a future web app would be to store the metadata from the recording into some kind of db
[14:11:27] hfp: I see, thanks
[14:11:39] hfp: what do you use now to write voip apps bougyman ?
[14:17:37] hfp: and then you control fs over http api calls, correct?