Skip to content

Instantly share code, notes, and snippets.

View wuliupo's full-sized avatar
🎯
Focusing: Jenkins, Vue, React

Pauli wuliupo

🎯
Focusing: Jenkins, Vue, React
View GitHub Profile
@wuliupo
wuliupo / curry.js
Last active June 12, 2017 10:19
Currying-柯里化
/*
Curry(咖喱) 的概念很简单:只传递给函数一部分参数来调用它,让它返回一个函数去处理剩下的参数。
- 柯里化: http://baike.baidu.com/view/2804134.htm
- Currying: https://en.wikipedia.org/wiki/Currying
- Lodash: https://lodash.com/docs#curry
- Lodash-FP:https://github.com/lodash-archive/lodash-fp
- Ramda:http://ramdajs.com/
*/
function match(what) {
@wuliupo
wuliupo / functional.js
Last active June 12, 2017 10:17
Functional programming
// the functional programming version
const find2 = (f => f(f))(f =>
(next => (x, y, i = 0) =>
(i >= x.length) ? null :
(x[i] === y) ? i :
next(x, y, i+1))((...args) =>
(f(f))(...args)));
let arr = [0, 1, 2, 3];
console.log(find2(arr, 2));
@wuliupo
wuliupo / git-util.md
Last active June 12, 2017 10:21 — forked from lttlrck/gist:9628955
rename git branch locally and remotely

git branch -m old_branch new_branch         # Rename branch locally

git push origin :old_branch                 # Delete the old branch

git push --set-upstream origin new_branch   # Push the new branch, set local branch to track the new remote

git reset --hard HEAD                       # Revert (rolling back) to your current head point
@wuliupo
wuliupo / copy.htm
Created October 13, 2016 02:57
Pure JavaScript Copy
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS Copy</title>
</head>
<body>
<h1>Pure JavaScript Copy</h1>
<button id="copyBtn">Copy Content</button>
<button id="randomBtn">Change Content</button>
@wuliupo
wuliupo / show-more.htm
Created October 12, 2016 06:08
Angular demo - show-more
<!doctype html>
<html lang="en" ng-app="demoApp">
<head>
<meta charset="UTF-8">
<title>Angular demo - show-more</title>
<style>
li{list-style:none;}
li .item{display:block;width:200px;margin-bottom:10px;padding:2px 4px;border:1px solid #888;}
li:nth-child(even) .item{background-color:#DDD;}
</style>
@wuliupo
wuliupo / get.php
Created June 14, 2016 05:13
PHP get remote file, anti anti spam
<?php
$url = getParam('url');
$encode = getParam('encode');
$file = 'cache/'.md5($url);
$exist = file_exists($file);
if($exist && (time() - filemtime($file) < 3600)){ // use cache during 10 minutes
echo file_get_contents($file);
exit();
}
@wuliupo
wuliupo / choujiang.htm
Created May 4, 2016 06:24
滚动抽奖活动
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>抽奖活动</title>
<style type="text/css">
body{font-size:12px;text-align:center;line-height:40px;}
.result_box{margin:0 auto;width:700px;max-width:100%;padding:10px 0;text-align:center;border:3px solid #40AA53;background:#efe;}
.result_box #oknum{width:99%;color:#cc0000;font-size:50pt;font-family:Verdana;text-align:center;border:none;background:#efe;}
@wuliupo
wuliupo / ScriptInHTML.html
Last active August 29, 2015 14:03
ScriptInAjax
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ScriptInHTML</title>
</head>
<body>
<button type="button" onclick="loadData();" >click me to load data</button>
<div id="loading">Loading</div>
<script type="text/javascript" src="//code.jquery.com/jquery-latest.js"></script>
@wuliupo
wuliupo / wc2014.ics
Created June 13, 2014 09:32
World Cup 2014 Calendar
BEGIN:VCALENDAR
METHOD:PUBLISH
VERSION:2.0
X-WR-CALNAME:世界杯
PRODID:-//Apple Inc.//Mac OS X 10.9.2//EN
X-APPLE-CALENDAR-COLOR:#711A76
X-WR-TIMEZONE:Asia/Shanghai
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Asia/Shanghai
<!DOCTYPE html>
<html>
<head>
<title>Bar Colors Example</title>
</head>
<body>
<div class="action"><button id="Real">Real</button><button id="Relative">Relative</button></div>
<div id="canvas" class="example-chart" style="height:1000px;width:100%"></div>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="../src/jquery.jqplot.js"></script>