It’s about time.


This should be plugin for all major IDE’s, this is forward thinking.

Pretty Slick


Insane, I just thought it was all talk. I didn’t realize Microsoft had /actually/ posted their source code on github

count it off!

Things that don’t change

Deadlines and Deliverables, in or out of college, that shit always means crunch time. I think I’ve worked 40 hrs in the last 3 days easily.

So much coding…

Leveraging Higher Order Functions in Javascript

I swear I’ll try to make this as clear and straight forward to understand.
So let’s say you have a list of objects that you want to traverse

list = ["John", "Mary", "Joe", "Jenny", "Jack", "Manny", "Jose"];

And maybe you want to do something neat with each element, something that’s similar but different in once place and now you’re like “hmm…do I copy paste or, idk there should be a way to make this better…”

    $.each(list, function(index, value) {
       console.log(value+" sucks");
    //Hmmm, now I wanna say they rock..., or other various things
    //Do I really have to write my function over again?
    $.each(list, function(index, value) {
       console.log(value+" rocks");
    //This is getting repetitive, and my code is getting long, sad times

Well there is another way, you could use a higher order function. Wouldn’t it be nice if you could say something like this

    var do_this = function (opinion, index, value) {
       console.log(value+" "+opinion);
    $.each(list, do_this("sucks"));
    //AwesomeTimes...if it worked...sad times

And you know, just have jQuery know that you’re trying to fill in only the first argument. Well you’re most of the way there, some languages will know wtf you’re trying to do and be like AwesomeSauce, and work, Javascript needs a bit of a hint, so this is the “work-around” to trigger something like this.

The reason this fails is because it will try to use do_this(“sucks”) return value’s call method, and what does it return? Nothing. So lets give it something, we’re almost all the way there, what if that function is super fucking long? it’s worth the extra effort. So lets revise our code

    var do_this = function(opinion) {
          return function (index, value) {
             console.log("object at index "+index+" "+value+" "+opinion);
    $.each(list.slice(0,2), do_this("sucks"));
    $.each(list.slice(2,5), do_this("rocks"));
    $.each(list.slice(5,list.length), do_this("I dont know"));

and there we go! So if ever someone’s being an esoteric dick to you about how awesome languages that treat functions as first class citizens are and how Haskell is the most awesome language ever — this is the kinda shit they’re talking about, and function currying, and other sexy awesome stuff that Haskell does.

BUT since we have to live in the real world, and work on real systems, this will save you some REAL headaches. Hope this was helpful.