Skip to content

Instantly share code, notes, and snippets.

View jaredLunde's full-sized avatar
🔮
manifesting

Jared Lunde jaredLunde

🔮
manifesting
View GitHub Profile
@jaredLunde
jaredLunde / README.md
Created December 4, 2020 19:52 — forked from kentcdodds/README.md
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

const resolveSynchronously = promises => {
if (promises.length > 0) {
const [next, resolve] = promises[0]
next.then(value => {
resolve(value)
// shift must be performed here to avoid accidentally creating a situation where
// pendingUpdates length === 1, allowing for subsequent requests to potentially
// resolve first
promises.shift()
resolveSynchronously(promises)
@jaredLunde
jaredLunde / curls.css
Last active September 3, 2021 15:48
Compiled with node-sass
/******************************************************************************
*** *
*** Curls.css *
*** A flexible flebox-based CSS framework *
*** (c) 2016 Jared Lunde *
*** *
******************************************************************************/
/**
** Browser resets
**/
@jaredLunde
jaredLunde / withPerf-es5.js
Last active July 28, 2016 03:03
ES5 React HOC for performance benchmarking using the React addon 'Perf'
// Pre-requisites
// ```````````````
// npm i react --save
// npm i react-addons-perf --save-dev
//
//
// Plain render usage
// ```````````````````
// const YourPerfComponent = withPerf(YourComponent)
// React.render(React.createElement(YourPerfComponent, props, children), ...)
@jaredLunde
jaredLunde / withPerf.js
Last active July 28, 2016 03:03
ES2015 React HOC for performance benchmarking using the React addon 'Perf'
// Pre-requisites
// ```````````````
// npm i react --save
// npm i react-addons-perf --save-dev
//
//
// Plain render usage
// ```````````````````
// const YourPerfComponent = withPerf(YourComponent)
// React.render(React.createElement(YourPerfComponent, props, children), ...)
@jaredLunde
jaredLunde / async_lru.py
Last active June 7, 2022 10:09
An LRU cache for asyncio coroutines in Python 3.5
import asyncio
import functools
from collections import OrderedDict
def async_lru(size=100):
cache = OrderedDict()
def decorator(fn):
@functools.wraps(fn)
@jaredLunde
jaredLunde / ordereddict_cursor.py
Last active May 13, 2018 23:02
OrderedDict cursor for psycopg2
from collections import OrderedDict
from psycopg2.extensions import cursor as _cursor
class OrderedDictCursor(_cursor):
def _to_od(self, tup):
return OrderedDict((k[0], v) for k, v in zip(self.description, tup))
def execute(self, query, vars=None):
return super().execute(query, vars)
@jaredLunde
jaredLunde / fix_unicode.py
Created August 15, 2014 16:51
Fix unicode mistakes in python 3
"""
"Fixing common Unicode mistakes with Python — after they’ve been made"
Adapted for use in Python 3.x from:
http://blog.luminoso.com/2012/08/20/fix-unicode-mistakes-with-python/
"""
def fix_bad_unicode(text):
u"""