Skip to content

Instantly share code, notes, and snippets.

View alesmenzel's full-sized avatar
:octocat:

Aleš Menzel alesmenzel

:octocat:
  • Emplifi
  • Prague
View GitHub Profile
@alesmenzel
alesmenzel / service-workers.md
Created February 22, 2019 20:26 — forked from Rich-Harris/service-workers.md
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

Simple removal of debug module

Common usage of the debug module is for development and then disable it in production (usually also have a separate logger for production issues). Thus the code is shipped without a purpose and also it can have some perf. implication. E.g. imagine you log some big object debug('Some big object', JSON.stringify(largeObject). The JSON.stringify runs even if we disable the module, waisting precious resources - the correct usage of the module is to use formatters, e.g debug('Some big object %o', largeObject), but i have rarely seen someone use it. To avoid this common pitfalls, we can remove the debug module from our code completely - saving bundle size and performance.

Example:

https://astexplorer.net/#/gist/1652612fd62624282390aa74883beeb8/9c46a23a73496cea19d550f3a45ee8d335988054

How to use

@alesmenzel
alesmenzel / PostgreSQL_index_naming.rst
Created March 13, 2020 16:12 — forked from popravich/PostgreSQL_index_naming.rst
PostgreSQL index naming convention to remember

The standard names for indexes in PostgreSQL are:

{tablename}_{columnname(s)}_{suffix}

where the suffix is one of the following:

  • pkey for a Primary Key constraint;
  • key for a Unique constraint;
  • excl for an Exclusion constraint;
  • idx for any other kind of index;
@alesmenzel
alesmenzel / yify.md
Created April 9, 2020 18:56 — forked from kuntau/yify.md
YIFY's Quality Encoding

For those that want to keep the YTS going (No, IDGAF about people that don't care for YTS quality) get HandbrakeCLI https://handbrake.fr/downloads... and use the following settings:

user@user:~$HandBrakeCLI -i /file/input.mp4 -o /file/out.mp4 -E fdk_faac -B 96k -6 stereo -R 44.1 -e x264 -q 27 -x cabac=1:ref=5:analyse=0x133:me=umh:subme=9:chroma-me=1:deadzone-inter=21:deadzone-intra=11:b-adapt=2:rc-lookahead=60:vbv-maxrate=10000:vbv-bufsize=10000:qpmax=69:bframes=5:b-adapt=2:direct=auto:crf-max=51:weightp=2:merange=24:chroma-qp-offset=-1:sync-lookahead=2:psy-rd=1.00,0.15:trellis=2:min-keyint=23:partitions=all

Reason to use CLI over GTK has to do with lack of support for advanced settings for Handbrake GTK

** Don't Re-encode already shitty encodes...get good source!**