Skip to content

Instantly share code, notes, and snippets.

View bfulop's full-sized avatar
🌊
Getting into the flow

Bálint Fülöp bfulop

🌊
Getting into the flow
View GitHub Profile
@rekram1-node
rekram1-node / settings.json
Created October 20, 2025 22:30
OpenCode agent server (zed)
{
"agent_servers": {
"OpenCode": {
"command": "opencode",
"args": ["acp"]
}
}
}
@donavon
donavon / formData.js
Last active February 17, 2021 07:29
Here's a good, better, best approach to convert a JavaScript object to "application/x-www-form-urlencoded" postable form data.
const formData = { foo: "foo", bar: "M&Ms" };
// Good 🔥
const postBody = Object.keys(formData)
.map((key) => encodeURIComponent(key) + "=" + encodeURIComponent(body[key]))
.join("&");
// Better 🔥🔥
const postBody = Object.entries(formData)
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
@anthonyjoeseph
anthonyjoeseph / FpReduxExample.tsx
Last active April 19, 2022 08:08
Should I Use redux-observable fp-ts Example
import { pipe } from 'fp-ts/pipeable'
import * as O from 'fp-ts/Option'
import * as Op from 'monocle-ts/lib/Optional'
import * as r from 'rxjs'
import * as ro from 'rxjs/operators'
import { createStore, applyMiddleware } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import React from 'react';
import { Provider, useDispatch, useSelector } from 'react-redux';
import { makeADT, ofType, ADTType } from '@morphic-ts/adt'
@jfcherng
jfcherng / st4-changelog.md
Last active February 26, 2026 10:28
Sublime Text 4 changelog just because it's not on the official website yet.
@yagudaev
yagudaev / cypress_support_hooks.js
Last active September 16, 2021 08:46
Cypress Fetch Support Workaround - replaces fetch request with traditional XHR so cypress can track them
// cypress/support/hooks.js
// Cypress does not support listening to the fetch method
// Therefore, as a workaround we polyfill `fetch` with traditional XHR which
// are supported. See: https://github.com/cypress-io/cypress/issues/687
enableFetchWorkaround()
// private helpers
function enableFetchWorkaround() {
let polyfill
@developit
developit / compositional-components-demo.js
Created January 7, 2017 22:44
Demonstrates compositional components in Preact (or React). Live demo: https://jsfiddle.net/developit/umnb4y87/
import { h, cloneElement, Component } from 'preact';
/** Example <Fetch url="/foo.json" /> compositional component.
* Just to demonstrate a compositional component that requires input massaging.
*/
class Fetch extends Component {
state = { loading: true };
componentDidMount() {
this.update();

Transduce


What is transduce? What is it for? This document is intended to help people (such as myself) who would be looking through the ramda docs, find transduce and have no idea if it would be a good fit for my current problem.

@paulirish
paulirish / what-forces-layout.md
Last active March 17, 2026 07:48
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@ericelliott
ericelliott / essential-javascript-links.md
Last active March 18, 2026 20:43
Essential JavaScript Links
@austinhyde
austinhyde / js-observables-binding.md
Last active January 7, 2025 08:27
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);