Skip to content

Instantly share code, notes, and snippets.

Avatar

xiaoming liu liuxiaomingskm

View GitHub Profile
@liuxiaomingskm
liuxiaomingskm / index.html
Last active Feb 7, 2020
运用SVG描绘四面国旗~
View index.html
<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> -->
View index.html
<svg
version="1.1"
baseProfile="full"
xmlns="http://www.w3.org/2000/svg">
</svg>
@liuxiaomingskm
liuxiaomingskm / index.html
Last active Feb 6, 2020
SVG初体验(划线和分组)
View index.html
<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 Feb 6, 2020
General Update Pattern for D3(D3的常用更新模式)
View app.js
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 Feb 5, 2020
D3 记事本添加note 使用D3库
View event-listener.js
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 Feb 2, 2020
AJAX 4 Ways Exercise (用XML,fetch,JQuery, Axios四种方式调用api并显示)
@liuxiaomingskm
liuxiaomingskm / axios-error-handling.markdown
Last active Feb 2, 2020
Axios Error Handling (axios有更为精细的错误划分 error.reponse, error.request)
@liuxiaomingskm
liuxiaomingskm / index.html
Last active Feb 2, 2020
use Axios to replace JQery Ajax
View index.html
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<button id="btn">click me!</button>
@liuxiaomingskm
liuxiaomingskm / index.html
Last active Feb 2, 2020
用JQuery调用随机猫咪图片api, 发送get请求 并更改img中src属性
View index.html
<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 Feb 2, 2020
jQuery AJAX Shorthand Methods(JQuery发送POST、PUT、getJSON的快捷写法)
View index.html
<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>