Skip to content

Instantly share code, notes, and snippets.

View WangShuXian6's full-sized avatar

王树贤 WangShuXian6

  • 哈银消费金融科技管理部
  • beijing
View GitHub Profile
@casamia918
casamia918 / addLessLoader_forCRA5.js
Created January 9, 2022 15:45
addLessLoader for create-react-app@5.0.0
/**
* addLessLoader_forCRA5
* customized addLessLoader of customize-cra for create-react-app@5.0.0
*
* CreatedAt : 2022-01-09
*
* Description: The customize-cra author copy getStyleLoaders codes from react-scripts@4.0.3 > webpack.config.js
* But as react-scripts upgrade to version 5, they also upgrade postcss-loader, which causes change of options schema.
* So, I re-copy getStyleLoaders codes from react-scripts@5.0.0 > webpack.config.js
*
import { catchError, map } from 'rxjs/operators';

const response = this.httpService
  .get('https://abc.com/api/v2/branches')
  .pipe(
    map((response) => response.data),
    catchError((e) => {
      throw new HttpException(e.response.data, e.response.status);
 }),
type Uuid = string;
@sindresorhus
sindresorhus / esm-package.md
Last active May 23, 2024 17:50
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@yuche
yuche / beta.md
Last active August 3, 2020 17:36
taro-next-beta

在 Taro Next 预览版(Alpha)版本之后,我们没有停下迭代的步伐,经过两个月的开发和数百次提交之后,现在我们谨慎但坚定地发布 Taro Next 测试(Beta) 版。相较于 Alpha,Beta 不但更稳定,也添加了更多的功能:

H5 编译支持

H5 编译支持是我们版本升级最重要的理由之一。这意味着原来开发者写的小程序应用,现在可以直接运行在 Web 中。添加 H5 支持非常简单,只需要在项目根目录安装 @tarojs/webpack-runner,运行 taro build —type h5 —watch 即可:

$ npm i -D @tarojs/webpack-runner@next
$ taro build —type h5 —watch
@ZyqGitHub1
ZyqGitHub1 / source.json
Last active April 20, 2024 02:19
hls-source
[
{
"id": "d240e1be-38aa-4356-88b8-d1febb48d95e",
"name": "色色资源站",
"uri": "https://www.emiao026.com",
"httpApi": "http://sscj8.com/inc/api.php",
"httpsApi": "http://sscj8.com/inc/sapi.php",
"type": "综合性资源"
},
{
@crapthings
crapthings / docker-compose.yml
Last active November 20, 2022 12:31
docker-compose rs init
version: '3'
services:
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo
restart: always
expose:
- 27017
ports:
@cowlicks
cowlicks / apollo_ws_subscription_graphql_auth.js
Last active May 16, 2020 03:19
Dynamic auth tokens for Websockets with Graphql Subscriptions
const subscriptionMiddleware = {
applyMiddleware: function(options, next) {
// Get the current context
const context = options.getContext().graphqlContext;
// set it on the `options` which will be passed to the websocket with Apollo
// Server it becomes: `ApolloServer({contetx: ({payload}) => (returns options)
options.authorization = context.authorization;
next()
},
};
@bpartridge
bpartridge / hooks.md
Last active June 10, 2022 09:29
React Hooks as Python decorators

So Hooks finally started to "click" for me when I realized they're very similar to Python decorators. In fact, they're essentially Python-like decorators, curried against the renderer, in an alternate syntax that reduces duplicate typing.

To be clear: I'm NOT advocating for Hooks moving towards decorator syntax, and I agree with the reasons why this suggestion isn't the right direction to move. But I think that the comparison with decorators is useful nonetheless, and perhaps could guide some of the ways in which we introduce Hooks to skeptical stakeholders.

Consider, for a moment, that Python almost adopted this syntax: https://www.python.org/dev/peps/pep-0318/#community-consensus ...

using:
    classmethod
 synchronized(lock)
@kimyvgy
kimyvgy / MANUAL.md
Created May 24, 2018 01:52 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.