« first day (397 days earlier)      last day (4554 days later) » 

9:09 PM
public bool SettingStorePriceChangesStoreProductPriceAndUpdatesProductPriceAndUpdatesProductModifiedTimestampButDoesNotModifyAProductThatHasNonDefaultPricingAlready
{
  get;
  set;
}
 
... I'm too lazy to even attempt to read that
 
I read it
And it wasn't really worthwhile.
How does everyone feel about currying?
 
It's tasty
 
Currying is the one about passing around this values?
 
I could make a setColour(RGB) and curry the function int setRed(r), set yellow(y) or otherwise.
 
9:18 PM
oh, .bind
Making awesome callbacks
 
hrmm?
 
Function.prototype.bind
Regarding your question: It's awesome.
 
Honestly, I've never seen much practical use in currying. It seems over-complicated, and there are probably clearer ways to do things.
 
I can give you a practical use: Fixing event in IE.
((I might be mixing up terms here, so...))
You write a wrapper which normalizes everything, and then calls your original handler: window.addEventListener( 'click', wrapper(callback) );
And I just lurvz the idea of functions everywhere.
 
... hmm. Then it seems I simply misunderstood currying, or wasn't associating it correctly. Because I use that pattern all the bleeding time.
 
9:25 PM
I might be mistaking it for something else too.
 
I never thought of it as currying, I just thought of it as defining new scopes for the stuff I need.
 
What's that non-Crockford jsLint site?
 
Functional programming names are weird
 
It seems to mesh with the article @Incognito linked
 
Thank-ee
 
9:27 PM
var converter = function(ratio, symbol, input) {
    return [(input*ratio).toFixed(1),symbol].join(" ");
}

var kilosToPounds = converter.curry(2.2,"lbs");
var litersToUKPints = converter.curry(1.75, "imperial pints");
var litersToUSPints = converter.curry(1.98, "US pints");
var milesToKilometers = converter.curry(1.62, "km");

kilosToPounds(4); //8.8 lbs
litersToUKPints(2.4); //4.2 imperial pints
litersToUSPints(2.4); //4.8 US pints
milesToKilometers(34); //55.1 km
 
The problem with most currying articles I've read is the absolutely banal examples they use.
 
Notice that Function.prototype.curry is ES5's Function.prototype.bind
 
@Incognito dude somehow doing all of that (or installing apache) bricked my system.
 
@Incognito that's a better example
 
would not boot, no login screen, nothing.
 
9:30 PM
@rlemon Did you rm / -rf ?
 
just finished reinstalling
after it was kuputz?
 
There's a weird thing where as sudo rm rf can act as if it's from /.
Before, to make it explode.
 
But seriously, why the fsck would I read the rest of an article that uses addTen as an example function?
 
ahh, nope.
I did by accident sudo rm *
 
@RyanKinal Because lots of people can't find a good use for it.
 
9:31 PM
but never put in my password so I can't imagine it removed anything
 
@rlemon I think you deleted the filesystem, i've done that before.
Sudo maintains login for a few minutes, I think 20?
 
@Incognito FFS, whats the point of asking me for it then
 
If it's logged, then it doesn't
(usually)
 
Lots of people alias -i to their rm function, it makes it confirm every delete.
 
each time I do anything in that directory with sudo it asks me for a password.
 
9:32 PM
Yep, that's what I did:
Jul 28 at 15:38, by Incognito
sudo rm * -rf, entire file system GONE.
 
sudo touch README
> password?
sudo rm README
> password?
 
ls on /.
 
Now I have noticed a butload of issues because (being a new system) i'm getting a lot of updates and it's fucking with my system until I reboot.
 
Ever tell you my friend's telnet login story?
 
But i'm not getting notifications
 
9:34 PM
Yeah, you deleted the filesystem.
I reloaded my VM to a previous snapshot
And luckily had my git repo on another server, so I just cloned over and fixed it in an hour.
 
My friend's server password was sudo rm -rf (as a joke). A bug in the telnet login caused the password to execute.
 
luckily I had pulled my repo, and not made any changes
 
@Zirak That is... terrifying
looks through his own code for instances where he could be currying
 
@RyanKinal you mean schönfinkeling??
ugh... now I have to go out and install all of those packages again?!
 
oh my gosh it's been so long. last (5??) months. have I missed anything epic?
 
9:41 PM
... there's a reason "Curry" caught on, and not "schönfinkel"
 
Refactory help. Seriously, this code is ugly, how I better it
 
