Skip to content

Instantly share code, notes, and snippets.

View constructor-s's full-sized avatar

Bill constructor-s

View GitHub Profile
@Pigamo
Pigamo / Vite MultiImage import
Last active May 6, 2024 22:40
Imports multiple images from a folder using Vite globs
const gallery = Object.values(import.meta.glob('@assets/*.{png,jpg,jpeg,PNG,JPEG}', { eager: true, as: 'url' }))
@spillz
spillz / docx_emf_patch.py
Created January 12, 2021 20:49
Monkey patch for python-docx to enable EMF support
# encoding: utf-8
# This module monkey patches the docx library to add support for Windows Enhanced Metafile images (EMF)
# Put in a local folder and "import docx_emf_patch" to enable EMF support.
from __future__ import absolute_import, division, print_function
import docx
from docx.image.exceptions import UnrecognizedImageError
from docx.image.constants import MIME_TYPE
from docx.image.exceptions import InvalidImageStreamError
@kbauer
kbauer / unicode.ahk
Created June 20, 2017 11:30
Autohotkey-script for converting LaTeX-like input to unicode characters. "Ctrl+Alt+Shift+U" toggles it on and off.
;; -*- mode: text; coding: utf-8 -*-
;;
;; DO NOT EDIT MANUALLY!
;;
;; FILE IS GENERATED BY EMACS LISP SCRIPT
;; `%((file-name-nondirectory qta-ahkdata:generator-script-file)%)'
;;
;;
;; Writing LaTeX glyphs with
;; AutoHotKey (unicode versions only)
@JesterXL
JesterXL / promiseall.js
Last active October 31, 2022 16:02
Example of using Array Destructuring for Promise.all.
Promise.all([
someThingThatReturnsAPromise(),
otherThingThatReturnsAPromise(),
lastThingThatReturnsAPromise()
])
.then( results =>
{
// this...
const [first, second, third] = results;
// ... instead of
@jquacinella
jquacinella / violin_weighted_plot.py
Last active February 3, 2023 15:51
Violin Plots for Weighted Data in Matplotlib
import weighted
from matplotlib.cbook import violin_stats
from scipy import stats
import statsmodels.api as sm
def vdensity_with_weights(weights):
''' Outer function allows innder function access to weights. Matplotlib
needs function to take in data and coords, so this seems like only way
to 'pass' custom density function a set of weights '''