Author Archives: kevin

About kevin

I write the posts

links for 2011-01-06

  • Lighty, who has fouled out just twice in his college career, now commits bad fouls so infrequently that he can remember each one. He described his worst of the year -- a play in the first half against South Carolina on Dec. 18, where he correctly identified what the Gamecocks were running from the scouting report ("I knew it, and I even called it out," he said) but failed to get in proper position to chase his man off a baseline double-screen. The ref caught Lighty trying a quick grab-move to keep pace. He was forced to watch it again on tape because Ohio State, as a policy, has its players review every foul they've committed.
  • investigation finds vaccine study's author altered medical histories of all 12 of the patients in the original study. meanwhile, the non-vaccination rate in marin county is 7%

Liked what you read? I am available for hire.

links for 2011-01-05

  • 10x programming ability may be a myth, in the industry at least. My first reaction is "then why is everyone so desperate to hire?" Maybe a smaller group of developers that are well rounded.
  • The airline would like to achieve the efficient allocation without leaving you this consumer’s surplus.  That is impossible in a spot-auction because the airline can never know exactly how much you are willing to pay and charge you that. But a hybrid pricing mechanism can implement the efficient allocation and capture all the surplus it generates.  And this hybrid pricing mechanism entails overbooking followed by a departure-day auction to sell back excess tickets.

Liked what you read? I am available for hire.

links for 2011-01-04

  • handy flowchart
  • ideo redesigns the shopping cart in 3 days. amazing. 8 minutes long
  • "We discovered that we could tell what performance group the interviewees belonged to within a minute or two by their attitudes toward people and politics. Individuals who were ranked low by their managers spoke of organizational politics as if it were poison. They were exceptionally annoyed by the people side of the business. They frequently stated they would rather be left alone to conduct their research untrammeled by human emotions. Top performers, in contrast, found a way to work within the political system. They hadn't exactly embraced politics. They didn't come off as glad-handling sales folks. These were professional scientists who were often top ranked in their field. They looked and talked liked scientists. The difference between them and those ranked at the bottom of the totem pole was clear. They had found a way to make peace with organizations, people, and politics. They climbed to the top of their field by mastering both hard things and soft and gushy people."

Liked what you read? I am available for hire.

Disable ESPN Autoplay

I wrote a Google Chrome extension that stops videos and ads from playing automatically on ESPN.com. This is another example of scratching my own itch; most people can enable this feature by clicking Autostart Off on any ESPN video, but I clear out my cookies every time I close Chrome, so that tool doesn't work for me. Also, this is more important for me than other people because I'll click to open three stories at once, and if the videos all begin playing at the same time, it gets extremely annoying. Anyway, here's the extension, all six lines of it in Javascript:
jQuery("#videoPlayer").ready(function(){
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.text = "function check_if_ready(){if (espn.video.player.adPlaying){espn.video.pause();} else{setTimeout(check_if_ready, 100);}}check_if_ready();"
    document.body.appendChild(script);
});
Unfortunately getting to that point took a while; I tried a few other things before I hit on that solution. It's not perfect but it gets the job done. In the future it would be nice to skip the ads entirely, or auto-play only the video in the tab I'm currently watching. You can download the extension here or improve the source code here.

Liked what you read? I am available for hire.

Changes to site RSS feeds

I've moved the links to a separate links page. They won't show up in the main RSS feed anymore, or on the homepage. To subscribe to "Posts," which is everything but links, add this page to your RSS reader: http://feeds.feedburner.com/kburke. If you are already subscribed, you don't have to do anything. To subscribe to links, add this feed to your RSS reader: http://feeds.feedburner.com/kburkelinks. I'm sorry for the trouble.

Liked what you read? I am available for hire.

links for 2011-01-03

Liked what you read? I am available for hire.

Auto-lightbox images in WordPress

I’m starting a new side project, where I’ll have to insert lots of screenshots for each blogpost. I’d like to allow users to enlarge images without having to leave the current page. The best way to do this is with a “lightbox,” which darkens the background and displays the image in the center of the screen.

What I would like is just to post an image to the blog and have the lightboxing and image resizing occur automatically. Unfortunately none of the WordPress plugins let you do this; most of them require you to add an extra link with a special tag. So I wrote this short bit of Javascript which extends a popular WordPress lightbox plugin, Lightbox 2. The script takes an image and wraps an “a” tag around it with the rel=”lightbox” attribute set, which triggers the Lightbox code. It also resizes the image to a maximum of 600 pixels wide or high. Here’s the code:

//get all images inside entry content
jQuery(document).ready(function(){
    jQuery(".entry-content img").each(function(){
//get the URL of the image
        var the_url = jQuery(this).attr('src');
//insert a href before image where rel=lightbox
        var a = jQuery("<a></a>").attr({"href": the_url, "rel": "lightbox"});
        jQuery(this).wrap(a);
        jQuery(this).load(function(){
            var the_width = jQuery(this).width();
            var the_height = jQuery(this).height();
            var max_dimension = 600;
            if (the_width && the_height){
                var ratio = the_width / the_height;
                if (ratio >= 1 && the_width > max_dimension){
                    jQuery(this).css('width', max_dimension);
                    jQuery(this).css('height', the_height * max_dimension / the_width);
                }
                else if (ratio > 1 && the_height > max_dimension){
                    jQuery(this).css('height', max_dimension);
                    jQuery(this).css('width', the_width * max_dimension / the_height);
                }
            }
        });
    });
});

You can also download the file here. To install, edit the header.php file of your WordPress directory and add the following lines above the

<?php wp_head(); ?>

line:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/path/to/img.js file" type="text/javascript"></script>

Then you’re done!

Liked what you read? I am available for hire.

links for 2010-12-30

  • "I view both parties right now as engaged in a colossal game of chicken.  Everyone knows that eventually, we are going to have to do something about the budget deficit.  So everyone wants to pass legislation that will be politically toxic to undo.  The idea seems to be that when the moment of truth finally arrives, the other side will have to make more concessions."  
  • the places chinese tourists visit in europe. really interesting
  • "And with each iteration, the spam gets more subtly targeted, and the spam filters get better at distinguishing human beings from software, in a bizarre parody of the imitation game popularized by Alan Turing (in which a human being tries to distinguish between another human being and a piece conversational software via textual communication) — an early ad hoc attempt to invent a pragmatic test for artificial intelligence."

Liked what you read? I am available for hire.