Skip to content

Instantly share code, notes, and snippets.

View heiswayi's full-sized avatar
👽

Heiswayi Nrird heiswayi

👽
View GitHub Profile
@heiswayi
heiswayi / Bindable.cs
Created June 5, 2016 21:32 — forked from btshft/Bindable.cs
Bindable class to reduce boilerplate code in mvvm (implement INotifyPropertyChanged)
namespace Helpers
{
///<summary>
/// Reduce mvvm boilerplate
///
/// Usage:
/// public class MyViewModel : Bindable {
/// // Now this property supports INotifyPropertyChanged
/// public string MyProperty
/// {
@heiswayi
heiswayi / program.cs
Last active May 10, 2018 08:53
List all installed .NET Framework versions in a PC
using Microsoft.Win32;
using System;
namespace List_NET_Version_Installed
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(".NET Framework Versions");
@heiswayi
heiswayi / SubstringExtensions.cs
Created December 25, 2016 15:40
C# Utilities - Substring extensions
namespace Helpers
{
internal static class SubstringExtensions
{
/// <summary>
/// Get string value between [first] a and [last] b.
/// </summary>
public static string Between(this string value, string a, string b)
{
int posA = value.IndexOf(a);
@heiswayi
heiswayi / copyToGitHub.bat
Last active August 2, 2018 16:33
Batch scripting to copy compiled Jekyll source into GitHub repo, but first delete previous folders and files
@echo off
set from="G:\GIT-REPOS\MyBitBucket\heiswayi.nrird.com\_site"
set to="G:\GIT-REPOS\MyGitHub\heiswayi.github.io"
for %%i in (%to%\*) do (
del /S /Q %%i
)
for /d %%i in (%to%\*) do (
@heiswayi
heiswayi / html-style-guide.md
Created September 23, 2015 05:39 — forked from ryansechrest/html-style-guide.md
HTML style guide with coding standards and best practices.

HTML Style Guide

All rules and guidelines in this document apply to HTML files.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Icon Legend:

· Space, Tab, Enter/Return

@heiswayi
heiswayi / TextBoxMaskBehavior.cs
Created November 3, 2018 19:50
WPF utilities: TextBox masking
using System;
using System.Windows;
using System.Windows.Controls;
using System.Globalization;
namespace WpfUtilities
{
public class TextBoxMaskBehavior
{
#region MinimumValue Property
@heiswayi
heiswayi / form-ui.html
Created November 6, 2017 19:06
Form UI Mockup Framework
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Formalize CSS</title>
</head>
<body>
<div id="wrapper">
<h1>
Example of all form elements
@heiswayi
heiswayi / function.js
Created October 13, 2015 02:37
Escape ALL characters (JavaScript)
function escapeAll(str) {
var hexString = '';
for (var c in str) {
c = str.charAt(c);
for (i = 0; i < 256; ++i) {
// convert i into a 2-digit hex string
var h = i.toString(16);
if (h.length == 1)
h = "0" + h;
@heiswayi
heiswayi / LargestTriangleThreeBuckets.cs
Created August 22, 2019 11:58 — forked from DanielWJudge/LargestTriangleThreeBuckets.cs
Largest-Triangle-Three Bucket Downsampling Graphs in C#
public static IEnumerable<Tuple<double, double>> LargestTriangleThreeBuckets(List<Tuple<double, double>> data, int threshold)
{
int dataLength = data.Count;
if (threshold >= dataLength || threshold == 0)
return data; // Nothing to do
List<Tuple<double, double>> sampled = new List<Tuple<double, double>>(threshold);
// Bucket size. Leave room for start and end data points
double every = (double)(dataLength - 2) / (threshold - 2);

Keybase proof

I hereby claim:

  • I am heiswayi on github.
  • I am heiswayi (https://keybase.io/heiswayi) on keybase.
  • I have a public key whose fingerprint is 7F4E 5907 A6AB 0D10 BADC ABE3 B7B7 B2B1 9180 5E81

To claim this, I am signing this object: