<Radar>
What is happening, and what are you expecting to see?
neo_ has joined #ruby
gizmore has quit [Ping timeout: 246 seconds]
Rodya_ has quit [Remote host closed the connection]
pawnbox has joined #ruby
mary5030 has quit [Remote host closed the connection]
<careta>
what I want to do is to have every possible combination of every element of the array in place. I want a string like 24e51b8, which is the combination of all the first elements of each sub array.
Rodya_ has joined #ruby
<careta>
The next number should be 25e51b8, which is the same first elements of each array, except now I'm on the second choice of the second sub-array
htmldrum has joined #ruby
<Radar>
?xy
<ruboto>
it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<Radar>
I'd like to know why you want to do this.
mary5030 has joined #ruby
bruce_lee has quit [Ping timeout: 264 seconds]
nso95- has joined #ruby
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has quit [Ping timeout: 260 seconds]
<careta>
Radar, ok sure. I have a list of hex numbers with 7 "digits". For each position of the 7 digit long number I have calculated what are the possible values. Now I want to build a list of all the possible hex values of this 7 digit long number
mattwildig has quit []
<careta>
so in the gist I gave you, the first sub array contains the possible hex digit values for the first character of a 7 digit long hex number
<careta>
the 2nd for the 2nd digit, etc
<Radar>
Oh I see.
<Radar>
I don't know of a magical way to do that. I'd need to tinker for a bit.
moei has quit [Quit: Leaving...]
maloik has joined #ruby
<careta>
I've been busting my head for a couple of hours, but then again I haven't programmed any serious algorithm for a while
<careta>
so I'm stuck
Azure has quit [Ping timeout: 260 seconds]
moei has joined #ruby
Azure has joined #ruby
<careta>
I thought maybe recursion is best in a case like this
maloik has quit [Ping timeout: 260 seconds]
krobzaur has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
gizmore has joined #ruby
<krobzaur>
Just starting writing my first program in Ruby, I am very pleased
BlackCoyote has quit [Remote host closed the connection]
dimasg has joined #ruby
nso95- has quit [Ping timeout: 240 seconds]
<Radar>
careta: yeah, I don't know how to do that. Sorry.
goodcodeguy has joined #ruby
InvGhosttt has quit [Ping timeout: 240 seconds]
karapetyan has quit [Remote host closed the connection]
dimasg has quit [Ping timeout: 240 seconds]
<krobzaur>
However I do have a question. I have an array of hashes. I want to get every hash in the array that has a specific key:value pair. What is the best way to do that?
dascodeman has joined #ruby
dascodeman has quit [Max SendQ exceeded]
maloik has joined #ruby
dlitvak has joined #ruby
<Radar>
krobzaur: .select
<krobzaur>
Radar: thanks
Rodya_ has quit [Remote host closed the connection]
nickron has joined #ruby
Rodya_ has joined #ruby
nso95- has joined #ruby
maloik has quit [Ping timeout: 260 seconds]
RobertBirnie has quit [Ping timeout: 264 seconds]
dlitvak has quit [Ping timeout: 260 seconds]
grotewold has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
RobertBirnie has joined #ruby
nickron has quit [Quit: leaving]
dascodeman has joined #ruby
Rodya_ has quit [Remote host closed the connection]
dascodeman has quit [Max SendQ exceeded]
nickron has joined #ruby
Jardayn has quit [Read error: Connection reset by peer]
dascodeman has joined #ruby
Rodya_ has joined #ruby
symm- has quit [Quit: Leaving...]
ElSif has joined #ruby
<shevy>
if I have a string like "abc123", is there a trivial way to only keep the numbers? as in to return either 123 or "123"?
weemsledeux has joined #ruby
<shevy>
found it
<shevy>
"abc123".gsub(/\D/, '')
shinnya has quit [Ping timeout: 240 seconds]
yoongkang has joined #ruby
amclain_ has quit [Quit: Leaving]
amincd has joined #ruby
<amincd>
hi! how do I use =~ to return the position of a regex pattern in a str?
<amincd>
200 bits to the first person who answers
<amincd>
joking, that's only worth like 6 cents
scripore has quit [Quit: This computer has gone to sleep]
maloik has joined #ruby
yoongkang has quit [Ping timeout: 240 seconds]
<mozzarella>
why not use index?
<Radar>
amincd: example string and regex?
WatUpMyKnitta has joined #ruby
<amincd>
ok I figured it out
<amincd>
position_var = str_var =~ regex_pattern
nickron has quit [Quit: leaving]
<amincd>
and the str_var and regex_pattern are interchangeable
tvw has quit [Ping timeout: 264 seconds]
<amincd>
in terms of order
SCHAAP137 has quit [Quit: Leaving]
RobertBirnie has quit [Ping timeout: 240 seconds]
maloik has quit [Ping timeout: 260 seconds]
<jhass>
shevy: "abc123[/\d+/]
RobertBirnie has joined #ruby
<jhass>
er plus missing "
yfeldblum has joined #ruby
tulak has joined #ruby
saddad has quit [Ping timeout: 246 seconds]
tulak has quit [Ping timeout: 260 seconds]
calderonroberto has quit [Ping timeout: 246 seconds]
maloik has joined #ruby
pawnbox has joined #ruby
<blubjr>
careta: did you get it working ? http://pastie.org/10585119 does what you want i think but its very ugly, im sure im missing something
ss_much has quit [Quit: Connection closed for inactivity]
Scriptonaut has joined #ruby
<Scriptonaut>
does anyone know of a good tutorial for using ncurses with ruby?
jhn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dlitvak has joined #ruby
dascodeman has joined #ruby
maloik has quit [Ping timeout: 240 seconds]
<agent_white>
Scriptonaut: I just found a "ncurses tutorial" and followed that. It's pretty much the same since the ncurses libs in ruby are just wrappers.
<Scriptonaut>
awesome, would you mind linking?
<Scriptonaut>
the problem is, I don't have much experience with curses in general
revengeofbigd_ has quit [Quit: Connection closed for inactivity]
mrtomme has joined #ruby
hypnosb has joined #ruby
<ja>
edj: it's the first — and only ¯\_(ツ)_/¯ — Ruby book I've read
<ja>
edj: are you listening to the soundtrack?
<edj>
ja: i would but im in the middle of peaky blinders
lxsameer has quit [Remote host closed the connection]
<edj>
ja: how long did it take to go through?
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
forgot has joined #ruby
<ja>
edj: i had never heard of that show. looks cool though. how highly would you recommend/rate it?
<ja>
edj: uhh, a week or so, and then another two weeks for me to truly begin grasping ruby's metaprogramming
<edj>
ja: its dark, 20s gangsters, well done, 9/10 for my taste.
<edj>
ja: yea im kind of eh with metaprograming
<edj>
ja: is this good for it?
fantazo has joined #ruby
<ja>
sounds great! and 20s even, jeez
<ja>
edj: I'd say so, yeah
Oog has quit []
<edj>
ja: alright ill order the paperback and get to work on it in the meantime
<edj>
ja: thank you
<ja>
although the examples are a bit weird and although his parenthesis style is odd (`foo( args )` — I think it's for newcomer clarity), it's the best programming book I've ever seen
<ja>
no problem
<ja>
but remember I warned you it's weird ( ͡° ͜ʖ ͡°)
<edj>
I'm weird
Guest43214 has quit [Ping timeout: 264 seconds]
<ja>
great
<edj>
actually ill have to get to work on it tommorow. its my bed time
<edj>
but thank you so much
<edj>
see you later
<ja>
right on!
<ja>
see you around, edj
CloCkWeRX has quit [Quit: Leaving.]
edj has quit [Quit: Page closed]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Outlastsheep has joined #ruby
CloCkWeRX has joined #ruby
yfeldblum has joined #ruby
Gnut has joined #ruby
ramadoka has quit [Quit: Page closed]
haasn` is now known as haasn
tubuliferous_ has quit [Ping timeout: 240 seconds]
jhn has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
darkxploit has quit [Max SendQ exceeded]
darkxploit has joined #ruby
darkxploit has quit [Remote host closed the connection]
darkxploit has joined #ruby
baweaver has quit [Remote host closed the connection]
diegoaguilar_ has joined #ruby
diegoaguilar has quit [Ping timeout: 240 seconds]
wet88 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
asas is now known as Dimik
saddad has quit [Quit: WeeChat 1.4-dev]
lxsameer has quit [Remote host closed the connection]
lxsameer has joined #ruby
allomov has joined #ruby
skweek has quit [Ping timeout: 240 seconds]
jud has quit [Quit: Leaving]
allomov has quit [Ping timeout: 240 seconds]
xnr has quit [Quit: ರ_ರ]
xnr has joined #ruby
skweek has joined #ruby
Toxo has joined #ruby
Toxo has left #ruby [#ruby]
colegatron has quit [Ping timeout: 240 seconds]
<apeiros>
pontiki, havenwood: updated. moved it from Range to Regexp (where the procs can now be proper class methods), implemented anchor: argument. seems the generated regex was correct yesterday already :) (tested for 0-9999)
<apeiros>
though, I only did the positive tests, not the negative ones
<apeiros>
oh, lol, and I fucked up @ anchor
<apeiros>
forgot to wrap it into a group
kp666 has joined #ruby
Outlastsheep has joined #ruby
axsuul has quit [Ping timeout: 240 seconds]
<apeiros>
updated :)
scripore has joined #ruby
arup_r has quit []
Amnez777- has quit [Changing host]
Amnez777- has joined #ruby
Amnez777- is now known as Amnez777
scripore has quit [Client Quit]
dimasg has quit [Ping timeout: 240 seconds]
colegatron has joined #ruby
weemsledeux has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
trautwein has joined #ruby
trautwein has quit [Client Quit]
weemsledeux has joined #ruby
krz has joined #ruby
exadeci has joined #ruby
otherj has joined #ruby
agent_white has quit [Changing host]
agent_white has joined #ruby
irk has joined #ruby
jayne has joined #ruby
brainslug has joined #ruby
csmb has joined #ruby
bhorn1 has joined #ruby
sshuff|gone has joined #ruby
otherj has quit [Remote host closed the connection]
otherj has joined #ruby
mistym- is now known as mistym
mistym has quit [Changing host]
mistym has joined #ruby
otherj has quit [Remote host closed the connection]
zack6849 has joined #ruby
nirix has joined #ruby
aredridel has joined #ruby
closer has joined #ruby
voxxit has joined #ruby
cibs has joined #ruby
fulgore_ has joined #ruby
timmow has joined #ruby
eshy has joined #ruby
nfsnobody has joined #ruby
pestle has joined #ruby
bodie_ has joined #ruby
otherj has joined #ruby
howdoicomputer has quit [Ping timeout: 264 seconds]
M-mistake has quit [Changing host]
M-mistake has joined #ruby
M-prosodyContext has quit [Changing host]
M-prosodyContext has joined #ruby
M-Kodo has joined #ruby
M-Kodo has quit [Changing host]
Jackneill has quit [Changing host]
Jackneill has joined #ruby
lurch_ has joined #ruby
exadeci has quit [Changing host]
exadeci has joined #ruby
Kartikay has joined #ruby
<jackcom>
what editor is good for ruby?
<Kartikay>
jackcom: I support sublime.
<jackcom>
subime
<jackcom>
how about eclipse?
<Kartikay>
No idea
calderonroberto has quit [Ping timeout: 240 seconds]
<shevy>
jackcom I can't write C# possibly save for hello world example. I am semi-idling, mostly learning from some .pdf unrelated to computers/programming
<jackcom>
ok good
<jackcom>
shevy: :) hello
WPWW1488 has quit [Remote host closed the connection]
spider-mario has joined #ruby
arup_r has quit [Remote host closed the connection]
codecop has quit [Remote host closed the connection]
yoongkang has joined #ruby
baweaver has joined #ruby
baweaver has quit [Ping timeout: 240 seconds]
kp666 has joined #ruby
allomov has joined #ruby
dreinull has joined #ruby
kp666 has quit [Max SendQ exceeded]
<dreinull>
Has anybody tried Ruby + Electron here before?
kp666 has joined #ruby
<dreinull>
Opal could be an option but I have a Sequel dependency which makes it non-trivial.
dionysus69 has quit [Ping timeout: 246 seconds]
kp666 has quit [Max SendQ exceeded]
kp666 has joined #ruby
kp666 has quit [Max SendQ exceeded]
<dreinull>
not saying opal+electron is trivial...
kp666 has joined #ruby
<marahin>
Hello. I'm looking for an effortless-in-coding, easy-to-use, rather fast storage for an IRC bot, so it can store RSS feeds, user memos, definition of words, some statistics. I originally thought of using SQLite, however as far as I see it's not the easiest way around. What would you suggest? Most effortless way would be to use some key/val storage for me
kp666 has quit [Max SendQ exceeded]
kp666 has joined #ruby
allomov has quit [Ping timeout: 240 seconds]
kp666 has quit [Max SendQ exceeded]
kp666 has joined #ruby
kp666 has quit [Max SendQ exceeded]
kp666 has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
kp666 has quit [Max SendQ exceeded]
<apeiros>
marahin: what troubles did you have with sqlite?
kp666 has joined #ruby
<marahin>
apeiros, not really troubles, but it's not as effortless as I would want it to be!
<zenspider>
effortless in coding? echo factoid >> database.txt
wet88 has quit [Quit: Quiting the chat]
<apeiros>
marahin: *sob*, ok, let me rephrase that: what was too much effort about it for you?
kp666 has quit [Max SendQ exceeded]
<marahin>
In order to make it effortless, I would have to define some methods that would make it effortless to store data under key, receive it under value :)
brunto has joined #ruby
<apeiros>
why do you have a key if you use the value to receive it? o0
<marahin>
apeiros, writing raw-SQL syntax! But really now, it's not that I can't do that. I'm really asking here because I wonder what's usually being used around with this kind of cases
<marahin>
apeiros, I got it wrong, sorry
<apeiros>
marahin: sequel allows you to use sqlite and you don't have to use raw sql.
<marahin>
oh. I'll check it out, thank you
<apeiros>
depending on what you do, maybe also take a look at PStore (stdlib)
<zenspider>
if you just want key/value store, gdbm is easier
tagrudev has joined #ruby
Log1x has joined #ruby
DexterLB has quit [Read error: Connection reset by peer]
htmldrum has quit [Ping timeout: 240 seconds]
duncannz has quit [Ping timeout: 260 seconds]
tvw has joined #ruby
dionysus69 has joined #ruby
sandstrom has joined #ruby
<apeiros>
and hi zenspider :) long time since I've last seen you
<blubjr>
hi zenspider
karapetyan has joined #ruby
TheBloke-Away is now known as TheBloke
<zenspider>
hey hey. yeah. I've been ... busy. ;)
<apeiros>
heh, don't I know it :D
marr has quit [Ping timeout: 260 seconds]
BaroMeter has joined #ruby
DexterLB has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
maloik has quit [Ping timeout: 240 seconds]
bersimoes has quit [Remote host closed the connection]
bersimoes has joined #ruby
bersimoes has quit [Ping timeout: 240 seconds]
trautwein has joined #ruby
elaptics`away is now known as elaptics
pandaant has joined #ruby
sepp2k has joined #ruby
linocisco has joined #ruby
lubarch has quit [Quit: leaving]
howdoicomputer has joined #ruby
sameerynho has joined #ruby
lxsameer has quit [Ping timeout: 260 seconds]
howdoicomputer has quit [Ping timeout: 240 seconds]
karapetyan has quit [Remote host closed the connection]
decoponio has joined #ruby
colegatron has quit [Ping timeout: 240 seconds]
trautwein has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sameerynho has quit [Remote host closed the connection]
jarray52 has left #ruby [#ruby]
lxsameer has joined #ruby
BaroMeter has quit [Ping timeout: 246 seconds]
lurch_ has joined #ruby
krz has quit [Ping timeout: 246 seconds]
lurch_ has quit [Client Quit]
sanjayu has joined #ruby
xaitec has joined #ruby
toretore has joined #ruby
xaitec has quit [Client Quit]
maloik has joined #ruby
bersimoes has joined #ruby
karapetyan has joined #ruby
colegatron has joined #ruby
Outlastsheep has quit [Ping timeout: 246 seconds]
Xeago has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
skade has joined #ruby
skade has quit [Client Quit]
Kartikay has quit [Quit: Page closed]
Kartikay has joined #ruby
bersimoes has quit [Read error: Connection reset by peer]
devbug has quit [Read error: Connection reset by peer]
bersimoes has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
reoring has joined #ruby
bersimoes has quit [Client Quit]
karapetyan has quit [Remote host closed the connection]
yoongkang has quit [Remote host closed the connection]
agent_w is now known as agent_white
<Ox0dea>
linocisco: You?
careta has joined #ruby
howdoicomputer has quit [Ping timeout: 240 seconds]
tildes has quit [Ping timeout: 246 seconds]
sanjayu has quit [Ping timeout: 240 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<shevy>
I have a weird question... both lines seem to be synonymous to one another (same output) https://gist.github.com/shevegen/0704695f43cee60d5b62 - but I assume that the first variant will always be faster right?
RegulationD has joined #ruby
freerobby has joined #ruby
<Ox0dea>
Right.
<Ox0dea>
Method invocation is much slower than parse-time concatenation.
jud has quit [Quit: Leaving]
RegulationD has quit [Ping timeout: 240 seconds]
<shevy>
this is funny because rubocop pointed to that
<shevy>
perhaps I should let the autocop run and correct every offending line of code
Outlastsheep has joined #ruby
<Ox0dea>
Perhaps you should sprinkle a little anarchism into your daily routine.
<Papierkorb>
I have this expectation: expect(Haml::Compiler).to receive(:new).with(include ugly: true).and_call_original
careta has quit [Quit: Leaving]
<Papierkorb>
It fails because the argument passed to ::new is not a Hash, but something else. Now, if I'd write ..receive(:new){|opts| ...}, how can I call the original implementation from that block?
sanjayu has joined #ruby
jud has joined #ruby
jud has quit [Changing host]
jud has joined #ruby
devbug has quit [Ping timeout: 240 seconds]
adaedra has joined #ruby
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
kirun has joined #ruby
Xeago has quit [Remote host closed the connection]
SCHAAP137 has quit [Ping timeout: 260 seconds]
reoring has quit [Remote host closed the connection]
arup_r has quit [Remote host closed the connection]
AlexRussia has quit [Ping timeout: 240 seconds]
chouhoulis has quit [Ping timeout: 240 seconds]
<linocisco>
Ox0dea, do you know me?
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
linocisco: I know that you've endeavored to learn Ruby via the Koans, which seems to me to be a sufficient amount of knowledge of you for current purposes. Please ask your question.
agent_white has quit [Quit: gnight]
SCHAAP137 has joined #ruby
Kendos-Kenlen has joined #ruby
d0lph1n98 has joined #ruby
jud has quit [Quit: Leaving]
<linocisco>
Ox0dea, I have no idea what ruby koans is . I am just looking for daily ruby exercise that can help me learn ruby quicker
goodcodeguy has joined #ruby
<TheBloke>
Koans are ruby exercises that can help you learn ruby quicker.
gustav has quit [Remote host closed the connection]
greister has joined #ruby
dimasg has joined #ruby
chouhoulis has quit [Ping timeout: 240 seconds]
test_user17 has left #ruby [#ruby]
cdg has quit [Remote host closed the connection]
lady3bean has joined #ruby
greister has quit [Ping timeout: 240 seconds]
dotix has joined #ruby
User458764 has joined #ruby
lubarch has quit [Quit: leaving]
weemsledeux has joined #ruby
brunto has joined #ruby
gustav has joined #ruby
freerobby has joined #ruby
xaitec has joined #ruby
futilegames has joined #ruby
th0m_ has joined #ruby
gustav has quit [Ping timeout: 260 seconds]
gustav has joined #ruby
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Helheim has joined #ruby
TheBloke is now known as TheBloke-Away
aryaching has quit []
Bugboy1028 has quit [Ping timeout: 272 seconds]
dangerousdave has joined #ruby
cyberfawkes has quit [Ping timeout: 272 seconds]
lavros has quit [Quit: leaving]
mjuszczak has joined #ruby
mjuszczak has quit [Max SendQ exceeded]
mjuszczak has joined #ruby
cornerma1 has joined #ruby
Bugboy1028 has joined #ruby
<havenwood>
g'morn
gizmore has joined #ruby
CyberAssassin has joined #ruby
Ilyes512 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
CyberAssassin is now known as Guest44274
teclator has quit [Ping timeout: 240 seconds]
cornerman has quit [Ping timeout: 240 seconds]
cornerma1 is now known as cornerman
Helheim has quit [Max SendQ exceeded]
Helheim has joined #ruby
myztic has joined #ruby
voodo is now known as voodo|away
ebbflowgo has quit [Quit: ebbflowgo]
yoongkang has quit [Remote host closed the connection]
greister has joined #ruby
strcmp1 has joined #ruby
strcmp1 was kicked from #ruby by ChanServ [Banned: good bye]
howdoicomputer has joined #ruby
mary5030 has joined #ruby
MarkRenton has joined #ruby
colegatron has quit [Ping timeout: 246 seconds]
mattarse has joined #ruby
mmitchel_ has joined #ruby
MarkRenton has left #ruby ["return(function() { return function() { return function {} }}}}}}}}}}}}}}}}}. Bye"]
voodo|away is now known as voodo
voodo has quit [Quit: Leaving...]
stannard has joined #ruby
mmitchell has quit [Ping timeout: 260 seconds]
howdoicomputer has quit [Ping timeout: 246 seconds]
xaitec has quit [Ping timeout: 240 seconds]
Zackio has quit [Quit: C-x C-c]
dangerousdave has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
lockdown has quit [Ping timeout: 246 seconds]
dangerousdave has joined #ruby
Zackio has joined #ruby
RobertBirnie has joined #ruby
stannard has quit [Ping timeout: 240 seconds]
railswebdev has joined #ruby
The_Phoenix has quit [Read error: Connection reset by peer]
mattarse has quit [Ping timeout: 260 seconds]
zenguy_pc has joined #ruby
RobertBirnie has quit [Client Quit]
xaitec has joined #ruby
lockdown has joined #ruby
xaitec has quit [Client Quit]
mattarse has joined #ruby
dlitvak has joined #ruby
<Diabolik>
is there a faster way of checking the number of consonants in a string than just using straight up regex?
NeverDie has joined #ruby
colegatron has joined #ruby
Zackio has quit [Remote host closed the connection]
DexterLB has quit [Quit: So long and thanks for all the fish]
kith has quit [Quit: kith]
ponga has joined #ruby
ergosum has joined #ruby
mattarse has quit [Ping timeout: 246 seconds]
Log1x has quit [Ping timeout: 240 seconds]
tomchapin has joined #ruby
DexterLB has joined #ruby
<bougyman>
>> 'is there a faster way of checking the number of consonants in a string than just using straight up regex?'.each_char.inject(0) { |a,b| 'aeiou'.include?(b) ? a : a + 1 }
<bougyman>
>> 'is there a faster way of checking the number of consonants in a string than just using straight up regex?'.each_char.inject(0) { |a,b| ' aeiou'.include?(b) ? a : a + 1 }
gustav has quit [Remote host closed the connection]
<banister>
havenwood holy?
tubuliferous_ has joined #ruby
<banister>
havenwood awesome, i had no idea String had its own magic #count method
<bougyman>
but then there's punctuation and stuff.
<havenwood>
banister: aye! :)
<bougyman>
probably have to actually use consonants in the string to compare.
pwnd_ has quit [Ping timeout: 240 seconds]
Log1x has joined #ruby
GraveLlama has joined #ruby
<GraveLlama>
Can arrays hold only one type of data or can you mix them
Zackio has quit [Remote host closed the connection]
<bougyman>
>> 'is there a faster way of checking the number of consonants in a string than just using straight up regex?'.each_char.count { |a| 'bcdfghjklmnpqrstvwxyz'.include?(a) }
Log1x has quit [Read error: Connection reset by peer]
<Diabolik>
havenwood
<Diabolik>
to adapt .count 'a-z', '^aeiou' to include uppercase
<Diabolik>
i would just need to add the upper case characters to the second string
<Diabolik>
?
Blaguvest has joined #ruby
brunto has quit [Ping timeout: 260 seconds]
<havenwood>
Diabolik: downcase.count
Moeh has joined #ruby
linocisco has joined #ruby
<havenwood>
Diabolik: if you only care about ASCII chars
grotewold has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<havenwood>
Diabolik: or: 'a-zA-Z', '^aeiouAEIOU'
<havenwood>
it's just ASCII chars anyways
mary5030 has quit [Remote host closed the connection]
<bougyman>
>> 'is there a faster way of checking the number of consonants in a string than just using straight up regex?'.each_char.count { |a| 'bcdfghjklmnpqrstvwxyz'.include?(a.downcase) }
<Moeh>
Say I have a string like "SELECT * FROM users" and I would like to replace the word users in it, but only if it is preceded by the word "FROM", could I still do that with gsub?
<Moeh>
bougyman: The problem is that we allow users to run sql against their own database. I haven't found a nice way to parse sql in ruby and change it programmatically.
kith has joined #ruby
<Ox0dea>
So you are sticking "user" input in SQL statements.
<Moeh>
I am not sure what you mean. AFAIK I don't "stick" user input in SQL statements but rather let users execute arbitrary sql statements.
<havenwood>
apeiros: Good question! I was thinking of trying to support arbitrary ranges. :O Really enjoyed looking at your code, thank you!!
niftylettuce has joined #ruby
dotix has quit [Ping timeout: 260 seconds]
<apeiros>
havenwood: butbutbut… I don't want to wait seeing your code until you support arbitrary ranges! :(
<apeiros>
:<
mary5030 has joined #ruby
pwnd_ has joined #ruby
<apeiros>
:-{
<havenwood>
apeiros: Mine is in a state of shambles but I have code to share. I'll put something together to share later today since I have to relocate right now.
<apeiros>
huzzah! ok havenwood :)
krobzaur has joined #ruby
diegoaguilar has joined #ruby
mjuszczak has quit []
Kis3k1 has joined #ruby
diegoaguilar has quit [Remote host closed the connection]
krobzaur has quit [Ping timeout: 240 seconds]
brunto has quit [Ping timeout: 260 seconds]
Zackio has quit [Quit: C-x C-c]
Zackio has joined #ruby
baweaver has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dangerousdave has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
freerobby has quit [Quit: Leaving.]
agit0 has joined #ruby
sideshowcoder_ has joined #ruby
linocisco has quit [Ping timeout: 246 seconds]
yoongkang has joined #ruby
davedev24 has joined #ruby
howdoicomputer has joined #ruby
mary5030 has quit [Remote host closed the connection]
<Diabolik>
how can i modify this to a) optimize it and b) allow for nil?
mary5030 has joined #ruby
<apeiros>
Diabolik: why do you once use .scan and once .count?
woven has joined #ruby
<tobiasvl>
Diabolik: although a Hash is obviously an object, are hash keys "properties"? sure the assignment isn't asking you to create your own class?
<jhass>
words=nil
howdoicomputer has quit [Ping timeout: 240 seconds]
xaitec has joined #ruby
freerobby has joined #ruby
xaitec has quit [Client Quit]
<apeiros>
and I'm not sure why you'd want to allow for nil, but a common way to deal with edge-cases like that is early return: `def …; return {"vowels" => 0, …} unless words; …`
yoongkang has quit [Ping timeout: 246 seconds]
<apeiros>
last but not least: "vowels" and "consonants" should be symbols there IMO.
<Diabolik>
apeiros i agree but im matching the test spec
<Diabolik>
apeiros my problem is when i run this test
<Diabolik>
Test.assert_equals(get_count(nil),{"vowels"=>0,"consonants"=>0},'Should return 5 vowel and 0 consonants')
<Diabolik>
i get
<Diabolik>
`get_count': wrong number of arguments (0 for 1) (ArgumentError)
<Diabolik>
from `
<Diabolik>
'
tomchapin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cpup has quit [Ping timeout: 264 seconds]
cpup has joined #ruby
<apeiros>
Diabolik: you're mixing up stuff there.
<apeiros>
make sure you actually paste the right error with the right code.
<apeiros>
because 0 for 1 says you are not passing an argument. but the code you show does pass an argument.
<Diabolik>
ah ofc
<Diabolik>
sorry
<Diabolik>
Test.assert_equals(get_count(),{"vowels"=>0,"consonants"=>0},'Should return 0 vowel and 0 consonants')
<apeiros>
good. and that'd be because your get_count requires an argument. the argument isn't optional.
<apeiros>
foo(nil) is not the same as foo()
elaptics is now known as elaptics`away
<Diabolik>
so it should be def get_count(*words)?
asas has joined #ruby
patrick has joined #ruby
Azure has joined #ruby
patrick is now known as Guest34190
pandaant has quit [Remote host closed the connection]
thesheff17 has quit [Ping timeout: 264 seconds]
<Ox0dea>
Diabolik: You could also just use the empty string as the default argument.
bttf has quit [Read error: Connection reset by peer]
<apeiros>
Diabolik: that makes get_count accept *any number* of arguments. that's almost certainly not what you want.
<apeiros>
Diabolik: you probably want a default value for the single argument it takes.
<Ox0dea>
(Somebody else tell Diabolik he should use a default argument.)
<apeiros>
Ox0dea: if it should take nil (IMO bad, but well…), then the default should IMO be nil too.
<apeiros>
IMO it shouldn't have a default value either. get_count() is silly.
<apeiros>
either this is homework or a horrible spec.
<apeiros>
(even with as homework it's a horrible spec - shouldn't use bad code to teach)
<apeiros>
-with
Emmanuel_Chanel has joined #ruby
Emmanuel_Chanel has quit [Max SendQ exceeded]
<Ox0dea>
Perhaps the intent of the exercise is to teach defensive programming.
Emmanuel_Chanel has joined #ruby
chouhoulis has joined #ruby
<apeiros>
s/defensive/stupid/
brt has quit [Ping timeout: 246 seconds]
<apeiros>
exploding early at nonsensical input is a perfectly sane defense.
<apeiros>
swallowing all kinds of shit is rather silly defense.
Jardayn has joined #ruby
cpup has quit [Ping timeout: 240 seconds]
<linocisco>
hi all
<apeiros>
hi linocisco
thesheff17 has joined #ruby
<linocisco>
I have install ruby. Can I still install rbenv?
<linocisco>
I have install ruby 1.9 using apt-get install ruby on ubuntu. Can I still install rbenv?
<apeiros>
linocisco: look at the rbenv website and see what they say?
<Ox0dea>
I think people who do this don't realize they're on camera.
<linocisco>
apeiros, thanks.
cpup has joined #ruby
bttf has joined #ruby
TheBloke-Away is now known as TheBloke
chouhoulis has quit [Ping timeout: 246 seconds]
RobertBirnie has joined #ruby
darkxploit has quit [Ping timeout: 260 seconds]
cpup has quit [Ping timeout: 240 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
houhoulis has quit [Remote host closed the connection]
User458764 has joined #ruby
momo-reina has joined #ruby
arup_r has quit [Remote host closed the connection]
arup_r has joined #ruby
krobzaur has joined #ruby
Jardayn has quit [Read error: Connection reset by peer]
yqt has joined #ruby
colegatron has quit [Ping timeout: 246 seconds]
banister has joined #ruby
krobzaur has quit [Ping timeout: 240 seconds]
futilegames has joined #ruby
TheBloke is now known as TheBloke-Away
darkxploit has joined #ruby
asas is now known as Dimik
tmtwd has joined #ruby
last_staff has joined #ruby
akkad has quit [Excess Flood]
colegatron has joined #ruby
greister has quit [Ping timeout: 260 seconds]
TheHodge has joined #ruby
akkad has joined #ruby
woven has quit [Ping timeout: 260 seconds]
dangerousdave has joined #ruby
howdoicomputer has joined #ruby
dangerousdave has quit [Max SendQ exceeded]
karapetyan has joined #ruby
yoongkang has joined #ruby
tildes has joined #ruby
TheBloke-Away is now known as TheBloke
stannard has joined #ruby
GraveLlama has quit [Read error: Connection reset by peer]
GraveLlama has joined #ruby
howdoicomputer has quit [Ping timeout: 240 seconds]
roshanavand has quit [Remote host closed the connection]
yoongkang has quit [Ping timeout: 240 seconds]
shinnya has quit [Ping timeout: 240 seconds]
stannard has quit [Ping timeout: 240 seconds]
xaitec has joined #ruby
howdoicomputer has joined #ruby
woven has joined #ruby
dangerousdave has joined #ruby
dangerousdave has quit [Max SendQ exceeded]
InvGhostt has quit [Ping timeout: 240 seconds]
dlitvak has quit [Remote host closed the connection]
crowell has quit [Changing host]
crowell has joined #ruby
mary5030 has joined #ruby
Kis3k1 has quit [Quit: Leaving]
brunto has joined #ruby
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
greister has joined #ruby
mary5030 has quit [Ping timeout: 240 seconds]
dimasg has joined #ruby
xaitec has quit [Quit: Xaitec]
momo-reina has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
chouhoulis has joined #ruby
Bubaphex has joined #ruby
Bubaphex has quit [Client Quit]
banister has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<linocisco>
hi all
VeryBewitching has joined #ruby
dimasg has quit [Ping timeout: 240 seconds]
<linocisco>
before installation of RVM, i installed ruby on ubuntu using apt-get install ruby and which installed 1.9 automatically.
<VeryBewitching>
G'day folks.
<Diabolik>
apeiros its not homework
<Diabolik>
its on codewars
Rickmast_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
krobzaur has joined #ruby
<linocisco>
when I install rvm using \curl -sSL https://get.rvm.io | bash -s stable --ruby. it installed rvm with ruby version 2.2.1 in specific directory. and I can't find version 1.9 using rvm use 1.9
chouhoulis has quit [Ping timeout: 240 seconds]
cdg has joined #ruby
<havenwood>
linocisco: For system Ruby: rvm use system
dotix has joined #ruby
dotix has joined #ruby
dotix has quit [Changing host]
dotix has quit [Remote host closed the connection]
dotix has joined #ruby
dotix has quit [Changing host]
dotix has joined #ruby
<havenwood>
linocisco: If you're looking for a switcher lighter than RVM use chruby not rbenv.
<linocisco>
havenwood, I was not aware of that
Xeago has joined #ruby
<linocisco>
havenwood, i m not using rbenv, i am using rvm
<havenwood>
linocisco: I only mention it because you said rbenv earlier then RVM.
<apeiros>
linocisco: with rvm, you generally use rvm to install your ruby. not apt.
<apeiros>
i.e., rvm install ruby-2.2.3; rvm use 2.2.3 --default
<linocisco>
havenwood, yes. it was right.. but I didn't install rbenv which installation is complicated
<havenwood>
linocisco: Use the command apeiros showed above to install 2.2.3 and set it as the RVM default Ruby.
<linocisco>
apeiros, yes. I see. I installed ruby simply via apt-get install ruby first before I know other options
<havenwood>
linocisco: To switch back to system Ruby: rvm use system
myztic has quit [Ping timeout: 246 seconds]
<linocisco>
havenwood, that is easier
<linocisco>
havenwood, apeiros thanks all
BTRE has quit [Read error: Connection reset by peer]
cdg has quit [Ping timeout: 260 seconds]
varunwachaspati has quit [Quit: Connection closed for inactivity]
myztic has joined #ruby
myztic has quit [Client Quit]
Xeago has quit [Ping timeout: 260 seconds]
ereslibre_laptop has quit [Ping timeout: 276 seconds]
BTRE has joined #ruby
myztic has joined #ruby
<linocisco>
havenwood, apeiros some_guy = { :name => "Tony", :age => 21 } is not working in version 1.9
<linocisco>
havenwood, apeiros now.ok with version 2.2.3 which is latest
<apeiros>
linocisco: "not working" is a useless problem description
<apeiros>
Kis3k1: in general, try to use pry (or irb) to answer such questions.
dangerousdave has joined #ruby
dangerousdave has quit [Max SendQ exceeded]
<Kis3k1>
alright, thanks
<apeiros>
IMO ?<char> literals is syntax which you should know about, but not use.
wet88 has joined #ruby
<pontiki>
Postel's Principle
GarethAdams has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
<blubjr>
oh weird
dangerousdave has joined #ruby
dangerousdave has quit [Max SendQ exceeded]
agent_white is now known as agent_fake
Jackneill has quit [Ping timeout: 260 seconds]
BSaboia has joined #ruby
agent_fake is now known as agent_bob
dangerousdave has joined #ruby
dangerousdave has quit [Max SendQ exceeded]
agent_bob is now known as agent_white
dangerousdave has joined #ruby
BSab has quit [Ping timeout: 240 seconds]
<apeiros>
postel's law. one of my pet peeves.
<apeiros>
not because it's wrong, but because it's almost always applied/understood wrongly
<blubjr>
how do you mean
<pontiki>
yeah, kinda like scripture
<apeiros>
postel's law (robustness principle) is "Be conservative in what you do, be liberal in what you accept from others"
<apeiros>
and some people take it as "your stuff must be able to deal with every kind of incoming crap".
GarethAdams has joined #ruby
yardenbar has quit [Ping timeout: 240 seconds]
<apeiros>
though, actually I do strongly disagree with one of its parts, specifically the "silently discard invalid input". I'm a fan of "explode early and loudly". With some (rare) exceptions.
cmoneylulz has joined #ruby
Kis3k1 has quit [Quit: Leaving]
<blubjr>
hear hear
amoeba has joined #ruby
<apeiros>
ah, somehow omitted to send a line. re "some people take it as":
<pontiki>
that's one of the reasons i don't refer to it as a law
<pontiki>
apeiros: i saw that here...
atomical has joined #ruby
scottstamp has joined #ruby
yoongkang has joined #ruby
<apeiros>
and that's not what it means. postel clarified that he meant "within the spec". i.e. implement the whole spec for incoming. but only use what's necessary for outgoing.
<pontiki>
exactly
<pontiki>
and pretty specifically at that for the TCP spec
peterhil_ has joined #ruby
jbrhbr has quit [Quit: Leaving.]
Kharma has joined #ruby
dikaio has quit [Read error: Connection reset by peer]
GraveLlama has quit [Ping timeout: 240 seconds]
agent_white is now known as agent_fake
lockdown has quit [Ping timeout: 240 seconds]
agent_fake is now known as agent_white
BraddPitt has joined #ruby
nso95- has joined #ruby
yoongkang has quit [Ping timeout: 240 seconds]
johnny56 has joined #ruby
peterhil_ has quit [Ping timeout: 240 seconds]
BSaboia has quit [Ping timeout: 240 seconds]
BSaboia has joined #ruby
gustav has quit [Remote host closed the connection]
colegatron has quit [Ping timeout: 240 seconds]
lockdown has joined #ruby
sonOfRa_ has joined #ruby
scottstamp has quit [Ping timeout: 265 seconds]
Kharma has quit [Ping timeout: 265 seconds]
johnny56 has quit [Ping timeout: 265 seconds]
BraddPitt has quit [Ping timeout: 265 seconds]
amoeba has quit [Ping timeout: 265 seconds]
last_staff has quit [Quit: last_staff]
FastJack_ has joined #ruby
BrunoSaboia has joined #ruby
baweaver has quit [Remote host closed the connection]
zack6849 has quit [Ping timeout: 272 seconds]
atomical has quit [Ping timeout: 265 seconds]
sonOfRa has quit [*.net *.split]
FastJack has quit [*.net *.split]
snapcase has quit [*.net *.split]
dlitvak has joined #ruby
Coraline has quit [*.net *.split]
pestle has quit [*.net *.split]
bodie_ has quit [*.net *.split]
irk has quit [*.net *.split]
jayne has quit [*.net *.split]
brainslug has quit [*.net *.split]
csmb has quit [*.net *.split]
bhorn1 has quit [*.net *.split]
sshuff|gone has quit [*.net *.split]
BSaboia has quit [Ping timeout: 240 seconds]
niftylettuce has quit [Quit: Connection closed for inactivity]
FooMunki has joined #ruby
vifino has quit [*.net *.split]
tsunamie has quit [*.net *.split]
ajafo has quit [*.net *.split]
cmoneylulz has quit [Ping timeout: 240 seconds]
BSaboia has joined #ruby
GraveLlama has joined #ruby
calderonroberto has quit [Ping timeout: 240 seconds]
BrunoSaboia has quit [Ping timeout: 240 seconds]
zotherstupidguy has joined #ruby
baweaver has joined #ruby
Wsewolod has quit [Ping timeout: 240 seconds]
colegatron has joined #ruby
chouhoulis has joined #ruby
Helheim has quit [Read error: Connection reset by peer]
manolo1 has joined #ruby
Marcon has joined #ruby
lxsameer has quit [Quit: Leaving]
roshanavand has quit [Remote host closed the connection]
<havenwood>
apeiros: It may be incredibly naive, but hey at least I have 501500 passing assertions! :P
<apeiros>
^^
<crankharder>
Is there any tool that will visualize all subclasses of a given class? trying to trace through a new-to-me app with a pile of inheritance everywhere. basically just want it to output a pyramid of sorts
<apeiros>
not sure whether I added my tiny pathetic test code to the gist
<havenwood>
crankharder: So not #ancestors but #ancestry_tree?
yoongkang has quit [Ping timeout: 260 seconds]
A124 has quit [Quit: '']
<apeiros>
sounded like #descendants (if that existed)
<apeiros>
crankharder: rdoc can generate diagrams of classes
<apeiros>
not sure, I'd hope yard can too, but I never tried/looked
<apeiros>
for rdoc, I think you need graphviz installed
dlitvak has quit [Read error: Connection reset by peer]
dlitvak has joined #ruby
<crankharder>
actually, looks like I can really get what I want just from #subclasses
dlitvak has quit [Remote host closed the connection]
<apeiros>
crankharder: you *probably* should have told us that it's rails.
<apeiros>
s/probably/absolutely/
<apeiros>
you know, kinda relevant.
<havenwood>
blubjr: You can use RubyVM::InstructionSequence to run certain code with TCO when it's not enabled. But are you using the trace info? Why not just enable TCO?
crazydiamond has quit [Remote host closed the connection]
dikaio has joined #ruby
<havenwood>
crankharder: Rails!!
djbkd has joined #ruby
* havenwood
searches in vain for a pitchfork
* apeiros
gets the torches
roshanavand has joined #ruby
saddad has joined #ruby
<havenwood>
blubjr: Want to compile Ruby with TCO? Yell if you want help.
<blubjr>
havenwood: will do, im just looking into it now
<havenwood>
blubjr: RVM, chruby/ruby-install or compiling yourself?
<havenwood>
(It's easy to patch whatever way.)
<apeiros>
havenwood: thanks for your code, it was an interesting read :)
<blubjr>
compiling myself
jetpackjoe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
roshanavand has quit [Ping timeout: 246 seconds]
krobzaur has joined #ruby
ruid has quit [Ping timeout: 246 seconds]
Asher has quit [Quit: Leaving.]
arup_r has quit []
pwnd_ has quit [Ping timeout: 240 seconds]
spt0 has quit [Ping timeout: 264 seconds]
djbkd has quit [Quit: My people need me...]
dimasg has joined #ruby
mary5030 has joined #ruby
<havenwood>
blubjr: patch -p1 -d . < tco.patch
myeyesareblind has quit [Read error: Connection reset by peer]
<nofxx>
what's the gem <arg> to list all installed files from a gem?
dotix has quit [Ping timeout: 246 seconds]
<nofxx>
csguest, but for word matching the scan would be a better option... you can //i , go case insensitive
<blubjr>
csguest: doing it like they said will produce the same results, but it has very different performance characteristics from cdring down a list, remember
<csguest>
:)
<csguest>
but i like cdring down a list
<blubjr>
me too, its just much slower in ruby :)
roshanavand has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
spt0 has joined #ruby
<Coraline>
nofxx: you're looking for gem contents
kerunaru has quit [Ping timeout: 260 seconds]
<nofxx>
Coraline, thank you!
<Coraline>
Sure
vdamewood has joined #ruby
smokey has quit [Read error: Connection reset by peer]
pawnbox has quit [Remote host closed the connection]
Vitor has joined #ruby
<apeiros>
csguest: it does work.
<apeiros>
but gets includes the newline.
<apeiros>
so if you type "quit"+enter, it'll be "quit\n" != "quit", which is true.
tubuliferous_ has quit [Ping timeout: 240 seconds]
<Coraline>
csguest: you need to chomp
<apeiros>
for future reference "does not work" is a useless problem description. instead state what you expect something to do, and what it does instead. if you get an exception, paste (on gist.github.com) the full exception.
chouhoulis has quit [Ping timeout: 240 seconds]
myztic has quit [Quit: leaving]
<apeiros>
or compare to "quit\n"
snapcase has quit [Ping timeout: 246 seconds]
nso95- has joined #ruby
snapcase has joined #ruby
th0m__ has quit [Ping timeout: 240 seconds]
skweek has quit [Ping timeout: 240 seconds]
codecop has quit [Remote host closed the connection]
<csguest>
can i gets
<csguest>
without a newline
Vitor has quit [Ping timeout: 260 seconds]
<Coraline>
Like I said, use chomp
CloCkWeRX has quit [Ping timeout: 240 seconds]
<csguest>
heh heh. chomping strings
nso95- has quit [Remote host closed the connection]
<apeiros>
csguest: also, you probably want $stdin.gets, not toplevel gets
<csguest>
whats the difference
<apeiros>
toplevel gets is Kernel#gets, which is ARGF.gets, which in turn means it'll consider all arguments given to your script as files to read from, and after having read them, move on to $stdin.
tubuliferous_ has joined #ruby
<csguest>
oh
<csguest>
cool it works now
<csguest>
if you input dicks, itll print out cats
<cats>
no it won't
<csguest>
if you say anything else itll print out dogs
<csguest>
now it will
<csguest>
my programming skills are off the charts
pawnbox has joined #ruby
<cats>
I stt
<cats>
see*
<csguest>
is there a better way to check equivalence
<csguest>
instead of ==
<blubjr>
apeiros: oh huh, so if you just use normal gets it automatically works like a normal unix program ?