Skip to content

Instantly share code, notes, and snippets.

View MaxArt2501's full-sized avatar
🎡
Reinventing a better wheel

Massimo Artizzu MaxArt2501

🎡
Reinventing a better wheel
View GitHub Profile
@MaxArt2501
MaxArt2501 / share-this-skeleton.html
Last active June 23, 2017 22:35
share-this HTML skeleton
<div class="share-this-popover" style="position: absolute; ...">
<ul>
<li data-share-via="...">...</li>
...
</ul>
</div>
@MaxArt2501
MaxArt2501 / conic-gradient.svg
Created May 9, 2017 07:55
How to create a conic gradient in SVG (needs JavaScript)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MaxArt2501
MaxArt2501 / ie-domtokenlist-toggle.js
Last active February 16, 2018 13:27
Add second argument support in DOMTokeList.toggle (e.g. for Internet Explorer)
(function(dtl) {
if (!dtl) return;
var elem = document.createElement("div");
div.classList.toggle("test", false);
if (div.className === "test")
dtl.prototype.toggle = (function(toggle) {
return function(cls, force) {
if (typeof force === "boolean")
return this[force ? "add" : "remove"](cls);
@MaxArt2501
MaxArt2501 / _cmyk.scss
Last active August 31, 2020 17:09
CMYK helper functions for SASS
@function cmyk_black($color) {
@return 1 - max(red($color), green($color), blue($color)) / 255;
}
@function cmyk_cyan($color) {
$black: cmyk_black($color);
@return if($black < 1, 1 - red($color) / 255 / (1 - $black), 0);
}
@function cmyk_magenta($color) {
$black: cmyk_black($color);
@MaxArt2501
MaxArt2501 / codepointat.js
Last active July 16, 2016 21:09
A polyfill for `String.prototype.codePointAt`
String.prototype.codePointAt || (String.prototype.codePointAt = function(index) {
var code = this.charCodeAt(index);
if (code >= 0xd800 && code <= 0xdbff) {
var surr = this.charCodeAt(index + 1);
if (surr >= 0xdc00 && surr <= 0xdfff)
code = 0x10000 + ((code - 0xd800) << 10) + (surr - 0xdc00);
}
return code;
});