CogBlogged Tagged ‘code’

Building WordPress Admin Tool for Building Daily Creates

Last January, Tim Owens did a masterful job of assembling the Daily Create site out of a premium theme (Salutation), a mix of plugins (including Awesome Flickr Gallery, Tubepress, and Gravity Forms), etc– and no custom code. When I arrived at UMW in February, I offered to take over the creation of the challenges. It is a mix of ones submitted by our site users, borrowed ones from the Daily Shoot, b3ta Challenges, the Vancouver Draw Down, and the 30 Day Drawing Challenge, plus about a good 30% we just dreamed up. Creating them turned out to be a bit tedious as there was at least 7 different things to set on the interface. We had to have them, scheduled in advance, each to be published at 10:00 am EST. (1) The title would be present if it was submitted via a form; for one from scratch it is entered/pasted. [...]

(see the full barking...)

CogDogCodeAcademy: A Random Freesound Generator

Who needs a stinking academy to provide a code challenge? With some basics under the belt (which of course you cannot do without) and google (which usually lands you at Stack Overflow), you can tinker away. Well, I can. Here was a tool I whipped up in about 10 minutes, and then spent about another hour futzing with the CSS. It generates a search on a random word at freesound.org all in JavaScript. This all started during tonight’s live stream of ds106 with Jim Groom, who was showing the results for people in cvlass and afar who did the sound effects story challenge. Michael Branson Smith, being a not-follow-the-rules artist, did not aim to do a connected story, but used all of the ones he got as a search on the word “fire”. He felt there might be a sound assignment on using a random search at freesound.org and I [...]

(see the full barking...)

From the CogDogLab: Pechaflickr

Here is a new toy to play with- announcing Pechaflickr, the pecha kucha + battle decks + flickr mashup. Type in a tag, click “play”, and you will be served up 20 random flickr photos, displayed each for 20 seconds. The idea is to have people practice the art of improv to a set of never before seen images, and try to make sense of it. I owe the idea to Giulia Forsyth, who days before 2011 Northern Voice tweeted me asking if there was some way to make Five Card Flickr do something like this. My first, lame response was going to be: Yeah, do 5 Card flickr 4 times ;-) But I thought this might be fun to do. My first round was a build off of the same code that I wrote for 5 Card Flickr, because all of the image data for the tags read in [...]

(see the full barking...)

More Code Fun: Reading (or ‘to Read’) List

While I’m on the code doc kick… this one is not mine, but something I applied on my site. A week or so ago I came across (from RSS feeds? nah, I think it was in twitter? maybe a squirrel stepped o my keyboard?) Steph Gray’s Reading: keeping on top of stuff I save, some code he rolled. The way he describes the need rang a resonant bell with me: Like a lot of people, I use services like Google Reader, Twitter, Delicious and Instapaper to help me find and store interesting links to articles, tools, apps or whatever. Personally, when I don’t have time to read it right now, I tend to star an item in Google Reader, ‘favourite’ it in Twitter, or mark it to ‘Read later’ in Instapaper – often five or ten things a day. I also save interesting stuff to Delicious, particularly where I think [...]

(see the full barking...)

PHP Local Time Code

I spent about 15 minutes writing a small PHP function for one of my sites, and then another hour writing it up. What for? Well, let’s back up. If you are running online events where people might come from anywhere, there can always be challenges for getting the right time to people. For our NMC events, while our office is in Austin, we have staff in 3 other time zones, and people in our community from maybe another 14 or more zones on top of that. If I say something starts at 2:00pm Central Time, then it puts it on everyone else to figure out when that is (and I’ve seen event sites where they do not even provide the reference time zone). If were all proper and versatile, we’d use Greenwich Mean Time, since everyone knows their offset, right? (I am -7 what are you?) Most of the time [...]

(see the full barking...)

Coding My Own WordPress Authors List

cc licensed flickr photo shared by bitzcelt Elwood: It’s 106 miles to get this sidebar coded, we’ve got a full tank of gas, half a pack of cigarettes, it’s dark and we’re wearing sunglasses. Jake: Hit it. I have no idea why I opened this way except for Jim Groom Inspiration. But to jive my code chops, there’s nothing more energizing than doing a little hack and chop coding in WordPress. Today I was again doing some sidebar fine tuning on the NMC MIDEA web site (previously covered in my almost done series on doing custom post types in WordPress 3.0). It was one of those “oh this might take 20 minute” deals that ended up going a bit longer. but like Jake and Elwood, when you gotta go to Chicago, you drop the sunglasses and hit it. And this is pretty simple, and most likely there is a plugin [...]

(see the full barking...)

Feed2JS Source Moved to Google Code

I am at the same time honored and deeply scared that a lot of people use my Feed2JS tool created like in 2003 or 2004 for helping people embed RSS feeds in their site using cut and paste JavaScript. If my stats are right, in the 6 hours since the cache was cleaned out (daily), 45,000 some unique feeds have been run through here, which is about 60 feeds per minute. I hardly do anything to the code and I hope it does not blow up on anyone. There may have been some issues since the time I was trying to implement a new parser (which killed the server which for years has been kindly donated for free by the kind folks at Modevia Web Services)…. in restoring it I may have put a deprecated version of MagpieRSS; I just re-adjusted and the old FeedMachine seems to be working. For [...]

(see the full barking...)

Updating Web Sites with Google Spreadsheets

I’ve done a handful of web projects this year where it made sense to store data in Google Spreadsheets, and then use a bit of PHP code to make them be dynamically displayed on a web site. In many cases, these are tables of data that are parsed and presented nicely in the web site, but for a few NMC projects, it made sense as a way for a staff person to update data on our web pages w/o having to touch the pages. As a first example, I am cleaning up an older WordPress site I use for logging my running/training; in the past, I kept a spreadsheet on my desktop for keeping a run log and then manually transferred the totals/averages/graphs to my web site by pasting into some text files (they are embedded with a PHP include). It worked, but it did have that tedious manual smell [...]

(see the full barking...)

WordPress Shazam! Your Category is Now a Page

cc licensed flickr photo shared by ElDave The main navigation of most WordPress sites is driven by cycling through all of the content that are WordPress pages– which is nice, but sometimes you have content that you don;t want cluttering the navbar. Or maybe you want to insert something that is not a Page into the navbar. I’ve been amazed that so few people seem to know how to subvert it, and below is a little trick I use when I want to wedge some other kind of WordPress content into the navbar by Pages process. Mostly this is in your HEAD… I mean the header.php file of your templates that generates it as an Unordered List: <div id="nav"> <ul>   <li class="<?php if (is_home()) {echo 'page_item current_page_item'; } ?>">     <a href="<?php echo get_settings('home'); ?>/">Home</a></li>   <?php wp_list_pages('title_li' ); ?> </ul> </div> The first li item creates the Home link, and in [...]

(see the full barking...)

WP LastPosts: Cause I Keep Forgetting My Own URLs

I just whipped up the puniest of WordPress hacks for the ultimate reasons, to serve myself. If I knew what I was doing, it would be a plugin, but I’ll leave that as an exercise for the reader. Here’s the thing. Whenever I write something, i like to reference by link a previous post. So I have to load my own site to find it, and man, I am tired of waiting. So my hack generates page that just in simple layout lists your latest 100 (or whatever number you wish) posts, so you can either copy the URL or edit it. It makes something like this: The code consists of 2 PHP files and a GIF image that go into your theme directory: http://cogdogblog.com/code/lastposts.zip headless.php is just a simplifed version of header.php with just some CSS in it last.php is a simple template that does all the work images/edit.gif [...]

(see the full barking...)