This file contains 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
let greet = function (a) { | |
return { | |
greet: function (b) { | |
return b ? greet(a + " " + b) : a; | |
} | |
} | |
}; | |
console.log(greet('hello').greet('world').greet()) |
This file contains 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
/** | |
* | |
A Magicaldrome String is a string of characters that reads | |
the same forward and backward when characters are read in groups of | |
two and the groups of two are always read from left to right. | |
For example, "abcdcdab" is a | |
Magicaldrome String because the first two characters are the same as the | |
last two characters in the string, namely "ab"; and the 3rd and 4th | |
characters from the left are the same as the 4th and 3rd characters from |
This file contains 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
<main class="page"> | |
<h2>Upload ,Crop and save.</h2> | |
<!-- input file --> | |
<div class="box"> | |
<input type="file" id="file-input"> | |
</div> | |
<!-- leftbox --> | |
<div class="box-2"> | |
<div class="result"></div> | |
</div> |
This file contains 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="container"> | |
<div class="well" data-bind="fileDrag: fileData"> | |
<div class="form-group row"> | |
<div class="col-md-6"> | |
<img style="height: 125px;" class="img-rounded thumb" data-bind="attr: { src: fileData().dataURL }, visible: fileData().dataURL"> | |
<div data-bind="ifnot: fileData().dataURL"> | |
<label class="drag-label">Drag file here</label> | |
</div> | |
</div> | |
<div class="col-md-6"> |
This file contains 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
this.toDataURL(this.data.photoUrl, (dataUrl) => { | |
console.log(dataUrl); | |
}) | |
toDataURL(url, callback) { | |
var xhr = new XMLHttpRequest(); | |
xhr.onload = function() { | |
var reader = new FileReader(); |
This file contains 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
handleFileSelect(evt){ | |
var files = evt.target.files; | |
var file = files[0]; | |
if (files && file) { | |
var reader = new FileReader(); | |
reader.onload =this._handleReaderLoaded.bind(this); | |
reader.readAsBinaryString(file); |