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.

Markdown is the new WYSIWYG

If you publish content on the web, get ready, a shift started a while back, but now gaining momentum. I first encountered Markdown a few years ago and had a fancy for it, but never took the time to learn it. I didn’t really have a use for it. Now that I’ve had to use it on StackOverflow, GitHub, and other great sites, I’m convinced it’s time to learn it.

Testing XHR in Appcelerator with SinonJS

Coming soon. Testing XHR with SinonJS. Here are some references. https://github.com/cjohansen/Sinon.JS/issues/135 http://titaniumninja.com/testing-titanium-mobile-applications-with-jasmine-and-sinon-part-i/

Getting Titanium CurrentWindow To Work Under CommonJS

Appcelerator is a moving target, developed and changing pretty fast. The old way was using the **url: ** property of a window to open up a new screen with a javascript screen. Old and Busted var window = Ti.UI.createWindow({ url: 'screen.js' }); Another Old Way Then came the Tweetanium structure, while a solid way to set up, it’s not the route Appcelerator is recommending anymore. See my post for more information on the Tweetanium Setup

Improving my Vim environment with ctags and Tagbar

I love Vim. There is something about it. Most people that “try” Vim, hate and wonder what all the fuss is about. If you force yourself to learn it, customize your environment and start using it, you’ll want to use it for all your text editing needs. Here are few more improvements I’ve installed today.  Tagbar Tagbar allows you to see inspect the current file listing the properties and methods in that file.

Programmers should be lazy, but not at the expense of user experience

Has this every happened to you. A form wants you to enter in your phone number… OK, let’s be honest, there are 20 different ways you can enter in your phone, but as far as a computer is concerned it’s just interested in the numbers. So that means stripping out the non-numeric characters is trivial…. So why do so many sites do like this stupid site…. make you enter in a phone the way THEY want you.

Getting AngularJS and Zend Framework POST to play nice

I was simply posting data to the server using this code $scope.submit = function() { console.log($scope.newTitle + ' is the new title'); $http({ url: '/api/idea/method/add', method: 'POST', data: { title: $scope.newTitle, description: $scope.newDescription }, headers: {'Content-Type': 'application/x-www-form-urlencoded'} }) .success(function(data, status) { }) .error(function(data, status) { }); }; But I was getting a JSON object submitted and therefore using Zend’s _getParam('title') could not pick up the title in the post. The answer was to use jQuery’s $.