Skip to content

Instantly share code, notes, and snippets.

@svoisen
svoisen / main.rs
Last active May 20, 2022 03:03
Print histogram of file line lengths using Rust
// Dependencies required in Cargo.toml
// clap = { version = "3.1.7", features = ["derive"] }
// deque = "0.3.2"
// ignore = "0.1.6"
// num_cpus = "1.13.1"
use clap::Parser;
use deque::{Stealer, Stolen};
use ignore::WalkBuilder;
use num_cpus;
@svoisen
svoisen / onEnter.elm
Last active December 24, 2021 16:06
Handle onEnter in Elm including input value
onEnter : (String -> msg) -> Attribute msg
onEnter tagger =
let
isEnter code =
if code == 13 then
Decode.succeed ""
else
Decode.fail ""
decodeEnter =
Decode.andThen isEnter keyCode
@svoisen
svoisen / Of Mice and Men
Created March 21, 2013 19:16
Information on low-level scrolling events on Mac OS X
From the WebKit documentation at:
http://www.opensource.apple.com/source/WebKit/WebKit-7533.16/chromium/src/mac/WebInputEventFactory.mm
// Of Mice and Men
// ---------------
//
// There are three types of scroll data available on a scroll wheel CGEvent.
// Apple's documentation ([1]) is rather vague in their differences, and not
// terribly helpful in deciding which to use. This is what's really going on.
//
@svoisen
svoisen / 8-column gridset Sass
Created February 13, 2013 23:50
Sass for generating a Gridset style 1-4-8 column responsive grid
$font-size: 1em
$line-height: 1.5em
@mixin column($width, $offset)
margin-left: $offset
width: $width
float: left
padding: 0 $line-height/2 0 $line-height/2
-webkit-box-sizing: border-box
box-sizing: border-box