Skip to content

Instantly share code, notes, and snippets.

@heiswayi
heiswayi / LargestTriangleThreeBuckets.cs
Created August 22, 2019 11:58 — forked from DanielWJudge/LargestTriangleThreeBuckets.cs
Largest-Triangle-Three Bucket Downsampling Graphs in C#
View LargestTriangleThreeBuckets.cs
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);
@heiswayi
heiswayi / gist:7775ec456f2e98b739a6c556a19e0cb1
Created April 26, 2018 04:58 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions
View gist:7775ec456f2e98b739a6c556a19e0cb1
View Effective_Engineer.md
@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)
View Bindable.cs
namespace Helpers
{
///<summary>
/// Reduce mvvm boilerplate
///
/// Usage:
/// public class MyViewModel : Bindable {
/// // Now this property supports INotifyPropertyChanged
/// public string MyProperty
/// {
@heiswayi
heiswayi / FocusExtension.cs
Created June 5, 2016 21:30 — forked from chuckdee68/FocusExtension.cs
FocusExtension - Focusing Controls in View from ViewModel using MVVM principles
View FocusExtension.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Supporting
{
@heiswayi
heiswayi / gist:34d0de1ddfa72fb53e7e
Created October 14, 2015 01:48 — forked from jwoschitz/gist:1129249
Brute force implementation / C#
View gist:34d0de1ddfa72fb53e7e
class Program
{
#region Private variables
// the secret password which we will try to find via brute force
private static string password = "p123";
private static string result;
private static bool isMatched = false;
@heiswayi
heiswayi / privacy-policy.md
Last active February 11, 2021 13:57 — forked from maddisondesigns/cookie-policy.md
eCommerce Terms & Conditions and Privacy Templates
View privacy-policy.md
@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.
View html-style-guide.md

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 / css-style-guide.md
Created September 23, 2015 05:39 — forked from fleishmanhillard/css-style-guide.md
CSS style guide with coding standards and best practices.
View css-style-guide.md

CSS Style Guide

All rules and guidelines in this document apply to css/scss files unless otherwise noted.

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.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts
@heiswayi
heiswayi / php-style-guide.md
Created September 23, 2015 05:38 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.
View php-style-guide.md

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

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.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts