Skip to content

Instantly share code, notes, and snippets.

View Constantiner's full-sized avatar
:octocat:
Glory to mankind!

Konstantin Kovalev Constantiner

:octocat:
Glory to mankind!
View GitHub Profile
@nrkn
nrkn / index.ts
Last active May 25, 2020 08:52
TypeScript pattern matching with predicates
import { Shape } from './shapes.types'
import { area, perimeter } from './shapes.lib'
const shapes: Shape[] = [
{ radius: 4 }, { side: 5 }, { width: 6, height: 7 }
]
const totalArea = shapes.reduce(
( sum, shape ) => sum + area( shape ),
0
@jayj
jayj / flexbox.less
Last active April 22, 2025 14:38
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox