« first day (967 days earlier)      last day (3987 days later) » 

4:00 PM
It's implemented in all other array methods. foo.forEach is the same thing as foo.map
The only difference between them is what happens to the value retuned from the callback
 
No, use foo.map to map and foo.forEach to perform an action on each element.
 
@FlorianMargaine are you kidding ?
 
yeah, and foo.filter to filter and blah blah. But it's still just a name. It's just less useful than other array methods.
 
4:02 PM
Is that app really showing an old Nokia and let you play snake with this fake keys?
 
I want that to replace my keypad on my phone.
Freaking sweet to see the numbers dialed up there in green and black
 
@Zirak let's say I have objects which I filter on some value and them map to span elements, I want to now attach them all to some other container element, what would you do?
 
@BenjaminGruenbaum And now you're being a nitty-gritty jackass again. Yes, you can use forEach and it's more semantic; however, it is already encapsulated by other array methods.
 
Well solve this example without it
 
4:07 PM
 
You can do thing.filter(filtering).forEach(attach) and have it behave the same way as thing.filter(filtering).filter(attach)
Or thing.filter(filtering).map(attach)
Anything that just traverses over all elements
 
But you're not mapping, or filtering
 
That doesn't matter
 
@Gacnt sounds like a good plan to me
 
When I use map/filter I like not having side effects
 
4:09 PM
Because the result is the same. So as I said, more semantic, nothing else
 
I'm temporary and I have a nickname
 
I like pineapples
 
@Zirak yeah, well, at least you're not bored as fuck
 
I'm working with twitter bootstrap. I have used the bootstrap stylesheet "docs.css" that is not part of bootstrap, but is just for presenting the documentation. is very serious? xD
 
What. The. Fck did you just say
 
4:14 PM
Are you talking with me @Gacnt ?
 
Yes
 
I said that I have used docs.css stylesheet even this is not part of bootstrap library.
 
why are for-loops so good in firefox and forEach so good in opera...
 
I did not know that docs.css was just a stylesheet for presenting the bootstrap documentation. xD
 
Different JS engines?
 
4:16 PM
and I can understand why forEach technically performs better than a for-loop, but the second you start using multiple levels of looping I would think that using a forEach would start to suck with all the function creations unless you already needed functions for some other reason and just get lucky when needing to iterate
(put those weird numbers aside)
 
I try to avoid loops at all costs, I find using Objects with exact properties works 10x better
 
@redline perhaps Firefox cheats here, and only executes the last iteration seeing that they overwrite each other?
 
@JanDvorak good point
 
Jesus, I just spent about 30 mins trying to get a Win 8 tablet to do anything. In the end I gave up and just powered it off.
 
LOL
@JanDvorak give me ideas, im bored
 
4:20 PM
@Gacnt what kind of ideas?
Install Hedgewars
 
Preferably programming
 
make a sudoku solver
 
oh. Clone Hedgewars
 
i did that once, it was fun
 
I'm gonna learn golang bbl
 
4:20 PM
learn J
 
alrighty then
 
@JanDvorak J?
 
you know, will smith from men in black
J
 
lol
 
The J programming language, developed in the early 1990s by Kenneth E. Iverson and Roger Hui, is a synthesis of APL (also by Iverson) and the FP and FL function-level languages created by John Backus. To avoid repeating the APL special-character problem, J requires only the basic ASCII character set, resorting to the use of the dot and colon as "inflections" to form short words similar to digraphs. Most such "primary" (or "primitive") J words serve as mathematical symbols, with the dot or colon extending the meaning of the basic characters available. Additionally, many characters which...
 
4:24 PM
Can docs.css (stylesheet of bootstrap used for presenting the bootstrap documentation) be used for commercial site?
 
hmm. Peroni Gran Riserva. Italian for Special Brew, apparently
 
//I may have fallen in love:
var bindCall = function (method) {
    return method.call.bind(method);
};
//so you can do:
[ 'I', 'like', 'pineapples' ].map( bindCall(String.prototype.toUpperCase) );
 
a, b := swap("hello", "world") @FlorianMargaine is that how variables are declared
 
Being a nitty gritty asshole here:
["1","2","3" ].map( bindCall(parseInt) );
 
@Zirak how is that different from [...].map(toUpperCase)?
 
4:29 PM
@JanDvorak Try it
 
@JanDvorak toUpperCase works on this
 
ah, right, oops
 
