Skip to content

Instantly share code, notes, and snippets.

Malte Ubl cramforce

Block or report user

Report or block cramforce

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cramforce
cramforce / simple-thermostat.groovy
Created Nov 5, 2019
Simple SmartThings Thermostat
View simple-thermostat.groovy
definition(
name: "Outdoor Thermostat",
namespace: "cramforce",
author: "Malte",
description: "Simple SmartThings Thermostat",
category: "Convenience",
iconUrl: "https://s3.images-iherb.com/sns/sns01567/u/3.jpg",
iconX2Url: "https://s3.images-iherb.com/sns/sns01567/u/3.jpg"
)
@cramforce
cramforce / settimeout.groovy
Created Dec 25, 2018
Debounce switches in SmartThings via switches, contact, and motion sensors.
View settimeout.groovy
definition(
name: "setTimeout",
namespace: "cramforce",
author: "Malte",
description: "Debounce switches based on switches, contact, and motion sensors.",
category: "Convenience",
iconUrl: "https://png.pngtree.com/svg/20170719/react_1353128.png",
iconX2Url: "https://png.pngtree.com/svg/20170719/react_1353128.png"
)
@cramforce
cramforce / dig.txt
Created Sep 6, 2017
dig foo.cdn.ampproject.org
View dig.txt
dig foo.cdn.ampproject.org
@cramforce
cramforce / main.py
Created Jul 17, 2017
Google App Engine ADT Pulse alert email to IFTT webhook adapter
View main.py
import logging
import re
# Receives alert emails from ADT Pulse and expects them to have
# an extra text of the form 'action=YOUR_ACTION' in the body.
# Calls IFTT with your key and the given action to trigger a webhook.
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
from google.appengine.api import urlfetch
import webapp2
@cramforce
cramforce / on-idle.js
Created Dec 7, 2016
Wrapper around requestIdleCallback to wait for a minimum work budget
View on-idle.js
/**
* Delays calling the given function until the browser is notifying us
* about a certain minimum budget or the timeout is reached.
* @param {!Window} win
* @param {number} startTime When we started waiting for idle.
* @param {number} minimumTimeRemaining Minimum number of millis idle
* budget for callback to fire.
* @param {number} timeout in millis for callback to fire.
* @param {function()} fn Callback.
*/
@cramforce
cramforce / merged-branches.sh
Created Sep 15, 2016
Find local git branches with a closed GitHub PR
View merged-branches.sh
#!/bin/bash
# Outputs commands to delete local branches that have an
# associated merged (really closed) PR.
# In particular, this also works if the remote branch was
# before merging rebased remotely.
# BIG CAVEAT: This will report branches that have a closed,
# but not merged PR for deletion.
@cramforce
cramforce / es6-modules-and-bundling.md
Last active May 29, 2017
ES6 modules and bundling
View es6-modules-and-bundling.md

Status quo

Current ES6 module usage (and general JS usage) in the browser relies on transpilation (due to non-widepread support in browsers) and bundling (to limit HTTP request count and HTTP waterfalls) for performance (module count easily goes into the 1000s which even with HTTP2 cannot be efficiently loaded in a module-per-request strategy; even when using Push to avoid HTTP waterfalls).

Bundling strategies

The bundlers use 2 large classes of strategies to bring N modules into a single JS file:

  1. (require.js, browserify, webpack): Each module gets put into a function that can be addressed by name. There is typically an export object per module where all exports are properties of that object.
  2. (closure compiler, rollup): Modules get compiled away and exported symbols become essentially global variables (at least within compilation unit) and directly accessed by other modules.
@cramforce
cramforce / no-efficient-feature-detection.md
Created Jun 23, 2016
Things that cannot be feature detected efficiently
View no-efficient-feature-detection.md
  • Supported allow- values in iframe sandbox attribute.
View closure compiler usage
--angular_pass : Generate $inject properties for
AngularJS for functions annotated
with @ngInject
--charset VAL : Input and output charset for all
files. By default, we accept UTF-8 as
input and output US_ASCII
--checks-only : Don't generate output. Run checks,
but no compiler passes.
--closure_entry_point VAL : Entry points to the program. Must be
goog.provide'd symbols. Any goog.provi
View gist:0ef82cde500f928068b1
npm i doesnt-exist
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "i" "doesnt-exist"
npm ERR! node v0.10.33
npm ERR! npm v2.14.1
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/doesnt-exist
npm ERR! 404
npm ERR! 404 'doesnt-exist' is not in the npm registry.
You can’t perform that action at this time.