Skip to content

Instantly share code, notes, and snippets.

@weltkante
weltkante / ArrayBinder.cs
Created April 5, 2019 09:07
2d array wrapper for WPF datagrid binding
public sealed class ArrayBinder : IBindingList, ITypedList
{
private sealed class ArrayColumn : PropertyDescriptor
{
public ArrayBinder Owner { get; }
public int ColumnIndex { get; }
public ArrayColumn(ArrayBinder owner, int index)
: base($"[{index}]", null)
{
@David-Desmaisons
David-Desmaisons / knockout-isotope-adapted,from.mbest.js
Last active August 31, 2015 14:12 — forked from mbest/mbest-knockout-isotope.js
update to make it compatible with isotope 2.0
/*
Isotope binding for Knockout 3+
(c) Michael Best
Adapted by David Desmaisons to make it compatible with isotope 2.0
License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
"use strict";
ko.bindingHandlers.isotope = {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;
using System.Windows.Controls;
using System.Windows;
using System.Collections.ObjectModel;
using System.Collections;
using System.Windows.Markup;
@makenova
makenova / Difference between debounce and throttle.md
Last active February 22, 2023 03:09
Javascript function debounce and throttle

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@mbest
mbest / mbest-knockout-isotope.js
Last active June 30, 2016 15:54
Isotope binding for Knockout, using "arrayChange" feature of Knockout 3.0. Example: http://jsfiddle.net/mbest/ACSGx/
/*
Isotope binding for Knockout 3+
(c) Michael Best
License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
"use strict";
ko.bindingHandlers.isotope = {
init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
@wteuber
wteuber / fmod.js
Last active February 6, 2024 14:47
fmod for Javascript, will work with any ECMA-262 implementation.If you need a precision higher than 8, please use another implementaion of fmod.
/*
fmod for Javascript, will work with any ECMA-262 implementation.
If you need a precision higher than 8, please use another implementation of fmod.
1.05 % 0.05
=> 0.04999999999999999
Math.fmod(1.05, 0.05)
=> 0