00:12
<
neshpion >
# %w(thing.mov thing.mp4 thing.avi thing.webm).sort_by { |s| %w(avi mp4 webm).index { |ext| s.include? ext } || 0 }.reverse
00:13
Laplace has quit [Quit: Connection closed for inactivity]
00:13
<
neshpion >
s/reverse/last
00:15
<
weaksauce >
just one match?
00:15
<
weaksauce >
or first match of the priority
00:16
<
neshpion >
first of priority, or whatever happens to be at the end of the list if none of the priorities are matched
00:17
<
neshpion >
meaning the highest priority pattern needs to have the highest index
00:23
<
weaksauce >
clever? maybe... but just going through the list once and keeping track of the first index of each might be most performant / easiest
00:23
<
weaksauce >
hash keys have been ordered since ruby 1.9 so you could use that fact
00:24
<
weaksauce >
and use reduce with an object
00:24
<
weaksauce >
s/object/hash
01:15
Averna has quit [Ping timeout: 252 seconds]
01:23
Synthead has joined #ruby
01:37
<
ox1eef_ >
I probably don't understand the requirements, but based on the description you gave, maybe: %w(foo.mpg bar.avi).find { %w(.mpg avi).one? { File.extname(filename) } }
01:38
<
ox1eef_ >
%w(foo.mpg bar.avi).find { |filename| %w(.mpg .avi).one? { |extname| extname == File.extname(filename) } } *
01:38
<
weaksauce >
they want best first find ox1eef_
01:39
<
weaksauce >
so say avi is their preferred codec they want that first
01:39
<
weaksauce >
even if there is a mp4 in the list before it
01:43
cartdrige has joined #ruby
01:47
<
ox1eef_ >
%w(.avi .mpg).find { |extname| break %w(foo.mpg bar.avi).find { |file| File.extname(file) == extname } }
01:48
<
ox1eef_ >
Time to eat Christmas dinner. That might be something to work with.
01:49
<
ox1eef_ >
%w(.avi .mpg).find could be %w(.avi .mpg).each as well.
02:04
markong has quit [Ping timeout: 272 seconds]
02:09
desnudopenguino has joined #ruby
02:11
neshpion has quit [Remote host closed the connection]
02:12
neshpion has joined #ruby
02:26
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
02:46
neshpion has quit [Ping timeout: 255 seconds]
02:49
neshpion has joined #ruby
02:52
Synthead has quit [Ping timeout: 248 seconds]
03:34
<
neshpion >
i landed on `filenames.max_by { |f| extensions.index { |ext| f.end_with? ext } || 0 }`
03:35
reset has quit [Quit: reset]
03:40
c10l5 has quit [Quit: See ya! o/]
03:43
c10l5 has joined #ruby
03:51
c10l5 has quit [Quit: See ya! o/]
03:52
c10l5 has joined #ruby
03:53
c10l5 has quit [Client Quit]
04:00
c10l5 has joined #ruby
04:02
Laplace has joined #ruby
04:24
Synthead has joined #ruby
04:27
Sheilong has quit []
04:43
neshpion has quit [Quit: neshpion]
04:48
desnudopenguino1 has joined #ruby
04:48
desnudopenguino has quit [Ping timeout: 260 seconds]
04:48
desnudopenguino1 is now known as desnudopenguino
05:20
desnudopenguino has quit [Ping timeout: 252 seconds]
05:21
desnudopenguino has joined #ruby
05:28
desnudopenguino has quit [Ping timeout: 255 seconds]
05:32
Synthead has quit [Quit: Leaving]
07:12
Laplace has quit [Quit: Connection closed for inactivity]
07:37
cryptkeeper has joined #ruby
07:48
FullMetalStacker has joined #ruby
08:58
John_Ivan_ has joined #ruby
09:00
M1ll173r47[m]1 has quit [Quit: You have been kicked for being idle]
09:01
John_Ivan has quit [Ping timeout: 260 seconds]
09:02
jvalleroy has joined #ruby
10:23
Sankalp has quit [Ping timeout: 268 seconds]
10:26
cryptkeeper has quit [Quit: Connection closed for inactivity]
10:33
Sankalp has joined #ruby
10:44
cartdrige has joined #ruby
10:46
gr33n7001 has joined #ruby
10:46
gr33n7007h has quit [Killed (zirconium.libera.chat (Nickname regained by services))]
10:46
gr33n7001 is now known as gr33n7007h
10:46
Guest1673 has joined #ruby
12:54
hightower2 has quit [Ping timeout: 248 seconds]
13:05
aeris has quit [Remote host closed the connection]
13:06
tomtmym has joined #ruby
13:06
tomtmym has quit [Changing host]
13:06
tomtmym has joined #ruby
13:06
aeris has joined #ruby
13:21
ollysmith has joined #ruby
13:26
<
petru >
Ugh, jekyll doesn't work with 3.2 because of shopify/liquid gem
13:26
hightower2 has joined #ruby
14:05
hightower2 has quit [Remote host closed the connection]
14:05
hightower2 has joined #ruby
14:42
<
Rounin >
petru: If it's not something you're using, is it possible that you could make your own shopify/liquid gem that doesn't do anything?
14:42
<
Rounin >
If it's just a matter of having something that has the same name and returns...
14:43
hightower2 has quit [Remote host closed the connection]
14:43
<
Rounin >
Of course, if it always tries to get the gem online, that's an issue
14:43
<
Rounin >
What can I say, I work in integration... It's 90% duck tape and stopgap solutions there
15:26
cartdrige has quit [Quit: I am more peaced off than a dragon trying to blow out candles]
15:27
sixpiece has joined #ruby
15:27
<
sixpiece >
hi anyone know how to use ruby for rest api?
15:37
<
joto >
sixpiece, consuming or creating?
15:37
<
sixpiece >
I want to do it on the line for now I think
15:37
<
sixpiece >
cause I am so new to it
15:38
<
sixpiece >
but if you have another idea I would try that
15:38
<
sixpiece >
interactive ruby irb , just to get familiar and then go from there was my thought
15:41
<
joto >
ok so I assume you want to consume a rest api
15:42
<
joto >
in that case: look up the httparty gem
15:42
<
joto >
that would be the easiest
15:44
hightower2 has joined #ruby
16:33
rvalue has joined #ruby
16:38
perrierjouet has joined #ruby
16:53
perrierjouet has quit [Quit: WeeChat 3.7.1]
16:59
nmollerup has joined #ruby
17:09
hightower2 has quit [Remote host closed the connection]
17:12
cartdrige has joined #ruby
17:13
hightower2 has joined #ruby
17:20
reset has joined #ruby
17:34
crax23 has joined #ruby
17:37
cartdrige has quit [Ping timeout: 265 seconds]
17:44
reset has quit [Quit: reset]
17:53
reset has joined #ruby
18:15
markong has joined #ruby
18:47
ox1eef_ has quit [Quit: WeeChat 3.7]
18:47
ox1eef_ has joined #ruby
18:55
markong has quit [Ping timeout: 260 seconds]
19:12
cryptkeeper has joined #ruby
19:16
gr33n7007h has quit [Quit: WeeChat 3.7.1]
20:00
hightower2 has quit [Remote host closed the connection]
20:00
hightower2 has joined #ruby
20:05
hightower2 has quit [Ping timeout: 272 seconds]
20:17
goldfish has joined #ruby
20:25
sixpiece has quit [Ping timeout: 268 seconds]
20:32
hightower2 has joined #ruby
20:41
aeris has quit [Read error: Connection reset by peer]
20:41
Mikaela has quit [Write error: Connection reset by peer]
20:41
aeris has joined #ruby
20:42
Mikaela has joined #ruby
20:52
Mikaela has quit [Remote host closed the connection]
20:53
Mikaela has joined #ruby
21:25
ua_ has quit [Ping timeout: 246 seconds]
21:39
ua_ has joined #ruby
21:42
cryptkeeper has quit [Quit: Connection closed for inactivity]
21:45
entropie has quit [Ping timeout: 265 seconds]
21:47
entropie has joined #ruby
21:54
goldfish has quit [Quit: Leaving]
22:10
markong has joined #ruby
23:00
ruby[bot] has quit [Remote host closed the connection]
23:00
ruby[bot] has joined #ruby
23:20
r3m has quit [Quit: WeeChat 3.8-dev]
23:20
r3m has joined #ruby
23:26
tomtmym has quit [Quit: Gone.]
23:34
_ht has joined #ruby
23:36
crax23 has quit [Ping timeout: 264 seconds]
23:54
desnudopenguino has joined #ruby
23:58
_ht has quit [Quit: _ht]