Skip to content

Instantly share code, notes, and snippets.

@godmar
godmar / sizzle-jsdom.patch
Created September 7, 2012 15:40
Updating sizzle for jsdom to github 20120907 version.
diff --git a/lib/jsdom/selectors/sizzle.js b/lib/jsdom/selectors/sizzle.js
index f8c890c..5870d19 100755
--- a/lib/jsdom/selectors/sizzle.js
+++ b/lib/jsdom/selectors/sizzle.js
@@ -1,982 +1,900 @@
/*!
* Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
@godmar
godmar / html.js.patch
Created September 7, 2012 21:04
possible fix for checked attribute
diff --git a/lib/jsdom/level2/html.js b/lib/jsdom/level2/html.js
index 6d92a8f..ae7e38a 100644
--- a/lib/jsdom/level2/html.js
+++ b/lib/jsdom/level2/html.js
@@ -848,11 +848,14 @@ define('HTMLInputElement', {
return this._initDefaultChecked();
},
get checked() {
- return !!this.getAttribute('checked');
+ return !!this._attributes.getNamedItem('checked');
@godmar
godmar / gist:6029903
Created July 18, 2013 14:43
Patch for console._window problem
--- index.js.bad 2013-07-18 10:36:04.355114831 -0400
+++ index.js 2013-07-18 10:39:47.540221548 -0400
@@ -146,7 +146,8 @@
return href;
};
- var window = this.console._window = this;
+ var window = this;
+ this.console = new Console(this);
@godmar
godmar / problem2html.patch
Created August 12, 2015 17:16
support -B option
--- a/src/problem2html.py
+++ b/src/problem2html.py
@@ -110,6 +110,8 @@ class ConvertOptions:
'set title (only used when there is no pre-existing template and -h not set).'],
['loglevel', 'store', '-L', '--log-level',
'set log level (debug, info, warning, error, critical).'],
+ ['imgbasedir', 'store', '-B', '--image-base-dir',
+ 'set image base directory'],
['quiet', 'store_true', '-q', '--quiet',
"quiet."],
--- a/frontend/templates/submissions.html
+++ b/frontend/templates/submissions.html
@@ -56,7 +56,7 @@ Your Submissions
</div>
<div class="col-lg-4">
{% from "submit_form.html" import submit_form %}
- {{ submit_form(problems, contest, next_url='/submissions') }}
+ {{ submit_form(problems, contest, next_url=root + '/submissions', root=root) }}
</div>
{% endblock %}
// fix for https://gist.github.com/mreidsma/69a42480f157647cd710#file-summonalerts-js-L4
// Set the text of the alert
var message = 'The Database of Broken Dreams is currently unavailable.';
// Turn the alert on or off (true = on, false = off)
var showAlert = false;
angular.module('summonApp.directives').directive("resultsFeed",
function() {
return {
@godmar
godmar / gist:8e32645ddc7086494a04
Last active February 1, 2016 18:28
patches to pycounter
diff --git a/pycounter/helpers.py b/pycounter/helpers.py
index 5001da9..90f274b 100644
--- a/pycounter/helpers.py
+++ b/pycounter/helpers.py
@@ -25,7 +25,17 @@ def convert_date_run(datestring):
:param datestring: the string to convert to a date.
"""
- return datetime.datetime.strptime(datestring, "%Y-%m-%d").date()
+ try:
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 10: invalid start byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0x96 in position 42: invalid start byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0x9a in position 7: invalid start byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xa0 in position 0: invalid start byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xad in position 10: invalid start byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 1: invalid continuation byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 36: invalid continuation byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3: invalid continuation byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 79: invalid continuation byte
1 UnicodeDecodeError: 'utf8' codec can't decode byte 0xf1 in position 28: invalid continuation byte
@godmar
godmar / gist:891749b267ab74d3268f
Created February 1, 2016 19:20
falling back to ISO 8859
diff --git a/pycounter/csvhelper.py b/pycounter/csvhelper.py
index d77c645..ef7f850 100644
--- a/pycounter/csvhelper.py
+++ b/pycounter/csvhelper.py
@@ -24,7 +24,7 @@ class UnicodeReader(six.Iterator):
self.fileobj = open(self.filename, 'rt',
encoding=self.encoding, newline='')
else:
- self.fileobj = open(self.filename, 'rb')
+ self.fileobj = open(self.filename, 'rU')
commit 9c25ff27baf0c0b4727051ca6727a60f234dff87
Author: Godmar Back <godmar@gmail.com>
Date: Wed May 25 22:20:59 2016 -0400
fixes to BFS and various other notes
- streamlined BFS implementation
- pointers for BFS and TSP practice
- note on integer arithmetic
- note on dyadic rationals