@ThomasShields A lot of hating on jQuery/cowbell?
 
@ThomasShields Why you no here :(
 
schönfinkel IMO is more fun to say.
 
@RyanKinal ah nothing new, i see :_
@Raynos school.
 
9:42 PM
@rlemon But more difficult to spell
And also requires extra keystrokes
 
yea I totally had to google it to get the correct spelling.
 
@Raynos i'm finally catching some time while listening to a class recording. (a particularly boring one, no less)
 
And also is not a tasty food
 
@RyanKinal that argument leaves room for mis-interpretation for other uses.
 
I see
 
9:43 PM
$("#div") is shorter to write so must be what I use.
 
@rlemon I was talking about the umlaut, not the number of actual characters
 
Ahhhhhh
hahaha, wow. way over my head.
 
@rlemon What are you trying to set up?
@ThomasShields I've been wondering where you disappeared to.
 
Last JS thing I tried to do was a quick Newton's method calculator: jsbin.com/ikajuz/7/edit#preview ...didn't even have time to do it properly.
 
I'm just setting up my Dev box for work.
 
9:44 PM
@Incognito long time no see. :)
 
@ThomasShields New inside joke is that jQuery = cowbell.
 
Need mono, git, apache, php, mysql, ect..
 
@rlemon I simply rewrote the language internals, so that everytime I make a string literal, it's automatically passed to jQuery. '#id' is mapped to jQuery('#id')
 
@Incognito ...cowbell?
 
@rlemon It's ubuntu, can't you just do apt-get?
 
9:45 PM
MOAR COWBELL
 
Yeah, because the world needs more cowbell
 
Installing is generally trivial.
 
you mean because it's clunky, loud, noisy, annoying, and generally useless?
 
@Incognito yea... like 25 times..
dude, i'm lazy
 
@ThomasShields Yeah man.
 
9:46 PM
0
Q: Refactoring node.js database code

RaynosI have a user model. It basically forwards get/create/delete requests into my database client. The problem I have is the error handling, it screams not DRY to me, but I can't find an elegant way to clean it up. var UserModel = pd.make(Model, { get: function _get(id, cb) { // nano i...

 
I don't like having to do things twice.
 
We have a domain too, cowbelljs.com
 
@Incognito awesome.
 
No, you just need more of it!
 
@Incognito lol that's awesome.
 
user1385191
9:46 PM
@ThomasShields innerHTML on a table = IE explosion
 
@Zirak I wrote a vanilla javascript parser for jQuery
 
@MattMcDonald i know. I had to write that fast and i'm not as familiar with table functions as I should be :(
 
innerHTML anywhere = mind explosion
 
@rlemon ... did it include eval?
 
$ = jQuery = eval("document.innerHTML"); // just to piss you off
OMG HOW DID YOU KNOW!
 
user1385191
9:48 PM
I keep surprising myself with ways to clean up code
 
$.fn.javascript = function (codez) { return eval(codez); }
 
