« first day (944 days earlier)      last day (4005 days later) » 

10:01 PM
@FizzyTea Thanks for the right answer
 
@FizzyTea @copy for(i=12;--i;print())for(j=10;--j;)putstr(i%j%2) has some similarities.
 
Hi guys, I watched some video about 'let' etc tried to do some play with it, but it gives me an error. Does only work on some certain browsers?
 
@user2015338 works only in firefox
 
m59
regex: \s and \s? seem to be doing the same....is it normal for whitespace to be optional like that?
 
Braces should only appear on the right if () {, not on the left
 
10:11 PM
Let is not a part of the specification yet, it's only a part of the suggestions that are in the draft of the next JS specification
 
@m59 Where do you see a space?
 
m59
Isn't \s whitespace?
 
@Benjamin, Ah OK thanks
 
Ah, I thought you meant a literal whitespace.
 
m59
I want it to be optional, but it seems to be that way already. Without specifically adding the ? I was expecting it to require whitespace.
 
10:12 PM
@m59 They don't do the same thing.
 
@m59 Well the second one just means it matches a whitespace character zero or one times.
 
!!> /\w\s\w/.test('ab')
 
@Zirak false
 
m59
hmm
 
!!> /\w\s?\w/.test('ab')
 
10:14 PM
@OctavianDamiean true
 
m59
Yes, that is what I expect. man I suck at regex. I'm must has missed something else.
 
!!> /\w\s?\w/.test('a b')
 
@OctavianDamiean true
 
@Zirak IS this the Node version?
 
No
 
10:19 PM
huh?
 
I just thought he was re-writing SOChatBot into Node, and just renamed it in the process
 
What this?
Oh.
 
m59
^\s*function[ ]?\(.*\)\s*\{.+\}\s*$
I see:
From the start
any amount of whitespace
followed by "function"
optional single space
(
any character, any amount
)
any amount of optional whitespace (This part works without the asterisk!!!?)
{
more than one of any character
}
any amount of optional whitespace
end
 
^\s*function[ ]?\(.*\)\s*\{.+\}\s*$
Reposted it as actual code.
 
m59
Yeah, my bad.
 
10:22 PM
Think it was you that plays LoL :P
 
m59
I play, I like Draven.
 
@m59 Eh, what's [ ]? supposed to mean?
 
m59
Ashe and Draven are my favorites, but I get carried away on Draven.
 
but you know, playing vs AI is like jerking off next to your girlfriend...
2
 
m59
10:24 PM
@OctavianDamiean optional single space
probably all wrong
 
m59
that would match line breaks and stuff though
 
@m59 Sites like refiddle.com and debuggex.com usually help me debug my more complex regexps
And what's wrong with ` ?` (a space, followed by a question mark)? no need for a character class
 
m59
ah ok
 
Also, I don't see the problem
Removed the star after the \s between parens:
!!> /^\s*function[ ]?\(.*\)\s\{.+\}\s*$/.test('function (){}')
 
10:26 PM
@Zirak false
 
@m59 \u0020?
 
oh, because it wouldn't match anyway
 
That's what you'll want then.
 
m59
hmm I was using regex pal, but I can't figure out refiddle.
 
I think.
 
10:27 PM
@OctavianDamiean How about the fucking space character
That giant key, between the Alts?
 
@Zirak Mhmm.
Too easy. Doesn't look all codey.
 
m59
lol
 
Just wondering if that's the correct character. :P
 
Anyway, your regexp doesn't accept nothing between the curly braces (if that's acceptable), and it works fine (removed star):
!!> /^\s*function ?\(.*\)\s\{.+\}\s*$/.test('function (){abc}')
 
@Zirak false
 
10:29 PM
!!> /\w\u0020\w/.test('a b')
 
@OctavianDamiean false
 
What's it meant to match?
 
No space between ){, and the regexp commands it. Again, I don't see the problem.
 
@OctavianDamiean true
 
not sure why [ ]? was used instead of \s?
 
10:29 PM
It was the right one, cool.
 
m59
But
\s should require the whitespace
 
@Shmiddty He wants only space not all other whitespace characters as well.
 
m59
yet it is making it optional
 
\s isn't optional
 
m59
maybe this tester is bugged.
Trying to figure out refiddle.
 
10:32 PM
"Figure out"?
But the pattern at the top, text at the bottom
 
Damn that refiddle page has a nice layout
Wish I could css like that
 
@XCritics Take a look at their CSS and learn from it.
 
Did
 
debuggex is quite awesome
 
Yea, I like it more than refiddle.
 
10:37 PM
Holy god wish the women would get here so we can leave, I'm soooo hunngreehhh
 
This is a great article about regexps: perl.plover.com/Regex/article.html
 
Yay, DFAs
Oh, they don't call them DFAs :/
 
Reference for regexes ^
And it calls them DFAs :)
 
Yeah, I linked to that several times myself here :)
 
m59
10:41 PM
@Zirak dubuggex worked fine. Refiddle wouldn't do anything. It turns out it was a bug in the tester I was using.
 
