Skip to content

Instantly share code, notes, and snippets.

View gmamaladze's full-sized avatar

George Mamaladze gmamaladze

View GitHub Profile
@gmamaladze
gmamaladze / README.md
Last active February 4, 2021 21:53 — forked from mbostock/.block
Nodes snapping to colored clusters - d3.js sample

Drag gray nodes into one of the colored clusters. They will snap to the group. You can also move nodes out of groups to regroup them.

Created using D3's force layout. Forekd from Multi-Foci Force Layout.

This code is distributed under MIT license. Copyright (c) 2013 George Mamaladze. See MIT license.

@gmamaladze
gmamaladze / A_README.md
Last active August 30, 2024 10:12
HashSet that preserves insertion order or .NET implementation of LinkedHashSet

HashSet that preserves insertion order or .NET implementation of LinkedHashSet

Many people naively assume an ordinary .NET HashSet preserves insertion order. Indeed HashSet accidentally preserves insertion order until you remove and re-add some elements. There is such a data structure in Java - LinkedHashSet which respects order and has O(1) RW times.

No, I did not find a (working) corresponding implementation in .NET. That's I wrote this one.

The implementation uses linked list in combination with dictionary to define the iteration, ordering and at the same time allow O(1) removal.

The order is not affected if an element is re-inserted into the set it retains it's old position.

@gmamaladze
gmamaladze / index.html
Last active August 29, 2015 14:04
Lego Power Functions Remote Control UI
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Lego Power Functions Remote Control</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
</head>
<body>