Skip to content

Instantly share code, notes, and snippets.

@kausters
kausters / pagination.js
Last active December 16, 2019 09:54
Generate bracketed page list for pagination; no loops or mutation
/**
* Calculate start and end page numbers for page list in pagination
*
* Page list is expanded to the left and right of the current page by the
* amount in [bracketing] argument but without exceeding outer bounds.
*
* For example (7 pages total, bracketing by 2):
* [1] 2 3 4 5
* 1 [2] 3 4 5
* 1 2 [3] 4 5

Keybase proof

I hereby claim:

  • I am kausters on github.
  • I am kristaps (https://keybase.io/kristaps) on keybase.
  • I have a public key whose fingerprint is 9885 30EE 7E43 084B 6CDF 6900 8DF1 F42D 7F8F 9A67

To claim this, I am signing this object:

@kausters
kausters / selection.scss
Created January 28, 2013 17:04
A simple SCSS mixin for generating ::selection rules for selected text. Usage: @include selection { /* your style */ }
@mixin selection {
& ::selection {
@content;
}
& ::-moz-selection {
@content;
}
}