Skip to content

Instantly share code, notes, and snippets.

@thatrubylove
Created May 21, 2015 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thatrubylove/76f4011084d2b56e7026 to your computer and use it in GitHub Desktop.
Save thatrubylove/76f4011084d2b56e7026 to your computer and use it in GitHub Desktop.
How an asshole abuses power - be them female or male
* Now talking on #RubyOnRails
* Topic for #RubyOnRails is: Rules: http://goo.gl/dgSj5 | MINASWAN (Matz is nice and so we are nice) | Can't talk? Register/identify with Nickserv first! 4.2.1 has been released! http://goo.gl/Pgv1KO | Newest releases: 4.2.1, 4.1.10, 4.0.13 | Guides: http://goo.gl/Drh96 | API Docs: http://goo.gl/ErSVb | Mailing List: http://is.gd/3Euc | Logs at http://goo.gl/uma9x
* Topic for #RubyOnRails set by Radar (Thu Mar 19 21:49:10 2015)
-ChanServ- [#rubyonrails] Register with nickserv in order to talk: /msg nickserv help
* nattonerd has quit (Remote host closed the connection)
<rubycasts_io_> ahh, hexchat is a nice improvement
* comrad (~britter@freecnc/comrad) has joined
* dented42 (~dented42@71-219-130-168.slkc.qwest.net) has joined
<sevenseacat> rubycasts_io_: welcome back.
* abuzze (~abuzze@office.xing.com) has joined
* nfk|laptop has quit (Ping timeout: 255 seconds)
* Megamos (~anonymous@31.210.249.31) has joined
* wsmoak (~wsmoak@apache/committer/wsmoak) has joined
* jessej (uid88512@gateway/web/irccloud.com/x-mgdiiuexxclfpidm) has joined
* wsmoak_ has quit (Ping timeout: 245 seconds)
* lxsameer (~lxsameer@unaffiliated/lxsameer) has joined
* Disconnected (Operation timed out)
* Loaded log from Thu May 21 02:19:40 2015
* Now talking on #RubyOnRails
* Topic for #RubyOnRails is: Rules: http://goo.gl/dgSj5 | MINASWAN (Matz is nice and so we are nice) | Can't talk? Register/identify with Nickserv first! 4.2.1 has been released! http://goo.gl/Pgv1KO | Newest releases: 4.2.1, 4.1.10, 4.0.13 | Guides: http://goo.gl/Drh96 | API Docs: http://goo.gl/ErSVb | Mailing List: http://is.gd/3Euc | Logs at http://goo.gl/uma9x
* Topic for #RubyOnRails set by Radar (Thu Mar 19 21:49:10 2015)
-ChanServ- [#rubyonrails] Register with nickserv in order to talk: /msg nickserv help
* artto (~artto@89-212-58-38.static.t-2.net) has joined
* dcarmich (~dcarmich@c-67-176-237-158.hsd1.il.comcast.net) has joined
<rickjamesthethir> I have this dictionary and i need to do 2 things. separate into words/sequences and then check to make sure that if a sequence is a duplicate then it never gets outputted in the final output
* alex88 (~alex88@unaffiliated/alex88) has joined
<rubycasts_io_> rickjamesthethir, looks like a job for each_cons :D
<rickjamesthethir> problem is this dictionary is 25,000 words. It's super slow to run an array.each {|x| *searching for duplicate in the same big array* }
<rubycasts_io_> rickjamesthethir, use ruby 2+ and use .lazy
* wsmoak (~wsmoak@apache/committer/wsmoak) has joined
<Radar> rubycasts_io_: example? :)
<rickjamesthethir> so if I take each part of the 25,000 array and then search for duplicates in the same 25,000 array well thats 25,000 * 25,000 0.0
* rocknrollmarc (~rocknroll@p5B3C0284.dip0.t-ipconnect.de) has joined
<rickjamesthethir> let me google .lazy
<rubycasts_io_> rickjamesthethir, you also might want to split the list in half ie, binary search
* the_real_intinig has quit (Ping timeout: 244 seconds)
<rubycasts_io_> Radar, long time no see (since I havent been on since 2009 or so)
<Radar> rubycasts_io_: indeed :)
<Radar> rubycasts_io_: What was your original name?
<rubycasts_io_> Radar, have you gotten you rubyhero award yet?
<Radar> rubycasts_io_: 2012
<rubycasts_io_> good, you needed it :)
<itsgokul> what does this statement do cattr_reader :fields_to_search, :associations_to_search
<rubycasts_io_> peimei
* Juanchito (uid41878@gateway/web/irccloud.com/x-ublrjuwtmlclltep) has joined
<rubycasts_io_> railsjistsu dreamr
<Radar> I don't remember that name :(
<rubycasts_io_> i had a lot
<rubycasts_io_> im a re-brander
* aditya432 has quit (Client Quit)
<Radar> dreamr? but not Dreamer3?
<rubycasts_io_> nope, he is dif
<Radar> Confusing.
* wsmoak_ has quit (Ping timeout: 272 seconds)
<rubycasts_io_> :D
<rubycasts_io_> rubycasts_io_ is much more direct ;)
<Dreamer3> more direct than me?
<Dreamer3> doubtful
<rubycasts_io_> lol
<rubycasts_io_> long time on you too.
* bruno- has quit (Ping timeout: 258 seconds)
<rubycasts_io_> it fees very 2008 in here, I love it
* abuzze (~abuzze@office.xing.com) has joined
* MartinElvar has quit (Remote host closed the connection)
* kaspernj has quit (Quit: Leaving)
* wsmoak_ (~wsmoak@198.98.93.120) has joined
* dudedudeman (~joobrien@209.133.30.67) has joined
<rubycasts_io_> rickjamesthethir, also you can import that into SQL first and then use SQL to work the dupes :D
<sandelius> is there a list with reserved column names somewhere?
<rubycasts_io_> rickjamesthethir, if it were me I would probably go that route as it is much better on memory and speed
<Radar> sandelius: "type"
<rubycasts_io_> and I dig sql
<Radar> end of list? :)
<Radar> goodnight folks
<sandelius> Radar ahh nice :)
<rubycasts_io_> night Radar
* wsmoak has quit (Ping timeout: 255 seconds)
<rubycasts_io_> you know, as many times as I fought with guys like dhh and zenspider (usually on the side of zed or benhardt) it is kind of nice to not be known anymore :D
<sandelius> Radar well how about validate, save etc?
<rubycasts_io_> sandelius, as column names? in the db or in rails?
<rubycasts_io_> attrs in rails shouldnt match existing activerecord method names :)\
* nikamura (~nikamura@client-178-16-44-81.inturbo.lt) has joined
<sandelius> rubycasts_io_ column names that would make ActiveRecord punch me hard :)
* wsmoak_ has quit (Read error: Connection reset by peer)
<sevenseacat> `type` is the main one to watch out for.
<rubycasts_io_> here is how you get that list
* wsmoak (~wsmoak@198.98.93.120) has joined
* wsmoak has quit (Changing host)
* wsmoak (~wsmoak@apache/committer/wsmoak) has joined
<sevenseacat> thats reserved for polymorphic associations.
<rubycasts_io_> ActiveRecord::Base.instance_methods
<rubycasts_io_> yes, type is STI
<rubycasts_io_> single table inheritance
<sevenseacat> STI, sorry.
<nikamura> Hi, how would i go on permitting https://gist.github.com/Nikamura/962c449577079e8a0d3d there params
<nikamura> params.require(:tags).permit ???
<rubycasts_io_> nikamura, since the keys are dynamic you need something like
* dudedudeman has quit (Ping timeout: 258 seconds)
<rubycasts_io_> params.require(:tags).permit!
* AzaToth (~azatoth@wikipedia/AzaToth) has joined
<rubycasts_io_> which I dont like because it is dangerous
<sevenseacat> how are they dynamic?
<nikamura> yeah, but we use brakeman which throughs an error
<rubycasts_io_> 1
<rubycasts_io_> 10
<rubycasts_io_> 15
<rubycasts_io_> those are not static keys
<rubycasts_io_> they are indices
<nikamura> it’s an id of an item
<sevenseacat> indeed, and the strong parameters syntax allows for that.
<rubycasts_io_> which is dynamic
<sevenseacat> looking it up now
* wsmoak has quit (Read error: Connection reset by peer)
<Silex> is there a somehow recommended way to run rails in docker for production? google gives me like 5 different ways, each custom-made by random people
<rubycasts_io_> nikamura, then you need to put tags into a root key
<rubycasts_io_> nikamura, something: {tags:[]}
* wsmoak (~wsmoak@apache/committer/wsmoak) has joined
<rubycasts_io_> so that you can permit on the array syntax of tags
<rubycasts_io_> if tags is in the require you cant, if it is in the permit you can
<rushed> Silex: pretty new deployment method to have anything recommended at this point
<sevenseacat> http://guides.rubyonrails.org/action_controller_overview.html#strong-parameters see 4.5.2
<rubycasts_io_> yes but that is in the permit not the require
<sevenseacat> also, the last example of 4.5.3.
<rubycasts_io_> which is what I said :)
<rubycasts_io_> in the require it cant be an array or you have to permit all sub keys
<sevenseacat> who said anything about a require anywhere
<nikamura> mhm, probably will have to use permit!
* karimb (~kboumedhe@87.pool85-52-16.dynamic.orange.es) has joined
<rubycasts_io_> "<nikamura> params.require(:tags).permit ???"
<rubycasts_io_> that is where
<sevenseacat> so change the require to a permit?
<sevenseacat> then permit the exact options you want
<rubycasts_io_> that would not be 'railsy'
<sevenseacat> the fuck?
<rubycasts_io_> wrap tags in another key
<nikamura> params.permit(:tags)
<nikamura> Unpermitted parameters: utf8, _method, tags, commit
<rubycasts_io_> that way you can require and permit
<sevenseacat> yes, lets make it 'railsy' and do it your way so it can be insecure
* elia (~elia@93-35-11-46.ip52.fastwebnet.it) has joined
* wsmoak_ (~wsmoak@198.98.93.120) has joined
<nikamura> oh okay params.permit(tags: {})
* wsmoak has quit (Read error: Connection reset by peer)
<nikamura> works
<nikamura> thanks
<sevenseacat> nikamura: so slice out the params you want, first
<rubycasts_io_> sevenseacat, you can fuck off again tonight
<sevenseacat> rubycasts_io_: be careful.
<rubycasts_io_> i spent an hour helping someone you wouldnt last night after you accused me of not being friendly
<sevenseacat> and watch your language.
<rubycasts_io_> keep your negative stuff to yourself
<sevenseacat> i didnt accuse you of anything.
<rubycasts_io_> "<sevenseacat> the fuck?"
<rubycasts_io_> ok captain america
<sevenseacat> yes, thats a bit different than telling someone to fuck off.
<nikamura> params.slice(:tags).permit(tags: [:parent_tag, :description])
* tenderlove has quit (Ping timeout: 276 seconds)
<nikamura> cheers gutys
<nikamura> guys*
<sevenseacat> nikamura: good stuff :)
<rubycasts_io_> you can address other people you dont need to get in my kool aid
seveneacat!*@* added to ignore list.
<sevenseacat> rubycasts_io_: thats alright, i've warned you to watch yourself, i wont do it again.
<rubycasts_io_> thanks for the warning big boy
* rocknrol_ (~rocknroll@p5B3C0284.dip0.t-ipconnect.de) has joined
<sevenseacat> good of you to assume we're all boys here.
* rocknrollmarc has quit (Read error: Connection reset by peer)
<rubycasts_io_> you are acting tought, thus big boy
<rubycasts_io_> now bugger off pls
* darutoko (~Vandal@176.209.248.178) has joined
<sevenseacat> i did warn you
<rubycasts_io_> you keep saying that
* ChanServ gives channel operator status to sevenseacat
* You have been kicked from #RubyOnRails by sevenseacat (Your behavior is not conducive to the desired environment.)
No channel joined. Try /join #<channel>
@thatrubylove
Copy link
Author

tldr version here -> https://gist.github.com/thatrubylove/69380eecf75b8faed96f

lines have only been removed, as can be verified from the logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment