June 2011
1 post
Sass and Sprockets for Rails 3.1 →
I blogged!
August 2010
1 post
Setting up a new work laptop
* Chrome
* Firefox
* Firebug
* Web developer tools
* Alfred
* TextMate
* AckMate, GetBundles, ProjectPlus
* GitX
* Inconsolata
* Homebrew
* Xcode and the iOS SDK
* Git
* Ruby Version Manager
July 2010
1 post
iPhone Pull to Refresh - Leah Culver's Blog →
February 2010
1 post
Probably shouldn’t have multiple people switching tags in the same directory on a development server, but I still need to a place to put this:
chown -R :Domain\ Users . && chmod -R g+w .
January 2010
1 post
Things I should have already known but instead...
string.match(regexp) and regexp.exec(string) don’t do the same thing when it comes to global pattern matching.
event.currentTarget is the element that is listening to the event, so you don’t have to rely on this.
The beforeunload event.
The difference between keyCode and charCode.
How cookies work (!)
This list will grow.
December 2009
3 posts
Similarly ...
$.fn.tallest = $.fn.tallest || function(outer, margins) {
var fn = outer ? "height" : "outerHeight";
return Math.max.apply(Math, $.map(this, function(el) {
return $(el)[fn](margins);
}));
};
$.fn.widest = $.fn.widest || function(outer, margins) {
var fn = outer ? "width" : "outerWidth";
return Math.max.apply(Math, $.map(this, function(el) {
return $(el)[fn](margins);
}));
};
EDIT:...
I keep writing this
$.fn.maxWidth = function(outer, margins) {
var o = 0, i, l;
for (i = 0, l = this.length; i
Edit: Wow, I went months before realizing that these didn't actually work. Fixed.
June 2009
3 posts
From a colleague working on a site audit:
<div class="SeoSection">
<!-- Search Engine Optimization //-->
<h1>Overview</h1>
</div>
Some math
Spreadsheet 1: 1562 rows x 2 prototypes
Spreadsheet 2: 2744 rows x 2 prototypes
Spreadsheet 3: 815 rows x 2 prototypes
Add it all together and I have to copy and paste 10,242 links into these templates for user acceptance testing. Shoot me now.
May 2009
5 posts
“Developing an Accessible Web 2.0 Widget... →
My next project is the main navigation for an ecommerce site that’s had a history of problems with accessibility. They’re also very design-focused, so we’ll need to redevelop standard UI controls to make them look prettier. ARIA will play a big role in this.
This video is long and slow, but definitely has a lot of great information about developing for accessibility, including...
Worst. Project. Ever is almost over.
In the meantime, I enjoyed exploring the JavaScript architecture ideas from Jim Benton and Yehuda Katz. I have a simple state machine going, and it has some nicely declarative logic definitions. I need to see how well it scales to the type of UI work we tend to do here.
Today, I’m working:
in a Java/Maven environment in Eclipse for mac, off of a Viacom VPN, porting over static code from another Subversion repository,
on a borrowed Dell laptop in XP working mainly in MS Office on a proprietary Microsoft mobile platform on an extra-slow Microsoft VPN,
on my work iMac, but mostly just to use Outlook in Windows XP in VMWare,
and I’m escaping to my...
var a = 'You can start here \
and continue here \
and then finish it up here.';
via Snook
Case in Point Regarding Naming Anonymous Functions
Needed to optimize a new feature on an old YUI site:
After running the YUI source through a couple find-and-replaces, I got this:
And the problem was obviously a bad implementation and usage of getElementsByClassName.
The patterns:
Pattern
Replacement
([A-Za-z0-9]+) = function
$1 = function _$1
([A-Za-z0-9]+): function
$1: function _$1
Edit: posted at the same time on Ajaxian.
Edit...
April 2009
7 posts
Understanding Git Conceptually →
Reading this felt like reading for classwork again, but it is very well written and totally convinced me to start using git instead of svn for some things.
Name all functions, especially ones that are typically anonymous:
$("a").click(function linkClickHandler(e) {
$("b").each(function bIterator() {
// an error or expensive operation happens here
});
});
Your stack traces and profiling logs become much more descriptive. (via)
Useful Textmate tricks for CSS
Cmd-shift-C opens up the Apple Color Picker. If you already had a hex color code highlighted, it shows that color.
For box model math, I like to do this:
div {
width: 88px; /* 100 - 5 - 1 - 5 - 1 */
padding: 0 5px;
border: 1px solid #000;
}
But sometime my brain doesn’t want to handle that math. But if you highlight an math expression and hit Ctrl-shift-C, you can have Textmate...
The next iteration of my low budget CMS idea
Everything is wrapped in a basic layout.
Plain text files for pages (“content”) in YAML or XML (YAML for now because XML in PHP sucks).
Map urls to the content files, so that the url structure reflects the file system.
Content files have metadata (page title, etc), sprinkled throughout the layout.
Content files also have arrays (“sections”) of data structures (“components”).
Components are...
Made a site a year ago. Need to roll out the international version, but it’ll use a completely different CMS. So we’re screen-scraping the current PHP site to make static HTML templates for the Java guys to implement.
Yikes.
Well this looks super-useful... →
New evolution of my JavaScript pattern
Doesn’t take inheritance into account, but it does a lot of what I want in a basic class.
var Namespace = window.Namespace || {};
Namespace.Foo = function() {
/* --- CONSTANTS --- */
var CONSTANTS = {
A_CONSTANT_VALUE : 1
};
// shorthand reference
var C = CONSTANTS;
/* --- STATIC VARIABLES --- */
var STATIC = {
instances : [],
canBeOverridden : "bar"
};
/* ---...
This dock type thing. →
Uses easing equations to interpolate values over a curve, and proxy objects to use parallel animations without over-active repaints and flickering.
March 2009
5 posts
Command-line Fu < The best UNIX commands on the... →
Code Graveyard
Developed a template I shouldn’t have. Again.
var CollapsableList = function() {
var COLLAPSED_CLASS = "collapsed";
function init(container) {
if (! container.data("collapsableList")) {
container.data("collapsableList", new instance(container));
}
};
function instance(container) {
this.container = container;
addBehavior(this);
};
instance.prototype = {
find :...
Time wasting bug #1
@media print {
/* These styles won't be applied */
}
<!-- if you specify a media other than "print" or "all" in HTML: -->
<link rel="stylesheet" type="text/css" media="screen" src="sonofabitch.css" />
How FriendFeed uses MySQL to store schema-less... →
I wanna see how this would work as a Rails datastore.
February 2009
3 posts
Easiest optimization ever
In jQuery:
$("#container").append(element1).append(element2).append(element3);
is orders of magnitude slower than:
$("#container").append(element1, element2, element3);
I didn't know rails app templates were so... →
JavaScript Audio Player Notes
Patterns
I’m using a weird combination of the module pattern and function prototypes. This lets me declare most methods as just functions scoped inside the module, while still having a new-able object to create. I like the idea of adding methods to the prototype because it only happens once.
var ClassFactory = function() {
var instance = function() {
};
instance.prototype =...
January 2009
9 posts
Switching from scripting languages to Objective C... →
via Keegan.
UIKit/CoreGraphics vs. AppKit/Cocoa →
Memory Management Programming Guide for Cocoa:... →
Another link I wish I’d found a long time ago. Almost need a quiz on its contents to solidify it in my memory.
PrEV | Demystifying iPhone App Startup →
I figured out a lot of this on my own but this would have saved me a lot of trouble.
Today I finished the core functionality of my first from-scratch iPhone app. It’s a budget forecaster that helps me estimate how much money I’ll have at the end of the month, and if I ever will hit rock bottom.
It’s a navigation controller and four views:
The main view shows how much money you start with, where it’s going, and what you’ll end with
The second view...
Good iPhone class resources →
A full week of Cocoa/iPhone development
EXC_BAD_ACCESS means that some data was garbage-collected or lost in someway before it was access. Check to make sure it was explicitly retained. Setting an instance variable doesn’t seem to retain it, but using a setter does. This was helpful.
When you’re loading a view from a nib, don’t change any UI elements until viewDidLoad
Spent the last two days working through this book. Objective-C is weird but I kind of like it. It’s sort of a joy to turn on “:”-aware tabbing and have the method signatures line up in this weird way.
After a break, I tried rewriting sifr3 again using method 2 from the previous post. It took about two days. The most significant bug was that jQuery calculated the height and width of the replaced nodes incorrectly. I didn’t get to using the jQuery flash plugin and there’s a lot of clean up that could be done, but it turns out Richard had beaten me to the punch and rewritten it as...
December 2008
8 posts
I’m trying to figure out how to tackle rewriting sifr3 to remove redundancies with jQuery and reduce file size. I’ve tried two different tactics:
Remove a component of code, like the query selector engine, and replace all the calls to it with jQuery. It worked great for the query selector, but completely fell apparent when I switched over all the DOM methods. Too much rewriting since...
Forgot to mention this:
Took a look a the BrightCove JavaScript API and briefly evaluated it for a Flash developer here. Here are my notes:
It looks like a pretty solid API. I guess it’s only meant for a single player in the page, since you don’t have any control over how the scripts initialize. As long as the JS files are included, it grabs the tag and creates the player. Even...
Weird bug:
Conditions caused by a mouse move event change the window.location. Since jQuery removed all the event listeners, the <a> tag loses the preventDefault() on mouseup and fires after the new page loads, returning the user back to the old page.
Answer: don’t use an <a> tag or remove the href value from it.
First Cocoa app idea: an unobtrusive time tracker app. Call it with a key command like Quicksilver, type to find the task. Maybe make an iPhone version too.
5 projects today!
Dell prototyping
Turner Resources image tweaking
Yahoo/eBay API research
Target Scoping
Dell microsite maintenance
Plus read a chapter or two of the Cocoa book
Things to do
Create the project build/commit/test/validate script bundle discussed yesterday
Learn Objective-C and Cocoa
Learn YUI 3
Build the holy grail of carousels
Keep biking to work so that I eventually stop getting so tired by the end of the day
Notes on broadly scoping projects:
Make a list of all assumptions. There will be a lot of them.
Compare how long it took to develop a similar component, and estimate the difference saying that it’s only 80% as complicated, or 150% as complicated.
Attended a brain storming session for a mobile app! Really exciting and I hope we get to develop something.
Idea for something I really...
Not much happening this week, but I gave a code review on my JS eBay API wrapper for yahoo widgets. No one had really looked at the code, so it wasn’t terribly successful. We talked about the correct indenting on switch statements mostly.
November 2008
9 posts
Had to break out my part of the project into an isolated example and test if the character encoding problem was a part of the environment or … something else. It wasn’t my code, that’s for sure. =) Fortunately, we received a new build of the environment that apparently fixes the bug. Now we can make eBay Trading API calls and it won’t complain that we’re not using...
Getting the current static IP in JS
Make a request for checkip.dyndns.com
Regex out the number
Profit
var ipAddress = request.responseText.match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/);