Skip to content

Instantly share code, notes, and snippets.

View wushan's full-sized avatar

Tony Chiang wushan

View GitHub Profile
@wushan
wushan / default.conf
Created November 19, 2016 14:44
NGiNX Configuration for Vue-Router in HTML5 Mode
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@wushan
wushan / jquery.getbgimage.js
Created December 4, 2015 07:09 — forked from schmidsi/jquery.getbgimage.js
getBgImage: Simple Jquery Plugin to get the dimensions or other attributes from a css background-image
// Inspired by http://stackoverflow.com/questions/5106243/how-do-i-get-background-image-size-in-jquery, a simple jquery plugin who does the task
$.fn.getBgImage = function(callback) {
var height = 0;
var path = $(this).css('background-image').replace('url', '').replace('(', '').replace(')', '').replace('"', '').replace('"', '');
var tempImg = $('<img />');
tempImg.hide(); //hide image
tempImg.bind('load', callback);
$('body').append(tempImg); // add to DOM before </body>
tempImg.attr('src', path);