« first day (2218 days earlier)      last day (2734 days later) » 

2:00 PM
That's not too difficult...
 
user3119231
 
It'd help if you split on your string...
 
so
@Zirak I'm on a chromebook
@Zirak using crouton to get an ubuntu chroot
@Zirak on which I'm using exwm as my window manager
(ubuntu is because I didn't have much choice.)
 
!!s/because.*/awesome)/
 
@rlemon (ubuntu is awesome) (source)
 
2:06 PM
@FlorianMargaine I used to do this, ended up just wiping chromeos and installing ubuntu
 
@BenFortune but ubuntu sucks
and honestly, I don't want to bother with all the wifi and sound shit
 
Was literally 1 patch for me which was for the sound, which chromebook?
 
Could probably be made to be more efficient, but meh.
 
@BenFortune I haven't even tried it
 
2:11 PM
what is the best way to cancle following .then() ´s if the array in the first .then() is empty in a promise using Bluebird? I basically just want to return [] instead my other .then() functions are called with no sense
is that possible?
 
@FlorianMargaine swaggalicious
 
jsfiddle.net/rx0zv4wb/5 Slightly cleaner, @Duvall912.
 
because my server crashes if the database as not result that fit´s to the request
 
@Cerbrus "Thanks for doing my homework" 😃
Ugh, something keeps locking up my browser
 
@BayLife yes, you just nest the promises to achieve that. One sec, I'll write a small sample.
 
2:17 PM
@BenFortune Not even a thanks, actually :P
Still, fun to do
 
@Luggage thanks :)
 
@ivarni Russian cats are scary ya know. Not sure if I can blame them
 
return doFirstThing()
.then(function (result) {
    if (result.length) {
        return doSecondThing(result)
        .then(function (result2) { return doThirdThing(result2); });
    }
    else {
        return result;
    }
})
 
@BayLife Just throw an Error
throw new EmptyResultError("nothing matched")
 
doSecondThing and doThirdThing happen if the array has items, otherwise, not.
@OliverSalzburg I don't think it's an error, just a short circuit
If you consider it an error condition, though, @BayLife, listen to Oliver.
 
2:21 PM
Okay throw new EmptyResultSuccess("nothing matched") then
 
haha
 
;P
I think it's also fine to check if( !result || !result.length ) return result; at the start of a handler
Whatever works and is readable ;D
 
My example could be more readable than it is.
yea, I agree with your line above
 
best would be if I could just put it in the : block
.then(departmentData => [ departmentData, departmentData[0].length !== 0 ? departmentData[0].map(entry => this.getDateRange(new Date(entry.dateFrom), new Date(entry.dateTo))) : "" ])
 
I think that's too much on one line.
 
2:24 PM
I agree :D
 
ok^^
then i will make the check a .then() before that
 
meh, you can just re-write that line ot be a lot more readable. even JUST some newlines helps:
.then(departmentData => [
    departmentData,
    departmentData[0].length !== 0 ? departmentData[0].map(entry => this.getDateRange(new Date(entry.dateFrom),
    new Date(entry.dateTo))) : ""
])
 
ah ok
 
meow?
 
May I ask why you are returning an array of arrays?
as opposed to something like { departmentData: departmentData, dateRanges: xxx, someDate: xxx } ?
 
2:28 PM
good Q
 
then later on in your code you can use result.departmentData instead of result[0]
 
good suggestion. some lines under this I was at a point where i had to do sth like this ^^
 var departmentMinStock = departmentData[0][0].departmentMinStock;
asked myself before, if this is good :D
but before i change everything. How I would like to test, if the "cancel" works. But if i try to put a throw new Error in a : block. This seems to be syntactical incorrect
.then(departmentData => departmentData.length !== 0 ? [departmentData] : throw new EmptyResultSuccess("nothing matched"))
 
yea, break that into a full function if you plan to throw
I just mean departmentData => { }
Also, the EmptyResultSuccess was a joke.
Is this an error condition or are 0 results a normal possibility?
 
yes i know, just a copy
normal
 
Then I would not throw an error at all.
 
2:35 PM
ok so your solution?
 
