frontend-tech

Month: 2018-07

2018-07-02

2018-07-03

jihchi 09:45:04
https://github.com/madou/yubaba

GitHub

madou/yubaba

yubaba - :sparkles: Element to element animation orchestrator for React.js :point_right:

mrorz 10:38:50
湯婆婆
👩 1

2018-07-04

mofas 05:39:10
聽一堆對前端不熟的辦公室同事討論前端 會一直想要翻白眼
什麼辦公室~~
😢 2
jihchi 08:31:59
https://twitter.com/compuives/status/1014120920389177349?s=12
Announcing CodeSandbox Dashboard & Teams! 🎉

🗃️ Use your dashboard to organize, search and edit all of your sandboxes
⚡ Create teams to collaborate on sandboxes together in real-time
🔴 Because of this, CodeSandbox Live is now free!

there's more:
medium.com/@compuives/ann
jihchi 18:50:21
https://twitter.com/samccone/status/1014341689253613569?s=12

🌩️ Instantly understand where your webpack 4 build time is going by adding one argument.

webpack --plugin webpack/lib/debug/ProfilingPlugin
💪 1

2018-07-05

jihchi 09:22:52
https://cssguidelin.es/

cssguidelin.es

CSS Guidelines

High-level advice and guidelines for writing sane, manageable, scalable CSS

👍 1
jihchi 17:26:30
https://github.com/nbedos/termtosvg

GitHub

nbedos/termtosvg

termtosvg - Record terminal sessions as SVG animations

❤️ 1
jihchi 17:28:08
https://github.com/mame/quine-relay

GitHub

mame/quine-relay

quine-relay - An uroboros program with 100+ programming languages

2018-07-06

mofas 05:17:29
The man, the meth, the legend!
jihchi 08:31:04
https://twitter.com/sharifsbeat/status/1014900348492943360?s=12

Obviously Promises are not cancellable.
But what we can do, is make them lazy by wrapping them inside a function and making them quasi cancellable. Cancellable is a very small function, might be useful if you're not using Tasks, bluebird or rxjs f.e.

codesandbox.io/s/yk0vw275rz
jihchi 09:00:11
https://enlight.nyc/y-combinator

enlight.nyc

Deriving the Y Combinator

A walkthrough of the purpose and workings of the Y combinator in JavaScript.

這東西真熟悉
jihchi 17:35:19
http://keycode.info/ @swei.hsu 上次一直找不到,最近找到了!

keycode.info

JavaScript Event KeyCodes

Keycode testing tool - which keys map to which keycodes?

💯 1
jihchi 22:37:51
https://github.com/alcor/itty-bitty.git

GitHub

alcor/itty-bitty

itty-bitty - Itty.bitty is a tool to create links that contain small sites

2018-07-08

mofas 06:07:03
https://speakerdeck.com/peterpme/reasonreact-a-love-story

Speaker Deck

ReasonReact - A Love Story

When I first met ReactJS, it was love at first sight. We built beautiful UIs for years together with our firstborn, Redux. I felt like nothing would get between us. Not even when a younger, skinnier version came along (Preact). Life was good. Everything changed when ReasonReact showed up on our block. I was curious, of course. Didn’t act on it, though. Why would I? We’d run into each other a lot since we shared the same circles. One day, the temptations got too strong. What was I thinking? Nothing about what I was doing felt right, at first. I was leaving a lot behind but for some weird reason, I knew I’d end up here anyway. I mean, it’s not like we’re splitting apart. React will still be there, but so will Reason... I’m here to announce my love affair.

mofas 12:12:55
GraphQL Europe 2018
1

2018-07-09

mofas 00:34:47
https://www.youtube.com/watch?v=_OTwfCbbVXU&list=PLn2e1F9Rfr6lOTXAxwZDlukTVpBxyxeur&index=17

YouTube

The Future of GraphQL Servers - Peggy Rayzis @ GraphQL Europe 2018

