« first day (1824 days earlier)      last day (3121 days later) » 

crl
5:03 PM
What do you guys think of Semantic-UI?
this in particular
 
@crl I've used it for my last 2 projects
 
@BenjaminGruenbaum I need your help. I asked on Mathematics, got an answer, and now I don't understand my question anymore.
 
crl
@Cereal is it closer to jQuery or angular? (stupid question, but my boss wants to use it, and I have no idea how to use it)
well if you don't understand your own question, that's a 'blem, oh shit Functors...
 
> closer to jQuery or angular
@crl have you tried reading the manual?
 
5:08 PM
@crl Uh. It's a css library, with some javascript stuff
I only use their ajax api for search bars
    $('.ui.search.customer-search').search({
        apiSettings: {
            url: '/customers/search/{query}'
        }
    });
^ That's the entirety of the javascript for a searchbar
 
crl
ok, thanks, closer to bootstrap (that's what I though, I was just confused with the API thing)
@Bartek A functor is a function defined over a Set and with values in a Set?
 
@crl a functor is a morphism between categories
 
spoken like a true academician
 
@AwalGarg I think that's a kind of nut
 
5:16 PM
what?
 
!!wiki macadamia
It was a joke
 
Macadamia is a genus of four species of trees indigenous to Australia and constituting part of the plant family Proteaceae. They are native to north eastern New South Wales and central and south eastern Queensland. The tree is commercially important for its fruit, the macadamia nut or simply macadamia. Other names include Queensland nut, bush nut, maroochi nut, bauple nut, and Hawaii nut. In Australian Aboriginal languages, the fruit is known by names such as bauple, gyndl, jindilli, and boombera. Previously, more species, with disjunct distributions, were named as members of this genus Macadamia...
Macadamia is a genus of four species of trees indigenous to Australia and constituting part of the plant family Proteaceae. They are native to north eastern New South Wales and central and south eastern Queensland. The tree is commercially important for its fruit, the macadamia nut or simply macadamia. Other names include Queensland nut, bush nut, maroochi nut, bauple nut, and Hawaii nut. In Australian Aboriginal languages, the fruit is known by names such as bauple, gyndl, jindilli, and boombera. Previously, more species, with disjunct distributions, were named as members of this genus Macadamia...
 
@AwalGarg I fixed the icon rendering in SO chat boxing
 
Cap should really only run commands x seconds after they're sent to account for speed edits
 
jQuery().is(':love');
unsupported pseudo: love :o(
 
5:21 PM
@BartekBanachewicz oh hi
 
so after watching the youtube video.. I'm sold.
 
crl
@BenjaminGruenbaum simple question, on native Promises, I'd like to process the result of a Promise.all jsbin.com/kefuxu/edit?html,js,output, jsbin.com/kefuxu/6/edit?html,js,output is working, but I'd prefer to execute the requests only at the last moment
 
@rlemon What in the world....
 
crl
it's probably easier with Bluebird than with native Promises though
 
@rlemon That's enough internet for you today young man.
 
5:24 PM
!!tell Trasiva youtube squatty potty unicorn
 
@crl you need fmap instead of then
Dunno what's the equivalent of fmap in JS
 
crl
I see, what you mean, not easy to apply haskell things in JS
 
@rlemon I'll watch it at home, I have a feeling that has no business being watched in an office environment.
 
@Trasiva totes SFW
 
5:27 PM
@crl wait, isnt't all :: [Promise a] -> Promise [a]?
@crl in which case Promise.all(promisesToExecute).then(rs => rs.map(r=>r.json())).then(rs=>{console.log(rs.map(r=>r.args.lol))});
 
 
@rlemon What. The actual FUCK. Did I just watch?
 
openstack's dashboard is sweet
also our build tools use way too much ram
 
@Trasiva squatty potty
I've already ordered mine
 
@rlemon That was really...disturbing.
 
5:30 PM
you clearly don't internet enough if that disturbed you
 
Dude, you live in Canada, just cut down a tree and make one out of the trunk for like....the $1 CAD in gas you spent.
 
> cut down a tree
 
@rlemon It was disturbing enough for at work.
 
also, half the world already squats to shit
 
@rlemon and wipes their butt with their hand, and their hand with sand, and can't eat with that hand
 
5:31 PM
@ssube afaik they use the water bucket not their hand and sand
 
@ssube Not like they have anything to eat anyway
 
It was one year ago today that I was very upset by the jpg of Darth Vader pouring ocean water into a brita filter.
Oh the memories...
 
I sent 4 PR's to learnxiny in like 10 minutes. adambard would be creeped out
 
LOL
kansascity.com/news/local/article39003903.html well... at least it wasn't florida man
 
5:34 PM
'Murica
 
I need a good camera
these long exposure images always amaze me
 
@rlemon were you around when we were talking about that yesterday?
 
crl
@BartekBanachewicz I thought of that, not working, but this is working at least: jsbin.com/kefuxu/8/edit?html,js,output
 
@crl wait why wouldn't that work
what does "not working" mean
@crl here you compose in the lifted code. You should still be able to compose in the promise code.
as in
f <$> g can always be written as g >>= liftM f
but JS doesn't have a concept of a monad and I was under impression then does the whole lifting
 
@SterlingArcher This? This is why we can't have nice things.
 
5:45 PM
Actually that's Canada's fault
Driving around in their low riders.. shooting all the jobs..
 
> icummings@kcstar.com
 
@SterlingArcher So I've been under a rock for a while. What's the job situation, did you nab one?
 
lol yeah I've been working for about a month now
Found a job right before I went on vacation, started about 3 weeks after I got back
 
crl
@Bartek it's ok, you were very close
 
I want to believe
 
crl
5:48 PM
Promise.all(promisesToExecute)
	.then(rs=> rs.map(r=>r.json()))
	.then(rs=>{
	  rs.forEach(r=>r.then(s=>{console.log(s.args.lol)}))
  })
 
that can't be right
 
crl
you have to do another 'then' at the end
 
it's as bad as CPS
 
crl
I know, it's temporary
 
I mean uh
when you call that first then, you should have a Promise of list
and after the operation it should still be a promise of list
that map doesn't change the type!
it just changes the thing to json, it doesn't do anything in terms of actual promises
 
@crl why is it suddenly a promise of list of promises here?
 
@SterlingArcher Good man.
 
it just SHOULDN'T do that
let me write that myself
@crl unless .json() returns a promise itself
in which case uh
 
crl
it does developer.mozilla.org/fr/docs/Web/API/Response, fetch is the new ajax thing, you have to do a first then(r=>r.json()) and another then where you can finally read the content
 
http://www.commitstrip.com/en/2015/10/14/the-5-stages-of-learning-to-follow-coding-rules/
CommitStrip
The 5 stages of learning to follow coding rules
CommitStrip
1444845641
 
6:05 PM
There are coding rules?
 
1) make it work
2) don't break it
 
