Skip to content

Instantly share code, notes, and snippets.

View 1ockwood's full-sized avatar

Craig Lockwood 1ockwood

View GitHub Profile
@1ockwood
1ockwood / container-queries.js
Last active March 8, 2022 23:41
Container Queries
// Container Queries
// https://philipwalton.com/articles/responsive-components-a-solution-to-the-container-queries-problem/
// Only run if ResizeObserver is supported.
if ('ResizeObserver' in self) {
// Create a single ResizeObserver instance to handle all
// container elements. The instance is created with a callback,
// which is invoked as soon as an element is observed as well
// as any time that element's size changes.
var ro = new ResizeObserver(function(entries) {
@1ockwood
1ockwood / default-packages
Created November 21, 2020 22:01
nvm default packages
npm-check
svgo
@1ockwood
1ockwood / svg-add-viewbox.md
Last active September 17, 2019 18:12
Add viewBox attribute to SVG

Finds svg code containing width and height attributes, but no viewBox attribute. Replaces it with viewBox attribute included.

Search:

<svg baseProfile="tiny" xmlns="http:\/\/www\.w3\.org\/2000\/svg" width="([1-9]\d*)(\.\d+)?" height="([1-9]\d*)(\.\d+)?">

Replace:

These are blank space characters that sometimes get introduced when copying and pasting from Photoshop, Sketch, etc.
--><--
-->
<--
@1ockwood
1ockwood / keybase.md
Created May 20, 2018 13:26
Keybase Proof

Keybase proof

I hereby claim:

  • I am 1ockwood on github.
  • I am 1ockwood (https://keybase.io/1ockwood) on keybase.
  • I have a public key ASCvp2Kb-EMCu1j8ZaGAJwRiE9Vwg5iOOVkXS6JqGjPJjgo

To claim this, I am signing this object:

@1ockwood
1ockwood / .stylelintrc
Created February 28, 2018 20:55
Stylelint Config
{
"extends": "stylelint-config-standard",
"rules": {
"indentation": 2,
"string-quotes": "double",
"no-duplicate-selectors": true,
"color-hex-case": "lower",
"selector-combinator-space-after": "always",
"selector-attribute-quotes": "always",
"selector-attribute-operator-space-before": "never",