Skip to content

Instantly share code, notes, and snippets.

View ETBlue's full-sized avatar

ETBlue ETBlue

View GitHub Profile
@virolea
virolea / upload.js
Last active October 10, 2024 15:11
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])
@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][]
// before
// 通常這四個都有個共通的因素,才會被擺在一起
if (rtn == RESULT_A || rtn == RESULT_B || rtn == RESULT_C || rtn == RESULT_D) {
Do1();
} else {
Do2();
}
// after
// 所以就把那個因素寫成 function name
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};
@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()
@audreyt
audreyt / a.json.ls
Last active October 23, 2021 14:10
x: 1
y: require \./b.json.ls
z: require \./c.json.ls
#proposal #wrapper #comparison .graph {
position: relative;
height: 4rem;
display: block; // make sub div display in this div
float: left; // fix the display result
width: 25%; // fix the display result
}
screenshot:http://i.imgur.com/mGKUbzK.png
@dvessel
dvessel / r-em-sizing.scss
Last active October 30, 2018 09:59
font-size in rem and a tool for absolute to em conversion. http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
// Inspired by this post from CSS-Tricks.
// http://css-tricks.com/snippets/css/less-mixin-for-rem-font-sizing/
//
// Plays nice with compass/typography/vertical_rhythm
// http://compass-style.org/reference/compass/typography/vertical_rhythm/
//
// Calculates font size in `rem` (root em).
//
// Relative values depends on $base-font-size. Pixle value for font-size depends
// on $legacy-support-for-ie6 or $legacy-support-for-ie7 or $legacy-support-for-ie8
@drublic
drublic / rem-fallback.less
Last active March 28, 2020 23:57
Fallback rem-mixin in Sass and LESS
@main-font-size: 16px;
.x-rem (@property, @value) {
// This is a workaround, inspired by https://github.com/borodean/less-properties
@px-fallback: @value * @main-font-size;
-: ~`(function () { return ';@{property}: @{px-fallback}'; }())`;
-: ~`(function () { return ';@{property}: @{value}rem'; }())`;
}