Skip to content

Instantly share code, notes, and snippets.

View regetskcob's full-sized avatar
👋
Hi!

regetskcob

👋
Hi!
View GitHub Profile
@j-un
j-un / spotify.html
Last active December 28, 2025 01:30
[Hugo] Shortcode for Spotify embed code
<!--
Parameters:
type - (Required) album / track / playlist / artist
id - (Required) Target ID
width - (Optional) width
height - (Optional) height
-->
{{ if .IsNamedParams }}
<iframe src="https://open.spotify.com/embed/{{ .Get "type" }}/{{ .Get "id" }}"
@RomanEsin
RomanEsin / replaceColor.swift
Last active October 20, 2022 19:35 — forked from andrey-str/replaceColor.swift
Replace color in UIImage with give tolerance value
// color - source color, which is must be replaced
// withColor - target color
// tolerance - value in range from 0 to 1
func replaceColor(color: UIColor, withColor: UIColor, image: UIImage, tolerance: CGFloat) -> UIImage {
// This function expects to get source color(color which is supposed to be replaced)
// and target color in RGBA color space, hence we expect to get 4 color components: r, g, b, a
assert(color.cgColor.numberOfComponents == 4 && withColor.cgColor.numberOfComponents == 4,
"Must be RGBA colorspace")