sublime text editor – sublimelinter running multiple javascript linters

i like to run my javascript through jshint and gjslint to lint my code for anything those tools pick up. sublime text editor is my favorite editor for javascript and the sublimelinter is an excellent package that will lint your code in real time.

the problem with sublimelinter is that it will only let you run one linter per language. this is problematic if you want to run two. the solution? it’s a little hacky and unfortunately isn’t very modular, but it can be done.

the linter you choose can be configured to run an external tool to lint your code. the results of the tool can be parsed via some regex magic and you can then parse the results into a format that sublimelinter understands.

since jshint and gjslint can be invoked as external tools, you can just write a wrapper shell script which will run both of these tools against your file, then check against some regex to pick up the results and feed it to sublime.

it’s a little messy and i suspect when the plugin upgrades itself, you’ll have to reapply these changes because you are mucking with the internals of sublimelinter, but having both static code tools run in real-time for me is worth it.

it’s not a lot of code, but it’s enough where it’s not for the faint of heart:
sublimelinter fork with diffs.

mongoose – add to an existing array

a new language and a new database means that there are new ways to do things. mongodb is a document-oriented database which means that updating your document is a little more complex than your standard SQL update.

suppose you have a document:

    _id: 1,
    items: [
            itemId: 1,
            title: 'ipod nano black',
            price: '42',
            _id: 1001

and you want to add a new item to the items array in your document. after some digging around, it looks like this works:

var item = {
    title: 'title of the new item',
    price: '4242'
// find by document id and update
    {$push: {items: item}},
    {safe: true, upsert: true},
    function(err, model) {
// find by some conditions and update
    {$push: {items: item}},
    {safe: true, upsert: true},
    function(err, model) {

where collection is your instance of the model you are updating. you can either findByIdAndUpdate if you have the document id handy, otherwise you can findOneAndUpdate and use some conditions to find the record that you want to update.

ugh, this is really simple stuff, it should be easy, but the mongoose documentation would really benefit from a few examples.

node.js, express, consolidate, dustjs-linkedin AND dustjs-helpers

i just started playing with node.js and so far it seems pretty intriguing. my first use case for node.js is to make some JSON APIs. trying to figure out what the structure of a node.js project should be has been a pretty frustrating experience, though.

nevermind that node.js is still in its infancy and the core APIs have been changing at an alarming rate.

nevermind that this means that many blogs that you read about node.js examples won’t work anymore because they were for an older version of node.

what is the most frustrating thing in the world is that trying to figure out what best practice is seems impossible to verify because everyone is still trying to figure out what best practice really is.

that being said, i’ve decided to use express as the web framework. it seems pretty popular, lightweight, and relatively straightforward to use.

i wanted to be able to use a javascript template engine and though there are many, many options out there, i’ve decided to use the linked fork of dust.js. the linkedin guys seem to have a pretty good thing going there and have made some improvements to the engine that really help.

a convenience layer is consolidate which will make swapping template engines relatively painless, though in practice, i don’t know how realistic this is because even though you can swap out a template engine, the views probably won’t be syntactically compatible. still, using consolidate did make setting up dustjs relatively straightforward.

that being said, IF you use consolidate and you want to use dustjs-helpers, there’s really no good documentation on how to do it. the best hint i found was actually in the git repo for dustjs.

    app.engine('dust', cons.dust);
    cons.dust.helpers = require('dustjs-helpers');
    app.set('view engine', 'dust');
    app.set('views', __dirname + '/views');

the last few months

in the last few months, i’ve been transitioning front a LAMP developer to a primarily front end developer. it’s been an interesting and fun journey so far, but quite humbling as well.

it seems like there’s so much that i still just don’t know and i think that i need to start documenting the things that i hear about and how feelings about them.

so here’s my first note to myself to learn about: backbone.js, underscore.js, mustache.js, dust.js

also, it looks like it these tools might come in handy: prism, filedrop.

spare time

so what do i end up doing with my spare time? at work i’m making facebook apps. when i get home, i made a facebook app just for myself, just for the 365 project i’m working on. it’s still rough around the edges but it’s semi-working and taking a picture a day is quite the challenge.


i just got an email from sarah from one click ventures. the email informed me that she is a representative from the fedora store and that they have recently been hit with a google penalty for the links going to some of their sites. Their consultant recommended that they try to remove some of the links on, you know, the internets that link to their site.

so she has asked me to remove a link from cindy’s blog where she linked the word “fedora” in her blog while talking about buying a fedora from said store.

after i got the email, i was incredulous and appalled. you want me to remove content from my personal blog? well, actually, it’s cindy’s blog, so you want me to ask someone to remove something from their PERSONAL BLOG? the crazy thing is that i think what cindy did was “the right thing”™. she correctly linked the word fedora to the place where, you know, they actually bought the FEDORA!

so, ok, i decide that i’m just going to ignore the email because i get all sorts of emails all the time asking me to do things that i don’t really want to do and that’s the end of that. but no. it isn’t the end of that. not at all.

instead, i’ve been getting emails from sarah almost every other day asking me if i’ve had a chance to remove the link. the first time around, sure, i’ll excuse it, because, you know, it doesn’t hurt to ask. but if you haven’t heard back, maybe the person doesn’t have anything to say? why? why would you keep writing asking for the same thing over and over again? is it because if you keep asking, you think something will change?

it was the third email she sent me that finally got me upset enough to reply because she told me in her email that she has been getting a lot of pressure from people above her to get this link removed. cindy, do you hear that? it is really important for the link to fedora on your blog dated two and a half years ago be removed!

so i decided to look up sarah and guess what? she’s a self-proclaimed SEO and social media specialist. and sarah does work for the parent company who owns the fedora store. so i guess she’s trying to do her job and all, but really? is this how the internets work now, people?

i don’t know why i’m so worked up about this. i think it’s because i feel like this is breaking internet etiquette. you don’t ask people to change their content. am i naive in thinking this?

maybe it’s because i feel like it’s a form of censorship. maybe it’s because i feel like whatever i decide to put on my blog is really my business. if you don’t like what you read, stop coming. it’s not like i have posted anything on this blog since the kids have been born anyway, so i don’t really anticipate that i would make much of an impact at all, but hey, if cindy’s post really is that big of a deal, then who knows?

i had flashbacks of the time when i was threatened by a pearl tea store owner to remove my review of their store from my site because it was unflattering. they said that they would sue me. by the way, banana crepe in japantown in downtown san jose, i still think your pearl tea is terrible and wouldn’t recommend anyone to go there for that. i hear your crepes are pretty good, but after that email from you, i promised never to bring my business there again.

so yay. i blogged a rant. about fedoras. *eyeroll*

did you know that this same company sells neck ties and scarves and hand bags and reading glasses and socks and sunglasses and travel products?

wait…am i helping them or hurting? i really feel like i’m doing “the right thing”™ here, right?

a special moment

i was watching modern family last night and phil was trying to make a special moment with his daughter. he went to great lengths to create a memory that only he and his daughter would have to look back upon and smile fondly.

it reminded me of a memory from my childhood when my dad took me to a niners game. i think it might be the only 49ers game we’ve ever gone to. i must have been around 8 years old. i remember being so excited the week before the game and i would talk about the game with great anticipation.

i would ask my dad how long we would go to the game and he would tell me that he didn’t know. the game could go into overtime and we might be there all night long! i would tell my mom that she shouldn’t stay up for us because we might not go home until the sun came up.

we went to the game, watched it, and had a blast. i remember my dad bought me a horn that i could blow to make noise at the game. i carried that horn with me everywhere i went for a week after that.

it’s such a great memory of a little boy excited to spend time with his dad at his football game. i had forgotten about it until i watched modern family last night, so thank you modern family for helping me relive a wonderful moment in my life.

tonight, kyden and i are going to go to the sharks game. he, too, has been so excited about it and has been motioning power play shark jaws and cheering go! sharks! go! around the house for the past several days. i never really thought about it as a moment that he and i can share (though i’m sure he’s far too young to really remember it later as an adult), but it certainly gives a different perspective to a night out like this.

in training this week

I’ve been in training all this week and today I took a certification test to be a cloudera certified hadoop developer. I find it mildly amusing that the first professional certification I have ever gotten is in something whose primary user are java developers. I anticipate that most of my interactions with hadoop with primarily be using hadoop streaming for MapReduce tasks.

But yes, I am certified having written a full two, that’s right, count them, TWO MapReduce apps. What else can I call myself a pro in that I’ve only done twice? Laser tag?

pad and quill – the octavo for ipad 2 case

i just recently got the ipad 2 and i’ve been torn about what to do for a case. for my iphone 4, it was important to me that the case be ultra-thin. i didn’t want to add additional bulk to the phone. eventually, i ended up with a switcheasy nude black case. this case is super thing, yet provides the protection that i want for my iphone.

when making the decision to get an ipad case, i was confronted with the same question: what is important to me for an ipad case? it turns out that what was important for me for the iphone is not what is important to me for the ipad.

so what did i want? i did not want the smart covers because the thought of spending upwards of $60 for just a cover with no back protection on the ipad was simply appalling. i did, however, want something that took advantage of the “smart” factor of the cover. i wanted something that when i opened up my ipad, it would make use of the magnets to turn on and off the ipad.

adding bulk to the ipad 2 was a concern of mine, but i also wanted something that would provide full front and back protection of the ipad 2 especially when it was not being used.

it was not terribly important to me that the ipad 2 case had an integrated stand in it. it was important that i would be able to charge the ipad 2 easily and that access to all of the ports were readily accessible.

but really, the biggest factor of the decision was that the case had to be beautiful.

with all of those things in mind, i ended up with the pad and quill octavo for ipad 2. there are a couple of competitors out there to this case that from the outside looks like a moleskine journal. what spoke to me about this particular case is that it does have an integrated magnet to use the smart features of the case.

for me it was a toss up between the dodocase and the octavo and the on/off feature with the magnet sealed the deal for me.

i’ve received the case and the quality of the case on first glance is pretty stunning. the specially carved speaker channel seems to amplify sound that goes through the ipad 2 speaker instead of muffling it.

i do have to admit that when i first installed the ipad 2 in the octavo, i was a bit disappointed with just how much bulk this case adds to the ipad 2. the ipad 2 is firmly seated in the case and there’s no chance that it will fall out of the case.

i realized that though heft matters, i’m not sure if i got a different case if i would use the ipad 2 differently. would i hold it differently because the overall weight is less? the truth of the matter is that the ipad 2 isn’t really a device that i can hold comfortably in 1 hand for a prolonged period like some of the other tablets in the market that are just much smaller and weighs much less. (i’m thinking the galaxy tab, for example)

workmanship on the octavo is pretty solid, my only complaint (and it is a nitpick) is that there is a knot in the wood border that holds the ipad 2 in the case.

because these are hand crafted cases, i would have thought that pad and quill would have paid more attention to these kinds of details. this is a premium $70 case, after all. it looks like a blemish when you look at the case from the outside and i think that i’m just disappointed that i just ended up getting a bad build. this is the only complaint i have from a cosmetic point of view.

outside from that, i love the case and highly recommend it to anyone.

of course…

of course after i mention a great find of mine, it breaks. pixelpipe is no longer correctly uploading to plixi for me. it looks like there’s some kind of API issue on their side. in the meantime, it means that uploading images just became difficult again.

plixi’s iphone app is nowhere to be found. i’m not sure what happened to it as it WAS available at some point some time ago… the only thing that is saving me is that plixi will also let you email images to a custom email address that will then upload it to your account. thank goodness. this solves my image uploading needs, but i really wished there was an integrated solution for status updates and image uploads. pixelpipe looked like it was the solution, but alas, that does not seem to be the case.

maybe it’s finally time to start writing that iphone app, after all…

But, soft! What light through yonder window breaks?