Skip to content

Instantly share code, notes, and snippets.

View juliendargelos's full-sized avatar
🌫️

Julien Dargelos juliendargelos

🌫️
View GitHub Profile
@juliendargelos
juliendargelos / three-compute-volume.jsm
Last active December 18, 2019 13:52
Utils for computing three geometries volume
export function computeVolume(geometry) {
return isBufferGeometry(geometry)
? computeBufferGeometryVolume(geometry)
: computeGeometryVolume(geometry)
}
export function computeBufferGeometryVolume(geometry) {
return geometry.index
? computeIndexedBufferGeometryVolume(geometry)
: computeNotIndexedBufferGeometryVolume(geometry)

https://stackoverflow.com/a/3926546/4867982

Lookaround Name What it Does
(?=foo) Lookahead Asserts that what immediately follows the current position in the string is foo
(?<=foo) Lookbehind Asserts that what immediately precedes the current position in the string is foo
(?!foo) Negative Lookahead Asserts that what immediately follows the current position in the string is not foo
`(?
@juliendargelos
juliendargelos / rollup-plugin-web-dependencies.js
Last active October 19, 2019 15:50 — forked from bastienrobert/rollup-plugin-rename-imports.js
Rollup plugin to rename imports in an ES modules
import fs from 'fs'
/**
* @example
* // In rollup.config.js
* export default {
* // ...
* plugins: [
* webDependencies({
* // Use pika cdn by default
@juliendargelos
juliendargelos / url-regex.md
Created October 2, 2019 16:13
Compact regular expression for urls

Url regex

Compact regular expression for urls:

/^(?:([^:\/\s]+):)?(?:\/\/([^?#\s:]+))?(?::(\d+))?(?:(\/[^?#\s]+))?(?:#([^?\s]*))?(?:\?(.+))?$/

Example:

const methods = [
Math.random,
n => (Math.sin(n * 0.04) + 1) * 0.5,
n => n % 200 / 200,
n => Math.pow(n * 0.5 % 100 - 50, 2) / 2500,
n => (Math.sin(n * 0.01) + 1) * 0.3 + 0.15,
n => n % -50 / 50,
n => Math.abs(n * 0.8 % 100 - 50) / 50,
]
@juliendargelos
juliendargelos / spinner.svg
Created June 20, 2019 12:07
Basic animated svg spinner
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juliendargelos
juliendargelos / share-urls.md
Last active July 16, 2020 15:46
Share urls cheatsheet for Facebook Twitter and Linkedin.

facebook

https://facebook.com/sharer/sharer.php?u=URL

twitter

https://twitter.com/intent/tweet/?url=URL&amp;text=CONTENT
@juliendargelos
juliendargelos / Default.sublime-commands
Created March 25, 2019 08:42
Open Terminus in split view on Sublime Text
[
{
"caption": "Terminus: Open Default Shell in Split View",
"command": "terminus_open",
"args": {
"config_name": "Default",
"pre_window_hooks": [
["set_layout", {
"cols": [0.0, 0.7, 1.0],
"rows": [0.0, 1.0],
@juliendargelos
juliendargelos / media.sass
Last active March 18, 2019 01:32
Media mixins.
$tablet: 800px
$desktop: 1000px
=media-min-height($height)
@media screen and (min-height: $height)
@content
=media-min-width($width)
@media screen and (min-width: $width)
@content
@juliendargelos
juliendargelos / text-stroke.sass
Created March 18, 2019 01:15
Cross-browser css text-stroke.
@function text-stroke-shadow-layer($offset, $color)
$text-shadow: ()
$text-shadow: append($text-shadow, #{$offset}px 0 0 $color, comma)
$text-shadow: append($text-shadow, #{$offset}px #{$offset}px 0 $color, comma)
$text-shadow: append($text-shadow, 0 #{$offset}px 0 $color, comma)
$text-shadow: append($text-shadow, #{-$offset}px #{$offset}px 0 $color, comma)
$text-shadow: append($text-shadow, #{-$offset}px 0 0 $color, comma)
$text-shadow: append($text-shadow, #{-$offset}px #{-$offset}px 0 $color, comma)
$text-shadow: append($text-shadow, 0 #{-$offset}px 0 $color, comma)
$text-shadow: append($text-shadow, #{$offset}px #{-$offset}px 0 $color, comma)