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
My Awesome Sketch | |
First State | |
some event -> Second State | |
Second State |
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 | |
} |
// 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) { |