you CAN use error handling for flow control, but that's abusing it.
 
hm, but if i try to apply your style i have to rewrite everything as it seems, because it seems that your doThirdThing() handle like a function. Could i apply this easier in here? jsfiddle.net/azucn8st
 
no, no.
you don't need to rewrite everything.
one sec
Does what you have work?
 
if i request data that exist yes
perfectly ;)
 
line 15 seems wrong..
 
2:41 PM
yeah from your advice i removed the []
but if you put them in again
 
the second argument to .then() is an error handler, but you pass it some array..
 
hm ok
 
put it back to working condition, please.
 
was just the removed []
 
ok, yea, now it's valid again.
give me names for those three promise results.
 
2:44 PM
names?
 return [{"vacationRequest": departmentData[0], "blockedDays": blockedDays}, departmentData[2]];
 
nevermind, i'll make some up
 
😃
 
:P
 
https://jsfiddle.net/mqgo5Lgx/
Why is effect not a function?
 
What is the thing you want to check, departmentData.length?
hm.. I don't even see any async calls afte the first Promise.all..
You might not need all those .then()s
 
2:49 PM
if the database found something
data comming from mysql async
return Promise.using(dbConnection.getConnection(), function (conn) {
            return conn.queryAsync(sql, [departmentID])
                .then(function (result) {
                    return result;
                })
                .catch(function (err) {
                    return err;
                });
        });
 
user6820627
did you know css can generate random number now? codepen.io/kranzy/pen/JbGwKa
 
@jAndy haha no it's veterans day here :p
 
after line 14, i see no reason to keep splitting your code into promises.
 
just a pic of when I was in the Air Force
 
am I wrong?
 
2:51 PM
@rlemon wooooot happy Friday boooys @FlorianMargaine @KendallFrey
 
yay!
I'm taking the afternoon off
 
nice
dude only like 3 more weeks for Oculus Touch
can't wait!
 
@LearnHowToBeTransparent A list of pre-defined numbers isn't random
 
@Loktar omg
 
I can definitely wait... for the price to come down
 
2:52 PM
@ndugger you already have a really capable PC
price isn't too bad, but yeah lower would be better
 
@Luggage the getDateRange() must be handled with promises
 
user6820627
@BenFortune rlemon saw zach saucier's version
 
else it runs in undefined
 
I don't feel like dropping ANOTHER $800
 
@Loktar whoa really?
 
2:53 PM
@Zirak lol nice
 
@KendallFrey what, about the price?
I mean yeah $800 is a good chunk for sure
but still for what we get idk
 
about "lower would be better"
 
VR is badass
 
@LearnHowToBeTransparent It also depends on where you click
 
@BayLife no, it doesn't
 
2:53 PM
@Loktar Have you heard NerdCubed talk about it?
 
no
 
@AwalGarg thaaaanks
 
I should try this..
 
Guys I am trying to do a simple shake effect can you help me understand why I get a Uncaught type error?
 
2:54 PM
but I get what he's trying to say
 
@Luggage hmkay
 
I hope Portal Stories VR gets Rift support asap
 
return dateArray; // <- not a promise, not async
which is ok.
 
@Zirak I am honestly surprised, though - I've never seen you exaggerate about these things before, or seen holding strong opinions either. Is this something special which has bitten you before? Or was it your recent anecdote with your coworker? :P
 
setInterval(function () {
        $("#piec").effect("shake");
    }, 5000);
should not produce an uncaught type error
 
2:57 PM
setInterval is dirty
 
I am also using the jquery lib and the ui
the lib is defined before the ui
 
@Skullomania .effect() is not on jquery. I think it needs another library
oh?
I don't see jquery UI anywhere.
not in external resources, no int he html as a script tag.
 
take a look
 
@KendallFrey yeah I bet it will
 
I did.
 
2:58 PM
well I hope, some people are being bitches when it comes to the Rift which is REALLY annoying imo
 
that's how I know.
 
but touch looks and sounds so superior to the vive wands
 
@Loktar "vive wands"? Whoever came up with that product name?
 

« first day (2218 days earlier)      last day (2734 days later) »