Skip to content

Instantly share code, notes, and snippets.

@rproenca
rproenca / Clipboard.js
Last active July 5, 2025 22:31
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
@luruke
luruke / smashingmagazine.js
Last active June 19, 2025 11:33
Source code of the demo "Improving User Flow Through Page Transitions" on Smashing Magazine.
/*
https://www.smashingmagazine.com/2016/07/improving-user-flow-through-page-transitions/
You can copy paste this code in your console on smashingmagazine.com
in order to have cross-fade transition when change page.
*/
var cache = {};
function loadPage(url) {
if (cache[url]) {
@btfak
btfak / useHexo.md
Created May 26, 2016 09:41
How to use Hexo and deploy to GitHub Pages
@addyosmani
addyosmani / pwas.md
Last active June 10, 2020 18:30
💄💋 Progressive Web Apps across popular frameworks that I have written or contributed significantly to

React HN (Universal rendering, Offline caching, optimisations)

React + Webpack application using the PRPL pattern

@atma
atma / docker-clean.sh
Created May 4, 2016 00:19
Clean all Docker containers and/or images
#clean all containers:
docker ps -a | sed '1 d' | awk '{print $1}' | xargs -L1 docker rm
#clean all images:
docker images -a | sed '1 d' | awk '{print $3}' | xargs -L1 docker rmi -f
@Restuta
Restuta / framework-sizes.md
Last active June 11, 2025 03:17
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@meritt
meritt / better-webfont-loading-with-localstorage-and-woff2.js
Last active January 12, 2024 14:26
Улучшение загрузки веб-шрифтов с использованием localStorage и поддержкой формата WOFF2
// Этот скрипт должен быть размещён в <head> над всеми внешними объявлениями стилей (link[rel=stylesheet])
function loadFont(fontName, woffUrl, woff2Url) {
// 0. Многие неподдерживаемые браузеры должны останавливать работу тут.
var nua = navigator.userAgent;
var noSupport = !window.addEventListener // IE8 и ниже
|| (nua.match(/(Android (2|3|4.0|4.1|4.2|4.3))|(Opera (Mini|Mobi))/) && !nua.match(/Chrome/)) // Android Stock Browser до 4.4 и Opera Mini
if (noSupport) {
return;
}
@paulirish
paulirish / what-forces-layout.md
Last active August 11, 2025 02:26
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
@PurpleBooth
PurpleBooth / README-Template.md
Last active August 13, 2025 09:33
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites