Skip to content

Instantly share code, notes, and snippets.

Mike Hemesath mhemesath

Block or report user

Report or block mhemesath

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
from import base
from django.core.cache import get_cache
from django.conf import settings
from import call_command
import StringIO
import re
import urls
View month.html.erb
<% start_date = date.beginning_of_month.beginning_of_week - %>
<% end_of_month = date.end_of_month.end_of_week %>
<% weeks = (start_date...end_of_month).each_slice(7).to_a %>
<% (0..6).each do |i| %>
<th><%= (start_date + i.days).strftime('%a') %></th>
<% end %>
PIPELINE_LESS_ARGUMENTS = '--include-path=' + ':'.join([
for app_module in [pkgutil.get_loader(app) for app in INSTALLED_APPS]
View d3pyramid
<!DOCTYPE html>
<meta charset="utf-8">
<!--[if lte IE 8]><script src="../r2d3.v2.js"></script><![endif]-->
<!--[if gte IE 9]><!-->
<script src="../lib/d3/d3.v2.js"></script>
<body><div id="pyramidDiagram"></div></body>
mhemesath /
Last active Aug 21, 2019
MIddleware to allow celery tasks to be batched per request.
from celery import task
class AsyncTaskMiddleware(object):
Dynamically adds an async task queue to the request to be executed when the
response is processed.
All tasks added to the request are executed using a single asynchronous celery task.
Once the task is executed, it will execute each individual task in its own celery
mhemesath / transformToMatrix.js
Created Oct 9, 2012
Converts a SVG transform string into a Raphael Matrix object.
View transformToMatrix.js
function toMatrix(transform) {
var transforms = transform.split(' '),
matrix = Raphael.matrix();
for (var i=0; i<transforms.length; i++) {
var match = /^(\w+)\((.+)\)$/.exec(transforms[i]),
tranform = match[1],
values = toFloatArray(match[2]);
if ('translate' === transform) matrix.translate.apply(matrix, values);
mhemesath / gist:2771836
Created May 22, 2012
Stylus Right-To-Left Support
View gist:2771836
.foo {
p { color: #333; text-align: rtl(right, left); }
// Output
.foo p { color: #333; text-align: left; }
html[dir="rtl"] .foo p { text-align: right; }
You can’t perform that action at this time.