Skip to content

Instantly share code, notes, and snippets.

@zymiboxpay
zymiboxpay / timeoutFunc.js
Created April 11, 2017 07:12
根据条件,间隔一定时间执行同一段代码
var i = 0;
setTimeout(function timeoutFunc(){
if(i < 10){
i ++;
console.log(i);
setTimeout(timeoutFunc, 1000);
}
}, 1000);
@zymiboxpay
zymiboxpay / machine_learning_with_python.ipynb
Created March 20, 2017 10:37
machine_learning_with_python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zymiboxpay
zymiboxpay / readme.md
Last active March 10, 2017 10:44
password free system

用户的角度

  1. 用户注册/登录
  2. 填写邮箱
  3. 用户收到邮件,点击连接
  4. 若是登录邮件则直接登录,若是注册邮件则确认邮箱且填写用户名

系统的角度

  1. 保存一张注册邮箱数据表,字段有用户ID,邮箱,用户名
@zymiboxpay
zymiboxpay / index.html
Last active March 9, 2017 08:43
learn promise
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script>
(function() {
var id = 0;
@zymiboxpay
zymiboxpay / star_grade.js
Created February 7, 2017 03:27
star_grade
/**
* 司机星级
*
* author: Jude.Zhu
* date: 2016-01-23
*
* require icomoon font-family
*
* usage:
*
@zymiboxpay
zymiboxpay / copy_to_clipboard.js
Created February 7, 2017 03:23
copy_to_clipboard
(function(global, undefined){
function copyToClipboard(content, successCallback) {
successCallback = successCallback || alert.bind(this, '复制成功');
// http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
// IE 8
if(window.clipboardData) {
window.clipboardData.setData('Text', content);
e.preventDefault();
}
// IE 9 以及现代浏览器
@zymiboxpay
zymiboxpay / test.rb
Created December 12, 2016 11:19
random
#!/usr/bin/env ruby
#生成 10_000 个范围在0-4之间的随机数
#计算他们的平均值
#从中随机抽取100个数
#通过有放回重抽法尝试 10_000 次
#每次抽 100 个数
#计算这100个数的平均值
#计算这 10_000 次的平均值
#以上步骤尝试100次
module Solution
@zymiboxpay
zymiboxpay / particle_system.html
Last active December 29, 2016 06:45
particle_system
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>partical</title>
<style>
body {
margin: 0;
padding: 0;
}
@zymiboxpay
zymiboxpay / README.md
Last active November 18, 2016 08:45
javascript 通讯录 索引 效果与微信类似

目标

  • 用javascript实现一个与微信通讯录效果相似的插件

要求

  • 易用
  • 尽量遵守 weui 设计规范
  • 最好是原生的,不依赖 jQuery
  • 页面滚动要流畅

分阶段目标

@zymiboxpay
zymiboxpay / index.html
Created November 10, 2016 04:23
css variables && animations
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>css variables && animations</title>
<script src="http://cdn.bootcss.com/jquery/2.2.4/jquery.js"></script>
<style>
:root {
--transparency: 1;
--v_offset: -100%;