Skip to content

Instantly share code, notes, and snippets.

View punker76's full-sized avatar
☮️
#PEACE

Jan Karger ツ ☀ punker76

☮️
#PEACE
View GitHub Profile
@punker76
punker76 / coffeescript_converter.rb
Created August 28, 2012 07:07 — forked from phaer/coffeescript_converter.rb
A trivial CoffeeScript.org -> Javascript plugin for jekyll ( https://github.com/mojombo/jekyll ). Put this file in '_plugins/' and write a YAML header to your .coffee files (i.e. "---\n---\n")
module Jekyll
require 'coffee-script'
class CoffeeScriptConverter < Converter
safe true
priority :normal
def matches(ext)
ext =~ /coffee/i
end
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
/// <summary>
/// Popup with code to not be the topmost control
@punker76
punker76 / 0_reuse_code.js
Created April 19, 2014 08:04
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@punker76
punker76 / DataGridColumnHeadersPresenter
Last active August 29, 2015 14:10
MahApps.Metro DataGridColumnHeadersPresenter without right header gripper
<!-- for ne metro style -->
<Style TargetType="{x:Type DataGridColumnHeadersPresenter}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeadersPresenter">
<Grid>
<Border IsHitTestVisible="False"
BorderThickness="0 0 0 3"
Background="Transparent"
BorderBrush="{DynamicResource GrayBrush5}" />
@punker76
punker76 / AeroColorProvider.cs
Created October 15, 2015 21:34 — forked from usagirei/AeroColorProvider.cs
MahApps Metro DWM Colored Accent
/*
* Provides DWM Color as a Bindable Property
* Add the Namespace
* xmlns:dwmAero="clr-namespace:MahApps.Metro.DWMAero"
* And a Resource
* <dwmAero:AeroColorProvider x:Key="AeroColorProvider" />
* Then Bind on the Properties (110%,95%,80%,65%,50% Respectively)
* Color="{Binding Source={StaticResource AeroColorProvider}, Path=Highlight}"
* Color="{Binding Source={StaticResource AeroColorProvider}, Path=Accent}"
* Color="{Binding Source={StaticResource AeroColorProvider}, Path=Accent2}"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls"
xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours"
xmlns:Converters="clr-namespace:MahApps.Metro.Converters">
<Converters:ThicknessBindingConverter x:Key="ThicknessBindingConverter" />
<Style x:Key="ExpanderBaseHeaderStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="Transparent" />
@punker76
punker76 / gist:702408f6770332f3405d291fbec8e403
Created October 7, 2016 06:49
IconPacks Xaml from the gif
<UniformGrid Columns="4" Rows="3" Grid.Row="0" RenderOptions.ClearTypeHint="Enabled" TextOptions.TextRenderingMode="ClearType">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Text="Flip.Normal"
Margin="4"
FontSize="14"
@punker76
punker76 / gist:62271a1205cceeef27253fac7678cb42
Created October 7, 2016 14:50
Opening a Xaml File in a shared Project
Intellisense could not be initialized due to the following error: System.ArgumentException: Empty path name is not legal.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at Microsoft.VisualStudio.Text.Implementation.TextDocumentFactoryService.OpenFileGuts(String filePath, DateTime& lastModifiedTimeUtc, Int64& fileSize)
at Microsoft.VisualStudio.Text.Implementation.TextDocumentFactoryService.OpenFile(String filePath, DateTime& lastModifiedTimeUtc, Int64& fileSize)
at Microsoft.VisualStudio.Text.Implementation.TextDocumentFactoryService.CreateAndLoadTextDocument(String filePath, IContentType contentType, Boolean attemptUtf8Detection, Boolean& characterSubstitutionsOccurred)
at Micro
@punker76
punker76 / PasswordBoxHelper.cs
Created October 12, 2017 21:36
GetPasswordBoxCaretPostion
private int GetPasswordBoxCaretPostion(PasswordBox passwordBox)
{
var infos = passwordBox?.GetType()?.GetProperty("Selection", BindingFlags.NonPublic | BindingFlags.Instance);
var selection = infos?.GetValue(passwordBox, null) as TextSelection;
var tTextRange = selection?.GetType()?.GetInterfaces()?.Where(x => x.Name == "ITextRange")?.FirstOrDefault();
var oStart = tTextRange?.GetProperty("Start")?.GetGetMethod()?.Invoke(selection, null);
var value = oStart?.GetType()?.GetProperty("Offset", BindingFlags.NonPublic | BindingFlags.Instance)?.GetValue(oStart, null) as int?;
var caretPosition = value.GetValueOrDefault(0);
return caretPosition;
}
@punker76
punker76 / CustomMetroRectToggleButtonStyle.xaml
Created November 1, 2017 23:07
A custom MahApps ToggleButton style.
<Style x:Key="CustomMetroRectToggleButtonStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource GrayBrush3}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>