_id stringlengths 2 6 | title stringlengths 0 58 | partition stringclasses 3
values | text stringlengths 27 233k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q8900 | compareDaySegments | train | function compareDaySegments(a, b) {
return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first
b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)
a.event.start - b.event.start || | javascript | {
"resource": ""
} |
q8901 | composer | train | function composer(componentMap) {
return buildTemplateData;
/**
* Accepts a Hapi request object (containing Windshield config information) and
* resolves everything Hapi/Vision needs to render an HTML page.
*
* @callback {buildTemplateData}
* @param {Request} request - Hapi request ob... | javascript | {
"resource": ""
} |
q8902 | renderComponentSchema | train | async function renderComponentSchema(definitionMap, renderComponent) {
/**
* Renders a single Windshield component definition into a rendered
* component object
*
* @param {string} definitionGroupName - Name of the association that contains the component
* @param {ComponentDefinition} defin... | javascript | {
"resource": ""
} |
q8903 | renderOneComponent | train | async function renderOneComponent(definitionGroupName, definition) {
const childDefinitionMap = definition.associations;
// replacing child definitions with rendered child components
definition.associations = await renderAssociationMap(childDefinitionMap);
| javascript | {
"resource": ""
} |
q8904 | renderComponentFromArray | train | async function renderComponentFromArray(definitionGroupName, definitionGroup) {
const promises = definitionGroup.map((definintion) => renderOneComponent(definitionGroupName, definintion));
const renderedComponents = await Promise.all(promises);
const markup = [];
const exported = {};
... | javascript | {
"resource": ""
} |
q8905 | renderAssociationMap | train | async function renderAssociationMap(definitionMap) {
if (!definitionMap) {
return {};
}
const definitionEntries = Object.entries(definitionMap);
const promises = definitionEntries.map(([groupName, definitionGroup]) => {
return renderComponentFromArray(groupName, ... | javascript | {
"resource": ""
} |
q8906 | fileIterator | train | function fileIterator(paths, options, callback) {
var filePacks = [];
if (typeof options === 'function') {
callback = options;
options = {};
}
if (typeof paths === 'string') {
paths = [paths];
} else if (paths instanceof Array) {
paths = [].concat(paths);
} else ... | javascript | {
"resource": ""
} |
q8907 | getInfo | train | function getInfo(hash) {
const info = getHashInfo(hash);
const algo = getAlgorithmFromId(info.id); | javascript | {
"resource": ""
} |
q8908 | needsRehash | train | function needsRehash(hash, algo, options) {
const info = getInfo(hash);
if (info.algorithm !== (algo || DEFAULT_ALGO)) {
return true;
}
const algoNeedsRehash = getAlgorithmFromId(info.id).needsRehash;
const result = algoNeedsRehash && algoNeedsRehash(hash, info);
if (typeof result === "boolean") {
... | javascript | {
"resource": ""
} |
q8909 | train | function (targetIDs, pickerID) {
function matches(id) {
if (id instanceof RegExp) {
return id.test(pickerID);
}
return id === pickerID;
}
if | javascript | {
"resource": ""
} | |
q8910 | train | function (config) {
Filter.call(this);
config = config || {};
this.regex = config.regex || '';
if (utils.isString(this.regex)) {
this.regex = new RegExp(this.regex);
}
| javascript | {
"resource": ""
} | |
q8911 | _concat | train | function _concat(buffOne, buffTwo) {
if (!buffOne) return buffTwo;
if (!buffTwo) return buffOne;
let newLength = buffOne.length | javascript | {
"resource": ""
} |
q8912 | train | function () {
var pkg = require(process.cwd() + '/package.json');
var licenses = [];
pkg.licenses.forEach(function (license) {
licenses.push(license.type);
});
return '/*! ' + pkg.name + ' - v' + pkg.version + ' - ' + gutil.date("yyyy-mm-dd") + "\n" +
| javascript | {
"resource": ""
} | |
q8913 | train | function(commands, resetCommands) {
// resetCommands defaults to true
if (resetCommands === undefined) {
resetCommands = true;
} else {
resetCommands = !!resetCommands;
}
// Abort previous instances of recognition already running
if (recognition && recognition.abort... | javascript | {
"resource": ""
} | |
q8914 | train | function(options) {
initIfNeeded();
options = options || {};
if (options.autoRestart !== undefined) {
| javascript | {
"resource": ""
} | |
q8915 | train | function(commandsToRemove) {
if (commandsToRemove === undefined) {
commandsList = [];
return;
}
commandsToRemove = Array.isArray(commandsToRemove) ? commandsToRemove : [commandsToRemove];
commandsList = commandsList.filter(function(command) {
| javascript | {
"resource": ""
} | |
q8916 | start | train | function start(config) {
if (!isConfigurationParametersDefinedCorrectly(config)) {
throw new Error('license-check - Configuration error');
}
var folders = [];
if (config.src) {
folders = getFoldersToCheck(config.src);
}
if (folders.length === 0) {
gutil.log('license-check', gutil.colors.red('{src... | javascript | {
"resource": ""
} |
q8917 | getFoldersToCheck | train | function getFoldersToCheck(src) {
var folders = [];
src.forEach(function (entry) {
if (entry.charAt(0) === '!') {
folders.push(path.join('!' + mainFolder, entry.substring(1, entry.length)));
} else {
if (entry.charAt(0) === '/') | javascript | {
"resource": ""
} |
q8918 | isConfigurationParametersDefinedCorrectly | train | function isConfigurationParametersDefinedCorrectly(config) {
if (!config) {
gutil.log('license-check', gutil.colors.red('Config must be defined to run the plugin'));
return false;
}
if (!config.path) { | javascript | {
"resource": ""
} |
q8919 | train | function (obj) {
this.obj = obj;
/**
* Check if the wrapped object is defined
* @returns true if the wrapped object is defined, false otherwise
*/
this.isPresent = function () {
return angular.isDefined(this.obj) && this.obj !== null;
};
... | javascript | {
"resource": ""
} | |
q8920 | train | function (options) {
return {
options: options,
render: function ($scope, $elem) {
var _this = this, expression = $elem.find('tbody').html(),
// Find the resources from the comment <!-- ngRepeat: item in items --> displayed by angular in the DOM
// Thi... | javascript | {
"resource": ""
} | |
q8921 | train | function (options) {
var oTable;
var _render = function (options, $elem, data, $scope) {
options.aaData = data;
// Add $timeout to be sure that angular has finished rendering before calling datatables
$timeout(function () {
_hideLoading($elem);
// Se... | javascript | {
"resource": ""
} | |
q8922 | train | function (options) {
var oTable;
var _render = function (options, $elem, $scope) {
// Set it to true in order to be able to redraw the dataTable
options.bDestroy = true;
// Add $timeout to be sure that angular has finished rendering before calling datatables
$time... | javascript | {
"resource": ""
} | |
q8923 | removeSubdomains | train | function removeSubdomains(hostname) {
const hostnameParts = hostname.split('.');
// A hostname with less than three parts is as short as it will get.
if (hostnameParts.length < 2) {
return hostname;
}
// Try to find a match in the list of ccTLDs.
const ccTld = find(tldList, part => endsWith(hostname, ... | javascript | {
"resource": ""
} |
q8924 | getHostname | train | function getHostname(url, userOptions = {}) {
const defaults = {
removeSubdomains: true,
};
const options = Object.assign({}, defaults, userOptions);
const domainRegExp = /^(?:[a-z]+:\/\/)?(?:[^/@]+@)?([^/:]+)/i;
const ipAddressRegExp = /^\d{1,3}\.\d{1,3}.\d{1,3}\.\d{1,3}$/;
const domainMatch = url.matc... | javascript | {
"resource": ""
} |
q8925 | train | function() {
var self = this;
this.$input = this.$tpl.find('input[type=hidden]:eq(0)');
this.$file = this.$tpl.find('input[type=file]:eq(0)');
this.$file.attr({'name':this.name});
this.$input.attr({'name':this.name+'-hidden'});
this.options.image.before_change = this.options.image.before_change ... | javascript | {
"resource": ""
} | |
q8926 | train | function (params) {
this.$id = 'graphic';
this.$deps = []; // Position dependency added later if relative positioning is true.
params = _.extend({
alpha: 1,
anchor: {
x: 0.5,
y: 0.5
},
relative: true,
sc... | javascript | {
"resource": ""
} | |
q8927 | train | function (config, loggerContext) {
Layout.call(this, config, loggerContext);
this.pattern = this.config.pattern ||
| javascript | {
"resource": ""
} | |
q8928 | train | function (gruntfileContent) {
var defaultGruntfilePath = path.join(__dirname, 'default-gruntfile.js');
gruntfileContent = | javascript | {
"resource": ""
} | |
q8929 | train | function(checks, callback) {
fs.lstat(options.source, function(err, stats) {
/* istanbul ignore else */
if (stats.isFile()) {
copyFile(options, callback);
} else if (stats.isDirectory()) {
copyDir(options, callback);
} else if | javascript | {
"resource": ""
} | |
q8930 | train | function(callback) {
fs.exists(options.source, function(exists) {
if(!exists) { callback(new Error('Source file | javascript | {
"resource": ""
} | |
q8931 | train | function(linkString, callback) {
fs.exists(_toFile, function (exists) {
| javascript | {
"resource": ""
} | |
q8932 | train | function(exists, linkString, callback) {
if (exists) {
return callback(null, symlink); | javascript | {
"resource": ""
} | |
q8933 | train | function(stats, callback) {
fs.readFile(file, function(err, data) {
| javascript | {
"resource": ""
} | |
q8934 | train | function(data, stats, callback) {
fs.writeFile(_toFile, data, stats, function(err) {
| javascript | {
"resource": ""
} | |
q8935 | processAuthResultForEntity | train | function processAuthResultForEntity(err, entity) {
if(stopAll) return
if(err && err.code !== ACL_ERROR_CODE) {
stopAll = true
callback(err, undefined)
} else {
if(entity) {
| javascript | {
"resource": ""
} |
q8936 | _getMatcher | train | function _getMatcher (element) {
if (_matcher) {
return _matcher;
}
if (element.matches) {
_matcher = element.matches;
return _matcher;
}
if (element.webkitMatchesSelector) {
_matcher = element.webkitMatchesSelector;
return _matcher;
}
if (element.mozMatchesSelector) {
_matcher ... | javascript | {
"resource": ""
} |
q8937 | _matchesSelector | train | function _matchesSelector (element, selector, boundElement) {
// no selector means this event was bound directly to this element
if (selector === '_root') {
return boundElement;
}
// if we have moved up to the element you bound the event to
// then we have come too far
if (element === boundElement) {
... | javascript | {
"resource": ""
} |
q8938 | _bind | train | function _bind (events, selector, callback, remove) {
// fail silently if you pass null or undefined as an alement
// in the Delegator constructor
if (!this.element) {
return;
}
if (!(events instanceof Array)) {
events = [events];
}
if (!callback && typeof (selector) === 'function') {
callba... | javascript | {
"resource": ""
} |
q8939 | JSONReporter | train | function JSONReporter(dir, config) {
this._config = config;
| javascript | {
"resource": ""
} |
q8940 | getMutationScore | train | function getMutationScore(stats) {
return {
total: (stats.all - stats.survived) / stats.all,
killed: stats.killed / stats.all,
survived: stats.survived / stats.all,
| javascript | {
"resource": ""
} |
q8941 | getResultsPerDir | train | function getResultsPerDir(results) {
/**
* Decorate the results object with the stats for each directory.
*
* @param {object} results - (part of) mutation testing results
* @returns {object} - Mutation test results decorated with stats
*/
function addDirStats(results) {
var dir... | javascript | {
"resource": ""
} |
q8942 | addDirStats | train | function addDirStats(results) {
var dirStats = {
all: 0,
killed: 0,
survived: 0,
ignored: 0,
untested: 0
};
_.forOwn(results, function(result) {
var stats = result.stats || addDirStats(result).stats;
dirStats.al... | javascript | {
"resource": ""
} |
q8943 | addMutationScores | train | function addMutationScores(results) {
_.forOwn(results, function(result) {
if(_.has(result, 'stats')) {
addMutationScores(result);
}
| javascript | {
"resource": ""
} |
q8944 | search | train | function search(platform) {
return new Promise((resolve, reject) => {
if (!platform || platform === '') reject(new Error('platform cannot be blank'));
const options = {
method: 'GET',
hostname: 'www.exploitalert.com',
path: `/api/search-exploit?name=${platform}`,
};
const req = http... | javascript | {
"resource": ""
} |
q8945 | train | function (name, loggerContext) {
/**
* Logger name
*/
this.name = name;
/**
* Reference to the logger context that created this logger
*
* The reference is used to create appenders and layouts when
* configuration is applied.
*/
this.loggerContext = loggerContext;
... | javascript | {
"resource": ""
} | |
q8946 | train | function () {
//check if we are able to execute
if (!canExecuteWrapper.call(options.context || this)) {
//dont attach any global handlers
return instantDeferred(false, null, options.context || this).promise();
}
//notify that we are running and clear any existing error message
isRunning(true);
... | javascript | {
"resource": ""
} | |
q8947 | train | function (callback) {
callbacks.fail.push(function () {
var result = callback.apply(this, arguments);
if (result) {
| javascript | {
"resource": ""
} | |
q8948 | getRegEx | train | function getRegEx(version) {
switch(version.toLowerCase())
{
case 'v1':
return /^[0-9A-F]{8}-[0-9A-F]{4}-[1][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
case 'v2':
return /^[0-9A-F]{8}-[0-9A-F]{4}-[2][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i;
case 'v3':
return /^[... | javascript | {
"resource": ""
} |
q8949 | uuid | train | function uuid(version) {
var v = (version) ? version : '';
// verify its a valid string
this.assert(
(typeof this._obj === 'string' || this._obj instanceof String),
'expected #{this} to be of type #{exp} but got #{act}',
'expected #{this} to not be of type #{exp}',
'string',
t... | javascript | {
"resource": ""
} |
q8950 | KarmaCodeSpecsMatcher | train | function KarmaCodeSpecsMatcher(serverPool, config) {
this._serverPool = serverPool;
this._config = _.merge({ karma: { waitForCoverageTime: 5 } }, config); | javascript | {
"resource": ""
} |
q8951 | processScopeVariables | train | function processScopeVariables(variableDeclaration, loopVariables) {
var identifiers = [], exclusiveCombination;
_.forEach(variableDeclaration.declarations, function(declaration) {
identifiers.push(declaration.id.name);
});
| javascript | {
"resource": ""
} |
q8952 | filterObject | train | function filterObject(gobj, filter) {
let found = true;
let obj = gobj;
// find the value we're interested in
for (let i = 0, len = filter.length; obj && typeof obj === 'object' && i < len; i++) {
if (!obj.hasOwnProperty(filter[i])) {
| javascript | {
"resource": ""
} |
q8953 | hashValue | train | function hashValue(it) {
const str = JSON.stringify(it) || '';
let hash = | javascript | {
"resource": ""
} |
q8954 | notify | train | function notify(gobj, source) {
const state = gobj.__gawk__;
if (source === undefined) {
source = gobj;
}
// if we're paused, add this object to the list of objects that may have changed
if (state.queue) {
state.queue.add(gobj);
return;
}
// notify all of this object's listeners
if (state.listeners) {
... | javascript | {
"resource": ""
} |
q8955 | copyListeners | train | function copyListeners(dest, src, compareFn) {
if (isGawked(src) && src.__gawk__.listeners) {
if (dest.__gawk__.listeners) {
for (const [ listener, filter ] of src.__gawk__.listeners) {
dest.__gawk__.listeners.set(listener, filter);
}
} else {
dest.__gawk__.listeners = new Map(src.__gawk__.listeners);... | javascript | {
"resource": ""
} |
q8956 | mix | train | function mix(objs, deep) {
const gobj = gawk(objs.shift());
if (!isGawked(gobj) || Array.isArray(gobj)) {
throw new TypeError('Expected destination to be a gawked object');
}
if (!objs.length) {
return gobj;
}
// validate the objects are good
for (const obj of objs) {
if (!obj || typeof obj !== 'object' ... | javascript | {
"resource": ""
} |
q8957 | computedBeginDependencyDetectionCallback | train | function computedBeginDependencyDetectionCallback(subscribable, id) {
var computedObservable = this.computedObservable,
state = computedObservable[computedState];
if (!state.isDisposed) {
if (this.disposalCount && this.disposalCandidates[id]) {
// Don't want to dispose this subscript... | javascript | {
"resource": ""
} |
q8958 | train | function (sKey) {
return decodeURI(document.cookie.replace(new RegExp('(?:(?:^|.*;)\\s*' + encodeURI(sKey).replace(/[\-\.\+\*]/g, | javascript | {
"resource": ""
} | |
q8959 | train | function (sKey, sPath) {
if (!sKey || !this.hasItem(sKey)) { return false; }
document.cookie | javascript | {
"resource": ""
} | |
q8960 | bindingContext | train | function bindingContext(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback, settings) {
var self = this,
isFunc = typeof(dataItemOrAccessor) == "function" && !isObservable(dataItemOrAccessor),
nodes,
subscribable;
// The binding context object includes static pr... | javascript | {
"resource": ""
} |
q8961 | updateContext | train | function updateContext() {
// Most of the time, the context will directly get a view model object, but if a function is given,
// we call the function to retrieve the view model. If the function accesses any observables or returns
// an observable, the dependency is tracked, and those obse... | javascript | {
"resource": ""
} |
q8962 | cloneIfElseNodes | train | function cloneIfElseNodes(element, hasElse) {
var children = childNodes(element),
ifNodes = [],
elseNodes = [],
target = ifNodes;
for (var i = 0, j = children.length; i < j; ++i) {
if (hasElse && isElseNode(children[i])) {
target = elseNodes;
... | javascript | {
"resource": ""
} |
q8963 | makeWithIfBinding | train | function makeWithIfBinding(isWith, isNot, isElse, makeContextCallback) {
return {
init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
var didDisplayOnLastUpdate,
hasElse = detectElse(element),
completesElseChain = observable... | javascript | {
"resource": ""
} |
q8964 | filterByUrls | train | function filterByUrls(url) {
if(_config.refererIndependentUrls) {
var isRefererIndependend = false;
for(var i in _config.refererIndependentUrls) {
if(new RegExp(_config.refererIndependentUrls[i]).test(url.split('?')[0])) {
isRefererIndependend = true;
... | javascript | {
"resource": ""
} |
q8965 | filterByMethods | train | function filterByMethods(req) {
if(_config.allowedMethods) {
return _config.allowedMethods.indexOf(req.method) > -1;
} else if(_config.blockedMethods){
| javascript | {
"resource": ""
} |
q8966 | indexOf | train | function indexOf(arr, value, start) {
start = start || 0;
if (arr == null) {
return -1;
}
var len = arr.length;
var i = start < 0 ? len + start : start;
| javascript | {
"resource": ""
} |
q8967 | every | train | function every(arr, cb, thisArg) {
cb = makeIterator(cb, thisArg);
var result = true;
if (arr == null) {
return result;
}
var len = arr.length;
var i = -1;
| javascript | {
"resource": ""
} |
q8968 | filter | train | function filter(arr, cb, thisArg) {
cb = makeIterator(cb, thisArg);
if (arr == null) {
return [];
}
var len = arr.length;
var res = [];
for (var i = 0; i < | javascript | {
"resource": ""
} |
q8969 | filterType | train | function filterType(arr, type) {
var len = arr.length;
var res = [];
for (var i = 0; i < len; i++) {
var ele = arr[i];
| javascript | {
"resource": ""
} |
q8970 | strings | train | function strings(arr, i) {
var values = filterType(arr, 'string');
| javascript | {
"resource": ""
} |
q8971 | objects | train | function objects(arr, i) {
var values = filterType(arr, 'object');
| javascript | {
"resource": ""
} |
q8972 | functions | train | function functions(arr, i) {
var values = filterType(arr, 'function');
| javascript | {
"resource": ""
} |
q8973 | arrays | train | function arrays(arr, i) {
var values = filterType(arr, 'array');
| javascript | {
"resource": ""
} |
q8974 | first | train | function first(arr, cb, thisArg) {
if (arguments.length === 1) {
return arr[0];
| javascript | {
"resource": ""
} |
q8975 | last | train | function last(arr, cb, thisArg) {
if (arguments.length === 1) {
return arr[arr.length - | javascript | {
"resource": ""
} |
q8976 | train | function (browser, url, proxyURL, pacFileURL, dataDir, bypassList) {
// Firefox pac set
// http://www.indexdata.com/connector-platform/enginedoc/proxy-auto.html
// http://kb.mozillazine.org/Network.proxy.autoconfig_url
// user_pref("network.proxy.autoconfig_url", "http://us2.indexdata.com:9005/id/cf.pac... | javascript | {
"resource": ""
} | |
q8977 | extend | train | function extend(a,b){
var c={};
for(var i in a){
if(a.hasOwnProperty(i)){
| javascript | {
"resource": ""
} |
q8978 | train | function(){
try {
this.preview.backgroundColor = this.format.call(this);
} catch(e) {
this.preview.backgroundColor = this.color.toHex();
}
//set the color for brightness/saturation slider
this.base.backgroundColor | javascript | {
"resource": ""
} | |
q8979 | train | function(unique_id, e, manual_close){
// Remove it then run the callback function
e.remove();
this['_after_close_' + unique_id](e, manual_close);
// Check if the wrapper is empty, if it is.. | javascript | {
"resource": ""
} | |
q8980 | train | function(e, unique_id, params, unbind_events){
var params = params || {},
fade = (typeof(params.fade) != 'undefined') ? params.fade : true,
fade_out_speed = params.speed || this.fade_out_speed,
manual_close = unbind_events;
this['_before_close_' + unique_id](e, manual_close);
// If this is tr... | javascript | {
"resource": ""
} | |
q8981 | train | function(unique_id, params, e, unbind_events){
if(!e){
var e = $('#gritter-item-' + unique_id);
}
// We set the fourth param to let the _fade function know to
// unbind the "mouseleave" event. | javascript | {
"resource": ""
} | |
q8982 | train | function(e, unique_id){
var timer_str = (this._custom_timer) ? this._custom_timer : this.time;
this['_int_id_' + unique_id] = | javascript | {
"resource": ""
} | |
q8983 | train | function(params){
// callbacks (if passed)
var before_close = ($.isFunction(params.before_close)) ? params.before_close : function(){};
var after_close = | javascript | {
"resource": ""
} | |
q8984 | train | function(basePath, config) {
this._basePath = basePath;
this._config = config;
var directories = IOUtils.getDirectoryList(basePath, | javascript | {
"resource": ""
} | |
q8985 | loadScript | train | function loadScript(url, callback, errorCallback, $timeout) {
var script = document.createElement('script'),
body = document.getElementsByTagName('body')[0],
removed = false;
script.type = 'text/javascript';
if (script.readyState) { // IE
script.onreadystatechange = function () {
... | javascript | {
"resource": ""
} |
q8986 | loadLocale | train | function loadLocale(localeUrl, $locale, localeId, $rootScope, $q, localeCache, $timeout) {
function overrideValues(oldObject, newObject) {
if (activeLocale !== localeId) {
return;
}
angular.forEach(oldObject, function(value, key) {
if (!newObject[key]) {
delete oldObject... | javascript | {
"resource": ""
} |
q8987 | outputFile | train | function outputFile(configId, outputdata){
var fname= configId+ '_accounts.csv';
console.log("Outputing file... "+fname);
var input= {
data: outputdata,
| javascript | {
"resource": ""
} |
q8988 | train | function (originalObj, originalProp, targetObj, targetProp) {
Object.defineProperty(
originalObj,
originalProp,
{
get: function () {
return targetObj[targetProp];
},
... | javascript | {
"resource": ""
} | |
q8989 | train | function (originalObj, originalProp, targetObj, targetProp) {
Object.defineProperty(
originalObj,
originalProp,
{
get: function () {
return targetObj[targetProp];
},
... | javascript | {
"resource": ""
} | |
q8990 | train | function (obj, prop, callback, callbackParams) {
var value = obj[prop];
Object.defineProperty(
obj,
prop,
{
get: function () {
return value;
},
... | javascript | {
"resource": ""
} | |
q8991 | train | function(error, response, body) {
var rspBody = helper.handleCB(error, response, body);
if (rspBody != null) {
var destId = config.get(program.dest).accountId;
var url = | javascript | {
"resource": ""
} | |
q8992 | readDashFromFS | train | function readDashFromFS(fname) {
var dashboardBody = fs.readFileSync(fname);
console.log('Read file:', fname);
// Set the proper account_id on all widgets
if (dashboardBody != null) {
dashboardBody = JSON.parse(dashboardBody);
console.log('Read source dashboard named: ' + dashboardBody.dashboard.title... | javascript | {
"resource": ""
} |
q8993 | train | function (done) {
glob(path.join(__dirname, "*.ejs"), function (err, files) {
if (err) {
return done(err);
}
var templates = {};
async.forEach(files, function (file, done) {
fs.readFile(file, "utf8", function (err, data) {
| javascript | {
"resource": ""
} | |
q8994 | train | function () {
this.update = {
gravity: function (entity, dt) {
// Accelerate entity until it reaches terminal velocity.
if (entity.c.velocity.yspeed < entity.c.gravity.terminal) {
| javascript | {
"resource": ""
} | |
q8995 | train | function(data) {
//initialise with a few Todos because we are very busy people
self.todoList.insert(data.data.todoList);
self.todoList2.insert(data.data.todoList);
| javascript | {
"resource": ""
} | |
q8996 | MongoDB | train | function MongoDB(host, port, database, collection, username, password){
_self = this;
if(arguments.length < 3){
throw ("MongoDB constructor requires at least three arguments!");
}
if(collection){
| javascript | {
"resource": ""
} |
q8997 | train | function(cb){
if(!_isOpen){
_self.open(function () {
_self.removeAll(function() {
getCollection(cb);
});
});
| javascript | {
"resource": ""
} | |
q8998 | hashRound | train | function hashRound(input, length, hashFunction, rounds, callback) {
if (rounds > 0 || !validatePassword(input, length)) {
process.nextTick(() => | javascript | {
"resource": ""
} |
q8999 | selectColor | train | function selectColor(namespace) {
var hash = 0,
i;
for (i in namespace) {
hash = (hash << 5) - hash + namespace.charCodeAt(i);
hash |= 0; // Convert to 32bit | javascript | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.