Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Boldewyn's full-sized avatar

Manuel Strehl Boldewyn

View GitHub Profile
#
# Advanced Django 1.3.x+ Logging
#
# Author:
# Jason Giedymin < jasong _[_a-t_]_ apache d-o-t org >
#
# Description:
# A Django 1.3.x+ settings.py snippet with Advanced logging formatters using RFC 2822,
# TimedRotatingFileHandler, and a WatchedFileHandler.
#
@Boldewyn
Boldewyn / jquery.defer.js
Created May 13, 2011 12:47
jQuery deferring helper
var $=(function(){var x=[],z=setInterval(function(){if("jQuery" in window){$.each(x,function(){$(this)});clearInterval(z)}},10);return function(y){x.push(y)}})();
/* uncompressed: */
var $ = (function() {
var x = [],
z = setInterval(function() {
if ("jQuery" in window) {
$.each(x, function() {
$(this);
});
function(s,k){k=s.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);return new Date(Date.UTC(k[1],k[2]-1,k[3],k[4],k[5],k[6]))}
@Boldewyn
Boldewyn / README
Created May 28, 2011 18:34
HTTP Error Responses by MIME Type
This is a collection of templates, that depict HTTP error messages in different MIME types.
Each template expects the parameters
* {CODE} - the numeric HTTP error code
* {PHRASE} - the reason phrase, e.g., "Not Found" for 404
and in some cases the parameter
@Boldewyn
Boldewyn / ttf2png.py
Created April 5, 2012 17:30
Convert font to a series of PNG images
#!/usr/bin/python
"""Convert all defined glyphs from a font to PNG images
Needs FontForge, ImageMagick and pngcrush installed."""
import fontforge as ff
import os
import subprocess
import sys
@Boldewyn
Boldewyn / dummyimg.sh
Created December 12, 2012 16:14
Request a dummy image from http://dummyimage.com from within your shell session. MIT license.
#!/bin/bash
# (C) 2012 Manuel Strehl
#
# Published under the MIT license <http://opensource.org/licenses/mit-license>.
if [ "$1" = "-h" -o "$1" = "--help" ]; then
cat <<USAGE
usage: $(basename $0) WIDTH [HEIGHT]
Request a dummy image from <http://dummyimage.com>. If HEIGHT is omitted, it
@Boldewyn
Boldewyn / mdshow
Created December 16, 2012 19:38
Show a Markdown file rendered in the browser. The `markdown` program as well as `base64` must be installed. Assumes, that `x-www-browser` is correctly configured.
#!/bin/bash
MDFILE=$1
x-www-browser $(markdown "$MDFILE" | base64 -w0 | \
cat <(echo -n "data:text/html;charset=UTF-8;base64,") -)
@Boldewyn
Boldewyn / apply_mask.sh
Created December 18, 2012 08:58
Apply an alpha mask from mask.img on an image source.img and store in result.img.
#!/bin/sh
SOURCE=$1
MASK=$2
TARGET=$3
convert "$SOURCE" "$MASK" -compose CopyOpacity -composite "$TARGET"
@Boldewyn
Boldewyn / cssgrep.sh
Last active March 20, 2023 13:49
cssgrep prints the part of HTML files, that match a given CSS selector. Solution based on this answer on StackOverflow: http://stackoverflow.com/a/14187086/113195
#!/bin/bash
function _usage() {
cat <<USAGE
usage: $(basename $0) PATTERN [FILES]
Print the HTML that matches the CSS selector PATTERN.
USAGE
}

Awesome PHP Libraries

A list of amazingly awesome PHP libraries that you should consider using (and some other shiny extras).