Skip to content

Instantly share code, notes, and snippets.

View reygreen1's full-sized avatar
🖨️

RayGuo reygreen1

🖨️
View GitHub Profile

TL,DR: 务必总是在构建函数里定义实例属性。

在小胖的PoorPhy物理库里,有很多类似这样的代码:

function WorldA () {
  // ...
}

WorldA.prototype = {
@reygreen1
reygreen1 / store_usage.md
Last active October 19, 2022 09:02
store.js官方使用文档的翻译,便于大家阅读。

store.js使用简介

store.js 提供了一套跨浏览器的本地存储解决方案。

// 将 'marcus' 存为 'username'
store.set('username', 'marcus')

// 获取 'username'

##移动端webapp开发的触摸事件

###1.触摸事件

  • touchstart:当手指触摸屏幕时触发;即使已经有一个手指放在了屏幕上也会触发。

  • touchmove:当手指在屏幕上滑动时连续的触发。在这个事件发生期间,调用preventDefault()可阻止滚动。

  • touchend:当手指从屏幕上移开时触发。

@reygreen1
reygreen1 / node中常用的全局对象.md
Last active May 20, 2019 05:20
对node中全局对象的一些整理

##全局对象(global)

__dirname:当前文件所在目录的绝对路径

__filename:当前文件的绝对路径

console:输出信息

  1. console.log():打印日志信息
  2. console.info():打印相关信息
@reygreen1
reygreen1 / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@reygreen1
reygreen1 / dabblet.css
Created December 24, 2014 08:58
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@reygreen1
reygreen1 / dabblet.css
Created December 24, 2014 08:59
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@reygreen1
reygreen1 / dabblet.css
Created December 24, 2014 09:02
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@reygreen1
reygreen1 / dabblet.css
Created February 3, 2015 07:28
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;