Skip to content

Instantly share code, notes, and snippets.

@saaj
saaj / sqlite_tokenizer.py.patch
Last active August 29, 2015 14:02
Debugging Python SQLite FTS4 tokenizers with sqlite-fts-python 0.1
--- original/sqlite_tokenizer.py
+++ patched/sqlite_tokenizer.py
@@ -8,6 +8,10 @@
import ctypes
from ctypes import POINTER, CFUNCTYPE
import struct
+
+
+SQLITE_OK = 0
+SQLITE_DONE = 101
@saaj
saaj / snippet.js
Last active August 29, 2015 14:06
Simplified LDML to POSIX datetime format converter
/**
* Simplified datetime format string converter from LDML (Locale Data Markup
* Language) aka CLDR (Unicode Common Locale Data Repository) format to POSIX
* aka strftime format.
*
* Main usecase is using complete localization from CLDR with D3, which
* implements POSIX style of date formatting.
*
* References:
* - http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
@saaj
saaj / gist:7154231
Created October 25, 2013 12:54
Routes 1.13 capturing group fix
--- ~/venv/1/lib/python2.7/site-packages/routes/route.py
+++ ~/venv/2/lib/python2.7/site-packages/routes/route.py
@@ -421,7 +421,7 @@
# our regexp first. It's still possible we could be completely
# blank as we have a default
if self.reqs.has_key(var) and self.defaults.has_key(var):
- reg = '(?:' + partreg + rest + ')?'
+ reg = '(' + partreg + rest + ')?'
# Or we have a regexp match with no default, so now being
@saaj
saaj / jira-markdown-converter.user.js
Last active August 18, 2017 08:54
This userscript converts between Jira markup and Markdown in Jira ticket textarea
// ==UserScript==
// @name Jira Markdown Converter
// @namespace https://gist.github.com/saaj/fb58cfca7d682a4d3c8083239eafc174
// @description This userscript converts between Jira markup and Markdown in Jira ticket textarea
// @version 0.1.2
// @author saaj
// @match https://*.atlassian.net/*
// ==/UserScript==
/**
@saaj
saaj / marshmallow.ipynb
Last active September 12, 2018 09:50
Marshmallow field validation for an empty text field
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saaj
saaj / ranking.py
Created June 9, 2014 11:31
Python SQLite ranking functions for sqlitefts
# -*- coding: utf-8 -*-
'''
Ranking code based on:
https://github.com/coleifer/peewee/blob/master/playhouse/sqlite_ext.py
'''
import struct
import math
@saaj
saaj / 73498.svg
Created August 1, 2019 18:21
hstr demo
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saaj
saaj / HISTORY.rst
Created April 26, 2020 20:04
Development MySQL server and administrative UI
@saaj
saaj / HISTORY.rst
Created April 26, 2020 20:05
Local DynamoDB and simplistic administrative UI