Be Shallow

Be Shallow
Do you want a secret that will make you 10x more productive? Of course you do. As a programmer, you’re designed to look for better, faster, more efficient solutions to all life’s problems. It’s in your nature, and if you could be 10x faster, you would at least be curious. Does This Sound Familiar You start working on a rather large code base. The previous developers did their best to organize the project into nice subfolders, and more subfolders.

Password Reset Token Expiration

Password Reset Token Expiration
Paige Niedringhaus writes a nice blog post called Password Reset Emails In Your React App Made Easy with Nodemailer, where she outlines how to use Nodemailer + ReactJS + Node.js + MySQL + Sequelize to build a simple password reset flow. Everyone reading these words has doubtless gone through the familiar password reset song and dance. Enter your email into a form field, receive an email with a link, click the link, reset your password, voilà!

Apps I use and may be useful to you too

Apps I use and may be useful to you too
A run down on the apps I use regularly and why. Caution, Mac specific drivel ahead. Vim Do I even need to explain? It’s pretty common place for proud Vim users to show off their .vimrc, but I’ve come to find copy/paste from someone else’s .vimrc is not really a good idea. A developer’s .vimrc is a personal matter, crafted over time with love and affection, it suits them and their needs.

Why Vim

A coworker asked me the other day. Why Vim, what do you like so much about it? I would dare say everyone who encounters Vim has a similar story. Many years ago, while on a linux machine I first encounted Vim. It was a simple way to edit text on the server. It didn’t make sense, but it worked. That was the extent of engagement with Vim for about 10 years, just being able to do simple editing of text.

The MEAN Stack

Maybe you’re familiar with the LAMP stack? Linux, Apache, MySql, PHP. That’s been a pretty common way to serve websites for many years (circa 1998?). But things have changed, technologies have changed, and it’s not 1998 anymore. IE6 is dead, nested tables are dead, and the LAMP stack is the Old and Busted. The New Hotness is the MEAN stack, MongoDB, ExpressJS, AngularJS, and NodeJS. This new stack of technologies is what many new web apps are using these days.

Getting Jenkins ready for Node.js and AngularJS testing

Setting up Jenkins for Node.js + Mocha testing and such Install this stuff Node.js via Nave git clone* ./bin/ usemain v.0.8.9 Mocha npm install -g mocha ChaiJS npm install -g chai xunit-file (Mocha custom report for Jenkins) npm install -g xunit-file Jshint npm install -g jshint Nock npm install -g nock Supertest npm install -g supertest Testacular npm install -g testacular PhantomJS npm install -g phantomjs Here is a handy script that will install v0.

Using Testacular with Jenkins for AngularJS e2e Testing

Rollcall! AngularJS in your code ✓ Jenkins ✓ Node.js is installed on the Jenkins server? ✓ Testacular is installed on the Jenkins server ✓* PhantomJS is installed on the Jenkins server ✓ If that’s what you’re using, this is how I set up testing on the Jenkins server. Create a new job in Jenkins Pull from Git (or whatever), Trigger how you want too. That’s not germane to this article.

Some really good parts about JavaScript

Most people who only know some jQuery and little JavaScript in the browser scratch their head and wonder how this lame language can be run on a server, or better yet, how most of your front end can be run on this messed up language. JavaScript hits the nail on head Functions as first class citizens. So what does this mean? Functions can be embedded inside other functions var outer = function embedded() { var inside = function() { var deep = 'variable inside a function, inside a function'; }; } Notice how outer has a function inside it called inside, and inside the inside function is a variable deep?

Metamorphosis from PHP to JavaScript

The following is account of why I prefer writing programs in JavaScript over PHP. I have well over 10 years of programming experience in PHP. I’ve written everything from a simple one page PHP program, to a complex Zend Framework apps, to you name it, I’ve coded it in PHP (even stuff I know I should have not done in PHP). You Always Play To Your Strengths, if PHP is your strength, that’s going to be your game

MongooseJS and the problem with adding new properties

My setup is easy. Node.js, ExpressJS, MongooseJS. The Problem I was getting a list of objects from the MongoDB. Like this // Find all items where owner in following array Thing.find() .where('owner').in(following) .populate('owner') .populate('comments.userId') .sort('-updatedOn') .limit(20) .exec(callback); In the callback I was assigning the results to res.locals.things for use in another middleware function. In another middleware function I tried this // Extend thing[i] with a new property called newProperty for var i=0; i < res.