3 hours ago, by Incognito
bool HTMLElement::ieForbidsInsertHTML() const
{
    // FIXME: Supposedly IE disallows settting innerHTML, outerHTML
    // and createContextualFragment on these tags.  We have no tests to
    // verify this however, so this list could be totally wrong.
    // This list was moved from the previous endTagRequirement() implementation.
    // This is also called from editing and assumed to be the list of tags
    // for which no end tag should be serialized. It's unclear if the list for
    // IE compat and the list for serialization sanity are the same.
 
javascript is a solved problem, man. Just use jQuery
 
Production webkit.
 
user1385191
cleanerMethodCall(
	param1,
	param2,
	param3,
	param4,
	param5
);
dirtierMethodCall(param1, param2, param3, param4, param5);
 
user1385191
9:49 PM
if only params were that small when you passed them...
 
evenBetterMethodCall({});
orAlternatively([]);
 
@Zirak good, but not as good as... 42()
 
@MattMcDonald Which do you favor?
 
And yeah. If I have to use the ternary operator, it'll look like this:
 
var df = document.createDocumentFragment();
df.appendChild(document.createTextNode("Hello World!"));
df.appendChild(document.createTextNode("Foo Bar!"));
var el = document.getElementById($("#div")[0].id);
eval("el.innerHTML = df.innerHTML");
 
9:51 PM
cond ?
    then :
    else;
 
@Zirak Don't like that one
 
orEvenFurther() { arguments; }
 
have I used DocumentFragments correct??
 
@rlemon Needs more cowbell!!!
 
var el = document.getElementById($("#div")[0].id);
not enough for you?
 
9:52 PM
@rlemon eeeeeeeeviiiiillllll
 
var el = $(document)[0].getElementById($("#div")[0].id);
 
$(document.getElementById($("#div").attr("id")));
 
MOAR COWBELL!
var el = $($(document)[0].getElementById($("#div")[0].id)); // I work!
 
@rlemon documentfragment.innerHTML does not exist
 
@Raynos ohh Boo!
 
9:54 PM
You could inject the fragment into a div, then get the innerHTML
 
Since you guys are faffing around anyway, can I have some input into making this code more DRY.
 
Sorry guys, I can't troll anymore.. Raynos pulled out his spec guide
 
There's always a way with cowbell
 
The issue is the .whitelist function, but I cant unelegant it
@rlemon I just know that documentfragment does not have innerHTML :\. It's obvouis
Node < DocumentFragment
 
@Raynos Right, it only exists on HTMLElement
 
9:54 PM
Node < Element < innerHTMLInterface
 
I'm trying to find a way to graphically map out the bs that happens when you do innerhtml="<lolcats/>"
 
1
Q: Refactoring node.js database code

RaynosI have a user model. It basically forwards get/create/delete requests into my database client. The problem I have is the error handling, it screams not DRY to me, but I can't find an elegant way to clean it up. var UserModel = pd.make(Model, { get: function _get(id, cb) { // nano i...

 
Oh that works too
@Incognito it's pain, don't do it
 
@Raynos I need to man, and I'm going to make it into a poster you can spend money on.
Because it's big enough to go into a poster.
 
@Raynos Why is "getaddrinfo" special, and what happens in that branch (I mean, what does whitelist do)?
 
9:57 PM
@Zirak is the comment not self explanatary for whitelist?
and getaddrinfo is murderous rage.
It's this random DNS error I get, I have to swallow it
 
Poster? You should write a book. "Shit that happens when you do innerHTML". I'd buy it.
 
@Zirak fixed it though
 
Yeah, I get what it does on boolean. But if there special behavior on undefined, or it is like false? (guessing latter)
 
@Incognito to be pedantic. .innerHTML is defined on Element
 
@Zirak That's basically what [this is](0xdeadcafe.github.com/CodeGuide-0000/) going to end up being in terms of length... 20 pages already, less than 1/10th done.
 
9:59 PM
@Zirak it does nothing, edited comment
 
@Raynos Since HTML5, yeah.
Why's it there?
Why did it get added to html5?
 
@Incognito because they wanted the DOM parsing trolls seperately
 
Raynos, if you look at the code for an outerHTML call you'll lose it. You'll freak.
It's just insane.
I'm headed home, cheers everyone.
 
@Raynos - aside - wouldn't you be better served putting the failure points into a map so you can add/remove them as they arise? Especially if it is caused by a bug, seems like you're making "getaddrinfo' magical
 
jsperf.com/1m-cow-bell <- got me thinking.. how bad can I make that selector.
 
10:02 PM
Your whitelist seems like not a whitelist but a procedural collection of magic.
 
anyone else make it any worse?
 
@Chris I don't know how to put it into a map nicely
 
@Raynos Port the callback, something like:
 
Hmm, I do see the challenge there because the failure points can happen both at o.error and o.syscall
 
function whiteListCb ( method, json, cb ) {
    error.whitelist(function _errors(err) {
                if (err.syscall === 'getaddrinfo') {
                    UserModel[ method ](json, cb);
                } else if (err.error === "conflict") {
                    return true;
                } else {
                    return false;
                }
            }, cb)
        );
}
erm
 
10:03 PM
the problem is that all three functions call a different method on getaddrinfo
 
There
Don't they just call "themselves"?
 
Yeah but err.error === "conflict" is unique to create
 
But otherwise, it seems like the whitelist ought to be more a matter of thiserror->thisaction
 
and get has err.error === "not_found"
and delete has none
 
or thiserror->tryagain vs. thiserror->return false
 
10:05 PM
the errors are also unique for commands
 
You can always add more params (or replace them with an object literal)
 
I wouldnt want not_found to return true on delete or insert
 
I'd create a "map", actually: { insert : ['conflict', 'moreInsertErrors', 'etc'] } etc
 
@rlemon Damn, jQuery selector is slow as shit compared to vanilla gEBI
@Zirak That's what I'm sayin', B
 
You're already hard-coding the values
 
