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
@drufball
drufball / high-level-features.md
Last active December 1, 2017 06:59
Short descriptions for the "what high-level features do you want to see in browsers?" survey

Infinite list: Automatically lazy-loads content from a data source as the user scrolls, view-recycling as necessary.

Lazy-load image: Won't load the resource until it is on or near the screen.

Pull to refresh: Recreate the "pull down to refresh" UI from iOS and Android.

Carousel: Side scroller that handles lazy-loading and optionally snaps to elements.

Multi-line ellipsis: Automatically hide text and replace with a fade/ellipsis after a specified number of lines.

@kentcdodds
kentcdodds / bookmarklet
Created March 27, 2018 03:54
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);}})();
@markerikson
markerikson / redux-orm-normalization.js
Last active February 2, 2019 20:57
Redux-ORM nested data normalization
import {fk, many, Model} from 'redux-orm';
class Book extends Model {
static get fields() {
authors: many('Author', 'books'),
publisher: fk('Publisher', 'books'),
}
static parse(data) {
/*
import React from 'react';
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = { counter: 0 };
this.increment = this.increment.bind(this);
}
increment() {
@rviscomi
rviscomi / crux-cls.sql
Created June 17, 2019 17:10
Query for cumulative layout shifts in the Chrome UX Report
SELECT
form_factor.name AS form_factor,
cls.start,
ROUND(SUM(cls.density), 4) AS density
FROM
`chrome-ux-report.all.201905`,
UNNEST(experimental.cumulative_layout_shift.histogram.bin) AS cls
WHERE
origin = 'https://www.nytimes.com'
GROUP BY
@getify
getify / 1.md
Last active January 17, 2020 16:35
A question about JS parameter scopes, and closures over them vs function scopes

I received a question about this snippet of code:

function def(first="oldValue" , second=function(){
         return first;
}){
        var first="updatedValue";
        console.log('inside',first);
        console.log('function',second());
}

Pattern Matching

This is a strawman proposal for adding pattern matching to ECMAScript. Pattern matching is useful for matching a value to some structure in a similar way to destructuring. The primary difference between destructuring and pattern matching are the use cases involved - destructuring is useful for binding pieces out of larger structures whereas pattern matching is useful for mapping a value's structure to data or a set of behaviors. In practice this means that destructuring tends to allow many shapes of data and will do its best to bind something out of it, whereas pattern matching will tend to be more conservative.

Additionally, the power of pattern matching is increased substantially when values are allowed to participate in the pattern matching semantics as a matcher as well as a matchee. This proposal includes the notion of a pattern matching protocol - a symbol method that can be implemented by objects that enables developers to use those values in pattern matching. A common scenario w

@jinuljt
jinuljt / clear_wechat_website_data.md
Last active May 22, 2020 06:23
清除微信网页缓存(iOS)

清除safari缓存即可。  
原理是因为Apple限制,在iOS上微信只能使用webview。

1 image image image

@sebmarkbage
sebmarkbage / API.js
Last active August 11, 2020 04:03
Custom Stack Frames
type FrameScope = {
[key:string]: mixed
};
type StackFrame = {
name?: string,
fileName?: string,
lineNumber?: number,
columnNumber?: number,
scope?: FrameScope
};

Variants

Author

  • Alejando Serrano (47 Degrees)

Champions

  • Searching for one ;)