How to install git and gitk on Bash on Ubuntu on Windows 10

gitk on Bash on Ubuntu on Windows 10You may have heard about “Bash on Ubuntu on Windows”. If not, you can check out my post on Bash for Windows 10.

First, you’ll need to make sure you have the Windows 10 Anniversary Update, which you’ve probably received automagically by now.

Then, you’ll need to manually install Bash on Ubuntu on Windows to get your bash prompt.

When you’re done, you’ll probably listen to Microsoft when they say “no GUI stuff!” on bash… But actually, you can set yourself up with a lovely development environment including git – and even gitk – right in Windows.

And it’s much easier than you might think…

(more…)

The Windows 10 Summer Update will include… Linux?!

Ubuntu Bash + Windows 10This summer, Windows 10 will be 1 year old. Microsoft recently announced that they’ll be releasing another “major” update for their latest OS around this time.

Most of the new features are nothing terribly earth-shattering. Probably the most impactful change to most users will be a slight modification to the Start Menu.

For power users, however, they’ve got something rather big planned: Windows 10 will soon include the Ubuntu Linux Bash shell (probably as an optional app/download).

What in tarnation is going on here?!

(more…)

How to add an EU Cookie Consent popup to your web site

Cookie Consent / IdiocyCookie Consent laws: you have surely seen them.

You go to a site, and you get a popup or bar at the top of the site that says, “We use cookies, blah blah blah…”

There is usually a “Learn more” link, and sometimes a way to accept or reject that site’s use of cookies.

The reason for this is a very stupid law implemented in the European Union that is supposed to protect people from… well, actually, it doesn’t protect anyone from anything. Okay, technically, it protects you from your sanity.

Especially if you use Google Adsense to put ads on your web site, you probably have received an e-mail from them telling you that you must have a Cookie Consent thingie on your site by the end of September 2015 in order to comply with yet another EU cookie law.

Right, so, how do you add cookie consent to your site – quickly and easily?

(more…)

Understanding Embed Codes

Embed CodesYou have probably encountered embed codes before, but they may seem like a bit of a mystery.

An embed code is, in short, a bit of HTML that allows you to embed part of another web site on your own – like a YouTube video, for example.

Embed codes come in two general flavors these days, and each has its strengths and weaknesses.

So, how do embed codes work? Why are some hugemongous, and others teeny-tiny? Are iframe tags really the spawn of the devil?

Read on!

(more…)

I shared a link on Facebook, but no image shows up

Sharing an Image on FacebookAh, yes. Facebook and images!

You know the drill: You share a link, and you expect that an image from the page you shared will show up.

But, it doesn’t.

This is especially true if you’re sharing a link from a lesser-known site, like perhaps your own blog or online store.

Fortunately, there are a few tricks you can use to make Facebook – and other social networking sites – happy.

(more…)

JavaScript Fun: Looping with a Delay

JavaScript is Awesome!If you’ve ever programmed something in JavaScript, you most likely ran into a situation where you needed a delay.

Normally, we do this with setTimeout().

For repeatedly calling some function every X milliseconds, one would normally use setInterval().

Well, that’s fine. But what if you want to so something 10 times, and delay 3 seconds between iterations?

The solution is not as obvious as it appears…

But it is simple!

(more…)

Varnish: Remove all Cookies EXCEPT the ones you want

COO-KIES!

COO-KIES!

So, you’ve got a web server. It’s slow.

So, you optimize your app, and implement some caching. It’s faster, but not fast enough.

So, you decide to use Varnish, the popular reverse-proxy web application accelerator. It doesn’t work.

The reason it doesn’t work is that on your web site, you’ve got all kinds of Javascript-based goodies, like Google Analytics, or maybe embedded videos that set tracking cookies, or maybe things like AddThis that also set client-side cookies.

Well, client-side cookies are for the JS on your site; your application doesn’t actually care about them. BUT – and this is an annoying “but” – if those client-side cookies are set for “yourdomain.com”, then with every single request a reader makes to your server, those cookies are sent along.

And that means Varnish won’t cache anything, because it says, “Cookies?! EEK! No caching!”

So, how do you make Varnish happy with only the cookies that you want to keep?

Read on…

(more…)

How to Program Smarter Without Staying Up Until 4:00am

I just read an interesting article at BusinessInsider.com entitled Why Programmers Work at Night.

The article explains why programmers generally tend to prefer working in the wee hours of the morning.

Programming requires keeping a lot stuffed in your brain at once, and thinking about all of it all at once. This task can often be a tad difficult under normal work/life circumstances.

In short:

This is why programmers are so annoyed when you distract them.

Because of this huge mental investment, we simply can’t start working until we can expect a couple of hours without being distracted. It’s just not worth constructing the whole model in your head and then having it torn down half an hour later.

In fact, talking to a lot of founders you’ll find out they feel like they simply can’t get any work done during the day. The constant barrage of interruptions, important stuff to tend to and emails to answer simply don’t allow it. So they get most of their “work work” done during the night when everyone else is sleeping.

If you have ever programmed anything, you understand the above 3 paragraphs perfectly.

Still, there is a better way…

(more…)

Ruby 1.9.3-p362: “Stack level too deep” Error Message is a bug?

Ruby 1.9.3-p362 Broken?Oopsy!

On 25 December 2012, Ruby version 1.9.3-p362 was released. Is that dedication, or what?

Yesterday, I decided to upgrade to this new version of Ruby that contains only bug fixes.

Bad idea.

Sure, the site loads… But if you try to create a new record via the front-end UI, it craps out with an Internal Server Error.

Digging a bit deeper, it seems this new Ruby version causes a “stack level too deep” error in /active_record/transactions.rb – at least when using Rails 2.3.x.

So, how do we fix this little problem?

(more…)

Sublime Text: A Programmer’s Text Editor for the Rest of Us

Ya know, I program a lot. I also create a lot of web sites. So, having a good text editor is kind of essential.

For the longest time, I’ve been searching for a good programmer text editor like TextMate.

Unfortunately, I shun Macs like the plague since I can build better, faster, more reliable puters myself for 1/3 the price, so TextMate wasn’t an option. And I most certainly will not run a hacked version of OS X just to get TextMate!

At first, I used jEdit. It’s okay, but not quite what I was looking for. Then, I switched to NetBeans for my Ruby on Rails stuff, and Notepad++ for everything else. Well, that worked okay, but NetBeans RoR support is pretty lacking these days.

Furthermore, I wanted to get the heck away from these darn Java-based text editors. That’s really just silly.

Enter Sublime Text 2!

(more…)