Skip to content

Instantly share code, notes, and snippets.

View hansmaad's full-sized avatar
💻
Hacking

Hannes Kamecke hansmaad

💻
Hacking
  • Cologne, Germany
View GitHub Profile
@hansmaad
hansmaad / chartist-logaxis-patch.js
Created July 14, 2016 08:49
Adds a log scale option to Chartist AutoScaleAxis
(function (window, document, Chartist) {
'use strict';
function AutoScaleAxis(axisUnit, data, chartRect, options) {
// Usually we calculate highLow based on the data but this can be overriden by a highLow object in the options
var highLow = options.highLow || Chartist.getHighLow(data.normalized, options, axisUnit.pos);
this.bounds = Chartist.getBounds(chartRect[axisUnit.rectEnd] - chartRect[axisUnit.rectStart], highLow, options.scaleMinSpace || 20, options.onlyInteger);
var scale = options.scale || 'linear';
@hansmaad
hansmaad / chrome 45 onpointerdown
Created July 10, 2015 08:00
test file for Issue 506664: window.onpointerdown is null in version 45, was undefined before, breaks polyfills
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div id="test" style="width:300px; height:300px; background:red;">
</div>
<script>
var hasPointerEvents = 'onpointerdown' in window;
var e = hasPointerEvents ? 'pointerdown' : 'mousedown';
(function({{$1:moduleName}}){
'use strict';
angular.module('{{$2:angularModule}}')
.directive('{{$3:directive}}', {{$3:directive}});
function {{$3:directive}}() {
return {
restrict : 'E',
templateUrl : '',
@hansmaad
hansmaad / gist:11254836
Last active August 29, 2015 14:00 — forked from mauricedb/gist:5356933
WebApiConfig JSON configuration
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
@hansmaad
hansmaad / module.js
Created March 26, 2014 08:39
Template for Revealing Module Pattern with submodule
(function(module, undefined) {
var privateProb = "Private";
var privateFunc = function(prob) {
return prob + privateProb;
};
module.publicProb = "Hello Module";
module.publicFunc = function() {
@hansmaad
hansmaad / gist:9187633
Last active October 14, 2024 15:01
WPF Flat Combo Box Style
<!-- Flat ComboBox -->
<SolidColorBrush x:Key="ComboBoxNormalBorderBrush" Color="#e3e9ef" />
<SolidColorBrush x:Key="ComboBoxNormalBackgroundBrush" Color="#fff" />
<SolidColorBrush x:Key="ComboBoxDisabledForegroundBrush" Color="#888" />
<SolidColorBrush x:Key="ComboBoxDisabledBackgroundBrush" Color="#eee" />
<SolidColorBrush x:Key="ComboBoxDisabledBorderBrush" Color="#888" />
<ControlTemplate TargetType="ToggleButton" x:Key="ComboBoxToggleButtonTemplate">
<Grid>
<Grid.ColumnDefinitions>