Skip to content

Instantly share code, notes, and snippets.

View tianyk's full-sized avatar
🏠
Working from home

keke tianyk

🏠
Working from home
View GitHub Profile
'use strict';
for (var i = 0; i < 10; i++) {
setTimeout(function() {
console.log(i);
}, 0);
}
for (var i = 0; i < 10; i++) {
(function(i) {
@tianyk
tianyk / update.sh
Created December 21, 2015 08:52
Git Update Hook
#!/bin/bash
# --- Command line
refname="$1"
oldrev="$2"
newrev="$3"
refex="$7"
branch=${refname#refs/heads/}
# Make a temp directory for writing the .jshintrc file
;
/**
* 要求,种子相同的情况下返回的随机序列数组相同。
* e.g.
* <= (1477044467806, 4)
* => [3, 2, 0, 1]
*
* <= (1477044467886, 6)
* => [3, 4, 2, 5, 0, 1]
* @param seed 随机数种子
$('.order-del').each((_, btn) => {
let $btn = $(btn);
$.ajax({
url: `//order.jd.com/lazy/deleteOrder.action?orderId=${$btn.attr('_orderid')}&PassKey=${$btn.attr('_passkey')}`,
dataType: 'jsonp',
cache: false
});
});
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form id="uploadForm" enctype="multipart/form-data">
<input id="file" type="file" name="file" />
@tianyk
tianyk / openresty.conf
Last active April 2, 2018 03:07
openresty
user nginx;
worker_processes 1;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
@tianyk
tianyk / forward.js
Created June 21, 2017 08:18
端口映射
const net = require('net');
// const mapping = [
// {
// localHost: '',
// localPort: '',
// remoteHost: '',
// remotePort: ''
// }
// ];
@tianyk
tianyk / Mock.html
Last active September 8, 2017 03:13
<html>
<head>
<title>Mock.js</title>
</head>
<body>
<script src="http://mockjs.com/dist/mock.js"></script>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script>
<style id="jsbin-css">
.container {
width: 100%;
border: 1px solid #cec;
margin: 10px;
}
.container .img {
width: 100%;
}