Skip to content

Instantly share code, notes, and snippets.

View fuunnx's full-sized avatar
💭
🤯

Géraud Henrion fuunnx

💭
🤯
View GitHub Profile
@fuunnx
fuunnx / snippets.code-snippets
Last active October 6, 2023 13:36
VS Code Snippets
{
// Place your GLOBAL snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
@fuunnx
fuunnx / replay.tsx
Created January 18, 2021 22:14
Xstream operators
// from https://github.com/ReactiveX/rxjs/blob/b25db9f369b07f26cf2fc11714ec1990b78a4536/src/internal/operators/shareReplay.ts#L26-L37
import xs, { Stream, MemoryStream, Subscription } from 'xstream'
export function replay<T>(source: Stream<T>) {
let subject: MemoryStream<T>
let refCount = 0
let subscription: Subscription
let innerSub: Subscription
let hasError = false
@fuunnx
fuunnx / ..Scripts and configs.md
Last active October 25, 2023 08:50
Scripts and configs

Mon setup

  • vscode, spotify, git, slack, discord
  • fira code
  • sync vs code settings
  • tabby
  • diodon (gestionnaire de presse papier) + raccourci clavier
  • gestionnaire de fichiers avec des colonnes de Miller : patheon-files
  • activation smooth scroll dans vs code et dans ff
const data = [
{ name: "chocolat pépites", price: 2.81 },
{ name: "pulco", price: 2.58 },
{ name: "ampoule 1", price: 5.4 },
{ name: "ampoule 2", price: 2.57 },
{ name: "emmental", price: 2.58 },
{ name: "emmental", price: 2.58 },
{ name: "comté", price: 4.94 },
{ name: "courgette", price: 0.55 },
{ name: "chanterelles", price: 3.49 }
@fuunnx
fuunnx / captureClicks.js
Created September 23, 2019 16:33
fork from captureClicks from @cycle/history, with shadow dom support (you may need a polyfill for `event.composedPath()`)
export function captureClicks(callback) {
const listener = makeClickListener(callback)
if (typeof window !== 'undefined') {
document.addEventListener('click', listener, false)
}
return () => {
document.removeEventListener('click', listener)
}
}
@fuunnx
fuunnx / snabbdom+0.7.0.patch
Last active September 4, 2018 07:46
Snabbdom - Shallow copy duplicated vnode on DOME node creation
```sh
mkdir patches
mv snabbdom+0.7.0.patch patches/snabbdom+0.7.0.patch
npm install snabbdom@0.7.0 patch-package@5.1.1 && ./node_modules/.bin/patch-package
```
@fuunnx
fuunnx / 1.driver - DOMdriver.js
Last active October 11, 2017 08:12
Cycle Imperative DOM driver
import fromEvent from 'xstream/extra/fromEvent'
import xs from 'xstream'
export default function jqueryDriver () {
return (instruction$) => {
instruction$.addListener({
next: fn => {
if (typeof fn === 'function') {fn()}
else {fn.call()}
},
@fuunnx
fuunnx / higherOrderVNodes.ts
Last active January 21, 2020 17:14
Higher order vnodes utility functions
const typeButton = extended({
attrs: {
type: 'button',
},
})
const blueBackground = extended({
style: {
'background-color': 'blue',
'color': 'white',
@fuunnx
fuunnx / component.js
Created July 31, 2017 08:48
flexible-canvas-component
import {addResizeListener} from './resizeListener'
import canvasPixelRatio from './pixelRatio'
export class FlexibleCanvas extends HTMLDivElement {
static get observedAttributes() {return ['width', 'height', 'pixelRatio'] }
createdCallback () {
this.canvas = this.appendChild(document.createElement('canvas')) //eslint-disable-line
this.canvas.setAttribute('style', `
display: block;\
.Checkbox input {
width: 0;
height: 0;
opacity: 0;
}
.Checkbox input + label {
display: block;
width: 1rem;
height: 1rem;
background: grey;