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
/* Use the Munchkin API to record a 'visitWebPage' event (see http://community.marketo.com/MarketoArticle?id=kA050000000Kyr7). Set the url of the visitWebPage event to the url of the download. I found that I had to make the link open in a new window, otherwise the Munchkin never manages to 'call home'... | |
I did it with jQuery. Replace $jq with a reference to a valid jQuery object in the code below. | |
We use a separate subdomain for Marketo-hosted landing pages and resources (in common with most users, I suspect). Since we wanted to track downloads for any PDF or PPT file within that domain, the jQuery selector pretty much wrote itself. It's case sensitive, but could easily be extended or modified to work around that - wasn't necessary for me. | |
Opening the links in a new window seems to help with the tracking. If the new page loads too quickly, then it seemed as if the event handler code didn't get called. Leaving the original window open avoids this (I set target="_blank"). | |
*/ |
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
// Adapted from http://stackoverflow.com/questions/901115/get-query-string-values-in-javascript | |
// Give a querystring like this: yourpage.html?cheese=wensleydale&biscuits=nice | |
var qs = (function(a) { | |
if (a == "") return {}; | |
var b = {}; | |
for (var i = 0; i < a.length; ++i) | |
{ | |
var p=a[i].split('='); | |
if (p.length != 2) continue; |
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
// clear the email address field when the user clicks into it | |
function clickClear(e) { | |
if (e.value == 'Your email address') { // text must match the default value attribute on the <input> tag | |
e.value = ''; | |
} | |
} |
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
# ----------------------------------------------------------------------------------- | |
# Create the database | |
CREATE DATABASE `shkspr` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; | |
# ----------------------------------------------------------------------------------- | |
# Create table structures | |
CREATE TABLE `shkspr`.`Chapters` ( | |
`WorkID` VARCHAR( 32 ) NOT NULL , |
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
-- of all the characters, whose paragraphs/speeches are the longest, on average? | |
SELECT | |
"characters"."name" AS "character_name", | |
SUM(length("paragraphs"."plain_text")) as "letter_count", | |
COUNT(*) as "paragraph_count", | |
SUM(length("paragraphs"."plain_text"))/COUNT(*) as "drone_factor" | |
FROM "paragraphs" | |
INNER JOIN "characters" ON "paragraphs"."character_id" = "characters"."id" |
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
SELECT * FROM node_revisions | |
INNER JOIN node ON node.nid = node_revisions.nid | |
WHERE body LIKE '%search term%' | |
AND node.status = 1 | |
AND node_revisions.vid IN (SELECT vid FROM node WHERE status = 1) |
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
var collapsed_by_default = false; // set this to true if you prefer collapsed by default | |
function HideCategory(id, IsAgent, animation) { | |
// Function hides category | |
$j("div#category_" + id).hide(animation); | |
SetDownArrow(id, IsAgent); | |
$j.cookie('hide_category_' + id, 'yes', { expires: 180 }); | |
$j("div#category_header_" + id).attr("onclick", "ShowCategory(" + id + "," +IsAgent+ ",'blind')"); | |
}; |
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
from datetime import tzinfo, timedelta, datetime | |
import calendar | |
class UTC(tzinfo): | |
"""UTC""" | |
def utcoffset(self, dt): | |
return timedelta(0) | |
def tzname(self, dt): | |
return "UTC" | |
def dst(self, dt): | |
return timedelta(0) |
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
// see http://googleappsdeveloper.blogspot.co.uk/2011/07/gmail-snooze-with-apps-script.html | |
// Should be set to run every day at midnight, and moves emails one label 'nearer' to the inbox | |
var MARK_UNREAD = false; | |
var ADD_UNSNOOZED_LABEL = true; | |
function getLabelName(i) { | |
return "Snooze/Snooze " + i + " days"; | |
} |
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
def mozzicon(md5): | |
# Inspired by (!) https://github.com/cupcake/sigil | |
# return a 5 by 5 grid of divs with horizontal plane of symmetry | |
# (css used to rotate by 90deg) | |
# md5 is a string like "9eadbe04ba0a832eecbd0a27f563e0a6" | |
# use first char of hash to pick a color from 7 | |
colors = ('2d4fff', 'feb42c', 'e279ea', '1eb3fd', 'e84d41', '31cb73', '8d45aa', ) |
OlderNewer