Skip to content

Instantly share code, notes, and snippets.

View leohxj's full-sized avatar
💯
Focusing

Leo Hui leohxj

💯
Focusing
View GitHub Profile
@leohxj
leohxj / dozzle
Created March 13, 2021 04:52
docker logs
docker run --name dozzle -d --volume=/var/run/docker.sock:/var/run/docker.sock -p 4040:8080 amir20/dozzle:latest
@leohxj
leohxj / request.ts
Last active March 5, 2021 08:13
fetch 封装
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import { ApiError } from './ApiError';
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
import { OpenAPI } from './OpenAPI';
function isDefined<T>(value: T | null | undefined): value is Exclude<T, null | undefined> {
return value !== undefined && value !== null;
@leohxj
leohxj / main.dev.ts
Last active February 26, 2021 02:30
Electron 管理 BrowserView
// xx
const view = new BrowserView()
win.setBrowserView(view)
view.setBounds({ x: 0, y: 0, width: 300, height: 300 })
view.webContents.loadURL('https://electronjs.org')
@leohxj
leohxj / settings.json
Created September 30, 2019 07:49
vsc setting for ngte
{
"editor.fontFamily": "FiraCode-Retina",
"editor.fontLigatures": true,
"editor.fontSize": 18,
"editor.dragAndDrop": false,
"editor.minimap.renderCharacters": false,
"editor.roundedSelection": false,
"editor.quickSuggestions": {
"other": true,
"comments": true,
@leohxj
leohxj / logger.js
Created July 15, 2019 02:11
custom logger
export const logger = (name, ...args) => {
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line
console.groupCollapsed(`logger --> ${name}`);
// eslint-disable-next-line
console.log(...args);
// eslint-disable-next-line
console.groupEnd();
}
};
@leohxj
leohxj / index.html
Last active January 7, 2019 14:44
[todoMVC] dom structure
<section class="todoapp">
<div>
<header class="header">
<h1>todos</h1>
<input class="new-todo" placeholder="What needs to be done?" value="" />
</header>
<section class="main">
<input id="toggle-all" class="toggle-all" type="checkbox" />
<label for="toggle-all"></label>
<ul class="todo-list">
@leohxj
leohxj / getInitialState.jsx
Last active November 14, 2021 17:24
[react initialState] initState #react
class A extends React.PureComponent {
state = this.getInitialState();
getInitialState() {
const { className } = this.props;
return {
className
};
}
@leohxj
leohxj / deepEquals.js
Last active November 28, 2018 09:33
#react
function deepEquals(a, b, ca = [], cb = []) {
// Partially extracted from node-deeper and adapted to exclude comparison
// checks for functions.
// https://github.com/othiym23/node-deeper
if (a === b) {
return true;
} else if (typeof a === "function" || typeof b === "function") {
// Assume all functions are equivalent
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255
return true;
width: 120px;
flex: auto;
display: -webkit-box;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
import PropTypes from 'prop-types';
import React from 'react';
import styles from './index.less';
export default function Banner({ hasLogo }) {
const logo = hasLogo ? <div className={styles.logo} /> : null;
return <div className={styles.container}>{logo}</div>;
}