Using SASS with Visual Studio 2013 Essentials

Visual Studio: "Don't you SASS me, son!"

Visual Studio 2013 (Essentials or not, I don’t suppose it matters) provides the ability to add SASS files (.scss) to your project. Strangely, it doesn’t give you the ability out of the box to compile them!

Now before you go attempt to install the Windows version of ruby (which is impossible by the way), let me demonstrate how to get automatic compilation in Visual Studio. Just for you, I’ve done the requisite frantic googling, spelunking through StackOverflow comments, and sacrificing to ancient pagan deities, all to find the hidden clue pointing out the right direction.

Because I love you.

app.UseGoogleAuthentication Does Not Accept 2 Arguments - Azure Tutorial

EDIT: 2014-07-03 MSDN just posted a blog shedding light on why this change was introduced. Long story short, Google likes breaking things for you.

If you’re following the tutorial Deploy a Secure ASP.NET MVC 5 app with Membership, OAuth, and SQL Database to an Azure Web Site you may get this error when you get to the Google auth section.

The Problem

The two parameter overload is a new feature in Microsoft.Owin.Security.Google version 2.1.0.

The Fix

You just need to upgrade the nuget package.1

Export a Global to the Window Object with Browserify

Browserify is a pretty slick tool that lets developers use node.js-style requires in their browser-deployed javascript. This gives significant advantages such as importing libraries from the thousands available on npm or being able to run unit tests headlessly in node.

Using a module system like Browserify and require is one of the many techniques that help javascript developers craft modular code that doesn’t accidentally leak variables into the global scope. But sometimes the whole purpose of a library is to do exactly that: export a namespaced set of objects that other scripts can use. If all of the developer’s code is hidden inside a closure and accessed internally through require, how can other third party scripts use the library?

Rollbar Is Pretty Much Awesome

Stop. Just Stop.

At work we use a rather old, homegrown, erratic error reporting system. Basically every error any site or system encounters gets emailed out to the developers mailing list. Everyone has nasty Exchange filters to dump thousands of emails into a PHP Crap folder; emails that are neither actionable nor assignable.

The filters never work perfectly and inevitably filter something they shouldn’t and suddenly all the business folk are breathing down your neck about why the site doesn’t work and you’re left scratching your head and muttering to yourself about how it works fine on my machine, dammit.

Life’s too precious for this.

Benford's Law

The hackernewsletter today linked to the Wikipedia article on Benford’s Law, which is a rather interesting topic.

Benfords Law distribution (Wikipedia) Benford’s Law holds that in many common data sets, the distribution of the first digit of each member of the set forms a gentle curve, wherein about 30% of the numbers start with the digit 1 down to about 5% starting with 0.

I was curious to see what other data sets might fit within this distribution.

Just a few ruby scripts away!

Update OpenSSL for All RVM Rubies

AKA Fix Heartbleed in all my RVM managed rubies.

Assumes you’re using RVM with homebrew as your autolibs.

# Updates OpenSSL and then recompiles and installs all your RVM managed rubies:
$ brew update
$ brew upgrade openssl
$ rvm list strings | while read RUBY; do rvm reinstall --disable-binary $RUBY; done

This will take a while.

After its done, you should be able to run

$ ruby -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"

with each ruby and have it print out OpenSSL 1.0.1g 7 Apr 2014

Brittle Tests Are Testing Things You Don't Care About

I was recently testing the pagination of a certain page on my site. I only wanted to show 12 records at a time. The simple test was to spin up 15 records and then assert that only 12 were assigned in the controller.

models_controller_spec.rb
describe 'pagination' do it 'only shows 12 records' do 15.times { FactoryGirl.create(:model) } get :index expect(assigns(:models).length).to eq 12 end end

Eventually I added a static block of 3 “featured” records to the top and therefore only needed to paginate 9.

I changed the controller and hit save, only to watch my tests turn red.