Skip to content

Instantly share code, notes, and snippets.

View NE-SmallTown's full-sized avatar
💭
yea, tired.

Heaven NE-SmallTown

💭
yea, tired.
  • feel free to leave a message.
  • Nowhere, Nowhere.
View GitHub Profile
//需要用到字符数组
#include <stdio.h>
#include <string.h>
void main()
{
char c1[]="有时,我们不禁这样:一路坎坷,常想放弃,前方大道,扑朔迷离,对吗(对/不对)";
char c1y[]="嗯,我时常也这样想,要是每天都能开开心心的活着,感受生活带来的美好,那该多好。是吧(嗯/不是)";
char c1n[]="哈哈,别这样讲嘛。我们不是石头对吧,总归会有感情,总会有不开心的时候,有时候做高数都做得想cry是吧。(赞/不赞)";
char c2y[]="但是我后来明白,这样的人生是没有意义的,没有风吹雨打的人生又能算什么,拿着所谓的不错的工资,过着每年旅游两次的所谓的滋润生活,然后等死。你愿意吗(愿意/不愿意)";
char c2n[]="哈哈,别这样讲嘛。我们不是石头对吧,总归会有感情,总会有不开心的时候,有时候做高数都做得想cry是吧。(赞/不赞)";
@NE-SmallTown
NE-SmallTown / WhyReact.md
Created December 6, 2019 03:52 — forked from sebmarkbage/WhyReact.md
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr

@NE-SmallTown
NE-SmallTown / flux.js
Created May 30, 2019 03:14 — forked from acdlite/flux.js
A Redux-like Flux implementation in <75 lines of code
/**
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
*/
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {
@NE-SmallTown
NE-SmallTown / index.md
Created October 24, 2018 15:53 — forked from bvaughn/index.md
How to use profiling in production mode for react-dom
@NE-SmallTown
NE-SmallTown / index.md
Created October 24, 2018 15:52 — forked from bvaughn/index.md
Interaction tracing with React

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.

This Gist provides some high-level docum

@NE-SmallTown
NE-SmallTown / algebraic-effects-series-2.md
Created September 23, 2018 14:42 — forked from yelouafi/algebraic-effects-series-2.md
Capturing continuations with Generators

Algebraic Effects in JavaScript part 2 - Capturing continuations with Generators

This is the second part of a series about Algebraic Effects and Handlers.

Note: initially I planned a 3-part series, but since the current post on undelimited continuations ended up taking

@NE-SmallTown
NE-SmallTown / delimited-continuations.js
Created September 10, 2018 02:03 — forked from yelouafi/delimited-continuations.js
delimited continuations using javascript generators
// We model the call stack using a linked list of Generators
// Each Generator has a _return field pointing back to its parent
function stepGen(gen, arg) {
const {done, value} = gen.next(arg)
if(done) {
if(gen._return) {
stepGen(gen._return, value)
}
@NE-SmallTown
NE-SmallTown / prepack-gentle-intro-1.md
Created May 10, 2018 03:42 — forked from gaearon/prepack-gentle-intro-1.md
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.

Strings

String.prototype.*

None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).

@NE-SmallTown
NE-SmallTown / bookmarklet
Created March 27, 2018 05:06 — forked from kentcdodds/bookmarklet
activeElement logger bookmarklet
javascript:(function(){if(window._activeElInterval){clearInterval(window._activeElInterval);delete window._activeElInterval;}else{var activeEl;window._activeElInterval=setInterval(function(){var currentActiveEl=document.activeElement;if(currentActiveEl!==activeEl){activeEl=currentActiveEl;console.log(activeEl);}},200);}})();