« first day (1301 days earlier)      last day (3653 days later) » 

12:00 AM
I don't trust the grinner
 
ugh, I hate state. Separating the bot into two, but now comes the question of how are bans handled...
 
Still not sold on splitting it
 
If you've got a better solution to how the bot can /live without executing any command logic, I'm all ears
 
@Tarryn 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.
 
Actually...ban state can just reside on Zoe, and Fran will do the checks himself. He needs to have access to Zoe anyway to trigger her on and off.
 
12:04 AM
Viva la Zoe!
 
It does complicate /help, but that's easier to solve
And I told myself I'd go to bed early...
Fuck me, bye
 
I know right? just left (that's the part of the story when my brain is melted and I go to sleep)
 
12:16 AM
@LászlóMonda 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.
 
 
1 hour later…
1:25 AM
@Mosho What TV series should copy and I watch next?
 
@BadgerGirl Blue Mountain State
Funniest tv series I've ever seen
 
@monners Okay, we will watch that. :)
Thanks
 
be warned, it's a little extreme
 
Is it gay?
 
m59
!!> var arr = []; arr.foo = 'foo value'; console.log(arr);
 
1:30 AM
@m59 "undefined" Logged: []
 
m59
lies?
 
This is not php
 
m59
@BadgerGirl ^ lol
I know, it's still funny :)
I never thought too deeply what would happen if you used an array as an object, since it is one...
kinda trippy
 
@BadgerGirl lol, no. It's basically a very funny parody of college jock culture.
So I guess it's a little gay
 
2:05 AM
ok newbie question..feel so stupid for asking, but why do I get "undefined" in the console after typing var age = 20?
didn't i just define the variable?
 
m59
That's the return value... you aren't doing anything which would return something
If that didn't make sense, think of it like this:
function() {
  var age = 20;
}
the return value of that function is "undefined"
 
so how would i define it?
by console.log?
 
m59
define what? @redshift
 
thikning how to ask
 
@MisbahKhan 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.
 
m59
2:11 AM
I understand what you're confused about, but it's not really an issue, you just think it is :)
 
ok thanks:)
 
m59
var age = 20; (this doesn't return anything...)
then
console.log(age)
that also doesn't return anything
but it will log age as 20
 
does 'return' basically store info in memory?
 
m59
mm....I don't know what you're trying to say.
 
lol
 
m59
2:13 AM
Put this in your console
function foo() {
  return 'foo!';
}
then
foo();
that returns something (as you can see lol)
 
@m59 The voices are inside your mind!
 
m59
@redshift to put it another way, the console is automatically logging the return value of the function you're calling - but the functions you're calling don't have return values
or you aren't calling a function at all, so you really don't have one :)
the "undefined" is kinda meaningless
 
@redshift Put this in your console: var age = 20; age;
 
m59
Oh yeah, tru dat
 
ok
 
2:15 AM
Then you're giving something for the console to return
then try just typing a space and hitting return. you'll get undefined because whitespace doesn't matter, so the console has nothing to return (ergo, undefined)
 
unless i call something like age; or foo(); I will get an 'undefined' ?
 
Calling foo() will give you whatever that function returns
 
m59
make it simple, if it can feasibly give you a value, it will
 
!!> function foo () { return 'I am not a crook'; }; foo();
 
@monners "I am not a crook"
 
2:17 AM
got it
 
Schweet
Isn't JavaScript...
!!epic
 
lol
 
@m59 you're a room owner, right?
 
m59
yeah
 
Is there a rep minimum or something for moving messages to trash?
 
m59
2:19 AM
1 message moved to Trash can
dunno :) Is that what you had in mind?
 
Yep
So you're just clicking on the arrow to the left of the message and there's an option there?
 
m59
heh, not that I mind a gif, but it is hilarious how one gif puts my cpu usage at 60%
old lame laptop ftw
 
@PengfeiLiu 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.
 
m59
@monners no, I go to "room" on the right, above the pictures
at the bottom of the list is an option "move messages"
 
Oh! So I do have that power
Good good
1 message moved to Trash can
Mwa ha ha ha haaaaa
 
