Skip to content

Instantly share code, notes, and snippets.

View voxpelli's full-sized avatar

Pelle Wessman voxpelli

View GitHub Profile
@voxpelli
voxpelli / apple-crossover-patch.diff
Last active June 7, 2023 17:34
Highlighted diff of the patch that Apple applies to CrossOver in the Game Porting Toolkit here: https://github.com/apple/homebrew-apple/blob/main/Formula/game-porting-toolkit.rb
This file has been truncated, but you can view the full file.
diff --git a/include/distversion.h b/include/distversion.h
new file mode 100644
index 00000000000..b8a3724b76b
--- /dev/null
+++ wine/include/distversion.h
@@ -0,0 +1,12 @@
+/* ---------------------------------------------------------------
+* distversion.c
+*
+* Copyright 2013, CodeWeavers, Inc.
@voxpelli
voxpelli / SASS_Color_Contrast.md
Last active August 21, 2022 11:49
Pure SASS script for calculating contrast ratios of colors. MOVED TO: https://github.com/voxpelli/sass-color-helpers

Pure SASS-adaption of Lea Verou's contrast-ratio javascript. Can be useful when eg. generating colored buttons from a single supplied color as you can then check which out of a couple of text colors would give the best contrast.

This script currently lacks the support for alpha-transparency that Lea supports in her script though.

In addition to the color-contrast adaption there's also some math methods that were needed to be able to calculate the exponent of a number and especially so when the exponent is a decimal number. A 2.4 exponent is used to calculate the luminance of a color and calculating such a thing is not something that SASS supports out of the box and not something I found a good pure-SASS script for calculating and I much prefer pure-SASS over ruby extensions. The math methods might perhaps be unecessary though if you're running Compass or similar as they may provide compatible math methods themselves.

Normal usage: `color: pick_best_color(#f00

@voxpelli
voxpelli / README.md
Last active August 9, 2022 18:52
my starship config

This is my config for the Starship cross-shell prompt.

@voxpelli
voxpelli / module-type-badges.md
Created August 5, 2022 17:14
A selection of shield.io badges to indicate module type

Badges

Pick the right one and add to your repo to show what kind of module it is

Module type: ESM

[![Module type: ESM](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://nodejs.org/api/esm.html)
@voxpelli
voxpelli / log-chai-error-with-diff.js
Created July 11, 2016 10:12
This small snippet leverages Mocha's reporter to do proper diffs of Chai assertion errors so that one can log them oneself as well
const mochaList = require('mocha').reporters.Base.list;
const mochaErrorLog = function (err, title) {
mochaList([{
err,
fullTitle: () => title || 'Untitled'
}]);
};
@voxpelli
voxpelli / main.js
Last active April 19, 2022 12:43
A recursive Promise.all() that works on objects
const zipObject = function (keys, values) {
const result = {};
keys.forEach((key, i) => {
result[key] = values[i];
});
return result;
};
// Used in real world eg. here: https://github.com/voxpelli/node-format-microformat/blob/5381268dbcdb1aef6a5757758710e4b9f75cbea3/index.js#L72-L78
// Works
/** @typedef {null|undefined|boolean|string|number|Array} NonObject */
/**
* @template T
* @typedef {T|Promise<T>} MaybePromised
@voxpelli
voxpelli / template-tag-factory.js
Created January 22, 2020 14:58
A small little helper for creating a template tag where one can modify the static strings, the values and/or the final output in some way. Eg. trim some whitespaces?
/**
* @template T
* @param {T} value
* @returns {T}
*/
const passthrough = value => value;
/**
* @param {object} [options]
* @param {(value: string) => string} [options.staticCallback]
@voxpelli
voxpelli / all.txt
Created October 26, 2021 10:44
Takes a Blue Oak Council Copyleft JSON file and outputs it in a format that can be copy and pasted into the GitHub organization insights query https://blueoakcouncil.org/copyleft.json
license:CDDL-1.0
license:CDDL-1.1
license:CPL-1.0
license:EPL-1.0
license:EPL-2.0
license:ErlPL-1.1
license:IPL-1.0
license:LGPL-2.0-only
license:LGPL-2.0-or-later
license:LGPL-2.1-only
// My own take
const JSON_ESCAPE = {
'&': '\\u0026',
'>': '\\u003e',
'<': '\\u003c',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
};