Skip to content

Instantly share code, notes, and snippets.

View liuxiaomingskm's full-sized avatar

xiaoming liu liuxiaomingskm

View GitHub Profile
@liuxiaomingskm
liuxiaomingskm / index.html
Last active February 7, 2020 00:55
运用SVG描绘四面国旗~
<svg
version="1.1"
baseProfile="full"
xmlns="http://www.w3.org/2000/svg"
id="bahamas">
<rect x ="0" y="100" width="600" height="100" fill="#FFC72C" />
<polygon points="0 0, 260 150, 0 300" fill="black"/>
</svg> -->
<svg
version="1.1"
baseProfile="full"
xmlns="http://www.w3.org/2000/svg">
</svg>
@liuxiaomingskm
liuxiaomingskm / index.html
Last active February 6, 2020 18:11
SVG初体验(划线和分组)
<svg
version='1.1'
baseProfile="full"
smlns="http://www.w3.org/2000/svg">
<g stroke-width="5px" stroke="blue">
<line x1="100" y1="100" x2="700" y2="350" />
<line x1 ="100" y1="350" x2="700" y2="100" />
</g>
</svg>
@liuxiaomingskm
liuxiaomingskm / app.js
Created February 6, 2020 03:00
General Update Pattern for D3(D3的常用更新模式)
var add = d3.select("#add");//add is a button
add.on('click', function(){
quotes = quotes.concat(newQuotes);
var listItems = d3.select("#quotes")
.selectAll("li")
.data(quotes);
listItems
@liuxiaomingskm
liuxiaomingskm / event-listener.js
Created February 5, 2020 00:08
D3 记事本添加note 使用D3库
d3.select("#new-note").on("submit", function(){
d3.event.preventDefault();
var input = d3.select("input");
d3.select("#notes")
.append("p")
.classed("note",true)
.text(input.property("value"));
input.property("value","");
});
@liuxiaomingskm
liuxiaomingskm / ajax-4-ways-exercise-starter.markdown
Last active February 2, 2020 17:38
AJAX 4 Ways Exercise (用XML,fetch,JQuery, Axios四种方式调用api并显示)
@liuxiaomingskm
liuxiaomingskm / axios-error-handling.markdown
Last active February 2, 2020 16:46
Axios Error Handling (axios有更为精细的错误划分 error.reponse, error.request)
@liuxiaomingskm
liuxiaomingskm / index.html
Last active February 2, 2020 00:49
use Axios to replace JQery Ajax
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<button id="btn">click me!</button>
@liuxiaomingskm
liuxiaomingskm / index.html
Last active February 2, 2020 00:25
用JQuery调用随机猫咪图片api, 发送get请求 并更改img中src属性
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<div class="container">
<h1>Welcome To Random Cat Pictures</h1>
<img id="photo" src="https:\/\/dog.ceo\/api\/img\/deerhound-scottish\/n02092002_6780.jpg" alt="">
<button id="btn">Get Random Cat!</button>
</div>
@liuxiaomingskm
liuxiaomingskm / index.html
Last active February 2, 2020 00:01
jQuery AJAX Shorthand Methods(JQuery发送POST、PUT、getJSON的快捷写法)
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<button id="getBtn">GET()</button>
<button id="postBtn">POST()</button>
<button id="getJSONBtn">GETJSON()</button>