Skip to content

Instantly share code, notes, and snippets.

View learosema's full-sized avatar
👋
Hello World!

Lea Rosema learosema

👋
Hello World!
View GitHub Profile
@ayamflow
ayamflow / gist:96a1f554c3f88eef2f9d0024fc42940f
Last active March 20, 2024 02:48
Threejs Fit plane to screen
var cameraZ = camera.position.z;
var planeZ = 5;
var distance = cameraZ - planeZ;
var aspect = viewWidth / viewHeight;
var vFov = camera.fov * Math.PI / 180;
var planeHeightAtDistance = 2 * Math.tan(vFov / 2) * distance;
var planeWidthAtDistance = planeHeightAtDistance * aspect;
// or
@LeaVerou
LeaVerou / dabblet.css
Created March 30, 2017 20:28
Test multi-position color stops
/**
* Test multi-position color stops
*/
background: red;
background: linear-gradient(45deg, green 0 50%, lime 50% 100%);
min-height: 100%;
@peterspackman
peterspackman / mingw-w64-x86_64.cmake
Last active April 15, 2024 15:04
cmake toolchain file for mingw-w64 x86_64 builds on Ubuntu
# Sample toolchain file for building for Windows from an Ubuntu Linux system.
#
# Typical usage:
# *) install cross compiler: `sudo apt-get install mingw-w64`
# *) cd build
# *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake ..
# This is free and unencumbered software released into the public domain.
set(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
@mauriciosoares
mauriciosoares / doubleclick.js
Created October 19, 2015 20:07
rxjs double click example
let clickStream = Rx.Observable.fromEvent(document.getElementById('link'), 'click');
clickStream
.buffer(clickStream.debounce(250))
.map(list => list.length)
.filter(x => x === 2)
.subscribe(() => {
console.log('doubleclick');
})
@gaearon
gaearon / slim-redux.js
Last active April 25, 2024 18:19
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@sephirot47
sephirot47 / GLSL Raymarch ShaderToy tutorial and example code
Created June 29, 2015 12:28
GLSL Raymarch ShaderToy tutorial and example code
/*
a shader executes per pixel
so every thing you see here is he function for every pixel
raymarching is in principe a function that finds the closest point to any surface in the world
then we move our point by that distance and use the same function,
the function will probably be closer to an object in the world every time
and after about 40 to 200 iterations you'll either have found an object or
missed them all into infinity
@suzck
suzck / ifYouPreferSass
Last active June 27, 2021 06:28
CSS only fix for select with rounded corners on OSX
.select-list {
position: relative;
&:after{
content: "▼";
position: absolute;
top: 0;
right: 0;
bottom: 0;
font-size: 60%;
@aemkei
aemkei / Readme.md
Last active August 29, 2015 14:12
A Snow Animation in 90 Bytes of HTML and JavaScript
@leonderijke
leonderijke / svgfixer.js
Last active May 26, 2023 11:22
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html