Negative Margins Adventures in css, javascript, and all things web


2
May/10
1

Automatically run phpunit tests with Kicker on OS X

Here's a quick tutorial on how to use Kicker to automatically run PHPUnit tests on OS X. Kicker uses OS X's filesystem events to automatically run a command after a target directory or file is changed. Better yet, after the command is run it will Growl the results for you!

  1. First, install Kicker: sudo gem install kicker
  2. Next, switch to your tests directory
  3. kicker -e "phpunit Bundle/SomeBundle" Bundle/SomeBundle/ ../src/Bundle/SomeBundle/

The Kicker command structure is the command to be executed, followed by the directories or files to be watched. In my example, the tests in the SomeBundle directory are run and if any file in the test directory or the src directory are changed the tests are run. When phpunit finishes running a growl notification will be made. Using the Growl control panel, you can change the types of growls that are produced on either successful or failed tests. I like the Music Video display style.

Special thanks to my coworker Justin for pointing this out.

3
Dec/07
0

Have a javascript or css question?

I spend 40+ hours a week knee deep in javascript, css and php, but lately mostly javascript and css. I'm responsible for making everything over at www.lijit.com not only provide a great user interface, but work in Firefox, Internet Explorer 6/7 and Safari 2/3, I never seem to have the time to get to Opera =-\

That being said, I've dealt with all manners of javascript and css trickery. Granted, I use prototype and scriptaculous to do most of the heavy lifting. None the less,  I feel qualified to answer all manners of questions in this space. So, ask away: @ me on twitter: http://twitter.com/cranberyxl, This way we can keep the answers out in the open, and if I don't know the answer, may be someone else does. I fI cant' answer in 140 characters, I'll link to a blog post back here.

Filed under: General
2
Oct/07
1

PHP: Mixing SimpleXML and json_encode

Recently, I've been doing a lot of work with XML and json. One small problem I ran into was assigning SimpleXML variables to a class variable and then running it through json_encode:

"pageLength":{"0":"10"}

The simple solution I came up with, but which were not readily apparent in the documentation is that you need to simply cast the SimpleXML variable to a string or int.

$object->pageLength = (int)$xml->element;

which produces this json:

"pageLength":0

Hope this helps someone else save some time.

14
Aug/07
3

Post Gnomedex Post

After a week on the road, culminating with Gnomedex 07, I'm back in the office. Molly and I spent a week in the northwest where we were able to visit her family. We then took a train up to Seattle for a weekend of conference fun. The trip home was a convoluted collection of planes, trains and automobiles spanning three states and taking over twelve hours.

Once in Seattle we met up with Stan, went to the mixer and Gnomedex was on. After spending the past few months hanging out in Chris Pirillo's live chatroom, it was a pleasure to finally meet him and his wife Ponzi in person. They put on a wonderful weekend where the field is very level and you are equally likely to get into a conversation with a new blogger or a seasoned blogger like Robert Scoble. The presenters provided a wide variety of topics covering everything from open money to elder blogging.

It was really cool to meet some of out users who are doing cool things with Lijit. Deepak Singh has found some really cool academic uses that he writes about here. Of course, there were people that knew our fabulous evangelist Tara, like Tajee, a Japanese video blogger. Perhaps I can use her videos to learn a little Japanese. It was wonderful to be surrounded by people that understood what we do, where the odd Web 2.0 lexicon that we've developed was okay to use. I think Chris Brogan really understood and did a nice write up that has turned a few heads our direction. I'm very excited to see where things go.

I definitely look forward to going to Gnomedex 08, seeing old faces, and meeting new people. Stepping outside of Boulder and our developing tech scene and into a room full of people from the Valley was very energizing, but now I've got a lot of coding to do.

Filed under: General
26
Apr/07
0

Make mp3s remember their position like podcasts

I'm sure many of you noticed that when Apple rolled out the Podcasts section in iTunes, that podcasts remembered the position they were last stopped (unless they played through completely). I've often foudn myself wishing that other mp3s did this. For example, a podcaster might release an optional audio file, not in their normal genre, which they offer for download on their website. I'll find myself listening to said mp3 and without thinking, I might jump to another file or close iTunes. I'm trained, when listening to spoken word, to be able to pick up where I left off. Well, low and behold, apple does offer this feature for all files.

Single File

  1. Select the file you want to edit
  2. Right click on the selected file (ctrl-click Mac) and Choose Get Info
  3. Choose the Options tab
  4. Select remember playback position
  5. Click OK

