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 json | |
from lxml import etree | |
import requests | |
from datetime import date | |
def findId(xml): | |
for cat in xml.findall('category'): | |
if cat.text.startswith('HH_'): | |
return cat.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
<?xml version="1.0" encoding="windows-1252"?> | |
<xsl:stylesheet xmlns="http://www.w3.org/2000/svg" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:exsl="http://exslt.org/common" | |
extension-element-prefixes="exsl" | |
version="1.0"> | |
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes" /> | |
<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyzàèìòùáéíóúýâêîôûãñõäëïöüÿåæœçðø'" /> | |
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÄËÏÖÜŸÅÆŒÇÐØ'" /> |
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
//Via http://stackoverflow.com/a/29579591/76367 | |
function svg_link(svgid) { | |
svg = document.getElementById(svgid); | |
return $('<a/>').attr('href', 'data:image/svg+xml;utf8,' + svg.outerHTML); | |
} |
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/python | |
import feedparser | |
import yaml | |
import pinboard | |
from time import mktime | |
import os | |
class RssToPinboard(object): | |
def __init__(self, settings): |
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
//NOTE: Depends on paper.js. | |
if ('undefined' == typeof unset) function isset(x) { return !('undefined' == typeof x) } | |
if ( !isset(ifunset) ) function ifunset(x, def) { return ('undefined' == typeof x) ? def : x; } | |
//These are defaults; config variables can be set before loading this script. | |
var LOGGING = ifunset(LOGGING, false); | |
var CANVAS_SELECTOR = ifunset(CANVAS_SELECTOR, 'canvas.sparkler'); | |
var XMARGIN = ifunset(XMARGIN, 2); | |
var YMARGIN = ifunset(YMARGIN, 2); |
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
lp <- function(givenName, givenQuantity, resources, needsChart) { | |
if ( !all.equal(names(resources), colnames(needsChart)[2:length(colnames(needsChart))]) ) { | |
warning("constraints and needsChart don't match.") | |
return(NA) | |
} else if ( dim(needsChart)[1] != 2 ) { | |
warning("Can only handle two products.") | |
return(NA) | |
} | |
sapply(givenQuantity, function(x) { |
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 SomeDecorator(next): | |
def getFunction(fn): | |
def doStuff(req, *args): | |
return fn(req, *args) | |
return doStuff | |
return getFunction |
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 md5(str): | |
import md5 | |
hasher = md5.new() | |
hasher.update(str) | |
return hasher.hexdigest() |
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
function randstr($len = 8) { | |
$src = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; | |
$src = $src.$src.$src.$src.$src; | |
return substr(str_shuffle($src), 0, $len); | |
} |
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
$config['uri_protocol'] = "PATH_INFO"; | |
$config['enable_query_strings'] = TRUE; | |
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-?=+&;'; |
OlderNewer