Skip to content

Instantly share code, notes, and snippets.

一波不是一波 riskers

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.ts
Last active Jun 8, 2016
egret init include loading view
View Main.ts
class Main extends egret.DisplayObjectContainer {
private loadingView: LoadingUI;
static stageWidth: number;
static stageHeight: number;
public constructor() {
super();
View egret-music.md

Main.ts

    var music = new Music;
    this.addChild(music)
        
    this.once(egret.TouchEvent.TOUCH_BEGIN,function(){
        music.stop();
        music.play();
    },this)
@riskers
riskers / .tmux.conf
Last active Apr 6, 2017
tmux 配置、快捷键
View .tmux.conf
# unbind some default keybindings
unbind C-b
# set prefix key to ctrl-a
set -g prefix C-a
# lower command delay
set -sg escape-time 1
# start first window and pane at 1, not zero
@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
@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 / 0-main.md
Last active Oct 31, 2017
javascript 函数式编程
View 0-main.md

我眼中的函数式

函数式是一种编程范式,面向对象也是一种编程范式。

函数式分为两类,Lisp 和 Haskell,Lisp又有很多方言,Clojure、Scheme 都是其中一种。

JS 函数式

JavaScript 这个语言是基于原型的,可以用构造函数的方法去写 OOP,也可以去写函数式。

@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 / es6.md
Last active Mar 15, 2018
异步编程
View es6.md

Promise

基本结构

// 创造 Promise 实例

//Promise构造函数接受一个函数作为参数,该函数的两个参数分别是resolve和reject。
var promise = new Promise(function(resolve,reject){	
	//... some code
You can’t perform that action at this time.