@FlorianMargaine This is the site for regexps. Great stuff.
 
@Samson what about it?
 
something s fishy here.. sometimes I don t get all the data from redis
I suspect I m not using the promise library as I should
because I m doing something async in a loop inside
what do you think
it s inside an express module
 
I assume these are q promises?
 
yep
 
m59
10:42 PM
Now I just need to figure out how to say

match any character including whitespace, but require one non-whitespace character
 
so basic question is, how do I do something async in a loop and wait for it all to finish? because that s wrong I guess
 
I could never really get into the Sam text editor unfortunately, because it has the best implementation of regexps ever.
 
@Samson yeah, I was wondering why you didn't wait for the loop to finish
 
how? :)
when to resolve the promise
/
 
@Samson count the requests
 
10:44 PM
@Samson well, it's called an asynchronous semaphore, I use github.com/caolan/async but you can implement it easily yourself
@Samson just like @phenomnomnominal said, the easiest way is indeed a counter. and only resolve the promise once the counter reaches 0
@Samson honestly though? async is very widely used and very useful, you'd just end up implementing what they're already doing. I think Q might have its own solution for this sort of thing but I've used the two together before without issues
 
you mean this would do?
ok, I ll take a look there anyway
 
Yeah, async semaphores are really handy. Here's what I use:
        var sem = function(f){
            var busy = 0;
            return function(amount){
                busy += amount;
                if(busy === 0){
                    f();
                }
            };
        };
 
@Samson no, it won't.
@Samson that would fire on the first callback never.
 
Edit, you bastard!
 
@Samson you want to have a 'resolved' counter, and increase it by one each time a callback fires, then check it against the length or something
 
10:47 PM
ah right:)
got it
 
@Samson you can also use Q.all , it's a part of Q
Q.all takes an array of promises and resolves when they're all resolved and rejects when at least one rejects.
 
You can wrap the database callback for each index in a promise, and use that, that way you'd be doing it the "Q way"
 
but this should also work
 
Yeah, that looks like it should work
 
10:50 PM
ok, I ll learn the proper way of doing this now
:)
thanks a lot
 
Anytime :) We usually get pretty stupid questions here about jQuery plugins. Node questions and REDIS are always welcome
 
actually this is my first time using Q
 
It's the de-facto standard for promises
I use it all the time in my APIs, it's pretty nifty
 
I realised I needed something like that when I couldn t move the data fetching code outside the route :)
 
10:54 PM
Is it me, or was the useit.com website much easier to navigate?
 
@BYossarian 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.
 
o/
 
