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
> npm install unorm | |
var unorm = require('unorm'); | |
// String optimized for compatibility, for url ids | |
title = 'The title™ is ? ! % CO\u2082 and E=mc\u00B2' | |
var normalize = function (title) { | |
"use strict"; | |
var urlsafe = unorm.nfkd(title); // normalized form - decomposition |
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
import smtplib | |
from email.header import Header | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from html2text import html2text | |
def get_encoding(unicode_text): |
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
keepdate = now - timedelta(days=30) | |
number_of_objects = 100 | |
count = FeedLog.objects.filter(created__lte=keepdate).count() | |
for i in xrange(0, count, number_of_objects): | |
smaller_queryset = FeedLog.objects.filter( | |
created__lte=keepdate)[i: i + number_of_objects] | |
for feed_log in smaller_queryset: | |
feed_log.delete() |
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
diff --git a/cjp/cjp/scripts/runScrapers.py b/cjp/cjp/scripts/runScrapers.py | |
index e79ccf1..6c989c4 100755 | |
--- a/cjp/cjp/scripts/runScrapers.py | |
+++ b/cjp/cjp/scripts/runScrapers.py | |
@@ -28,7 +28,7 @@ for s in scrapers: | |
# remove original HTML for articles older than two weeks | |
now = datetime.now() | |
keepdate = now - timedelta(days=14) | |
-old_articles = Article.objects.filter(created__lte = keepdate).exclude(orig_html = '') | |
+old_articles = Article.objects.filter(created__lte = keepdate).exclude(orig_html = '').iterator() |
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
<!-- | |
name the frame name="myframe" | |
then you can reach into the frame like so (using jQuery) | |
--> | |
$(frames['myframe'].document).find('.someClass').attr('style', 'display: none') |
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
<!-- | |
name the frame: <iframe name="myframe" ...> | |
then you can reach into the frame like so (using jQuery) | |
--> | |
$(frames['myframe'].document).find('.someClass').attr('style', 'display: none') |
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
<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://www.theanticorruptionpledge.org/embed?k=ahlzfnRoZWFudGljb3JydXB0aW9ucGxlZGdlcg8LEgdQbGVkZ2VyGK76Dgw" style="border: none; overflow: hidden; height: 98px; width: 98px;"></iframe> |
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
<!-- CORRECT --> | |
<fieldset class="deformMappingFieldset"> | |
<!-- mapping --> | |
<ul> | |
<li class="section"> | |
<div>Please enter your region (i.e. California, Farāh, British Columbia) and country spelled out (i.e. United States, Botswana)</div> | |
</li> | |
<input name="__start__" value="location:mapping" type="hidden"> | |
<li class="field" title="" id="item-deformField10"> | |
<!-- mapping_item --> |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func nextPrime() func() int { | |
last := 3 | |
return func() int { |
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
#!/usr/bin/env python | |
import commands | |
import datetime | |
import hashlib | |
import os | |
import sys | |
DATADIR = "/home/ubuntu/transfer_data" |