react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);2) get requireAccess func => bindCheckAuth to redux
react + redux + RR
It uses https://gist.github.com/iNikNik/3c1b870f63dc0de67c38 for stores and actions.
1) create redux
const redux = createRedux(state);2) get requireAccess func => bindCheckAuth to redux
| <script> | |
| // A minimal polyfill for copying text to clipboard that works most of the time in most capable browsers. | |
| // Note that: | |
| // - You may not need this. `navigator.clipboard.writeText()` works directly in all modern browsers as of 2020. | |
| // - In Edge, this may call `resolve()` even if copying failed. | |
| // - In Safari, this may fail if there is nothing selected on the page. | |
| // See https://github.com/lgarron/clipboard-polyfill for a more robust solution. | |
| // | |
| // License for this Gist: public domain / Unlicense | |
| function writeText(str) { |
Inspired by dannyfritz/commit-message-emoji
See also gitmoji.
| Commit type | Emoji |
|---|---|
| Initial commit | 🎉 :tada: |
| Version tag | 🔖 :bookmark: |
| New feature | ✨ :sparkles: |
| Bugfix | 🐛 :bug: |
| import * as mongoose from 'mongoose'; | |
| export let Schema = mongoose.Schema; | |
| export let ObjectId = mongoose.Schema.Types.ObjectId; | |
| export let Mixed = mongoose.Schema.Types.Mixed; | |
| export interface IHeroModel extends mongoose.Document { | |
| name: string; | |
| power: string; |
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\ is your / directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git, the mingw64 in this directory is your root. Find it by using pwd -W).
If you go to that directory, you will find the typical linux root folder structure (bin, etc, lib and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.
It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.
It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.
| const needsPolyfill = !window.Intl | |
| /* eslint-disable import/no-webpack-loader-syntax */ | |
| const intl = require('bundle-loader?lazy&name=intl!intl') | |
| /* eslint-enable import/no-webpack-loader-syntax */ | |
| const polyfilled = needsPolyfill && new Promise(resolve => { | |
| intl(resolve) | |
| }) |
sorted by rerender time
| Solution | Use CSS | Use Inline-Styles | Mount Time (ms) | Rerender time (ms) |
|---|---|---|---|---|
| react (without styles) | - | - | 16.11 | 29.96 |
| styled-jsx-static | + | - | 25.27 | 42.24 |
| emotion-extract-static | + | + | 52.29 | 44.79 |
| react-css | + | + | 28.17 | 46.18 |
| styletron | + | - | 53.03 | 47.36 |
| // Source of https://www.npmjs.com/package/physical-cpu-count | |
| 'use strict' | |
| const os = require('os') | |
| const childProcess = require('child_process') | |
| function exec (command) { | |
| const output = childProcess.execSync(command, {encoding: 'utf8'}) | |
| return output |
| on run {input, parameters} | |
| set output to "http://translate.google.com/translate_t?sl=auto&tl=uk&text=" & urldecode(input as string) | |
| return output | |
| end run | |
| on urldecode(x) | |
| set cmd to "'require \"cgi\"; puts CGI.escape(STDIN.read.chomp)'" | |
| do shell script "echo " & quoted form of x & " | ruby -e " & cmd | |
| end urldecode |