Skip to content

Instantly share code, notes, and snippets.

@martynchamberlin
martynchamberlin / scrollbars.md
Last active November 7, 2024 10:14
On the Width of Scroll Bars on Mac and Windows

How It Works on Mac

By default, scroll bars do not appear on Mac except when the user is scrolling and when there is hidden content. You can double check this by going to System Preferences -> General -> Show scroll bars: Automatically based on mouse or trackpad.

When you do scroll, the width of viewport and the available width of the inner content does not change from what it was. If the width was 300 pixels, it still is 300 pixels.

If you change the "Show scroll bars" setting to "Always" then the scrollbar takes up a decided amount of width - 16 pixels to be precise.[^1] Let's say your browser height is 300 pixels and your broswer width is also 300 pixels. With this setting, if you toggle the height of the body from 300 to 600, causing scrollableness, then a scrollbar will appear only have you have done the toggle. The width of your body will have gone from 300 to 284 pixels, because the scrollbar takes up space in a way that it did not in the other setting. Interestingly, if you're talking about

@aaugustin
aaugustin / question.md
Last active July 24, 2024 03:05
Accessibility in browsers: zoom level vs. font size

Scroll to the bottom for the answer

Question

There's two ways to increase the default font size in browsers:

  1. set a default zoom level > 100% ("page zooming")
  2. set a default font size > 16px ("text scaling")

Option 1 relies on the browser's proportional scaling. This feature was

Articles

  • How does the go build command work ? URL (2016-07-26 13:41:13) [4 min]

  • Test Driven Development Kata \u2013 Roman to Arabic in JavaScript URL (2016-07-20 12:32:56) [7 min]

  • C# - The C# Memory Model in Theory and Practice, Part 2 URL (2016-07-20 11:01:41) [18 min]

  • What every programmer needs to know about game networking URL (2016-07-07 11:02:52) [8 min]

@riceissa
riceissa / LICENSE
Last active April 7, 2021 14:50
for pandoc; like -M links-as-notes:true, but better
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@Rich-Harris
Rich-Harris / service-workers.md
Last active May 3, 2025 12:49
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@olih
olih / jq-cheetsheet.md
Last active May 10, 2025 20:55
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@jkva
jkva / csun16.md
Last active April 6, 2016 12:54
A light-hearted description of my CSUN 2016 attendance

CSUN 2016 was fun. A lot of fun.

Mostly because of the people I got to hang out with for a week. Thinking about it, I can't really come up with anything I didn't like. Which is good.

What I took away from CSUN '16:

  • Getting a local AT&T sim card is really useful to be able to SMS, call and tweet. It makes synchronising get-togethers a breeze.
  • #a11y people like to party.
  • Sign language karaoke is a thing. See above.
@enjalot
enjalot / README.md
Last active October 9, 2024 12:17
aframe + d3 test

Testing out aframe.io with d3.js.

Since AFrame works with DOM elements, you can use d3's selection API to generate and modify 3D elements, as well as handle "mouse" events (including the VR friendly "fuse cursor") as if it was SVG.

Built with blockbuilder.org

@paullewis
paullewis / requestIdleCallback.js
Last active April 23, 2025 04:07
Shims rIC in case a browser doesn't support it.
/*!
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@skeeto
skeeto / Makefile
Created October 21, 2014 03:51
C Object Oriented Programming Example
CFLAGS = -std=c99 -Wall
main : main.o
.PHONY : test clean
test : main
./$^ "*regex*" "*vtable*" < main.c
clean :