Skip to content

Instantly share code, notes, and snippets.

View YankeeTube's full-sized avatar
🌩️

GM Yankee YankeeTube

🌩️
View GitHub Profile
@khromov
khromov / service-worker.ts
Created April 10, 2023 21:17
SvelteKit service worker example
/// <reference types="@sveltejs/kit" />
/// <reference no-default-lib="true"/>
/// <reference lib="esnext" />
/// <reference lib="webworker" />
// https://kit.svelte.dev/docs/service-workers#type-safety
const sw = self as unknown as ServiceWorkerGlobalScope;
import { build, files, version } from '$service-worker';
@YankeeTube
YankeeTube / event_watcher.js
Last active December 3, 2021 05:52
It easily helps listeners of dirty events in Specific Elements. I was inspired by Vue.js' Watch.
const EventWatch = function(selector, instance, config={}) {
this.subscribe = {[selector]: {}}
this.selector = selector
this.element = document.querySelector(selector)
if (!this.element) throw "Element Not found."
Object.entries(instance).map(([eventName, eventHandler]) => {
const newEventHandler = (e) => {
const beforeEvent = new CustomEvent(`${eventName}:before`)
const afterEvent = new CustomEvent(`${eventName}:after`)
@xmeng1
xmeng1 / wsl2-network.ps1
Created July 14, 2019 06:50
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@michaelboke
michaelboke / Dockerfile
Last active April 23, 2024 17:50
Docker scratch x509 fix
FROM golang:alpine as builder
WORKDIR /app
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
RUN update-ca-certificates
ADD main.go /app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -ldflags="-s -w" -installsuffix cgo -o app .
FROM scratch
COPY --from=builder /app/app .
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
@lopspower
lopspower / README.md
Last active May 3, 2024 13:26
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store