Skip to content

Instantly share code, notes, and snippets.

@miwebguy
miwebguy / details.html
Last active August 28, 2023 16:42
Open Details on Destkop, Close on mobile
<script>
//<![CDATA[
//open or close details elements based on viewport
function openDesktopDetails()
{
const detailsEls = document.querySelectorAll(".wpc details");
var len = detailsEls.length;
var w = window.innerWidth;
if(w > 1023) {
detailsEls.forEach(function (item) {
@miwebguy
miwebguy / GIMP PSD Layers to PNG
Created February 10, 2023 18:10
Quick Export all layers in GIMP to PNG
GIMP PSD Layers to PNG
Export it as Open Raster (.ora), an open specification for layered-image files.
Export Image as Open Raster (.ora)
File -> Export As ...
myfile.ora
Open myfile.ora as an archive, with a program like file-roller or 7zip.
https://askubuntu.com/questions/485917/gimp-export-every-layer-as-a-separate-png-image
@miwebguy
miwebguy / simpletoc.js
Last active April 21, 2022 17:00
Simple Table of Contents from Headings
//https://stackoverflow.com/questions/187619/is-there-a-javascript-solution-to-generating-a-table-of-contents-for-a-page
window.onload = function () {
var toc = "";
var level = 0;
document.getElementById("VNAArticle").innerHTML =
document.getElementById("VNAArticle").innerHTML.replace(
/<h([\d])>([^<]+)<\/h([\d])>/gi,
function (str, openLevel, titleText, closeLevel) {
@miwebguy
miwebguy / ShareLinks.txt
Last active February 12, 2025 17:07
Share Links
@miwebguy
miwebguy / CoreDates.php
Created September 2, 2021 14:39
PHPDateStuff
<?php
class CoreDates
{
/**
* @brief Return the greater of 2 dates
* @param $_first (str date)
@miwebguy
miwebguy / VBInstallScreenTooSmall.md
Last active August 10, 2021 19:29
Virtualbox Linux install - install screen to small?
@miwebguy
miwebguy / gist:bb971144b5a67d466e1c8250a08c7930
Created June 17, 2021 18:35
VB-Ubuntu Small Install Screen
https://stackoverflow.com/questions/57115746/virtualbox-screen-resolution-too-small-during-installation
Boot the installer in EFI mode not legacy-BIOS mode.
It's Settings->System->Enable EFI (special OSes only).
I just tested this with POP!_OS 20.10. BIOS mode: tiny 800x600 window. EFI mode: window is large enough to fit the installer.
If you do get an 800x600 window, you can also move the installer window so that you can see the desktop, right-click on the desktop, choose "Display Settings", and increase the resolution.
<style>
/* based on https://codepen.io/dannibla/pen/amgRNR */
.floating-label {position:relative}
.floating-input {display:block; width:300px; background-color:transparent}
.floating-label label {font-weight:normal;position:absolute;pointer-events:none;left:9px;top:8px;font-size:smaller; transition: all .2s ease-in-out;}
.floating-input:focus {margin-top:12px}
.floating-input:focus ~ label, .floating-input:not(:placeholder-shown) ~ label {top:-2px;background-color:#fff; transition: all .2s ease-out-in;}
.floating-select:focus ~ label , .floating-select:not([value=""]):valid ~ label {top:-18px}
/**** floating-Lable style end ****/
</style>
@miwebguy
miwebguy / table2csv.js
Created March 11, 2021 15:00
VanillaJS Table to CSV Export
function table2csv(table_id) {
// based on https://stackoverflow.com/questions/15547198/export-html-table-to-csv
// Quick and simple export target #table_id into a csv
var separator = ',';
// Select rows from table_id
var rows = document.querySelectorAll('table#' + table_id + ' tr');
// Construct csv
var csv = [];
for (var i = 0; i < rows.length; i++) {
@miwebguy
miwebguy / NiceBlockQuotePattern.html
Created December 30, 2020 14:52
NiceBlockQuotePattern
<style>
blockquote {
background: #f9f9f9;
border-left: 10px solid #ccc;
margin: 1.5em 10px;
padding: 0.5em 10px;
quotes: "\201C""\201D""\2018""\2019";
}
blockquote:before {
color: #ccc;