totally agree that sever-side adoption is super important
… But we use python in backends, and graphene is still very cryptic ._.
drop it
🎉 2
mofas 00:34:54
Best talk in graphQL Europe
jihchi 19:06:21
GitHub - rhysd/vim.wasm: Vim editor ported to WebAssembly
https://github.com/rhysd/vim.wasm

GitHub

rhysd/vim.wasm

vim.wasm - Vim editor ported to WebAssembly

mofas 22:38:34
有人要猜一下
```
const reg1 = /^[abc]+$/gi;
const reg2 = /^[def]+$/gi;

const f1 = (words) => {
return words.filter(d => {
console.log(reg1.test(d), reg2.test(d));
return reg1.test(d) || reg2.test(d);
});
}

const f2 = (words) => {
return words.filter(d => {
return reg1.test(d) || reg2.test(d);
});
}

console.log(f1(['abc', 'abf', 'def']));
console.log(f2(['abc', 'abf', 'def']));
```

f1跟f2會return什麼嗎
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test

> test() called multiple times on the same global regular expression instance will advance past the previous match.

看來沒事不要亂用 regexp instance 的 method,你永遠猜不到哪些會是記憶性的 lol
恭喜🎉 要 reset
Michael Hsu 2018-07-10 09:27:29
可以參考 ramda 實作 test(或直接用
每次都 new 一個新的 Reg
把g拿掉就好了 哪來這麼麻煩= =

2018-07-10

mofas 22:15:55
http://jxnblk.com/writing/posts/defining-component-apis-in-react/

jxnblk.com

Jxnblk Writing

The writing of Brent Jackson

"Avoid Apropcalypse" is really an art.
abstracting a new prop or defining a new component is a hard decision.

2018-07-11

mofas 01:29:32
```
if (d > 1) ret += (d >> 1) << 1;
```
想不到寫js 也會有一天寫出這樣的code lol
mofas 01:41:50
唉呀, 我錯了 有更快的 `if (d > 1) ret += d & ~1;`
mofas 01:43:46
總之就是某段code要跑 `Math.floor(d/2)*2` 但是速度太慢了(這clock應該破千). 只好直接條bit 只要兩個clock
mrorz 01:46:15
`if (d > 1) ret += d - d%2` ?
調 bit 是否會比較快要看 interpreter 是否會正確翻譯 instruction 呢
mofas 01:46:38
d % 2 你這裡就在跑 除法
mofas 01:46:52
乘除都是幾千clock
mrorz 01:53:44
那浮點數轉 int 再轉回來要多少 cycle?
還是在你想跑的環境裡測一下比較能確定
mrorz 01:55:24
v8 如果能猜對 type 應該就會比較快就是了
mofas 01:56:34
的確應該要來寫個uint好惹
mofas 01:57:30
`In Java, the bitwise operators work with integers. JavaScript doesn't have integers. It only has double precision floating-point numbers. So, the bitwise operators convert their number operands into integers, do their business, and then convert them back. In most languages, these operators are very close to the hardware and very fast. In JavaScript, they are very far from the hardware and very slow. JavaScript is rarely used for doing bit manipulation.`
mofas 01:57:43
好像真的不會快 = =
mofas 02:00:46
https://jsperf.com/bit-vs-module/1
原來 jsperf 還活著
甚感欣慰
1
mofas 02:00:54
module 比較快 !! lol
我每次跑都不一樣,有時候 bitwise 比較快,有時候 module 比較快
https://jsperf.com/bit-vs-module-2 `uint` 發生什麼事了囧
👍 2
Michael Hsu 09:57:49
https://www.facebook.com/AirbnbEng/videos/1989360027763421/
Airbnb Tech Talk: GraphQL and Apollo at Airbnb

Facebook

2018-07-12

jihchi 08:28:37
https://twitter.com/bobzhang1988/status/1016860153725911041?s=12

ICYMI: we have made a major release: bs-platform 4.0.0

2018-07-13

mofas 01:25:55
eslint-scope 3.7.2 was compromised
mrorz 01:59:14
wow 大新聞
mofas 03:28:04
mrorz現在是白天都不用上班惹ㄇ
照樣上班ㄚ
mofas 03:28:25
https://code.visualstudio.com/blogs/2018/07/12/introducing-logpoints-and-auto-attach

code.visualstudio.com

Introducing Logpoints and auto-attach

Introducing Logpoints and auto-attach to make debugging easier and simpler to use in Visual Studio Code

mofas 03:56:54
```
This observation is especially relevant for JavaScript developers, who mostly deal with the complexity of managing state, and this might explain why most JavaScript developers still prefers to add console.log's to their source code instead of using a script debugger.
```
mofas 04:11:18
`Logpoints` 還蠻好用的 不用打 `console.log` 但是我還是比較喜歡一鍵執行
👍 1
jihchi 09:48:16
https://eslint.org/blog/2018/07/postmortem-for-malicious-package-publishes

<https://github.com/eslint/eslint-scope/issues/39#issuecomment-404533026>

ESLint - Pluggable JavaScript linter

Postmortem for Malicious Packages Published on July 12th, 2018

A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.

幸好發現得算快呢
jihchi 12:39:15
https://twitter.com/dan_abramov/status/1017409804308905986?s=12

Just got a report that CodePens in the official Tutorial on the React website used a two-years-old version of React (0.14).

Can’t decide if I should be embarrassed that I forgot to update them, or proud that all of them work with latest React 16 with ZERO changes.
jihchi 14:27:56
https://twitter.com/addyosmani/status/1017655423099289600?s=12

Tip: Webpack supports performance budgets for sites :moneybag:

You can..
:writing_hand: Configure a max file size (e.g JS should be < some KB)
:rotating_light: Throw a warning or error if files get large
:mag_right: Only apply to certain file extensions (.js, .css etc)

https://webpack.js.org/configuration/performance/
jihchi 17:28:03
https://github.com/teodosii/react-notifications-component

GitHub

teodosii/react-notifications-component

react-notifications-component - Highly configurable and easy to use React Component to notify your users!

2018-07-14

mofas 03:25:00
http://fastpack.io/

fastpack.io

Fastpack · Pack JavaScript fast &amp; easy

Pack JavaScript fast &amp; easy

mofas 03:26:15
Ultra fast pack tool, 10x faster than webpack/parcel

2018-07-15

mofas 03:34:25
How to build yourself npm worm!
mofas 21:34:10
The good example of worm! Try to find by yourself.
😂 1

2018-07-16

mofas 03:05:35
https://9to5mac.com/2018/07/10/app-store-10-years-design-evolution/

9to5Mac

10 years of the App Store: The design evolution of the earliest apps

One of the most significant design opportunities in recent history was announced with a simple blog post on Apple&rsquo;s website. &ldquo;Let me just say it: We want native third-party applications on the iPhone, and we plan to have an SDK in developers&rsquo; hands in February,&rdquo; Steve Jobs wrote. On a quiet Thursday morning less than a year later, the App Store opened to iPhone users with a selection of just over 500 apps. Few contemporary innovations have changed how we live our lives and interact with the world around us more than iPhone apps. The creators of the first 500 available at launch had the unique opportunity of shaping the design direction and interaction methods of the millions of apps created since. To celebrate the App Store&rsquo;s 10th anniversary, let&rsquo;s study the visual evolution of 10 original App Store apps. The Apps For the purpose of this piece, I&rsquo;ve focused exclusively on notable visual changes to apps that were available to download on day one and are still receiving updates today. While many of these apps are also available for iPad, this review highlights changes to iPhone versions. (Click on any photo to view a larger version.) iTunes Remote Apple set an example for other developers right out of the gate by publishing some of their own software on the App Store. Two of the first apps created were the game Texas Hold&rsquo;em and Remote, a simple utility for controlling playback of your Mac or Apple TV&rsquo;s iTunes library over Wi-Fi. While Texas Hold&rsquo;em was pulled from the store in 2011, Remote lives on today. From the beginning, Remote&rsquo;s design was heavily influenced by the look and feel of the iPhone&rsquo;s iPod app (today called Music). In fact, the Now Playing view was essentially identical in appearance. Version 2.0 brought a new icon designed by Louie Mantia. The two apps began to diverge at iOS 6, when the stock Music app was completely redesigned and featured a volume slider that responded dynamically to the movement of your iPhone. Remote kept a more stock appearance. The icon was again updated to match the styling of iTunes 11 on the Mac. Remote&rsquo;s first major ground-up redesign came with iOS 7. In contrast to the Music app&rsquo;s stark white theme, Remote featured a dark, blurred background that was tinted by the color of your album artwork. In 2016, Apple released the Apple TV Remote app for the 4th-generation Apple TV, a logical step forward that appeared to replace Remote. Shortly after, Remote was renamed iTunes Remote. While the app continued to be available for download, it remained practically unchanged until this past June, when it received a completely new design and support for the iPhone X&rsquo;s taller display. iTunes Remote&rsquo;s refresh returns to a much more visually conservative look reminiscent of the iOS 11 Music app, but forgoes large titles and cards in favor of traditional navigation. Instead of a red tint color, iTunes Remote uses blue to match the updated icon. Facebook In contrast to iTunes Remote&rsquo;s modest changes, the Facebook app has been continuously redesigned over the past decade with increasing frequency. A comprehensive visual history of the app would fill a small book, so I&rsquo;ve chosen to highlight eight of the more significant changes. Facebook&rsquo;s adventures on the iPhone actually began before the App Store existed. The service was initially available as one of the iPhone&rsquo;s first web apps in October 2007. Version 1.0 in the App Store is barely recognizable as Facebook today aside from the signature blue navigation bar. Even the icon is missing the signature white &ldquo;f.&rdquo; The app&rsquo;s News Feed was essentially an embellished table view above a tab bar with five icons: Home, Profile, Friends, Chat, and Inbox. Version 2.0 built on the same concept, adding two more layers of navigation underneath the main title bar. Facebook 3.0 was first previewed in July 2009, and introduced a 3&times;3 grid of icons to help solve the app&rsquo;s ballooning navigation. Early screenshots show an entirely blue tiled grid, but this design was never released in a public build of the app. In October 2011, Facebook 4.0 was an early adopter of the &ldquo;hamburger menu&rdquo; for navigation. The app&rsquo;s popularity hastened the embrace of the controversial design element across countless apps and websites in following years. After version 4, Facebook&rsquo;s design timeline becomes significantly more challenging to follow. The app&rsquo;s look began to iterate faster, and changes were often rolled out incrementally instead of being held for major releases. In April 2013, Facebook experimented with &ldquo;Chat Heads&rdquo; in the iOS app, moveable profile photos that expanded into chat windows when tapped on. iOS 7&rsquo;s new look necessitated a redesign that saw the reintroduction of a tab bar for navigation. Tab bar icons are still regularly redesigned and relocated between updates. Some of Facebook&rsquo;s design challenges come from their operational scale. Unlike many smaller apps, Facebook must offer a consistent experience to its customers on a large number of platforms, not just Apple&rsquo;s. An update in August 2017 attempted to unify the design of the News Feed across iOS, Android, and the web with comments styled to look more like a Messenger conversation. Things Things began development as a task management tool for the Mac, but ended up hitting 1.0 status on iOS first. Cultured Code, the app&rsquo;s developer, noted in their launch post that the original version was built in just over a month &ndash; a deadline that seemed impossible. Things 1.0 lacked a way to sync with the Mac version and had tagging disabled, both critical features. Despite the stressful launch, the same basic hierarchy of the app persists to this day. An excellent Flickr album documents the app&rsquo;s early design stages. The first major visual refresh came in August 2012 when Things 2.0 was released. A fresh coat of paint shed the stock iOS look, and little graphical embellishments gave it unique personality. Things 2.5 in September 2014 refreshed the app&rsquo;s UI again with a flatter look and lighter color scheme. A redesign was originally planned for Things 3, but development took longer than expected. Things 3 released in May 2017 was the most significant change the app&rsquo;s look yet. Virtually every icon and UI element was re-drawn while preserving the underlying layout. In the update&rsquo;s launch video, Cultured Code specifically highlights how animation was used to give the app an all-new feel. The redesign earned Cultured Code an Apple Design Award in 2017. OmniFocus Even in its infancy, the App Store was well-stocked with task management apps. Both Things and OmniFocus, from The Omni Group, have been available since day one. Although both apps provide similar utility, each has taken unique design directions over the past decade. OmniFocus for iPhone initially used simple table views with custom iconography for navigation, winning an Apple Design Award in 2008. The Omni Group redrew all of their artwork and the app&rsquo;s icon in June 2010 in response to the iPhone 4&rsquo;s Retina display. One of the app&rsquo;s largest changes came in June 2011 when Forecast mode was added. A glossy date picker just under the navigation bar became a defining UI element, even when the gloss was dropped in 2013 for an iOS 7-era redesign. The new flat look relied heavily on text tint colors for spatial awareness. An update in spring 2015 brought a darker app icon to the iPhone with softer edges on the check mark. Every icon since 2012 has included an Easter egg that even longtime users might not know about. Zoom in and you&rsquo;ll notice that the carbon fiber texture is actually made up of tiny, repeating Omni logos. The most recent major update to OmniFocus came this past May with OmniFocus 3.0. While many of the changes were engi…

2
jihchi 22:10:44
https://github.com/imbrn/v8n

GitHub

imbrn/v8n

v8n - :ballot_box_with_check: JavaScript fluent validation library.

jihchi 22:23:43
https://github.com/hasura/graphql-engine

GitHub

hasura/graphql-engine

graphql-engine - Blazing fast, instant GraphQL APIs on Postgres with fine grained access control

2018-07-17

mofas 05:13:26
Twitter as your REPL.
mofas 05:14:06
"only work when you have 129k followers"
😂 2
mofas 23:25:01
Tutorial: Designing a GraphQL API

2018-07-18

jihchi 21:57:52
https://github.com/alidcastano/rogue.js

GitHub

alidcastano/rogue.js

rogue.js - Rogue.js - a nearly invisible framework for creating server-rendered React applications

2018-07-20

jihchi 08:14:49
https://twitter.com/addyosmani/status/1020064908895895552?s=12

Measure web performance with the RAIL model: bit.ly/rail-model - goals and guidelines for faster pages. Updated for 2018 ⚡
jihchi 08:35:55
https://twitter.com/left_pad/status/1019947243019882496?s=12

If you've been wondering how the Pipeline Proposal has been moving along, @JamesDiGioia has written a post on the @babeljs blog 🎉! babeljs.io/blog/2018/07/1
jihchi 18:21:59
v1.9.0
https://github.com/yarnpkg/yarn/releases/tag/v1.9.0

GitHub

yarnpkg/yarn

yarn - :package::cat2: Fast, reliable, and secure dependency management.

2018-07-21

jihchi 15:11:41
https://github.com/thedaviddias/Front-End-Performance-Checklist

GitHub

thedaviddias/Front-End-Performance-Checklist

Front-End-Performance-Checklist - :video_game:The only Front-End Performance Checklist that runs faster than the others.

jihchi 15:11:46
https://github.com/nathan/pax

GitHub

nathan/pax

pax - The fastest JavaScript bundler in the galaxy.

2018-07-22

mofas 12:07:11
https://github.com/GoogleChromeLabs/ndb

GitHub

GoogleChromeLabs/ndb

ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

👍 2
mofas 12:07:49
現在js的dev tools DX 應該top1惹
mofas 12:09:35
之前 vs code attach debug整合 node.js 已經還不錯了
mofas 12:09:44
現在這個更加暴力
mofas 12:10:05
還可以做各種profiling

2018-07-23

mofas 08:54:49
用了vue這段時間 真的覺得vue-cli是一個大贏react eco system的設計
mofas 08:57:28
你可以開 ui 去選擇要inject什麼東西到你的project去, 不用自己 yarn install 然後調config 和 import
像是inject jest plugin 他就幫你開好資料夾 加上example code 注入npm script 和install all dependency
mofas 08:58:08
雖然覺得這沒定義好 inject不同plugin 應該會overwrite的亂七八遭 然後壞掉
mofas 08:58:13
但是目前還沒發生過 lol
我覺得他應該會發生在一年後當你想要升其中幾個套件的版本的時候。

不過 React 也何嘗不會有這種問題呢 XDD
所以 vue-cli 讓大家亂 inject 還可以繼續 work?
這樣 create-react-app 又在堅持什麼,讓大家啥都不能改 Orz
另外vue-cli 裡面用webpack-chain 讓你想怎麼改webpack就怎麼改
我用rewired-cra 寫到都快吐血惹
我覺得是vue-cli的plugin 已經吸取大量前人精髓(望向webpack) 所以設計的plugin可以cover到大多數人的用途 又能避免炸掉
https://cli.vuejs.org/dev-guide/plugin-dev.html#service-plugin
看這精美的dev documents
Next.js 也是呢
不過沒有 dev docs 一切自求多福囧
https://github.com/zeit/next.js/#customizing-webpack-config
jihchi 09:19:58
beginner friendly ?
jihchi 09:59:29
https://github.com/bvaughn/react-window

GitHub

bvaughn/react-window

react-window - React components for efficiently rendering large lists and tabular data

jihchi 10:00:23
https://github.com/bvaughn/react-window/issues/5 . 各種 AutoSizer

GitHub

AutoSizer · Issue #5 · bvaughn/react-window

Document an AutoSizer solution built with react-measure (based on the Resize Observer spec, can be polyfilled). This seems like a more future-friendly way of detecting resize. For the moment, I hav...

mofas 10:07:16
Shamelessly copy and use!
👍 2 2 2 😎 1
mrorz 11:39:00
由於我們希望可以重複使用 action creator,我們現在的 code base 的 action creator 有很多這種 code:
```
dispatch(setState('isLoading', false));
dispatch(setLoadingError(''));
dispatch(loadData(resp));
```

但其實上面這樣的 code 會觸發 3 次 re-render。

讀了一下 https://github.com/reduxjs/redux/issues/959 發現其實 2015 年 gaearon 曾經推薦過 redux-batched-actions: https://github.com/tshelburne/redux-batched-actions

感覺起來應該挺必要的,有人踩過什麼雷嗎?
re-render 透過 PureComponent 可以不用太擔心?
但我的例子裡,state 被更新了三次沒錯。

如果你的 component 是 `Form` 好死不死就 connect 了 `isLoading`, `loadError`, `data`
就會 render 三次呢 XD
假設裡面的 component 沒用到 prop 就不會 re-render
Hmm 確實透過夠細緻的封裝可以避免 re-render
不過同時也會進行很多的 prop comparison(當然與 vdom 比起來,這個比較確實輕量很多)

如果能把 dispatch batch 起來,就不用做這些 prop comparison 惹
你可以用updater pattern 呀 XD
```
updater => updater(reducer)

dispatcher('update', state => state.set('isLoading', false).set('loadingError', '').set('data', resp));
```
我偷懶不想create action/action type/listener 的時候 整個reducer就只會有一個action 叫update XD
反正我已經幾乎沒在用redux log 去看action dispatch
維護不易啊
it is fine if you don't need to maintain
Hahhah
It’s true
mofas 21:03:40
react-select v2 offical release
不過我已經不知道他有幾個props了
https://react-select.com/props

react-select.com

React-Select

A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.

Downshift 正夯?
我覺得downshift理念真的比較好
只是實作細節react-select做了必較好
時代不一樣,定位也不一樣。react-select 當時還是最好用
不見得每次都有時間自己刻

2018-07-24

jihchi 08:14:49
https://twitter.com/dceddia/status/1021396910823886848?s=12

A quick tutorial on React's Context API - pass props around easily without "prop drilling" (and no Redux needed):
mofas 10:25:30
https://github.com/cyan33/learn-react-source-code

GitHub

cyan33/learn-react-source-code

learn-react-source-code - :fire: Build react from scratch (code + blog)