« first day (1775 days earlier)      last day (3398 days later) » 

08:03
Less characters does not mean more readable or comprehensible.
that's probably not the intention
Probably not, but it is great to reduce your code more and more. Then a few months later you have to read that code and think "What the fuck was I thinking?!". Something to consider at least.
user3119231
@choz one day, she (it) will answer your apologize :D
let pro_reverse = (
	S,
	i = X => X.charCodeAt(),
	a = String.fromCharCode
) => (S
	.replace(/[A-Z]/g, X => a(90 - i(X) + 65))
	.replace(/[a-z]/g, X => a(122 - i(X) + 97))
);
@choz
regex solves everything
cs.rit.edu/~atk/JavaScript/manuals/jsobj nice resource on objected oriented JS
08:14
@overexchange ES6 has class :P
This would help to understand atleast existing production code.
Like python, if JS has provided only class based inheritance then there would not be overhead in learning prototypical inheri. If class based inheritance has come as a new facility in ES6 then that means, people are yet to learn JS as new versions come in
@RoelvanUden ES6 came in 2015 beginning? that mean people who wrote code from past 5-6 years id not use class based inheritance.
I don't understand people who cling to their paradigms when switching languages. That kind of defies the point of learning a new language, no?
unless there are other aspects of the language that attracts them
the best languages are flexible enough to support any paradigm
08:31
Amidst learning new language features, learning supporting paradigms does not harm.
@overexchange there will still be differences to, let's say, Java
hey guys, can someone tell me what the following code does or what this pattern is called so i can read it up?
system = require('system'),
address, output, size;
(those kind of strange structures in js are hard to google ^^)
@GNi33 you mean like public/private facility unlike javascript?
afaik, the new class keyword is just syntactical sugar
you still have prototypal inheritence
I never learnt about class in JS.
08:42
@wullxz require() sounds like it's from either firefox extension code or node.js code
there will be no object oriented inheritance model in JS with ES6
i know what require() does. my problem is the other things behind the require() call
it just looks like it because of the new syntax, probably to appeal to Java/younameit - programmers that will bitch afterwards because stuff doesn't work the way they are used to it
because they don't know that it's still a prototypal system
@wullxz oh, uh… the other things don't appear to do anything
i don't know what methodcall(), arg1, arg2, ...; does
crl
crl
08:45
!!should .gitignore be added to git?
@wullxz system = require('system') does what you expect; the stuff following the comma does nothing
@Cauterite or RequireJs, some other package managers use it too probably
@crl I need to see, how moderatorresponds you?
@crl yeah
@crl Not at all
crl
crl
08:46
pfff
then why is it there? i guess a reasonable programmer has had some intend to write address,output,size after the method call
@wullxz what's the surrounding code?
@wullxz those are variable definitions
@GNi33 Do you use class based syntax in production code?
they are instantiated to undefined, that's all that does
08:47
right at the top
@overexchange no, I use prototypal inheritance
@wullxz you didn't mention the var
oops. sorry. musst've missed it when copying
oh lol. now i understand xD
thanks anyway ^^
right, so var X, Y, Z; declares each of the names as new variables, and optionally assigns them values if there are of the form A = B
08:49
yeh, i feel like a complete noob now
well it's not a pattern i use very often either, so don't feel too bad
well, i've even used that syntax myself in other languages. it's not even special to js. i guess i'm still half asleep. this is so embarrasing ^^
I don't like that the declarations are in one line there, makes it a little confusing
but that's all personal preference
@GNi33 Having an idea about prototypical inheritance is MUST before going for class based syntax in JS?
btw: do you guys know of a handy way to generate pdf files in nodejs? (preferrably from html or latex code)
yeh @GNi33, shame on the programmer who wrote such misleading code. not my fault i read it wrong xD
08:53
@overexchange I would say so, because if you start using extend in your classes, you'll build a prototype chain
hell, you should know about prototypal inheritance in general
every Object, String, ... has a prototype that you make use of
@wullxz hehe, well, I wouldn't go this far, but okay ;)
the JS prototype system isn't that complicated really; the most opaque part is probably the new operator
08:55
yeah. I like to use Object.create
not sure if I like the class syntax at all, I'd need to give the whole ES6 syntax a go some time
well, as a js newbie i can tell you that it's confusing to have so many ways to create instances of objects and also so many ways to alter objects and instances alike
@wullxz yes I agree
I can't remember the last time I actually 'defined' any classes in JS
i tend to just write functionally nowadays
writing functional code does not require JS training, if you know any similar lang like python, you can start writing
well, i'm used to create classes because i mainly programmed in c# or java. so i always feel the need to create reusable classes
08:58
it very much depends what kind of program you're writing
i'm usually writing userscripts or firefox addons — i.e. dirty hacks
i also saw several code-pieces that created objects on the fly which is also kinda confusing
(but sometimes handy)
@wullxz what?
on the fly? all objects are created 'on the fly' as far as i'm aware
dirty hacks are always the coolest
what does "on the fly" mean here?
09:00
i mean something like var obj = { name: "wullxz", age: 26}
ah, that's an 'object literal'
and then maybe some functions added to it
yeah, you use those all the time
object literals inherit directly from Object if you're wondering
that sneaky edit... :P
09:01
yep, i know that, although i'm not always aware of that fact ^^
my problem with those kind of things is, i always think: why not create a class that defines the needed functions and members and reuse it instead of creating (probably inconsistent) object literals everywhere?
are you a Java programmer? :D
@GNi33 I got this nice tuto for proto inheri cs.rit.edu/~atk/JavaScript/manuals/jsobj
I bet you are
yes
java, c#
haha
09:02
^^
classes, classes for everything!
yes! ^^
that's what I dislike about Java, it's so bulky
all hail the classes! ^^
it maybe is
that's actually a really nice thing about JS
09:03
Hey guys, can you tell me why is this so slow ? (jerky, kagaroos) jsfiddle.net/TCJT4/44
i like groovy, because it encourages lambdas a lot more and it is very concise
I need an object once, that has these properties?
In java I'd need a class and implement it as singleton
like a cross between javascript and java I suppose
yeah, i also like js for the fact that you can quickly start typing scripts away and don't have to think about class hierarchy as you'd have to in java
JS, I just write that Object Literal and I'm done
09:04
@wullxz same with python
@wullxz: classes define objects with data and associated behaviour; if your object doesn't represent something with behaviour, there's no need to define it as a class
@GNi33 god no, you can have a single instance without creating a singleton
jesus, I still need a class
why would I want to have a class for that?
on the other hand, it has been some time since I wrote my last lines of Java, so I better shut up about it
user3119231
yeah, true, it is still bulky for that
09:06
@Cauterite yes, i know. but i always think: what if i have a bunch of objects to create that all need to have the same members and loop over them somewhere else? if those objects are collected from multiple sources, the risk of creating incompatible object literals is high
@Maurize Hum, but why is it jerky ? Do you know a way to avoid it ?
in groovy you can do def map = { test: 'obj', anotherTest: 'obj2' } at least
user3119231
@Baldráni you know what requestanimation frame is doing?
Nup i'll go check
user3119231
09:07
@GNi33 yeah that would be more like wall street
user3119231
@Baldráni yep it executes this function every FRAME (best cases < 10 ms)
Programming without required classes? Blasphemy! JavaScript is the language of the devil!
  function( callback ){
    window.setTimeout(callback, 10000);
  };
