This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadIamge(imageSrc, name) { | |
var image = new Image() | |
image.setAttribute('crossOrigin', 'anonymous') | |
image.onload = function () { | |
var canvas = document.createElement('canvas') | |
canvas.width = image.width | |
canvas.height = image.height | |
var context = canvas.getContext('2d') | |
context.drawImage(image, 0, 0, image.width, image.height) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2017-05-31T01:35:50.116Z","extensionVersion":"v2.8.1"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {Object|String} data string or keys of object are named in form of snake | |
* @param {number} depth to which level of keys should it process | |
* @return {Object|String} string or keys of object are named in form of camel case | |
*/ | |
exports.snakeToCamel = function(data, depth) { | |
if (Util.isObject(data)) { | |
if (typeof depth === 'undefined') { | |
depth = 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Util = require('util'); | |
module.exports = function AlpOpenError(message, extra) { | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
Util.inherits(module.exports, Error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// originally from: http://stackoverflow.com/questions/5796718/html-entity-decode/27385169 | |
function(str) { | |
var element = document.createElement('div'); | |
// regular expression matching HTML entities | |
var entity = /&(?:#x[a-f0-9]+|#[0-9]+|[a-z0-9]+);?/ig; | |
function decodeHTMLEntities() { | |
// find and replace all the html entities | |
str = str.replace(entity, function(m) { | |
element.innerHTML = m; | |
return element.textContent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var func in module.exports) { | |
if (typeof module.exports[func] === 'function') { | |
module.exports[func].displayName = func; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
hasClassName: function(element, name) { | |
return new RegExp('(?:^|\\s+)' + name + '(?:\\s+|$)').test(element.className); | |
}, | |
addClassName: function(element, name) { | |
if (!this.hasClassName(element, name)) { | |
element.className = element.className ? [element.className, name].join(' ') : name; | |
} | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(userAgent, fileName) { | |
var suffix = '.zip'; | |
if(userAgent.indexOf('msie') >= 0 || userAgent.indexOf('chrome') >= 0) { | |
return 'attachment; filename=' + encodeURIComponent(fileName) + suffix; | |
} else if(userAgent.indexOf('firefox') >= 0) { | |
return 'attachment; filename*="utf8\'\'' + encodeURIComponent(fileName)+'"' + suffix; | |
} else { | |
return 'attachment; filename=' + new Buffer(fileName).toString('binary') + suffix; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snippet> | |
<content><![CDATA[ | |
import React from 'react'; | |
let ${1:componentName} = React.createClass({ | |
propTypes: { | |
}, | |
getInitialState() { | |
return {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="overlay"> | |
<div class="loading"></div> | |
<div class="fool-tooltip" data-tooltip="Processing...">Processing...</div> | |
</div> |
NewerOlder