havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com || Ruby 2.4.1, 2.3.4 & 2.2.7: https://www.ruby-lang.org || Paste >3 lines of text to: https://gist.github.com || Rails questions? Ask in: #RubyOnRails || Logs: https://irclog.whitequark.org/ruby || Books: https://goo.gl/wpGhoQ
Slinky_Pete has quit [Ping timeout: 240 seconds]
cagomez has quit [Remote host closed the connection]
jackjackdripper1 has quit [Quit: Leaving.]
kn-928 has joined #ruby
gusrub has joined #ruby
ta_ has joined #ruby
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ndrst has quit [Ping timeout: 276 seconds]
ta_ has quit [Ping timeout: 260 seconds]
ndrst has joined #ruby
ndrst is now known as Guest65485
baroquebobcat has quit [Quit: baroquebobcat]
_sfiguser has quit [Quit: Leaving]
cschneid has joined #ruby
cschneid has quit [Remote host closed the connection]
cschneid has joined #ruby
justthisguy has joined #ruby
BSaboia has quit [Quit: Leaving]
Slinky_Pete has joined #ruby
cschneid has quit [Remote host closed the connection]
nadir has joined #ruby
FastJack has quit [Read error: Connection reset by peer]
FastJack_ has joined #ruby
guardianx has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
gusrub has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
cschnei__ has joined #ruby
kculpis has joined #ruby
millerti has quit [Ping timeout: 246 seconds]
benlieb has joined #ruby
benlieb has quit [Client Quit]
balazs_ has joined #ruby
r3QuiEm_cL has joined #ruby
Slinky_Pete has quit [Remote host closed the connection]
MrBusiness has joined #ruby
cschnei__ has quit [Remote host closed the connection]
GodFather has quit [Quit: Ex-Chat]
GodFather has joined #ruby
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
enterprisey has quit [Quit: Leaving]
lxnr has joined #ruby
coderphive has joined #ruby
marxarelli is now known as marxarelli|afk
someuser has quit [Ping timeout: 248 seconds]
guardianx has quit []
bmurt has joined #ruby
lxnr has quit [Ping timeout: 264 seconds]
gix- has joined #ruby
gix has quit [Disconnected by services]
someuser has joined #ruby
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
kapil___ has joined #ruby
troys is now known as troys_
kn-928 has quit [Ping timeout: 255 seconds]
cosmicz has quit [Quit: This computer has gone to sleep]
dviola has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
dviola has quit [Changing host]
dviola has joined #ruby
astrobunny has joined #ruby
kimbernator has joined #ruby
nacsurte_ has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
gusrub has joined #ruby
bvcosta has quit [Ping timeout: 264 seconds]
<kimbernator> I'm just beginning to learn Ruby (and programming in general), and I'm working with opening and closing files right now and something is confusing me: Typically I'd declare a variable as an IO object for a file by doing "var = open(file)" then read from it by running var.read, finally closing it with a var.close (cont.)
<kimbernator> but
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<kimbernator> by accident I tried "data = open(file).read" and it assigned the contents of the file to the "data" variable
<kimbernator> Whether or not that's good form, I'm not sure if that file is supposed to be closed or if it was automatically
<kimbernator> Because there's no longer an object to run a .close on
<kimbernator> Does that make sense?
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GodFather has quit [Quit: Ex-Chat]
GodFather has joined #ruby
<kimbernator> So I guess the question is this: if I don't create an IO object for a file, but rather run an operation like .read on the open operation itself, does that keep the file open?
QualityAddict has joined #ruby
<kimbernator> Maybe I'm yelling into the wind haha
t-recx has quit [Quit: t-recx]
gizmore has joined #ruby
nobitanobi has quit [Remote host closed the connection]
r3QuiEm_cL has joined #ruby
gizmore|2 has quit [Ping timeout: 246 seconds]
<matthewd> kimbernator: open returns a File object. That's what you're calling read on, either way.
<matthewd> If you don't close it, it gets left open*
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<kimbernator> I am 95% sure that makes sense to me, but the issue that arises using the syntax I did is that I have no method of closing that file anymore
<matthewd> * until it gets automatically closed later, but it's generally bad form to rely on that
<kimbernator> Unless I do and I'm just not aware of it
<matthewd> Correct. So you probably don't want to do that.
r3QuiEm_cL has joined #ruby
<kimbernator> Huh, so it's just a solid way to take up a bunch of memory without a method to reclaim it other than gc
<matthewd> Just like `file = open(..); content = file.read; file = nil`... and now you can't close it.
<kimbernator> Oh wow
<kimbernator> Not a lot of hand-holding huh
<matthewd> I'm not sure what you mean
<matthewd> `file` is a variable that points to an object. If you point it elsewhere, it no longer points to that object.
<kimbernator> I guess it was more a reaction to the logic as a whole, regardless of language
<kimbernator> Like I said, programming isn't something I'm entirely familiar with
<kimbernator> I'm okay with scripting in bash/powershell, but neither of those would present this issue
_aeris_ has quit [Ping timeout: 248 seconds]
<kimbernator> Hey, thanks for the help
The_Schmidt_ has left #ruby ["Leaving"]
<kimbernator> Really appreciate it
<teatime> kimbernator: some languages like python and perl6 have a feature/syntax that lets you do something cool here
<matthewd> GC will take care of it in time... it's just unwise to rely on it because it's consuming an fd, for example
lacuna has joined #ruby
<matthewd> You "should" be using a block, though: then the problem goes away
<matthewd> File.open(...) { |f| ...; f.read; ... }
lacuna has quit [Client Quit]
<teatime> nice, didn't know you could do the same thing in Ruby
_aeris_ has joined #ruby
<matthewd> If you're really just reading a file, though, File.read(filename) is simpler again
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
r3QuiEm_cL has joined #ruby
r3QuiEm_cL has quit [Client Quit]
benlieb has joined #ruby
nexii has joined #ruby
mim1k has joined #ruby
<kimbernator> Right, and after a couple minutes of research that was what I ended up using
<nexii> hello. I was wondering if anyone else is having timeouts when trying to install gems
<kimbernator> I just wanted to understand how ruby was dealing with my questionable syntax
<nexii> I can't even seem to install bundler
jenrzzz has quit [Ping timeout: 240 seconds]
<matthewd> kimbernator: So, I think it's important to emphasize that calling methods on objects (and chains of methods on objects from methods on objects ..) is a very ordinary and reasonable thing to do
<matthewd> kimbernator: The only time it becomes less reasonable is if you need to call multiple methods on the same object
marxarelli|afk is now known as marxarelli
marxarelli is now known as marxarelli|afk
<matthewd> (as you did with read + close)
<kimbernator> At that point I'd want to do "var = open(file); operation ; operation ; var.close", right?
<kimbernator> Just want to make sure I get your drift
<matthewd> In bash terms, you can build as many things as you like into a pipeline, but if you want to send the output of one command into two other separate commands, you're gonna need to store it in a variable
mim1k has quit [Ping timeout: 260 seconds]
A124 has quit [Ping timeout: 240 seconds]
<matthewd> (or use a tempfile, because that's a normal thing to do in a shell) (or use tee, which is just getting complicated)
<matthewd> Right.
<kimbernator> I'm so smart
enterprisey has joined #ruby
<kimbernator> brb applying for a senior developer role
<nexii> does anyone have any advice on how to get past the timeout errors when running gem install?
<matthewd> nexii: I'd investigate it as a network issue ¯\_(ツ)_/¯
charliesome has joined #ruby
d^sh has quit [Ping timeout: 240 seconds]
A124 has joined #ruby
<nexii> matthewd: I thought maybe that was the case, but then I get this error in different networks
d^sh has joined #ruby
mtkd has quit [Ping timeout: 240 seconds]
<kimbernator> Side note: pretty rad that I can hop on to an IRC and get help from one of the members of the rails core team
jordanm has joined #ruby
mtkd has joined #ruby
lxnr has joined #ruby
nofxx has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
lxnr has quit [Ping timeout: 255 seconds]
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<nexii> I just noticed that the issue might be related to my os since my other computer on the same network, which runs OSX, runs bundle just fine whereas the computer that it doesn't work with runs xenial ubuntu
<kimbernator> matthewd: I'm reading the documentation on using a block for File.open(). You're right, it's a bit more elegant than what I'm doing. Good call!
nexii has quit [Remote host closed the connection]
nofxx has quit [Remote host closed the connection]
<matthewd> It's also the more rubyish approach: blocks turn up everywhere
noobineer has joined #ruby
<kimbernator> Again, thanks for the advice buddy. Have a good one!
kimbernator has quit [Quit: Leaving]
lacuna has joined #ruby
baroquebobcat has joined #ruby
jameser has joined #ruby
gusrub has quit [Remote host closed the connection]
knight33 has joined #ruby
skweek has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
someuser has quit [Ping timeout: 248 seconds]
Slinky_Pete has joined #ruby
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gusrub has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
VladGh has quit [Ping timeout: 240 seconds]
ujjain- has quit [Changing host]
ujjain- has joined #ruby
lacuna has joined #ruby
Slinky_Pete has quit [Ping timeout: 248 seconds]
jenrzzz has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
mkali has joined #ruby
__Yiota has joined #ruby
skweek has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
VladGh has joined #ruby
kn-928 has joined #ruby
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxnr has joined #ruby
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
aihwh has joined #ruby
runescape07rsps has quit [Quit: Leaving]
orbyt_ has joined #ruby
lxnr has quit [Ping timeout: 255 seconds]
enterprisey has quit [Quit: Leaving]
Cohedrin_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FahmeF has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nofxx has joined #ruby
anisha has joined #ruby
QualityAddict has quit [Quit: Leaving]
troys_ is now known as troys
FahmeF has quit [Ping timeout: 240 seconds]
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
runescape07rsps has joined #ruby
nofxx has quit [Remote host closed the connection]
ta_ has joined #ruby
nofxx has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
ta_ has quit [Ping timeout: 248 seconds]
dviola has quit [Quit: WeeChat 1.9]
chouhoulis has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
cschneid has joined #ruby
nobitanobi has joined #ruby
chouhoulis has quit [Ping timeout: 260 seconds]
cschneid has quit [Ping timeout: 255 seconds]
ascarter has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Alina-malina has quit [Changing host]
Alina-malina has joined #ruby
nertzy has quit [Ping timeout: 264 seconds]
bambanx has joined #ruby
baroquebobcat has joined #ruby
npgm has quit [Quit: Connection closed for inactivity]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
e2021 has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
aleandros has joined #ruby
mim1k has joined #ruby
gusrub has quit [Remote host closed the connection]
benlieb has quit [Ping timeout: 260 seconds]
GodFather has quit [Ping timeout: 248 seconds]
skweek has quit [Ping timeout: 240 seconds]
coderphive has quit [Quit: coderphive]
Fezzler has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
zacts has quit [Quit: WeeChat 1.9]
Fezzler has quit [Client Quit]
sarbs has joined #ruby
lxnr has joined #ruby
nobitanobi has quit [Remote host closed the connection]
lxnr has quit [Ping timeout: 255 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kn-928 has quit [Ping timeout: 240 seconds]
Slinky_Pete has joined #ruby
P1ro has quit [Remote host closed the connection]
skweek has joined #ruby
Slinky_Pete has quit [Ping timeout: 248 seconds]
skweek has quit [Ping timeout: 260 seconds]
troys is now known as troys_
ascarter has joined #ruby
bambanx has quit [Quit: Leaving]
gusrub has joined #ruby
ta_ has joined #ruby
Keltia has quit [Read error: Connection reset by peer]
Keltia has joined #ruby
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ryandevilla has joined #ruby
ovaltine1 has quit [Ping timeout: 240 seconds]
mim1k has joined #ruby
ascarter has joined #ruby
ryandevilla has quit [Ping timeout: 240 seconds]
gusrub_ has joined #ruby
gusrub has quit [Ping timeout: 260 seconds]
mim1k has quit [Ping timeout: 248 seconds]
live has joined #ruby
live has quit [Quit: Leaving]
kapil___ has quit [Quit: Connection closed for inactivity]
lektrik has joined #ruby
sarbs has quit [Read error: Connection reset by peer]
aleandros has quit [Quit: aleandros]
howdoi has joined #ruby
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guardianx has joined #ruby
e2021 has quit [Remote host closed the connection]
nacsurte has joined #ruby
e2021 has joined #ruby
twillkens has quit [Quit: Lost terminal]
baroquebobcat has quit [Quit: baroquebobcat]
gusrub_ has quit [Remote host closed the connection]
gusrub has joined #ruby
nacsurte has quit [Ping timeout: 240 seconds]
troys_ is now known as troys
cagomez has joined #ruby
govg has joined #ruby
cagomez has quit [Ping timeout: 255 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
danieli has quit [Ping timeout: 248 seconds]
Bock has joined #ruby
rabajaj has joined #ruby
gusrub has quit [Remote host closed the connection]
gusrub has joined #ruby
im0nde has joined #ruby
danieli has joined #ruby
im0nde is now known as asd460
danieli has quit [Changing host]
danieli has joined #ruby
asd460 has quit [Client Quit]
troys has quit [Quit: Bye]
anisha has quit [Quit: This computer has gone to sleep]
kn-928 has joined #ruby
im0nde has joined #ruby
ta_ has quit [Remote host closed the connection]
kn-928 has quit [Ping timeout: 240 seconds]
Dimik has quit [Ping timeout: 240 seconds]
e2021 has quit [Read error: Connection reset by peer]
e2021 has joined #ruby
kapil___ has joined #ruby
clouts has joined #ruby
djbkd has joined #ruby
kluge has quit [Ping timeout: 252 seconds]
ruby-lang446 has quit [Ping timeout: 260 seconds]
spheric has quit [Ping timeout: 248 seconds]
ur5us has quit [Remote host closed the connection]
guardianx has quit []
alex`` has joined #ruby
mbr has quit [Ping timeout: 255 seconds]
mbr has joined #ruby
jinie has quit [Ping timeout: 260 seconds]
jinie has joined #ruby
onegoal has joined #ruby
ledestin has joined #ruby
gusrub has quit [Remote host closed the connection]
ana_ has joined #ruby
shime has joined #ruby
kwd has joined #ruby
im0nde has quit [Quit: im0nde]
conta has joined #ruby
nobody has joined #ruby
nobody has quit [Remote host closed the connection]
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
kwd has quit [Quit: kwd]
djbkd has quit [Ping timeout: 264 seconds]
onegoal has quit [Ping timeout: 260 seconds]
balazs_ has quit [Ping timeout: 240 seconds]
KevinSjoberg has joined #ruby
lxnr has joined #ruby
cadillac_ has quit [Ping timeout: 240 seconds]
shime has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
guardianx has joined #ruby
cadillac_ has joined #ruby
jamesaxl has joined #ruby
Mon_Ouie has quit [Ping timeout: 252 seconds]
ta_ has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
KevinSjoberg has joined #ruby
ana_ has quit [Quit: Leaving]
TomyWork has joined #ruby
guardianx has quit []
ana_ has joined #ruby
quobo has joined #ruby
runescape07rsps has quit [Quit: Leaving]
cagomez has joined #ruby
Burgestrand has joined #ruby
cagomez has quit [Ping timeout: 260 seconds]
mark_66 has joined #ruby
jaruga has joined #ruby
claudiuinberlin has joined #ruby
claudiuinberlin has quit [Client Quit]
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alex`` has quit [Quit: WeeChat 1.9]
KevinSjoberg has joined #ruby
guille-moe has joined #ruby
ur5us has joined #ruby
kn-928 has joined #ruby
lexruee has quit [Ping timeout: 248 seconds]
lexruee has joined #ruby
kn-928 has quit [Ping timeout: 248 seconds]
dextrey has joined #ruby
yeticry_ has quit [Read error: Connection reset by peer]
yeticry has joined #ruby
A124 has quit [Ping timeout: 240 seconds]
e2021 has quit [Remote host closed the connection]
e2021 has joined #ruby
cagomez has joined #ruby
claudiuinberlin has joined #ruby
A124 has joined #ruby
Mon_Ouie has joined #ruby
e2021 has quit [Read error: Connection reset by peer]
e2021 has joined #ruby
Silthias has joined #ruby
im0nde has joined #ruby
Silthias1 has joined #ruby
cagomez has quit [Ping timeout: 260 seconds]
maum has joined #ruby
<maum> I got an error: strip!': invalid byte sequence in EUC-KR
<maum> how can I fix this problem?
dionysus69 has joined #ruby
Silthias has quit [Ping timeout: 260 seconds]
babykosh has joined #ruby
<tobiasvl> maum: can you gist the whole stacktrace?
iamayam has quit [Ping timeout: 255 seconds]
iamayam has joined #ruby
babykosh has quit [Quit: babykosh]
mochiyoda_ has quit [Ping timeout: 255 seconds]
dextrey has quit [Ping timeout: 255 seconds]
mochiyoda_ has joined #ruby
figuresofstick has joined #ruby
alex`` has joined #ruby
imode has quit [Ping timeout: 255 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
mim1k has joined #ruby
bronson has quit [Remote host closed the connection]
cagomez has joined #ruby
justthisguy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Ping timeout: 252 seconds]
KeyJoo has joined #ruby
abrcdbr has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shime has joined #ruby
claudiuinberlin has joined #ruby
claudiuinberlin has quit [Client Quit]
bruno- has joined #ruby
mikecmpbll has joined #ruby
marr has joined #ruby
claudiuinberlin has joined #ruby
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
Ishido has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> maum: by treating encoding with respect.
<dminuoso> maum: Clearly your string has codepoints that are not valid in EUC-KR
<maum> ㅗㅡ
<maum> hm
<dminuoso> maum: So you're probably trying to mojibake your string. Figure out the correct encoding.
<maum> This is traceback
<maum> I declared # encoding: UTF-8
ana_ has quit [Quit: Leaving]
<dminuoso> maum: And where does the string come from?
<dminuoso> Is it a literal in the same file?
cfjk has joined #ruby
<maum> it is same file and I am not sure which string is the problem
<maum> the file was working fine before
ana_ has joined #ruby
belmoussaoui___ has joined #ruby
<dminuoso> maum: Is that a yes or no to my question?
tcopeland has quit [Quit: tcopeland]
<maum> yes
belmoussaoui has quit [Ping timeout: 264 seconds]
<dminuoso> maum: The stack trace will tell you where its coming from, so you can identify the exact string.
FahmeF has joined #ruby
<dminuoso> It's quite possible that your editor considered the file to be some other encoding (say UTF8), saved characters using UTF8 codepoints - but ruby interprets those codepoints as EUC-KR
<dminuoso> So I'd say look into the encoding of your editor.
KeyJoo has quit [Read error: Connection reset by peer]
<maum> the string is 'Dong C. Liu and Jorge Nocedal. 1989. On the limited memory large scale optimization. Mathema tical Programming, 45:503?528.'
<dminuoso> maum: What is your text editors encoding?
bruce_lee has joined #ruby
<maum> how can I check it ? I am using vi editor
<dminuoso> maum: `:set encoding`
aihwh has quit [Quit: Leaving.]
<maum> I tried :set encoding=utf-8 in vi
<maum> but it still same
<dminuoso> maum: ...
<dminuoso> maum: That's the problem to begin with perhaps?
<maum> you mean the problem is the vi encoding?
<dminuoso> maum: Yes. vi is saving the file using encoding "utf-8", and Ruby then interprets that file as encoding "euc-kr"
<dminuoso> mojibake complete.
<maum> :set encoding=euc-kr ?
<maum> hm,... also same
<dminuoso> maum: Well if the characters are already in the buffer Im not sure what would happen.
<maum> ok, thanks for your help!
<TomyWork> has anyone here ever made a totally custom Thin backend?
<TomyWork> i'm confused about start/stop/connect/disconnect
<TomyWork> basically what i want to do is have a custom backend that takes a single connection and exits
<TomyWork> and that connection should be fed from stdin/out
<TomyWork> instead of a socket
GeorgesLeYeti has joined #ruby
<GeorgesLeYeti> Hi
<GeorgesLeYeti> I have a array of values and I want to return an array of uniq value of this array but order by the number of occurency
cagomez has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
abrcdbr_ has joined #ruby
claudiuinberlin has joined #ruby
runescape07rsps has joined #ruby
mostlybadfly has joined #ruby
abrcdbr has quit [Ping timeout: 240 seconds]
cagomez has quit [Ping timeout: 260 seconds]
<dminuoso> &ri Enumerable#group_by GeorgesLeYeti
Puffball has quit [Remote host closed the connection]
<dminuoso> >> [1,1,2,3].group_by(&:itself).values.sort_by(&:length).map(&:first)
<ruby[bot]> dminuoso: # => [2, 3, 1] (https://eval.in/860578)
<dminuoso> It's not particularly efficient though
Mon_Ouie has quit [Ping timeout: 255 seconds]
Mon_Ouie has joined #ruby
Puffball has joined #ruby
<dminuoso> >> [1,1,2,3].each.with_object(Hash.new(0)) { |e, o| o[e] += 1 }.sort_by { |e| e[1] }.map(&:first)
<ruby[bot]> dminuoso: # => [2, 3, 1] (https://eval.in/860581)
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso> I think this is the clean way
Slinky_Pete has joined #ruby
<dminuoso> >> [1,1,2,3].each.with_object(Hash.new(0)) { |e, o| o[e] += 1 }.sort_by { |e| -e[1] }.map(&:first)
<ruby[bot]> dminuoso: # => [1, 2, 3] (https://eval.in/860582)
<dminuoso> For the other sort direction.
* dminuoso pokes apeiros
<dminuoso> Lets play code golf.
Siyfion has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
<TomyWork> high-stakes no-holds-barred code golf
Bish has quit [Quit: leaving]
Slinky_Pete has quit [Ping timeout: 248 seconds]
<GeorgesLeYeti> Woo
<GeorgesLeYeti> Ty a lot guys
s00pcan_ has quit [Read error: Connection reset by peer]
s00pcan has joined #ruby
<dminuoso> Oh I can save one character already
<dminuoso> >> [1,1,2,3].each.with_object(Hash.new(0)) { |e, o| o[e] -= 1 }.sort_by { |e| e[1] }.map(&:first)
<ruby[bot]> dminuoso: # => [1, 2, 3] (https://eval.in/860592)
Serpent7776 has joined #ruby
<dminuoso> If only we had Array#second :|
<dminuoso> .sort_by(&:second).map(&:first) kinda looks neat
biberu has joined #ruby
<TomyWork> >> [1,1,2,3].sort.uniq # i dont know what the task is, but....
<TomyWork> >> [1,1,2,3].sort.uniq # i dont know what the task is, but....
<ruby[bot]> TomyWork: # => [1, 2, 3] (https://eval.in/860596)
roshanavand has joined #ruby
<dminuoso> TomyWork: output must be of uniq values, sort order is order of occurence
<TomyWork> ah
mikecmpbll has joined #ruby
<TomyWork> uniq -c then :)
<dminuoso> Heh
<dminuoso> Actually
nicesignal has quit [Remote host closed the connection]
samlisl_ has joined #ruby
nicesignal has joined #ruby
<dminuoso> >> a = [1,2,2,2,3,4,4]; a.uniq.sort_by { |e| a.count(e) }
<ruby[bot]> dminuoso: # => [1, 3, 4, 2] (https://eval.in/860600)
<dminuoso> I mean its horribly ineffciient but short!
<TomyWork> dang
<dminuoso> >> a = [1,2,2,2,3,4,4]; a.uniq.sort_by { |e| -a.count(e) }
<ruby[bot]> dminuoso: # => [2, 4, 1, 3] (https://eval.in/860601)
kculpis has quit [Ping timeout: 248 seconds]
alex`` has quit [Quit: WeeChat 1.9]
roshanavand has quit [Quit: leaving]
lxnr has quit [Ping timeout: 246 seconds]
astrobunny has quit [Remote host closed the connection]
harfangk has joined #ruby
roshanavand has joined #ruby
roshanavand has quit [Client Quit]
Ishido has quit [Remote host closed the connection]
lxnr has joined #ruby
lxsameer has joined #ruby
ski4x7 has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
Ishido has joined #ruby
ski7777 has joined #ruby
kn-928 has joined #ruby
kn-928 has quit [Ping timeout: 240 seconds]
lxsameer has quit [Ping timeout: 240 seconds]
tcopeland has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
raynold has quit [Quit: Connection closed for inactivity]
bronson has joined #ruby
bruno- has joined #ruby
gregf_ has joined #ruby
lxsameer has joined #ruby
ShalokShalom_ has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
Slinky_Pete has joined #ruby
ShalokShalom has quit [Ping timeout: 240 seconds]
ShalokShalom_ is now known as ShalokShalom
lxsameer has quit [Ping timeout: 248 seconds]
Slinky_Pete has quit [Ping timeout: 240 seconds]
GodFather has joined #ruby
<TomyWork> i want to control what exactly ends up on stdout, so my first two lines in the script are "$actual_stdout = $stdout" and "$stdout = $stderr". why/how does the Thin web server still output to stdout?
<dminuoso> TomyWork: $stdout is just a variable pointing at an object.
<dminuoso> TomyWork: and thin probablz doesn't use that variable?
<elomatreb> STDOUT is the default value of $stdout, nothing stops them from just using it directly
<dminuoso> ^-
* dminuoso pokes elomatreb with ripgrep
<dminuoso> Take that!
<TomyWork> so i probably have to reopen $stdout instead of just reassigning it
<dminuoso> Im not quite sure you really want that.
cagomez has joined #ruby
<TomyWork> works, though :)
<dminuoso> TomyWork: thin has a well defined interface to change how it logs. use it.
tvw has joined #ruby
<TomyWork> i dont want to do that for every single component, though
<dminuoso> TomyWork: I dont see how fiddling with the global stdout/stderr objects is better than just telling thin to be silent for a bit
<dminuoso> ¯\_(ツ)_/¯
<TomyWork> it's not just thin :)
KevinSjoberg has joined #ruby
ur5us has quit [Remote host closed the connection]
<TomyWork> what i'm doing is trying to make sinatra work with xinetd
<TomyWork> and i'm using thin because thin supports custom backends
tcopeland has quit [Quit: tcopeland]
roshanavand has joined #ruby
<TomyWork> and i hope that way i can create a backend that just reads from stdin and writes to stdout
KevinSjoberg has quit [Client Quit]
dionysus69 has quit [Ping timeout: 248 seconds]
stamina has joined #ruby
<TomyWork> which is where xinetd sits
naprimer2 has quit [Ping timeout: 246 seconds]
<TomyWork> right now i'm still confused by Thin::Backends's naming scheme
<TomyWork> but i think i'm making progress :)
naprimer2 has joined #ruby
cagomez has quit [Ping timeout: 255 seconds]
InfinityFye has joined #ruby
<Cork> anyone know if there is a way to kill remote processes started through Net:SSH exec! ?
<Cork> basically when the local script catches a INT event i would want to stop the remote processes too
tcopeland has joined #ruby
anisha has joined #ruby
chalkmonster has joined #ruby
rabajaj has quit [Remote host closed the connection]
apparition has joined #ruby
naprimer2 has quit [Ping timeout: 248 seconds]
abrcdbr has joined #ruby
cagomez has joined #ruby
abrcdbr_ has quit [Ping timeout: 255 seconds]
claudiuinberlin has joined #ruby
nahra` has quit [Remote host closed the connection]
KevinSjoberg has joined #ruby
claudiuinberlin has quit [Client Quit]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cagomez has quit [Ping timeout: 248 seconds]
charliesome has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
abrcdbr has quit [Quit: Textual IRC Client: www.textualapp.com]
t-recx has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jamesaxl has quit [Ping timeout: 260 seconds]
fmartingr has quit [Quit: Connection closed for inactivity]
bronson has joined #ruby
Slinky_Pete has joined #ruby
bronson has quit [Ping timeout: 246 seconds]
Slinky_Pete has quit [Ping timeout: 240 seconds]
figures_ has joined #ruby
figuresofstick has quit [Ping timeout: 248 seconds]
alex`` has joined #ruby
<dminuoso> Cork: didn't we have this discussion yesterday?
<Cork> no
<dminuoso> Weird, just had this topic this week.
<Cork> haven't touch this kind of problem in at least 8 months >_>
jlebrech has joined #ruby
<Cork> this is an old script i'm trying to fix a bug in :)
<dminuoso> Cork: fork the process through some mechanism server side, install a local sighandler for SIGINT and translate it into sending SIGTERM to the fork'ed process.
<Cork> i think i have a fairly clean solution and it looks like it works
<jlebrech> anyone try ubuntu subsystem on windows? my colleague is trying to run middleman on windows 10 and i suggested that would be a better course to take than installing ruby directly on windows
<Cork> i basically store the different ssh sessions in a global hash and on trap("INT") i loop them and run .shutdown! on them
<Cork> it seams to work, not completely through testing yet though
tcopeland has quit [Quit: tcopeland]
kn-928 has joined #ruby
<dminuoso> Cork: Assuming SSH terminates a child process immediately that sounds sane.
<dminuoso> (or rather, Im not sure how SSH server exactly executes things)
<Cork> ya, that is still what i'm trying to test
<Cork> first level looks like it always works, it is child processes i have left
eblip has joined #ruby
eb0t has quit [Ping timeout: 246 seconds]
ShekharReddy has joined #ruby
kn-928 has quit [Ping timeout: 240 seconds]
tcopeland has joined #ruby
Ishido has quit [Ping timeout: 240 seconds]
madhatter has quit [Remote host closed the connection]
Ishido has joined #ruby
tcopeland has quit [Client Quit]
shime has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
naprimer has joined #ruby
tvw has quit [Ping timeout: 240 seconds]
knight33 has joined #ruby
tvw has joined #ruby
charliesome has joined #ruby
dextrey has joined #ruby
cagomez has joined #ruby
madhatter has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ldnunes has joined #ruby
e2021 has quit [Remote host closed the connection]
Mon_Ouie has quit [Ping timeout: 240 seconds]
e2021 has joined #ruby
Mon_Ouie has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
cagomez has quit [Ping timeout: 240 seconds]
kn-928 has joined #ruby
dionysus69 has joined #ruby
claudiuinberlin has joined #ruby
savoir-faire has left #ruby [#ruby]
synthroid has joined #ruby
GeorgesLeYeti has quit [Quit: Leaving]
figures_ is now known as figuresofstick
Slinky_Pete has joined #ruby
kn-928 has quit [Ping timeout: 248 seconds]
Slinky_Pete has quit [Ping timeout: 248 seconds]
runescape07rsps has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gnufied has quit [Quit: Leaving]
jaruga has quit [Quit: jaruga]
claudiuinberlin has joined #ruby
harfangk has quit [Quit: No Ping reply in 180 seconds.]
my123 has quit [Read error: Connection reset by peer]
tcopeland has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gnufied has joined #ruby
harfangk has joined #ruby
jaruga has joined #ruby
e2021 has quit [Remote host closed the connection]
e2021 has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
my123 has joined #ruby
my123 has quit [Changing host]
my123 has joined #ruby
stamina has quit [Quit: WeeChat 1.9]
bmurt has joined #ruby
InfinityFye has quit [Ping timeout: 240 seconds]
jaruga has quit [Ping timeout: 255 seconds]
claudiuinberlin has joined #ruby
InfinityFye has joined #ruby
jaruga has joined #ruby
sekmo has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
elsevero has joined #ruby
afromankenobi has joined #ruby
mkali has quit [Quit: mkali]
cdg has joined #ruby
mkali has joined #ruby
jlebrech has quit [Ping timeout: 255 seconds]
GodFather has quit [Ping timeout: 248 seconds]
cdg_ has joined #ruby
tcopeland has quit [Quit: tcopeland]
alex`` has quit [Quit: WeeChat 1.9]
bruno- has joined #ruby
alex`` has joined #ruby
cdg has quit [Ping timeout: 246 seconds]
sekmo has quit [Quit: Textual IRC Client: www.textualapp.com]
tcopeland has joined #ruby
bruno- has quit [Ping timeout: 240 seconds]
tcopeland has quit [Client Quit]
FahmeF has quit [Remote host closed the connection]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
darix has quit [Quit: may the packets be with you...]
<pavelz> hello. i am working on some project and can
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<pavelz> cant't figure out why bundler does not include gems from git repos in the search path
<elomatreb> Are they in a group you didn't install/require? You should probably show your Gemfile
claudiuinberlin has joined #ruby
dextrey has quit [Ping timeout: 255 seconds]
someuser has joined #ruby
balazs_ has joined #ruby
GodFather has joined #ruby
aagdbl[m] has quit [Ping timeout: 240 seconds]
M107262[m] has quit [Ping timeout: 240 seconds]
aidalgol has quit [Ping timeout: 240 seconds]
Orbixx[m] has quit [Ping timeout: 240 seconds]
tcopeland has joined #ruby
bronson has joined #ruby
<pavelz> how can I check what stuff will be included in an app? i used bundler exec ruby -e 'puts $:
tcopeland has quit [Client Quit]
<pavelz> is that wrong?
shime has joined #ruby
bokayio has quit [Ping timeout: 240 seconds]
DLSteve has joined #ruby
kua[m] has quit [Ping timeout: 240 seconds]
roshanavand has quit [Quit: Leaving]
velu_aon[m] has quit [Ping timeout: 246 seconds]
haylon has quit [Ping timeout: 246 seconds]
dtcristo has quit [Ping timeout: 246 seconds]
Tagami[m] has quit [Ping timeout: 246 seconds]
dman[m] has quit [Ping timeout: 246 seconds]
KevinMGranger has quit [Ping timeout: 246 seconds]
jonjits[m] has quit [Ping timeout: 246 seconds]
watzon has quit [Ping timeout: 246 seconds]
aviraldg has quit [Ping timeout: 255 seconds]
Hanma[m] has quit [Ping timeout: 255 seconds]
gokul_mr[m] has quit [Ping timeout: 264 seconds]
yana[m] has quit [Ping timeout: 264 seconds]
torarne has quit [Ping timeout: 264 seconds]
turt2live has quit [Ping timeout: 255 seconds]
lasenna[m] has quit [Ping timeout: 276 seconds]
Matt[m]1 has quit [Ping timeout: 276 seconds]
cgfbee has quit [Ping timeout: 240 seconds]
tcopeland has joined #ruby
Giphy[m] has quit [Ping timeout: 276 seconds]
Silthias1 has quit [Ping timeout: 255 seconds]
bokayio has joined #ruby
bronson has quit [Ping timeout: 248 seconds]
chmuri has quit [Ping timeout: 240 seconds]
cgfbee has joined #ruby
apparition has quit [Quit: Bye]
tcopeland has quit [Quit: tcopeland]
Silthias has joined #ruby
chmurifree has joined #ruby
tcopeland has joined #ruby
<TomyWork> Cork dont pin me down on it, but I think your first-level processes will get a SIGHUP. do they deal with that?
chouhoulis has joined #ruby
Silthias1 has joined #ruby
tcopeland has quit [Client Quit]
<Cork> TomyWork: ya
Silthias has quit [Ping timeout: 240 seconds]
<TomyWork> what do you mean "ya"?
<pavelz> elomatreb: oh its something different ) there are two files each define a class and class that is inheriting from one defined in other file is not defined.
<pavelz> a head scratcher.
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dextrey has joined #ruby
phinxy has joined #ruby
phinxy has left #ruby [#ruby]
claudiuinberlin has joined #ruby
<pavelz> is there a reason a class might be undefined even if the file defining it is right there?
KevinSjoberg has joined #ruby
Ouchy has joined #ruby
Ouchy has quit [Changing host]
Ouchy has joined #ruby
darix has joined #ruby
dtcristo has joined #ruby
drcode has quit [Quit: ZNC 1.6.5 - http://znc.in]
nertzy has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 260 seconds]
drcode has joined #ruby
Bish has joined #ruby
Emmanuel_Chanel has joined #ruby
drcode has quit [Client Quit]
synthroid has quit [Remote host closed the connection]
Emmanuel_Chanel has quit [Max SendQ exceeded]
tcopeland has joined #ruby
Emmanuel_Chanel has joined #ruby
drcode has joined #ruby
GodFather has quit [Ping timeout: 248 seconds]
knight33 has joined #ruby
harfangk has quit [Ping timeout: 248 seconds]
synthroid has joined #ruby
drcode has quit [Quit: ZNC 1.6.5 - http://znc.in]
mim1k has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
Slinky_Pete has joined #ruby
mim1k has joined #ruby
tvw has quit [Remote host closed the connection]
drcode has joined #ruby
__Yiota has joined #ruby
tcopeland has quit [Quit: tcopeland]
Tagami[m] has joined #ruby
Hanma[m] has joined #ruby
lasenna[m] has joined #ruby
Giphy[m] has joined #ruby
yana[m] has joined #ruby
jonjits[m] has joined #ruby
Orbixx[m] has joined #ruby
aviraldg has joined #ruby
aidalgol has joined #ruby
watzon has joined #ruby
torarne has joined #ruby
M107262[m] has joined #ruby
haylon has joined #ruby
turt2live has joined #ruby
velu_aon[m] has joined #ruby
dman[m] has joined #ruby
KevinMGranger has joined #ruby
kua[m] has joined #ruby
gokul_mr[m] has joined #ruby
aagdbl[m] has joined #ruby
Matt[m]2 has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Slinky_Pete has quit [Ping timeout: 255 seconds]
Rapture has joined #ruby
sylario has joined #ruby
shime has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
Burgestrand has quit [Quit: Closing time!]
tcopeland has joined #ruby
runescape07rsps has joined #ruby
shime has joined #ruby
ta_ has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 240 seconds]
FahmeF has joined #ruby
tcopeland has quit [Ping timeout: 264 seconds]
ResidentBiscuit has joined #ruby
jamiejackson has joined #ruby
shime has quit [Client Quit]
mim1k has joined #ruby
dextrey has quit [Ping timeout: 240 seconds]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bruno- has joined #ruby
kapil___ has joined #ruby
marr has quit [Remote host closed the connection]
skweek has joined #ruby
tcopeland has joined #ruby
marr has joined #ruby
tcopeland has quit [Client Quit]
Mon_Ouie has quit [Ping timeout: 255 seconds]
Mon_Ouie has joined #ruby
oleo has joined #ruby
claudiuinberlin has joined #ruby
afromankenobi has quit [Remote host closed the connection]
ryandevilla has joined #ruby
afromankenobi has joined #ruby
rabajaj has joined #ruby
synthroid has quit [Remote host closed the connection]
afromankenobi has quit [Ping timeout: 240 seconds]
cschneid has joined #ruby
Bhootrk_ has quit [Read error: Connection reset by peer]
kn-928 has joined #ruby
synthroid has joined #ruby
runescape07rsps has quit [Quit: Leaving]
aufi has joined #ruby
afromankenobi has joined #ruby
kn-928 has quit [Ping timeout: 240 seconds]
KCmetro has joined #ruby
nicolai86 has quit [Quit: ZNC - http://znc.in]
nicolai86 has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chouhoulis has quit [Remote host closed the connection]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Mon_Ouie has quit [Ping timeout: 240 seconds]
chouhoulis has joined #ruby
Slinky_Pete has joined #ruby
lacuna has joined #ruby
FrostCandy has joined #ruby
<FrostCandy> in this statement ( var = id if var.nil? ) What is the id ? is that setting var = var.id?
ForeignBiscuit has joined #ruby
ForeignBiscuit has quit [Max SendQ exceeded]
knight33 has joined #ruby
ForeignBiscuit has joined #ruby
mson has joined #ruby
ForeignBiscuit has quit [Max SendQ exceeded]
ForeignBiscuit has joined #ruby
ForeignBiscuit has quit [Max SendQ exceeded]
ForeignBiscuit has joined #ruby
tcopeland has joined #ruby
ResidentBiscuit has quit [Ping timeout: 255 seconds]
Slinky_Pete has quit [Ping timeout: 260 seconds]
gusrub has joined #ruby
rippa has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #ruby
tcopeland has quit [Quit: tcopeland]
Slinky_Pete has joined #ruby
dextrey has joined #ruby
<FrostCandy> oh nm guess i need my coffee
ForeignBiscuit is now known as ResidentBiscuit
xall has joined #ruby
kn-928 has joined #ruby
someuser has quit [Ping timeout: 246 seconds]
conta has quit [Ping timeout: 252 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ana_ has quit [Ping timeout: 252 seconds]
bronson has joined #ruby
synthroid has quit [Remote host closed the connection]
moei has joined #ruby
cagomez has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
shime has joined #ruby
claudiuinberlin has joined #ruby
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
synthroid has joined #ruby
mark_66 has quit [Remote host closed the connection]
troys has joined #ruby
nacsurte has joined #ruby
testuser has joined #ruby
xall has quit [Ping timeout: 240 seconds]
testuser has quit [Client Quit]
xall has joined #ruby
bvcosta has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
KevinSjoberg has joined #ruby
<rabajaj> any help would be really appreciable
SteenJobs_ has joined #ruby
chalkmonster has quit [Quit: Daddy's flown, 'cross the ocean.]
someuser has joined #ruby
bvcosta has quit [Remote host closed the connection]
kn-928 has quit [Ping timeout: 240 seconds]
bvcosta has joined #ruby
gusrub has quit [Remote host closed the connection]
im0nde has quit [Ping timeout: 240 seconds]
baroquebobcat has joined #ruby
knight33 has joined #ruby
gusrub has joined #ruby
bvcosta has quit [Ping timeout: 248 seconds]
kn-928 has joined #ruby
drcode has quit [Quit: ZNC 1.6.5 - http://znc.in]
hahuang65 has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby
bvcosta has joined #ruby
dextrey has quit [Quit: WeeChat 1.9]
mkali has left #ruby [#ruby]
[Butch] has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nobitanobi has joined #ruby
Serpent7776 has quit [Quit: Leaving]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
synthroid has quit [Remote host closed the connection]
alex`` has quit [Quit: WeeChat 1.9]
claudiuinberlin has joined #ruby
nb_bez_______ has joined #ruby
drcode has joined #ruby
Slinky_Pete has quit [Remote host closed the connection]
cdg has joined #ruby
alex`` has joined #ruby
thinkpad has quit [Ping timeout: 246 seconds]
cdg_ has quit [Ping timeout: 260 seconds]
alex`` is now known as alexherbo2
xall has quit [Ping timeout: 252 seconds]
alexherbo2 is now known as alex``
someuser has quit [Ping timeout: 246 seconds]
ryandevilla has quit [Ping timeout: 260 seconds]
guille-moe has quit [Ping timeout: 240 seconds]
justthisguy has joined #ruby
kies has quit [Ping timeout: 255 seconds]
guille-moe has joined #ruby
orbyt_ has joined #ruby
KCmetro has quit [Quit: Leaving...]
cdg_ has joined #ruby
maryo_ has joined #ruby
xall has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
cdg has quit [Ping timeout: 240 seconds]
orbyt_ has quit [Ping timeout: 252 seconds]
uZiel has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
<TomyWork> dminuoso believe it or not, this actually works now: https://gist.github.com/TomyLobo/21746d38b222afdce5b0406e87637f0d
<TomyWork> and i'm pretty sure that's not what you're supposed to do
bronson has joined #ruby
afromankenobi has quit [Remote host closed the connection]
<TomyWork> any advice/comment? :)
afromankenobi has joined #ruby
orbyt_ has joined #ruby
afromank_ has joined #ruby
afromankenobi has quit [Read error: Connection reset by peer]
bruno-_ has joined #ruby
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
bruno- has quit [Ping timeout: 240 seconds]
<havenwood> TomyWork: `STDOUT` is a nice, already existing, placeholder for actual stdout.
FahmeF has quit [Remote host closed the connection]
baroquebobcat has joined #ruby
mim1k has quit [Ping timeout: 246 seconds]
bvcosta has quit [Remote host closed the connection]
bvcosta has joined #ruby
kn-928 has quit [Ping timeout: 248 seconds]
frozengeek has quit [Quit: frozengeek]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
<TomyWork> havenwood so that's preferred over $stdout?
cdg_ has quit [Remote host closed the connection]
bvcosta has quit [Ping timeout: 248 seconds]
<havenwood> TomyWork: STDOUT is preferred when you mean to be using the actual, original stdout.
<havenwood> TomyWork: Like for setting $stdout back after having changed it.
<TomyWork> havenwood err, then how do you explain that my script still works as before if i replace $stdout by STDOUT?
d10n-work has joined #ruby
<TomyWork> i'd say that implies STDOUT gets affected by .reopen, just like $stdout
<TomyWork> but since STDOUT is the default standard out, i should probably reopen that, just in case
bronson has quit [Remote host closed the connection]
gusrub has quit [Remote host closed the connection]
aufi has quit [Ping timeout: 246 seconds]
ryandevilla has joined #ruby
jamiejackson has quit [Ping timeout: 246 seconds]
<sagax> hi all!
<sagax> how to deprecate "eval" ?
hahuang65 has joined #ruby
<TomyWork> sagax https://www.youtube.com/watch?v=ZXsQAXx_ao0 (might be loud)
<TomyWork> btw, i dont know what you mean by your question. are you looking for a way to throw warnings/errors whenever someone uses eval somewhere? are you looking for a clean migration path?
<TomyWork> or something else entirely?
armyriad has joined #ruby
rabajaj has quit [Quit: Leaving]
mson has quit [Quit: Connection closed for inactivity]
eckhardt has joined #ruby
FahmeF has joined #ruby
belmoussaoui___ has quit [Quit: belmoussaoui___]
<baweaver> module Kernel; def eval(*a) raise 'lol no' end end
shime has quit [Quit: Textual IRC Client: www.textualapp.com]
<sagax> TimApple: I just want to disallow the eval method https://apidock.com/ruby/Kernel/eval
phaul has joined #ruby
<baweaver> Problem is what happens if someone else's code uses it you depend on
<matthewd> Define "disallow"?
<baweaver> sagax: why do you need to?
<matthewd> (also "the eval method")
<sagax> i don't need "eval"
<TomyWork> >> module Kernel; def eval(*a) raise 'lol no' end end; eval("format c:")
<ruby[bot]> TomyWork: # => lol no (RuntimeError) ...check link for more (https://eval.in/860975)
<TimApple> huh?
<baweaver> They tagged the wrong person
<baweaver> carry on with your iPhone release
<sagax> I want to improve code security
<baweaver> That's what linters are for
<baweaver> or brakeman
<TomyWork> sagax that might be a red herring
marxarelli|afk is now known as marxarelli
kies has joined #ruby
guille-moe has quit [Ping timeout: 246 seconds]
<TomyWork> sagax are you shopify? :)
<apeiros> dminuoso: only a little bit less code: [1,1,2,3].each_with_object(Hash.new 0){|e,o|o[e]+=1}.sort_by{|a,b|-b}.to_h.keys
gusrub has joined #ruby
taurgal has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guille-moe has joined #ruby
<baweaver> >>[1,1,2,3].each_with_object(Hash.new 0){|e,o|o[e]+=1}.sort_by{|a,b|-b}.to_h.keys
<ruby[bot]> baweaver: # => [1, 2, 3] (https://eval.in/860979)
<baweaver> uniq?
troys is now known as troys_
<baweaver> apeiros: what are we doing today in code golf?
<apeiros> looks to me like items in order of frequency
<baweaver> Ah.
<apeiros> but ask dminuoso, he called for the challenge :)
workmad3 has quit [Ping timeout: 240 seconds]
<sagax> TomyWork: no, i not shopify
nahra has joined #ruby
TomyWork has quit [Ping timeout: 240 seconds]
mim1k has joined #ruby
phaul has quit [Quit: leaving]
<matthewd> >> a=[1,1,2,3];a.uniq.sort_by{|e|-a.count(e)}
<ruby[bot]> matthewd: # => [1, 2, 3] (https://eval.in/860981)
<matthewd> golf != efficient ;)
charliesome has quit [Ping timeout: 248 seconds]
<matthewd> Even if you want to keep the hash, '=' is a bit shorter than 'with_object'
* baweaver keeps looking for a dirty regex / sprintf hack
<baweaver> I don't think it'd be shorter than that though
<sagax> ruby can do this ['a','b','c'].zip(['1','2','3']) => [["a", "1"], ["b", "2"], ["c", "3"]] but how to do "zip" like this? (['a','b','c'],['1','2','3']).zip() with native
mim1k has quit [Ping timeout: 255 seconds]
KevinSjoberg has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> >> [['a','b','c'], ['1','2','3']].transpose
<ruby[bot]> havenwood: # => [["a", "1"], ["b", "2"], ["c", "3"]] (https://eval.in/860985)
<havenwood> sagax: ^
<matthewd> Couple more: a=[1,1,2,3];a.sort_by{|e|-a.count(e)}&a
<sagax> havenwood: wow, thanks
bmurt has joined #ruby
plujon has joined #ruby
nobitanobi has quit [Remote host closed the connection]
nobitanobi has joined #ruby
TomyLobo has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tcopeland has joined #ruby
romulus10 has joined #ruby
baroquebobcat has quit [Quit: baroquebobcat]
cschneid has quit [Remote host closed the connection]
nobitanobi has quit [Ping timeout: 246 seconds]
raynold has joined #ruby
romulus10 has quit [Quit: WeeChat 1.7]
Chuck_ has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Chuck_> On my mac terminal, when I type in ruby -v I did not get the version number. I get "open: unrecognized option "-"
elcontrastador has joined #ruby
FahmeF has quit [Remote host closed the connection]
benlieb has joined #ruby
Ltem has joined #ruby
taurgal has quit [Ping timeout: 248 seconds]
orbyt_ has joined #ruby
taurgal has joined #ruby
<havenwood> Chuck_: check?: command -V ruby
imode has joined #ruby
Silthias1 has quit [Quit: Leaving.]
<havenwood> I don't think it makes for a fewer char count, but it's partially there in the spirit of code golf:
<havenwood> >> [1,1,2,3].chunk(&:i).map(&:pop)
<ruby[bot]> havenwood: # => [[1, 1], [2], [3]] (https://eval.in/860987)
InfinityFye has quit [Quit: Leaving]
<havenwood> (if we can assume presorted)
<Chuck_> I'm just trying to see what versions of ruby I'm using.
<havenwood> Chuck_: I'm trying to see what your Ruby command actually is.
<havenwood> Chuck_: Do you get the expected result for?: command -V ruby
<Chuck_> It showed this: zsh: no matches found: check?:
<havenwood> command -V ruby
<havenwood> Chuck_: just that ^
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Chuck_> zsh: command not found: -V
<havenwood> Chuck_: The part to run is `command -V ruby`.
<havenwood> This whole line:
<havenwood> command -V ruby
<havenwood> The command is `command` with the `-V` flag and `ruby` as an argument.
baroquebobcat has joined #ruby
<Chuck_> ruby is an alias for /usr/bin/open -a /Applications/RubyMine.app/
jinie has quit [Ping timeout: 248 seconds]
runescape07rsps has joined #ruby
<havenwood> Chuck_: That's why ^
<havenwood> Chuck_: You've defined an alias for Ruby that actually opens your RubyMine app.
jinie has joined #ruby
<Chuck_> i use rvm list and it showed all the versions with the asterisk and => for the current version being used but that command for checking ruby version is not working for me.
<havenwood> Chuck_: Check our .zshrc for an: alias ruby="/usr/bin/open -a /Applications/RubyMine.app/"
<havenwood> and delete that line
<Chuck_> i see
<havenwood> Chuck_: You've aliased the `ruby` command to opening your Ruby IDE. That's probably not a good idea.
<havenwood> Chuck_: I'd strongly recommend deleting that alias.
charliesome has joined #ruby
Terens has quit [Ping timeout: 240 seconds]
<havenwood> Chuck_: Maybe instead do an `alias -s rb="open -a /Applications/RubyMine.app"` so it opens Ruby files in your IDE if you "run" them directly like: >> example.rb
ledestin has joined #ruby
<havenwood> Or just pick an alias name other than "ruby".
<Chuck_> Thank you so much, havenwood! I got that to work now.
<havenwood> I'd definitely consider that name reserved for the lang's binary.
<havenwood> Chuck_: You're welcome!
elsevero has quit [Ping timeout: 248 seconds]
elsevero has joined #ruby
ShekharReddy has quit [Quit: Connection closed for inactivity]
conta1 has joined #ruby
nb_bez_______ has quit [Quit: Connection closed for inactivity]
anisha has quit [Quit: This computer has gone to sleep]
conta1 has quit [Ping timeout: 246 seconds]
runescape07rsps has quit [Quit: Leaving]
lxsameer has joined #ruby
Chuck_ has quit [Remote host closed the connection]
snockerton has joined #ruby
knight33 has joined #ruby
FahmeF has joined #ruby
Silthias has joined #ruby
cdg has joined #ruby
guille-moe has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Bock has quit [Ping timeout: 240 seconds]
cdg has quit [Ping timeout: 240 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
belmoussaoui has joined #ruby
cdg has joined #ruby
xall has quit [Quit: xall]
charliesome has joined #ruby
hahuang65 has quit [Ping timeout: 240 seconds]
claudiuinberlin has joined #ruby
Chuck_ has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Slinky_Pete has joined #ruby
FahmeF has quit [Remote host closed the connection]
selim has quit [Ping timeout: 240 seconds]
ryandevilla has quit [Quit: WeeChat 1.7]
cdg has quit [Ping timeout: 260 seconds]
uZiel has quit [Ping timeout: 248 seconds]
charliesome has quit [Ping timeout: 240 seconds]
SHyx0rmZ has joined #ruby
selim has joined #ruby
jamesaxl has joined #ruby
charliesome has joined #ruby
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jinie has quit [Ping timeout: 240 seconds]
jinie has joined #ruby
Burgestrand has joined #ruby
afromank_ has quit []
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
balazs_ has quit [Ping timeout: 255 seconds]
charliesome has quit [Ping timeout: 248 seconds]
charliesome has joined #ruby
<pavelz> i have a problem with this project when i try to start the app there is an error says that class is undefined while it is clearly right there. Could a loading order of some sort cause one of the files in the directory cause it not to load
<pavelz> ?
jgjorgji has joined #ruby
phaul has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
orbyt_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jgjorgji> what's the best way to tar up a ruby program so i don't have to install development tools on servers?
Slinky_Pete has quit [Remote host closed the connection]
<elomatreb> pavelz: You need to explicitely require files you need, Ruby doesn't do autoloading
<pavelz> i guess this is them some sort of bundler/rails fault then
<elomatreb> Rails does do some limited autoloading however
cadillac_ has joined #ruby
bronson has joined #ruby
balazs_ has joined #ruby
orbyt_ has quit [Client Quit]
KevinSjoberg has joined #ruby
hahuang65 has joined #ruby
eckhardt has joined #ruby
bronson has quit [Ping timeout: 255 seconds]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has joined #ruby
LastWhisper____ has quit [Client Quit]
lxnr has quit [Ping timeout: 240 seconds]
LastWhisper____ has joined #ruby
Dimik has joined #ruby
mikecmpbll has joined #ruby
hahuang65 has quit [Ping timeout: 255 seconds]
lacuna has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
cschnei__ has joined #ruby
RedNifre has joined #ruby
<RedNifre> Hi. Any recommendation regarding writing tests?
knight33 has joined #ruby
mtkd has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<elomatreb> RedNifre: Do it? :P
<RedNifre> The Book has a chapter about it and goes with 'test/unit' from the standard library. Is that the way to go or are there significantly better libraries out there that I should use instead?
<Papierkorb> `rspec` is also pretty popular. If it's better depends on your taste
<RedNifre> Oh, I think I heard about that one. Wasn't there a project that used rspec to specify the language but Matz didn't support it so it was abandoned and Ruby is now basically specified by what MRI does each release?
<dminuoso> RedNifre, be careful to test your own code and not someone elses.
mtkd has joined #ruby
<RedNifre> dminuoso I still haven't gotten around figuring out gems and serious project setups (the standard library is still enough for my tiny projects) so there's no risk for encountering other people's code anyway ;)
<Papierkorb> Just get into writing tests. What you use doesn't matter much for that. There are many things to think about, but honestly, just get doing it and learn along the way.
hahuang65 has joined #ruby
<dminuoso> RedNifre, for example I see a lot of rails projects doing idiotic things like it { should belong_to(:blah) }
<RedNifre> Oh, I already write tests in other languages, I was asking about the technical side in Ruby (which library etc.)
<Papierkorb> RedNifre: Just be on the look-out when you got a bit comfortable with it for improvements and best-practices
<RedNifre> Well, I try to mostly write pure functions so testing doesn't get too complicated (No need to create complex mocks if all you have is functions and data)
<elomatreb> dminuoso: I actually like doing that, I accidentally forgot to set up the reverse association on a model multiple times which was only caught by such a test
<dminuoso> elomatreb, I've just frequently seen tests that just try to assert that the "thing in rails you are using" really does what its supposed to.
biberu has quit []
hahuang65 has quit [Ping timeout: 248 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
preyalone has joined #ruby
maryo_ has quit [Quit: Leaving]
Slinky_Pete has joined #ruby
ddffg has joined #ruby
Burgestrand has quit [Quit: Closing time!]
synthroid has joined #ruby
Slinky_Pete has quit [Ping timeout: 240 seconds]
voker57 has quit [Ping timeout: 255 seconds]
voker57 has joined #ruby
voker57 has quit [Changing host]
voker57 has joined #ruby
r3QuiEm_cL has joined #ruby
roonsauce has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
kn-928 has joined #ruby
dviola has joined #ruby
ta_ has joined #ruby
snockerton has quit [Quit: Leaving.]
kn-928 has quit [Ping timeout: 248 seconds]
orbyt_ has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
Slinky_Pete has joined #ruby
al2o3-cr has quit [Ping timeout: 252 seconds]
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jaruga has quit [Quit: jaruga]
nacsurte_ has joined #ruby
sagax has quit [Remote host closed the connection]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
KevinSjoberg has joined #ruby
nacsurte_ has quit [Read error: Connection reset by peer]
Chuck_ has quit [Remote host closed the connection]
bmurt has joined #ruby
nacsurte has quit [Ping timeout: 240 seconds]
dionysus69 has joined #ruby
bronson has joined #ruby
<RedNifre> If I have a byte string, how do I pick three consecutive bytes and join them into a number? e.g. turn 01 00 00 into the number 65536?
<RedNifre> do I have to_i all of them, shift and add? Or is there a simpler way?
<matthewd> I don't know of a built-in thing that'll take three bytes... I guess I might do "\x00#{the_three_bytes}".unpack("N")
<Papierkorb> 24bit integers are whacko anyway. You could use unpack but I don't see much reason, as now you have to add the NUL byte at the right place (endianess)
bronson has quit [Ping timeout: 246 seconds]
lacuna has joined #ruby
<Papierkorb> You can get around that by unpacking a 16bit and a 8bit integer, and then shifting those. But that's not shorter than just manually shifting it right away
<Papierkorb> Makes it also a bit clearer which endianess you're using there
<RedNifre> Well, the unpack variant looks nicer than (bstring[start].to_i << 16) + (bstring[start+1].to_i << 8) + bstring[start+2].to_i
cdg has joined #ruby
<matthewd> `bstring[start, 3].bytes.inject(0) {|l,r| l * 256 + r }` ?
FahmeF has joined #ruby
knight33 has joined #ruby
duracrisis is now known as bob
<RedNifre> Interesting, but isn't "\x00#{bstring[start, 3]}".unpack("N") clearer? (Assuming the reader knows what N means)
bob is now known as Guest61719
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<matthewd> To me, yes -- especially given that unpack is much clearer for other (e.g. 16bit) values
lxnr has joined #ruby
<matthewd> The byte-wrangling isn't terrible in its own right, but it'd stand out horribly against unpacks elsewhere... and byte-wrangling for things that are trivially unpackable seems silly
<RedNifre> is there a variant of unpack that returns the first result instead of an array?
<matthewd> Ruby 2.4 added String#unpack1
<RedNifre> hey wait... I can pick both numbers in one step if I do "Nn", huh?
<matthewd> Yes
<RedNifre> (I have one 3 byte number followed by a 2 byte number)
<RedNifre> excellent
Chuck_ has joined #ruby
<matthewd> I'd also consider using IO#read(n) instead of reading the whole thing then trying to slice strings back out, FWIW
troulouliou_div2 has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
troulouliou_div2 has joined #ruby
troulouliou_div2 has quit [Changing host]
<RedNifre> I thought about that but it's easier for testing if I have a function where I pass a byte string as a parameter and get the parsed object back instead of having the function read the file by itself.
FahmeF has quit [Read error: Connection reset by peer]
<RedNifre> It's now offset, size = "\x00#{bstring[start,5]}".unpack("Nn") , not too shabby.
<matthewd> That's what StringIO is for
<RedNifre> Okay, I'll look it up.
hahuang65 has joined #ruby
<RedNifre> I'm not convinced. My usecase involves small files (couple kB, maybe 1MB max) so I'll probably stick with the less efficient but easier to understand approach.
Chuck_ has quit [Ping timeout: 240 seconds]
graft has quit [Ping timeout: 246 seconds]
cdg_ has joined #ruby
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdg has quit [Ping timeout: 252 seconds]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
knight33 has joined #ruby
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
troulouliou_div2 has quit [Quit: Leaving]
SteenJobs_ has quit [Quit: SteenJobs_]
Guest61719 is now known as duracrisis
dionysus69 has quit [Ping timeout: 248 seconds]
KevinSjoberg has joined #ruby
charliesome has joined #ruby
Ltem has quit [Quit: Leaving]
s1kx has joined #ruby
goyox86 has joined #ruby
d5sx43 has joined #ruby
d5sx43 has quit [Client Quit]
graft has joined #ruby
jazzinimal has joined #ruby
eckhardt has joined #ruby
<RedNifre> The "encoding" of a String is basically just a tag attached to it, right? (I'm asking because "\xff".encoding returns UTF-8, even though that string isn't valid UTF-8)
KevinSjoberg has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<matthewd> Yes
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jordanm has quit [Ping timeout: 240 seconds]
<apeiros> RedNifre: additionally, that tag influences what certain operations do
goyox86 has left #ruby [#ruby]
<RedNifre> so strings are always byte arrays and if i want a UTF-16 string it will be either BE or LE I guess?
synthroid has quit []
lxsameer has quit [Quit: WeeChat 1.7]
goyox86 has joined #ruby
<apeiros> yes
<RedNifre> i see
<apeiros> utf specifies how characters map to bytes
<apeiros> unicode specifies how characters map to codepoints
KevinSjoberg has joined #ruby
<RedNifre> no, uft specifies how codepoints map to differently sized bit vectors.
<RedNifre> E.g. in Java, a String is UTF-16 but you don't have to worry about the endianess inside the language since a char is 16 bit, not 2 x 8 bits.
<apeiros> bit vectors, huh? tell me, what size are those bit vectors?
wogi has quit [Ping timeout: 252 seconds]
<RedNifre> depends, 16 bit in java, 32 in go, 8 in the file system?
<apeiros> then you're not really having utf-16. you have unicode. you have codepoints.
<RedNifre> no, you can't have a codepoint outside of the BMP in java. you have UTF-16.
<apeiros> look, you can call a byte an 8bit vector. ain't no real difference.
<RedNifre> E.g. if you put one gothic letter into a string the string has a length of 2.
<apeiros> that'd be an implementation limitation.
<apeiros> there's no utf-16 without an endianness.
ur5us has joined #ruby
<RedNifre> Why do you believe that?
enterprisey has joined #ruby
<RedNifre> you can put UTF-16 in an int array without worrying about endianess.
KevinSjoberg has quit [Ping timeout: 240 seconds]
<apeiros> as said, then you have unicode.
<apeiros> the thing you put into an array are codepoints.
<RedNifre> no, if you put UTF-32 into an int array you could call it unicode.
<apeiros> *shrug* ok. if you want to believe that.
<RedNifre> Say you put 10FFFF in an array position you might call it unicode, but you are not allowed to use 10FFFF in UTF-16
__Yiota has joined #ruby
<apeiros> how do you write that "utf-16 int array" to disk?
<RedNifre> In either big or little endian?
<apeiros> oh really?
<apeiros> and how do you write it to memory other than disk?
bmurt has joined #ruby
<RedNifre> Sure, the UTF-16 in a file will have endianess (because files are made out of bytes), but the array in RAM isn't concerned with endianess.
alex`` has quit [Ping timeout: 240 seconds]
<apeiros> because endians don't exist in ram? only in hard drives?
ur5us has quit [Ping timeout: 248 seconds]
jenrzzz_ has joined #ruby
wogi has joined #ruby
<RedNifre> On a 64 bit CPU you can read RAM in chunks of 8, 16, 32 or 64 bit. I guess it's usually little endian these days. So I would infact read and write them to RAM in units of 16 bits without worrying about the endianess.
AnoHito has quit [Read error: Connection reset by peer]
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
<apeiros> anyway, as said, the purpose of utf is to map codepoints to bytes. you can believe that or think you know better. IDC. got real stuff to do :)
AnoHito has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
FastJack has joined #ruby
<RedNifre> Then I choose to believe that I know better and believe that only UTF-8 is about mapping codepoints to sequences of bytes. But I agree that it's probably not worth it to continue the discussion.
Paraxial has quit [Remote host closed the connection]
FastJack_ has quit [Read error: Connection reset by peer]
Paraxial has joined #ruby
roonsauce has quit [Remote host closed the connection]
roonsauce has joined #ruby
<dminuoso> apeiros, do you have the keyword "encoding" on highlight?
<apeiros> lol, no
<apeiros> and honestly by now I think I should ignore the topic.
<dminuoso> Too frustrating?
<apeiros> yupp
roonsauce has quit [Ping timeout: 240 seconds]
troys_ is now known as troys
ldnunes has quit [Quit: Leaving]
Azure has quit [Ping timeout: 240 seconds]
belmoussaoui has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
kn-928 has joined #ruby
<imode> is it safe to truncate a securerandom UUID after being encoded in base36?
<apeiros> your computer won't explode if you do it
<imode> given. but I'm looking to generate 10-digit base-36 IDs.
<imode> I'm debating between urlsafe_base64 and truncating a UUID.
<apeiros> well, a type 4 uuid has 122 bits of entropy
belmoussaoui_ has joined #ruby
[Butch] has quit [Quit: I'm out . . .]
<apeiros> 10 digits of base 36 translates to roughly 1/5th of that
<imode> yeah, I got that too.. maybe I'm just better off throwing random base64 at people.
<apeiros> it also means you can't restore the original uuid from the base36
<apeiros> why'd that be better?
<imode> the keys have to be short.
<imode> and urlsafe_base64 has a larger alphabet.
<apeiros> ok. but that's not an answer to the question.
<apeiros> ok. so why don't you translate the uuid to base64?
<imode> I considered it, but I'm wondering what the benefit would be.
<imode> (we're talking about ruby's securerandom, I assume.)
<apeiros> yes. I did not randomly introduce a new type of uuid.
jordanm has joined #ruby
jazzinimal has quit [Ping timeout: 260 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
millerti has joined #ruby
<imode> also, the base64 representation of the UUID would be longer than 10 digits.
<apeiros> the "your computer won't explode" was a hint at you not specifying what "safe" means in your context. just to clarify.
bmurt has joined #ruby
<imode> I'm good. nevermind.
enterprisey has quit [Ping timeout: 248 seconds]
<apeiros> ok
<apeiros> oh, fun, I accidentally my math. 10 digits of base36 is only 1/1454234566226315313152th the entropy of 122bits.
ddffg has quit [Quit: Leaving]
<imode> I just went with a random URL-safe base64 string and went with 12 characters. that gives me 72 bits.
oleo has quit [Quit: irc client terminated!]
Exagone313 has quit [Quit: see ya!]
<apeiros> if you want to calculate the risk of collision, the uuid entry of wikipedia iirc has the basic math formula for that in it.
<apeiros> if that's what you're concerned about RE "safe"
<imode> pretty much. though the number of possible keys with this method pretty much exceeds what I'm going to be doing. :P
<imode> thanks though.
<apeiros> I did find it rather difficult to attach a meaning to the probabilities, though. if you e.g. expect to generate 1mio IDs, is a 0.01% probability of collision low enough?
<apeiros> the number of keys can be misleading re collision probability.
d10n-work has quit [Quit: Connection closed for inactivity]
brw has quit [Ping timeout: 248 seconds]
<apeiros> f.ex., you only need 23 people to have a 50% chance of two people having their birthday on the same date (excluding the year)
jenrzzz_ has quit [Ping timeout: 240 seconds]
<apeiros> iirc…
<havenwood> the birthday paradox
<apeiros> yupp
<havenwood> 70 people for 99.9%
<havenwood> 100 people for six nines.
<apeiros> yeah, it grows surprisingly quick
am55 has quit [Read error: Connection reset by peer]
<apeiros> imode: anyway, unless you're beyond millions of keys, you'll probably be fine with 72 bit of entropy :)
goyox86___ has joined #ruby
<imode> apeiros: yeeeah. :P
<imode> worst case we introduce some extra digits. :P
<apeiros> if it's stored in a db, just have a unique constraint.
enterprisey has joined #ruby
<imode> we're throwing them into redis, but also presenting them to users to share.
<imode> and embedding them in URLs + shortening them.
brw has joined #ruby
goyox86 has quit [Ping timeout: 240 seconds]
Exagone313 has joined #ruby
<imode> huh!
<imode> now that is interesting.
<imode> I think 'll stick with base64 though, as 12 digits is enough for our first tests.
<imode> thanks though! that's an interesting and short demonstration.
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
<matthewd> If you're actually using Rails, you might want has_secure_token, which is backed by that method. But otherwise, it, or the argument^Wdiscussion in the relevant PRs, might be informative.
<apeiros> matthewd: interesting implementation :D
<imode> it definitely is, looking at it now.
<imode> re: the argument/discussion. :P
r3QuiEm_cL has joined #ruby
mim1k has joined #ruby
<apeiros> ` - ["0", "O", "I", "l"]` - I have something similar in an alnum ID generator for our company
<matthewd> https://github.com/rails/rails/pull/25734 is the short answer for why the implementation looks like it does
<matthewd> I think https://github.com/rails/rails/pull/18217 and https://github.com/rails/rails/pull/18347 have some enthused discussion, somewhere in there, of probabilities of collision etc, leading to the decision on which approach to take
hahuang65 has quit [Ping timeout: 248 seconds]
preyalone has quit [Quit: Connection closed for inactivity]
Siyfion has quit [Quit: Textual IRC Client: www.textualapp.com]
mim1k has quit [Ping timeout: 240 seconds]
kn-928 has quit [Ping timeout: 260 seconds]
<apeiros> implemented a faster one (without modulo bias). doubt it'll work for large N's, though.
<apeiros> val = SecureRandom.random_number(58**N); Array.new(N) { val, digit = val.divmod(58); BASE58_ALPHABET[digit] }.join
roonsauce has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
goyox86___ has quit [Ping timeout: 240 seconds]
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
phaul has quit [Ping timeout: 248 seconds]
bronson has joined #ruby
<matthewd> apeiros: Hmm. I think I just assumed that working with even a smallish bigint would be slower... not sure we ever benchmarked that
roonsauce has quit [Remote host closed the connection]
<apeiros> I benched it with larger Ns, it degrades quickly.
Guest19798 has quit [Changing host]
Guest19798 has joined #ruby
Guest19798 is now known as Nicmavr
<RedNifre> How do I check if a file is run directly or in a require_relative? (I want to write tests for a tiny script, but the test starts the stript when I require it)
<apeiros> if $0 == __FILE__
<apeiros> though, best to just explicitly separate executables and libraries
<RedNifre> good point, I'll separate them. Thanks.
jenrzzz has quit [Ping timeout: 260 seconds]
<RedNifre> But what exactly does "if $0 == __FILE__" mean? Does $0 contain the name of the file that was started first and is __FILE__ a constant that refers to the name of the file where it's referenced? Are those just strings with filenames or File objects? Will they be equal if I have identically named files in separate folders?
<apeiros> yes. strings. no.
<apeiros> it's not perfectly reliable since both $0 and __FILE__ can be manipulated. but it's good enough.
<matthewd> Technically __FILE__ is a string, not a constant
* matthewd channels dminuoso
<apeiros> if anything other than a string literal at all, __FILE__ would be a local variable or method
<apeiros> _ is not uppercase ;-)
* apeiros never really bothered to look up as what the ruby parser actually treats it
<apeiros> (it's not registered as lvar, method or constant)
<RedNifre> In irb __FILE__ is "(irb)" and $0 is "irb". Does that distinction mean anything?
FrostCandy has quit []
jenrzzz has joined #ruby
<apeiros> you're not in a file
<matthewd> apeiros: It does get directly inlined as a literal
<apeiros> matthewd: great. so my intuit was right :)
<apeiros> though, I think that wouldn't actually rule it out of being a keyword. I mean nothing stops ruby from inlining the value a keyword evaluates to.
<apeiros> meh
<apeiros> who cares
<apeiros> it's a string. it's magic. rest is implementation details.
Bhootrk_ has joined #ruby
bronson has quit [Ping timeout: 248 seconds]
sagax has joined #ruby
<banisterfiend> apeiros wassup swiss face 9000
<apeiros> me, despite wanting to be in bed. slow backups. fuck em.
<apeiros> and what's up in your region of the world?
<apeiros> where the heck are you nowadays anyway? haven't seen you here in ages!
tcopeland has quit [Quit: tcopeland]
roonsauce has joined #ruby
cjs226_ has joined #ruby
TomyLobo has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
roonsauce has quit [Ping timeout: 260 seconds]
lacuna has quit [Quit: Textual IRC Client: www.textualapp.com]
jenrzzz has joined #ruby
ur5us has joined #ruby
PaulCape_ has quit [Quit: .]
PaulCapestany has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
mikeiniowa has quit [Remote host closed the connection]
mikeiniowa has joined #ruby
<banisterfiend> apeiros netherlands bb
<banisterfiend> apeiros thinking of going to switzlerand for a vacation before my next job starts though
cdg has joined #ruby
<apeiros> well, tell me. we could go have a drink.
<banisterfiend> apeiros coolio where would a swiss recommend a tourist go for a short vacation?
<apeiros> the swiss don't know the tourist places ;-)
<apeiros> japanese 5 day tours will probably go to visit lucerne
<apeiros> then matterhorn
<apeiros> and jungfrau joch
<havenwood> banisterfiend: this American would recommend jungfrau
<apeiros> bern bundeshaus
<havenwood> banisterfiend: lauterbrunnen or murren
<apeiros> I think we have plenty of beautiful places. I don't think we have anything exceptionally great, though.
<havenwood> apeiros: i dunno, pretty breathtaking :-O
<apeiros> ok, maybe I'm just hard to impress :D
cdg_ has quit [Ping timeout: 248 seconds]
cdg has quit [Ping timeout: 248 seconds]
<banisterfiend> mountains & lakes
mtkd has quit [Ping timeout: 252 seconds]
govg has quit [Ping timeout: 248 seconds]
mtkd has joined #ruby
cjs226_ has quit [Quit: Textual IRC Client: www.textualapp.com]
cjs226 has joined #ruby
mostlybadfly has joined #ruby
hanmac has quit [Ping timeout: 246 seconds]
frozengeek has joined #ruby
TomyLobo has joined #ruby
nofxx has quit [Read error: Connection reset by peer]
taurgal has quit [Ping timeout: 240 seconds]
nofxx has joined #ruby
roonsauce has joined #ruby
millerti has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Ouchy has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rutix has quit []
roonsauce has quit [Ping timeout: 248 seconds]
hanmac has joined #ruby
nopolitica has joined #ruby
hahuang65 has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
__Yiota has joined #ruby
jameser has joined #ruby
millerti has joined #ruby
Azure has joined #ruby
elsevero has quit [Ping timeout: 240 seconds]
moei has quit [Quit: Leaving...]
r3QuiEm_cL has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
astrobunny has joined #ruby
FahmeF has quit [Remote host closed the connection]
cjs226 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FahmeF has joined #ruby
thinkpad has joined #ruby
e2021 has quit [Remote host closed the connection]
cjs226 has joined #ruby
e2021 has joined #ruby
FahmeF has quit [Read error: No route to host]
FahmeF has joined #ruby
bruce_lee has quit [Remote host closed the connection]
FahmeF has quit [Read error: No route to host]
FahmeF has joined #ruby
FahmeF_ has joined #ruby
FahmeF has quit [Read error: Connection reset by peer]
jenrzzz_ has joined #ruby
FahmeF_ has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
cjs226 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FahmeF has quit [Read error: Connection reset by peer]
r3QuiEm_cL has joined #ruby
tcopeland has joined #ruby
FahmeF has joined #ruby
r3QuiEm_cL has quit [Client Quit]
SteenJobs_ has joined #ruby
FahmeF_ has joined #ruby
FahmeF has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
FahmeF_ has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
FahmeF_ has joined #ruby
FahmeF has quit [Read error: Connection reset by peer]
cjs226 has joined #ruby
troys is now known as troys_
FahmeF_ has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
orbyt_ has joined #ruby
FahmeF has quit [Read error: No route to host]
FahmeF has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
FahmeF has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
kn-928 has joined #ruby
ur5us has joined #ruby
FahmeF has quit [Read error: No route to host]
FahmeF has joined #ruby
workmad3 has joined #ruby
jenrzzz_ has quit [Ping timeout: 248 seconds]
FahmeF has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
ur5us has quit [Client Quit]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kn-928 has quit [Ping timeout: 248 seconds]
FahmeF has quit [Read error: No route to host]
FahmeF_ has joined #ruby
mim1k has joined #ruby
FahmeF_ has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
FahmeF_ has joined #ruby
FahmeF has quit [Read error: Connection reset by peer]
dj has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
<dj> hi
FahmeF_ has quit [Read error: No route to host]
__Yiota has joined #ruby
FahmeF has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
jackjackdripper has joined #ruby
FahmeF has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
FahmeF has quit [Read error: No route to host]
marr has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
FahmeF has joined #ruby
SteenJobs_ has quit [Quit: SteenJobs_]
FahmeF has quit [Read error: Connection reset by peer]
FahmeF has joined #ruby
SteenJobs_ has joined #ruby
FahmeF has quit [Read error: No route to host]
FahmeF has joined #ruby
gnufied has quit [Ping timeout: 246 seconds]
FahmeF has quit [Read error: No route to host]