anyone using node-inspector?
@Maurize So i need to change this ? But still it will stay jerky i guess dont you think ?
09:09
shit is running extremely slow
@overexchange let me look for a blog post that uses a particle emitter as example
emitter?
user3119231
@Baldráni it is up to this:
user3119231
 $(".slideContainer").animate({marginLeft:-currencyPairWidth},speed, 'linear', function(){
code reading required, but I think it explains it pretty good
09:11
ok
user3119231
@Baldráni working with frames isnt "laggy" working with timers and durations inside frames is.
sorry, I really haven't got the time now to read that one
i also stored that thing in my pocket to read it later ^^
09:13
@Maurize Do you think I shall give up with this function and head toward animate() ?
user3119231
@Baldráni I think you should use animation frames INSTEAD of timers. Because frames comes more smoothly bc.bm-designs.de
@GNi33 when you write a function constructor Manager, do you say obj = new Manager(); or obj = new Manager;?
@overexchange i don't think it makes a difference
obj = Object.create(Object.prototype) ;) .. whoops
doesn't make diff, Because JS is flexible?
09:16
@overexchange they mean exactly the same thing, syntactically
@Maurize Ok, I'll see what i get; ty for the advise
dammit, it's early. Manager should be the prototype of course
@GNi33 Object.create(Object.prototype) and Object.create({}) is the same, isn't it?
sort of
user3119231
@Baldráni let me give you another example for working with frames.
09:17
but you will want to set the Manager Object as prototype
@overexchange i usually opt for obj = Manager(), but I think the constructor has to explicitly support that
@Maurize With pleasure
explicitly support that?
user3119231
user3119231
And if anyone here thinks js is not powerful he shall click my link!
user3119231
09:19
:P
@overexchange i think it needs something like this = this || {} to make that work
!!> ({"proto" : null}).__proto__ === null
@Cauterite "SyntaxError: invalid property id"
@Cauterite false
!!> var x = {}; x.__proto__ = null; x.__proto__
@Cauterite "SyntaxError: let is a reserved identifier"
@Cauterite "undefined"
@GNi33 In this hierarchy, when I say mark = new WorkerBee(); first Employee constructor executes and then WorkerBee constructor executes. am I correct?
09:25
Hi, is there any library that convert object values. For ex. if I have {"age" : "18"} it has to return {"age":18} ?
@overexchange that's the way it should work anyway.. if your derived class uses some property of the base class and it hasn't been defined yet, it kinda throws a kink in your plans
@Sunrise But that's just guessing. Why would you want to do that?
Just because a string looks like a number, doesn't mean it is a number.
@Sunrise I think one has to override toString. anyways, am new to JS
obj = {"age":18}
   Object {age: 18}
obj.toString
    toString()
f = obj.toString
   toString()
@Neil Constructor and initialisation is same like java. am I correct?
let x = {"age" : "18"};
for (let n of Object.getOwnPropertyNames(x)) {
    x[n] = parseInt(x[n]);
};
@Sunrise
The OP isn't giving me the impression he wants his code reviewed. It looks like he wants people to look at his tool *cough*. — Cerbrus 57 secs ago
Couldn't resist xD
I need to grow up :)
09:33
@Cauterite why can't we rely on window['toString'] for such stuff. you can override it in a way you want
@overexchange maybe if the problem was a little more well-defined we'd be able to agree on a solution
@RoelvanUden I am creating Express.js app, and when user types /users/?age=18, server has to find all documents in MongoDB that satisfies that age is equal 18 myCollection.find(req.query), but the problem is that express.js converts all query values to strings but I need to have numeric values because mongoDB returns empty array otherwise. If I'd have only this age parameter, I'll simply convert it and that's all, but there can be at least six params, and I'll have to convert part of them
so how do you know which ones to convert to numbers and which to leave as strings?
Hello o/
obj.toString = function(){
     return '{"age"' + ':' + parseInt(this['age'])+'}';
}
09:39
@overexchange JSON.stringify
Y U NO USE stringify!?
that's not really the problem
@overexchange not really, no
@Cauterite Nobody said it was
I was just pointing it out
09:42
@Cauterite it depend's only on params names. I thought that it'll be so easy to filter docs in MongoDB, just pass directly req.query and that's all
alright so let's say you've got your query string as a table:
// ?age=18&gender=male&id=56fa98fe
{age : "18", gender : "male", id : "56fa98fe"}
let's say we make this table of transformer functions:
Good morning
let TxfmrTbl = {
	age : x => parseInt(x),
	gender : x => x,
	id : x => parseInt(x, 16)
}
Or just validate your input...
Instead of passing the entire object to find
@Sunrise : you see where i'm going with this? do you need more explaination?
09:47
@Cauterite bad idea, in general.. compounds complexity and potentially creates a lot of wtf moments from bugs created from these types of problems
@Cauterite it's new ES6 syntax?
well what would you do @neil ?
@Cauterite well if possible, just pass the right types from the get-go.. no conversion
Can somebody answer this question on constructor and initialization?chat.stackoverflow.com/transcript/message/25320688#25320688
it's data from a URL query string
09:49
If you need obj.age as a number, Number(obj.age). And like @BenFortune said, don't pass the raw object to find
string being the keyword
@Cauterite so surround the strings with "" to make the distinction
and use a generic conversion, not one that works specifically with that table's fields
or better still, don't use url query strings
@ivarni He probably is, it still returns strings
No wait, he's using req.query
You should only ever pass what information you need. What happens when users start adding their own query parameters to the URL?
good point
09:53
Really, I did't think about this, then the best solution is to do validation. Thanks all for help.
jquery('#doormatNavigation a:not([href*="http://www.sample.com/"])').each(function (){

            jQuery(this).attr('href', "http://www.sample.com" + jQuery(this).attr('href'))

        });
