Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🦮
Golden

Davo Galavotti davo

🦮
Golden
View GitHub Profile
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
/*
* Stripe WebGl Gradient Animation
* ScrollObserver functionality to disable animation when not scrolled into view has been disabled and
* commented out for now.
*/
//Converting colors to proper format
function normalizeColor(hexCode) {
@Axeltherabbit
Axeltherabbit / YTPlaylistParser.py
Last active September 9, 2024 18:21 — forked from fffaraz/bs4.py
Python YouTube Playlist Link Collector
#regex original source http://code.activestate.com/recipes/578284-youtube-playlist-parserextractor/
#fork of https://gist.github.com/fffaraz/f3dcf48ae93b6c04adb9d74b1de711e5
#if you want to stream a yt-playlist with vlc use "python parser.py URLHERE -o playlist.m3u && cvlc --no-video playlist.m3u"
import re
import requests
import argparse
import SwiftUI
import PlaygroundSupport
struct UserCell: View {
var body: some View {
HStack(spacing: 16) {
Image(systemName: "person.crop.circle.fill")
.font(.system(size: 48))
VStack(alignment: .leading, spacing: 2) {
global.THREE = require("three");
const canvasSketch = require('canvas-sketch');
const Random = require('canvas-sketch-util/random');
const gradientHeight = 512;
const settings = {
dimensions: [ 2048, gradientHeight * 2 ]
};
@miguelmota
miguelmota / scale.js
Created June 3, 2020 23:26
JavaScript linear scale function
const scale = (d, r) => v => r[0] + (r[1] - r[0]) * ((v - d[0]) / (d[1] - d[0]))
const s = scale([0, 600], [10, 20])
console.log(s(300)) // 15
@omri374
omri374 / spacy_preprocessor.py
Created May 13, 2020 10:39
Text preprocessing using spaCy
import re
from typing import List
import spacy
from spacy.tokens import Doc
from tqdm import tqdm
class SpacyPreprocessor:
def __init__(
@szepeviktor
szepeviktor / Wistia-download-videos.md
Last active May 15, 2025 16:15
Download Wistia videos - Please do not misuse it!

Download Wistia videos

  1. right-click on the playing video, select Copy link
  2. find Wistia video ID in the copied link e.g. wvideo=tra6gsm6rl
    • alternative: look for e.g. hashedId=tra6gsm6rl in the page source
  3. load http://fast.wistia.net/embed/iframe/ + video ID in your browser
  4. look for "type":"original" in the page source and copy the URL from the next line e.g. "url":"http://embed.wistia.com/deliveries/129720d1762175bcd8e06dcab926ec76ad38ff00.bin"
  • alternative: look for "type":"hd_mp4_video"
// Bookmarklet for Azure DevOps work items
// Select a number, click bookmarklet and open workitem with that id in new window
// Can edit using tools such as http://subsimple.com/bookmarklets/jsbuilder.htm
// based on code found at https://stackoverflow.com/questions/26261323
javascript:
(function(){
const path = 'your/path-here'; // usually Domain/projectId
s=document.selection?document.selection.createRange().text:window.getSelection?window.getSelection().toString():document.getSelection?document.getSelection():'';
if(s==''){
s=prompt('Enter%20ID%20of%20workitem%20:','');
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 21:12:20 2020
@author: timallan
"""
from itertools import permutations