Skip to content

Instantly share code, notes, and snippets.

View maximilian-krauss's full-sized avatar
💥
¯\_(ツ)_/¯

Maximilian Krauß maximilian-krauss

💥
¯\_(ツ)_/¯
View GitHub Profile
@maximilian-krauss
maximilian-krauss / MEF.cs
Created November 11, 2012 09:34
MEF Example
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ConsoleApplication1 {
class Program {
@maximilian-krauss
maximilian-krauss / linkLabelEx.cs
Created March 26, 2012 14:56
LinkLabel with BB-Code Style Url support
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing.Design;
using System.Text.RegularExpressions;
using System.Windows.Forms;
/*
* linkLabelEx - Ein Linklabel with BB-Code
* Copyright (c) 2012 by Maximilian Krauss
* http://kraussz.com
@maximilian-krauss
maximilian-krauss / gist:2170153
Created March 23, 2012 12:15
Lunchtimestunt #1
using System;using System.Collections.Generic;using System.Linq;using System.Windows.Forms;using System.Drawing;class T { class L : Control { List<Point> dataPoints = new List<Point>(); public delegate void LeMoveHandler(object sender, Point cords); public event LeMoveHandler LeMove; public L() { SetStyle(ControlStyles.OptimizedDoubleBuffer, true); MouseMove += (o, e) => { Invalidate(); onLeMove(); }; MouseLeave += (o, e) => { Invalidate(); onLeMove(); }; Click += (o, e) => { dataPoints.Add(PointToClient(new Point(MousePosition.X, MousePosition.Y))); Invalidate(); }; } void onLeMove() { if (LeMove != null) LeMove(this, PointToClient(new Point(MousePosition.X, MousePosition.Y))); } protected override void OnPaint(PaintEventArgs e) { e.Graphics.FillRectangle(new SolidBrush(BackColor), ClientRectangle); dataPoints.ForEach(p => e.Graphics.FillRectangle(Brushes.Green, new Rectangle(new Point(p.X - (6 / 2), p.Y - (6 / 2)), new Size(6, 6)))); if (dataPoints.Count > 1) e.Graphics.DrawLines(Pens.Yellow, dataPoints.ToA
@maximilian-krauss
maximilian-krauss / gist:1909966
Created February 25, 2012 18:29
updateSystem.NET - Asynchronous Updatecheck
#Region " Asynchroner Updatespaß "
Private Sub btnRunAsync_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunAsync.Click
'Updatesuche anstoßen
upctrlMain.checkForUpdatesAsync()
End Sub
'Dieses Event wird in jedem Falle nach Abschluß der Updatesuche gefeuert.
'Also bei gefundenen Updates, keinen neuen Updates und auch im Fehlerfall.
Private Sub upctrlMain_checkForUpdatesCompleted(ByVal sender As Object, ByVal e As updateSystemDotNet.appEventArgs.checkForUpdatesCompletedEventArgs) Handles upctrlMain.checkForUpdatesCompleted
@maximilian-krauss
maximilian-krauss / gist:1556449
Created January 3, 2012 19:20
TreeView Select Next/Previous Item
' (c) TommyB http://shotty.devs-on.net
MyBase.KeyPreview = True
' ...
Private Sub Me_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles Me.KeyDown
Dim SelectedNode As TreeNode = NaviTreeView.SelectedNode
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
var dynamo = function(obj, path, value) {
if(obj === undefined || path === undefined) {
return undefined;
/*
Pass n arguments or an array with values and this method returns the first with a valid value.
Invalid values are: null, undefined, 0, ''
*/
var coalesce = function(/* n arguments */) {
var index,
args;
if(arguments.length === 0) {
return undefined;

Keybase proof

I hereby claim:

  • I am maximilian-krauss on github.
  • I am maximilian (https://keybase.io/maximilian) on keybase.
  • I have a public key whose fingerprint is 83CA 569E 408F 88D2 E0D1 7E7D AAFB 2BD2 4929 04B5

To claim this, I am signing this object: