Skip to content

Instantly share code, notes, and snippets.

@jinwei233
jinwei233 / Block.jsx
Created May 27, 2017 09:00
多行文本垂直居中,前置 icon
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
AsyncStorage,
Platform,
} from 'react-native';
@jinwei233
jinwei233 / 我对 JavaScript 闭包的理解.org
Last active August 29, 2015 14:20
我对 JavaScript 闭包的理解

在 JavaScript 中,创建一个 表达式 —— 通常是一个 函数表达式 时,这个函数以及创建函 数时的 环境 共同构成了 闭包

举个例子,一个数数的函数:

function Counter(){
  var n = 0;
  return function(){
    n++;
@jinwei233
jinwei233 / event-simulate.js
Last active August 15, 2016 09:22
跨浏览器的事件模拟
// **跨浏览器的事件模拟**
// @keyword event-simulate,dispatchEvent,fireEvent,事件模拟
// @author cookieu@gmail.com
// 现有的功能库非常长,而且基本都抄自 yui 的代码
// 比如:
// - https://github.com/totorojs/event-simulate
// - https://github.com/dxq613/event-simulate
// 有时我们只需要模拟简单的几个事件,这时候去 copy 一大段代码,或引入一个第三方库,显得不切实际
// 有一个 jQuery 的插件很小
// - https://github.com/eduardolundgren/jquery-simulate/blob/master/jquery.simulate.js
@jinwei233
jinwei233 / learning_clojure_1
Created July 13, 2014 16:29
getting started with clojure
想学 clojure 是因为看到一篇 blog ,在 pc 上支持 600k 的并发,太疯狂了,比 Node.js
的 250k 两倍还多,于是就心痒痒。并且 clojure 是 lisp 的方言,已知对 lisp 很有兴趣,
但是好像它被一些人人视为「玩具」——除非你特别牛,用它是找不到工作的。而clojure和
Java一样,是基于JVM的语言,所以它可以真的投入使用,比如 Storm 就是 clojure 的应用。
1. clojure 的高并发能力
- 因为它是 lock-free 的 [5]
2. Mac 下安装lein
在已经有 Java 环境的情况下,安装非常简单:
@jinwei233
jinwei233 / raphael_grid_hover_effect.html
Created December 19, 2013 06:48
raphaeljs 绘制网格,以及网格响应
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="http://a.tbcdn.cn/p/global/1.0/global-min.css" />
<title>Raphaeljs 绘制网格</title>
<style type="text/css" media="screen">
.con{
border:1px solid #999;width:700px;height:350px;margin:10px 0 0 10px;
@jinwei233
jinwei233 / raphaeljs_cross_line.html
Created December 19, 2013 03:23
raphaeljs 绘制十字线,mousemove重绘
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="http://a.tbcdn.cn/p/global/1.0/global-min.css" />
<title>Raphaeljs 绘制十字线</title>
<style type="text/css" media="screen">
.con{
border:1px solid #999;width:700px;height:350px;margin:10px 0 0 10px;
@jinwei233
jinwei233 / raphaeljs_smooth_line_join.html
Created December 19, 2013 02:54
raphaeljs平滑的连线
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<link rel="stylesheet" href="http://a.tbcdn.cn/p/global/1.0/global-min.css" />
<title>Raphaeljs 平滑的连接端点</title>
<style type="text/css" media="screen">
.con{
border:1px solid #999;width:700px;height:350px;margin:10px 0 0 10px;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>kissy 自定义事件对象(Custom EventTarget) </title>
</head>
<body>
<script charset="utf-8" src="http://g.tbcdn.cn/kissy/k/1.4.0/seed.js"></script>
<script type="text/javascript">
@jinwei233
jinwei233 / kissy_1.3_1.4 extend.html
Last active December 30, 2015 11:19
兼容kissy1.2~1.4的extend
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>兼容kissy1.2~1.4的extend</title>
</head>
<body>
<!-- 改成1.4.0 进行测试-->
<script charset="utf-8" src="http://g.tbcdn.cn/kissy/k/1.3.0/seed.js"></script>
function(){
\```
}