Skip to content

Instantly share code, notes, and snippets.

View bluebeel's full-sized avatar

Saïkou Barry bluebeel

View GitHub Profile
@jtblin
jtblin / udp-loader.go
Last active April 5, 2024 13:23
UDP server performance optimisation
package main
import (
"crypto/rand"
"flag"
"log"
mrand "math/rand"
"net"
"os"
"os/signal"
// We'll use an npm module here (probably won't be possible in the Figma plugin...)
import triangulate from 'delaunay-triangulate';
// Export your generative program
export default {
props: {
// Number of points (e.g. 1D data structure)
shape: 125
},
// Here the 'vertex' shader generates random points in 2D
@mattdesl
mattdesl / messy.js
Created September 17, 2019 14:18
random grid connections / Licensed under Polyform Non Commercial 1.0.0
// License: Polyform Non Commercial 1.0.0
// https://polyformproject.org/licenses/noncommercial/1.0.0/
const canvasSketch = require('canvas-sketch');
const Random = require('canvas-sketch-util/random');
const Color = require('canvas-sketch-util/color');
const { linspace, lerp } = require('canvas-sketch-util/math');
const risoColors = require('riso-colors').map(h => h.hex).filter(c => {
const hex = Color.parse(c).hex.toLowerCase();
return hex !== '#000000' && hex !== '#ffffff'
});
@mattdesl
mattdesl / rings.js
Created October 2, 2019 16:16
canvas-sketch + canvas-sketch-util = penplot lines
const canvasSketch = require('canvas-sketch');
const { renderPaths, createPath, pathsToPolylines } = require('canvas-sketch-util/penplot');
const { clipPolylinesToBox } = require('canvas-sketch-util/geometry');
const Random = require('canvas-sketch-util/random');
const settings = {
dimensions: [ 12, 12 ],
orientation: 'landscape',
pixelsPerInch: 300,
scaleToView: true,
@slava-vishnyakov
slava-vishnyakov / readme.md
Last active June 28, 2024 19:01
How to upload images with TipTap editor
  1. Create a file Image.js from the source below (it is almost a copy of Image.js from tiptap-extensions except that it has a constructor that accepts uploadFunc (function to be called with image being uploaded) and additional logic if(upload) { ... } else { ... previous base64 logic .. } in the new Plugin section.
import {Node, Plugin} from 'tiptap'
import {nodeInputRule} from 'tiptap-commands'

/**
 * Matches following attributes in Markdown-typed image: [, alt, src, title]
 *
@timc1
timc1 / useTheme2.tsx
Created April 18, 2020 20:10
🌑☀️core app system/light/dark mode theming + varying themes for nested components
import * as React from "react";
type ThemeConfig = "system" | "light" | "dark";
type ThemeName = "light" | "dark";
// Custom themes are keyed by a unique id.
type KeyedThemes = {
[k: string]: {
config: ThemeConfig;
themeName: ThemeName;
};
// @ts-nocheck //TODO: enable remove once there are typings in place
// TODO: uncomment all three eslint() occurrences once eslint warnings and errors are fixed
// for info on emitCSS etc. https://github.com/rollup/rollup-plugin-svelte#extracting-css and https://svelte.dev/docs#svelte_preprocess
// import { eslint } from 'rollup-plugin-eslint'
import { terser } from 'rollup-plugin-terser'
import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'
import config from 'sapper/config/rollup.js'
import environmentVariables from './config/env'
@benknight
benknight / README.md
Last active August 16, 2023 04:59
[use-carousel] Headless UI React hook for building a scroll-based carousel

[use-carousel] Headless UI React hook for building a scroll-based carousel

BYO-UI. No CSS necessary. Inspired by react-table.

Usage:

const {
  getLeftNavProps,
 getRightNavProps,
@adamrushuk
adamrushuk / expand_k8s_pvc.sh
Created November 2, 2020 08:51
Testing process to expand k8s PVCs without losing data
# Testing process to expand k8s PVCs without losing data
#region Install
# Check the current cluster
kubectl config current-context
# Add bitnami repo
helm repo list
helm repo add bitnami https://charts.bitnami.com/bitnami