how to put this one in a condition?
@FlorianMargaine What does that do?
@winresh24 Uh, what?
09:55
@BenFortune there is a comment with example usage
-2
Q: Pass the Device Time to Javascript in HTML Android App

IpadIs there a chance to provide the device time from Android (java) to my Javascript App? Without using an Datetime-Format just a plane Time. Without using a calendar?

if not equal sample.com is the output if equal different.com is the output
@FlorianMargaine Ah, didn't see that. Github's websockets seem to be a hit and miss
@MadaraUchiha
@BenFortune np
@BenFortune basically, a pastebin with your own vps, from the cli
with source highlighting too
and the putfile can let you put images
"add xclip support" means that the url of the file will then be in your clipboard
it's basically adding echo $line | xclip or something similar
09:57
@FlorianMargaine Awesome. I use ShareX for mine. Can create a snippet from clipboard data and upload to Gist or my dedi
anyone?
@winresh24 something like this? :
for (let E of document.querySelector("#doormatNavigation a")) {
	if (E.getAttribute("href") !== "http://www.sample.com/") {
		E.setAttribute("href", "http://www.sample.com" + E.getAttribute("href"));
	};
};
i can't remember how to use jquery, sorry
wait let me test
10:01
@Cauterite -1 not enough jQuery
@BenFortune does it work with images? does it highlight? :P
@Cauterite please use properties
@Cauterite querySelectorAll()?
@MadaraUchiha yep, my mistake
@BenFortune that doesn't answer the 2nd question
10:04
What do you mean highlight? Wouldn't that depend on the service that's displaying it?
@Cauterite lol not working
@winresh24 change querySelector to querySelectorAll
@BenFortune it generates an html file
user3119231
-2
Q: Pass the Device Time to Javascript in HTML Android App