> Inside a function, the := short assignment statement can be used in place of a var declaration with implicit type. I like this.
 
@JanDvorak I was going to ask that but I thought I'd look too noob...
 
I just opened the console and ran the code to make sure toUpperCase doesn't happen to accept a first argument
 
4:32 PM
wow
method.call.bind
that is actually really awesome
appending .bind to .call and using the semantics of the .bind function so that the map argument goes to the first argument in call instead of thisArg is just really ingenius
 
It's just a bit of sugar.
 
where did you find that?
 
Assuming he didn't come up with it himself ...
 
Using .bind with .call (or `.apply) is a pretty known approach. I've seen it used in code bases before. It's useful.
 
It's definitely very cool, but probably very hard for someone else to quickly look at and understand what is going on
 
4:36 PM
It's just how awesome the language is
 
but that's sometimes the trade-off for sugar
 
Like your problem before, and the way phenomnomnominal suggested you solve it
 
indeed it is
pheno solved a problem i had?
 
I'm talking about hiding, let's say you want to apply A's method to every object in your list.
We have an A type object and a B type object that 'extends' A, and we want to call A's method foo (B has its own foo) on both.
 
@Gacnt there are 2 ways to declare variables
the basic way
var varName typeName = value
and the infered way
varName := value
the := means that the compiler will guess what the type is, so you don't have to declare it
that's "type inference"
 
4:40 PM
you mean A.prototype.method?
like he suggested
 
[new A(),new B()].forEach(function(elem) { return A.method.call(elem);})
In ES6
 
@FlorianMargaine yeah, I learned it a little later, it's bad ass
 
[new A(),new B()].forEach((elem) => A.method.call(elem))
 
ES6 uses lambas?
NIIIIIIIIIIIIIIIICE
 
That's just notation, (x)=> <expression> is the same as a (function(x){return <expression> })
 
4:42 PM
@BenjaminGruenbaum this still requires you to know the method instead of just "casting" all the objects to A before iterating the array
@BenjaminGruenbaum yes i know, C# remember? ;)
 
const f = "%T(%v)\n" the hell is this < Variable Type, variable, new line? @FlorianMargaine
    const f = "%T(%v)\n"
    fmt.Printf(f, ToBe, ToBe)
 
@redline In CoffeeScript it's different though, that's why I was saying in case you know that. In CoffeeScript -> is C#'s => and => binds the value of this to the current context.
 
i've never used coffeescript so i wasn't confused, so it's all good
 
@redline You'd like to execute A's method, was that not the point?
 
well yes
but for example
you have B like you defined, but then C as well
B defines without overriding, C defines and doesn't override (base design I know)
 
4:44 PM
@Gacnt you've never used printf?
 
bad*
 
You want one to hide and one to override?
 
you already mentioned it
 
@FlorianMargaine I never did much C, not enough to remember all the %
 
but let's just say one hides and one doesn't
you put BOTH B and C in the array
then try to iterate and call the appropriate methods
see what i mean?
 
4:44 PM
@Gacnt I don't know all the % tbh, but you can understand the principle then
 
yeayh
 
[new A(),new B()].forEach((elem) => (elem.method||A.prototype.method).call(elem) )
There you go
 
printf basically turns into fmt.Printf("%T(%v)\n", ToBe, ToBe)
 
still a gross oversimplication
 
replacing T and v with the 2 args
 
4:45 PM
cause it's a simple example
 
a good answer, but still oversimplified
 
dunno what %T and %v stand for
 
what if i had MANY classes with all kinds of crazy inheritance
just saying...
 
Was just wondering what %T and %v does, I'll google, I just your resource more than google :D
 
4:46 PM
That'd still work.
 
it's too hard to keep track
 
I think it's a pretty complete answer. However, like I said, the only real use case for hiding is covariance in return type, and that's not an issue in JS.
 
@FlorianMargaine golang.org/pkg/fmt in case you're curious yourself
 
now, you forced your base method
what if you had 3 levels here?
you don't KNOW that if it doesn't define a method itself that it should use A
you assumed that
 
Oh, right you wanted a distinction
You can set a flag if you'd like
 
4:47 PM
true
but again, way more work than it's worth
 
var a = {};
a.method = function(){ alert("Hello");};
a.method.hides = false;
 
but to your point, i went into one of my larger C# projects and searched the entire solution for "public new"
 
Then check for method hides or not
 
and only found ONE occurance
where i specifically needed it, and not for a good reason
but cause i needed to "hack" a class
 
I'm with Eric, I do see a use case, but it's very limited and to achieve something pretty specific for the most part.
 
4:49 PM
and not to JS as you said
 
I love the fact C# just lets you do whatever you want, but it can make for pretty confusing code at times.
 
you mean JS?
 
(I really dislike explicit interfaces for example)
 
oh i love explicit interfaces, they are so useful
 
No, C#, C# is just as agile as JS, if not more, at the price of boilerplate
 
4:50 PM
especially for internals
combined with generics
hard to explain, nevermind
 
See, I see explicit interfaces as code smell, I guess internals with generics might be an acceptable use case.
Naa, it's ok, I know the use cases, I just don't like it.
 
i had to derived from some razor views
and using the single generic for the model, but specifying two classes, one with a generic and one without as razor does, made it very difficult to get things organized
and explicit interfaces as the only way to solve the problem
 
Yeah, I don't think it's Razor's fault, but I know that problem. A lot of crazy things make sense in ASP.NET MVC :)
 
but i never really find the code confusing, i like C# and can ready through it very quickly, but that's probably due to the hard-typing and how much better the editor is
 
The fact you're above so many layers of abstraction and have to abide to conventions is really useful at times and makes for short, readable unambiguous code at times but it can also be a real PITA
 
4:53 PM
I find JS to read right away cause there are so many things someone could do, it's so dynamic, so it's harder to quickly look at someone else's code and know what is going on IMO
 
@redline VS is pretty awesome with JS if you get WebEssentials and ReSharper
 
    @FlorianMargaine Last thing,
    func needFloat(x float64) float64 {
        return x * 0.1
    }

    the float64 {  part was not explained, why is the argument declared, followed by another declaration, is it to specify the return type ?
 
my buddy at work had resharper and hated it cause it was doing something weird with another addon we use
 
@redline The fact it's dynamic also makes it possible to write a lot less code to do the same thing. It's hard to get used to.
 
I hate resharper
 
4:54 PM
@redline VisualStudio sucks without ReSharper, really.
If you hate ReSharper you're using it wrong, it makes VS much better, and a decent IDE
Without it you have to do so much yourself, and it's really smart.
 
i just used the VS dev extensions
they are really nice
 
It's not even close.
 
i don't like things that code for me though
i code in a very specific way and don't like code editors writing for me
i like to balance my equals, ect...
 
@redline It doesn't code for you, but often it suggests things that make you say 'Ah, why didn't I think of that'
 
that never happens ;)
 
4:55 PM
That's because you're not aware of those because you don't have ReSharper :P
 
- It makes VS *even slower*
- It *changes* almost every shortcut I'm used to
- It constantly interrupts me while I'm typing to go and delete the parentheses it's put in the wrong place
- it replaces most dialogs with cluttered, slow, badly rendered WPF ones that have everything in a different place for no reason
 
For example, when I'm sloppy and use .Count() > 0 instead of .Any
 
@TomW yea that sounds about like what my buddy at work said
 
- It's your fault for having a bad computer
- You can configure it to keep the same shortcuts, you configure it the first time. You probably pressed the wrong button there.
- That's a setting
 
This is very much conditional on your workplace, but it's advertised as being able to do VB, and it can't
for a VB shop, that's extra annoying. My new place isn't, though
 
4:57 PM
Oh, yeah it sucks at VB, don't use it for VB
 
lol
there was the disconnnect
 
It detects unreachable code, extracts methods, classes, etc very well. It suggests shorter ways to do things and enforces conventions you can export to make sure you're not sloppy.
 
that's as well as all the useless disruptive shit I outlined above
 
It handles importing very nicely, a lot of stuff that used to reach building now doesn't thanks to it.
 
well i can tell you for a fact i am the exception to the rule when it comes to doing things the long way and being sloppy
i'm OCD so my code is always really neat
not cause i code it right the first time
but cause i go over and over and over and over it
 
4:58 PM
So you don't write perfect code the first time, you go over and over it :P
 
right
but by going over and over it, i learn more, and see more things that what resharper would have told me
 
I go over and over it, only I use tools like ReSharper when doing so so I can be faster :P
I still re-read code almost all of the time, but I use inspection tools.
 
There are certain useful features in ReSharper that I wish I could get without it getting in the way of me doing my work
 
@TomW How slow exactly is your computer? A good box shouldn't even notice ReSharper
 

« first day (967 days earlier)      last day (3987 days later) »