Skip to content

Instantly share code, notes, and snippets.


Alexander Milevski w8r

View GitHub Profile
w8r / graphToSVG.ts
Last active Apr 20, 2022
Graph to SVG
View graphToSVG.ts
type Id = string | number;
interface Node {
id: Id;
color: string;
radius: number;
x: number;
y: number;
strokeWidth?: number;
strokeColor?: string;
w8r / linked_list.ts
Created Jan 19, 2022
Simple doubly-linked list
View linked_list.ts
export class Node<T>{
data: T;
prev: Node<T> = null;
next: Node<T> = null;
constructor(data: T) { = data;
w8r / index.js
Created Dec 3, 2021 url shortening
View index.js
const url = ``;
.then(r => r.text())
.then(r => console.log(r));
View array-intersection.ts
function intersection(...lists) {
const result = [];
const resultLUT = {};
for(let i = 0; i < lists.length; i++) {
const currentList = lists[i];
for(let y = 0; y < currentList.length; y++) {
const currentValue = currentList[y];
if(!resultLUT[currentValue]) {
let existsInAll = true;
w8r / createDataContext.tsx
Created Nov 20, 2020
Create data context
View createDataContext.tsx
import React, { useReducer, Reducer, createContext, ReactNode, Dispatch } from "react";
type Action = <A>(dispatch: Dispatch<A>) => Function;
export default function <S, A extends Action>(
reducer: Reducer<S, A>,
actions: Record<string, A>,
initialState: S
) {
const Context = createContext<S>({} as S);
w8r /
Created Dec 14, 2019 — forked from benzguo/
Force Editor + Pan/Zoom

Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.

Built with D3.js.

View napoleon.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
w8r / .block
Last active Aug 6, 2019
Leaflet + mapbox-gl
View .block
license: mit
height: 500
border: no
w8r / Bunny.js
Created Jul 30, 2019 — forked from bberak/Bunny.js
How to use regl in React or React Native
View Bunny.js
import React, { PureComponent } from "react";
import { StyleSheet } from "react-native";
import ReglView from "./ReglView";
import mat4 from "gl-mat4";
import bunny from "bunny";
export default class Bunny extends PureComponent {
drawCommand = regl => {
return regl({
vert: `
w8r / .gitignore
Last active Apr 29, 2019
Namespaces vs. classes
View .gitignore