Skip to content

Instantly share code, notes, and snippets.

View RaoHai's full-sized avatar
🎯
Focusing

陆沉 RaoHai

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am RaoHai on github.
  • I am raohai (https://keybase.io/raohai) on keybase.
  • I have a public key whose fingerprint is C9BF EABD B2F5 49EF B234 1999 8416 6130 B3AD 7BB9

To claim this, I am signing this object:

class Chart {
changeData(arg: any) {}
axis(arg: any) {}
render() {}
}
function field(config: any) {
return function (target, propertyKey, descriptor) {};
}
@RaoHai
RaoHai / run.js
Created October 10, 2017 02:37
一键拉黑本页红卫兵
[].slice.call(document.querySelectorAll('.follow_item'))
.map(function(item) {
var d = item.getAttribute('action-data');
var data = /uid=(\d+)&/g.exec(d);
var uid = data && data[1];
if (uid) {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://weibo.com/aj/f/addblack?ajwvr=6');
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
@RaoHai
RaoHai / upload.js
Created December 9, 2016 07:46
Simpe Image Resampling
// var fileInput = document.querySelector('file');
var targetWidth = 400;
var targetHeight = 400;
function doUpload () {
// upload picture
}
fileInput.onChange = function () {
var file = this.files[0];
@keyframes pop-upwards {
0% {
transform: matrix(.97,0,0,1,0,12);
opacity: 0
}
20% {
transform: matrix(.99,0,0,1,0,2);
opacity: .7
}
import React from 'react';
import classnames from 'classnames';
import './highlightMenu.less';
function getSelectionClientRect() {
const selection = window.getSelection();
console.log('> getSelectionClientRect', selection.rangeCount, selection.isCollapsed);
if (selection.rangeCount && !selection.isCollapsed ) {
const range = selection.getRangeAt(0).cloneRange();
return range.getBoundingClientRect && range.getBoundingClientRect();
import React from 'react';
import { Editor, EditorState } from 'draft-js';
import InlineStyles from '../InlineStyles';
export default class EditorCore extends React.Component {
constructor(props) {
super(props);
this.state = { editorState: EditorState.createEmpty() };
this.onChange = this._onChange.bind(this);
}
export default {
BOLD: {
fontWeight: 700,
},
ITALIC: {
fontStyle: 'italic',
},
};
@RaoHai
RaoHai / App.js
Created September 27, 2016 12:21
import React, { Component } from 'react';
import logo from '../logo.svg';
import './App.css';
import EditorCore from './EditorCore';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
import React from 'react';
import { Editor, EditorState } from 'draft-js';
export default class EditorCore extends React.Component {
constructor(props) {
super(props);
this.state = { editorState: EditorState.createEmpty() };
this.onChange = this._onChange.bind(this);
}
_onChange(editorState) {