gproto23 has quit [Remote host closed the connection]
gproto23 has joined #ruby
<mooff>
hehe
<adam12>
It's hard coming up with good gem names lately.
shokohsc has quit [Read error: Connection reset by peer]
<wnd>
I may have a different definition for good names
eldritch has joined #ruby
glider has joined #ruby
shokohsc has joined #ruby
nirvdrum has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
wnd: What's the definition?
<wnd>
In this context, descriptive and searchable (read: unique). I know it's boring and not funny.
<adam12>
wnd: I figure the gem summary / description would be sufficient to match any expected searches?
<adam12>
I get where you're coming from tho.
royo25 has quit [Quit: Bye]
<mooff>
the IIRC name was 'giving up' just to get it released ;)
<mooff>
many that i liked were already taken
gproto23 has quit [Ping timeout: 260 seconds]
<John_Ivan>
is there a particular method or approach to iterating a string from a given position? e.g suppose I want to start printing out the chars of "this_string" but from position 6.
<mooff>
:: "this string"[6..]
<ruby-eval>
=> "tring"
<adam12>
You can use String#slice if it reads better to you.
<John_Ivan>
hmm. hold on, trying to figure out if that will work. thank you by the way.
<John_Ivan>
mooff, no, it won't I'm afraid. because I need to be in control of the iterator to apply conditions to it
<John_Ivan>
so that I can continue my iteration from a given "at" position
<jhass[m]>
string.each_char.drop(6).each
<jhass[m]>
string[6..].each_char
<mooff>
\o/ ^
<John_Ivan>
I guess that works. cheers.
<jhass[m]>
first might be slightly more performant for very big strings
<John_Ivan>
it works well for my usecase. thanks mate. it won't work well if you want to go backwards though :)
<John_Ivan>
because once you dropped the 6 chars, what if you want to iterate now in reverse? you have to reconstruct the string again rather than just using some pointer arithmetic
<adam12>
You want StringScanner then, likely.
<jhass[m]>
Maybe you want to write C not Ruby xD
<John_Ivan>
I want to write Ruby with C :>
gproto23 has joined #ruby
<jhass[m]>
Check Crystal then
emcb5 has joined #ruby
<adam12>
Or StringIO..
<adam12>
Not really sure what you're building tho.
<jhass[m]>
More seriously though you might also consider just computing your indicies, a.upto(s.size) do |i| s[i] end; s.size.downto(b) etc
* mooff
wishes that StringIO.new.is_a?(IO) was true :)
<John_Ivan>
adam12, just making my own string lib, the one I mentioned yesterday.
<adam12>
John_Ivan: Right. Did you have an example in another language? Just curious.
<John_Ivan>
an example? of what
<adam12>
John_Ivan: A library that you are modelling this from.
<John_Ivan>
not really. I just made my own function called "GetStringBetween(char1, char2, occurence)"
<John_Ivan>
and I figured that for the occurence, I'd have to scan back and forth keeping memory in mind (of occurences)
<jhass[m]>
mooff: class StringIO; def is_a?(class); class == IO ? true : super; end; end; xD
<mooff>
hehe jhass[m]
<John_Ivan>
I normally do this with array indices in C
<adam12>
John_Ivan: Gotcha. What's occurence?
<adam12>
The string being worked on?
<mooff>
jhass[m]: fwiw it's really IO === StringIO.new that i was interested in, for case statements
<John_Ivan>
adam12, "this-occure-more-than-once" calling the function over this string would yield "more" rather than "occur"
<John_Ivan>
3rd occurence would yield "than"
<jhass[m]>
mooff: aww, yeah, the one thing you can't really hack up in Ruby :(
<adam12>
John_Ivan: Sorry, I still don't follow. But if you get something working I'd be curious to see.
<adam12>
jhass[m]: LOL.
<mooff>
lol
<mooff>
using Insanity
eddof13 has joined #ruby
o|||||o has quit [Ping timeout: 260 seconds]
roadie has quit [Ping timeout: 245 seconds]
o|||||o has joined #ruby
Guest48_ has joined #ruby
dionysus69 has quit [Ping timeout: 256 seconds]
Guest48_ has quit [Client Quit]
roadie has joined #ruby
<John_Ivan>
adam12, no worries. yeah. I'll get it working. once I figure out how to iterate back and forth in the same string. but basically
<John_Ivan>
GetStringBetween("-", "-", 1, string_to_scan); //where string_to_scan is "this-is-a-string-to-scan", the return value should be "is". if the occurence is 2, the return value is "a". if it's 3, it's "string"
<John_Ivan>
at least that's how I plan to design it
<John_Ivan>
the params of the function are GetStringBetween(char1, char2, occurence, stringToScan);
TCZ has joined #ruby
roadie has quit [Ping timeout: 250 seconds]
SobiX has quit [Ping timeout: 250 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mooff>
John_Ivan: have you written that as a test case? :)
<John_Ivan>
mooff, I use the exact format I mentioned above for testing, yes.
<John_Ivan>
though I think I'm going to give up on it.
<John_Ivan>
adam12, I appreciate the interest :), I'll read it in a moment.
<John_Ivan>
mooff, well, originally the string lib I'm making is meant to just ease my future work but
<John_Ivan>
let's say that I'm slightly lost. I'm in between a stage where I am asking myself
<John_Ivan>
"I can automate some of my data. but I could also just go and do it by hand. doing it by hand will be quicker if done in stages. but the automation will do it in a few seconds. I'll have to spend writing a few days. in which in those few days I'll probably have the stuff done. is there a point in this lib now? might be in the future. but automation will crop up again. I guess at that time, I'll just use the basic string operations and hope
<John_Ivan>
to be good enough...
<John_Ivan>
mooff, so "priorities" and "choosing what suits best", taking my state of mind in consideration
<John_Ivan>
is the reason I figured I am probably wasting my time making that string library.
<adam12>
I'd say YAGNI and rule of 3. Start doing what you're doing, and you dup it 3 times, extract it. And don't build anything you haven't needed yet (YAGNI).
<adam12>
Unless it's for fun, in that case, there's no harm in throwing away code.
TCZ has quit [Quit: Leaving]
<John_Ivan>
:)
gproto23 has quit [Remote host closed the connection]
<adam12>
I'm trying to use net/http more and more, but I usually want to wrap it
<adam12>
so I'm back at Faraday, just without the dependency.
<adam12>
Oh well.
<havenwood>
The stdlib is for sure getting more crisp and maintained. That's nice.
<adam12>
Be nice if we could settle on an API like Rack, but for HTTP requests.
<havenwood>
mmmmm
<adam12>
then it could be Square.build(my_own_http_client) and you could just my_own_http_client.get(path, headers, body) or whatever.
<adam12>
Any large project seems to have 4-5 HTTP clients (transitively)
<adam12>
My largest project has async-http, httparty, excon, faraday, and patron, with only Faraday being non-transitive.
TCZ has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]
<havenwood>
adam12: Yeah, async-http, HTTP.rb and Typhoeus are my gotos.
<havenwood>
adam12: I did use Faraday for our Ruby SDK since that seemed the most flexible to not mess with your world.
<havenwood>
A Rack-like solution would sure be nice. The problem with Faraday is we'd all have to actually use it.
<havenwood>
I guess Faraday is the closest we have.
<adam12>
I wonder what it would take to make net/http nicer to use.
<adam12>
I submitted a PR months ago without a peep, so I don't know whether it would even see any improvements outside of something that tickled core's fancy.
___nick___ has quit [Ping timeout: 245 seconds]
emcb5 has quit [Read error: Connection reset by peer]
emcb5 has joined #ruby
ur5us has joined #ruby
markong has joined #ruby
o|||||o has quit [Ping timeout: 272 seconds]
<mooff>
is HTTParty still HTTPopular?
o|||||o has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
<adam12>
lol
SobiX has joined #ruby
<havenwood>
mooff: I avoid the Net::HTTP wrappers.
<havenwood>
mooff: But Rails folk especially seem to party hard enough to use it. ¯\_(ツ)_/¯
<havenwood>
mooff: Async, "no". Parallel, "no". HTTP/2, "no". So that's a "no" for me.
<Guest7120>
Why the minute we started talking about slave trade, and I translated old Danish texts?
<Guest7120>
Did I get silenced? All my texts show up red.
<Guest7120>
Some hidden agenda to silence me on IRC for trying to have a normal discussion.
<Guest7120>
I hate this place.
<Guest7120>
None of you are willing to show your real names or selfies either.
TCZ has quit [Quit: Leaving]
roadie has joined #ruby
<John_Ivan>
hey adam12, mind if I ask some questions outside ruby/programming? more like, discipline/principle/habit related. I've got an annoying problem of "organization".
Exuma has joined #ruby
Exuma has quit [Client Quit]
<Guest7120>
John_Ivan: Dude's probably busy
<Guest7120>
Wait, what day is it today?
<Guest7120>
Wednesday, cool
roadie has quit [Ping timeout: 240 seconds]
<Guest7120>
My best friend was named Ivan!
<Guest7120>
After all his neighbors died from overdose
<John_Ivan>
Guest7120, hi can I help you?
<Guest7120>
He decided to marry and settle down in a different city
<Guest7120>
John_Ivan: No, sorry
<Guest7120>
John_Ivan: The Ivan I knew though, he lived next to these two twins. Before they took suicide.
<Guest7120>
They ran around with knives and slashed innocent victims.
<Guest7120>
They used to be good people. But all the pills and poverty messed with their heads.
<Guest7120>
RIP. They never killed anybody at least.
<leah2>
who had ops again? :p
<Guest7120>
One of them hanged himself. After getting raped in prison.
<Guest7120>
leah2: I'm done.
<mooff>
Guest7120: what's the ninth letter of the alphabet?
Guest7120 has quit [Read error: Connection reset by peer]
<adam12>
leah2: Maybe we need more ops. havenwood jhass[m]
<adam12>
John_Ivan: Sure no problem.
ur5us has quit [Ping timeout: 260 seconds]
<havenwood>
Organization is hard...
<adam12>
First time I can recall we've been trolled since the migration.
<havenwood>
adam12: We can also +r but this was just a single intoxicated person.
<havenwood>
I think we outlasted the trolls.
<John_Ivan>
adam12, I have trouble deciding what to keep or what not to keep in terms of media. Let's say movies and music. I try to apply the "must keep or good to keep" rule on business management but I don't think it's helping. Is there some other framework you can recommend or other rules/hints/tips?
<adam12>
John_Ivan: Is this movies and music specifically or just as an example?
<adam12>
I'm probably the worst for this since I'm a closet data hoarder.
roadie has joined #ruby
<John_Ivan>
adam12, it actually is movies and music.
<adam12>
Tho I did delete my Windows 2003 server ISO's a few days ago.
<adam12>
John_Ivan: Why not keep everything? Space is so cheap now.
<John_Ivan>
yeah, I'm trying to lessen on the hoarding habit and actually keep what I need.
<John_Ivan>
adam12, well, I kinda do. It's around 10TB. I keep them on 3 separate HDDs. the problem is actually working with the data tends to be time consuming.
<John_Ivan>
such as applying labels, etc
<adam12>
John_Ivan: Maybe they don't need labels? I use Plex and it seems to do OK (at least for visual media).
<adam12>
John_Ivan: Let's move this to #ruby-offtopic
<adam12>
(and I gotta duck out to put kid to bed. Back later / tomorrow)
<John_Ivan>
sure
roadie has quit [Ping timeout: 260 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dionysus69 has quit [Ping timeout: 272 seconds]
markong has quit [Ping timeout: 260 seconds]
<hwrd>
in blocks, like { |x| ... }, what is the proper term for that x there?