Skip to content

Instantly share code, notes, and snippets.

View xudaolong's full-sized avatar
🎯
Focusing

Dillon Xu xudaolong

🎯
Focusing
View GitHub Profile
const express = require('express')
const path = require('path')
const port = process.env.PORT || 8080
const app = express()
// serve static assets normally
app.use(express.static(__dirname + '/public'))
// handle every other route with index.html, which will contain
// a script tag to your application's JavaScript file(s).
@xudaolong
xudaolong / React-CoreRouter.js
Last active January 3, 2019 14:15
React-Webpack 按需加载|-|&tag=react
// FIXME:因为在ComponentsLet中引入了所需的组件,所以不会再单独打包出独立的组件.若工程进一步增加,有必要整理代码
const root_Welcome = {
path: '/Welcome',
getComponent(nextState, cb) {
require.ensure([], (require) => {
cb(null, require('App/Components/Core/Welcome/WelcomeCpt').default)
}, 'Welcome')
}
};
@xudaolong
xudaolong / fetcherUtil.js&env=js&abbr=`aaa&label=aaa
Last active May 6, 2019 02:18 — forked from LopatkinEvgeniy/fetcher.js
JavaScript-Fetch 优雅使用|-|&tag=Other
import fetch from 'isomorphic-fetch';
// usage : const { status, data, error } = yield fetcher('/api/url');
export default function fetcher(url, options = {}) {
return new Promise((resolve) => {
fetch(url, Object.assign({}, {
credentials: 'same-origin',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
@xudaolong
xudaolong / actions.js
Last active May 13, 2020 09:08 — forked from AlexFrazer/actions.js
Redux - Action Component Rendux 集合|-|{"files":{"component.jsx":{"env":"plain","abbr":"jjj"},"actions.js":{"env":"plain","abbr":""}},"tag":"Uncategorized"}
import fetch from 'isomorphic-fetch';
export const REQUEST_POSTS = 'posts/REQUEST';
export const RECEIVE_POSTS = 'posts/RECEIVE';
export const ERROR_POSTS = 'posts/ERROR';
export const ADD_FILTER = 'posts/ADD_FILTER';
export const REMOVE_FILTER = 'posts/REMOVE_FILTER';
// this action is a generic get all posts
(
(name,msg) => console.log(name,msg)
)("dragon","hello,bird");
(
name => console.log(name)
)("dragon");
let cat = {
name:"tom",
#!/bin/sh
echo $ONCEWORK_CLIPBOARD
git remote add origin https://github.com/once-work/oncework.git
@xudaolong
xudaolong / sql-select.txt
Last active February 19, 2021 02:30
|-|{"files":{"sql-select.txt":{"env":"plain","abbr":"sel"}},"tag":"SQL"}
select t.* from %c% t %c%;
git checkout %c%