Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Alan.He alanhg

🎯
Focusing
Block or report user

Report or block alanhg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alanhg
alanhg / pre-commit.sh
Last active Mar 15, 2020
checkstyle when pre commit
View pre-commit.sh
#!/bin/bash
wd=`pwd`
function print(){
echo "===========$*============"
}
print "Start check style for Java"
View axios-utils.ts
import axios from 'axios';
/**
* Cancel previous pending request
*/
const pending = new Map();
export const addPending = config => {
const url = [config.method, config.url].join('&');
config.cancelToken =
View tslint.json
{
"extends": ["tslint:latest", "tslint-react", "tslint-eslint-rules", "tslint-config-prettier"],
"linterOptions": {
"exclude": ["lib/**"]
},
"jsRules": {
"object-literal-sort-keys": false
},
"rules": {
"jsx-no-lambda": false,
View saga-spec-factory.ts
export default class SagaSpecFactory {
static getAPIStub(apiMethodFunc: any, response: object): any {
return ({ fn, args }, next) => {
if (fn === apiMethodFunc) {
return response;
}
return next();
};
}
}
View enzyme-setup.ts
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
// React 16 Enzyme adapter
configure({ adapter: new Adapter() });
@alanhg
alanhg / intl-enzyme-test-helper.ts
Created Oct 2, 2019
intl-enzyme-test-helper.ts
View intl-enzyme-test-helper.ts
import React from 'react';
import { IntlProvider, intlShape } from 'react-intl';
import { mount, render, shallow } from 'enzyme';
const messages = {}; // en.json
const intlProvider = new IntlProvider({ locale: 'en', messages, onError: () => '' }, {});
const { intl } = intlProvider.getChildContext();
function nodeWithIntlProp(node) {
@alanhg
alanhg / .huskyrc
Created Sep 13, 2019
husky config
View .huskyrc
{
"hooks": {
"pre-commit": "tsc --noEmit && lint-staged",
"pre-push": "yarn install && yarn run test"
}
}
@alanhg
alanhg / settings.xml
Created Aug 20, 2019
maven setting default config
View settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<id> central</id>
<name> Maven Repository Switchboard</name>
<layout> default</layout>
You can’t perform that action at this time.