Skip to content

Instantly share code, notes, and snippets.

vieron / Export each as SVG.js
Last active June 4, 2021 20:26
Export each as SVG. Modified some lines from the original by Aaron Beall ( to export each selected object as a separate SVG file.
// Fireworks JavaScript Command
// Exports current document state as SVG graphics format
// Install by copying to Fireworks/Configuration/Commands/
// Run via the Commands menu in Fireworks
// Aaron Beall 2010-2011
// Version
var VERSION = "0.6.1";
// Params
asafge / ng-really.js
Created November 12, 2013 13:06
ng-really? An AngularJS directive that creates a confirmation dialog for an action.
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
maxboeck / donottrack.js
Last active November 6, 2023 10:00
Check "Do Not Track" Client Hint
const allowsTracking = () => {
const dnt =
window.doNotTrack ||
navigator.doNotTrack ||
if (dnt === 1 || dnt === '1' || dnt === 'yes') {
return false
if ('msTrackingProtectionEnabled' in window.external) {
return !window.external.msTrackingProtectionEnabled()
praveenpuglia /
Last active March 28, 2024 15:06
Everything you need to know about Shadow DOM

I am moving this gist to a github repo so more people can contribute to it. Also, it makes it easier for me to version control.

Please go to - for latest version of this document. Also, if you find the document useful, please shower your love, go ⭐️ it. :)

Shadow DOM

Heads Up! It's all about the V1 Spec.

In a nutshell, Shadow DOM enables local scoping for HTML & CSS.

DaveMDS /
Last active May 6, 2024 04:49 — forked from ta264/
Install docker on arm64 synology
set -e
echo "Downloading docker $DOCKER_VERSION-$ARCH"
curl "$ARCH/docker-$DOCKER_VERSION.tgz" | tar -xz -C /usr/local/bin --strip-components=1
ljharb /
Last active May 22, 2024 09:22
Array iteration methods summarized

Array Iteration

While attempting to explain JavaScript's reduce method on arrays, conceptually, I came up with the following - hopefully it's helpful; happy to tweak it if anyone has suggestions.


JavaScript Arrays have lots of built in methods on their prototype. Some of them mutate - ie, they change the underlying array in-place. Luckily, most of them do not - they instead return an entirely distinct array. Since arrays are conceptually a contiguous list of items, it helps code clarity and maintainability a lot to be able to operate on them in a "functional" way. (I'll also insist on referring to an array as a "list" - although in some languages, List is a native data type, in JS and this post, I'm referring to the concept. Everywhere I use the word "list" you can assume I'm talking about a JS Array) This means, to perform a single operation on the list as a whole ("atomically"), and to return a new list - thus making it mu

Git Cheat Sheet


Getting Started

git init


dergachev /
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF


To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

paulirish /
Last active July 20, 2024 17:43
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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent