Skip to content

Instantly share code, notes, and snippets.

View ZWkang's full-sized avatar
🇨🇳
the harder the better the sweeter the victory

kang ZWkang

🇨🇳
the harder the better the sweeter the victory
  • 家里蹲
  • China Shenzhen
  • 16:10 (UTC +08:00)
View GitHub Profile
@ZWkang
ZWkang / cheng-lou-spectrum-of-abstraction.md
Created June 28, 2022 11:55 — forked from markerikson/cheng-lou-spectrum-of-abstraction.md
Cheng Lou - "On the Spectrum of Abstraction" summarized transcript (React Europe 2016)

Cheng Lou - On the Spectrum of Abstraction

Cheng Lou, a former member of the React team, gave an incredible talk at React Europe 2016 entitled "On the Spectrum of Abstraction". That talk is available for viewing here: https://www.youtube.com/watch?v=mVVNJKv9esE

It's only a half-hour, but it is mind-blowing. It's worth re-watching two or three times, to let the ideas sink in.

I just rewatched the talk for some research, and wrote down a summary that's semi-transcript-ish. I didn't see any other transcripts for this talk, other than the auto-generated closed captions, so I wanted to share for reference.

Summary

@ZWkang
ZWkang / README.md
Created June 14, 2022 11:15 — forked from mlrawlings/README.md
Using `src/node_modules/` for module development

Using src/node_modules/ for module development

The issue 👎

Often you'll find that you need utility methods or other functionality that might make sense as an external module that you could :tada: open source 🎉, but the process can be painful:

  1. create a directory outside the project
  2. initialize a git repo
@ZWkang
ZWkang / enzyme_render_diffs.md
Created September 14, 2019 12:38 — forked from fokusferit/enzyme_render_diffs.md
Difference between Shallow, Mount and render of Enzyme

Shallow

Real unit test (isolation, no children render)

Simple shallow

Calls:

  • constructor
  • render
@ZWkang
ZWkang / index.js
Created September 12, 2019 12:58 — forked from kentcdodds/index.js
NodeJS file runner for Jest (create-node-runner using create-jest-runner). Use this with the runner option in jest config.
const {createJestRunner} = require('create-jest-runner')
module.exports = createJestRunner(require.resolve('./node-runner'))
@ZWkang
ZWkang / README.md
Created August 29, 2019 11:58 — forked from necolas/README.md
Experimenting with component-based HTML/CSS naming and patterns

NOTE I now use the conventions detailed in the SUIT framework

Template Components

Used to provide structural templates.

Pattern

t-template-name
@ZWkang
ZWkang / 1.md
Created August 29, 2019 06:02 — forked from swyxio/1.md
Learn In Public - 7 opinions for your tech career

1. Learn in public

this essay has been updated on my personal site, together with a followup on how to get started

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos or Twitch streams. Start a newsletter. Draw cartoons (people loooove cartoons!). Whatever your thing is, make the thing you wish you had found when you were learni

@ZWkang
ZWkang / haml.js
Created May 14, 2019 09:27 — forked from tj/haml.js
/* ex:ts=2:et: */
/*jslint bitwise: true, browser: true, eqeqeq: true, evil: true, immed: true, newcap: true,
nomen: true, plusplus: true, regexp: true, undef: true, white: true, indent: 2 */
/*globals */
var Haml = {};
// Bind to the exports object if it exists. (CommonJS and NodeJS)
if (exports) {
Haml = exports;
@ZWkang
ZWkang / what-forces-layout.md
Created May 13, 2019 07:35 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@ZWkang
ZWkang / css.js
Created May 12, 2019 14:52 — forked from tj/css.js
/**
* Module dependencies.
*/
var fs = require('fs');
var css = fs.readFileSync('style.css', 'utf8');
function scan(buf) {
@ZWkang
ZWkang / bind.js
Created May 12, 2019 14:06 — forked from tj/bind.js
function FunctionBind(this_arg) { // Length is 1.
if (!IS_FUNCTION(this)) {
throw new $TypeError('Bind must be called on a function');
}
// this_arg is not an argument that should be bound.
var argc_bound = (%_ArgumentsLength() || 1) - 1;
if (argc_bound > 0) {
var bound_args = new $Array(argc_bound);
for(var i = 0; i < argc_bound; i++) {
bound_args[i] = %_Arguments(i+1);