Skip to content

Instantly share code, notes, and snippets.

View suhodolskiy's full-sized avatar
🇺🇦

Ilya Suhodolskiy suhodolskiy

🇺🇦
View GitHub Profile
<script lang="ts">
export enum BadgeLook {
Success = 'success',
Warning = 'warning',
Danger = 'danger',
Info = 'info',
}
</script>
<script lang="ts" setup>
document.addEventListener('feedspring:render-complete', () => {
const posts = document.querySelectorAll('[feedspring="post"]')
const selectorReadMoreButton = '.code-button'
const buttonExpandText = 'Hide'
posts.forEach((post) => {
const review = post.querySelector('[feed-field="review"]')
if (review && review.scrollHeight > review.clientHeight) {
const button = post.querySelector(selectorReadMoreButton)
@suhodolskiy
suhodolskiy / settings.json
Created July 8, 2023 19:56
vscode config
{
"editor.fontFamily": "JetBrains Mono",
"editor.fontLigatures": true,
"editor.fontSize": 16,
"workbench.colorTheme": "GitHub Light",
"editor.formatOnSave": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"editor.largeFileOptimizations": false,
"[json]": {
@suhodolskiy
suhodolskiy / result.html
Created April 22, 2022 22:12
Golang html/template
<ul>
<li>
Level 1
<ul>
<li>
Level 2
<ul>
<li>
<!-- Auto Rotate Webflow Tabs (Shared by @irishbuckley flowbase.co -->
<script>
var Webflow = Webflow || [];
Webflow.push(function () {
// Fix for Safari
if (navigator.userAgent.includes("Safari")) {
document.querySelectorAll(".tab-button").forEach((t)=>(t.focus=function(){const x=window.scrollX,y=window.scrollY;const f=()=>{setTimeout(()=>window.scrollTo(x,y),1);t.removeEventListener("focus",f)};t.addEventListener("focus",f);HTMLElement.prototype.focus.apply(this,arguments)}));
}
@suhodolskiy
suhodolskiy / contrasting.ts
Last active March 30, 2024 03:41
Contrasting color [Colord]
import { Plugin } from 'colord'
declare module 'colord/colord' {
interface Colord {
contrasting(): Colord
}
}
const plugin: Plugin = (ColordClass) => {
ColordClass.prototype.contrasting = function () {
@suhodolskiy
suhodolskiy / useClickAway.js
Created October 31, 2019 09:01
React Hook: Click Away
function useClickAway(callback) {
const savedCallback = useRef()
const ref = createRef()
function handleClickOutside(event) {
if (ref && ref.current && !ref.current.contains(event.target)) {
savedCallback.current()
}
}
useEffect(
() => {