Skip to content

Instantly share code, notes, and snippets.

Cecile Muller cecilemuller

Block or report user

Report or block cecilemuller

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active Jan 26, 2020
How to create an HTTPS certificate for localhost domains
View 2019-https-localhost.md

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 / letsencrypt_2019.md
Last active Jan 26, 2020
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2019.md

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 / launch.json
Created Jan 8, 2018
Run ts-node in VSCode Debugger
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Node Inspector",
"type": "node",
"request": "launch",
"args": ["${workspaceRoot}/src/service.ts"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@cecilemuller
cecilemuller / get_combinations.php
Created Feb 1, 2013
PHP: Get all combinations of multiple arrays (preserves keys)
View get_combinations.php
<?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 / index.html
Last active Jan 8, 2020
Record three.js to WebM video using CCapture.js
View index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Record WebGL to WebM (Chrome only)</title>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css" charset="utf-8">
</head>
<body>
<div class="buttons">
@cecilemuller
cecilemuller / example.html
Last active Nov 25, 2019
Better underlines, especially on Retina
View example.html
<p>
Lorem ipsum consectetur <a href="#">simple basic link paqejigu</a> adipisicing
elit aut <a class="enhanced" href="#">simple enhanced link paqejigu</a> aut officia
adipisci nemo perferendis eveniet delectus ipsam consectetur. Molestiae, iste
ipsa sit aliquid quasi quidem ab? Enim veritatis architecto commodi!
</p>
<p>
Lorem ipsum consectetur <b><a href="#">bold basic link paqejigu</a></b> adipisicing
elit aut <b><a class="enhanced" href="#">bold enhanced link paqejigu</a></b> officia
@cecilemuller
cecilemuller / gulpfile.js
Last active Nov 17, 2019
Gulp: Output multiple files from a single input file
View gulpfile.js
var path = require('path');
var gulp = require('gulp');
var through2 = require('through2');
var File = require('vinyl');
function generate_two_text_files_from_one_json(){
'use strict';
return through2.obj(function(file, enc, next){
var mydata = JSON.parse(file.contents.toString('utf8'));
@cecilemuller
cecilemuller / gist:3081372
Created Jul 10, 2012
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
View gist:3081372
DECLARE
r record;
BEGIN
FOR r IN SELECT (each(hstore(NEW))).*
LOOP
RAISE NOTICE '% value is %', r.key, quote_nullable(r.value);
END LOOP;
RETURN NEW;
END
@cecilemuller
cecilemuller / .travis.yml
Last active Sep 1, 2019
Travis CI config to run headless Node tests via Xvfb
View .travis.yml
language: node_js
node_js:
- '6.9.1'
- '7.0.0'
sudo: false
addons:
apt:
packages:
- xvfb
@cecilemuller
cecilemuller / gist:3081392
Created Jul 10, 2012
PostgreSQL: UPDATE if the row exists, INSERT if it doesn't exists (UPSERT)
View gist:3081392
CREATE OR REPLACE FUNCTION upsert_tableName(arg1 type, arg2 type) RETURNS VOID AS $$
DECLARE
BEGIN
UPDATE tableName SET col1 = value WHERE colX = arg1 and colY = arg2;
IF NOT FOUND THEN
INSERT INTO tableName values (value, arg1, arg2);
END IF;
END;
$$ LANGUAGE 'plpgsql';
You can’t perform that action at this time.