Skip to content

Instantly share code, notes, and snippets.

Visual Studio Code shortcuts I use often

Navigation

Sidebar:

  • Cmd-Shift-F: search
  • Cmd-Shift-E: files

Navigating in current editor:

The scope of a variable is the region of the program in which you can directly access the variable:

if (true) {
  let x = 123;
}

Here, the scope of x is the then-block of this if-then-else statement.

@kgrz
kgrz / what-forces-layout.md
Created March 11, 2016 12:40 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@kgrz
kgrz / part1.md
Created February 17, 2016 05:00 — forked from practicingruby/part1.md

Inheritance is a key concept in most object-oriented languages, but applying it skillfully can be challenging in practice. Back in 1989, M. Sakkinen wrote a paper called Disciplined inheritance that addresses these problems and offers some useful criteria for working around them. Despite being more than two decades old, this paper is extremely relevant to the modern Ruby programmer.

Sakkinen's central point seems to be that most traditional uses of inheritance lead to poor encapsulation, bloated object contracts, and accidental namespace collisions. He provides two patterns for disciplined inheritance and suggests that by normalizing the way that we model things, we can apply these two patterns to a very wide range of scenarios. He goes on to show that code that conforms to these design rules can easily be modeled as ordinary object composition, exposing a solid alternative to tradi

@0xDE57
0xDE57 / config.md
Last active October 24, 2025 12:09
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@ourmaninamsterdam
ourmaninamsterdam / createRandomString.js
Created August 8, 2015 14:26
createRandomString()
function createRandomString(minLen, maxLen) {
var alphabet = 'abcdefghijklmnopqrstuvwxyz'.split(''),
stringLen = Math.floor(Math.random() * (maxLen - minLen + 1)) + minLen,
string = '';
for(var i = 0; i < stringLen; i++) {
string += alphabet[Math.floor(Math.random() * alphabet.length)];
}
return string;
}
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active December 17, 2025 23:35
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@ourmaninamsterdam
ourmaninamsterdam / setCssAttributeValue.js
Created April 8, 2015 12:35
Set CSS attribute value
function setCSSAttributeSelectorValue(selector, value) {
return selector.slice(0, selector.lastIndexOf(']')) + '=' + value + ']';
}