Skip to content

Instantly share code, notes, and snippets.

View matthew-macgregor's full-sized avatar
🏠
Working from home

Matthew MacGregor matthew-macgregor

🏠
Working from home
View GitHub Profile
@davidtheclark
davidtheclark / dumb_to_smart_quotes.py
Created May 5, 2013 17:10
Convert dumb quotes to smart quotes in Python
def dumb_to_smart_quotes(string):
"""Takes a string and returns it with dumb quotes, single and double,
replaced by smart quotes. Accounts for the possibility of HTML tags
within the string."""
# Find dumb double quotes coming directly after letters or punctuation,
# and replace them with right double quotes.
string = re.sub(r'([a-zA-Z0-9.,?!;:\'\"])"', r'\1”', string)
# Find any remaining dumb double quotes and replace them with
# left double quotes.
@jessefreeman
jessefreeman / camera.js
Created March 1, 2013 20:27
A simple camera for ImpactJS. Also allows for a mask overlay for simple lighting effects.
ig.module(
'game.plugins.camera'
)
.requires(
'impact.game',
'impact.image'
)
.defines(function () {