Skip to content

Instantly share code, notes, and snippets.

//
// The following program is written by Leslie Carr, IAM Research Group, Southampton University, UK
// and is based on work Zigzag(TM) work owned by Ted Nelson.
//
// This file may be distributed freely for research purposes only. No commercial product or service
// may be based on it or on any part of version of it.
// All queries should be directed to the author at lac@ecs.soton.ac.uk
//
// VERSION 0.5.2 large (40 cell) table, deleting, hopping
// VERSION 0.5.5 experimental zigzag traversal
program = "some string"
number = program.bytes.map { |byte| byte.to_s(2).rjust(8, "0") }.join.to_i(2)
# => 139552669917336061109431911
number.to_s(2).scan(/.+?(?=.{8}*\z)/).map { |string| string.to_i(2).chr }.join
# => "some string"
tttttt
ttttth
ttttti
tttttn
tttttg
ttttts
ttttht
tttthh
tttthi
tttthn
@dzucconi
dzucconi / a.rb
Last active August 29, 2015 14:09 — forked from ahoward/a.rb
# this directive processor enhances sprockets with the ability to load bower
# and npm packages
#
# usage is simple
#
# //= browserify 'my_library'
# window.MyLibrary
# browserify.modules['my_library']
#
# if you would like to to control the name of what's loaded do this
class Redirector
FALLBACK = '/'
def self.url(a)
match(a)[:key]
end
def self.handle(url)
RedirectTable::MAP[url] || url(url) || FALLBACK
end

Keybase proof

I hereby claim:

  • I am dzucconi on github.
  • I am dzucconi (https://keybase.io/dzucconi) on keybase.
  • I have a public key whose fingerprint is 2AAF 4404 75DD 69FC 5B2F 4F55 A830 E131 C8D4 7A75

To claim this, I am signing this object:

type Omit = <T extends object, K extends Array<keyof T>>(
obj: T,
keys: K
) => { [K2 in Exclude<keyof T, K[number]>]: T[K2] }
/**
* Removes entries from an object based on a list of keys
*/
export const omit: Omit = (obj, keys) => {
const next = {} as { [K in keyof typeof obj]: (typeof obj)[K] }
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@dzucconi
dzucconi / a11y.ts
Created October 2, 2020 20:41
onA11yClick
type Handler<T> = (
event: React.KeyboardEvent<T> | React.MouseEvent<T, MouseEvent>
) => void
export const onA11yClick = <T>(handler: Handler<T>) => {
return {
tabIndex: 0,
role: "button",
onClick: (event: React.MouseEvent<T, MouseEvent>) => handler(event),
onKeyPress: (event: React.KeyboardEvent<T>) => {