@Benjamin I see you online this late on a regular basis. How do you manage staying up late and actually going to work?
(Yeah, I know it's Saturday tomorrow)
 
@AmaanCheval I'm ninja coding right now
 
11:05 PM
The best kind
 
Our management is in the states in business meetings, my brother asked if I could ninja-code him a PoC for something and I said sure
 
Ah, that makes sense
 
Also, I'm doing a big project in CoffeeScript right now, mainly to feel more comfy with it
 
@BenjaminGruenbaum can you help me out adapt that .all to my code?
do I still need to keep the base promise?
 
Yeah, saw you telling Craig that
Weird to refer to @phenomnomnomenal as Craig
 
11:08 PM
haha
 
@Samson each _client.get would be a part of a promise, then you'd return Q.all on the array of those promises, that would be your promise
 
@BenjaminGruenbaum, how are you finding it?
 
Aww, I got the spelling wrong
Well, technically, you did :p
 
@phenomnomnominal it's nice, there is really not that big of a difference. I don't like comprehensions very much but syntactically it's cleaner which is very nice.
 
@BenjaminGruenbaum, that's what i've been telling people! It's just JavaScript
It outputs pretty much the same code that i would write myself
 
11:10 PM
It's very helpful when doing classes too, I don't usually need classes but when I'm modeling stuff from JSON it's useful.
All the -> and => and @ are nice syntactic sugar, and omitting the () is also nice.
 
Now that you're getting into it, do you find you're being more productive?
 
Other than that the existential operator is nice, and the silly stuff like off is nice
I'm being about as productive, I'm having fun with it, I'm still not 100% sure I trust it very much.
Splats are also very nice btw
Also, not having to return stuff
 
splats are good, splice operators, destructuring assignments
yeah automatic returns are great
 
splice operators are also nice, it's nice syntactic sugar :)
 
took me a while to get used to it, all my functions ended with just return for a while haha
 
11:13 PM
What's destructing statements?
 
[first, second, third] = [1, 2, 3]
 
Oh, I thought they had another name, but sure that's nice
 
@BenjaminGruenbaum You're not the only one: github.com/michaelficarra/CoffeeScriptRedux
 
You can also do stuff like arr[3..5] = [1,2,3] iirc
 
11:15 PM
A lot of that is already in Spidermonkey.
 
and with objects
 
Hai, I iz in ur jekyll, fixing ur docs.
 
inRange = 0 < x < 10
I love that
 
@BenjaminGruenbaum something like: gist.github.com/samsonradu/ddfeaae431469a2a3b6b
 
String interpolation
 
11:16 PM
I also use unless a lot, like unless predicate return , especially in the beginning of functions to reduce nesting
 
So many good things
Have you been using source maps?
I still find it easier to think and debug in JS
 
Not a single deal maker/breaker though
 
I wonder what version the bot is using.
 
@copy @FizzyTea for(j=11;--j-1;)putstr(5%j%2) matches the first line.
 
@FizzyTea What version of what?
 
11:18 PM
It's nice, but I think it still has more downsides than upsides
 
@OctavianDamiean Spidermonkey
 
Mainly, the fact it's impossible to use in team projects when working with other developers who are not the 'learning kind' if you know what I mean
 
I think I m missing something.. _client.get is not a promise itself
 
@Shmiddty I think you're onto something.
 
m59
Am I doing it very wrong if I eval a script from ajax (it comes in as text). I am assuming that is what jQuery does anyway...
 
11:19 PM
@Samson map the data to an array of functions (_get methods), then to a list of promises, then just return Q.all on that list
@m59 Yes, sanitize it first
 
m59
via, what?
 
JSON.parse
 
@BenjaminGruenbaum, yeah for sure, but for personal projects it's good fun
 
!!> [1,2,3].map(x=>x*x);
 
It's worth learning for sure :)
 
11:20 PM
@FizzyTea "SyntaxError: syntax error"
 
@FizzyTea not yet my friend, not yet
 
:-(
 
Soon, in harmony
 
It's in FF nightlies.
 
are they any built in functions for rotating images in a browser from its central point ?
 
11:20 PM
@phenomnomnominal maybe we should ask for coffeescript support on the bot, shouldn't be too hard
 
@BenjaminGruenbaum, good idea
just have to import the compiler into the worker script
!! > -coffee blah blah
 
Probably have a different worker script just for that
 
@phenomnomnominal "SyntaxError: missing ; before statement"
 
Maybe use !!!> (an extra !)
 
11:21 PM
@phenomnomnominal Y U NO MAEK SENSE!? Could not understand c (perhaps you meant to execute a command? If so, prepend the command name with a /)
 
!!> navigator.appVersion
 
@OctavianDamiean "undefined"
 
does navigator exist in a worker?
!!> Object.keys(navigator);
 
@phenomnomnominal []
 
m59
@BenjaminGruenbaum as you may expect, I don't follow. The script I am getting is not even valid js on its on. I did run a regex on it to make sure it is in a format I expect.
 
11:23 PM
Mhmm, interesting, it should have access to navigator
 
m59
@BenjaminGruenbaum every time this runs, I will get something like this
function($scope, $http) {
 //etc
}
 
!!> [x*x for (x of [1,2,3])]
 
@FizzyTea [1,4,9]
 
oh nice
 
11:23 PM
:-)
 
!!> self.navigator.appVersion
 
@OctavianDamiean "undefined"
 
Yeah, it runs on firefox now iirc
!!> let x=5;x;
 
@BenjaminGruenbaum "SyntaxError: missing ; before statement"
 
Can't do that in golf however.
You're stuck with ...
!!> [x*x for each (x in [1,2,3])]
 
11:24 PM
golf is using spidermonkey-bin-7.0.1-2
 
@FizzyTea "SyntaxError: missing ( after for"
 
!!> function f(){ yield 1;})()
 
@BenjaminGruenbaum "SyntaxError: missing ; before statement"
 
Strange.
 
@FizzyTea 000011000 doesn't seem to fit the N%j%2 pattern
 
@BenjaminGruenbaum yeah that
 
Wat? Wait a minute, self and navigator should be available.
 
!!> console.log(self)
 
11:28 PM
@OctavianDamiean [object WorkerErrorEvent]
 
!!>511^16
 
@Shmiddty 503
@Shmiddty 496
 
@Shmiddty 495
 
!!>501^487
 
11:32 PM
@Shmiddty 18
 
I must have some sort of brain damage. For some reason this construct doesn't make any sense to me right now. o_O github.com/Zirak/SO-ChatBot/blob/master/source/…
He's iterating over the global and global.__proto__ objects.
Then for each of those, he iterates of its properties.
 
right
he is filtering the properties
 
Then he checks if the property is not in the whitey array and deletes it form the current object if it isn't?
 
iterating over the properties of global won't iterate over inherited properties/methods
 
11:35 PM
Alright, then I got it right. :P
 
thus, the second iteration over __proto__
 
Yea, no that's clear. I wasn't quite sure if I got the check right.
Mainly because if that's right, I don't understand why self and navigator are not available.
 
ah shit
I gotta run
 
I like my women how I like my coffee. Without a penis
 
11:48 PM
Missed my train. >.<
 
Cool, help me figure out why self and navigator are not available in Zirak's WebWorker. :P
 
Not gonna browse code on my phone
 
DO IT!
I must have misunderstood something in that part I was discussing earlier.
 
Hey People, How you doing?
@OctavianDamiean Alright Mate :)
 

« first day (944 days earlier)      last day (4005 days later) »