Skip to content

Instantly share code, notes, and snippets.

View azl397985856's full-sized avatar
😟
I may be slow to respond.

lucifer azl397985856

😟
I may be slow to respond.
View GitHub Profile
@tomhicks
tomhicks / plink-plonk.js
Last active March 18, 2024 02:23
Listen to your web pages
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@sulco
sulco / clown-formatter.js
Created December 10, 2018 19:11
A clown formatter
window.devtoolsFormatters = [{
header: function(obj){
if (!obj.__clown) {
return null;
}
delete obj.__clown;
const style = `
color: red;
border: dotted 2px gray;
border-radius: 4px;
@bvaughn
bvaughn / index.md
Last active April 3, 2024 07:41
Interaction tracing with React

This API was removed in React 17


Interaction tracing with React

React recently introduced an experimental profiler API. After discussing this API with several teams at Facebook, one common piece of feedback was that the performance information would be more useful if it could be associated with the events that caused the application to render (e.g. button click, XHR response). Tracing these events (or "interactions") would enable more powerful tooling to be built around the timing information, capable of answering questions like "What caused this really slow commit?" or "How long does it typically take for this interaction to update the DOM?".

With version 16.4.3, React added experimental support for this tracing by way of a new NPM package, scheduler. However the public API for this package is not yet finalized and will likely change with upcoming minor releases, so it should be used with caution.

@samthor
samthor / safari-nomodule.js
Last active February 14, 2024 02:54
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.:
@chrisco
chrisco / bfs_and_dfs.md
Created August 31, 2016 21:00 — forked from bertoort/bfs_and_dfs.md
Breadth First Search And Depth First Search

Breadth First Search

Algorithm for searching graph-like data structures, one level at a time.


Step by Step

  • Start a queue
  • Check current node - if false, mark as visited, continue
@Restuta
Restuta / framework-sizes.md
Last active March 7, 2024 00:01
Sizes of JS frameworks, just minified + minified and gzipped, (React, Angular 2, Vue, Ember)

Below is the list of modern JS frameworks and almost frameworks – React, Vue, Angular, Ember and others.

All files were downloaded from https://cdnjs.com and named accordingly. Output from ls command is stripped out (irrelevant stuff)

As-is (minified)

$ ls -lhS
566K Jan 4 22:03 angular2.min.js
@zenparsing
zenparsing / optional-chaining-proxy.js
Last active April 10, 2023 18:14
Optional chaining with JS Proxy
const unwrapSymbol = Symbol();
function unwrap(x) {
if (this == null)
return this;
let f = this[unwrapSymbol];
if (typeof f !== "function")
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@jonathanmorley
jonathanmorley / regex_golf.md
Last active November 16, 2022 17:42 — forked from jpsim/answers.md
Best possible answers collected so far for [Regex golf](http://regex.alf.nu/). === WARNING: SPOILERS ===