Skip to content

Instantly share code, notes, and snippets.

View zushenyan's full-sized avatar
🤪
writing bugs~

Andrew Yan zushenyan

🤪
writing bugs~
View GitHub Profile
function foo(){
document.getElementById("huehue");
}
@zushenyan
zushenyan / SRSHME.html
Last active December 25, 2015 16:29
SRSHME stands for Simple Realtime Syntax Highlight Markdown Editor which is a showcase of how realtime syntax highlight is possible in Html/Css/JavaScript.
<!--
SRSHME stands for Simple Realtime Syntax Highlight Markdown Editor
which is a showcase of how realtime syntax highlight is possible in Html/Css/JavaScript.
Have tested on the latest version of Chrome, Firefox, Opera, Safari and IE 10.
Be aware of this code is not optimized. When you typed too many characters,
it will become more and more laggy because I choose to do it in a straight way,
and since it's just a showcase & tutorial, I will leave it as current state if there is no more critical bugs.
-->
@zushenyan
zushenyan / login.js
Last active December 7, 2015 17:57
A back up of passport basic usage with Redis.
var express = require("express");
var path = require("path");
var passport = require("passport");
var localStrategy = require("passport-local");
var bodyParser = require("body-parser");
var cookieParser = require("cookie-parser");
var session = require("express-session");
var bcrypt = require("bcrypt");
var db = require("redis").createClient(process.env.REDIS_URL);
import _ from "lodash";
import {fn as isGeneratorFn} from "is-generator";
const generatorMiddleware = store => next => action => {
let {dispatch} = store;
let generator = findGenerator(action);
if(isGeneratorFn(action)){
return runGenerator(dispatch, action, action);
}
else if(generator){
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import {
SortableTreeWithoutDndContext as SortableTree,
dndWrapExternalSource,
insertNode
} from 'react-sortable-tree';
import HTML5Backend from 'react-dnd-html5-backend';
import { DropTarget, DragDropContext } from 'react-dnd';
interface Field {
name: string;
path?: string;
}
interface Fields {
[name: string]: Section | Field;
}
interface Section extends Field {
import 'react-select/dist/react-select.css';
import React from 'react';
import { Field, reduxForm } from 'redux-form';
import Select from 'react-select';
const transValue = (value) => ({ label: value, value });
const Input = ({ input, options = [], showDropdown = false }) => {
return <Select.Creatable
inputProps={input}
import React from 'react';
import { Field, reduxForm } from 'redux-form';
import AutoSuggest from 'react-autosuggest';
import styles from './styles.css';
const suggestions = [
{ label: 'Apple', value: 1 },
{ label: 'Aqua', value: 2 },
{ label: 'Banana', value: 3 },
{ label: 'Bean', value: 4 },
// index.js
import React from "react";
import ReactDOM from "react-dom";
import Select from "react-select";
import "./styles.css";
const options = [
{ label: "aaa", value: 1 },
{ label: "bbb", value: 2 },
{ label: "ccc", value: 3 }