« first day (2230 days earlier)      last day (2721 days later) » 

10:00 PM
!!s/sumpt/fapp/
 
@Shmiddty !!afk fappin (source)
 
yeah one question I got today after the main guy left his position. So can you get the stuff he was supposed to have done next week for the release?
 
Thanks for sharing, hon
 
I said no..well can you give a timeline?
grrr
need to figure out a way to diplomatically push out the deadline
 
Time it takes to do the same work is inversely proportional to the amount of people working on it.
If only you and another guy where working at some specific thing you can make your timeline twice as long.
 
10:14 PM
I might do
bit pissed they set the timeline to the day I vacation
ie, this has to be done before you go..because no else has a clue how to do it
eh rant over..tomorrow is a fresh start :)
 
m59
I have a data structure that could be
{
  foo: 'string'
}
or
{
  foo: [{a: 'whatever', b: 'stuff']
}
I'm trying to use Ramda to make the latter example into {foo: 'stuff'}
 
The way i see it you have 2 options:
- Work extra and get paid more.(Ideally, but, you will be paid the same.)
- Do the work you were intended to do and get fired.
 
m59
This is easy in the non-functional way, but then I don't learn anything
 
{
  foo: [{a: 'whatever', b: 'stuff']
}
aren't you missing a }?
 
m59
R.over(
    R.lensProp('foo'),
    R.ifElse(
      R.is(String),
      R.identity,
      R.view(R.lensIndex(-1))
    )
  )
@KarmaDoe yeah, my bad
So, that will get me to { foo: {b: 'stuff'} }
 
10:19 PM
But why make foo an array?
 
m59
That's just how the data is
It can have multiple
I just need the last one
 
but youll get
{
foo:
foo:
foo:
 
m59
  R.pipe(
    R.over(
      R.lensProp('foo'),
      R.ifElse(
        R.is(String),
        R.identity,
        R.view(R.lensIndex(-1))
      )
    ),
    R.over(
      R.lensProp('foo'),
      R.view(R.lensProp('b'))
    )
  )
This works
but I think having to lensProp('foo') twice is wrong
@KarmaDoe That doesn't make any sense to me, sorry.
 
If you make an object property an array, you'll get listed several identically named properties with different content
 
m59
You're confused, my friend.
I'm not doing that.
 
10:23 PM
I might as well be.
{
  foo: [{a: 'whatever', b: 'stuff'}, {c:'Cornflakes'}]
}

{
foo: {a: 'whatever', b: 'stuff'},
foo: {c:'Cornflakes'},
}
 
m59
You're still not making sense. That has nothing to do with what I'm doing.
 
Probably.
I'm sorry I rustled your jimmys.
 
m59
np
 
Is that Ramda btw ?
 
m59
Yeah
What I need is simply this:
a function that receives an array, and returns the b property from the last item (object) in the array
function thatINeed (array) {
  const lastItem = array[array.length - 1]
  return lastItem.b
}
That's what I'm not sure how to do with Ramda
R.over(
  R.lensProp('foo'),
  R.ifElse(
    R.is(String),
    R.identity,
    thatFunctionHere
  )
)
That code would do what I want
but I had to stop using Ramda style to do it
 
10:41 PM
I see
Ill go read Ramda docs now
 
10:54 PM
-1
Q: User refusing to correct misinformation in their popular answer

GothdoThere's a popular JavaScript question What's the difference between using “let” and “var” to declare a variable?. The question has been viewed 286k times and has a score of 1468, and the top answer has a score of 2256. The top answer contains some misinformation. It says about var and let: B...

 
m59
solved it
so easy
  R.over(
    R.lensProp('foo'),
    R.ifElse(
      R.is(String),
      R.identity,
      R.pipe(
        R.view(R.lensIndex(-1)),
        R.view(R.lensProp('b')),
        R.view(R.lensIndex(0))
      )
    )
  )
 
takeLast(1, array).b?
 
m59
That's not functional
but yeah, that's probably a better general direction
take and takeLast are probably better, yeah
 
To avoid all that nesting
 
m59
take returns an array, though
actually, I think my code is right
It does work. There might be a shortcut to R.view(R.lens
 
11:05 PM
I get where you are going now.
 
m59
oo R.prop probably
 
@m59 I was just about to ask: Do you specifically want a lens, or do you just want a property?
 
m59
    R.nth(-1),
    R.prop('tags'),
    R.nth(0)
@Zirak The existence of view mislead me
What is view good for, then?
 
A lens is a getter/setter, and view runs the getter
 
m59
But isn't R.prop always the same result as R.view(R.lensProp()) ?
 
11:12 PM
@m59 Matter of fact, I'm 99% sure lensProp is implemented in terms of prop
 
m59
cool
 
lensProp = key => lens(prop(key), assoc(key))
Let's look at the source
 
m59
neat. I should have done that
sorry. Head hurts bad.
 
No need to apologise, ramda's a big big library
 
m59
Have you dealt with any of the futures libraries?
I've found promises and async/await are not the ultimate solution to async in js
I suspect ramda-fantasy will be a boon to my life when I eventually wrap my head around it
and/or folktale
 
11:21 PM
@m59 Not really, no
@m59 Those are definitely interesting projects, you do have to dig into a bunch of stuff before you approach them
And that bunch of stuff isn't incredibly popular or widespread, which is difficult. The functional community at times is a bit weird, just like the hardcore OOP community is.
 
m59
Yeah, that has made it hard to pickup Ramda
The few decent blogs I've read are not really all that helpful to me
 
For instance, most examples you'll see aren't more complex than running toUppercase on objects or doing a simple xhr. Matter of fact, not a lot of people (myself sourly included) really know how to deal with complex state handling, how to really write a functional, non-mutative system.
 
Wouldn't you be better off with another language ?
 
Good examples of systems which have such challenges are games. Even Pacman or Space Invaders are hard to write in pure functions.
@KarmaDoe From what I've seen, nobody really knows how to do things
Besides Bartek who's a god and I don't deserve a whiff of his BO
 
m59
I'm glad to know there's someone else that's a code nihilist
 
11:29 PM
So fuck that and listen to Eine kleine Nachtmusik
 
m59
I think everyday I start working and I think, "This code sucks, I suck, and it and I will always suck."
 
m59
but on the bright side, I'm getting better. So it doesn't suck as bad.
 
Will you ever be happy with your code ?
 
@m59 ah, being critical to oneself alongside self deprecation. A bag of fun.
One coping mechanism is accepting the suck, and sometimes viewing it as a source of dirty pleasure. "Oh man", think to yourself, "I solved this problem in such an ugly way, I pulled every dirty trick in the book". Attune to that feeling. Energise yourself from it.
 
m59
11:32 PM
lol
 
Don't be sad because you are not what you could be. Be glad that you can be more than what you are.
 
Let it be your source of proteins.
 
m59
@KarmaDoe I generally just try to be awesome at something and don't really care so much about how good it is
 
eh, i just look at it as now i have code to come back to tomorrow, a week from now, or a year from now that can be improved.
 
m59
I mean, I'm not sure I'm ever "happy" with anything
but what I care about is trying to be impossibly perfect at things
and I can try
 
11:34 PM
One can always try.
 
m59
and I'm happy with that
 
As long as you're happy
And pay me the monthly protection
 
m59
ermm
 
And code doesn't crash the V8
Wich sometimes does.
 
┬┴┬┴┤ ͜ʖ ͡°) ├┬┴┬┴ pay up
 
11:36 PM
(⌐■_■)==ε/̵͇̿​̿/’̿’̿ ̿ ̿̿ No
 
✧゚・: *ヽ(◕ヮ◕ヽ)
 
🔫😎
 
Is there an easy way of re estructuring code as promise-chain like insted of nested callback ?
 
uhm, yeah usually that's pretty easy
 
Yeah, but it's tiresome
for 3k lines
 
11:45 PM
start by figuring out what can be isolated to a function that returns a promise.
 
step 0) have you got tests?
 
Tests ?
Wich tests ?
 
If you have methods that use the old node callback err,result style, you can easily promisify those with bluebird
 
I know how it can be done, i just don't want to spend 4 hours remaking it.
Is boring as fk,
But yeah, what you told me is what i would be doing.
But

if (err) {
  resolve(message(err));
}
 
(ノಠ ∩ಠ)ノ彡( o°o)
︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿︵‿ヽ(゜□゜ )ノ︵‿︵‿︵‿︵‿︵‿
 
11:53 PM
(ಠ >∩< ಠ)
 
@KarmaDoe write a script that rewrites them for you
 
That would be overly complex.
 

« first day (2230 days earlier)      last day (2721 days later) »