I don't understand the comic
 
Guys :| How does bluebird do promisifyAll?
 
3) Prepare your anus bug email
 
Like "No business logic in the view"
 
6:06 PM
@SomeKittens You mean we can't download the entire database to the browser and decrypt only what we want them to see?
 
@corvid of only there was some way to see the source code.
 
@corvid too bad there isn't a website you could goto and see the code that makes up PromisifyAll
@Luggage :D
 
ninja'd.
 
17
Q: I Broke My Promise

Sterling ArcherSo.. I'm having the hardest time learning how to Promise. I'm using bluebird (https://github.com/petkaantonov/bluebird) as suggested to me -- in order to tame my callback hell I've been getting. Example: function login(req,res,con,mysql,P) { var ref = undefined; con.getConnection(function(e...

Esailja's answer and comments explain how promisifyAll works
lol @SomeKittens the deleted answers on ^ xD
 
oh yeah, waaaay back when
 
crl
6:09 PM
.then(xs => xs.forEach(x => console.log(x))); //your version with your simple promises
.then(rs=>rs.forEach(r=>r.then(s=>console.log(s.args.lol)))) //mine with fetch double promises
@BartekBanachewicz ^
 
hilarious
 
Hey guys i am using openssh and i would like to know the configuration change i need to make to change the users default directory when they ssh into the server
 
@devdar that's not an ssh thing, that's part of PAM or SSSD
 
@ssube ok so i just need to configure the PAM or SSSD options in the sshd_config?
 
@devdar no, PAM and SSSD are the authentication system for the whole system
are these local users or LDAP ones?
 
6:11 PM
17
Q: PuTTY: Change default SSH login directory

BerndOn Windows I use PuTTY to log in a remote server via SSH. Is is possible to change the default directory entry point I get to after I connect and login? (That would be a nice time safer) e.g. from server/home/ to server/home/subdir/subdir forgot to add that the remote webserver is linux based

Like that?
 
@ssube the users are LDAP i modified the passwd and changed the path before the bin/bash but it did not work
@ssube i am using public key authentication for the LDAP users
 
@devdar are you using FreeIPA, an LDAP domain in SSSD, or some other bind?
 
@crl why are there double promises
@crl Don't promises have join?
 
crl
not the natives one, Bluebird yes I think
 
@SterlingArcher i am not using putty the client machine is linux and i am using the terminal to ssh the server
 
crl
6:14 PM
@BartekBanachewicz made like that github.com/github/fetch#html
 
@crl it seriously sounds like CPS
 
2
Q: Home Directories and pam.d using LDAP

Nicholas AndersonBackground: I'm not too familiar with the ins and outs of pam and LDAP authentication on a configuration side. I've used systems that use pam but I've only worked on applications, not systems themselves. Questions: Using pam to control authentication via LDAP, does this mean that a home director...

@devdar try something like that
 
@devdar putty is irrelevant.
 
@SterlingArcher also openssh doesnt have a ~/.bashrc or ~/.bash_profile
 
@crl I don't see the 2nd then used in JSON example
 
6:14 PM
using putty vs other shouldn't really matter
 
crl
fetch('/users.json')
  .then(function(response) {      //1
    return response.json()
  }).then(function(json) {       //2
    console.log('parsed json', json)
  })
 
@crl they are not nested
7 mins ago, by crl
.then(xs => xs.forEach(x => console.log(x))); //your version with your simple promises
.then(rs=>rs.forEach(r=>r.then(s=>console.log(s.args.lol)))) //mine with fetch double promises
 
did you mean to have a ; on the first line?
 
@BartekBanachewicz @crl nested promises are almost always an anti pattern
 
crl
@rlemon oh indeed no
 
6:17 PM
.then(rs=>rs.forEach(r=>r.then
^------------------------------------------ 1st
                          ^---------- 2nd
 
isn't that how you compose them?
 
@Luggage no, you compose them by monadic bind (aka then)
 
@Luggage Nested? No.
 
crl
I know my code is horrible, was just trying to get the final results :/
 
is r a promise object?
 
6:18 PM
@crl can you explain, slowly, why at any point your code has double promises?
IOW Promise of List of Promises?
it shouldn't happen.
 
It's relatively rare to find cases where I completely agree with @BartekBanachewicz on anything
This is one of them @crl :P
 
Let it be known, this was the time Bartek was right.
 
@ssube You said that, not me.
 
Nested promises mean you did something else wrong, not spreading when you should have.
 
6:20 PM
@SterlingArcher i now catch what youre saying i need to change the users home directory
 
crl
@BartekBanachewicz I don't know..
var promisesToExecute = [];
for(var i=0;i<10;i++)
	if(Math.random()<.5) // your condition
		promisesToExecute.push(fetch('http://httpbin.org/get?lol='+i));

Promise.all(promisesToExecute)
	.then(rs=> rs.map(r=>r.json()))
	.then(rs=> rs.map(r=>{
		return r.then(s=>s.args.lol)
	}))
 
Did you guys know that you could cd ~someOtherUser to go to their home directory?
 
crl
help me make that code be better
 
can I mock fetch somehow
 
6:22 PM
@crl OK
 
oops
 
Promise.all(promisesToExecute)
	.map(result => result.json())
	.map(json => json.args.lol)
	.then(arrayOfLols => /* whatever */);
If I read your code correctly.
That's with bluebird promises ^
 
m59
Is there a sweet es6 way of doing:
foo.apply(null, arguments) // but with arguments[0] shifted off
 
crl
@MadaraUchiha I'd like to run it on Chrome :)
 
@m59 nope
 
6:24 PM
@m59 Yes, foo(...arguments)
 
there is a proposal for that, though
 
Ah, not with the arguments shifted off, no.
Wait @crl does r.json() return a promise?
 
this is what I meant by composing. I'm not sure if it matches what you say is an anti-pattern or not: gist.github.com/luggage66/19c17f83617b908c6268
 
@Luggage That's fine
 
6:26 PM
though soemtimes I nest the getSpecialData with the intent to refactor. Sorry. :(
 
crl
@MadaraUchiha yes
 
m59
bar.apply(null, [].slice.call(arguments, 1)); // best way, then?
 
Aha
@crl Your goal is to always return either a promise or a value
So what you could do is this:
 
m59
oh doh
I need it replaced =D
 
@MadaraUchiha this is retarded beyond reason
 
6:28 PM
Promise.all(promisesToExecute)
	.then(rs=> Promise.all(rs.map(r=>r.json()))) // Single promise!
	.then(jsons => jsons.map(json=>json.args.lol))
 
@MadaraUchiha that's meh
 
@BartekBanachewicz Depends on what .json() does
 
crl
oh smart
 
it requires all jsons to finish before it goes to further processing
 
6:28 PM
If .json() is merely a proxy to JSON.parse()
 
so it's a sync point
 
Then it should not be async
@BartekBanachewicz True
@BartekBanachewicz But to change that, you'd have to change the way you call your promises
i.e.
for(var i=0;i<10;i++)
	if(Math.random()<.5) // your condition
		promisesToExecute.push(fetch('http://httpbin.org/get?lol='+i).then(rs => rs.json()).then(json => json.args.lol));
 
i.e. Promises need then that doesn't unpack the result
IOW bind
 
Which is also a perfectly valid option
 
not always
 
crl
6:31 PM
@MadaraUchiha @BartekBanachewicz thanks, finally!
 
why is there no bind on the promise interface.
 
m59
.apply(null, [newItem].concat([].slice.call(arguments, 1)));
@ssube proposal to make that nicer? ^ what is it?
 
@BartekBanachewicz vOv
It's there on bluebird
But it's usually abused.
 
Hi Guys, I need help with XMLHttpRequest cannot load shirish.productions/rarerabbit/subscribe/php/signup.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.rarerabbit.in' is therefore not allowed access. Error can you help me? I am using Shopify
 
@ShirishSC Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
6:32 PM
@MadaraUchiha that's not the reason to not have it o.O
 
@BartekBanachewicz No it isn't.
@BenjaminGruenbaum is more involved in the spec process than I am
You may want to ask him
@ShirishSC Do you know what CORS (Cross-Origin Resource Sharing) is?
 
Well I am not a developer
 
> Promise.all(...).then(...).resolve is not a function
now what
 
But all bouncers
 
Well, the browser has a security feature that prevents a site from requesting resources from other servers
 
6:33 PM
@m59 not exactly that, since it's not a common use case, but apply(array.head(), array.rest())
 
it's right there on MDN
there's a function called resolve
why doesn't it work. why isn't it there.
 
So unless the remote server specifically allows for resource sharing (using the Access-Control-Allow-Origin HTTP header), the browser will block the request.
 
> The Promise.resolve(value) method returns a Promise object that is resolved with the given value. If the value is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the value.
 
I want to send Name and Email to signup link.
 
it's exactly what's needed here
 
6:35 PM
@BartekBanachewicz It's a "static method", it's not on the promise prototype.
 
I have control on Remote server
How can I solve it?
 
Promise.resolve(foo) works fine, fetch('foo').resolve() -> not a function
@ShirishSC You will need to configure your web server to send the appropriate headers
Google "enable CORS on <web server here>" to get information
web server can be apache, nginx, etc
 
Well I am using Shopify so I am not sure how to do it
Is there a way to do it using JS?
 
@MadaraUchiha k
@MadaraUchiha so it's like completely useless?
 
6:37 PM
@BartekBanachewicz It's usually there to start the promise chain from sync values
 
so that's just Haskell's return
 
I don't know Haskell's return so I'll just politely nod.
 
class Monad m where
  (>>=) :: m a -> (a -> m b) -> m b
  (>>) :: m a -> m b -> m b
  return :: a -> m a
 
> why don't I just import all libraries and work? If I don't need one, it doesn't matter!
._____.
 
@BartekBanachewicz Hardly. It's used to make a method appear always asynchronous, despite whether it is or not.
Take a method that might hit a local cache or might make an HTTP request. If the cache is primed, you return an already-resolved promise (Promise.resolve(data)). If not, you make the request and return a promise that will resolve later.
 
6:40 PM
@ssube so it's just Promise.resolve = value => new Promise(function(resolve, reject) { resolve(value); });?
 
so, return
 
It's the promise equivalent of returning an empty array instead of null to have a consistent return type.
 
Hi. When I configure my grunt file this way, the live reload script is injected, but any call to the live reload is aborted... #grunt-contrib-connect
 
Think of importing libraries like loading cargo onto a ship. Every piece of cargo weighs the ship down and slows it down by that much. Eventually, you have all this cargo that didn't need to be shipped and your ship is moving at half the speed and using twice the fuel to haul it all. — Sterling Archer 2 mins ago
Strong analogy?
 
@SterlingArcher except the cargo is also the crew
 
6:44 PM
so essentially the problem with JS promises is that if I have a Promise x, and a function taking x and returning y, I'm gonna get Promise y just fine
but that's just fmap
what I need is a function taking Promise x and a function taking x and returning Promise y, which then returns Promise y
IOW JS Promises are only functors, but not Monads.
 
@BartekBanachewicz x.then(y)
 
buh, my regex is adding a weird comma
 
Hooray, JS avoided the insanity of monads.
 
m59
Can someone name this? http://pastebin.com/6X1hKjv5
It takes an array/function/object in whatever way to present them and returns an object. Functions should return objects are are passed whatever params came into the original function (minus the first one for obvious reason)
 
@JanDvorak that's not it
 
6:45 PM
@BartekBanachewicz Can't you return promises within promises? Eg:
 
Promise.bind = function (f) { this.then(f) }; or dunno because it's complicated
 
p.then(() => {
  return x.then(() => {
    return y;
  });
})
 
crl
no, doesn't work like that
 
@corvid no.
 
Then I have been doing something terribly wrong. Why does it work for me?
 
6:47 PM
@corvid it's just fucking CPS
you've reimplemented CPS with promises
 
CPS?
 
monads ~ CPS
 
@JanDvorak sure.
but they don't make you nest things unnecessarily
do notation is what makes monads useful
 
That's what do does, not bind
 
do is implemented in terms of bind, duh.
JS promises don't have binds.
3 mins ago, by Bartek Banachewicz
IOW JS Promises are only functors, but not Monads.
no monads, no do notation.
sorry.
 
6:48 PM
How come then.call isn't bind?
 
@JanDvorak because it won't unwrap the promise in the middle?
then is fmap.
 
const temp1 = ['1/2x', '1', undefined, '2', undefined];
new RegExp(`^${_.max(temp1.slice(1,3))}\/${_.max(temp1.slice(3,5))}$`);
 
are you looking at Bluebird promises, or at jQuery promises?
 
is there anything wrong with this?
 
@corvid It's not very readable
 
6:50 PM
@JanDvorak I think someone called them native promises or something
@corvid it's unreadable.
I guess those bluebird promises thing will be sane if Benjamin is actively overlooking it
 
@BartekBanachewicz ah, these. They should be compatible with bluebird as far as then is concerned, I guess.
 
yeah but then is less useful than bind
You can implement then with bind but you can't implement bind with then.
 
cc @Loktar
 
Still not sure what you mean by "it won't unwrap the promise in the middle"
 
@JanDvorak you're familiar with haskell monads right?
 
6:53 PM
Sure
 
instance  Monad Maybe  where
    (Just x) >>= k      = k x
    Nothing  >>= _      = Nothing

    (>>) = (*>)

    return              = Just
look at how the pattern matching on Just x uses unwrapped x
 
bind :: m a -> (a -> m b) -> m b
 
by analogy, in promises, the x would be a synchronous value that is fed to the next function
you need to wait until the first promise ends, obtain the value, then feed it to the function accepting the value and returning the 2nd promise
 
resolvedX.then(x=>Promise.resolve(f(x)) #=> resolvedY
 
tee hee
 
6:56 PM
@JanDvorak except Promise.resolve apparently doesn't do what you think it does here.
 
by Promise.resolve I mean a function that gives me a resolved promise
 
you're still taking f as pure function
 
I was more or less forcibly coaxed to getting my first flu shot since i was a kid
 
@JanDvorak oh yeah well that function doesn't exist. There's Promise.resolve on MDN but that one is just return.
 
6:57 PM
@SterlingArcher I'm sorry, you are autistic now.
 
I do mean a return
 
that's not enough if f returns a promise
Promise.resolve() called on a promise returns a promise
 
ohh reddit. how I love thee.
 
but then already turns the value into a promise
 
6:58 PM
so you end up with a Promise of a Promise either way
 
well, then, IO (IO a) already kinda gives you a bad day in Haskell
 
!!afk coffee + vape
 
Are you looking for a join?
 
@JanDvorak Haskell has join.
 
@BartekBanachewicz It returns a promise wrapping a promise, which you're pretty explicitly not supposed to do.
 
6:58 PM
@rlemon dammit
 
@JanDvorak join could do it but I'd rather have bind
 
function join(ppx) {return Promise(function(resolve){ppx.then(resolve)})
@BartekBanachewicz then is bind
 
@JanDvorak NO IT'S NOT
herp derp.
 

« first day (1824 days earlier)      last day (3121 days later) »