August 22nd, 2011 Posted by Don Albrecht
Today I stumbled across a handy little javascript framework called accounting.js. Like the handy date.js library. It focuses ongoing one thing extremely well. Convert numbers between simple strings of digits into nicely formatted easily readable strings.
it has just a few functions.
formatMoney()
by default, format the string to USD with 2 decimal places, comma separation at the thousands and a $ sign. Optional params of [currencySymbol], [precision], [thousands separator], [decimal separator].
formatColumn()
just like formatMoney, but it takes an array of values and white space pads their conversions to the same length.
unformat(string)
parse a given number formatted string and return its numerical value.
Joss Crowcroft’s Original Blog Announcment is here:
http://www.josscrowcroft.com/2011/code/my-weekend-project-accounting-js/
And the GitHub site is here:
June 19th, 2010 Posted by Don Albrecht
Earlier this week, I discovered that Safari doesn’t support dates in ISO 8601 UTC combined format: “2010-06-19T03:11Z”. This was a problem as my production system was delivering me a json file with dates in this format and my project was simply a new UI for the existing server. A quick round of googling found DateJS a powerful chainable Date extension that enables both unified parsing and mask based date rendering. I’d only played with it for a few minutes before I was completely hooked on it. Just look at what it can do.
1: // What date is next thursday?
2: Date.today().next().thursday();
3:
4: // Add 3 days to Today
5: Date.today().add(3).days();
6:
7: // Is today Friday?
8: Date.today().is().friday();
9:
10: // Number fun
11: (3).days().ago();
12:
13: // 6 months from now
14: var n = 6;
15: n.months().fromNow();
16:
17: // Set to 8:30 AM on the 15th day of the month
18: Date.today().set({ day: 15, hour: 8, minute: 30 });
19:
20: // Convert text into Date
21: Date.parse('today');
22: Date.parse('t + 5 d'); // today + 5 days
23: Date.parse('next thursday');
24: Date.parse('February 20th 1973');
25: Date.parse('Thu, 1 July 2004 22:30:00');
And Yes It supports ISO 8601 UTC combined format!.
A quick replacement of my existing date toolkit in the project and my bugs were fixed.
March 23rd, 2008 Posted by Don Albrecht
Firebug and its kin are awesome for debugging javascript, but once our scripts are in the wild we really don’t have any feedback of any kind about the state of the browser. DamnIT from JupiterIT attempts to alleviate this by providing an automated feedback system for javascript applications.
How it works:
- A box appears prompting you to describe your most recent actions:

- One of the following occurs:
- you type something and click send
- you click “close”
- 10 seconds pass with you doing nothing
- DamnIT emails you the following information:
- Browser
- Page
- HTML Content
- Description (if you entered one)
- Error message
- File name, line number, and stack (if the browser supports them)
On the surface this is an incredible system. In practice there are a few key issues that I think need addressed before the product is an ideal fit for every situation. Basically, I have severe reservations about the email only nature of the system and its dependence on central management. Both of these are key issues when dealing with sensitive information or large volumes of error messages and I’m sure will be addressed with future versions. I am going to integrate the system into the next release of BLT and will be providing feedback from those efforts in the near future. In the short term, you can check out DamnIT here:
https://damnit.jupiterit.com