Skip to content

Instantly share code, notes, and snippets.

{% comment %}
This is part of a Structured Data carousel.
Use https://search.google.com/structured-data/testing-tool to test changes.
{% endcomment %}
{
"@type": "ListItem",
"position": {{ include.index }},
@bminard
bminard / jekyll-sitemap
Last active April 27, 2018 01:51
Generate an XML site map using Jekyll.
---
layout:
permalink: /sitemap.xml
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd
http://www.w3.org/1999/xhtml http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
@bminard
bminard / myautoindex.py
Created March 3, 2017 12:54
Extending flask.ext.auto_index
class MyAutoIndex(AutoIndex):
def __new__(cls, base, *args, **kwargs):
if isinstance(base, Flask):
return object.__new__(MyAutoIndexApplication)
raise TypeError("'base' should be Flask; Blueprint is not implemented.")
def render_autoindex(self, path, browse_root=None, template=None, template_context=None, endpoint='.autoindex', show_hidden=None, sort_by='name', mimetype=None):
i = super(MyAutoIndex, self).render_autoindex(path, browse_root, template, template_context, endpoint, show_hidden, sort_by, mimetype)
print i
return i
@bminard
bminard / links.py
Created March 2, 2016 01:31
Get Review Board Links Key
@bminard
bminard / diff.py
Last active November 12, 2015 00:36
Review Board RBTools Example
time_from, time_to = process_command_line()
client = RBClient(sys.argv[len(sys.argv) - 1])
try:
root = client.get_root()
except ServerInterfaceError as err:
error(err)
sys.exit(1)
@bminard
bminard / conftest.py
Last active November 2, 2015 02:13
Pytest Decorator
def decorator(func):
def _decorator():
func()
return _decorator
def pytest_namespace():
return {
'decorator': decorator
}