Skip to content

Instantly share code, notes, and snippets.

View cecilemuller's full-sized avatar

Cecile Muller cecilemuller

View GitHub Profile
@cecilemuller
cecilemuller / main.ts
Last active December 20, 2022 10:27
Typescript Webworker
/* eslint-env browser */
import type {IRequestWorker} from "./worker.ts";
const worker = new Worker(new URL("./worker.ts", import.meta.url)) as IRequestWorker;
// Receive from the worker
worker.onmessage = ({data: {myresponse}}) => {
console.log(myresponse);
};
@MoOx
MoOx / install-flow-windows.md
Last active November 22, 2022 08:59
Unofficial Flow Windows binary
@cecilemuller
cecilemuller / Example.swift
Last active November 6, 2022 19:56
CSS HSL "linear-gradient" to Swift "CAGradientLayer"
// CSS gradient generated by https://www.joshwcomeau.com/gradient-generator/
// hsl(199deg 95% 55%) 0%
// hsl(140deg 63% 65%) 50%
// hsl(99deg 100% 50%) 100%
let gradient = CAGradientLayer()
// ...
gradient.type = .axial
gradient.colors = [
UIColor.hsl(degrees: 199, saturation: 0.95, lightness: 0.55).cgColor,
@cecilemuller
cecilemuller / gulpfile.js
Last active April 11, 2022 13:27
Gulp: Output multiple files from a single input file
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 / readme.md
Last active March 14, 2022 17:53
Using Three.js "examples" (e.g. OrbitControls) with Webpack 2

Javascript files from the examples folder (such as OrbitControls) are not CommonJS or ES Modules, but they can still be used in Webpack bundles:

In package.json:

"dependencies": {
	"three": "0.84.0",
	"webpack": "2.4.1"
}
@cecilemuller
cecilemuller / example.scss
Created January 18, 2022 22:52
Animated CSS Custom Property
// Static value by default:
// https://caniuse.com/css-variables
:root {
--example: 0deg;
}
.myclass {
background-image: linear-gradient( var(--example), red, green 50%, blue );
}
// Animated value where supported:
@cecilemuller
cecilemuller / marmoset-material-fields.md
Last active January 2, 2022 04:08
Marmoset Toolbag: Shader subroutine fields
@cecilemuller
cecilemuller / Emmet.sublime-settings
Last active November 21, 2020 10:59
HTML & Stylus boilerplate snippets for Emmet (ST3)
{
"autodetect_xhtml": false,
"snippets": {
"html": {
"snippets": {
"meta:viewport": "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, shrink-to-fit=no\">",
"meta:ua": "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">",
"js:html5":"<!--[if lt IE 9]>\n<script src=\"\/\/html5shiv.googlecode.com/svn/trunk/html5.js\"></script>\n<![endif]-->",
"js:empty": "<script>\n(function(){\n\t'use strict';\n\t\/\/\n\t\/\/ TODO\n\t\/\/\n})();\n</script>",
"js:webfont2": "<script>\nWebFont.load({\n\tgoogle: {\n\t\tfamilies: ['Droid Sans:n4:i4:n7', 'Droid Serif']\n\t}\n});\n</script>",
@n1k0
n1k0 / 404checker.js
Created January 11, 2013 10:55
A CasperJS script to check for 404 & 500 internal links on a given website
/**
* This casper scipt checks for 404 internal links for a given root url.
*
* Usage:
*
* $ casperjs 404checker.js http://mysite.tld/
* $ casperjs 404checker.js http://mysite.tld/ --max-depth=42
*/
/*global URI*/