Skip to content

Instantly share code, notes, and snippets.

View ruyaoyao's full-sized avatar
❣️

Shiny ruyaoyao

❣️
View GitHub Profile
@ruyaoyao
ruyaoyao / Recharts Custom Legend
Created November 9, 2017 06:50 — forked from abhirathore2006/Recharts Custom Legend
Recharts Custom Legend
import React from "react"
import Time from "react-time"
import { OverlayTrigger, Popover } from "react-bootstrap"
import { CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Surface, Symbols, XAxis, YAxis } from "recharts"
import "./style/StudentEngagement.less"
import { i18n } from "../services/Messages/Messages"
class StudentEngagementLineChart extends React.Component {
@ruyaoyao
ruyaoyao / data.js
Created October 25, 2017 06:03 — forked from ryanflorence/data.js
React-router request handle and prefetch data
// routes.js
const routes = [
{
path: '/',
component: Home,
exact: true
},
{
path: '/gists',
component: Gists
@ruyaoyao
ruyaoyao / Logger.js
Created October 20, 2017 03:45 — forked from santhoshtr/Logger.js
Winston based configurable node logger
var winston = require( 'winston' ),
fs = require( 'fs' ),
logDir = 'log', // Or read from a configuration
env = process.env.NODE_ENV || 'development',
logger;
winston.setLevels( winston.config.npm.levels );
winston.addColors( winston.config.npm.colors );
if ( !fs.existsSync( logDir ) ) {
@ruyaoyao
ruyaoyao / index.js
Created October 12, 2017 07:40 — forked from miguelmota/index.js
Node.js Winston logger wrapper to display filename
var log = require('./lib/logger')(module);
log.info('foo');
@ruyaoyao
ruyaoyao / ClientApp.jsx
Created July 20, 2017 14:50 — forked from btholt/ClientApp.jsx
react-router server-side rendering
const React = require('react')
const Landing = require('./Landing')
const Search = require('./Search')
const Layout = require('./Layout')
const Details = require('./Details')
const ReactRouter = require('react-router')
const data = require('../public/data')
const { Router, Route, hashHistory, IndexRoute } = ReactRouter
const Store = require('./Store')
const { store } = Store
@ruyaoyao
ruyaoyao / lopmonhoc.js.jsx
Created July 15, 2017 13:41 — forked from revskill10/lopmonhoc.js.jsx
Integrate Datatable with React.js
/** @jsx React.DOM */
var LopMonHoc = React.createClass({
getInitialState: function(){
return {data: []}
},
loadData: function(){
$.ajax({
url: '/daotao/lops',
success: function(data){
@ruyaoyao
ruyaoyao / index.html
Created May 23, 2017 02:20
多行文本未知高度垂直居中-by一丝 // source http://jsbin.com/xowiyuw
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>多行文本未知高度垂直居中-by一丝</title>
<style id="jsbin-css">
*{margin:0;padding:0;}
.box{
height:200px;
@ruyaoyao
ruyaoyao / index.html
Last active May 23, 2017 02:20
CSS 垂直置中解法, Making element to align vertically. JS Bin// source http://jsbin.com/dunutiwone
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<style id="jsbin-css">
.ot {
width: 400px;
height: 400px;
border: 1px solid #FF6600;
@ruyaoyao
ruyaoyao / parseLodash.js
Created April 28, 2017 03:22 — forked from gucheen/parseLodash.js
Safe JSON.parse with lodash.js
function parseLodash(str){
return _.attempt(JSON.parse.bind(null, str));
}
@ruyaoyao
ruyaoyao / README
Created February 23, 2017 05:42 — forked from adilapapaya/README
Export Table Data to CSV using Javascript
Example code for exporting data in a table to a csv file.