code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function getSites ($data) { if ($data['mobileSites'].length === 0 && $data['sites'].length) { $data['mobileSites'] = $data['sites']; }; var $sites = (isMobileScreen() ? $data['mobileSites'] : ($data['sites'].length ? $data['sites']: [])).slice(0); var $di...
Get available site lists. @param {Array} $data @return {Array}
getSites
javascript
overtrue/share.js
src/js/jquery.share.js
https://github.com/overtrue/share.js/blob/master/src/js/jquery.share.js
MIT
function makeUrl ($name, $data) { var $template = $templates[$name]; $data['summary'] = $data['description']; for (var $key in $data) { if ($data.hasOwnProperty($key)) { var $camelCaseKey = $name + $key.replace(/^[a-z]/, function($str){ ...
Build the url of icon. @param {String} $name @param {Object} $data @return {String}
makeUrl
javascript
overtrue/share.js
src/js/jquery.share.js
https://github.com/overtrue/share.js/blob/master/src/js/jquery.share.js
MIT
function hasFirstAPI () { if (!$.fn.jquery) return true; // for Zepto var versions = $.fn.jquery.split('.') return ( versions[0] !== '1' || versions[0] === '1' && parseInt(versions[1], 10) >= 4 ); }
Check whether .first() is existed https://api.jquery.com/first/ https://api.jquery.com/first-selector/ use .first() when version is greater or equal to 1.4 @return {boolean}
hasFirstAPI
javascript
overtrue/share.js
src/js/jquery.share.js
https://github.com/overtrue/share.js/blob/master/src/js/jquery.share.js
MIT
function QR8bitByte(data) { this.mode = QRMode.MODE_8BIT_BYTE; this.data = data; this.parsedData = []; // Added to support UTF-8 Characters for (var i = 0, l = this.data.length; i < l; i++) { var byteArray = []; var code = this.data.charCodeAt(i); if (code > 0x10000) { byteArray[0] = 0xF0 | ((c...
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QR8bitByte
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function QRCodeModel(typeNumber, errorCorrectLevel) { this.typeNumber = typeNumber; this.errorCorrectLevel = errorCorrectLevel; this.modules = null; this.moduleCount = 0; this.dataCache = null; this.dataList = []; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QRCodeModel
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);} var offset=0;while(offset<num.length&&num[offset]==0){offset++;} this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
QRPolynomial
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function _isSupportCanvas() { return typeof CanvasRenderingContext2D != "undefined"; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
_isSupportCanvas
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function _getAndroid() { var android = false; var sAgent = navigator.userAgent; if (/android/i.test(sAgent)) { // android android = true; var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i); if (aMat && aMat[1]) { android = parseFloat(aMat[1]); } } return android; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
_getAndroid
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
Drawing = function (el, htOption) { this._el = el; this._htOption = htOption; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
Drawing
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function makeSVG(tag, attrs) { var el = document.createElementNS('http://www.w3.org/2000/svg', tag); for (var k in attrs) if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]); return el; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
makeSVG
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
Drawing = function (el, htOption) { this._el = el; this._htOption = htOption; }
@fileoverview - Using the 'QRCode for Javascript library' - Fixed dataset of 'QRCode for Javascript library' for support full-spec. - this library has no dependencies. @author davidshimjs @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a> @see <a href="http://jeromeetienne.github.co...
Drawing
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function _safeSetDataURI(fSuccess, fFail) { var self = this; self._fFail = fFail; self._fSuccess = fSuccess; // Check it just once if (self._bSupportDataURI === null) { var el = document.createElement("img"); var fOnError = fun...
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
_safeSetDataURI
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
fOnError = function() { self._bSupportDataURI = false; if (self._fFail) { self._fFail.call(self); } }
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
fOnError
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
fOnSuccess = function() { self._bSupportDataURI = true; if (self._fSuccess) { self._fSuccess.call(self); } }
Check whether the user's browser supports Data URI or not @private @param {Function} fSuccess Occurs if it supports Data URI @param {Function} fFail Occurs if it doesn't support Data URI
fOnSuccess
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
Drawing = function (el, htOption) { this._bIsPainted = false; this._android = _getAndroid(); this._htOption = htOption; this._elCanvas = document.createElement("canvas"); this._elCanvas.width = htOption.width; this._elCanvas.height = htOption.height; el.appendChild(this._elCanvas); this...
Drawing QRCode by using canvas @constructor @param {HTMLElement} el @param {Object} htOption QRCode Options
Drawing
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function _getTypeNumber(sText, nCorrectLevel) { var nType = 1; var length = _getUTF8Length(sText); for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) { var nLimit = 0; switch (nCorrectLevel) { case QRErrorCorrectLevel.L : nLimit = QRCodeLimitLength[i][0]; break; case ...
Get the type by string length @private @param {String} sText @param {Number} nCorrectLevel @return {Number} type
_getTypeNumber
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function _getUTF8Length(sText) { var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a'); return replacedText.length + (replacedText.length != sText ? 3 : 0); }
Get the type by string length @private @param {String} sText @param {Number} nCorrectLevel @return {Number} type
_getUTF8Length
javascript
overtrue/share.js
src/js/qrcode.js
https://github.com/overtrue/share.js/blob/master/src/js/qrcode.js
MIT
function share(elem, options) { var data = mixin({}, defaults, options || {}, dataset(elem)); if (data.imageSelector) { data.image = querySelectorAlls(data.imageSelector).map(function(item) { return item.src; }).join('||'); } addClass(elem, 'shar...
Initialize a share bar. @param {Object} $options globals (optional). @return {Void}
share
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function createIcons(elem, data) { var sites = getSites(data); var isPrepend = data.mode == 'prepend'; each(isPrepend ? sites.reverse() : sites, function (name) { var url = makeUrl(name, data); var link = data.initialized ? getElementsByClassName(elem, 'icon-' + name) : ...
Create site icons @param {Element} elem @param {Object} data
createIcons
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function createWechat (elem, data) { var wechat = getElementsByClassName(elem, 'icon-wechat', 'a'); if (wechat.length === 0) { return false; } var elems = createElementByString('<div class="wechat-qrcode"><h4>' + data.wechatQrcodeTitle + '</h4><div class="qrcode"></div><div...
Create the wechat icon and QRCode. @param {Element} elem @param {Object} data
createWechat
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function getSites(data) { if (!data['mobileSites'].length) { data['mobileSites'] = data['sites']; } var sites = (isMobileScreen ? data['mobileSites'] : data['sites']).slice(0); var disabled = data['disabled']; if (typeof sites == 'string') { sites = site...
Get available site lists. @param {Object} data @returns {Array}
getSites
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function makeUrl(name, data) { if (! data['summary']){ data['summary'] = data['description']; } return templates[name].replace(/\{\{(\w)(\w*)\}\}/g, function (m, fix, key) { var nameKey = name + fix + key.toLowerCase(); key = (fix + key).toLowerCase(); ...
Build the url of icon. @param {String} name @param {Object} data @returns {String}
makeUrl
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function querySelectorAlls(str) { return (document.querySelectorAll || window.jQuery || window.Zepto || selector).call(document, str); }
Supports querySelectorAll, jQuery, Zepto and simple selector. @param str @returns {*}
querySelectorAlls
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function selector(str) { var elems = []; each(str.split(/\s*,\s*/), function(s) { var m = s.match(/([#.])(\w+)/); if (m === null) { throw Error('Supports only simple single #ID or .CLASS selector.'); } if (m[1]) { var elem...
Simple selector. @param {String} str #ID or .CLASS @returns {Array}
selector
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function addClass(elem, value) { if (value && typeof value === "string") { var classNames = (elem.className + ' ' + value).split(/\s+/); var setClass = ' '; each(classNames, function (className) { if (setClass.indexOf(' ' + className + ' ') < 0) { ...
Add the classNames for element. @param {Element} elem @param {String} value
addClass
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function getMetaContentByName(name) { return (document.getElementsByName(name)[0] || 0).content; }
Get meta element content value @param {String} name @returns {String|*}
getMetaContentByName
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function getElementsByClassName(elem, name, tag) { if (elem.getElementsByClassName) { return elem.getElementsByClassName(name); } var elements = []; var elems = elem.getElementsByTagName(tag || '*'); name = ' ' + name + ' '; each(elems, function (elem) { ...
Get elements By className for IE8- @param {Element} elem element @param {String} name className @param {String} tag tagName @returns {HTMLCollection|Array}
getElementsByClassName
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function createElementByString(str) { var div = document.createElement('div'); div.innerHTML = str; return div.childNodes; }
Create element by string. @param {String} str @returns {NodeList}
createElementByString
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function dataset(elem) { if (elem.dataset) { return JSON.parse(JSON.stringify(elem.dataset)); } var target = {}; if (elem.hasAttributes()) { each(elem.attributes, function (attr) { var name = attr.name; if (name.indexOf('data-') !...
Get dataset object. @param {Element} elem @returns {Object}
dataset
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function inArray(elem, arr, i) { var len; if (arr) { if (Array$indexOf) { return Array$indexOf.call(arr, elem, i); } len = arr.length; i = i ? i < 0 ? Math.max(0, len + i) : i : 0; for (; i < len; i++) { // Sk...
found element in the array. @param {Array|Object} elem @param {Array} arr @param {Number} i @returns {Number}
inArray
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function each(obj, callback) { var length = obj.length; if (length === undefined) { for (var name in obj) { if (obj.hasOwnProperty(name)) { if (callback.call(obj[name], obj[name], name) === false) { break; } ...
Simple each. @param {Array|Object} obj @param {Function} callback @returns {*}
each
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function alReady ( fn ) { var add = 'addEventListener'; var pre = document[ add ] ? '' : 'on'; ~document.readyState.indexOf( 'm' ) ? fn() : 'load DOMContentLoaded readystatechange'.replace( /\w+/g, function( type, i ) { ( i ? document : window ) [...
Dom ready. @param {Function} fn @link https://github.com/jed/alReady.js
alReady
javascript
overtrue/share.js
src/js/social-share.js
https://github.com/overtrue/share.js/blob/master/src/js/social-share.js
MIT
function runExec(container) { var options = { Cmd: ['bash', '-c', 'echo test $VAR'], Env: ['VAR=ttslkfjsdalkfj'], AttachStdout: true, AttachStderr: true }; container.exec(options, function(err, exec) { if (err) return; exec.start(function(err, stream) { if (err) return; cont...
Get env list from running container @param container
runExec
javascript
apocas/dockerode
examples/exec_running_container.js
https://github.com/apocas/dockerode/blob/master/examples/exec_running_container.js
Apache-2.0
Config = function(modem, id) { this.modem = modem; this.id = id; }
Represents a config @param {Object} modem docker-modem @param {String} id Config's id
Config
javascript
apocas/dockerode
lib/config.js
https://github.com/apocas/dockerode/blob/master/lib/config.js
Apache-2.0
Container = function(modem, id) { this.modem = modem; this.id = id; this.defaultOptions = { top: {}, start: {}, commit: {}, stop: {}, pause: {}, unpause: {}, restart: {}, resize: {}, attach: {}, remove: {}, copy: {}, kill: {}, exec: {}, rename: {}, log:...
Represents a Container @param {Object} modem docker-modem @param {String} id Container's ID
Container
javascript
apocas/dockerode
lib/container.js
https://github.com/apocas/dockerode/blob/master/lib/container.js
Apache-2.0
function dial(callback) { util.prepareBuildContext(file, (ctx) => { optsf.file = ctx; self.modem.dial(optsf, callback); }); }
Builds an image @param {String} file File @param {Object} opts Options (optional) @param {Function} callback Callback
dial
javascript
apocas/dockerode
lib/docker.js
https://github.com/apocas/dockerode/blob/master/lib/docker.js
Apache-2.0
function dialWithSession(callback) { if (opts?.version === "2") { withSession(self, optsf.authconfig,(err, sessionId, done) => { if (err) { return callback(err); } optsf.options.session = sessionId; dial((err, data) => { callback(err, data); if ...
Builds an image @param {String} file File @param {Object} opts Options (optional) @param {Function} callback Callback
dialWithSession
javascript
apocas/dockerode
lib/docker.js
https://github.com/apocas/dockerode/blob/master/lib/docker.js
Apache-2.0
Exec = function(modem, id) { this.modem = modem; this.id = id; }
Represents an Exec @param {Object} modem docker-modem @param {String} id Exec's ID
Exec
javascript
apocas/dockerode
lib/exec.js
https://github.com/apocas/dockerode/blob/master/lib/exec.js
Apache-2.0
Image = function(modem, name) { this.modem = modem; this.name = name; }
Represents an image @param {Object} modem docker-modem @param {String} name Image's name
Image
javascript
apocas/dockerode
lib/image.js
https://github.com/apocas/dockerode/blob/master/lib/image.js
Apache-2.0
Network = function(modem, id) { this.modem = modem; this.id = id; }
Represents an network @param {Object} modem docker-modem @param {String} id Network's id
Network
javascript
apocas/dockerode
lib/network.js
https://github.com/apocas/dockerode/blob/master/lib/network.js
Apache-2.0
Node = function(modem, id) { this.modem = modem; this.id = id; }
Represents an Node @param {Object} modem docker-modem @param {String} id Node's ID
Node
javascript
apocas/dockerode
lib/node.js
https://github.com/apocas/dockerode/blob/master/lib/node.js
Apache-2.0
Plugin = function(modem, name, remote) { this.modem = modem; this.name = name; this.remote = remote || name; }
Represents a plugin @param {Object} modem docker-modem @param {String} name Plugin's name
Plugin
javascript
apocas/dockerode
lib/plugin.js
https://github.com/apocas/dockerode/blob/master/lib/plugin.js
Apache-2.0
Secret = function(modem, id) { this.modem = modem; this.id = id; }
Represents a secret @param {Object} modem docker-modem @param {String} id Secret's id
Secret
javascript
apocas/dockerode
lib/secret.js
https://github.com/apocas/dockerode/blob/master/lib/secret.js
Apache-2.0
Service = function(modem, id) { this.modem = modem; this.id = id; }
Represents an Service @param {Object} modem docker-modem @param {String} id Service's ID
Service
javascript
apocas/dockerode
lib/service.js
https://github.com/apocas/dockerode/blob/master/lib/service.js
Apache-2.0
Task = function(modem, id) { this.modem = modem; this.id = id; this.defaultOptions = { log: {} }; }
Represents an Task @param {Object} modem docker-modem @param {String} id Task's ID
Task
javascript
apocas/dockerode
lib/task.js
https://github.com/apocas/dockerode/blob/master/lib/task.js
Apache-2.0
Volume = function(modem, name) { this.modem = modem; this.name = name; }
Represents a volume @param {Object} modem docker-modem @param {String} name Volume's name
Volume
javascript
apocas/dockerode
lib/volume.js
https://github.com/apocas/dockerode/blob/master/lib/volume.js
Apache-2.0
function handler(err, container) { expect(err).to.be.null; expect(container).to.be.ok; var attach_opts = { stream: true, stdin: true, stdout: true, stderr: true, hijack: true }; container.attach(attach_opts, function handler(err,...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, container) { expect(err).to.be.null; expect(container).to.be.ok; var attach_opts = { stream: true, stdin: true, stdout: true, stderr: true, hijack: true }; container.attach(attach_opts, function handler(err,...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, container) { expect(err).to.be.null; expect(container).to.be.ok; container.attach({ stream: true, stdout: true, stderr: true }, function handler(err, stream) { expect(err).to.be.null; expect(stream).to.be.ok; ...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, container) { expect(err).to.be.null; expect(container).to.be.ok; var attach_opts = { stream: true, stdin: true, stdout: true, stderr: true, hijack: true }; container.attach(attach_opts, function handler(err,...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, container) { expect(err).to.be.null; expect(container).to.be.ok; var attach_opts = { stream: true, hijack: true, stdin: true, stdout: true, stderr: true }; container.attach(attach_opts, function handler(err,...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, stream) { expect(err).to.be.null; expect(stream).to.be.ok; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; expect(data).to.be.ok; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; expect(data).to.be.ok; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, stream) { expect(err).to.be.null; expect(stream.pipe).to.be.ok; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, exec) { expect(err).to.be.null; exec.start(function(err, stream) { expect(err).to.be.null; expect(stream.pipe).to.be.ok; exec.inspect(function(err, data) { expect(err).to.be.null; expect(data).to.be.ok; done(); ...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, exec) { expect(err).to.be.null; exec.start() .then(stream => { expect(stream.pipe).to.be.ok; done(); }) .catch(done); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, exec) { expect(err).to.be.null; exec.start(startOpts, function(err, stream) { expect(err).to.be.null; //expect(stream).to.be.ok; expect(stream).to.be.an.instanceof(Socket); //return done(); var SAMPLE = 'echo\nall\nof\nme\n'; ...
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, stream) { expect(err).to.be.null; expect(stream).to.be.ok; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
function handler(err, data) { expect(err).to.be.null; done(); }
simple test that writes 1000 bytes to the "wc -c" command, that command returns the number of bytes it received, so it should return 1000 for this test
handler
javascript
apocas/dockerode
test/container.js
https://github.com/apocas/dockerode/blob/master/test/container.js
Apache-2.0
parseComment = function(comment) { // from esdoc (https://github.com/esdoc/esdoc/blob/master/src/Parser/CommentParser.js) comment = comment.replace(/\r\n/gm, '\n') // for windows comment = comment.replace(/^\t*\s?/gm, '') // remove trailing tab comment = comment.replace(/^\*\s?/, '') // remove first '*' comme...
A little module that extracts the API information from doc comments. @type {exports|module.exports}
parseComment
javascript
ritzyed/ritzy
extractapi.js
https://github.com/ritzyed/ritzy/blob/master/extractapi.js
Apache-2.0
printApiMethod = function(apiMethod) { //console.log(metadata) //console.log(metadata.comments) var docString = '====\n' + 'https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js#L' + apiMethod.line + '[Ritzy.' + apiMethod.name + ']::\n' + apiMethod.comments.filter(function(c) { return c.hasOwnProperty...
A little module that extracts the API information from doc comments. @type {exports|module.exports}
printApiMethod
javascript
ritzyed/ritzy
extractapi.js
https://github.com/ritzyed/ritzy/blob/master/extractapi.js
Apache-2.0
byApiMethod = function(apiDocString) { return function(apiMethod) { return apiMethod.comments.filter(function(c) { return c.hasOwnProperty('@apidoc') && c['@apidoc'] === apiDocString }).length > 0 } }
A little module that extracts the API information from doc comments. @type {exports|module.exports}
byApiMethod
javascript
ritzyed/ritzy
extractapi.js
https://github.com/ritzyed/ritzy/blob/master/extractapi.js
Apache-2.0
writeSection = function(section, sectionRef, sectionDescription) { process.stdout.write('[[' + sectionRef + ']]\n== ' + section + '\n\n' + sectionDescription + '\n\n') apiInfo.filter(byApiMethod(section)).map(printApiMethod).forEach(function(apiDoc) { process.stdout.write(apiDoc + '\n') }) }
A little module that extracts the API information from doc comments. @type {exports|module.exports}
writeSection
javascript
ritzyed/ritzy
extractapi.js
https://github.com/ritzyed/ritzy/blob/master/extractapi.js
Apache-2.0
initConfig = function(config) { let defaultVal = function(key, defaultValue) { if(!config.hasOwnProperty(key)) { if(typeof defaultValue === 'function') { config[key] = defaultValue() } else { config[key] = defaultValue } } } let requireVal = function(key) { if(!confi...
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
initConfig
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
initConfig = function(config) { let defaultVal = function(key, defaultValue) { if(!config.hasOwnProperty(key)) { if(typeof defaultValue === 'function') { config[key] = defaultValue() } else { config[key] = defaultValue } } } let requireVal = function(key) { if(!confi...
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
initConfig
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
defaultVal = function(key, defaultValue) { if(!config.hasOwnProperty(key)) { if(typeof defaultValue === 'function') { config[key] = defaultValue() } else { config[key] = defaultValue } } }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
defaultVal
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
defaultVal = function(key, defaultValue) { if(!config.hasOwnProperty(key)) { if(typeof defaultValue === 'function') { config[key] = defaultValue() } else { config[key] = defaultValue } } }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
defaultVal
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
requireVal = function(key) { if(!config.hasOwnProperty(key)) { throw new Error(`Configuration must contain a property '${key}'.`) } }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
requireVal
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
requireVal = function(key) { if(!config.hasOwnProperty(key)) { throw new Error(`Configuration must contain a property '${key}'.`) } }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
requireVal
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
webFontPromise = function(webFontFamily) { return new Promise(function(resolve, reject) { let webFontConfig = { classes: false, active() { resolve() }, inactive() { reject(Error('Webfonts [' + JSON.stringify(webFontFamily) + '] could not be loaded.')) ...
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
webFontPromise
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
webFontPromise = function(webFontFamily) { return new Promise(function(resolve, reject) { let webFontConfig = { classes: false, active() { resolve() }, inactive() { reject(Error('Webfonts [' + JSON.stringify(webFontFamily) + '] could not be loaded.')) ...
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
webFontPromise
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
inactive() { reject(Error('Webfonts [' + JSON.stringify(webFontFamily) + '] could not be loaded.')) }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
inactive
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
otFontPromise = function(fontUrl) { return new Promise(function(resolve, reject) { OpenType.load(fontUrl, (err, font) => { if (err) { reject(Error('Opentype.js font ' + fontUrl + ' could not be loaded: ' + err)) } else { resolve(font) } }) }) }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
otFontPromise
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
otFontPromise = function(fontUrl) { return new Promise(function(resolve, reject) { OpenType.load(fontUrl, (err, font) => { if (err) { reject(Error('Opentype.js font ' + fontUrl + ' could not be loaded: ' + err)) } else { resolve(font) } }) }) }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
otFontPromise
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
renderEditor = function(config, renderTarget) { const editorFactory = React.createFactory(Editor) React.render( editorFactory(config), renderTarget ) }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
renderEditor
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
renderEditor = function(config, renderTarget) { const editorFactory = React.createFactory(Editor) React.render( editorFactory(config), renderTarget ) }
This is the main entry point to the Ritzy editor. See client.js for an example of how it can be used. This is basically an API wrapper around the Editor react component, which can be used directly as well.
renderEditor
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setUserName(userName) { this.updateConfig('userName', userName) }
Sets the user name of the editor's user, which will be associated with all remote cursors that represent the cursor in this editor. Updates remote cursors immediately. @apidoc Configuration @param userName The user name to set. @returns {*}
setUserName
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setFontSize(fontSize) { this.updateConfig('fontSize', fontSize) }
Sets the editor font size, and update the editor contents immediately to reflect this. @apidoc Configuration @param fontSize The font size, in pixels, to set. @returns {*}
setFontSize
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setWidth(width) { this.updateConfig('width', width) }
Sets the editor width in pixels, and update the editor immediately to reflect this. @apidoc Configuration @param width The width of the editor in pixels. This includes the internal margins. @returns {*}
setWidth
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setMargin(horizontal, vertical) { this.updateConfig('margin', { horizontal: horizontal, vertical: vertical }) }
Sets the editor internal margins, and update the editor contents immediately to reflect this. Margins provide a useful "click area" where the user can click to go to the beginning or end of a line (or first or last line) without being super-precise about the click. @apidoc Configuration @param horizontal The horizontal...
setMargin
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setMarginHorizontal(horizontal) { let margin = { horizontal: horizontal, vertical: this.config.margin.vertical } this.updateConfig('margin', margin) }
Sets the editor internal horizontal margin. @apidoc Configuration @param horizontal The horizontal (left-right) margins. @returns {*}
setMarginHorizontal
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
setMarginVertical(vertical) { let margin = { horizontal: this.config.margin.horizontal, vertical: vertical } this.updateConfig('margin', margin) }
Sets the editor internal vertical margin. @apidoc Configuration @param vertical The vertical (top-bottom) margins. @returns {*}
setMarginVertical
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getContents() { return EditorStore.getContents() }
Returns the contents of the editor as an array of Char objects. The Char object is from the underlying CRDT data store. @apidoc Contents @returns Array[Char]
getContents
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getContentsRich() { return EditorStore.getContentsRich() }
Returns the contents of the editor in a rich text JSON format representing the rich text chunks and the associated attributes. @apidoc Contents @returns {*}
getContentsRich
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getContentsHtml() { return EditorStore.getContentsHtml() }
Returns the contents of the editor as HTML. @apidoc Contents @returns {*}
getContentsHtml
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getContentsText() { return EditorStore.getContentsText() }
Returns the contents of the editor as plain text. @apidoc Contents @returns {*}
getContentsText
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getSelection() { return EditorStore.getSelection() }
Returns the contents of the current selection as an array of Char objects. The Char object is from the underlying CRDT data store. Returns the contents of the current selection in the underlying CRDT data storage format. @apidoc Selection @returns Array[Char]
getSelection
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getSelectionRich() { return EditorStore.getSelectionRich() }
Returns the contents of the current selection in a rich text JSON format representing the rich text chunks and the associated attributes. @apidoc Selection @returns {*}
getSelectionRich
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getSelectionHtml() { return EditorStore.getSelectionHtml() }
Returns the contents of the current selection as HTML. @apidoc Selection @returns {*}
getSelectionHtml
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getSelectionText() { return EditorStore.getSelectionText() }
Returns the contents of the current selection as plain text. @apidoc Selection @returns {*}
getSelectionText
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getPosition() { return EditorStore.getPosition() }
Returns the current position of the local cursor. The position is a character at which the cursor is placed (the point just after the character), and an eolStart attribute. The eolStart attribute is when the position is at the character at the end of a line (will generally be space if it is a soft break, and a newline ...
getPosition
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getRemoteCursors() { return EditorStore.getRemoteCursors() }
Gets all remote cursors currently active in the document. Each remote cursor has attributes such as name ('name'), the last update time ('ms'), and the remote position of the cursor. @apidoc Cursors @returns Array[{*}]
getRemoteCursors
javascript
ritzyed/ritzy
src/ritzy.js
https://github.com/ritzyed/ritzy/blob/master/src/ritzy.js
Apache-2.0
getDefaultProps() { return { renderOptimizations: true } }
A React component to obtain TextInput from the user and insert it into the editor. We capture shortcuts via Mousetrap.js bindings. All other characters bypass Mousetrap and are inserted by the browser into the focused hidden text input area (so the browser's internal machinery deals with the key capture and translation...
getDefaultProps
javascript
ritzyed/ritzy
src/components/TextInput.js
https://github.com/ritzyed/ritzy/blob/master/src/components/TextInput.js
Apache-2.0
componentDidMount() { this.input = React.findDOMNode(this.refs.input) this.hiddenContainer = React.findDOMNode(this.refs.hiddenContainer) this.ieClipboardDiv = React.findDOMNode(this.refs.ieClipboardDiv) // for HTML paste support in IE -- ignored by Chrome/Firefox this.input.addEventListener('befor...
A React component to obtain TextInput from the user and insert it into the editor. We capture shortcuts via Mousetrap.js bindings. All other characters bypass Mousetrap and are inserted by the browser into the focused hidden text input area (so the browser's internal machinery deals with the key capture and translation...
componentDidMount
javascript
ritzyed/ritzy
src/components/TextInput.js
https://github.com/ritzyed/ritzy/blob/master/src/components/TextInput.js
Apache-2.0
shouldComponentUpdate(nextProps) { if(!nextProps.renderOptimizations) { return true } return this.props.focused !== nextProps.focused || this.props.coordinates.x !== nextProps.coordinates.x || this.props.coordinates.y !== nextProps.coordinates.y }
A React component to obtain TextInput from the user and insert it into the editor. We capture shortcuts via Mousetrap.js bindings. All other characters bypass Mousetrap and are inserted by the browser into the focused hidden text input area (so the browser's internal machinery deals with the key capture and translation...
shouldComponentUpdate
javascript
ritzyed/ritzy
src/components/TextInput.js
https://github.com/ritzyed/ritzy/blob/master/src/components/TextInput.js
Apache-2.0
componentDidUpdate() { if(this.props.focused) { this._focus() } }
A React component to obtain TextInput from the user and insert it into the editor. We capture shortcuts via Mousetrap.js bindings. All other characters bypass Mousetrap and are inserted by the browser into the focused hidden text input area (so the browser's internal machinery deals with the key capture and translation...
componentDidUpdate
javascript
ritzyed/ritzy
src/components/TextInput.js
https://github.com/ritzyed/ritzy/blob/master/src/components/TextInput.js
Apache-2.0