Skip to content

Instantly share code, notes, and snippets.

View agaerig's full-sized avatar

Andrew Gaerig agaerig

  • Pitchfork
  • Chicago, IL
View GitHub Profile
newsletterHP: {
id: [41, 54],
hed: 'lorum',
dek: 'ipsum',
}
- Choice of embed/id: CNE / Youtube / Facebook / Livestream.com
- If Facebook: choice of embed/id for mobile: CNE / Youtube / Livestream.com
- Start time
- End time
- Crown or top-3 unit
- Copy
- Optional link for copy
getChiDate(dateString) {
let setDate = new Date(dateString);
const centralOffset = 300;
let tzDiff = setDate.getTimezoneOffset() - centralOffset;
return new Date(setDate.getTime() + tzDiff * 60 * 1000);
}
formatTime(dateString) {
let chiDate = getChiDate(dateString);
return (chiDate.getHours() - 12) + ':' + padLeft(chiDate.getMinutes(), 2, 0);
formatTime(dateString) {
let chiOffset = 300;
let setDate = new Date('2017-07-14T18:00:00Z'); // example via Madame Ghandi
let tzDiff = setDate.getTimezoneOffset() - chiOffset;
let chiTime = new Date(setDate.getTime() + tzDiff * 60 * 1000);
// do your stuff with chiTime
}
def _parse_twitter(self, soup):
# tweet has a blockquote with a class and then following that,
# a widget js. strip both and replace with an embed for the link
tweets = soup.find_all('blockquote', class_=['twitter-tweet', 'twitter-video'])
for tweet in tweets:
link = tweet.find_all('a')[-1]
link_href = link.get('href')
# create element before with our embed tag
tweet_embed = soup.new_tag('span')
def send_to_copilot(self, id_list):
item_list = self.get_queryset().filter(id__in=id_list)
start = datetime.now()
for item in item_list:
mi = MigratedItem.objects.get_for_object(item)
if mi is not None and self.force_create:
mi.delete()
mi = None
def _clean_emphasis_tags(self, text):
touchups = [[re.compile(r'<i>\xa0'), ' <i>'],
[re.compile(r'\xa0</i>'), '</i> '],
[re.compile(r'<b>\xa0'), ' <b>'],
[re.compile(r'\xa0</b>'), '</b> ']]
touched_up = text
for touchup in touchups:
touched_up = touchup[0].sub(touchup[1], touched_up)
<!DOCTYPE html>
<html class="embed-html">
<body class="embed-body">
<div id="embed-container">
<div id="embedplayer"></div>
</div>
<script type="text/javascript">
(function() {
// Generate Inline Embed Url - add JS provided params (sourceReferrer and sourceUrl)
// Embed Loader uses the following line to string
// This script finds itself in the document body and inserts the iframe embed payload
// within a fluid embed div right after the script element.
// The iframe embed payload contains the inline player embed.
(function() {
var myselfScriptPath = '/script/video/58ed06dafd2e61762000000d.js';
var embedLoader = {
// Performs a check to ensure the script tag is located within
// the source page's document body and not within its head.
checkForHeadParent: function(element) {
<style type="text/css">
#feature-detail article .contents .sidenote {
color: #495391;
font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
}
#feature-detail article .contents .sidenote a {
color: #495391;
border-bottom: 1px solid #495391;
background: none;