Skip to content

Instantly share code, notes, and snippets.

Avatar

patrick kettner patrickkettner

View GitHub Profile
View largest_element_with_ background+image.js
function getURLOfLargestBackgroundImage() {
var _elms = new Map();
var _canidates = new Map();
const HEIGHT = document.documentElement.clientHeight * 1.4;
const WIDTH = document.documentElement.clientWidth;
const GRANULARITY_IN_PX = 10
const MIN_WIDTH = 150
const MIN_HEIGHT = 150
View dehumidifier.js
const Frigidaire = require('frigidaire');
const debug = require('debug')('frigidaire');
Frigidaire.prototype.DEHUMIDIFIER_MODE = 10002
Frigidaire.prototype.FAN_SPEED_ACTUAL = 10003
Frigidaire.prototype.FAN_SPEED_SETTING = 10004
Frigidaire.prototype.FILTER_STATUS = 10009
Frigidaire.prototype.FULL_BUCKET_INDICATOR = 10010
Frigidaire.prototype.HUMIDITY_SETTING = 10011
Frigidaire.prototype.HUMIDITY_ROOM = 10012
View google_text_measurement.js
function(a) {
if (!a) return 0;
var b = s_ed("div");
b.style.position = "absolute";
b.style.whiteSpace = "pre";
b.style.font = "16px arial,sans-serif";
a = s_OH(a);
s_Rc(b, a);
document.body.appendChild(b);
a = Math.round(b.offsetWidth);
View icon font bigquery
SELECT REGEXP_EXTRACT(url, r'(captainicon|octicon|typicon|entypo|mfglabsiconset|ionicons|fontawesome|icomoon)') type, count(distinct(pageid)) cnt
FROM [httparchive:runs.2018_01_15_requests]
WHERE REGEXP_MATCH(url, r'captainicon|octicon|typicon|entypo|mfglabsiconset|ionicons|fontawesome|icomoon')
GROUP BY type
ORDER BY cnt desc;
View tufte.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T
Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECcwLjM0OTYyMDY0
MDMgMC4yODg3OTMyMzYgMC40OTE4MjgwMjQ0IDFPECcwLjI3NjkyNjc4NTcgMC4yMTQx
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<ui-pane id="middle" style="grid-template-columns: 319px 1fr 299px;" row1="" disablegridtemplates="" disablegridstartandend="" hgrid=""><ui-pane id="propertiesBar" role="section" col1="" captioned="" dockleft=""><ui-caption><span class="pane-caption-text">Properties</span><ui-close-button title="Close"><svg xmlns="http://www.w3.org/2000/svg" fill="#000000" viewBox="0 0 24 24" width="48" height="48"> <path d="M 19 6.41 L 17.59 5 L 12 10.59 L 6.41 5 L 5 6.41 L 10.59 12 L 5 17.59 L 6.41 19 L 12 13.41 L 17.59 19 L 19 17.59 L 13.41 12 Z" /> <path fill="none" d="M 0 0 h 24 v 24 H 0 Z" /> </svg></ui-close-button></ui-caption><ui-body row2=""><ui-propertygrid><ui-propertygrid-container><ui-propertygrid-table><tr><td class="firstRow" style="width: 50%;"></td><td class="firstRow"></td></tr></ui-propertygrid-table></ui-propertygrid-container><ui-propertygrid-footer style="display: none;"><span class="property-footer-title"></sp
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
height: 100vh;
width: 100vw;
View -
+-o AppleSmartBattery <class AppleSmartBattery, id 0x100000257, registered, matched, active, busy 0 (0 ms), retain 6>
{
"ExternalConnected" = No
"TimeRemaining" = 73
"InstantTimeToEmpty" = 17
"ExternalChargeCapable" = No
"FullPathUpdated" = 1493188334
"CellVoltage" = (3475,3520,3516,0)
"Voltage" = 10511
"BatteryInvalidWakeSeconds" = 30
View release_steps.md

release modernizr in 10 easy steps

  1. compare HEAD with most recent release to determine new semver level (fundemental/breaking changes = bump major, new feature-detects/publically-exposed-util = bump minor, update to existing code (in non behavior changing way) = bump patch). Github compare view is handy here (e.g. https://github.com/Modernizr/Modernizr/compare/v3.3.1...master)
  2. update package.json version to new semver version
  3. run git tag ${semver} (e.g. git tag v3.4.0), then push the tags (git push --tags)
  4. npm publish
  5. log into the modernizr.com server
  6. cd ~/modernizr-neue
  7. npm update && bower update
  8. npm run deploy
  9. pm2 restart 0
View index.html
<!DOCTYPE HTML>
<html>
<head>
<title>Chrome Bug?</title>
<script>
function A() {
"use strict";
B();
}