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 | |
import os | |
import urllib2 | |
from poster.encode import multipart_encode | |
from poster.streaminghttp import register_openers | |
# Register poster to urllib2 | |
register_openers() |
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
# -*- coding: utf-8 -*- | |
import re | |
from lettuce import world, step, before | |
from lettuce_webdriver.util import find_field | |
from lettuce_webdriver import webdriver # We need this to register "I visit..." | |
from nose.tools import assert_true | |
from selenium import webdriver | |
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile | |
@before.all |
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 datetime | |
# Get the UTC tzinfo object, alternatively use the solution from http://docs.python.org/library/datetime.html#tzinfo-objects | |
from pytz import utc | |
my_article = Article() | |
# Save timestamp "now" as UTC | |
my_article.dc_created = datetime.now(utc) | |
my_article.save() |
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
// Check if overflow happens for a given jquery element | |
function check_overflow(element) { | |
var element_clone = element.clone(); | |
element.after(element_clone.hide().css({ | |
'position': 'absolute', | |
'width': 'auto', | |
'overflow': 'visible', | |
'max-width': 'inherit' | |
})); |
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
public class Area extends Measurement { | |
public Area(int value) { | |
super(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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Jasmine Spec Runner</title> | |
<link rel="stylesheet" type="text/css" href="../lib/jasmine-1.1.0/jasmine.css"> | |
<script type="text/javascript" src="../lib/jasmine-1.1.0/jasmine.js"></script> | |
<script type="text/javascript" src="../lib/jasmine.junit_reporter.js"></script> | |
</head> | |
<script type="text/javascript"> | |
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('../../build/reports/jasmine/', false)); // don't consolidate so that JUnitReport can pick up the XML |
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 sys | |
import logging | |
from lxml import etree | |
# Install from https://github.com/erikrose/pijnu & https://github.com/erikrose/mediawiki-parser | |
from pijnu.library.error import IncompleteParse | |
from preprocessor import make_parser as make_preprocessor_parser | |
from text import make_parser |
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
/* | |
* HTML Parser By John Resig (ejohn.org) | |
* Original code by Erik Arvidsson, Mozilla Public License | |
* http://erik.eae.net/simplehtmlparser/simplehtmlparser.js | |
* | |
* // Use like so: | |
* HTMLParser(htmlString, { | |
* start: function(tag, attrs, unary) {}, | |
* end: function(tag) {}, | |
* chars: function(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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>rasterizeHTML.js example</title> | |
<script type="text/javascript" src="lib/htmlparser.js"></script> <!-- Needed for Chrome & Safari to work around buggy XMLSerializer --> | |
<script type="text/javascript" src="lib/cssParser.js"></script> <!-- Needed to embed backgroundImages --> | |
<script type="text/javascript" src="lib/URI.js"></script> <!-- Needed to calculate paths when embedding stuff --> | |
<script type="text/javascript" src="rasterizeHTML.js"></script> | |
</head> | |
<body> |
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 https://developer.mozilla.org/en/DOM/XMLHttpRequest/Sending_and_Receiving_Binary_Data | |
var readBinaryFile = function (url) { | |
var content, newContent = ""; | |
$.ajax({ | |
dataType: 'text', | |
mimeType: 'text/plain; charset=x-user-defined', | |
url: url, | |
async: false, | |
cache: false, |
OlderNewer