Multiple File

  1. Select the files you want to edit
  2. Right click on the selected files (ctrl-click Mac) and Choose Get Info
  3. If prompted about editing multiple files, select Yes
  4. At the bottom of the dialog box change Remember Position to Yes, and check the box next to it
  5. Click OK

Now, the tracks the you selected will remember their playback position, just like podcasts.

Filed under: General
2
Feb/07
2

Javascript IDE and Firefox

Where is the javascript IDE? I know that you can use Eclipse, TextMate, Notepad and other such programs to edit javascript, and that more often then not said javascript is generated in the context of another language (php, ruby, java, or even .NET). I think that there could be huge potential for a Firefox addon that acted as an editor. Firebug is already most of the way there at 1.0. Could we join the missing link between Firebug and Notepad? /drool

2
Feb/07
0

Prototype Website and Documentation

At the risk of repeating news, and reporting it late at that, in internet time at least, and using too many appositives in a sentence, prototype has finally gotten documentation!

According to their website:

Prototype is a JavaScript Framework that aims to ease development of dynamic web applications.

Basically, it aims to take a lot of the common functions that web developers use, finding elements on a page, making ajax calls, writing classes, etc and wrap them into a library that worries about the various browser implementations of javascript so that you don't have to.

Prototype has recently been officially released as version 1.5, up to now there had been a few release clients. As part of the release they have released a website at prototypejs.org that finally includes a central place to view API documentation and discuss how you use prototype with other developers! Additionally, the people at Global Moxie have made the documentation available as a pdf for easy printing and offline reference. Great work!

29
Nov/06
0

Widgets vs RSS and Feed Readers

As we work on the next phase of development at Lijit, we have been thinking a lot about widgets, or wijits as we call them. Steve Rubel writes about widgets transforming blogs into start pages. I think this is a great idea, but then I started to think about how many people read blogs. Most serious blog readers use a news aggregator of some sort, either a desktop client or a web based reader. These feeders consume RSS and therefore don't benefit from widgets or advertising mostly for that matter, but FeedBurner is working out ways around this.

This brings me to wonder what will win in this space. Will users find enough value from the widgets on a blog page to venture outside of their newsreaders? Will content producers continue to syndicate their entire posts? Will a happy medium be found where newsreaders and home page destinations equalize? Will someone discover how to integrate widgets into RSS? It will be interesting to find out.

Filed under: General
12
Oct/06
0

IE, Why must you persecute me!?

As the CSS at lijit.com evolves I find myself continually up against the uncompliant Internet Explorer. The flavor this week is min and max width height. As you may or may not be aware the truly standards compliant browsers allow you to set both min-width and max-width properties to give you the ability to have a fluid layout appropriate for multiple monitor sizes. After a little research I found out that IE does support javascript from within CSS of all things. This allows you to keep track of the size of the window and hack in changing the size of your element. The first solution I found was over at svendtofte.com showing this code:
[css]
#element {
width:expression(document.body.clientWidth < 800 ? "800px" : "auto");
}
[/css]

I thought this was a pain, but it worked, so I extended it to handle both min and max:
[css]
#element {
width:expression(document.body.clientWidth < 800 ? "800px" : document.body.clientWidth < 1200 ? "1200px" : "auto");
}
[/css]

I figured I was all set, then I played with it in IE and wham, it froze. After more research and I found a post at cameronmoll.com indicating that using this method can introduce a race condition and infinite loop in IE. The solution, change your math slightly!? *sigh* So, here's the final working CSS that will be introduced in the next Lijit release that will give you a fluid layout between 800 and 1200 pixels:

[css]
#element {
min-width: 800px;
max-width: 1200px;
width:expression(document.body.clientWidth < 800 ? "800px" : document.body.clientWidth < 1200 ? "1200px" : "auto");
}
[/css]

28
Sep/06
0

Old School

I used to own cassettes, make them for my friends, and listen to them in my car. Today I discover that the fine people over at says-it.com have produced the Cassette Generator, another in their line of pages that make cool graphics to post on your blog, send to your friends, or whatever.

I found out about this by looking at my Lijit List, the first page I see at lijit.com. Someone in my trust network had reported on it, others had picked it up and when I logged in this morning there it was at the top of the list. Because I trust these people and they trust others I get a filter on web content that I trust. If you like what I like, you to can trust me just click on this Trust Me" button on the sidebar, or for one post only, the cassette tape below.


(When will our children be doing this with CDs?)

Filed under: General, lijit