Skip to content

Instantly share code, notes, and snippets.

View xxdavid's full-sized avatar

David Pavlík xxdavid

View GitHub Profile
@bitmorse
bitmorse / lastexport.py
Created March 20, 2013 00:51
lastfm scrobble exporter (from https://gitorious.org/fmthings/lasttolibre/blobs/master/lastexport.py // changed the script to try more often on failure )
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@tajpure
tajpure / marked-katex.js
Created August 14, 2016 10:44
Support katex for marked.
const renderer = new marked.Renderer()
let originParagraph = renderer.paragraph.bind(renderer)
renderer.paragraph = (text) => {
const blockRegex = /\$\$[^\$]*\$\$/g
const inlineRegex = /\$[^\$]*\$/g
let blockExprArray = text.match(blockRegex)
let inlineExprArray = text.match(inlineRegex)
for (let i in blockExprArray) {
const expr = blockExprArray[i]
const result = renderMathsExpression(expr)