Roswell Studios

139 Fulton Street, Ste 132
New York, NY 10038


This is where we write stuff.

Angular directives

— August 22, 2016

Rather than the jQuery way, to assign behaviors via selectors. $('input').focus().select() Angular wants to define the behaviors in directives: .directive('autoSelect', function ($timeout) { return { restrict: 'AE', link: function(scope, element, attrs) { $timeout(function(){ element[0].select(); element[0].focus(); },125);//wait out angular putting the text into the field } }; }) then assign those behaviors to dom elements directly: >input type="number" ng-model="bid.price" string-to-number auto-select /< Eventually you too can build...

Jasmine Hack: $q

— July 22, 2016

Lets say you have a Jasmine test of an asynchronous call with then(). You need to call $rootScope.$digest() in order for the then() to happen. Lets say you are testing the bit that returns that promise. You can’t expect($q.reject).toHaveBeenCalled() because the reject inside your function is not the same thing as $q.reject, which is the only thing spyOn can see. You could fix that by calling...

Angular Core Concepts

— July 1, 2016

Angular2 (or 1.5) for new or old users If you have avoided Angular to date, good news! You won’t have to forget anything. If you know all the differences between services and factories and controllers and directives, good news! Free up those brain cells! This guide is not going to answer all the possible questions about Angular. Rather it is a mindset that I found very...

Forum Review: Sabai

— May 22, 2016

WordPress Stack Exchange style forum. I’d never heard of it, and the cheap looking website doesn’t seem to have been updated since 2013, and English is clearly not his native language, but it seems quite extensible, the product itself was updated recently, and the author is quite active in the support forum. I was worried that because it was not free, the source would require ioncube...

Javascript Review: Angular 2

— May 15, 2016

the j2ee of javascript. So many classes. Very brittle: survey: {{}} produces 100s of lines of stacktraces (there’s the j2ee again) and kills the program if survey is defined in a promise in onInit. survey: {{}} works. Hoped you enjoyed adding “isset($a[‘x’]) &&” in every if($a[‘x’]) in PHP, because it’s back. “TypeError: Cannot set property ‘endSourceSpan’ of null” – unclosed or malformed html in the template....

Angular Review: Form Validation

— March 1, 2016

Another place that should be far simpler than it is. It doesn’t help that one of the solutions starts with “If you google “angular js password match” you would find a lot of solutions.”*, and I couldn’t get that one to work. There is an official Angular UI that has a “General-purpose validator for ngModel.”, but requires installing the entire suite for just that. This is...

Slow Server Tips

— February 15, 2016

We had a problem in which a server began running extremely slowly. Primarily for one magento site, but then the entire machine. top: There was a high load average, but nothing was running out of the ordinary. No Disk waits, Zombies, 6G/8G mem. yum install iotop; iotop: there’s almost nothing running here, either yum install sysstat; iostat -dkx 60: at last, a sign of a problem:...

Video Services Review 2015

— December 1, 2015

Hulu: now available commercial free, but did not have the top-tier shows in the past few seasons. It stopped doing the 180 second ad blocks, making free viewing better, but I adjusted to not using it during the bad times, making the service less necessary. I’m only watching 1 show per week, which is not worth any amount of money to skip the ads. Even Plus...

Code: password_verify + Zend Framework 1

— October 22, 2015

Let’s just say you have a Zend Framework project, and you never bothered to update to ZF2 because you spent a lot of time adapting to the ZF1 weirdness, and have a nice system going. But now you want to drop the MD5 style passwords some of your projects may still be using. The solution is a custom Zend_Auth_Adapter_Interface. Here is an example: class AuthHashVerify implements...

« newer / older »