Skip to content

Instantly share code, notes, and snippets.

View greglinch's full-sized avatar

Greg Linch greglinch

View GitHub Profile
@greglinch
greglinch / the_slug.php
Created December 5, 2012 04:28
create the_slug() function for WordPress
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/
@greglinch
greglinch / test-page.html
Last active October 18, 2018 15:19
Sample HTML page from Howard University ONA event
<html>
<head>
<title>This is my test page</title>
</head>
<body>
<h1>My article headline</h1>
<p>This is <em>my</em> article.</p>
<p>It's the <strong>greatest</strong> article ever written.</p>
</body>
</html>
@greglinch
greglinch / file-generator.py
Last active June 16, 2021 22:05
Python script to batch generate files based on a variable. Save this file in a new directory and make the desired modifications. Open terminal and cd into that directory. Type $ python ./file-generator.py to execute the script.
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')
@greglinch
greglinch / datawrapper-install-instructions-detailed.md
Last active October 28, 2021 14:13
Datawrapper set up instructions: Below is a detailed, step-by-step guide for setting up your own installation of Datawrapper, an open-source data visualization tool. Questions? Suggestions? Please let a comment below. Happy installing!