Hi, I'm Pete Karl. I love semicolons, bulleted lists, lines, boxes, and arrows — I make recipes for the Web.

Articles
Latest

Guide to writing smooth drag & drop Javascript (from scratch): Part I

May 2010

Do you really want to limit your JavaScript repertoire to what you can find in the jQuery plugin library? I'm going to explore (with code examples & practical knowledge) the world of JavaScript drag & drop, and expand what you're capable of. Let's build something completely awesome. From scratch.

see the full post »
Recent

Connect to the Foursquare API via OAuth, Python

Apr 2010

Everyone's talking about Foursquare, and everyone at my office is flipping obsessed. I chose to participate in the nerdiest way possible I guess. The following post will break down (and even explain, kinda) a connection to Foursquare's API using OAuth (and Python).

see the full post »

Updating a LinkedIn Status with a PUT request (using LinkedIn Profile API, Django, Python)

Mar 2010

As part of a recent project, we were asked to set up a system that allowed folks to authenticate using their LinkedIn credentials. We used LinkedIn's Oauth Authentication API, and plugged it into Django's built-in user admin using django-socialauth. I'm writing this short guide because the Internet seems woefully disorganized & underinformed on this topic.

see the full post »

Prevent content copying nicely with a friendly 'no copy' script

Jan 2010

It's miserable. There isn't any way to slice it. Hobbling browsers to keep people from copying your precious content is lame. During my tenure at GateHouse Media (newspaper company), I was asked to create & implement a script that would stop people from copying the content from our articles. "It's ludicrous", I said. If they're driven enough, people will find a way. Why mock them further?

see the full post »

Custom tabbed navigation with coda-slider 2.0

Jan 2010

Believe it or not, this was kind of a pain in the butt. Just enough so that I'm going to belt out a quick blog post about it. It comes down to changing a single line of code in the end, but there are some gotchas I'll share w/you along the way.

see the full post »

Generate Date & Time picking HTML with PHP

Sep 2009

Here's some PHP that generates date & time-picking drop-down menus.

Besides providing someone with a quick HTML-only solution to date/time picking, you can see how I generated the dates using PHP's mktime() and date() methods.

see the full post »
Tweets

Remember that you're not doing it for the money.

RT @aexmo: base64 is like voodoo. the good kind.

#protip If you're not seeing Xcode 4.2.1 after updating from the App Store, it's because you have to run Install Xcode from ~/Applications

RT @terrycavanagh: List of words containing "meow": meow, meowed, meowing, meows, homeowner

RT @bocoup: Announcing Startup Data Trends – open source Backbone.js app for open source Venture Capital : http://t.co/VmyhViFB

The people at @SportelloBoston are incredibly personable and friendly, from chef, to management, to the counter, and the bakery. #delicious

Gentle @jorydotcom issued a pull request on her first day. Bravo!

In honor of my new Twitter background: http://t.co/upJQ7h4t

RT @d6: Some people, when confronted with a problem, think "I know, I'll use multithreading". Nothhw tpe yawrve o oblems.

Comments
Recent
bravo! just used it and saved myself some bother. thanks
Try this for today: $yw_forecast['forecast'][date("D")]['low'][0] and this for tomorrow: $yw_forecast['forecast'][date("D",mktime()+86400)]['low'][0] Hope this helps. Sh
@Richie This is what I did: $item_yweather = $weather->channel->item->children("http://xml.weather.yahoo.com/ns/rss/1.0"); $i=0; foreach($item_yweather as $x => $yw_item) { foreach($yw_item->attributes() as $k => $attr) { if($k == 'day') $day = $attr; if($x == 'forecast') { $yw_forecast[$x][$i][$k] = $attr;} else { $yw_forecast[$x][$k] = $attr; } } $i+=1; }
Hi people. I litle bit expands the code so I have informations about humidity, visiblity, pressure, wind etc. (if someone wanna code, just let me know) All of this are current conditions. I find informations about forecast for today and tomotor like low and high temterature, code for icon etc like this: $low = $yw_forecast['forecast']['Tue']['low'][0]; $high = $yw_forecast['forecast']['Tue']['high'][0]; But there is problem. I have no idea how to automaticly set the day I need. How I can get information that for example today is Tuesday and tomorrow is wednesday and how to write it on code? I try this, but it do not work: $today = date ("D", mktime(0, 0, 0, date("m"), date("d"), date("Y"))); $low = $yw_forecast['forecast']['$today']['low'][0]; Can anybody help me fix this problem? PS: sorry about my english - not my home language :(
Hi people. How to get more info? I use: $text = $yw_forecast['condition']['text'][0]; $code = $yw_forecast['condition']['code'][0]; $temp = $yw_forecast['condition']['temp'][0]; $date = $yw_forecast['condition']['date'][0]; But I like to have something like this too: $day = $yw_forecast['forecast']['day'][0]; $date = $yw_forecast['forecast']['date'][0]; $low = $yw_forecast['forecast']['low'][0]; $high = $yw_forecast['forecast']['high'][0]; $high = $yw_forecast['forecast']['high'][0]; $text = $yw_forecast['forecast']['text'][0]; $code = $yw_forecast['forecast']['code'][0]; But I cant fix it. anything about ['forecast'] comes back empty. Can anyone help to amateur coder to fix it? Thanks a lot :)
Hi, first of all.. thanks for giving an alternative to the default settings... And I have a question hoping that somebody can help me. I have the slider working on pages that are by themselves, but I want to load them in what would be a "master" page through AJAX. Thing is that the slider stops working with it's coda-navigation when doing so... I've tried injecting the coda-slider.js through a function with livequery, and I know that it gets applied because if I set the dynamic arrows to false, they appear and the slider works... but I really need the nav to do the working for I want to use some thumbnails. Well, thx again
Thanks for this, very useful! One issue so far; I couldn't run searchd at first, I was getting WARNING: index 'search_test': preload: failed to open /Users/art/PycharmProjects/test/sphinx/indexes/search_test.sph: No such file or directory; NOT SERVING FATAL: no valid indexes to serve but just had to run the indexer first and then it was fine.
Has anyone managed to get their youtube videos to stop when a user selects a new panel? ive been searching for days without luck.. :/
Does your sever support cURL?
Thank you for the excellent code. Works just fine