m59
2:23 AM
heheh
 
what the hell does Create new bookmark do?
I don't wanna touch it lest I break the entire interwebz
 
m59
dunno =D
gotta go, peace!
 
@monners It makes these.
 
2:50 AM
@KumarAbinash 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.
 
3:00 AM
@BadgerGirl silicon valley
don't know what you like though
or why you are asking me, for that matter
@m59 o/
 
can anyone tell me, how to POST something via javascript to a php page?
I know how to do an ajax request, but i want the results returned to the browser.
 
has anyone ever worked with google+ api
 
3:24 AM
@BlueJ774 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.
 
3:46 AM
@KendallFrey I don't understand
 
4:03 AM
@KendallFrey Wait, you're Canadian?!?
To think, this whole time I've been thinking of you as an actual person...
 
@KendallFrey @KendallFrey I think you owe @monners an apology
 
^^
@copy, how'd you enjoy Blue Mountain State?
 
We're about to enjoy it
 
Ah
Enjoy!
 
Hi
 
4:15 AM
But first Glee
I should lock my laptop some times
 
4:39 AM
lol glee
 
lol
\o/
\o\
/o/
\o/
Adding that one to my gif library
 
on that note, do NOT google "vomit gif squirt".
I really didn't think that one through
 
@Mosho LOL
 
4:56 AM
@Mosho you forgot to unonebox that, BTW. May I trash it?
 
@EpicDavi 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.
 
5:10 AM
@JanDvorak I thought about it and decided it wasn't that offensive
considering lemon posted a cat anus earlier
 
He did unonebox it, though
 
right :P
 
@Kernelzero 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.
 
5:13 AM
this is seoul, south korea.
 
How is the living there?
Who knows? We don't question language design decisions here. — Jan Dvorak 9 secs ago
 
@user1833028 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.
 
5:28 AM
@SomeKittensUx2666 Testify!
 
5:41 AM
pob ?
@JanDvorak he could have made things easy to assign properties to a function and use it to act as enums ...
 
primarily opinion based
 
* last year, more then 18 000 people are murdered in Mexico * Drugs aint rock'n roll
 
@JanDvorak that's your opinion. heh
 
@monners do you disagree? Why?
 
I don't know why I'm in such a silly mood. I'm not drunk or anything.
@JanDvorak Nah, I was just being silly
 
5:47 AM
Oh. Makes sense, then :-)
 
had to leave my bed at 5am because there were electric problems and nobody of the responsible tech team is available. Apparently my name & phone nr is on the list too, while i'm just a developer.
so give me the sillyness
 
!!tell monners youtube RATM testify
 
^-- le belgium
 
5:58 AM
Global variables are strange
var array = [1,2,3];
delete window.array;
console.log(window.array); // [1, 2, 3]
 
the magic of undeletable variables :-)
 
(only in non strict mode)
 
to preserve your sanity, please stay away from delete :-)
 
i clear arrays by creating a new one.
 
@JanDvorak yes, because sometimes a global variable is a property of window, sometimes not
 
5:59 AM
@SomeKittensUx2666 Yeah yeah yeah, we've all played guitar hero
 
@dystroy it always is in browser environment
 
@KarelG That wasn't a real use case, just a morning puzzlement
 
@monners That was in Guitar Hero?
 
but depending on how you declare it it's or it's not marked as undeleteable.
 
@SomeKittensUx2666 Yeah, or Rock Band, one of em
 
6:00 AM
@JanDvorak yes
 
@dystroy morning puzzlement ? eh. i'm going to home. the problems are solved (i think) ... bb
 
The plastic guitar mafia actually had some pretty awesome artists in there
 
the real fun is that var statements inside eval produce deleteable local variables.
 
In a RESTful interface, what's the proper status code for "Expected XHR, didn't get it". 400 seems kinda generic
 
Drinking my coffee and having a look at an old answer that was upvoted... and that I just realized was wrong as one of the suggestion I had made was to use delete window.array
 
6:02 AM
@monners Only played GH3 and RB1 extensively.
 