IpadIs there a chance to provide the device time from Android (java) to my Javascript App? Without using an Datetime-Format just a plane Time. Without using a calendar?

user3119231
10:06
never heard about someone using javascript in android studio?
not working either @Cauterite
@winresh24 well what's the expected result, and actual result?
@FlorianMargaine Yeah but if you're uploading to pastebin, wouldn't it be pastebin that has the syntax highlighting? Or am I getting this backwards?
1 message moved to Trash can
@winresh24 Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@winresh24 explain in words, not with code
10:09
with this one all the href is change if url couldn't find sample.com
@winresh24 can you rephrase that?
1
Q: Constructors and initialization in javascript

overexchangeFor below hierarchy of function constructors, below are the instances created. When Javascript sees, mark = new WorkerBee; an object with members name, dept,projects and __proto__ are created. This object(value of this) is passed to WorkerBee constructor. Does Employee constructor get e...

div id foo
div id foo2
div class foo3

how do you write a stylus query that only targets foo3?

#foo .foo3 {} ?
In my old code I paste a minute ago it's working fine and change all the link that is not equivalent to sample.com for example the href was only "/extension" then the code will add sample.com in front it will be now sample.com/extension
what i want to happen is put it in condition
@SuperUberDuper .foo3 {} ?
10:13
something like if url is equal to sample.com execute same.com @Cauterite
@BenFortune no, I'm uploading an html file to my VPS.
@FlorianMargaine Ohhhhh, that makes more sense
My way is to upload the text files to my dedi, then syntax highlight on output.
Though I use gist 99% of the time anyway
@BenFortune it can only be inside A #foo
@winresh24 have you got a live website we can test? (or even a jsfiddle?)
wait let me do fiddle
10:16
@SuperUberDuper Whups there is, you make it look like they're independent of each other though.
@winresh24 this works fine for me: jsfiddle.net/Ugc5g/5808
@Cauterite the link doesn't change
inspect mine
10:31
@BenFortune yup, this way is to generate an HTML file that already has the syntax highlight
https://jsfiddle.net/Ugc5g/5809/
i see "before: /extension", "after: http;//www.sample.com/extension"
how can I match something like this

$('foo-*') where * is anything?
@SuperUberDuper not sure selectors can do that; you might have to just .filter() the results of $('*')
@Cauterite can't see try to inspect link
oh, thats a shame
10:39
I guess a attribute selector would workd
$('[class^="foo-"]')
it's pretty easy though
`$('*').filter(X => X.tagName.startsWith("foo-"))`
@GNi33 we're selecting by tag names, not by classes
@winresh24 when i inspect your jsfiddle the result is exactly the same as mine
oh
are you going over an xml or something?
look in my end @Cauterite
totally different
@winresh24 so it is… i have no idea what the problem could be, sorry
lols @Cauterite btw thanks
10:49
@SuperUberDuper Array.from($('*')).filter(X => X.tagName.toLowerCase().startsWith("foo-"))
Guys anyone knows an API where you can upload an image and get metadata (size, mime type, dimensions, etc)
@Cauterite I'm guessing Firefox vs Chrome, since for..of isn't supported in Chrome yet.
@BenFortune oh god really?
Or it is, but you can't use it with DOM nodes yet
Unless you polyfill it with Symbol.iterator
@BenFortune does that mean you can't Array.from(NodeList) ?
10:53
yeah, because it's so horrible to use for..in
@Cauterite Correct
@GNi33 it wouldn't be so bad if i remembered that it existed
at least i remember the old way to make arrays from nodelists
@Cauterite Can't use most ES6 without strict mode either :P
Well, let at least
oh, i didn't know that
Again, mainly Chrome
10:58
@Cauterite are using chrome?
@winresh24 if that doesn't work try jsfiddle.net/Ugc5g/5812
@winresh24 no, firefox
try it in chrome
@winresh24 'aint got no chrome here
not working in chrome

« first day (1775 days earlier)      last day (3398 days later) »