Skip to content

Instantly share code, notes, and snippets.

View cecilemuller's full-sized avatar

Cecile Muller cecilemuller

View GitHub Profile
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 2, 2024 16:43
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@cecilemuller
cecilemuller / launch.json
Last active May 2, 2024 00:55
Run ts-node in VSCode Debugger
{
"version": "0.2.0",
"configurations": [
{
"name": "Example",
"type": "node",
"request": "launch",
"runtimeExecutable": "node",
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
@cecilemuller
cecilemuller / package.json
Last active April 16, 2024 17:59
Subpath Imports:
{
"imports": {
"#components/*": "./src/components/*",
"#functions/*": "./src/functions/*"
}
}
@cecilemuller
cecilemuller / prettierPlugin.ts
Created April 15, 2024 07:35
Vite Plugin: Prettier
import type {PluginOption} from "vite";
import {format} from "prettier";
/**
* Format HTML pages using Prettier.
*/
export function prettierPlugin(): PluginOption {
return {
name: "prettier",
transformIndexHtml: {
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@cecilemuller
cecilemuller / vite.config.js
Created April 4, 2024 15:51
Vite: multiple entries, independant output paths
/* eslint-env node */
import {fileURLToPath} from "node:url";
/**
* @returns {import("vite").PluginOption}
*/
function buildPlugin(pages) {
return {
name: "change-html-output",
enforce: "post",
@cecilemuller
cecilemuller / example.yml
Created October 20, 2020 01:49
Run Docker Compose + in Github Action
name: Test
on:
push:
branches:
- main
- features/**
- dependabot/**
pull_request:
branches:
@cecilemuller
cecilemuller / README.md
Last active April 2, 2024 01:04
Vite generates en empty script when `build.rollupOptions.input` is set

Merely setting build.rollupOptions.input forces a script to be generated even if the page has none (whereas the default behavior doesn't generate the empty js file):

vite.config.js points to the same default location:

export default {
    build: {
        rollupOptions: {
            input: "index.html"
        }
 }
@cecilemuller
cecilemuller / get_combinations.php
Created February 1, 2013 03:13
PHP: Get all combinations of multiple arrays (preserves keys)
<?php
function get_combinations($arrays) {
$result = array(array());
foreach ($arrays as $property => $property_values) {
$tmp = array();
foreach ($result as $result_item) {
foreach ($property_values as $property_value) {
$tmp[] = array_merge($result_item, array($property => $property_value));
}
@cecilemuller
cecilemuller / getMaterialThumbnail.ms
Created January 3, 2019 14:35
Maxscript: get the Material Editor thumbnail for an arbitrary material
-- Reads the 88x88 thumbnail from Material Editor for an arbitrary material.
-- Note that it renders faster when the material editor is closed,
-- so you could call `MatEditor.Close()` first.
--
-- Parameters:
-- mat: a material instance (StandardMaterial, Universal_Material, etc..)
--
-- Returns:
-- a Bitmap or `undefined`
--