Skip to content

Instantly share code, notes, and snippets.

@getify
getify / 1.html
Last active May 10, 2023 03:25
Ever noticed how vw/vh units in CSS seem to be a bit unreliable on various devices (especially mobile)? Here's my solution.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>Test Page</title>
<script>
// early compute the vw/vh units more reliably than CSS does itself
computeViewportDimensions();
@tomhicks
tomhicks / plink-plonk.js
Last active July 26, 2024 01:10
Listen to your web pages
@sean0x72
sean0x72 / electron-win-drag.js
Created July 10, 2018 06:17
simulating windows areosnap feature when dragging a frameless window without using a draggable region
/*
There is no api for windows areosnap feature that I could find or not way to trigger it with the windows hotkeys.
*/
const titleBar = document.getElementById('title-bar');
const { remote, screen } = require('electron');
let activate = false;
const win = {
offsetX: 0,