Skip to content

Instantly share code, notes, and snippets.

Avatar

Christoph Matthies chrisma

View GitHub Profile
@chrisma
chrisma / boilerplate.py
Created April 29, 2012 08:22 — forked from ssokolow/boilerplate.py
Python boilerplate
View boilerplate.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""[application description]"""
__appname__ = "[application name]"
__author__ = "[author]"
__version__ = "0.0"
__license__ = "GNU GPL 3.0 or later"
import logging, argparse
@chrisma
chrisma / handy_commands.tex
Last active August 29, 2015 14:07
Handy commands for Latex
View handy_commands.tex
\newcommand{\enquote}[1]{``#1''} %enquote stuff nicely
\newcommand{\up}[1]{\ensuremath{^{\textrm{\small#1}}}} %Easy way of doing supercripts in text
@chrisma
chrisma / gist:2074bc2d6dbdbbdea138
Created October 26, 2014 20:36
Replace master branch with gh-pages
View gist:2074bc2d6dbdbbdea138
git branch gh-pages
git checkout gh-pages
git branch -D master
git push origin gh-pages
# Set gh-pages as default branch in admin interface
git push origin :master # delete master
@chrisma
chrisma / js_helpers
Last active August 29, 2015 14:08
Javascript helper functions
View js_helpers
function randomPropertyName(obj) {
var keys = Object.keys(obj)
return keys[ keys.length * Math.random() << 0];
}
function randomPropertyValue(obj) {
var keys = Object.keys(obj)
return obj[keys[ keys.length * Math.random() << 0]];
};
@chrisma
chrisma / js_string_helpers
Last active August 29, 2015 14:08
Javascript String helpers
View js_string_helpers
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
String.prototype.title = function(force) {
//'examPLE'.title(); -> 'ExamPLE'
//'examPLE'.title(true); -> 'Example'
return (force ? this.toLowerCase() : this).replace(/(?:^|\s)\S/g, function(s) { return s.toUpperCase(); });
};
@chrisma
chrisma / fixed_height_sticky_footer
Created November 1, 2014 22:52
Favorite fixed height sticky footer
View fixed_height_sticky_footer
@chrisma
chrisma / rgb_to_hex.js
Created December 1, 2014 20:48
RGB to Hex Javascript
View rgb_to_hex.js
function rgbToHex(r, g, b) {
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
}
@chrisma
chrisma / Extract_color_json_from_wikipedia.js
Created December 1, 2014 22:30
Extract information about colors (name, rgb, hex, hsv, hsl) from Wikipedia to JSON.
View Extract_color_json_from_wikipedia.js
result = [];
$('.wikitable tbody tr').each(function(){
var color = {};
color['name'] = $(this).find('th').text();
var tds = $(this).find('td');
color['hex'] = tds.first().text();
var rgb = [];
tds.slice(1,4).each(function(){
rgb.push(parseInt($(this).attr('title').replace('/255','')));
});
@chrisma
chrisma / named_colors.json
Created December 1, 2014 22:35
Named color JSON data, extracted from Wikipedia's "List of colors", accessed 01-12-2014.
View named_colors.json
[
{"name":"Acid green","hex":"#B0BF1A","rgb":[176,191,26],"hsl":[65,76,43],"hsv":[65,86,75]},
{"name":"Aero","hex":"#7CB9E8","rgb":[124,185,232],"hsl":[206,70,70],"hsv":[206,47,91]},
{"name":"Aero blue","hex":"#C9FFE5","rgb":[201,255,229],"hsl":[151,100,89],"hsv":[151,21,100]},
{"name":"African violet","hex":"#B284BE","rgb":[178,132,190],"hsl":[288,31,63],"hsv":[288,31,75]},
{"name":"Air Force blue (RAF)","hex":"#5D8AA8","rgb":[93,138,168],"hsl":[204,30,51],"hsv":[204,45,66]},
{"name":"Air Force blue (USAF)","hex":"#00308F","rgb":[0,48,143],"hsl":[220,100,28],"hsv":[220,100,56]},
{"name":"Air superiority blue","hex":"#72A0C1","rgb":[114,160,193],"hsl":[205,39,60],"hsv":[205,41,76]},
{"name":"Alabama crimson","hex":"#AF002A","rgb":[175,0,42],"hsl":[346,100,34],"hsv":[346,100,69]},
{"name":"Alice blue","hex":"#F0F8FF","rgb":[240,248,255],"hsl":[208,100,97],"hsv":[208,6,100]},
@chrisma
chrisma / preisvergleich_TShirt_drucken.md
Last active August 29, 2015 14:11
Preisvergleich T-Shirtdruck 09.12.2014
View preisvergleich_TShirt_drucken.md

Preisvergleich T-Shirtdruck, Dez 14

Preise für das preiswerteste schwarze T-Shirt in Größe L, Versand nach Deutschland:

Gesamt
Anbieter Preis Versandkosten