Instantly share code, notes, and snippets.

View color-contrast.css
The CSS4 contrast adjuster mimicked with just custom properties and calc().
While it's pretty straightforward to mimick the hue, saturation and
lightness adjusters, color contrast requires some "serious" math.
Results are not perfect, but very much usable IMHO.
Syntax of course is even more bloated than for the simple adjusters stated above.
html::before {
/* A few demo styles. */
position: fixed;
# Windows (Git bash)
dd if=/dev/urandom of=tmp bs=100kB count=1 && base64 tmp > big && rm tmp && cat big > /dev/clipboard && rm big
# Mac OS
dd if=/dev/urandom of=tmp bs=100kB count=1 && base64 tmp > big && rm tmp && cat big | pbcopy && rm big
View MySQL-query-log.sql
set global general_log = 1;
set global log_output = 'table';
select event_time, substring(argument,1,100) from mysql.general_log where event_time > time('08:58');
SET global general_log = 0;
View gist:d8c79e180b269b237803303122feee07
Browser unresponsive when large amount of text is inside text input field.
1. Visit this page: data:text/html,<!doctype html><html style="min-height: 300vh"><input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" type="text"></input>
2. Paste a large amount of text (between 10k and 100k characters, depending on your machine) into the text input.
3. Try repositioning the cursor, or scrolling
=> You'll experience serious lag, whereas Chrome on Mac OS, as well as other browsers, are just fine.
View requireParams.js
import {difference} from 'lodash';
export function BadRequestError(message) { = 'BadRequestError';
this.statusCode = 400;
this.message = 'Bad request. ' + message;
BadRequestError.prototype = Object.create(Error.prototype);
BadRequestError.prototype.constructor = BadRequestError;
View _.whereDeep.js
* Pimped version of `_.where` ( that can recurse deep.
* @param {Array|Object|string} collection The collection to search.
* @param {Object} source The object of property values to match.
* @param {String} prop The property of the collection to recurse into.
* @returns {Array} the new filtered array.
var whereDeep = function (collection, source, prop) {
'use strict';
View delayedFonts.diff
diff --git a/source/brix/brix.core.editor/editor.less b/source/brix/brix.core.editor/editor.less
index a8b569d..73bc245 100644
--- a/source/brix/brix.core.editor/editor.less
+++ b/source/brix/brix.core.editor/editor.less
@@ -1,6 +1,6 @@
// Fonts & Icons
-@import url(",300,400,600,700");
+@import url(",300,400,600,700");
@import url("");
View gist:a03395c351ddbe277f9f
Set-StartScreenOptions -EnableBootToDesktop -EnableDesktopBackgroundOnStart -EnableShowStartOnActiveScreen -EnableShowAppsViewOnStartScreen -EnableSearchEverywhereInAppsView -EnableListDesktopAppsFirst
cinst 7zip.install
cinst classic-shell
cinst Console2
cinst curl
cinst dropbox
cinst fiddler4
cinst Firefox
cinst flashplayerplugin
View console-paste-styles.js
(() => {
var style = document.createElement("style");
var rules = prompt('Paste CSS rules here');
var importStatements = (rules.split(';') || []).filter(s => s.startsWith('@import')).map(s => s + ';');
importStatements.forEach((importStatement, index) => style.sheet.insertRule(importStatement, index));
style.sheet.insertRule(`@media all{${rules}`, importStatements.length);