Skip to content

Instantly share code, notes, and snippets.

View nikitekirsha's full-sized avatar

nikitekirsha

  • Flexbe
View GitHub Profile
@deeperton
deeperton / rgba-to-hex.sass
Last active April 18, 2024 05:31
Converter RGBA() to #HEX color with applying alpha-channel + additional opacity
// converter rgba(r, g, b, a) color to #HEX string without alpha channel,
// with optional applying afterwards opacity ($opacity)
// by default alpha channel for rgba-color is applying against white background,
// but you can change it by setting third argumnet ($background)
@function rgba-to-rgb($rgba, $opacity: 0, $background: #fff) {
@if $opacity > 0 {
@if $opacity < 1 {
$opacity: $opacity * 100
}
@return mix(mix(rgb(red($rgba), green($rgba), blue($rgba)), $background, alpha($rgba) * 100%), rgb(255,255,255), $opacity)
@hideya
hideya / flex-wrap-anim.js
Last active April 25, 2023 05:49
CSS Flex Wrap Animation (code assumes no change in items except xy coords): https://codepen.io/hideya/pen/Jamabx
window.addEventListener('load', function(event) {
var targetClassName = 'flex-wrap-anim';
var defaultDuration = '0.3s';
var dummyList = [];
function addDummy(item, duration) {
var top = item.offsetTop;
var left = item.offsetLeft;
setTimeout(function() {
item.style.position = 'absolute';
@azu
azu / Medium: remove location hash.user.js
Created December 2, 2015 15:05
Medium: remove location hash
// ==UserScript==
// @name Medium: remove location hash
// @namespace http://efcl.info/
// @description Remove location hash from medium
// @include https://medium.com/*#*
// @version 1
// @grant none
// ==/UserScript==
function removeLocationHash(){
/**
* Calculate the contrast of a color to determine the appropriate opposing text color.
* @author D. Condrey
* @param {string|object} - element background-color or element
* @return {string}
* white - if background is a dark shade color
* black - if background is a light shade color
*/
define(function() {