“Sometimes I feel like I’m not… solid. I’m hollow. There’s… nothing behind my eyes. I’m a negative of a person. It’s as if I never— I never thought anything. I never wrote… anything, I never felt anything. All I want is blackness— blackness and silence.”—Sylvia Plath (via wordsthat-speak)
“Does that mean that you’re coding both pc and other devices simultaneously? :)”—Yup - Windows, Linux, Mac, Phones, Pads and Vitas all running the game in here. If you don’t develop all at once, you can end up with a main version and ports. Not good. (via tonyrevdev)
While working on a style-overhaul. I noticed that portions of our views are generated with markdown2, which as it turns out, produces terrible markup.
Produces HTML like
When it ought to be
This is something that the original python markdown module does as it should. The 2 in markdown 2 is a little misleading; the original markdown module is still being actively maintained.
After the switch, it necessary for me to port over our markdown extensions. Namely, we want some blocks of markdown to open their links in a new tab because they will always refer to external resources. Fortunately markdown has a robust extensions API and the end result looked like so:
# -*- coding: utf-8 -*-
""" Text generation and transformation utilities """
import markdown as md
from markdown.extensions import Extension
from markdown.treeprocessors import Treeprocessor
def link_process(self, element):
""" Traverse the element tree. """
children = element.getchildren()
for child in children:
if child.tag == 'a':
child.attrib['target'] = '_blank'
def run(self, root):
""" Makes links open in a new tab. """
def extendMarkdown(self, md, md_globals):
""" Return markdown `text` rendered in HTML. """
return md.markdown(text, [NewTabLinksExtension()])
When entering money into a form, there’s all sorts of potential ways a person could want to format the value, especially when you’re trying to serve a bilingual user base. To match every possible format (I could think of) I came up with the following regular expression:
Tipsy is a great, simple tooltip plugin for jQuery.
At Ajah, we’re currently using Tipsy to display additional data in our d3 visualizations. However, Tipsy doesn’t feature true SVG support and incorrectly assigns an SVG element’s position in Chrome and Firefox.
In Chrome, you’ll see a tooltip only targets the top-left corner of an SVG element, and in Firefox, it will always render at the top of the page regardless of where the actual element is. This is because Tipsy assumes all elements in the DOM can provide an offsetWidth and offsetHeight, where with SVG you want the BindingBox’s width and height instead.
With our new, improved Tipsy, it will first try to detect a BB accessor if possible and otherwise fall back to using offsetWidth and offsetHeight.