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
# getting messy page numbers | |
^p. \(\#[0-9]{1,3}\) | |
# matches p. (#33) | |
# page headings with book title | |
^HARD TIMES. [0-9]{1,3} | |
# matches HARD TIMES. 101 | |
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
# instantiate virtualenv with specific version of python | |
virtualenv -p /usr/bin/python3.7 venv |
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
// great little typographic widow control script from chris coyier | |
// https://css-tricks.com/preventing-widows-in-post-titles | |
$("h2 a").each(function() { | |
var wordArray = $(this).text().split(" "); | |
if (wordArray.length > 1) { | |
wordArray[wordArray.length-2] += " " + wordArray[wordArray.length-1]; | |
wordArray.pop(); | |
$(this).html(wordArray.join(" ")); | |
} |
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
/** | |
* Boilerplate WordPress shortcode - can drop into functions.php | |
* Use: [bananify this="thing to add a banana to"] | |
*/ | |
function bananify_func( $atts ) { | |
$a = shortcode_atts( array( | |
'this' => 'something' | |
), $atts ); |
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
# cribbed / adapted from here http://partiallyattended.com/2011/10/13/managing-unix-time-in-python | |
from time import strftime | |
from datetime import datetime | |
from datetime import date | |
from time import mktime | |
# convert unix to human-readable | |
def unix_to_human(unix_date): | |
human_date = datetime.fromtimestamp(int(unix_date/1000.0)).strftime('%Y-%m-%d %H:%M:%S') | |
return human_date |
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
python -m json.tool my_json.json > my_pretty_json.json |
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
# all thanks to nael shiab's post here: http://naelshiab.com/tutorial-send-email-python | |
# adding gist for my own reference / ease remembering | |
import smtplib | |
from_email = "########@gmail.com" | |
from_email_password = "somethingsecure" | |
to_email = "#######@some_email.com" | |
server = smtplib.SMTP('smtp.gmail.com', 587) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder