Skip to content

Instantly share code, notes, and snippets.

😀
Coding!

一波不是一波 riskers

😀
Coding!
Block or report user

Report or block riskers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@riskers
riskers / main.md
Created Sep 26, 2018
wordpress 开发
View main.md
| - your-theme
  | - images              # 主题相关图片资源
  | - header.php          # html 头部模板
  | - footer.php          # html 尾部模板
  | - index.php           # 首页模板
  | - single.php          # 文章模板
  | - page.php            # 页面模板
  | - style.css           
@riskers
riskers / README.md
Last active Sep 27, 2018
wxapp 踩坑日志
View README.md
  1. tabBarselectedIconPath 必须设置,否则:

尺寸最好为 81 * 81

  1. navigationStyle: "custom" 时可以自定义导航栏,然后如果需要设置返回键,需要设置 topstatusBarHeight + 10:

10 是经验值,是指胶囊键据屏幕上边缘的距离

@riskers
riskers / README.md
Created Jun 20, 2018
react router 获取 query params
View README.md
<Router>
  <div className="router-container">
    <Route exact path="/" component={ Home } />
    <Route exact path="/search" component={ Search } />
  </div>
</Router>

比如现在搜索要搜 t: texts: abc,路由应该是 /search?t=text&s=abc

View default.custom.yaml
# Rime default settings
# encoding: utf-8
patch:
config_version: "0.38"
schema_list:
# - schema: luna_pinyin
- schema: luna_pinyin_simp
# - schema: luna_pinyin_fluency
# - schema: bopomofo
@riskers
riskers / injectReducer.js
Last active Mar 6, 2018
react-router inject store
View injectReducer.js
import { combineReducers } from 'redux';
import globalDate from 'reducers/globalDate'
import permission from 'reducers/permission'
const createReducer = function (reducers) {
return combineReducers({
/* 公共 reducers,无论一开始在哪个路由下,都会载入 */
globalDate,
@riskers
riskers / immutablejs.md
Last active Apr 23, 2019
reselect 和 immutablejs 学习说明
View immutablejs.md

在 reducer 中,都是返回一个新对象,否则组件是不会更新 ui 的。而返回新对象,可以:

  • Object.assign:比较 hack,每次新生成一个对象
  • ...state
  • immutable.js
@riskers
riskers / readme.md
Last active Aug 24, 2017
css modules + react + babel-react-css-modules
View readme.md
  • 在入口文件(app.js)引入全局 css (:global(.xxx){...}), .xxx 不会被解析成 hash,可以在组件中 className="xxx" 使用
  • 本地css在组件(demo.js)中引入局部 css (.yyy{...}) ,在组件中 styleName="yyy" 使用

common.css: global-style

:global(.xxx) {
  ...
@riskers
riskers / readme.md
Last active Apr 24, 2019
check node_modules and yarn.lock is fit
View readme.md

yarn.lock 与 node_modules 保持一致

  • yarn add xxx 添加新的 package,同时更新 package.jsonyarn.lock
  • yarn upgrade xxx 更新 package,同时更新 package.jsonyarn.lock

这样操作过后,我们把 yarn.lock push 到代码仓库中

node_modules 与 yarn.lock 保持一致

团队使用 Yarn 来管理模块依赖,这样只能保证大家的 yarn.lock 是一致的,但不能保证大家的 node_modules 是一致的(因为 node_modules 并不在版本库里)。要是有人升级了模块,别人拿到了新的 yarn.lock ,但是本地的 node_modules 里的模块仍然是旧的。

@riskers
riskers / demo1.md
Created Jul 13, 2017
es6 module vs require
View demo1.md
// es6
export var foo = 'bar';
setTimeout(() => foo = 'baz', 500);

// main
import {foo} from './t.js';
console.log(foo); // bar
setTimeout(() => console.log(foo), 500); // baz
You can’t perform that action at this time.