Skip to content

Instantly share code, notes, and snippets.

View cheton's full-sized avatar
🎯

Cheton Wu cheton

🎯
View GitHub Profile
@cheton
cheton / .eslintrc
Last active July 21, 2016 07:25
ESLint
{
"plugins": [
"react"
],
"extends": "airbnb",
"env": {
"browser": true,
"node": true,
"es6": true
},
@cheton
cheton / .stylinrc
Created March 8, 2016 07:31
Stylus Linter
//
// https://github.com/rossPatton/stylint
//
{
"blocks": false,
"brackets": "always",
"colons": "always",
"colors": false,
"commaSpace": "always",
"commentSpace": false,
@cheton
cheton / .babalrc
Created March 17, 2016 07:08
Webpack Configuration
{
"presets": ["es2015", "stage-0", "react"],
"env": {
"development": {
"presets": ["react-hmre"]
}
}
}
@cheton
cheton / index.js
Last active March 21, 2016 16:42
Flat Tree
'use strict';
import _ from 'lodash';
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
const isArray = Array.isArray;
const extend = (target, ...sources) => {
sources.forEach((source) => {
for (let key in source) {
import omit from 'lodash/omit';
import React, { Component, PropTypes } from 'react';
const REGEXP = /{{(.+?)}}/;
class Interpolate extends Component {
static defaultProps = {
parent: 'span'
};
.custom-scroll::-webkit-scrollbar {
-webkit-overflow-scrolling: touch;
height: 10px;
width: 10px
}
.custom-scroll::-webkit-scrollbar:hover {
background-color: #E9E9E9;
border: 1px solid #dbdbdb
}
@cheton
cheton / Button.jsx
Last active November 22, 2016 02:31
Buttons
import classNames from 'classnames';
import React, { PropTypes } from 'react';
import styles from './index.styl';
const Button = (props) => {
const {
type = 'button',
children,
className,
componentClass,
## Application Blocking
### ApplicationControl.jsx
```js
import PropTypes from 'prop-types';
import React, { PureComponent } from 'react';
import BlockedAppsModal from './BlockedAppsModal';
import {
MODAL_BLOCKED_APPS
} from './constants';
<Widget widgetId="threats" />
// ES7 class properties
class Widget extends React.Component {
state = this.getInitialState(); // ?
getInitialState() {
return {
widgetId: this.props.widgetId
};
@cheton
cheton / index.jsx
Last active September 18, 2017 04:31
Show a modal window on the topmost frame of the browser window
import 'trendmicro-ui/dist/css/trendmicro-ui.css';
import '@trendmicro/react-buttons/dist/react-buttons.css';
import { Button } from '@trendmicro/react-buttons';
import React, { PureComponent } from 'react';
import ReactDOM from 'react-dom';
import styled from 'styled-components';
import Navbar from './Navbar';
import Portal from '../src';
const StyledPortal = styled(Portal)`