@SomeKittensUx2666 was probably RB3
I played RB2, RB3, GH3 extensively
Then I learnt how to play the real guitar
then I forgot
:(
 
Pfff... One can get 1568 upvotes for a bad wrong answer...
1789
Q: var functionName = function() {} vs function functionName() {}

RichardI've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent. The previous developer uses two ways of declaring functions and I can't work out if there is a reason behind it or not. The two way...

 
import is a reserved word?
TIL
 
@dystroy well, almost
 
@dystroy You do a lot of SQL in node, right?
 
6:17 AM
@benJima 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.
 
@SomeKittensUx2666 I don't do a lot of node. I just have a few applications, most of them being out of my day job scope
 
Can you point me to how you format long queries? I'm curious as to how you do it
 
what do you mean ? code formatting best practice ?
 
I end up with either a bunch of concatenated lines or one uber-long line
 
warning : the author of this comment has currently a coffee deficiency and might say stupid things until the third coffee starts to have effects
@SomeKittensUx2666 It's already hard to format JS properly, I don't have good solutions to you (assuming you don't want a stupid framework hiding the beauty of SQL). Here's an example from miaou : github.com/Canop/miaou/blob/master/libs/db.js#L195
 
6:20 AM
ok, so you go the concatenation route
 
yes
In some non nodejs programs I have big queries, it's no cleaner than in JS
 
Finally found the one thing that's easier in PHP
 
in PHP it's also easier, most of the time, to avoid the callback hell of js asynchronous querying
 
Florian showed me a pretty nice way to handle that with Bluebird
 
@SomeKittensUx2666 well.... he probably directed you to my code or blog, didn't he ?
 
@dystroy they say "callback hell", but I like the ability to create two concurrent deferreds and resolve them in arbitrary order.
 
@JanDvorak hey, don't misread me, I say it's simpler and easier in PHP, and it is because you have one thread per query, I wouldn't do anything in PHP now !
@JanDvorak This being said, some languages like go make that much easier and cleaner.
 
The "one thread per query" model is nice, but it kinda breaks down if you want to connect two clients through the server
 
of course
php was cool for simple things, mostly rendering "static" pages by embedding sql results, it's obsolete now and was never pretty
 
Please review my SE API interface in my spam filter. How would that look in GO?
 
6:31 AM
that's a lot of work you're asking here ^^
 
@tom 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.
 
@dystroy specifically, I'm interested in the crossed deferreds for the backoff wait and for the call itself.
 
In your code I see a mix of onload callbacks and jquery deffered (which I decided not to learn). Are you asking how in go launch a few parallel sequences of asynchronous calls ?
 
That. Also, I use deferreds to form a queue / mutex. Is that possible to improve?
 
sorry, was summoned because of baby poop
@JanDvorak
In Go, to launch something parallel to the current "thread", you do

    go somefunction()

You may also use an anonymous function (and yes you have closures) :

    go func(){
       // some code
    }()

If you want the results to be handled sequentially by a unique "thread", you simply create a channel


   c := make(chan Task, 10) // Task being a user defined struct
   go func(){ // a goroutine handling the received tasks
      for {
          task := <- c
          // do thing with task
      }
 
6:50 AM
 
@JanDvorak I hadn't coded in go for a few months, so I might have made mistake but you have the idea
 
but, can I have the task return its results while still blocking the channel? (if I understand channels correctly)
 
I don't get your question
but the answer is probably yes...
 
The point of backoff is that I already have the result but I can't send another request for some time
 
a delay ?
In there :
for {
          task := <- c
          // do thing with task
      }
 
6:55 AM
I do that by not releasing the mutex I grab when the request method is called
 
in go, if you have a unique goroutine reading on a channel, there won't be other threads reading from that channel, so you don't need a mutex, this goroutine can simply do its task and when it's ready to read from the channel it can read again
channels make mutex mostly useless ("mostly" is exagerated)
 
oh. The task is just some data that the goroutine must have code to handle? How do I return the results back to the task source / wait for the routine to provide said data?
 
you can put the result in another channel
a := <- c
 
then how do I match up the requests with the results?
 
Let's be clear : you have a few parallel tasks and at some point they all want to call an asynchronous function which can't be parallelized (and get the result back). That's it ?
 
7:06 AM
sometimes I get the results, but I want to prevent other calls for some time
sometimes, I get partial results, but I want the function to call itself recursively before providing full results to the original caller
yep
 
Good morning
Sencha Touch question: Is it possible to use associated stores for a nested list?
I tried but it says: _"Unable to match the updated record that came back from the server."_ when select an object in the roots elements
But in think it's a problem in my association maybe
woot, problem with formatting? :O
 
@JanDvorak I'm not sure of the best solution, although there are many (as already said, my mind wasn't trained to go those past months). Here's how you might make functions be launched from many waiting goroutines without being parallelized and with a minimal delay between executions :
    waitingFunctions := make(chan func, 100)
    go fun() {
         for {
             f := <- waitingFunctions // blocks until there's something in the channel
             f()
             time.Sleep(30 * time.Second)
         }
    }()
in various goroutines you would just pass the function to the channel
waitingFunctions <- fun() { // do something }
 
I don't know in advance how long I have to wait, I get that data from the API call. I assume I'd have to return from f()?
 
hi friendz
 
I'm sure there is a better solution... I should do some go to get it back :\
 
7:18 AM
what this markdown pagedown code do??
// The original code uses a regular expression to find out how much of the
        // text *directly before* the selection already was a blockquote:

        /*
        if (chunk.before) {
        chunk.before = chunk.before.replace(/\n?$/, "\n");
        }
        chunk.before = chunk.before.replace(/(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*$)/,
        function (totalMatch) {
        chunk.startTag = totalMatch;
        return "";
        });
        */

        // This comes down to:
        // Go backwards as many lines a possible, such that each line
if i delete code editor still works
 
@JanDvorak if your function does an asynchronous call, it's naturally blocking
have to work and I feel like I'm making things complex because I don't understand your problem
 
so, f would be a blocking function that waits long enough? Then what is the 30 second delay for?
 
if i delete code above what i expect not to work on editor?
 
Do you really have to wait a delay or are you just waiting for an answer ?
 
@user3586251 define "works". Also, why are you deleting it?
@dystroy a REST API provides me the data I want, but it can also issue a request for me to wait for some time.
and it doesn't like me to issue more than one request in parallel
 
7:22 AM
@JanDvorak every button and quote work .. im try to find what not work .. im delete it because im need few function only and minify still output big file and my clientz are slow connection
im need more then squeeze for minify
 
I would assume something breaks if you start tearing stuff out
indeed, humans seem to function perfectly well after you remove one ear
 
@JanDvorak i think so to .. im try to find what breaks .. i think it was quote function but it still work .. im try to apply github.com/jed/140bytes/wiki/Byte-saving-techniques without delete function
minify still 20kb
 
@KazimZaidi 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.
 
@user3586251 does your page use jQuery?
 
@JanDvorak yes :-)
 
7:26 AM
remove those 90k first, then care about the 20k of markdown
 
im convert it to jquery then?
 
are those really 20 kilobits?
 
im already remove some function not need and from 80 kb its 76kb now ..
 
@user3586251 did you profile your page to see what's taking so long? Are you sure that's loading things? What's taking so long?
 
7:27 AM
@JanDvorak yes minified :-(
@FlorianMargaine yes .. but the connection our country is very very slow and my clientz come from our country most :-/
 
@user3586251 are those really 20 kilo_bits_ = 2.5 kB as opposed to 20 kilo_bytes_?
 
@BenjaminGruenbaum happy birthday!
17
 
@JanDvorak haha no they are kilo bytes
0,025mb exactly
 
@user3586251 then use capital B, please. I can forgive grammatical errors, but not neglecting to use the right units.
 
7:29 AM
@BenjaminGruenbaum thanks for having your birthday today. You reminded me that it's my father birthday, and my step sister birthday today.
 
@JanDvorak sorry dont had think about it :-(
 
@user3586251 0 point 025 milibits???
 
errr...0.025MB xD
corrected xD
 
capital M = mega-, lowercase m = mili-
 
@JanDvorak am go to read chart later because i need :-)
i feel ashamed but :-/
anyway im hope that for save some bytes i can make this for(var i = 0; i < lines.length; i++) to for (i = lines.length; --i;)
?
reverse loop
 
7:33 AM
depends on whether the loop minds reversing
also, the indexes will start and end one higher
 
@JanDvorak yep .. im try to find what breaks when i do it ...
even with i-- vs --i?
 
@user3586251 you still start one higher
 
err ... ok :-/
im think because im not assign 0 to i?
 
Is this also connected to some IRC room?
 
maybe then i can make lines.length to lines.length - 1
or lines.length--
or leave original xD
 
7:36 AM
still, jQuery is bigger than pagedown. Replace jQuery with some lightweight library, then start editing someone's code
@user3586251 everytime you do that, you strip one element off the original array
 
is the name of this has been change !
 
zepto? im not care for ie support
understood :-)
 
@user3586251 then var $ = document.querySelectorAll.bind(document)
 
that code is strip support from ie?
 
@user3586251 even IE8 supports querySelectorAll
 
7:39 AM
ah .. is better then jquery without ie support or zepto?
 
@user3586251 subjective
 
im just mean for file size :-)
 
not sure, but I guess Zepto is still smaller
 
i will look
still not understand why no body made jquery version of pagedown :-/
it will be smaller then pure javascript
 
not when its dependencies are counted
 
7:42 AM
jquery's dependencies you mean?
 
I mean, jQuery would be a dependency of pagedown
 
@FlorianMargaine you're welcome
 
Smartest thing jQuery did was provide a framework for plugins
 
Otherwise we would only be vaguely familiar with the polyfill library jQuery
 
7:44 AM
yes i understand but many people already have jquery loaded anyway
 
What's wrong with formatting today???? :O
**Sencha Touch question:**
I've got two models (Category-->Object) with associations
Here is the CategoryModel:

Ext.define("TouchApp.model.CategoryModel", {
extend: "Ext.data.Model",
config: {
fields: [
{
name: 'id',
type: 'int'
},
{
name: 'name',
type: 'String'
}
],
//Aide: http://docs.sencha.com/touch/2.2.1/#!/api/Ext.data.association.Association
associations: [
{ type: 'hasMany', model: 'ObjectsModel', primaryKey: 'id', foreignKey: 'category'}
]

}
});

And here is the ObjectsModel:

Ext.define("TouchApp.model.ObjectsModel", {
 
The internet is broken
Stop it, internet
 
haha look, I formatted my question but it doesn't work
 
I've noticed that ctrl + k really only works well when you only have code to format
 
yes
 
7:46 AM
You can't mix with non-code
 
you need to use a proper chat for mixed formatting
 
@dystroy Like Miaou ;)
 
Miaou... not Meow
So I retry
**Bold** also -doesn't- *work*!
Maybe when it's more than one line...
ok I understand...
 
bold does work here
 
7:52 AM
yes but not with two lines or more
 
@dystroy That was a bold move.
 
one line bold
two
lines **bold**
you see...
that's annoying
 
looks like a bug
 
need to be reported...
 
two
lines __bold__ **bold**
Oh yeah, I remember, markdown only works in single line mode.
 
7:54 AM
But I can attest this kind of formatting is very hard to do and you can't do everything because markdown is a language defined to be light, not complete
 
@SteamFire hah, like they're going to do anything about it
 
(but miaou still works with bold on multi-lines comments)
 
@GNi33 that's what I'm thinkin about
so, one shot two kills here is my question on Miaou
 
miaou is broken for me
 
do some promotion for miaou
broken?
 
7:59 AM
@GNi33 you have connection problems ?
 
did you see my message?
 
i have pagedown 8kb minfied now! :-)
 
@GNi33 when ?
 
right now, room 8
 
just use techniques from byte saving and bit of jquery
 

« first day (1301 days earlier)      last day (3653 days later) »