This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
values = ['comma','separated', 'list', 'of','values', 'each', 'surrounded', 'by', 'quotes'] | |
# for each item in the list of items | |
for value in values: | |
# construct the filename; prefix or suffix optional | |
filename = 'prefix-' + value + '.jpt' | |
# open the file to be written | |
fo = open(filename, 'w') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function the_slug($echo=true){ | |
$slug = basename(get_permalink()); | |
do_action('before_slug', $slug); | |
$slug = apply_filters('slug_filter', $slug); | |
if( $echo ) echo $slug; | |
do_action('after_slug', $slug); | |
return $slug; | |
} | |
// credit: http://www.tcbarrett.com/2011/09/wordpress-the_slug-get-post-slug-function/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
page ='<div id="top_bin"><div id="top_content" class="width960"><div class="udacity float-left"><a href="http://www.xkcd.com">' | |
start_link = page.find('<a href=') | |
start_quote = page.find('"', start_link) | |
end_quote = page.find('"', start_quote+1) | |
url = page[start_quote+1:end_quote] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ARDUINO INPUT INCREMNENTER | |
// To measure the output of my desk pedals at work | |
// Adapted from Example 03A from "Getting Started with Ardunio" by Massimo Banzi | |
// Greg Linch | |
// http://www.greglinch.com | |
#define BUTTON 7 // input pin where the push button is connected; this will soon be replaced with alternative method to measure output of pedals | |
int val = 0; // store the state of the input pint |
NewerOlder