Skip to content

Instantly share code, notes, and snippets.

@dlindenkreuz
dlindenkreuz / RubberBand.md
Created April 30, 2020 08:45 — forked from originell/RubberBand.md
This is a straight copy of – to avoid this ever going dark http://squareb.wordpress.com/2013/01/06/31/

Analysis of Apple’s rubber band scrolling

January 6, 2013

I recently saw a post on Twitter from @chpwn that described the alogorithm that Apple uses for its “rubber band” or “bungee” scrolling.

b = (1.0 – (1.0 / ((x * c / d) + 1.0))) * d
@dlindenkreuz
dlindenkreuz / SketchSystems.spec
Created August 10, 2018 12:07
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@dlindenkreuz
dlindenkreuz / composeThunk.ts
Last active September 15, 2017 13:55
Composing redux-first-router thunks like koa middleware
import { RouteThunk } from "redux-first-router"
import * as compose from "koa-compose"
import { Middleware } from "koa-compose"
import { Dispatch } from "redux"
interface ThunkContext<S> {
dispatch: Dispatch<S>
getState: () => S
}
@dlindenkreuz
dlindenkreuz / gist:a439ec4b939f0561d6d9
Last active April 9, 2024 10:43 — forked from tyteen4a03/gist:3420a9e121d13b091343
Shopify handleize function in JavaScript
// one-liner version
// retains latin-1 supplement chars as well as latin extended-a and latin extended-b
Shopify.handleize = function (str) {
return str.toLowerCase().replace(/[^\w\u00C0-\u024f]+/g, "-").replace(/^-+|-+$/g, "");
};
/**
* Fetchr middleware for koa
*
* Translate Fetchr.middleware() from express.js to koa
* This is pretty rough and might be buggy but it does the job nicely for me at the moment.
*
* Tested with fetchr v0.5.14
*/
export default function () {
return function * (next) {