AndBobsYourUncle has quit [Ping timeout: 255 seconds]
bruno-_ has joined #ruby
bruno-_ has quit [Client Quit]
masondesu has joined #ruby
flying has quit []
enilsen16 has quit [Quit: enilsen16]
enterprisey has joined #ruby
AndBobsY_ has quit [Ping timeout: 255 seconds]
sepp2k has quit [Quit: Leaving.]
AndBobsYourUncle has joined #ruby
braincrash has joined #ruby
Pupeno has quit [Remote host closed the connection]
<fishcooker>
thanks for the sample of rb code, eelster... *err offline eval.in is new to me thankyou... ytti you got my point. I think there is time difference because the crontab is not even show the scheduled time
<fishcooker>
looks like the rb apps config not respect the server time
<dionysus69>
that returns 3 arrays lengthes are 4 4 2
<dionysus69>
how can I modify it so it returns 4 4 4 but the 2 elements that it lacks, it randomly*** picks
bazzy has joined #ruby
bronson has joined #ruby
<eelster>
You can do [1,2,3,4,5,6,7,8,9,10].each_slice(4).to_a.map{|i| i << (1..10).to_a.select while i.length < 4}
<eelster>
>> [1,2,3,4,5,6,7,8,9,10].each_slice(4).to_a.map{|i| i <<
<ruby[bot]>
eelster: # => /tmp/execpad-4e5a690e3464/source-4e5a690e3464:3: syntax error, unexpected keyword_rescue ...check link for more (https://eval.in/711692)
braincrash has joined #ruby
<eelster>
>> [1,2,3,4,5,6,7,8,9,10].each_slice(4).to_a.map{|i| i << (1..10).to_a.select while i.length < 4}
<zenspider>
I really tried to like it too... but damn...
<baweaver>
oh?
<baweaver>
Reading through it I'm way more likely to try it than Go again.
<zenspider>
actually going to take another stab at ML instead... I want to keep at a language that takes me out of my comfort zone
<baweaver>
Then again I'm also a Ruby/Scala/JS primary, so...
<baweaver>
Haskell on that list?
<zenspider>
that feels like apples and oranges to me (rust and go)... one is trying to replace C and the other? maybe java? I dunno. the go code I've read is... not fun
<baweaver>
Same. Correct me if I'm off but Rust is a C alt and Go is a generic binary language
<zenspider>
Haskell is not currently on the list (tho I just bookmarked the "school of haskell" tutorials)... I like code I can read
<zenspider>
tho I can read it better now that I've studied ML
<zenspider>
somewhat
<baweaver>
Have you ever seen bitemyapp's book?
<zenspider>
The way go IO works looks and feels like java to me
<zenspider>
no, url?
<baweaver>
He says it's far easier than Learn You a Haskell
<baweaver>
I'm inclined to agree from what I've read
<baweaver>
one sec
<blackbom1>
zenspider: lol. at least you tried. i hated it since i saw it :p
<baweaver>
Find his free section real quick. I do like that he'll give discounts to newbies without cashflow though
AndBobsYourUncle has joined #ruby
<zenspider>
oh. I was pointed to that at rubyconf ... tho I never looked at it. isn't it $$? I'm not sold on haskell so I'm not willing to shell out yet
<dionysus69>
nearly crashed my pc took all of the ram and swap was 10% left when i noticed xD
djbkd_ has joined #ruby
renchan has joined #ruby
<apeiros>
dionysus69: you could rewrite that in a much more efficient manner. calculate how many permutations there are. create a method to calculate the Nth permutation. then Array.new(10) { permutation_at(rand(0...permutation_possibilities)) }
KnownSyntax has joined #ruby
KnownSyntax has joined #ruby
KnownSyntax has quit [Changing host]
enyo has joined #ruby
djbkd_ has quit [Ping timeout: 258 seconds]
<dionysus69>
well I wont bother with it because I already found a solution and its much shorter :)
<domgetter>
When you say "an angle" do you mean the percentage?
<domgetter>
Or do you mean an angle? And is the angle given in radians or degrees?
<domgetter>
i.e. 25% -> pi/2 radians -> 90 degrees
<domgetter>
When the circle is filling up, does it start at the top and fill clockwise? counterclockwise?
<warrshrike>
its given in degrees
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nettoweb has joined #ruby
<warrshrike>
i converted to radians in code
<warrshrike>
yeah its clock wise
<warrshrike>
and percentage is out of 100 we manually convert it
lxsameer has joined #ruby
JeanCarloMachado has quit [Ping timeout: 248 seconds]
<warrshrike>
make sense?
<domgetter>
Yes, I'm looking at your code now
SpiffTR has joined #ruby
saneax-_-|AFK is now known as saneax
<warrshrike>
okay thanks a lot. you can skip the part about those if else...r=+ its just a performance optimization binary search style
<warrshrike>
Whenever a point (X, Y) is queried, it's guaranteed that all points within a distance of 10-6 of (X, Y) are the same color as (X, Y).
<warrshrike>
thats why im doing the dist thing
scootaloo has joined #ruby
<apeiros>
warrshrike: atan2 might be of interest
<domgetter>
fun fact: you can just write 1E-6 for the 0.000001
<warrshrike>
oh
<warrshrike>
lol cool il replace that
Jackneill_ has joined #ruby
<warrshrike>
whose atan2?
<Mon_Ouie>
atan2(y, x) gives you the angle between (x, y) and (0, 0)
<domgetter>
Will the radius always be the same as the coordinate of the circle? So like, if the center is at (15,15), will the radius be 15?
jenrzzz has joined #ruby
jenrzzz has joined #ruby
<warrshrike>
domgetter: the radius is fixed at 50 with mid point 50,50
<warrshrike>
does that answer your question?
milardovich has quit [Remote host closed the connection]
<domgetter>
For this problem yes. I didn't know if you wanted a more general solution for knowing if a point is inside a portion of a circle
<warrshrike>
no just this one problem will do. its an interview question actually
milardovich has joined #ruby
<warrshrike>
from facebook
bilgekagan has joined #ruby
<domgetter>
ah okay. Let me ask you this. Why is there a loop? That is, what are you using the while loop to do?
dhollinger has quit [Ping timeout: 245 seconds]
<warrshrike>
so in a nutshell heres my approach: -> for every angle 0->provided angle: -> keep increasing r from 0 to 50 until either the 'circle edge' of is less than 10^-6 away from goal or continue till end
SpiffTR has quit [Quit: Leaving.]
dhollinger has joined #ruby
<domgetter>
Will that tell you if the point is inside the pie piece, or will it tell you if the point is inside the circle as a whole?
<warrshrike>
just inside the pie
<warrshrike>
since outer loop 0-pie piece angle
<warrshrike>
and inner goes 0-50 for each of said angle
enyo has joined #ruby
milardovich has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
<warrshrike>
to test whether the 'point on circle edge at current angle for current dist' is < 10^-6 from goal
<warrshrike>
if so then its in pie piece
<domgetter>
Okay I now see the correctness of your algorithm
arnovr has quit [Ping timeout: 240 seconds]
Devalo has joined #ruby
<domgetter>
You're trying a bunch of points throughout the pie piece, and if one of them is close enough, then the point is in the pie piece
<warrshrike>
exactly
<warrshrike>
brute force
milardovich has joined #ruby
enyo has quit [Ping timeout: 240 seconds]
bilgekagan has left #ruby [#ruby]
<domgetter>
I think there's a few ways we can leverage geometry to get a better algorithm
<warrshrike>
on a related note how can i make a ruby for loop increase by 0.1 instead of 1? for i in 0..10
<warrshrike>
My algo is currently correct for 4/5 test cases. while the algo is correct, the 10^-6 nearness guarantee is two granular
<domgetter>
well we can rule out points that are definitely outside the circle by first doing the distance formula from the point to the center of the circle
<warrshrike>
too*
milardovich has quit [Ping timeout: 245 seconds]
<warrshrike>
okay yeah. those can be eliminated straight away
Dobler has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<domgetter>
Once we've ruled out all outside points, we can check if the point is above/below/leftward/rightward of a line to see if it must then be in the pie piece
<warrshrike>
domgetter: look at those if else thingies. my cheapo attempt at binary search it does yield a large speed up anecdotally
<domgetter>
and since by then we've ruled out outsiders, we must be only checking for candidates in the circle, even though we're comparing to whole lines
Guest29728 is now known as ged
<domgetter>
warrshrike that is a pretty clever way of speeding up the linear search. But we can get a constant-time algo :)
rodfersou has joined #ruby
ged is now known as Guest65151
<warrshrike>
domgetter: id love linear time :D
<warrshrike>
domgetter: so what lines do we check for?
<warrshrike>
constant*
<domgetter>
I think there are two main cases: <50% filled, and >50% filled.
<warrshrike>
id love constant time I meant*
rodfersou has joined #ruby
<domgetter>
then we can just look to see if the point is above the line y = mx+b which is the "fill line"
<warrshrike>
right so first we check if its in left half or right half
<domgetter>
if >50% and y_t > 50, we must be in the circle
<domgetter>
that sort of logic
osboxes has joined #ruby
<domgetter>
we must be in the filled part*
<warrshrike>
domgetter: okay so we check if its above the 'angle line'
<domgetter>
That's right
<warrshrike>
and we know its in left half
<warrshrike>
and we know its within circular bounds
<warrshrike>
okay yeah i can see where youre going with this
<domgetter>
yeah, ruling out points which are outside the circle is what lets us do these quicker checks
<warrshrike>
so left and right is easy. also we can easily check if above or below
<apeiros>
your task is to test whether a point is in a circular sector?
<warrshrike>
the y intercept
<domgetter>
There might be an even simpler way with some vector math, but this is only a handful of cases, so it's pretty straightforward
<warrshrike>
apeiros: Yep
<warrshrike>
whether its within 10^-6 of the nearest coloured sector to be precise
<apeiros>
you're given the center of the circular sector, the radius of it, and the point - what's the angle you're given for?
<warrshrike>
apeiros: clock wise angle from 'north'
<warrshrike>
think of it like a circular progress bar
<apeiros>
angle of what? the circular sector?
<warrshrike>
apeiros: we're given percentage of progress bar and percent/100*360 gives the angle of black sector
<warrshrike>
yeah
<apeiros>
ok, so you aren't given an angle, you're given a progress percentage, and you calculated the angle from that?
<warrshrike>
yep
<apeiros>
calculate the angle of the given point to the center of the circle
osboxes has quit [Ping timeout: 240 seconds]
<warrshrike>
go on...
<apeiros>
I thought the rest would be obvious
<warrshrike>
it is
<warrshrike>
but it really cant be this simple
<warrshrike>
~_~
<apeiros>
if the angle is bigger than the angle of the end of your circular section, then it's outside
<warrshrike>
i've been speeding up linear search for the past two haars
<apeiros>
(after adjusting for start points and direction that is)
<warrshrike>
apeiros: yeah i get it
<apeiros>
plus of course the distance test domgetter already mentioned
<apeiros>
distance test -> within circle
<apeiros>
angle test -> within section
<domgetter>
warrshrike yeah my line-making version is worse than just checking the relative angle
giovdk has joined #ruby
<giovdk>
hi
<warrshrike>
yeah. so we have here a constant time algorithm. Lemme code this up and come back with results
<apeiros>
hi giovdk
<warrshrike>
Hey buddy long time no see
Pupeno has joined #ruby
Pupeno has joined #ruby
<giovdk>
I'm using ruby 2.3.3 and if I do 19.95 * 3 on irb I get 59.849999999999994 instead of 59.85
<domgetter>
giovdk are you using decimal numbers for money?
<giovdk>
yes
govg has joined #ruby
<domgetter>
I am going to strongly suggest that you don't use floats for money
<warrshrike>
do Float.round
<apeiros>
warrshrike: that's bad advice.
<domgetter>
That being said. In that particular case, you could do (19.95 * 3).round(2)
<al2o3-cr>
use bigdecimal
<apeiros>
they'll just get errors on other places.
tarvos has quit [Quit: Page closed]
pandaant has joined #ruby
<domgetter>
For a real application in production that works on real money, do not use what I wrote
<warrshrike>
apeiros: ma bad. im jus' a backwards country boy
<apeiros>
don't use floats for decimal values where precision is required. there isn't much to add to that.
<domgetter>
I'm half surprised that Rails doesn't have Money.new(19.95)
<apeiros>
warrshrike: what I said was not meant as an insult to you. it's only related to your advice.
<giovdk>
thanks. I'm coming from php and it is usually safe to multiply / add floats. I'll give bigdecimal a look thanks :)
<apeiros>
giovdk: you're mistaken
<apeiros>
php shares the same problems with regards to floats as all other systems which use binary based floats
<apeiros>
php even has some additional problems due to its weak typing system
<domgetter>
In PHP it's also "bad" to use floats for money. ("Bad" here means that occasionally there will be errors which could be prevented by using a "correct" number type)
howdoi has joined #ruby
<warrshrike>
apeiros: ofc not im just messing around :)
duckpuppy has joined #ruby
<giovdk>
apeiros: in php it is also called "double" but it should be the same as float, isn't it?
rodfersou has quit [Quit: leaving]
<giovdk>
if I do 0.1 + 0.2 I get 0.3 and if I do 19.95 * 3 I get 59.85. But probably this is where the typing system comes in correct?
<domgetter>
doubles have the same precision problems as floats, yes
<apeiros>
giovdk: yes. both ruby and php's float values use 64bit (aka double) floating point
sepp2k has joined #ruby
pandaant has quit [Remote host closed the connection]
nankyokusei has joined #ruby
<giovdk>
thanks! but if so, is php doing something to prevent that to happen?
duckpuppy has quit [Ping timeout: 258 seconds]
<apeiros>
giovdk: no
<giovdk>
in php if I do $a = 19.95; echo gettype($a); echo 19.95 * 3; the result is correct
<domgetter>
giovdk for money, it's reccomended that you keep everything in pennies (or whatever the smallest unit is in your currency) and round to pennies when you have to do certain calculations like interest and taxes
<apeiros>
giovdk: it probably does not show you the complete value
<domgetter>
(and then you have to keep in mind that "round" doesn't have a single definition either)
<apeiros>
giovdk: there's also a Money gem. might be useful too.
<warrshrike>
apeiros: given circle center 50, 50 how can i find the angle to any given point?
<warrshrike>
without using atan2
<warrshrike>
domgetter:
<apeiros>
why without?
<Mon_Ouie>
Why couldn't you use atan2?
<warrshrike>
Learning exercise
<warrshrike>
that, and it shows moral fiber
bronson has joined #ruby
<warrshrike>
okay im sorry i thought
<domgetter>
warrshrike what are you allowing yourself to use? asin and acos?
<apeiros>
warrshrike: two points form a vector. I'm sure you learned at school how to calculate the angle of a vector.
Ax has joined #ruby
<warrshrike>
atan2 was some was magical math library when it actually was just tan inverse
<Mon_Ouie>
it's atan(y/x) except it accounts for the sign of y and x to give you the correct angle
AndBobsYourUncle has quit [Ping timeout: 255 seconds]
<apeiros>
^
<warrshrike>
okay so i just give it the displacement x,y from zero?
<warrshrike>
assuming circle center at zero
<domgetter>
assuming the circle is at zero, atan2 will give you a number between -pi and pi. that number will tell you, starting from the top, how far around the circle that point is
<domgetter>
if you get -pi/2 that means the point was directly to the left
<warrshrike>
domgetter: right so its the angle in radians?
<domgetter>
Yes
andrzejku has quit [Ping timeout: 258 seconds]
bronson has quit [Ping timeout: 240 seconds]
<warrshrike>
Okay. Here's what i thought
<domgetter>
it's also annoying not from 0 to 2pi, and annoyingly not counterclockwise from the point (1,0)
Pupeno has quit [Remote host closed the connection]
govg has quit [Quit: leaving]
<domgetter>
s/annoying not/annoyingly not/
<warrshrike>
the parametric equations x = cx + r * cos(a) y = cy + r * sin(a)
<warrshrike>
give us x and y points on circumference of any circle
milardovich has joined #ruby
<warrshrike>
so doing acos(x-cx/r)
JoshS has joined #ruby
<warrshrike>
should give us the angle too?
<domgetter>
that might only give the principle angle. I'd have to do a few examples to know for sure
<domgetter>
(arcsin and arccos are only defined between 0 and pi)
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Mon_Ouie>
acos only returns an angle between 0 and pi, you'll get the wrong result for negative values of y, and a similar issue if you only use asin
hotpancakes has joined #ruby
<warrshrike>
Oh. Yeah I didn't think of that
Ax has quit [Quit: Ax]
<warrshrike>
I need to brush up my trig
<domgetter>
atan2 will let you check angles in any direction
milardovich has quit [Ping timeout: 240 seconds]
<warrshrike>
got it
<warrshrike>
so i got that part working
<warrshrike>
now to check if its 'outside the circle'
<domgetter>
distance check is the easy part :)
<warrshrike>
I can use the angle i just calculated and check what x, y i get for 50 radius?
jair has quit [Remote host closed the connection]
elh9 has quit [Ping timeout: 255 seconds]
<domgetter>
yes
<domgetter>
x= r*cos(a), y = r*sin(a) :)
<domgetter>
(plus the 50,50 offset)
<warrshrike>
c_ang = Math.atan2((x_t-50),(y_t-50)) if c_ang < a.degrees && (50 + 50*Math.cos(c_ang)) >= x_t puts "yes" end
<warrshrike>
Woo. It seems to work :)
<warrshrike>
domgetter: it still doesnt work for one case a=87 x=20 y=40
<warrshrike>
just like my linear search solution
<domgetter>
does it work for any other cases of >50% ?
<domgetter>
is 20,40 right on the line for 87% ?
<warrshrike>
but this isnt > 50%
<warrshrike>
hmm not sure its just said this should be black
<domgetter>
? Is 87 not > 50 ?
<zenspider>
wow... I missed a lot.
<warrshrike>
oh yeah sorry i confused angle with %
<warrshrike>
stupid me
<warrshrike>
it does work for 99, 99, 99
<warrshrike>
which is in black part but out of circle bounds
<domgetter>
right, distance check is the easy part
blackwind_123 has quit [Ping timeout: 248 seconds]
<domgetter>
keep in mind that atan2 is NOT returning a value between 0 and 2pi starting at the top of the circle going clockwise
<warrshrike>
right it gives a negative value
tomphp has joined #ruby
<warrshrike>
i just saw
<warrshrike>
so i need to +180 deg
<warrshrike>
if -ve?
<domgetter>
so I think you'll need 4 cases: when the circle is >50% and the point is on the left, when it's >50% and the point is on the right, <50% and on the right, >50% and on the left
<zenspider>
warrshrike: what are you drawing in?
<domgetter>
the alternative is to convert "circle filled" coordinates into your atan2 coordinates
<domgetter>
so that you're comparing apples and apples
harai has quit [Ping timeout: 255 seconds]
<warrshrike>
right circled filled is out of 360
<domgetter>
zenspider it's a kata for checking if a point is inside a filled arc of a circle
<warrshrike>
how can i convert that?
<warrshrike>
also whats a kata
<domgetter>
warrshrike a kata is a small programming problem designed to sharpen your skills
<warrshrike>
domgetter: oh
<zenspider>
just monte carlo?
<zenspider>
can't you do that w/ a simple distance formula?
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
<warrshrike>
well idk if it sharpen my skills ~_~
<domgetter>
warrshrike just generate the point with r*sin(theta), r*cos(theta)
<Mon_Ouie>
I was just confused by the name, I was expecting something called degrees to return degrees
<warrshrike>
oh yeah come to think of it should have called it .to_rads
<warrshrike>
~_~
lxsameer has quit [Quit: WeeChat 1.6]
aremaref has quit [Ping timeout: 248 seconds]
Guest65151 is now known as ged
ged is now known as Guest23568
hightower2 has joined #ruby
warrshrike_ has joined #ruby
<warrshrike_>
sorry pc died
<warrshrike_>
lemme know if i missed anything
<domgetter>
nothin
tk__ has joined #ruby
<warrshrike_>
ah
<warrshrike_>
so any idea with those test cases?
warrshrike has quit [Ping timeout: 260 seconds]
<warrshrike_>
h
duckpuppy has joined #ruby
giovdk has quit [Ping timeout: 260 seconds]
<domgetter>
warrshrike_ alright I have the code that makes those 5 cases pass
<warrshrike_>
lets see it
<domgetter>
The mistake was that we needed to do 50*Math.cos(Math::PI/2 - a.degrees) in order to convert from "regular" angles to filled-in-circle angles
<domgetter>
that gives the correct point on the curve, which in turn gives the correct atan2 values
<domgetter>
I put it in quotes because it's not a real thing
duckpuppy has quit [Ping timeout: 240 seconds]
<domgetter>
I just mean the angles I'm used to from trig. That is, on the unit circle, you start at the point (1,0) and move counter-clockwise
<domgetter>
so PI/2 is straight up, and PI is to the left
<domgetter>
but for the circle in the problem, 0 is straight up, and we're going clockwise
<domgetter>
So I have to negate the angle and add PI/2
<warrshrike_>
ah
<warrshrike_>
makes sense now
<domgetter>
I could have made it more clear with something like 50*Math.cos(circle_degrees_to_normal_degrees(theta))
<warrshrike_>
you're a bloody genius
<warrshrike_>
yeah but good enough
<domgetter>
I think there are still edge cases of the circle being exactly half filled, and whether or not there is a fudge factor to take into account
<domgetter>
the "<" on line 20 won't work if the values are equal
<warrshrike_>
whats a fudge factor?
<domgetter>
oh, nvm, I'm tired and it will just say "no"
<warrshrike_>
should i make it <=?
spyder55 has quit []
<domgetter>
By "fudge factor" I meant like, "should the method return true if it's within 0.000001"
AndBobsYourUncle has joined #ruby
<domgetter>
warrshrike_ we don't need to make it <= in this case, but it might not do what is asked in the case where they are equal, so that's why I said to be wary of it as an edge case
<warrshrike_>
well im supposed to run this on 10000 testcases
<warrshrike_>
and can only do so once
<domgetter>
Ah
<domgetter>
then hold on
<domgetter>
what should it do if A) the circle is exactly half-filled, and B) the point is on that line?
<warrshrike_>
if its half filled we should just make sure the angle of the coords is <= 180?
<domgetter>
Sorry if I wasn't clear, I'm asking about the specific case where both the circle is half-filled, and the test point is on the fill border
<domgetter>
so like, the point is at (50,25)
<warrshrike_>
oh
<warrshrike_>
hmm
<domgetter>
Now that I think about it, I think it should be <= for all cases
<domgetter>
But I have one more question
<warrshrike_>
yeah thats what i thought it
<warrshrike_>
it could always be on the fill line...
<domgetter>
what should the answer be if the circle is 0% filled, and the point is at (50,75) ?
AndBobsYourUncle has quit [Ping timeout: 255 seconds]
<warrshrike_>
hmm
milardovich has joined #ruby
<warrshrike_>
shoudnt <= work here too?
<domgetter>
if the answer is "the return value should be 'no' if the circle is 0% no matter what", then we should add that as a special case before the distance check
<warrshrike_>
angle is zero rads
<warrshrike_>
oh i get what you mean now
<warrshrike_>
i think
<warrshrike_>
if its zero than
<warrshrike_>
always retur no
<warrshrike_>
like you said
<warrshrike_>
yeah its definitely that
enyo has joined #ruby
<domgetter>
I updated my gist to account for both edge cases
<warrshrike_>
so we need <= and a separate if condition
<warrshrike_>
lemme see
<warrshrike_>
okay lets run this bad boy
sdothum has joined #ruby
SpiffTR has joined #ruby
enyo has quit [Ping timeout: 240 seconds]
<domgetter>
warrshrike_ good luck. It's time for bed ehre
<warrshrike_>
okay
<warrshrike_>
thanks a lot!
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
domgetter has quit []
pawnbox has quit [Quit: gotta go guys.]
iffyuva has joined #ruby
veloutin has quit [Ping timeout: 258 seconds]
elh9 has joined #ruby
charliesome has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
govg has joined #ruby
Fernando-Basso has quit [Quit: WeeChat 1.6]
charliesome has quit [Client Quit]
veloutin has joined #ruby
ocbtec has joined #ruby
elh9 has quit [Remote host closed the connection]
Mon_Ouie has quit [Quit: WeeChat 1.6]
elh9 has joined #ruby
Lord_of_Life has quit [Excess Flood]
Gasher has joined #ruby
Lord_of_Life has joined #ruby
milardovich has quit [Remote host closed the connection]
milardovich has joined #ruby
toretore has joined #ruby
milardovich has quit [Ping timeout: 260 seconds]
minimalism has quit [Quit: minimalism]
polysics_ has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polysics has quit [Ping timeout: 258 seconds]
Guest23568 is now known as ged
ged is now known as Guest26038
tvw has joined #ruby
tomphp has joined #ruby
sepp2k has quit [Ping timeout: 248 seconds]
Pupeno has quit [Remote host closed the connection]
nankyokusei has joined #ruby
koldbrutality has quit [Ping timeout: 258 seconds]
cdg has joined #ruby
JeanCarloMachado has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
yfumi has joined #ruby
charliesome has joined #ruby
AndBobsYourUncle has joined #ruby
bronson has joined #ruby
JeanCarloMachado has quit [Remote host closed the connection]
JeanCarloMachado has joined #ruby
DoubleMalt has quit [Ping timeout: 258 seconds]
tmtwd has joined #ruby
slyslick has joined #ruby
milardovich has joined #ruby
AndBobsYourUncle has quit [Ping timeout: 255 seconds]
bronson has quit [Ping timeout: 245 seconds]
saneax is now known as saneax-_-|AFK
dasher00 has joined #ruby
sepp2k has joined #ruby
Pupeno has joined #ruby
Pupeno has quit [Changing host]
Pupeno has joined #ruby
milardovich has quit [Ping timeout: 248 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
petrichorx_ has joined #ruby
SpiffTR has quit [Quit: Leaving.]
DoubleMalt has joined #ruby
Kaze_FX has joined #ruby
tomphp has joined #ruby
tk__ has quit [Quit: ばいばい]
conta has joined #ruby
hotpancakes has joined #ruby
_main_ has joined #ruby
_main_ has quit [Read error: Connection reset by peer]
__main__ has quit [Read error: Connection reset by peer]
_main_ has joined #ruby
Pupeno has quit [Remote host closed the connection]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
_main_ is now known as __main__
milardovich has joined #ruby
anuxivm has joined #ruby
ksteck has joined #ruby
pilne has joined #ruby
hotpancakes has quit [Ping timeout: 255 seconds]
futilegames has joined #ruby
DoubleMalt has quit [Ping timeout: 260 seconds]
yfumi has quit [Quit: Leaving]
duckpuppy has joined #ruby
davic is now known as Taco
Taco is now known as Takko
Takko is now known as davic
newbie1 has joined #ruby
cdg has quit [Remote host closed the connection]
duckpuppy has quit [Ping timeout: 258 seconds]
enyo_ has joined #ruby
DoubleMalt has joined #ruby
futilegames has quit [Quit: futilegames]
rikkipitt has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
Guest26038 is now known as ged
ged is now known as Guest62830
enyo_ has quit [Ping timeout: 255 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
futilegames has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
slyslick has quit [Remote host closed the connection]
Pupeno has joined #ruby
charliesome has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
tmtwd has quit [Ping timeout: 260 seconds]
nettoweb has joined #ruby
charliesome has quit [Ping timeout: 240 seconds]
gloscombe has joined #ruby
Pupeno has quit [Remote host closed the connection]
jshjsh has joined #ruby
JoshS has quit [Disconnected by services]
jshjsh is now known as JoshS
binaryplease has joined #ruby
SpiffTR has joined #ruby
nettoweb1 has joined #ruby
aryaching has joined #ruby
nettoweb has quit [Ping timeout: 248 seconds]
unshadow has quit [Quit: leaving]
xen0fon has quit [Quit: xen0fon]
nettoweb1 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
masondesu has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
masondesu has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hotpancakes has joined #ruby
Gadgetoid has quit [Read error: No route to host]
nettoweb has joined #ruby
Gadgetoid has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
polysics_ has quit [Remote host closed the connection]
scootaloo has quit [Remote host closed the connection]
polysics has joined #ruby
Gadgetoid has quit [Read error: No route to host]
scootaloo has joined #ruby
f4 has joined #ruby
bmurt has joined #ruby
Gadgetoid has joined #ruby
x00r__ has quit [Ping timeout: 240 seconds]
duckpuppy has joined #ruby
polysics has quit [Ping timeout: 248 seconds]
Welkin has joined #ruby
nankyokusei has joined #ruby
<Welkin>
could anyone explain the syntax used here?
<Welkin>
`render plain: params[:article].inspect`
polysics has joined #ruby
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Welkin>
`{ :plain => params[:article].inspect }` should be the same, correct?
<Welkin>
it is a single element hashmap
<Papierkorb>
Welkin, in long form that'd be: `render({ :plain => params[:article].inspect })`
rikkipitt has quit [Remote host closed the connection]
duckpuppy has quit [Ping timeout: 248 seconds]
<Welkin>
okay
rikkipitt has joined #ruby
polysics has quit [Client Quit]
<Welkin>
and if you omit parentheses, you still need to include the commas between the function parameters
brendan- has joined #ruby
<Papierkorb>
Yes of course
nankyokusei has quit [Ping timeout: 258 seconds]
BlueDragons has joined #ruby
jenrzzz has quit [Ping timeout: 258 seconds]
BlueDragons has quit [Client Quit]
rikkipitt has quit [Ping timeout: 260 seconds]
shinnya has quit [Ping timeout: 258 seconds]
x00r__ has joined #ruby
bronson has joined #ruby
Pupeno has joined #ruby
AndBobsYourUncle has joined #ruby
brent__ has joined #ruby
bruno- has joined #ruby
conta1 has joined #ruby
bruno- has quit [Client Quit]
the_drow has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
Guest62830 is now known as ged
brent__ has quit [Ping timeout: 248 seconds]
ged is now known as Guest22004
AndBobsYourUncle has quit [Ping timeout: 255 seconds]
conta1 has quit [Ping timeout: 240 seconds]
BlkDynmt has quit [Quit: BlkDynmt]
SpiffTR has quit [Quit: Leaving.]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SpiffTR has joined #ruby
ifctj has joined #ruby
futilegames has quit [Quit: futilegames]
SpiffTR has quit [Client Quit]
Vile` has joined #ruby
eelster has joined #ruby
Pupeno has quit [Remote host closed the connection]
<eelster>
I have a question that I have, on the whole, been unable to find an answer to.
<eelster>
Does ruby have an sum type, like union in C/
dmin7b5 has joined #ruby
rikkipitt has joined #ruby
<eelster>
I meant to say a sum type. I don't know why I typed an
<Welkin>
you don't work with types directly, afaik
<Welkin>
like with any dynamically typed language
<Welkin>
you just use hashmaps
<eelster>
So generally classes are fine for what I want, but I was working with something where memory efficiency is essential. I was trying to see if I could use ruby instead of C, but I'll probably just use C for it.
bigkevmcd has quit [Ping timeout: 245 seconds]
<eelster>
Now that I think about it, because of Ruby's dynamic typing, I guess I could just use a single variable in place of a union.
<matthewd>
I'm not sure what a ruby equivalent of a union would look like
scootaloo has quit [Remote host closed the connection]
<matthewd>
.. but if memory efficiency really matters, you're likely to have a bad time anyway
petrichorx_ has quit [Quit: Connection closed for inactivity]
<eelster>
Could just be a single variable that changes types in Ruby.
<eelster>
matthewd: Yes that is true. Unfortunately, Ruby isn't great for my embedded device I'm working on with 128KB of RAM.
<Welkin>
lol
<Welkin>
then don't use ruby
brendan- has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<Welkin>
the obvious choice for embedded is C
<eelster>
It is already programmed in C
<eelster>
I just wanted to see if there was any way I could reprogram it in ruby, but it is seemingly not possible.
futilegames has joined #ruby
brendan- has joined #ruby
<eelster>
I like pushing Ruby to the limits (and beyond the limits) of what it was made for.
KeyJoo has joined #ruby
manjaro-kde5__ has joined #ruby
<Papierkorb>
eelster: Maybe Crystal-lang could be of interest to you on the long run
<Papierkorb>
I don't think though that anyone has tried to use crystal for embedded programming yet
<matthewd>
mruby?
<eelster>
Papierkorb: I've tried Crystal a bit, but for me it's not that interesting because I am pretty comfortable in C.
the_drow has quit [Quit: This computer has gone to sleep]
<eelster>
I use Ruby for a lot of dynamic things, which unfortunately crystal does not offer.
<eelster>
It's pretty cool on the whole though.
doublemalt_ has joined #ruby
xen0fon has joined #ruby
<canton7>
you're not going to get those dynamic things without interpreting the language (rather than compiling it), and an interpreted langauge is never going to work on an embedded platform
braincrash has quit [Ping timeout: 240 seconds]
<eelster>
canton7: Yes, that does seem to be the reality :/
<Papierkorb>
canton7: There are JVMs running on credit cards...
<eelster>
Papierkorb: That's an interesting idea. I wonder if I can work with JRuby for this.
<Papierkorb>
lawl
nettoweb has joined #ruby
<canton7>
true, but the vast majority of embedded devices don't run java
<Papierkorb>
Well, if you get it to fit in that few KiBs of ram you have..
<eelster>
Maybe I'll just get a better embedded device for my fridge.
<Papierkorb>
raspi zero?
<eelster>
I have one sitting around.
<Papierkorb>
it's small and should be powerful enough to run any language-of-the-week
<Papierkorb>
I'm still disappointed that IoT = "Internet of Toilets" didn't take off
<eelster>
I did completely re-program my Java-ready blueray player with JRuby.
<Papierkorb>
wat
<eelster>
My BlueRay player had a ton of shit features on it and I took it apart and messed with it and reprogrammed it.
<eelster>
It is probably illegal now with some of the modifications I made.
<eelster>
(A lot of DRM stuff)
<Papierkorb>
You mean, it's actually usable now?
<Welkin>
DRM is bullshit
<Papierkorb>
What a disgrace
dhollinger has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eelster>
JRuby is very useful for anything that is Java ready (which a lot of mid-range IoT devices are)
<Papierkorb>
I don't have Windows for one of those overpriced bullshit bluray players, nor do I own a standalone bluray player. I have a Bluray drive though and bought bluray movies, which I then have to rip/crack to actually watch. wtf?
<eelster>
Yeah, BlueRay is shitty.
aries_liuxueyang has quit [Ping timeout: 245 seconds]
<eelster>
Rasp Pi is great though, because I build a lot of my own IoT stuff instead of modding pre-existing IoT devices.
dhollinger has joined #ruby
bmurt has joined #ruby
<Papierkorb>
You don't buy premade IoT devices? So you don't find it funny to offer a VPN for random chinese corporations into your home network, or be part of a "proud" DDoS network?
ksteck has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eelster>
I buy some premade IoT devices. I do both. A lot of my IoT things aren't actually "online" either though. What do you mean by random chinese corporations?
Yacker has joined #ruby
<Papierkorb>
the real manufacturers, selling them as white label products
rikkipitt has quit [Quit: Leaving...]
<Papierkorb>
There was a case here in Germany where people bought tons of IoT surveillance cameras to watch their houses from a supermarket when they were cheap
<Papierkorb>
Well, their security was also cheap :)
<eelster>
Oh yeah, I don't do that shit. I also like tinkering and messing around.
<eelster>
I'm more comfortable with a rasp pi because I know I control what it's doing.
doubleemms has quit [Remote host closed the connection]
<eelster>
My IoT devices are connected to the internet, but very indirectly.
enyo_ has joined #ruby
futilegames has quit [Quit: futilegames]
xen0fon has quit [Ping timeout: 240 seconds]
braincrash has joined #ruby
enyo_ has quit [Ping timeout: 240 seconds]
f4 has quit [Quit: Ухожу я от вас]
jhack has joined #ruby
ifctj has quit [Ping timeout: 240 seconds]
jhack has quit [Client Quit]
tomphp has joined #ruby
xlegoman has joined #ruby
xen0fon has joined #ruby
andrzejku has joined #ruby
Mr_Pancake has quit [Ping timeout: 256 seconds]
dmin7b5 has joined #ruby
manjaro-kde5__ has quit [Ping timeout: 240 seconds]
dmin7b5 has quit [Client Quit]
xen0fon has quit [Quit: xen0fon]
dmin7b5 has joined #ruby
nettoweb has joined #ruby
_whitelogger has joined #ruby
bronson has quit [Remote host closed the connection]
<porfa>
i tried several things, but then i though “hmmm all of these lines have and R and two numbers on each side.. so.. why not look for ?R? or something..
<havenwood>
porfa: split /(?<=\d)(?=R)/
Channel6 has quit [Quit: Leaving]
<porfa>
wow, amazing
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xlegoman has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rikkipitt has quit [Remote host closed the connection]
Mystacism has joined #ruby
iffyuva has quit [Ping timeout: 240 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nowhere_man has quit [Quit: Konversation terminated!]
jackjackdripper has quit [Quit: Leaving.]
nowhere_man has joined #ruby
teclator_ has joined #ruby
teclator has quit [Ping timeout: 255 seconds]
xlegoman has joined #ruby
enilsen16 has quit [Quit: enilsen16]
agent_white has quit [Read error: Connection reset by peer]
Mystacism has left #ruby ["Leaving"]
houhoulis has quit [Remote host closed the connection]
LastWhisper____ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
wennefer has joined #ruby
LoneHermit has joined #ruby
sepp2k has quit [Quit: Leaving.]
wennefer has quit [Client Quit]
AlexRussia has quit [Ping timeout: 240 seconds]
enilsen16 has joined #ruby
houhoulis has joined #ruby
teclator_ has quit [Ping timeout: 245 seconds]
teclator has joined #ruby
art-solopov has quit [Quit: Konversation terminated!]
roamingdog has joined #ruby
roamingdog has quit [Remote host closed the connection]
roamingdog has joined #ruby
duckpuppy has quit [Ping timeout: 240 seconds]
<parsnip>
i think rvm is changing my `cd` command, but the code suggests it only does it if ZSH_VERSION is set, but i don't think it is. anyone run into this?
<porfa>
hello, im asking something in regex, but there seems no one around to help me it, is it ok it i crosshelp for this?
<elomatreb>
sure
<evotopid>
parsnip: Are you using zsh anyway? Maybe it is getting set somewhere, but I guess that's a bit weird.
<parsnip>
so when i `cd ~/my-jekyll`, it bleeps about stuff in Gemfile
dcunit3d has quit [Ping timeout: 240 seconds]
<porfa>
ok, how can i select, the first occurrence of: a space two numbers and a leter? for ie “kx13 INSPIRA DD1 66N” i want to keep” 66N” (its not always in the last part of the string)
<elomatreb>
Do the numbers have to be the same?
<porfa>
no no, they are random, it’s always random numbers (two) and a random Character
<evotopid>
parsnip: I don't know since I haven't used rvm in a while, personally I prefer rbenv which doesn't overwrite shell functionality like that.
<parsnip>
evotopid: okay, i like to hear of what's in common use, as i'm new to ruby (my actual use is quite limited so far)
<parsnip>
thank you
milardovich has quit [Remote host closed the connection]
<elomatreb>
porfa: / \d{2}\[a-zA-Z]/ ?
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]