10:08 PM
@Zirak thanks :0
gist: 1374703, 2011-11-17 22:08:42Z
var whitelistMap = {
    "get": ["not_found"],
    "insert": ["conflict"],
    "delete": []
}

function makeWhitelistCallback(method, thing, cb) {
    return error.whitelist(function _errors(err) {
        if (err.syscall === "getaddrinfo") {
            UserModel[method](thing, cb);
        } else if (whitelistMap[method].indexOf(err.error) !== -1) {
            return true;
        } else {
            return false;
        }
    }, cb);
}

var UserModel = pd.make(Model,{
    get: function _get(id, cb) {
        this.nano.get(id, 
            makeWhitelistCallback("get", id, cb)
        );
    },
    insert: function _create(json, cb) {
        this.nano.insert(json, json._id, 
            makeWhitelistCallback("insert", json, cb)
        );
    },
    delete: function _delete(name, cb) {
        var that = this;
        this.get(name, function _getRev(err, body) {
            that.nano.destroy(name, body._rev, 
                makeWhitelistCallback("delete", name, cb)
            );
        });
    }
});
Oh a map is an even beter idea
 
Enjoy teh awesome
 
@Zirak answer the question if you want brownie points
@Chris also thanks o/
 
can somebody advice easy to use jquery dropdown menu?
 
@Incognito Because it's needed for compatibility, and it got moved to Element for the sake of consistency.
 
@javagirl My advice: don't
:)
 
10:11 PM
@Chris why?
usual select element looks ugly
 
@Raynos Don't really care. I'll write the answer if you're too lazy to
 
@javagirl I could turn that question back onto you: why? Why not let your user use form components that are visually identifiable, keyboard accessible, and cross-browser consistent?
Otherwise... what advice do you need? I'm not trying to be a jerk... just don't get what advice you're after
jQuery plugin magic dictates that you simply include a javascript file on your page and the magic happens on its own.
 
thanks
mitya:) he's russian, wow
but, actually.. maybe somthing more famous, more convenient tool...
 
Don't know what you mean - but I found that by searching Google. Rather than "drop-down", they are properly called "form select" or less commonly "form combo".
However, I urge you again to reconsider murking up your forms with usability-reducing fancyness and jQuery magic and just sticking to the standard elements. I know, I know, they don't look "cool", but again, your users are used to the way these form elements look and work, by changing them around arbitrarily you're introducing a new learning curve for your users and potentially frustrating people when the script doesn't work right or if it breaks accessibility features like keyboard access.
 
10:29 PM
Words of wisdom
follow them
 
hey
I turned my magic numbers into something... simple
i.e 1 and 2
 
Too simple. Magic numbers must be turned into uppercase pseudo constants.
Globals, too
var MAGIC_NUMBER_THAT_EQUALS_ONE = 1;
var MAGIC_NUMBER_THAT_EQUALS_TWO = 2;
and so on
 
10:50 PM
@IvoWetzel is this NaCL?
 
private int maxRetry = 1;
public int MaxRetry
{
    get { return maxRetry = 5; }
    set { maxRetry = value; }
}
 
@Zirak ...
Why?
 
I wanna see what happens
 
@Zirak ...
That jsfiddle, why do you not use a for ... in
Oh never mind
(hurr durr)
 
Oh, the jsfiddle link was a "can you think of another way to do this?"
 
11:01 PM
fuck.. my girlfriends company is so fucked it makes me angry.
in such a rage right now
 
Not so surprising, but that C# snippet prints out 5 (when you Console.Write(this.MaxValue);)
 
and why if FF so laggy on Ubuntu
was quick as bunny on Windows.
 
public int SO {
    get {
        return SO = 5;
    }
    set {
        SO = value;
    }
}
FUCK YEAH
C# Stack Overflowed
ah well...g-time
 
ahaha, Speed up your jquery selectors by 30%!
omg! wow! thats amazing!
but it's true!
how?
I'll tell you
Introducing! Vanilla Query!
var el = $(document.getElementById("div"));
 
anybody know of a good "falling-snowflake" script?
 
11:14 PM
a gracious mix of DOM and jQuery
ummm Locktar made one
 
@rlemon really? cool.
 
somethinghitme.com check his blog
it's jQuery, but if you arn't using jQuery i'm sure you can extrapolate the idea.
 
@rlemon awesome, thanks
 
Ugh unit tests take forever >_<
20s to run a unit test
This is why you mock out the database
 
11:30 PM
Night guise
 
Hey @rlemon
howdy?
 
yo
 

« first day (397 days earlier)      last day (4554 days later) »