29. September 2014

Pay the Piper

Pay the Piper

Today, I’m announcing the general availability of Pay the Piper, the Google Chrome Extension that puts your todos to work — fighting distractions!

If you’re at all like me, you probably keep a task list somewhere. There are phone calls to make, books to drop off at the library, emails to send. Nothing terribly difficult. You also on occasion find yourself idly surfing the web. You know, just taking a break from your work.

Somehow, when it’s time to go home, you realize that none of your small tasks got done. How is this possible? How did you choose to look at one more cat video instead of crossing one small thing off that list?

Wouldn’t it be great if, at the moment you were about to be distracted, you could be reminded to look at your todo list? Even better, wouldn’t it be great if you could see the next thing you were supposed to get done?

Pay the Piper keeps you productive by making you “pay” to visit distracting sites. The cost? One completed task from your task list.

Pay the Piper protects you from your own bad habits by keeping you away from sites you know are distracting and focusing you back on your task list. Like a web blocker, you decide what sites are distractions to you, and Pay the Piper prevents you from viewing them. Unlike those other blockers, Pay the Piper replaces the distraction with a task from your task list. Completing any of your tasks grants you a few minutes to browse the distracting site. Hey, you’ve earned it!

Pay the Piper was built to augment the power of the todo.txt system and its Android/iOS apps. If you are a todo.txt user and your files are stored on Dropbox, Pay the Piper can use that task list as its source. But don’t worry if you don’t store your tasks there — you can also create your own list inside of Chrome. Thanks to the power of Google Chrome Sync, all of your logged in Chrome browsers will share the same task list.

“I got things done this weekend that I didn’t think I would have!” — Jessie Rymph, founder, Works Progress Seattle

 
Pay the Piper on the Google Chrome Web Store

Comments

21. August 2014

Todo.txt JavaScript parser

My current todo list is a simple text file using the popular todo.txt format. Along with the Android app, I’m able to keep track of my tasks in a simple format that I can access on the go.

Lately, I’ve been hard at work on a new project that I hope to announce in the not-too-distant future. The project involves showing todos in a Chrome extension, and I wanted to be able to support todo.txt files as well as plain old text files.

This isn’t the only Javascript implementation of the spec, but it was such a nice, contained project that it seemed like a good chance to reinvent the wheel. The result is pure JavaScript using lessons gleaned from the classic JavaScript: The Good Parts, and was developed TDD-style using Jasmine and Karma. Enjoy!

todo-txt-js on GitHub

Comments

29. May 2014

VB - The Good Parts (for C# peeps)

GW Basic. Remember it? -- from WikiPedia: (http://en.wikipedia.org/wiki/File:GW-BASIC_3.23.png)

There’s a great book on JavaScript called JavaScript: The Good Parts that every frontend developer should own. It does a great job of highlighting both the bad and good facets of the language. In that vein, here are some handy tips about VB to help you, intrepid C# programmer, find success.

1) Ignore the logical operators And and Or. These operators do not short-circuit, so an expression like

If a IsNot Nothing and a.Foo > 3 Then Debug.WriteLine("booo")

will give you a NullReferenceException. Instead use AndAlso / OrElse.

If a IsNot Nothing AndAlso a.Foo > 3 Then Debug.WriteLine("yay")

2) IsNot adds a touch of readability. Compare:

If Not a Is Nothing Then ...

vs.

If a IsNot Nothing Then ...

It’s more like natural language, which is VB’s appeal after all.

3) Avoid IIf() for ternaries. Instead, use If(). The former is not a part of the core language so much as a built-in function, and all of its arguments are evaluated:

Dim x as Integer = IIf(a IsNot Nothing, a.Foo, 0) ' NullReferenceException because a.Foo is evaluated

The latter, added in VB 9, maps to the same ternary operator that ?: does in C#.

Dim x as Integer = If(a IsNot Nothing, a.Foo, 0) ' Proper short-circuiting = no problem!

4) Nothing is not null — it’s default(T).

Dim str as String = Nothing ' This is null.
Dim lng as Long = Nothing ' This is 0.
Dim dt as DateTime = Nothing ' This is DateTime.MinValue.
Dim dt as DateTime? = Nothing ' This is null again!

Personally, I’d only use Nothing as a synonym for null and avoid the other usages.

5) Remember, Is is for comparing object types, while = is for comparing value types.

Dim obj as Object
If obj = Nothing Then Debug.WriteLine("boo") ' Error: obj is an object
If obj Is Nothing Then Debug.WriteLine("yay") ' Will work
Dim dt as DateTime
if dt = Nothing Then Debug.WriteLine("oy") ' Also will work... but didn't I just say to not do this?
if dt = DateTime.MinValue Then Debug.WriteLine("you're learning!") ' Much better

Comments