Skip to content

Instantly share code, notes, and snippets.

View ETBlue's full-sized avatar

ETBlue ETBlue

View GitHub Profile
@samwize
samwize / mocha-guide-to-testing.js
Created February 8, 2014 05:53
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
function p2(text){
return text < 10 ? "0"+text : text;
}
function getContainedNode(node){
var p = node;
while(p){
if(p && p.classList){
if(p.classList.contains("UFIComment")){
return {type:"comment",node:p};
// before
// 通常這四個都有個共通的因素,才會被擺在一起
if (rtn == RESULT_A || rtn == RESULT_B || rtn == RESULT_C || rtn == RESULT_D) {
Do1();
} else {
Do2();
}
// after
// 所以就把那個因素寫成 function name
@godfat
godfat / gw2-builds.md
Last active March 19, 2018 06:33
GW2 builds

Professions

Elementalist

  • TBA

Mesmer

  • [wvw group boon share chronomancer][]
  • [wvw roaming hybrid mirage][]
@virolea
virolea / upload.js
Last active December 12, 2024 16:14
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])