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
var svgString = new XMLSerializer().serializeToString(root); | |
var width = root.clientWidth, height = root.clientHeight; | |
var canvas = document.createElement("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
var ctx = canvas.getContext('2d'); | |
var DOMURL = self.URL || self.webkitURL || self; | |
var img = new Image(); |
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 fs = require('fs') | |
function rmPath(path, cb) { | |
fs.lstat(path, (err, stats) => { | |
//console.log('retrieve:', path) | |
if (stats.isDirectory()) { | |
fs.readdir(path, (err, files) => { | |
let len = files.length + 1 | |
let checkDir = () => { | |
//console.log(path + ' left:', len-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
function [varargout]=rp_sliceviewer(AOperation, varargin) | |
% Show a brain's slice. "rp_sliceviewer" can be opened more than one instance like MRIcro, and supports multi-slice, overlay and so on. by Xiao-Wei Song | |
%Usage: hFig =rp_sliceviewer('ShowImage', AFilename, CallBack); | |
% rp_sliceviewer('Delete', AFigHandle); | |
%Detailed usage is the code file "rp_sliceviewer.m" | |
%------------------------------------------------------------------------------------------------------------------------------ | |
% Copyright(c) 2007~2012 | |
% State Key Laboratory of Cognitive Neuroscience and Learning, Beijing Normal University | |
% Written by Xiao-Wei Song | |
% http://www.restfmri.net |
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 fetchData(url, cb) { | |
var xhr = new XMLHttpRequest() // 新建一个请求对象,如果需要文档,查XMLHttpRequest | |
xhr.open('GET', url) // get类型, url;注意此时请求还没有发送 | |
xhr.onload = function() {cb(xhr.responseText)} // 写好callback回调函数,因为js是异步的,只用通过回调函数接收参数来获取。 | |
xhr.send() // 发送请求,这里才是真的开始请求,请求成功的话回调就成功了;post在这里发送数据 | |
} | |
(function () { | |
var callback = function (str) { | |
var data = JSON.parse(str) // JSON.parse, JSON.stringify 互相转换 |
NewerOlder