Skip to content

Instantly share code, notes, and snippets.

@drodsou
drodsou / copyHtmlTableForExcel.js
Last active April 6, 2025 10:00
Copy HTML table to clipboard, for pasting in Excel (javascript)
// In Excel make sure to have this option enabled: Home / Clipboard / Options / Collect without showing the Office clipboard
// Tested in Windows 10 only
let table = document.querySelector('#table').outerHTML;
table = table
.replaceAll('\n','<br style="mso-data-placement:same-cell;"/>') // new lines inside html cells => Alt+Enter in Excel
.replaceAll('<td','<td style="vertical-align: top;"'); // align top
navigator.clipboard.writeText(table).then(
()=>console.log("success"),
(e)=>console.log("error", e),
@muxa
muxa / garage.yaml
Last active May 25, 2024 18:41
ESPHome Garage Switch with State Machine
substitutions:
room: Garage
device_name: Garage Switch
esphome:
name: garage_switch
platform: ESP8266
board: esp01_1m
wifi:
@xirixiz
xirixiz / pihole-macvlan-synology-docker.txt
Last active December 2, 2024 19:32
Add a PiHole instance on a macvlan enabled Docker network (Synology eth0 example)
#!/bin/bash
# NAS IP: 192.168.1.10 in this example
# DHCP scope reservation for macvlan: 192.168.1.210/28 (Details below)
## Network: 192.168.1.210/28
## HostMin: 192.168.1.211
## HostMax: 192.168.1.224
## Hosts/Net: 14
# Create a Synology macvlan0 bridge network attached to the physical eth0, and add the ip range scope (sudo)
@igogrek
igogrek / How I stopped loving Angular.md
Last active August 14, 2024 20:45
How I stopped loving Angular

I've worked with AngularJS for many years now and still use it in production today. Even though you can't call it ideal, given its historically-formed architecture, nobody would argue that it became quite a milestone not only for evolution of JS frameworks, but for the whole web.

It's 2017 and every new product/project has to choose a framework for development. For a long time I was sure that new Angular 2/4 (just Angular below) will become the main trend for enterprise development for years to come. I wasn't even thinking of working with something else.

Today I refuse to use it in my next project myself.

@westc
westc / toggleFullscreen.js
Last active March 2, 2020 08:07
Toggles fullscreen mode by checking which features are available.
/**
* @license Copyright 2020 - Chris West - MIT Licensed
* @see https://www.yourjs.com/blog/snippet-toggle-fullscreen/
* Either toggles the fullscreen view on the document or a specified element or
* turns the fullscreen view on or off depending on the optional value passed
* in.
* @param opt_elem {Element|undefined|null}
* The element that should be targeted for fullscreen viewing.
* @param opt_value {?boolean=}
* Optional. If not given or undefined or null fullscreen will simply be
@JPvRiel
JPvRiel / ubunut_network_manager_docker_dns_workaround.md
Last active March 14, 2025 14:17
Ubuntu, NetworkManager and Docker DNS workaround

Docker issues are frequently logged for DNS resolution in containers because it doens't inhert or get values for DNS from NetworkManager which leverages a built in dnsmasq to inteligently manage DNS.

Perminant workarround

sudo bash -c "echo listen-address=$(ip -4 addr show dev docker0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}') > /etc/NetworkManager/dnsmasq.d/docker-bridge"
sudo systemctl reload NetworkManager
sudo bash -c 'echo -e "{\n\t\"dns\": [\"$(ip -4 addr show dev docker0 | grep -oP "(?<=inet\s)\d+(\.\d+){3}")\"]\n}" > /etc/docker/daemon.json'
sudo systemctl restart docker
@paulirish
paulirish / what-forces-layout.md
Last active April 8, 2025 12: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
@robvanoostenrijk
robvanoostenrijk / instructions.md
Created October 27, 2014 04:47
IKVM: Apache Fop

Place compiled Apache FOP in folder structure:###

  • \build\fop.jar
  • \lib\avalon-framework-4.2.0.jar
  • \lib\batik-all-trunk.jar
  • \lib\commons-io-1.3.1.jar
  • \lib\commons-logging-1.0.4.jar
  • \lib\fontbox-1.8.5.jar
  • \lib\fop-20140825.dll
  • \lib\serializer-2.7.0.jar
@waldyrious
waldyrious / Unicode pangram.md
Last active April 14, 2021 12:49
Rough Unicode coverage test for fonts

Unicode pangrams

This is a text consisting of a list of pangrams, sourced from the Wikipedia article, including characters from many common languages featuring true alphabets (mostly Latin-extended, Cyrillic and Greek). This is useful as an informal Unicode coverage tests for fonts, as well as a general generic prose test for fonts.

The quick brown fox jumps over the lazy dog.