Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Refresh the max height set on the element. This may be useful if resizing the window and the content height changes.
function refresh() { element.style.maxHeight = element.scrollHeight + 'px'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_updateHeight () {\n const height = document.body.scrollHeight\n if (height === this._lastHeight) {\n return\n }\n \n this._lastHeight = height\n this._sendMessage('height', { height: height })\n }", "function setHeight() {\n $('.voyage').css('height',...
[ "0.7306204", "0.71844196", "0.7093979", "0.69578004", "0.68034196", "0.67750686", "0.6749046", "0.668914", "0.6688762", "0.6638899", "0.66354924", "0.66154706", "0.6495037", "0.64909416", "0.647521", "0.6473164", "0.6432447", "0.64289296", "0.64289296", "0.64289296", "0.64056...
0.79652953
0
Pick the first defined of two or three arguments. dfl comes from default.
function dfl(a, b, c) { switch (arguments.length) { case 2: return a != null ? a : b; case 3: return a != null ? a : b != null ? b : c; default: throw new Error('Implement me'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dfl(a, b, c) {\n\t\tswitch (arguments.length) {\n\t\t\tcase 2:\n\t\t\t\treturn a != null ? a : b;\n\t\t\tcase 3:\n\t\t\t\treturn a != null ? a : b != null ? b : c;\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Implement me');\n\t\t}\n\t}", "function dfl(a, b, c) {\n\t switch (arguments.length) {\n\t ...
[ "0.70769256", "0.7032066", "0.69990873", "0.6994567", "0.6947289", "0.6947289", "0.6947289", "0.6729991", "0.6694637", "0.6657053", "0.6616081", "0.65729797", "0.6436335", "0.6371848", "0.6368675", "0.6322258", "0.62222874", "0.6210064", "0.6180764", "0.61663306", "0.6148511"...
0.69394195
23
left zero fill a number see for performance comparison
function leftZeroFill(number, targetLength, forceSign) { var output = '' + Math.abs(number), sign = number >= 0; while (output.length < targetLength) { output = '0' + output; } return (sign ? (forceSign ? '+' : '') : '-') + output; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zeroFill(number) {\n\treturn (number < 10 ? ('0' + number) : number.toString());\n}", "function leftZeroFill(number, targetLength, forceSign) {\n var output = '' + Math.abs(number),\n sign = number >= 0;\n \n while (output.length < targetLength) {\n output = ...
[ "0.74372625", "0.7363078", "0.7321577", "0.7318851", "0.72658306", "0.725381", "0.72353715", "0.7233668", "0.7227976", "0.7224416", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", "0.7219083", ...
0.7176291
52
TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) { return function (val, period) { var dur, tmp; //invert the arguments, but complain about it if (period !== null && !isNaN(+period)) { deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).'); tmp = val; val = period; period = tmp; } val = typeof val === 'string' ? +val : val; dur = moment.duration(val, period); addOrSubtractDurationFromMoment(this, dur, direction); return this; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setName(name) { }", "constructor(name) {\n super(name);\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "constructor(name) {\n this.name = name;\n }", "construct...
[ "0.67782986", "0.6759405", "0.67381084", "0.67381084", "0.67381084", "0.67381084", "0.6733258", "0.6733258", "0.67120683", "0.66484624", "0.6612438", "0.6540716", "0.65202653", "0.65195", "0.6489472", "0.6465985", "0.6462259", "0.6415414", "0.6381141", "0.6297654", "0.6276111...
0.0
-1
check if is an array
function isArray(input) { return Object.prototype.toString.call(input) === '[object Array]'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_array(input) {\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return true;\n }\n return false;\n}", "function isArray(input) {\n return Object.prototype.toString.call(input) === '[object Array]';\n }", "function isArray(arr) {\n\t\treturn Object.prototyp...
[ "0.82666445", "0.7871224", "0.7838033", "0.783727", "0.78280234", "0.78280234", "0.7826276", "0.7820225", "0.7797053", "0.7787967", "0.7781514", "0.77701086", "0.77701086", "0.7746139", "0.7726031", "0.77094805", "0.7692416", "0.76890206", "0.76872563", "0.7686692", "0.768669...
0.7681993
64
compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays(array1, array2) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (~~array1[i] !== ~~array2[i]) {\n diffs+...
[ "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.82791424", "0.79984933", "0.79866725", "0.79537725", "0.7922521", "0.77097225", "0.75572866", "0.75463253", "0.75318825", "0.7503132", ...
0.0
-1
pick the locale from the array try ['enau', 'engb'] as 'enau', 'engb', 'en', as in move through the list trying each substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) { var i = 0, j, next, locale, split; while (i < names.length) { split = normalizeLocale(names[i]).split('-'); j = split.length; next = normalizeLocale(names[i + 1]); next = next ? next.split('-') : null; while (j > 0) { locale = loadLocale(split.slice(0, j).join('-')); if (locale) { return locale; } if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { //the next array item is better than a shallower substring of this one break; } j--; } i++; } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function chooseLocale(names) {\n var i = 0, j, next, locale, split;\n \n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : nu...
[ "0.70799595", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124", "0.70755124"...
0.0
-1
Return a moment from input, that is local/utc/utcOffset equivalent to model.
function makeAs(input, model) { var res, diff; if (model._isUTC) { res = model.clone(); diff = (moment.isMoment(input) || isDate(input) ? +input : +moment(input)) - (+res); // Use low-level api, because this fn is low-level api. res._d.setTime(+res._d + diff); moment.updateOffset(res, false); return res; } else { return moment(input).local(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeAs(input, model) {\n\t return model._isUTC ? moment(input).zone(model._offset || 0) :\n\t moment(input).local();\n\t }", "function makeAs(input, model) {\n return model._isUTC ? moment(input).zone(model._offset || 0) :\n moment(input).local();\n }", "funct...
[ "0.84117454", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.8377755", "0.78674024", "0.7862978", "0.7836228", ...
0.7805456
34
format date using native date object
function formatMoment(m, format) { if (!m.isValid()) { return m.localeData().invalidDate(); } format = expandFormat(format, m.localeData()); if (!formatFunctions[format]) { formatFunctions[format] = makeFormatFunction(format); } return formatFunctions[format](m); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "formatDate(date) {\n\t\treturn date.toString()\n\t\t.replace(/(\\d{4})(\\d{2})(\\d{2})/, (string, year, month, day) => `${year}-${month}-${day}`);\n\t}", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toI...
[ "0.75340456", "0.74220204", "0.73882395", "0.73852545", "0.7351628", "0.73369396", "0.7306578", "0.73013055", "0.72933567", "0.72933567", "0.72933567", "0.72215754", "0.72151476", "0.7212694", "0.71899515", "0.71846557", "0.7180238", "0.7170007", "0.716869", "0.715949", "0.71...
0.0
-1
Parsing get the regex to find the next token
function getParseRegexForToken(token, config) { var a, strict = config._strict; switch (token) { case 'Q': return parseTokenOneDigit; case 'DDDD': return parseTokenThreeDigits; case 'YYYY': case 'GGGG': case 'gggg': return strict ? parseTokenFourDigits : parseTokenOneToFourDigits; case 'Y': case 'G': case 'g': return parseTokenSignedNumber; case 'YYYYYY': case 'YYYYY': case 'GGGGG': case 'ggggg': return strict ? parseTokenSixDigits : parseTokenOneToSixDigits; case 'S': if (strict) { return parseTokenOneDigit; } /* falls through */ case 'SS': if (strict) { return parseTokenTwoDigits; } /* falls through */ case 'SSS': if (strict) { return parseTokenThreeDigits; } /* falls through */ case 'DDD': return parseTokenOneToThreeDigits; case 'MMM': case 'MMMM': case 'dd': case 'ddd': case 'dddd': return parseTokenWord; case 'a': case 'A': return config._locale._meridiemParse; case 'x': return parseTokenOffsetMs; case 'X': return parseTokenTimestampMs; case 'Z': case 'ZZ': return parseTokenTimezone; case 'T': return parseTokenT; case 'SSSS': return parseTokenDigits; case 'MM': case 'DD': case 'YY': case 'GG': case 'gg': case 'HH': case 'hh': case 'mm': case 'ss': case 'ww': case 'WW': return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits; case 'M': case 'D': case 'd': case 'H': case 'h': case 'm': case 's': case 'w': case 'W': case 'e': case 'E': return parseTokenOneOrTwoDigits; case 'Do': return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient; default : a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i')); return a; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "regexToken() {\r\n\t\t\t\tvar body, closed, comment, commentIndex, commentOpts, commentTokens, comments, delimiter, end, flags, fullMatch, index, leadingWhitespace, match, matchedComment, origin, prev, ref, ref1, regex, tokens;\r\n\t\t\t\tswitch (false) {\r\n\t\t\t\t\tcase !(match = REGEX_ILLEGAL.exec(this.chunk))...
[ "0.7055736", "0.67469317", "0.6541603", "0.64485", "0.6360168", "0.6360168", "0.63472235", "0.633795", "0.633795", "0.633795", "0.633795", "0.633795", "0.63212526", "0.629326", "0.629326", "0.629326", "0.629326", "0.62760067", "0.6274375", "0.6274375", "0.6274375", "0.62743...
0.610754
55
function to convert string input to date
function addTimeToArrayFromToken(token, input, config) { var a, datePartArray = config._a; switch (token) { // QUARTER case 'Q': if (input != null) { datePartArray[MONTH] = (toInt(input) - 1) * 3; } break; // MONTH case 'M' : // fall through to MM case 'MM' : if (input != null) { datePartArray[MONTH] = toInt(input) - 1; } break; case 'MMM' : // fall through to MMMM case 'MMMM' : a = config._locale.monthsParse(input, token, config._strict); // if we didn't find a month name, mark the date as invalid. if (a != null) { datePartArray[MONTH] = a; } else { config._pf.invalidMonth = input; } break; // DAY OF MONTH case 'D' : // fall through to DD case 'DD' : if (input != null) { datePartArray[DATE] = toInt(input); } break; case 'Do' : if (input != null) { datePartArray[DATE] = toInt(parseInt( input.match(/\d{1,2}/)[0], 10)); } break; // DAY OF YEAR case 'DDD' : // fall through to DDDD case 'DDDD' : if (input != null) { config._dayOfYear = toInt(input); } break; // YEAR case 'YY' : datePartArray[YEAR] = moment.parseTwoDigitYear(input); break; case 'YYYY' : case 'YYYYY' : case 'YYYYYY' : datePartArray[YEAR] = toInt(input); break; // AM / PM case 'a' : // fall through to A case 'A' : config._meridiem = input; // config._isPm = config._locale.isPM(input); break; // HOUR case 'h' : // fall through to hh case 'hh' : config._pf.bigHour = true; /* falls through */ case 'H' : // fall through to HH case 'HH' : datePartArray[HOUR] = toInt(input); break; // MINUTE case 'm' : // fall through to mm case 'mm' : datePartArray[MINUTE] = toInt(input); break; // SECOND case 's' : // fall through to ss case 'ss' : datePartArray[SECOND] = toInt(input); break; // MILLISECOND case 'S' : case 'SS' : case 'SSS' : case 'SSSS' : datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); break; // UNIX OFFSET (MILLISECONDS) case 'x': config._d = new Date(toInt(input)); break; // UNIX TIMESTAMP WITH MS case 'X': config._d = new Date(parseFloat(input) * 1000); break; // TIMEZONE case 'Z' : // fall through to ZZ case 'ZZ' : config._useUTC = true; config._tzm = utcOffsetFromString(input); break; // WEEKDAY - human case 'dd': case 'ddd': case 'dddd': a = config._locale.weekdaysParse(input); // if we didn't get a weekday name, mark the date as invalid if (a != null) { config._w = config._w || {}; config._w['d'] = a; } else { config._pf.invalidWeekday = input; } break; // WEEK, WEEK DAY - numeric case 'w': case 'ww': case 'W': case 'WW': case 'd': case 'e': case 'E': token = token.substr(0, 1); /* falls through */ case 'gggg': case 'GGGG': case 'GGGGG': token = token.substr(0, 2); if (input) { config._w = config._w || {}; config._w[token] = toInt(input); } break; case 'gg': case 'GG': config._w = config._w || {}; config._w[token] = moment.parseTwoDigitYear(input); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function convert_date(str){var tmp=str.split(\".\");return new Date(tmp[1]+\"/\"+tmp[0]+\"/\"+tmp[2])}", "function str2date(str) {\n\t\t\ttry {\n\t\t\t\tvar t = (str).split(/[- :]/);\n\t\t\t\treturn new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);\n\t\t\t} catch (err) {\n\t\t\t\talert(err);\n\t\t\t}\n\t\t}", "f...
[ "0.7793216", "0.74285257", "0.74285257", "0.7397207", "0.7374092", "0.73516434", "0.7351205", "0.727034", "0.72603965", "0.72467196", "0.7218412", "0.7181419", "0.71357113", "0.7127271", "0.71241677", "0.707636", "0.70552653", "0.7039943", "0.7037264", "0.70272136", "0.699619...
0.0
-1
convert an array to a date. the array should mirror the parameters below note: all values past the year are optional and will default to the lowest possible value. [year, month, day , hour, minute, second, millisecond]
function dateFromConfig(config) { var i, date, input = [], currentDate, yearToUse; if (config._d) { return; } currentDate = currentDateArray(config); //compute day of the year from weeks and weekdays if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { dayOfYearFromWeekInfo(config); } //if the day of the year is set, figure out what it is if (config._dayOfYear) { yearToUse = dfl(config._a[YEAR], currentDate[YEAR]); if (config._dayOfYear > daysInYear(yearToUse)) { config._pf._overflowDayOfYear = true; } date = makeUTCDate(yearToUse, 0, config._dayOfYear); config._a[MONTH] = date.getUTCMonth(); config._a[DATE] = date.getUTCDate(); } // Default to current date. // * if no year, month, day of month are given, default to today // * if day of month is given, default month and year // * if month is given, default only year // * if year is given, don't default anything for (i = 0; i < 3 && config._a[i] == null; ++i) { config._a[i] = input[i] = currentDate[i]; } // Zero out whatever was not defaulted, including time for (; i < 7; i++) { config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; } // Check for 24:00:00.000 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { config._nextDay = true; config._a[HOUR] = 0; } config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); // Apply timezone offset from input. The actual utcOffset can be changed // with parseZone. if (config._tzm != null) { config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); } if (config._nextDay) { config._a[HOUR] = 24; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, input[6] || 0);\n }", "function dateFromArray(input) {\n return new Date(input[0], input[1] || 0, input[2] || 1, input[3] || 0, input[4] || 0, input[5] || 0, inp...
[ "0.70560163", "0.70560163", "0.69689643", "0.68486726", "0.66355705", "0.6459506", "0.613033", "0.6126304", "0.6068413", "0.6014399", "0.6014399", "0.6014399", "0.6014399", "0.6014399", "0.5960855", "0.5960855", "0.5960855", "0.5900044", "0.5884953", "0.5875542", "0.58688384"...
0.0
-1
date from string and format string
function makeDateFromStringAndFormat(config) { if (config._f === moment.ISO_8601) { parseISO(config); return; } config._a = []; config._pf.empty = true; // This array is used to make a Date, either with `new Date` or `Date.UTC` var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; for (i = 0; i < tokens.length; i++) { token = tokens[i]; parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; if (parsedInput) { skipped = string.substr(0, string.indexOf(parsedInput)); if (skipped.length > 0) { config._pf.unusedInput.push(skipped); } string = string.slice(string.indexOf(parsedInput) + parsedInput.length); totalParsedInputLength += parsedInput.length; } // don't parse if it's not a known token if (formatTokenFunctions[token]) { if (parsedInput) { config._pf.empty = false; } else { config._pf.unusedTokens.push(token); } addTimeToArrayFromToken(token, parsedInput, config); } else if (config._strict && !parsedInput) { config._pf.unusedTokens.push(token); } } // add remaining unparsed input length to the string config._pf.charsLeftOver = stringLength - totalParsedInputLength; if (string.length > 0) { config._pf.unusedInput.push(string); } // clear _12h flag if hour is <= 12 if (config._pf.bigHour === true && config._a[HOUR] <= 12) { config._pf.bigHour = undefined; } // handle meridiem config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); dateFromConfig(config); checkOverflow(config); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndFormat(string, format) {\n var datePartArray = [0, 0, 1, 0, 0, 0, 0],\n config = {\n tzh : 0, // timezone hour offset\n tzm : 0 // timezone minute offset\n },\n tokens = format.match(formattingTokens),\n ...
[ "0.75422543", "0.73773617", "0.7180261", "0.7180261", "0.7180261", "0.7180261", "0.7167225", "0.71664", "0.71664", "0.71664", "0.71664", "0.71664", "0.7152761", "0.7148616", "0.7148616", "0.7148616", "0.70915365", "0.7087678", "0.7032007", "0.7032007", "0.70194393", "0.7019...
0.66543823
100
date from string and array of format strings
function makeDateFromStringAndArray(config) { var tempConfig, bestMoment, scoreToBeat, i, currentScore; if (config._f.length === 0) { config._pf.invalidFormat = true; config._d = new Date(NaN); return; } for (i = 0; i < config._f.length; i++) { currentScore = 0; tempConfig = copyConfig({}, config); if (config._useUTC != null) { tempConfig._useUTC = config._useUTC; } tempConfig._pf = defaultParsingFlags(); tempConfig._f = config._f[i]; makeDateFromStringAndFormat(tempConfig); if (!isValid(tempConfig)) { continue; } // if there is any input that was not parsed add a penalty for that format currentScore += tempConfig._pf.charsLeftOver; //or tokens currentScore += tempConfig._pf.unusedTokens.length * 10; tempConfig._pf.score = currentScore; if (scoreToBeat == null || currentScore < scoreToBeat) { scoreToBeat = currentScore; bestMoment = tempConfig; } } extend(config, bestMoment || tempConfig); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeDateFromStringAndArray(string, formats) {\n var output,\n inputParts = string.match(parseMultipleFormatChunker) || [],\n formattedInputParts,\n scoreToBeat = 99,\n i,\n currentDate,\n currentScore;\n for (i = 0; i < format...
[ "0.6992324", "0.6912437", "0.6811143", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67375225", "0.67109895", "0.67109895", "0.67109895", "0.66975677", "0.65970886", "0.65863997", "0.65863997", "0.65736145", "0.65736145", "0.65736145", "0.65736145", "0.65736145", ...
0.6364184
73
date from iso format
function parseISO(config) { var i, l, string = config._i, match = isoRegex.exec(string); if (match) { config._pf.iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(string)) { // match[5] should be 'T' or undefined config._f = isoDates[i][0] + (match[6] || ' '); break; } } for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(string)) { config._f += isoTimes[i][0]; break; } } if (string.match(parseTokenTimezone)) { config._f += 'Z'; } makeDateFromStringAndFormat(config); } else { config._isValid = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoDate(date)\n{\n\treturn date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate()\n}", "function dateFromISO8601(isostr) {\n var parts = isostr.match(/\\d+/g);\n var date = new Date(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]);\n var mm = date...
[ "0.7161587", "0.7084152", "0.69561076", "0.68181574", "0.66757625", "0.66372114", "0.6559707", "0.6525335", "0.6466161", "0.6465599", "0.644205", "0.64171946", "0.6406543", "0.6406543", "0.6406543", "0.6406543", "0.63656497", "0.63241196", "0.6322188", "0.62742394", "0.626350...
0.0
-1
date from iso format or fallback
function makeDateFromString(config) { parseISO(config); if (config._isValid === false) { delete config._isValid; moment.createFromInputFallback(config); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isoToDate(s) {\n if (s instanceof Date) { return s; }\n if (typeof s === 'string') { return new Date(s); }\n}", "function isoStringToDate(match){var date=new Date(0);var tzHour=0;var tzMin=0;// match[8] means that the string contains \"Z\" (UTC) or a timezone like \"+01:00\" or \"+0100\"\nvar dateSett...
[ "0.69151974", "0.66991687", "0.6643978", "0.65537083", "0.65537083", "0.6520427", "0.6492825", "0.64871174", "0.6448661", "0.64316744", "0.64316744", "0.64103484", "0.64103484", "0.6407205", "0.63858414", "0.6371779", "0.63675845", "0.63675845", "0.63675845", "0.63675845", "0...
0.64045346
34
Relative Time helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateRelativeDate() {\n let dateTimeElements = document.querySelectorAll('time.mm-relative-time');\n for (let i = 0, len = dateTimeElements.length; i < len; i++) {\n let skipSuffix = !['true', 'yes', 'y', '1'].includes(\n (dateTimeElements[i].dataset.mmSuffix || '')\n ...
[ "0.71941125", "0.7127394", "0.6900822", "0.6655317", "0.6595474", "0.6592507", "0.6548907", "0.6513634", "0.6513634", "0.6513634", "0.6513634", "0.64771926", "0.6451322", "0.64374864", "0.63676035", "0.6341692", "0.6341692", "0.6341692", "0.63083524", "0.62938464", "0.6293726...
0.0
-1
Week of Year firstDayOfWeek 0 = sun, 6 = sat the day of the week that starts the week (usually sunday or monday) firstDayOfWeekOfYear 0 = sun, 6 = sat the first week is the week that contains the first of this day of the week (eg. ISO weeks use thursday (4))
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) { var end = firstDayOfWeekOfYear - firstDayOfWeek, daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(), adjustedMoment; if (daysToDayOfWeek > end) { daysToDayOfWeek -= 7; } if (daysToDayOfWeek < end - 7) { daysToDayOfWeek += 7; } adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd'); return { week: Math.ceil(adjustedMoment.dayOfYear() / 7), year: adjustedMoment.year() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {\n var end = firstDayOfWeekOfYear - firstDayOfWeek,\n daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),\n adjustedMoment;\n\n\n if (daysToDayOfWeek > end) {\n daysToDayOfWeek -= 7;\n ...
[ "0.73554915", "0.72726876", "0.72572744", "0.72572744", "0.724771", "0.7211845", "0.7211845", "0.7211845", "0.7211845", "0.7211845", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0.72104126", "0....
0.70435184
60
Pick a moment m from moments so that m[fn](other) is true for all other. This relies on the function fn to be transitive. moments should either be an array of moment objects or an array, whose first element is an array of moment objects.
function pickBy(fn, moments) { var res, i; if (moments.length === 1 && isArray(moments[0])) { moments = moments[0]; } if (!moments.length) { return moment(); } res = moments[0]; for (i = 1; i < moments.length; ++i) { if (moments[i][fn](res)) { res = moments[i]; } } return res; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return moment();\n }\n res = moments[0];\n for (i = 1; i < moments.length...
[ "0.7575425", "0.75515914", "0.7439568", "0.7439568", "0.7294593", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", "0.7290889", ...
0.7611043
22
Fix Subtitles Octopus to work with embedded YouTube videos TODO: Fix subtitles position in fullscreen mode
function subResize(event) { var e_sub = subtitles.canvas; var e_vid = player.elements.wrapper; e_sub.style.display = "block"; e_sub.style.top = 0; e_sub.style.position = "absolute"; e_sub.style.pointerEvents = "none"; e_sub.width = e_vid.clientWidth * 2; e_sub.height = e_vid.clientHeight * 2; e_sub.style.transform = "scale(0.5, 0.5) translate(-50%, -50%)"; subtitles.resize(e_sub.width, e_sub.height); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySubtitles_sync(current_time){\n if (current_subtitle == null){\n subtitles_textbox[0].innerHTML = \"&nbsp;\";\n subtitles_textbox[1].innerHTML = \"&nbsp;\";\n subtitles_textbox[2].innerHTML = \"&nbsp;\";\n subtitles_textbox[3].innerHTML = \"&nbsp;\";\n subtitles_textbox[4].innerHTML...
[ "0.6343375", "0.62633234", "0.62324286", "0.6225659", "0.6173732", "0.6172417", "0.6156412", "0.6145753", "0.60456", "0.5974248", "0.59478223", "0.59293264", "0.58953816", "0.5854956", "0.5776911", "0.57645357", "0.5731814", "0.56288713", "0.56268555", "0.5614632", "0.561342"...
0.65505075
0
Workaround for starting video from saved position
function playpause(event) { player.play(); player.pause(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fastForwardVideo() {\n var fastForward = player.getCurrentTime();\n var add15Seconds = fastForward + 15;\n player.seekTo(add15Seconds);\n }", "function seek_video()\n {\n if (!(current in timecodes)) return;\n if (!video_elt.contentWindow) video_elt.currentTime = timec...
[ "0.6503766", "0.6483735", "0.6471824", "0.6385103", "0.63710624", "0.63526016", "0.6326265", "0.62359095", "0.6208896", "0.6198976", "0.6184221", "0.61513513", "0.613991", "0.6128529", "0.6114358", "0.610286", "0.6063831", "0.60608584", "0.6037987", "0.6035542", "0.5984169", ...
0.0
-1
Fetch courses from database paginated
fetchCourses(page = 1) { axios.get(`${utilities.backendUrl}/courses`, {params: {page: page}}) .then((res) => { this.setState({ courses: res.data.courses.content, pagination: res.data.courses, pageNumbers: res.data.pageNumbers }); }) .catch((err) => console.log(err)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getCourses(){\r\n const pageNumber = 2;\r\n const pageSize=10;\r\n \r\n const courses= await Course\r\n .find({ author : 'Mosh', isPublished :true})\r\n .skip( (pageNumber-1) * pageSize )\r\n //formula for pagination is pagenumber-1 * pagesize\r\n .limit(10)\r\n .sort({name: 1})\r\n //.sel...
[ "0.7596734", "0.7292198", "0.7196835", "0.7181529", "0.712476", "0.70222247", "0.6977866", "0.69531447", "0.69484216", "0.6920709", "0.68820125", "0.68610084", "0.68605316", "0.68555677", "0.68537855", "0.6726301", "0.67253274", "0.67029", "0.6701172", "0.6679708", "0.6664878...
0.7368527
1
== ENTITY == Creates a new entity.
function Entity(key) { this.key = key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createEntity() {\n var entity = new bb.Entity(this);\n this.addEntity(entity);\n return entity;\n }", "function newEntity(type) {\r\n if (uploadInProgress || downloadInProgress)\r\n console.log(\"TEST\");\r\n // create a new entitiy:\r\n currentEntity = new Entity();\r\n cons...
[ "0.7688623", "0.7096921", "0.7091664", "0.70670074", "0.703673", "0.69796306", "0.6925545", "0.6874329", "0.6833655", "0.6754023", "0.6738318", "0.6734428", "0.67286974", "0.6693507", "0.6600522", "0.65460014", "0.64814144", "0.6407978", "0.64077127", "0.6398789", "0.6381803"...
0.6037948
33
== ENTITY (QUESTION) ==
function QuestionEntity(key, content, contentExtended, replies) { Entity.call(key); this.content = content; this.contentExtended = contentExtended; this.replies = replies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Question() {}", "set Question(value) {}", "function Question(questionContent){\n this.questionContent = questionContent;\n this.correct = [];\n this.incorrect = [];\n}", "function whatIsQuestion() {\n\n if(anonymousvotingAddr.state() > 0) {\n var q = anonymousvotingAddr.question();\n docu...
[ "0.62489855", "0.60239494", "0.59625596", "0.592345", "0.59078705", "0.58567667", "0.5844578", "0.5829245", "0.58070093", "0.5799393", "0.5758112", "0.57523143", "0.57484645", "0.5739653", "0.5723298", "0.56927073", "0.5662957", "0.5657268", "0.5656958", "0.56536615", "0.5622...
0.61487424
1
^ must be `pageRef` specifically, can't be `pageReference` or something else
tileClickHandler() { console.log('titleClickHandler invoked!') const tileClicked = new CustomEvent('tileclick', { detail: this.meetingRoomInfo, bubbles: true }) // Instance of `CustomEvent` will take a name for your event (be thoughtful about this) and the payload (as a value to the `detail` key in an object) this.dispatchEvent(tileClicked); // ^ fires the event from this child component for a parent component to receive // pub-sub fireEvent(this.pageRef, 'pubsubtileclick', this.meetingRoomInfo); // Sub is `selectedMeetingRoom` LWC }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _page1_page() {\n}", "constructor(page){\n this.page = page;\n }", "@wire(CurrentPageReference)\n currentPageReference() {\n this.refreshPages();\n }", "onPageChange(unusedPageId) {}", "changePageIC ({ commit, state }, newPage) {\r\n const pageObject = state.pages[newPage...
[ "0.63993454", "0.6397837", "0.6283674", "0.62834054", "0.60920453", "0.6061683", "0.5991547", "0.5981727", "0.5967133", "0.5942613", "0.593631", "0.59243906", "0.5921996", "0.5920073", "0.5869142", "0.58208555", "0.58171266", "0.5779569", "0.5774384", "0.57672745", "0.5767274...
0.0
-1
combines searchURL with user input
function formatQueryParams(params) { const queryItems = Object.keys(params).map( (key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}` ); return queryItems.join("&"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateURL(url) {\n var value = input.value.replace(/ /g, \"%20\");\n var link = url + value + callback;\n console.log(link);\n search(link);\n }", "function search(){\n let query;\n if(searchLocation===\"location\"){\n searchLocation(\"\")\n ...
[ "0.7055356", "0.69988453", "0.68133175", "0.6729792", "0.6712663", "0.6657309", "0.66447306", "0.6630567", "0.6611218", "0.6572658", "0.6558793", "0.65510035", "0.6494138", "0.6493386", "0.6488527", "0.64810586", "0.64543474", "0.64014584", "0.63900495", "0.6381018", "0.63595...
0.0
-1
2. fetch info from namus api
function getMissingPerson(cityQuery, stateQuery) { cityQuery = cityQuery .toLowerCase() .split(" ") .map((s) => s.charAt(0).toUpperCase() + s.substring(1)) .join(" "); let params = { facet: "cityoflastcontact", "refine.cityoflastcontact": cityQuery, "refine.statedisplaynameoflastcontact": stateQuery.toUpperCase(), rows: 1000, }; const queryString = formatQueryParams(params); const url = `${searchURL}&${queryString}`; Promise.all([fetch(url)]) .then((res) => { if (res[0].ok) { return res[0].json(); } throw new Error(res[0].statusText); }) .then((resJson) => { if (!resJson.records.length) { $(".js-form").hide(); $("#js-error-screen") .append( `<section class="err-container"> <h2 class="error-message">There are no missing persons in this area!</h2> <button class="new-search-btn">Try new search</button> </section>` ) .show(); } else { displayResults(resJson); } }) .catch((err) => { $(".js-form").hide(); $("#js-error-screen").append( `<section> <h2 class="error-message">Something went wrong: ${err.message}</h2> <button class="new-search-btn">Go back</button> </section>` ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getUserDetails(){\n const res = await Api.get('url', true);\n }", "function getApiInfo () {\n fetch('https://randomuser.me/api/')\n .then( res => res.json() )\n .then( data => fillInInfo(data))\n}", "function getInfo() {\n fetch(TRAINERS_URL)\n .then(response => response.json())\n .then...
[ "0.6783462", "0.67026603", "0.6586437", "0.65854335", "0.6513364", "0.6404692", "0.6364228", "0.63597417", "0.6345355", "0.63417", "0.6330274", "0.6329044", "0.62944686", "0.62867755", "0.62865114", "0.6283548", "0.62478375", "0.6191709", "0.6189551", "0.61855054", "0.6173632...
0.0
-1
get random array of MP's
function shuffleArray(resJson) { for (let i = resJson.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [resJson[i], resJson[j]] = [resJson[j], resJson[i]]; } return resJson; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeN(){\n\tvar mimaps = [{'mi':5,'ma':7,'p':0.7},{'mi':8,'ma':10,'p':0.3}];\n\treturn wRand(mimaps);\n}", "function mm(array) {\n let v = array.length;\n let n = getRand(0, v);\n return array[n];\n}", "distribution(n: number): RandomArray {\n let paretoArray: RandomArray = [],\n ...
[ "0.6919016", "0.6906586", "0.6897475", "0.6825241", "0.67861396", "0.6652321", "0.6649915", "0.6641872", "0.6632528", "0.66028255", "0.659293", "0.6590533", "0.65550977", "0.65445155", "0.653075", "0.65240955", "0.6519388", "0.65169656", "0.6499348", "0.6484465", "0.6456471",...
0.0
-1
5. displayResults by emptying landing page and filling it with results
function displayResults(resJson) { // if there are previous results, remove them $("#starting-screen").hide(); $("#js-error-screen").empty(); // iterate through the items array let records = shuffleArray(resJson.records); let ages = {}; let races = {}; let genders = {}; records.forEach((record) => { if (genders[record.fields.gender]) { genders[record.fields.gender]++; } else { genders[record.fields.gender] = 1; } if (races[record.fields.raceethnicity]) { races[record.fields.raceethnicity]++; } else { races[record.fields.raceethnicity] = 1; } const age = Math.floor(record.fields.computedmissingmaxage / 10) * 10; if (ages[age]) { ages[age]++; } else { ages[age] = 1; } }); createAgeChart(ages); createRaceChart(races); createPieChart(genders); state.records = records; state.page = 0; if (records.length > 10) { records = records.slice(0, 10); } renderItems(records); // 7. display new search button // 8. Show CTA message to user $("#new-search-section").append( `<section class="new-search-container"> <h2 class="message-footer title">Want to search in a new location?</h2> <button class="new-search-btn">Let's Go!</button> </section>` ); //display the results section $(".results-txt").removeClass("hidden").show(); $(".results-container").removeClass("hidden").show(); $(".results").show(); $("#new-search-section").show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayResults() {\n\n $(\"#resultsPage\").show();\n $('#questionPage').hide();\n setTimeout(reset, 1000 * 10);\n }", "function renderResultsPage(results) {\r\n console.log(results);\r\n\t\r\n var resultsContainer = $('#container');\r\n\tvar did_you_mean = '';\r\n\t\r\n\tif...
[ "0.7576166", "0.7408926", "0.7405816", "0.7271213", "0.72583675", "0.71961373", "0.70647454", "0.706131", "0.70229244", "0.7012176", "0.6974457", "0.6970754", "0.694964", "0.6926762", "0.6889224", "0.6856273", "0.6844927", "0.68201596", "0.6808656", "0.6803067", "0.67957205",...
0.70503116
8
function to display next page of missing persons
function displayNext() { $("body").on("click", ".nextButton", (_e) => { state.page++; let results = state.records.slice(state.page * 10, state.page * 10 + 10); renderItems(results); }); $("body").on("click", ".previousButton", (_e) => { if (state.page === 0) { return; } state.page--; let results = state.records.slice(state.page * 10, state.page * 10 + 10); renderItems(results); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showNext()\n{\n\tcurPage++;\n\tshowContacts();\n}", "function next() {\n pageNumber++;\n getEmployeeDetails(myArr);\n }", "function nextPage() {\n\n if (pastContests.length > pastEndIndex + 30) {\n pastStartIndex = pastStartIndex + 30;\n pastEndIndex = pastEndIndex + 30;\n }\n...
[ "0.7129007", "0.7118382", "0.6519684", "0.64418954", "0.63983136", "0.63584185", "0.63391364", "0.63360023", "0.62673306", "0.62185323", "0.62167287", "0.61906916", "0.6179729", "0.6172903", "0.61637616", "0.6147424", "0.614542", "0.61194927", "0.6119322", "0.61016715", "0.60...
0.61757976
13
function to allow user to do a new search
function getnewSearch() { $("body").on("click", ".new-search-btn", function (e) { e.preventDefault(); $("#js-error-screen").hide().empty(); $(".results-container").hide(); $(".results-txt").hide(); $("#new-search-section").hide().empty(); $("#starting-screen").show(); $(".js-form").show(); $(".userInput").val(""); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newSearch() {\n window.location.href = \"../list/?service=\" + svcSearch +\"&range=\" + distSearch+\"/\"\n }", "function search() {\n\t\n}", "function add_click() {\n $('#search').click(function(){\n var query = find_query_params();\n //show a simpl...
[ "0.72698194", "0.72546387", "0.71110857", "0.70512104", "0.70338523", "0.69484234", "0.6932106", "0.69215333", "0.68896186", "0.6871552", "0.68326414", "0.68288755", "0.6780364", "0.6779372", "0.67776084", "0.6774904", "0.677374", "0.67706937", "0.6769311", "0.6756711", "0.67...
0.64309365
53
1. Get form info on submit and store in a variable...
function watchForm() { $("#search-form").submit((e) => { e.preventDefault(); let cityName = $("#city").val(); let stateName = $("#state").val(); getMissingPerson(cityName, stateName); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFormRequest() {\n var $inputs = $('.demo-form :input');\n var values = captureFormData($inputs);\n var url;\n // submitRequest(values, url);\n}", "function getFormValues() {\n\tname = document.getElementById(\"name\").value;\n\temail = document.getElementById(\"email\").value;\n\tsubject = doc...
[ "0.66617185", "0.6638421", "0.65942526", "0.64928544", "0.64516973", "0.6430104", "0.638016", "0.63558596", "0.63539", "0.6343344", "0.6343344", "0.6343344", "0.63425773", "0.6336309", "0.63136727", "0.6305972", "0.6293514", "0.625471", "0.6251539", "0.6249465", "0.62489104",...
0.0
-1
Loads the songs list data.
@action.bound async loadSongsList() { this.isLoading = true; try { const payload = { songName: this.filterSongName || null, artistName: this.filterArtistName || null, minGrade: this.filterGradesRange[0], maxGrade: this.filterGradesRange[1] }; const fetchedSongsList = await this.songsRepository.getSongsList(payload); this.songsList.clear(); this.songsList.push(...fetchedSongsList); } catch (e) { console.error(e); } finally { this.isLoading = false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSongs() {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n for (var i = 0; i < songArray.length; i++) {\n var para = document.createElement('P');\n var t = document.createTextNode(songArray[i]);\n para.appendChild(t);\n document.querySe...
[ "0.7790735", "0.7491936", "0.7319458", "0.7160265", "0.71298283", "0.69021964", "0.6890367", "0.68492705", "0.6836902", "0.6796913", "0.6795607", "0.6781002", "0.6709844", "0.66848135", "0.6670174", "0.66536796", "0.6645156", "0.6636902", "0.6633187", "0.66229904", "0.6604966...
0.61603266
43
Resets the filter data.
@action.bound resetFilter() { this.filterSongName = ''; this.filterArtistName = '', this.filterGradesRange = [1, 5]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "resetFilter() {\n this._domainsFiltered = this._domains.slice();\n this._chromosomesFiltered = this._chromosomes.slice();\n this.emitUpdate();\n }", "reset() {\n this._kbnFilter = null;\n this.value = this.filterManager.getValueFromFilterBar();\n }", "resetFilters () {\n this....
[ "0.7956197", "0.7918837", "0.78620577", "0.7814674", "0.760837", "0.7574271", "0.7509941", "0.74767387", "0.7462391", "0.74481803", "0.7423814", "0.73675483", "0.73427725", "0.73199946", "0.7317439", "0.7246125", "0.7229161", "0.72231317", "0.72146714", "0.72030294", "0.72001...
0.74113494
11
Book Object Constructor Function
function Book(book) { this.title =data.volumeInfo.title ; this.author=data.volumeInfo.author; this.description=data.volumeInfo.description || *** Description current unavailable ***; this.thumbnail = data.volumeInfo.imageLinks.thumbnail || null; this.url = ; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Book(title, author){\n this.title = title\n this.author = author\n}", "function Book(title,author,isbn){\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "function Book(title, author, isbn) {\n this.title = title;\n this.author = author;\n this.isbn = isbn;\n}", "functi...
[ "0.8303977", "0.8147901", "0.80564195", "0.80564195", "0.80564195", "0.80564195", "0.80564195", "0.80533516", "0.8045971", "0.7991683", "0.7964191", "0.7922469", "0.7919918", "0.79190755", "0.7899478", "0.78839153", "0.7867545", "0.7863045", "0.7848527", "0.77809876", "0.7763...
0.7537383
45
> 15 Using reduce to count a series of strings
function colorAccumulator(acc, x) { if (x === 'blue') { acc.blue += 1; } if (x === 'red') { acc.red += 1; } return acc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function countWordsReduceVersion(words) {\n \"use strict\";\n return reduce(words, function(prev, cur, i, arr) {\n prev[cur] = prev[cur] ? prev[cur] + 1 : 1;\n return prev;\n }, {});\n }", "function count (instructions) {\n let total = 0\n let i = 0\n\n while (i <...
[ "0.67465967", "0.65763605", "0.6520738", "0.63153195", "0.62628645", "0.62329996", "0.6200181", "0.61804855", "0.61490303", "0.6143942", "0.6124046", "0.61238724", "0.61191463", "0.6112411", "0.6042359", "0.60151803", "0.59892124", "0.59835213", "0.598021", "0.5959263", "0.59...
0.0
-1
Same aggregation function used in the string summing example! This function is pure so we can test it to our heart's content. Which is great because most of our application logic lives here.
reduce(state, action) { switch (action) { case 'blue': return Object.assign({}, state, { blue: state.blue + 1 }); case 'red': return Object.assign({}, state, { red: state.red + 1 }); default: return state; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Aggregate() {}", "sum() {}", "function sum() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t return _und...
[ "0.6318301", "0.5813306", "0.57832223", "0.5775831", "0.57717377", "0.57579803", "0.57409316", "0.5715209", "0.5688394", "0.56684715", "0.56453717", "0.564485", "0.563962", "0.56204325", "0.55836797", "0.55479014", "0.5540423", "0.54968804", "0.5464229", "0.5406033", "0.53642...
0.0
-1
Returns an Observable that emits each updated state
state() { return this._state; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor (initialState = {}) {\n this.emitter = new EventEmitter()\n this.updates = new Map()\n this.observers = new Map()\n this.applicators = new Map()\n this.current = initialState\n\n /**\n * Creates a held source stream that holds application state.\n * Held streams output the las...
[ "0.6698942", "0.62904114", "0.6283264", "0.5805762", "0.57265913", "0.5575637", "0.554832", "0.5543935", "0.5514091", "0.55012506", "0.5348636", "0.53154874", "0.53083175", "0.5295144", "0.5285675", "0.52639", "0.52143186", "0.52107507", "0.5209649", "0.5209649", "0.5209649",...
0.0
-1
Here, our action creators expose an API that allow the UI to push events/actions onto the actions observable.
blueClick() { this._actions.onNext('blue'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "createAction() {}", "function actionCreator() {\n return action\n}", "function actionCreator(){\n return action;\n }", "function actionCreator() {\n return action\n }", "function actionCreator() {\n return action;\n }", "bindActions() {\n\t\t// @props\n\t\t// onComplete\n\t\t// buttons\n\t\t...
[ "0.6954286", "0.6719776", "0.6691922", "0.66513765", "0.6623811", "0.66053516", "0.6485168", "0.64830816", "0.6446682", "0.6436856", "0.63788956", "0.6362903", "0.6333045", "0.6294832", "0.61877054", "0.6186368", "0.6181127", "0.6160792", "0.61441875", "0.6129566", "0.6113814...
0.0
-1
The main processor of commands.
function processCommand(receivedMessage) { let fullCommand = receivedMessage.content.substr(1) // Remove the leading exclamation mark let splitCommand = fullCommand.split(" ") // Split the message up in to pieces for each space let primaryCommand = splitCommand[0] // The first word directly after the excalamtion is the command let arguments = splitCommand.slice(1) // All other words are arguments/parameters/options for the command console.log("Command received: " + primaryCommand) console.log("Arguments: " + arguments) // There may not be arguments if (primaryCommand == "help") { helpCommand(arguments, receivedMessage) } else if (primaryCommand == "multiply") { multiplyCommand(arguments, receivedMessage) } else if (primaryCommand == "ping") { pingCommand(arguments, receivedMessage) } else { receivedMessage.channel.send("I don't understand the command. Try `!help` or `!multiply`") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CommandProcessor(controller) {\n this.controller = controller;\n}", "function handleCommand() {}", "function Command () {}", "function CommandsProcessor(message)\n{\n\n\n var command = getCommand(message);\n\n /**\n * Returns the name of the command.\n * @returns {String} the command\...
[ "0.656522", "0.645407", "0.6356635", "0.6344436", "0.63089496", "0.62207615", "0.61820775", "0.60718256", "0.6071718", "0.6071718", "0.6065387", "0.6064824", "0.59894633", "0.59594554", "0.5957238", "0.59568363", "0.59453076", "0.5944164", "0.5905963", "0.58969057", "0.587808...
0.57894444
29
The help command should list all the commands available without an argument, and accept a command as an argument to display said commands usage.
function helpCommand(arguments, receivedMessage) { if (arguments.length > 0) { receivedMessage.channelsend("It looks like you might need help with " + arguments) } else { receivedMessage.channel.send("I'm not sure what you need help with. Try `!help [topic]`") } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addImplicitHelpCommand() {\n this.command('help [cmd]', 'display help for [cmd]');\n }", "function help() {\n\tvar commandsArray = ['Help: List of available commands', '>help', '>about', '>contact', '>ping', '>time', '>clear', '>say'];\n\tfor (var i = 0; i < commandsArray.length; i++) {\n\t\tvar out = '<span...
[ "0.8007304", "0.77485216", "0.7647215", "0.76334184", "0.7555876", "0.75035346", "0.74084127", "0.7399205", "0.73620594", "0.7333159", "0.730623", "0.72821474", "0.723349", "0.72274303", "0.7214048", "0.7201404", "0.71871066", "0.718445", "0.7157682", "0.7102523", "0.7102523"...
0.74989164
6
Takes any number of passed in arguments that are numbers, and multiplies them.
function multiplyCommand(arguments, receivedMessage) { if (arguments.length < 2) { receivedMessage.channel.send("Not enough values to multiply. Try !`multiply 2 4 10` or `!multiply 5.2 7`") return } let product = 1 arguments.forEach((value) => { product = product * parseFloat(value) }) if (isNaN(product)) { receivedMessage.channel.send("Please input numbers instead.") } else { receivedMessage.channel.send("The product of " + arguments + " multiplied together is: " + product.toString()) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mul() {\n var res = 1;\n var count = 0;\n for (var i = 0; i < arguments.length; i++){\n if (typeof(arguments[i])===\"number\"){\n res *=arguments[i];\n count++;\n }\n }\n if (count == 0) return 0;\n return res;\n}", "function multiplyAll() {\n if ...
[ "0.8401136", "0.8034047", "0.795346", "0.7931022", "0.7829133", "0.78238165", "0.77966255", "0.76907176", "0.767811", "0.7623502", "0.75973105", "0.75830686", "0.7569053", "0.7513881", "0.74896085", "0.7456117", "0.7455235", "0.74446195", "0.7433075", "0.73673373", "0.7358504...
0.7161548
23
Returns Pong! to the user.
function pingCommand(arguments, receivedMessage) { receivedMessage.channel.send("Pong!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendPong() {\n const pong = { type: SOCKET_MESSAGE_TYPES.PONG };\n this.send(pong);\n }", "function _wsPong() {\n log.verbose(LOG_PREFIX, 'Pong.');\n _self.emit('pong');\n }", "function pong(user, userID, channelID, args, evt) {\n bot.sendMessage({\n to: channelID,\n message: 'Po...
[ "0.7041321", "0.69286495", "0.6809028", "0.6798936", "0.6554113", "0.640804", "0.58560777", "0.5795214", "0.57801706", "0.56441015", "0.5631033", "0.56156516", "0.5552069", "0.5540989", "0.5497749", "0.5458213", "0.5425959", "0.541008", "0.53341025", "0.5325144", "0.52942973"...
0.53205335
20
Handler for internal server errors
function errorHandler(err, req, res, next) { console.error(err.message) console.error(err.stack) res.status(500).render('error_template', { error: err }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function erroHandler(err, request, response, next) {\n response.status(500).send(\"Server Error! Please Try again later!!\");\n}", "function ErrorHandler() {}", "static serverError(message, res) {\n res.writeHead(500, {'Content-Type': 'text/html'});\n res.write(message);\n res.end();\n }", "func...
[ "0.78414315", "0.73446363", "0.72819155", "0.7269763", "0.7269763", "0.7257347", "0.7202326", "0.7199615", "0.71955085", "0.7185981", "0.7173113", "0.7088391", "0.70506644", "0.7044177", "0.70228547", "0.7022297", "0.6996022", "0.6987262", "0.69870025", "0.6978417", "0.697694...
0.684494
42
Note: due to BigNumber config the max decimals is 8
readableCrypto(value, decimals = 8) { if (value) { const bigNumberValue = BigNumber.make(value); const normalizedValue = Number(bigNumberValue.dividedBy(1e8)).toLocaleString(constants.LOCALE, { maximumFractionDigits: decimals }); return normalizedValue; } return value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bigNumber(value) {\n return __WEBPACK_IMPORTED_MODULE_1__ethersproject_bignumber__[\"a\" /* BigNumber */].from(value);\n }", "bigNumber(value) {\n return bignumber[\"a\" /* BigNumber */].from(value);\n }", "makeBigNumber(amount, decimals) {\n // Allow .0\n if (amount.substr(0,...
[ "0.69678116", "0.68826973", "0.68603146", "0.67189133", "0.65545577", "0.65459454", "0.6496998", "0.6496998", "0.64896846", "0.6451051", "0.643658", "0.6387632", "0.6380323", "0.6357161", "0.6324254", "0.63214487", "0.6309649", "0.62712514", "0.62406933", "0.62240386", "0.622...
0.61264294
24
Takes the response from api calls to the cart and replaces the clients cart render with the new cart html supplied. Note: this is some horribly dirty corner cutting hackery of which I am not proud. Don't judge me.
async function _reRenderCartWithResponse(response) { // Do nothing if not 200 if (response.status !== 200) return; // Convert response stream to text, which will contain the current html state of the cart let text = await response.text(); // Remove the current cart from the nav let cart = document.getElementById('nav-cart'); let show = document.getElementById('cart-wrapper'); show = show ? show.classList.contains('active') : false; if (cart) { while (cart.nextSibling) cart.parentNode.removeChild(cart.nextSibling); cart.parentNode.removeChild(cart); } if (!text) return; // Inject the new cart const template = document.createElement('template'); template.innerHTML = text; if (show) template.content.getElementById('cart-wrapper').classList.add('active'); for (const replacement of template.content.childNodes) { document.querySelector('nav').appendChild(replacement); } // The script included with the cart will not evaluate when injected via innerHTML, so regex // out its content and eval it. const script = text.match(/<script>([\s\S]*)<\/script>/); if (script) window.eval(script[1]); // Give the cart nav icon an animation for some responsiveness if ((cart = document.getElementById('nav-cart'))) cart.classList.add('animate'); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateCart() {\n\n\t$('contentMinicart').innerHTML = \"<div align='center' class='zajax_loading'>Loading... Please Wait<\\/div>\";\n\tnew Effect.Highlight($('contentMinicart'));\n\t\n\t// this gets called by handleResponse (which is in zoovy.js)\n var postBody = 'm=RenderElement&format=WRAPPER&docid='+D...
[ "0.6977778", "0.6943263", "0.66290593", "0.66050214", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6599", "0.6541971", "0.650137", "0.64912754", "0.64...
0.771274
0
Set the list opened or closed
function setStatus(node) { var elements = []; $(node).each(function() { elements.push($(node).nextAll()); }); for (var i = 0; i < elements.length; i++) { if (elements[i].css("display") == "none") { elements[i].fadeIn(); } else { elements[i].fadeOut(0); } } if (elements[0].css("display") != "none") { $(node).addClass("active"); } else { $(node).removeClass("active"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetOpen() {\n open = [];\n}", "_setOpenState(val) {\n if (val === undefined) {\n val = 'false';\n } // Default value\n GM_setValue('toggleSnatchedState', val);\n this._isOpen = val;\n }", "_setOpenState(val) {\n if (val === undefined) {\n ...
[ "0.6220082", "0.61727405", "0.61727405", "0.60176533", "0.59372956", "0.58933836", "0.587499", "0.5846048", "0.5846048", "0.5846048", "0.58295065", "0.5825171", "0.5818736", "0.57208157", "0.57129925", "0.56440496", "0.5641822", "0.5605687", "0.5602292", "0.5562374", "0.55225...
0.0
-1
! Parsley.js Version 2.7.1 built Mon, May 1st 2017, 11:19 am
function _toConsumableArray(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function expendParsley() {\n window.Parsley.on('field:success', function () {\n\n\n });\n }", "private public function m246() {}", "constructor(location, parcels) {\n this.location = location;\n this.parcels = parcels;\n }", "function setup(p){\n\n}", "function PlatForm() {}", "fu...
[ "0.585894", "0.52009135", "0.5161253", "0.51474077", "0.5083898", "0.5078293", "0.5019331", "0.49913025", "0.49615997", "0.49594483", "0.49470842", "0.49466026", "0.4904374", "0.48970538", "0.48697108", "0.4867041", "0.48647588", "0.48589423", "0.48562303", "0.48493853", "0.4...
0.0
-1
inputevent Alleviate browser bugs for input events
function n(){var t=this,i=window||global;_extends(this,{isNativeEvent:function(e){return e.originalEvent&&e.originalEvent.isTrusted!==!1},fakeInputEvent:function(i){t.isNativeEvent(i)&&e(i.target).trigger("input")},misbehaves:function(i){t.isNativeEvent(i)&&(t.behavesOk(i),e(document).on("change.inputevent",i.data.selector,t.fakeInputEvent),t.fakeInputEvent(i))},behavesOk:function(i){t.isNativeEvent(i)&&e(document).off("input.inputevent",i.data.selector,t.behavesOk).off("change.inputevent",i.data.selector,t.misbehaves)},install:function(){if(!i.inputEventPatched){i.inputEventPatched="0.0.3";for(var n=["select",'input[type="checkbox"]','input[type="radio"]','input[type="file"]'],r=0;r<n.length;r++){var s=n[r];e(document).on("input.inputevent",s,{selector:s},t.behavesOk).on("change.inputevent",s,{selector:s},t.misbehaves)}}},uninstall:function(){delete i.inputEventPatched,e(document).off(".inputevent")}})}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onInput(e) {\r\n /* console.log(e.detail);\r\n console.log(\"onInput: \", e.detail);*/\r\n }", "_onInputChange(event) {\n if (typeof event.target.oninput === 'undefined') {\n this._onInputChangeHandler(event);\n }\n }", "function onInput(e){\n console...
[ "0.7483774", "0.7424675", "0.73940694", "0.73078495", "0.72044325", "0.71850246", "0.71850246", "0.71850246", "0.71850246", "0.71568596", "0.7054438", "0.7052404", "0.7024237", "0.6939248", "0.690374", "0.68855846", "0.68607026", "0.6822698", "0.68046427", "0.6775204", "0.674...
0.7285664
8
! moment.js locale configuration ! locale : Breton [br] ! author : JeanBaptiste Le Duigou :
function ud(a,b,c){var d={mm:"munutenn",MM:"miz",dd:"devezh"};return a+" "+xd(d[c],a)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nf...
[ "0.80059713", "0.7704327", "0.7642467", "0.7615224", "0.7004516", "0.67185086", "0.6640758", "0.6581124", "0.6524153", "0.6427434", "0.6401369", "0.6152816", "0.6152816", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.61002886", "0.6100...
0.0
-1
! moment.js locale configuration ! locale : German (Switzerland) [dech] ! author : sschueller :
function Dd(a,b,c,d){var e={m:["eine Minute","einer Minute"],h:["eine Stunde","einer Stunde"],d:["ein Tag","einem Tag"],dd:[a+" Tage",a+" Tagen"],M:["ein Monat","einem Monat"],MM:[a+" Monate",a+" Monaten"],y:["ein Jahr","einem Jahr"],yy:[a+" Jahre",a+" Jahren"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nf...
[ "0.818455", "0.7860676", "0.7833741", "0.73853076", "0.70475256", "0.69542605", "0.68731415", "0.68490523", "0.65440273", "0.6526152", "0.6369514", "0.601142", "0.601142", "0.59891135", "0.5938963", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.59140235", "0.5914...
0.0
-1
! moment.js locale configuration ! locale : Estonian [et] ! author : Henry Kehlmann : ! improvements : Illimar Tambek :
function Fd(a,b,c,d){var e={s:["mõne sekundi","mõni sekund","paar sekundit"],m:["ühe minuti","üks minut"],mm:[a+" minuti",a+" minutit"],h:["ühe tunni","tund aega","üks tund"],hh:[a+" tunni",a+" tundi"],d:["ühe päeva","üks päev"],M:["kuu aja","kuu aega","üks kuu"],MM:[a+" kuu",a+" kuud"],y:["ühe aasta","aasta","üks aasta"],yy:[a+" aasta",a+" aastat"]};return b?e[c][2]?e[c][2]:e[c][1]:d?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Os(e,t,n){return\"m\"===n?t?\"хвилина\":\"хвилину\":\"h\"===n?t?\"година\":\"годину\":e+\" \"+\n//! moment.js locale configuration\nfunction(e,t){var n=e.split(\"_\");return t%10==1&&t%100!=11?n[0]:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?n[1]:n[2]}({ss:t?\"секунда_секунди_секунд\":\"секунду_секунди_секунд...
[ "0.7557109", "0.7551594", "0.74955004", "0.7079154", "0.69555044", "0.62988454", "0.6280072", "0.62005496", "0.60696095", "0.6043879", "0.6043879", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60302883", "0.60118425", "0...
0.0
-1
! moment.js locale configuration ! locale : Konkani Latin script [gomlatn] ! author : The Discoverer :
function Id(a,b,c,d){var e={s:["thodde secondanim","thodde second"],m:["eka mintan","ek minute"],mm:[a+" mintanim",a+" mintam"],h:["eka horan","ek hor"],hh:[a+" horanim",a+" hor"],d:["eka disan","ek dis"],dd:[a+" disanim",a+" dis"],M:["eka mhoinean","ek mhoino"],MM:[a+" mhoineanim",a+" mhoine"],y:["eka vorsan","ek voros"],yy:[a+" vorsanim",a+" vorsam"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nf...
[ "0.8243827", "0.78860277", "0.7814756", "0.77083063", "0.7066194", "0.6849828", "0.6790166", "0.657647", "0.6568694", "0.64285296", "0.63389885", "0.61543334", "0.61543334", "0.6018532", "0.59970075", "0.5991416", "0.59857446", "0.59857446", "0.59662306", "0.59568894", "0.595...
0.0
-1
! moment.js locale configuration ! locale : Luxembourgish [lb] ! author : mweimerskirch : ! author : David Raison :
function Od(a,b,c,d){var e={m:["eng Minutt","enger Minutt"],h:["eng Stonn","enger Stonn"],d:["een Dag","engem Dag"],M:["ee Mount","engem Mount"],y:["ee Joer","engem Joer"]};return b?e[c][0]:e[c][1]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nf...
[ "0.8045511", "0.7559744", "0.75030416", "0.7409973", "0.740628", "0.7021226", "0.69451475", "0.64851147", "0.6393321", "0.62985593", "0.62424666", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0.60107577", "0....
0.0
-1
! moment.js locale configuration ! locale : Romanian [ro] ! author : Vlad Gurdiga : ! author : Valentin Agachi :
function ce(a,b,c){var d={mm:"minute",hh:"ore",dd:"zile",MM:"luni",yy:"ani"},e=" ";return(a%100>=20||a>=100&&a%100===0)&&(e=" de "),a+e+d[c]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cl(e,t,n){return\"m\"===n?t?\"минута\":\"минуту\":e+\" \"+\n//! moment.js locale configuration\n//! locale : Russian [ru]\n//! author : Viktorminator : https://github.com/Viktorminator\n//! Author : Menelion Elensúle : https://github.com/Oire\n//! author : Коренберг Марк : https://github.com/socketpair\nf...
[ "0.7537402", "0.69916016", "0.69081736", "0.6767979", "0.66841763", "0.64818966", "0.6432834", "0.64190984", "0.57471997", "0.56857115", "0.55967474", "0.5530572", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.5456", "0.54282737", "0.5...
0.0
-1
Hsla conversions adapted from:
function hue2rgb( p, q, h ) { h = ( h + 1 ) % 1; if ( h * 6 < 1 ) { return p + ( q - p ) * h * 6; } if ( h * 2 < 1 ) { return q; } if ( h * 3 < 2 ) { return p + ( q - p ) * ( ( 2 / 3 ) - h ) * 6; } return p; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "asHSL(ao) {\r\n return \"hsla(\" + this.h + \",\" + this.s + \"%,\" + this.l + \"%,\" + ((ao == undefined) ? this.a : ao) + \")\";\r\n }", "function toHsla(color) {\n return hsla.apply(void 0, _toConsumableArray(parseToHsla(color)));\n}", "get hsla() {\n let [r, g, b] = Color.RGBToHSL(this.r, thi...
[ "0.7133919", "0.6777103", "0.6756517", "0.6323499", "0.6226175", "0.61585385", "0.61223394", "0.60979325", "0.60345244", "0.6014705", "0.59953487", "0.5991524", "0.5911918", "0.59083855", "0.5854398", "0.5845574", "0.5794395", "0.57931525", "0.5763595", "0.5761861", "0.575987...
0.0
-1
Return an effect options object for the given parameters:
function _normalizeArguments( effect, options, speed, callback ) { // Allow passing all options as the first parameter if ( $.isPlainObject( effect ) ) { options = effect; effect = effect.effect; } // Convert to an object effect = { effect: effect }; // Catch (effect, null, ...) if ( options == null ) { options = {}; } // Catch (effect, callback) if ( $.isFunction( options ) ) { callback = options; speed = null; options = {}; } // Catch (effect, speed, ?) if ( typeof options === "number" || $.fx.speeds[ options ] ) { callback = speed; speed = options; options = {}; } // Catch (effect, options, callback) if ( $.isFunction( speed ) ) { callback = speed; speed = null; } // Add options to effect if ( options ) { $.extend( effect, options ); } speed = speed || options.duration; effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default; effect.complete = callback || options.complete; return effect; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _normalizeArguments(effect,options,speed,callback){// Allow passing all options as the first parameter\nif($.isPlainObject(effect)){options=effect;effect=effect.effect;}// Convert to an object\neffect={effect:effect};// Catch (effect, null, ...)\nif(options==null){options={};}// Catch (effect, callback)\n...
[ "0.63458794", "0.63458794", "0.63458794", "0.6345363", "0.6340309", "0.6337576", "0.6335888", "0.6304416", "0.627795", "0.6254449", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", "0.6252033", ...
0.62808436
17
Support: IE 8 only IE 8 doesn't resolve inherit to visible/hidden for computed values
function visible( element ) { var visibility = element.css( "visibility" ); while ( visibility === "inherit" ) { element = element.parent(); visibility = element.css( "visibility" ); } return visibility !== "hidden"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function visible(element){var visibility=element.css(\"visibility\");while(visibility===\"inherit\"){element=element.parent();visibility=element.css(\"visibility\");}return visibility!==\"hidden\";}", "function visible(element){var visibility=element.css(\"visibility\");while(visibility===\"inherit\"){element=el...
[ "0.6636289", "0.6636289", "0.6636289", "0.648814", "0.64609355", "0.64392227", "0.6343425", "0.6238091", "0.6237218", "0.62117374", "0.612754", "0.6095307", "0.60799813", "0.60512996", "0.594326", "0.593291", "0.59233123", "0.59233123", "0.59233123", "0.58854663", "0.5885439"...
0.56523085
51
Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, allowing multiple different settings on the same page.
function Datepicker() { this._curInst = null; // The current instance in use this._keyEvent = false; // If the last event was a key event this._disabledInputs = []; // List of date picker inputs that have been disabled this._datepickerShowing = false; // True if the popup picker is showing , false if not this._inDialog = false; // True if showing within a "dialog", false if not this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class this._appendClass = "ui-datepicker-append"; // The name of the append marker class this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class this.regional = []; // Available regional settings, indexed by language code this.regional[ "" ] = { // Default regional settings closeText: "Done", // Display text for close link prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link monthNames: [ "January","February","March","April","May","June", "July","August","September","October","November","December" ], // Names of months for drop-down and formatting monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right showMonthAfterYear: false, // True if the year select precedes month, false for month then year yearSuffix: "" // Additional text to append to the year in the month headers }; this._defaults = { // Global defaults for all the date picker instances showOn: "focus", // "focus" for popup on focus, // "button" for trigger button, or "both" for either showAnim: "fadeIn", // Name of jQuery animation for popup showOptions: {}, // Options for enhanced animations defaultDate: null, // Used when field is blank: actual date, // +/-number for offset from today, null for today appendText: "", // Display text following the input box, e.g. showing the format buttonText: "...", // Text for trigger button buttonImage: "", // URL for trigger button image buttonImageOnly: false, // True if the image appears alone, false if it appears on a button hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: false, // True if month can be selected directly, false if only prev/next changeYear: false, // True if year can be selected directly, false if only prev/next yearRange: "c-10:c+10", // Range of years to display in drop-down, // either relative to today's year (-nn:+nn), relative to currently displayed year // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: "+10", // Short year values < this are in the current century, // > this are in the previous century, // string value starting with "+" for current year + value minDate: null, // The earliest selectable date, or null for no limit maxDate: null, // The latest selectable date, or null for no limit duration: "fast", // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker onSelect: null, // Define a callback function when a date is selected onChangeMonthYear: null, // Define a callback function when the month or year is changed onClose: null, // Define a callback function when the datepicker is closed numberOfMonths: 1, // Number of months to show at a time showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) stepMonths: 1, // Number of months to step back/forward stepBigMonths: 12, // Number of months to step back/forward for the big links altField: "", // Selector for an alternate field to store selected dates into altFormat: "", // The date format to use for the alternate field constrainInput: true, // The input is constrained by the current date format showButtonPanel: false, // True to show button panel, false to not show it autoSize: false, // True to size the input for the date format, false to leave as is disabled: false // The initial disabled state }; $.extend( this._defaults, this.regional[ "" ] ); this.regional.en = $.extend( true, {}, this.regional[ "" ] ); this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Datepicker() {\r\n\tthis.debug = false; // Change this to true to start debugging\r\n\tthis._nextId = 0; // Next ID for a date picker instance\r\n\tthis._inst = []; // List of instances indexed by ID\r\n\tthis._curInst = null; // The current instance in use\r\n\tthis._disabledInputs = []; // List of date ...
[ "0.74273753", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.72829443", "0.71955395", "0.71955395", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7186703", "0.7...
0.7161838
74
Bind hover events for datepicker elements. Done via delegate so the binding only occurs once in the lifetime of the parent div. Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
function datepicker_bindHover( dpDiv ) { var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; return dpDiv.on( "mouseout", selector, function() { $( this ).removeClass( "ui-state-hover" ); if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-prev-hover" ); } if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { $( this ).removeClass( "ui-datepicker-next-hover" ); } } ) .on( "mouseover", selector, datepicker_handleMouseover ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function datepicker_bindHover(dpDiv){var selector=\"button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a\";return dpDiv.delegate(selector,\"mouseout\",function(){$(this).removeClass(\"ui-state-hover\");if(this.className.indexOf(\"ui-datepicker-prev\") !== -1){$(this).removeClass(\"ui-date...
[ "0.7934868", "0.7904358", "0.79031956", "0.79031956", "0.79031956", "0.7886937", "0.787541", "0.7867152", "0.7743114", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", "0.7694913", ...
0.77573276
21
jQuery extend now ignores nulls!
function datepicker_extendRemove( target, props ) { $.extend( target, props ); for ( var name in props ) { if ( props[ name ] == null ) { target[ name ] = props[ name ]; } } return target; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function jQueryExtend() {\n var options, name, src, copy, copyIsArray, clone,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length,\n deep = false;\n\n // Handle a deep copy situation\n if ( typeof target ==...
[ "0.73487353", "0.696477", "0.6951151", "0.6454417", "0.6113531", "0.6113531", "0.60536283", "0.60536283", "0.5966844", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.5964627", "0.59418887", "0.59309053", "0.59309053", "0.5918109", "0.5908905", "0.59048486...
0.0
-1
Post events to containers
function delayEvent( type, instance, container ) { return function( event ) { container._trigger( type, event, instance._uiHash( instance ) ); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function postEvents(req, res, next) {\n jackalopeApp.jackrabbitConnection.publish('queue.simple', req.body);\n res.status(200).end();\n }", "function registerEvents(Remci) {\n for(var e in events) {\n let event = events[e];\n Remci.post(e, emitEvent(event));\n }\n}", "function onContai...
[ "0.6496375", "0.63010883", "0.5960383", "0.5890177", "0.5843974", "0.5827947", "0.5778853", "0.57435614", "0.5645402", "0.56397086", "0.55770916", "0.55728555", "0.5566734", "0.5565772", "0.55490434", "0.55484766", "0.55384415", "0.5507436", "0.5482938", "0.54693615", "0.5421...
0.0
-1
! jQuery UI Spinner 1.12.1 Copyright jQuery Foundation and other contributors Released under the MIT license. >>label: Spinner >>group: Widgets >>description: Displays buttons to easily input numbers via the keyboard or mouse. >>docs: >>demos: >>css.structure: ../../themes/base/core.css >>css.structure: ../../themes/base/spinner.css >>css.theme: ../../themes/base/theme.css
function spinnerModifer( fn ) { return function() { var previous = this.element.val(); fn.apply( this, arguments ); this._refresh(); if ( previous !== this.element.val() ) { this._trigger( "change" ); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function customSpinner() {\n\t$(\".spinner\").spinner({\n\t\tnumberFormat: \"n\",\n\t\tmin: 0\n\t});\n}", "_initQuantitySpinner() {\n $('#spinnerQuantity').spinner();\n }", "function loading() {\n\n var opts = {\n lines: 13, // The number of lines to draw\n length: 7, // The length of each...
[ "0.7480407", "0.72747725", "0.6951026", "0.6838331", "0.68114835", "0.66085505", "0.6585339", "0.65607965", "0.656062", "0.6557318", "0.655325", "0.65526116", "0.6364848", "0.6330671", "0.63282835", "0.63166267", "0.63128227", "0.6304382", "0.6275497", "0.6247222", "0.6246567...
0.0
-1
Helper function to create drag handlers for dragover/dragenter/dragleave:
function getDragHandler(type) { var isDragOver = type === 'dragover'; return function (e) { e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; var dataTransfer = e.dataTransfer; if (dataTransfer && $.inArray('Files', dataTransfer.types) !== -1 && this._trigger( type, $.Event(type, {delegatedEvent: e}) ) !== false) { e.preventDefault(); if (isDragOver) { dataTransfer.dropEffect = 'copy'; } } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static dragEvents(){\n //enter drag\n Quas.on(\"dragenter dragstart\", \".drop\", function(e){\n e.preventDefault();\n new Element(this).addCls(\"dragenter\");\n });\n\n //exit drag\n Quas.on(\"dragend dragleave\", \".drop\", function(e){\n e.preventDefault();\n new Element(this)...
[ "0.7138991", "0.7102745", "0.69069475", "0.68983006", "0.6729915", "0.6649239", "0.6649239", "0.6601595", "0.65734357", "0.65551645", "0.6535164", "0.6468388", "0.6432454", "0.64096344", "0.6367905", "0.6367905", "0.63239425", "0.63213205", "0.6307204", "0.62995845", "0.62949...
0.6193044
45
Custom proxy to avoid jQuery's guid
function proxy(fn, context) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } return function () { for (var _len2 = arguments.length, args2 = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args2[_key2] = arguments[_key2]; } return fn.apply(context, args.concat(toArray(args2))); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function i(){this.expando=me.expando+i.uid++}", "getElementId(){\n return `${this.constructor.elementIdPrefix}${this.identity}`;\n }", "function get(){return proxy;}", "function get(){return proxy;}", "function getNeededId(self){\n var manipulator = $(self);\n var neededId = manipulator.attr('i...
[ "0.60234004", "0.5816297", "0.57973206", "0.57973206", "0.5755648", "0.56807077", "0.5627472", "0.5626583", "0.5598052", "0.5547384", "0.5547384", "0.5546235", "0.5508463", "0.55060285", "0.5495939", "0.54917043", "0.548817", "0.54807484", "0.54734755", "0.5466507", "0.545303...
0.0
-1
Only available for JPEG image
function arrayBufferToDataURL(arrayBuffer) { var dataView = new Uint8Array(arrayBuffer); var length = dataView.length; var base64 = ''; var i = void 0; for (i = 0; i < length; i++) { base64 += fromCharCode(dataView[i]); } return 'data:image/jpeg;base64,' + btoa(base64); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isJPEG(imgUrl)\r\n {\r\n var istream = getDataStream(imgUrl);\r\n if (istream) {\r\n var bis = Components.classes[\"@mozilla.org/binaryinputstream;1\"].createInstance(Components.interfaces.nsIBinaryInputStream);\r\n bis.setInputStream(istream);\r\n if (bis.read16() == SOI_MARKE...
[ "0.6750157", "0.6707812", "0.6451136", "0.6432129", "0.64300776", "0.6354731", "0.63220286", "0.63220286", "0.62505156", "0.62397563", "0.62182915", "0.6178039", "0.61705726", "0.6163406", "0.6151997", "0.6141724", "0.6130553", "0.6121599", "0.61148214", "0.60809416", "0.6045...
0.0
-1
Turns a plugin!resource to [plugin, resource] with the plugin being undefined if the name did not have a plugin prefix.
function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function splitPrefix(name){var prefix,index=name?name.indexOf('!'):-1;if(index > -1){prefix = name.substring(0,index);name = name.substring(index + 1,name.length);}return [prefix,name];} //Creates a parts array for a relName where first part is plugin ID,", "function build_plugin_names() {\n const args = Norma(...
[ "0.6088341", "0.5513669", "0.5496837", "0.543208", "0.53964555", "0.5210579", "0.5210579", "0.5177312", "0.5127608", "0.5112156", "0.5010494", "0.49943906", "0.4879141", "0.48771456", "0.48741922", "0.47705242", "0.47443357", "0.47084403", "0.47025114", "0.46985525", "0.46838...
0.0
-1
Filter out all items except for the one passed in the argument
function onlyItem (item) { return function () { return $(this).val() == item.id; }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function without(items, item) {\n return items.filter(function (i) {\n return i !== item;\n });\n }", "function without(items, item) {\n return items.filter(function (i) { return i !== item; });\n}", "function without(items, item) {\n return items.filter(function (i) { return i !== item; });\...
[ "0.7620843", "0.74576545", "0.74576545", "0.6949059", "0.67931205", "0.6763516", "0.67110926", "0.66278845", "0.6603125", "0.66006714", "0.65639323", "0.6540129", "0.6525952", "0.65198886", "0.6499483", "0.64748067", "0.64748067", "0.6468689", "0.6459403", "0.641476", "0.6413...
0.0
-1
Used 'uni range + named function' from
function match(a) { return DIACRITICS[a] || a; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Range() {}", "function f(){return{range:function(e,t,a){void 0===t?(t=e,e=0,a=1):a||(a=1);var n=[];if(a>0)for(var r=e;r<t;r+=a)n.push(r);else for(var f=e;f>t;f+=a)\n // eslint-disable-line for-direction\n n.push(f);return n},cycler:function(){return n(Array.prototype.slice.call(arguments))},joiner...
[ "0.6480403", "0.59365773", "0.59111726", "0.587964", "0.57743406", "0.5752047", "0.5658205", "0.5624756", "0.55952084", "0.55952084", "0.5579083", "0.55713874", "0.5569544", "0.55360025", "0.5502493", "0.5502493", "0.5502493", "0.549479", "0.54816073", "0.5480432", "0.5480432...
0.0
-1
CODE TO COMPUTE AND RENDER A TILE
function tile(x, y, w, distortion) { const points = [ { x: -w / 2 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: 0 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: -w / 2 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: 0 + random(-distortion, distortion), }, { x: w / 2 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: 0 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: -w / 2 + random(-distortion, distortion), y: w / 2 + random(-distortion, distortion), }, { x: -w / 2 + random(-distortion, distortion), y: 0 + random(-distortion, distortion), }, ]; push(); translate( x + random(-distortion, distortion), y + random(-distortion, distortion) ); rotate(distortion); stroke(100, 100 - distortion); strokeWeight(sw - distortion/100); beginShape(); //Outer perimater points.forEach((item) => { vertex(item.x, item.y); }); endShape(CLOSE); //INNER CROSS const crossPointIndexs = [1, 3, 5, 7]; beginShape(); crossPointIndexs.forEach((index) => { vertex(0, 0); vertex(points[index].x, points[index].y); }); endShape(); pop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render() {\n loop(function (row, col) {\n x = (col * tileSize);\n y = (row * tileSize);\n\n // draw placements\n if (map[row][col] == 1) {\n context.fillStyle = \"#aa0000\";\n context.fillRect(x + tileOffset, y + tileOffset, ...
[ "0.7171772", "0.70247406", "0.69938207", "0.69023806", "0.6890839", "0.676174", "0.6754753", "0.6692558", "0.66662043", "0.66611296", "0.6626367", "0.66016304", "0.65700763", "0.65541524", "0.6511475", "0.64953935", "0.6476145", "0.646591", "0.6449381", "0.64069533", "0.64026...
0.61062956
49
funcion que contiene el contador
function stopTimer(){ chronometre.innerHTML = count++; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iniciar() {\n \n }", "function principal() {\n choquecuerpo();\n choquepared();\n dibujar();\n movimiento();\n \n if(cabeza.choque (comida)){\n comida.colocar();\n cabeza.meter();\n } \n}", "function mostrar() {}", "function mostrar() {}", "proce...
[ "0.65542704", "0.6495829", "0.6143127", "0.6143127", "0.60917383", "0.60357255", "0.595808", "0.59304494", "0.5917927", "0.5917927", "0.5917927", "0.5916683", "0.57877177", "0.5783338", "0.57822526", "0.5778104", "0.57690966", "0.5768726", "0.57636976", "0.57540953", "0.57509...
0.0
-1
funcion que detiene el cronometro
function stops(){ window.clearInterval(timer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function continuar() {\n emp2=new Date(); //fecha actual\n emp2=emp2.getTime(); //pasar a tiempo Unix\n emp3=emp2-cro; //restar tiempo anterior\n emp=new Date(); //nueva fecha inicial para pasar al temporizador \n emp.setTime(emp3); //datos para nueva fecha inicial.\n ...
[ "0.7084632", "0.70063454", "0.6917214", "0.6824818", "0.67470676", "0.6412796", "0.6401061", "0.62434053", "0.6226063", "0.6205591", "0.6180736", "0.6180677", "0.6108131", "0.60960746", "0.6022762", "0.5978259", "0.59092844", "0.58879197", "0.583516", "0.5808286", "0.57941294...
0.0
-1
funcion que reinicia el cronometro desde 0
function reset(){ window.clearInterval(timer) count = 0; // reinicia desde 0 esta fuera del contador principal chronometre.innerHTML = count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inicializaCronometro() {\n\t\n\tcampo.one(\"focus\", function () { // a função one descarta eventos iguais seguintes\n//campo.on(\"focus\", function () { // a função on capta o 1º e todos os eventos posteriores\n\t\tvar tempoRestanteSPAN = $(\"#tempo-digitacao\");\n\t\tvar tempoRestante = tempoRestanteSPA...
[ "0.7165427", "0.6921866", "0.69150525", "0.68493015", "0.663943", "0.640949", "0.6209638", "0.6057614", "0.59472287", "0.5833526", "0.57887197", "0.57860214", "0.57778484", "0.5658321", "0.5643356", "0.5616707", "0.56120735", "0.56055814", "0.5596092", "0.55855334", "0.558048...
0.49681208
88
toggles menu style from none to block and vice versa
function toggleMenu() { var menu = document.getElementById('menu'); if (menu) { if (menu.style.display === "none") { menu.style.display = "block"; } else { menu.style.display = "none"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function menuToggle() {\n var s_options = DOM.options.style;\n var s_obutton = DOM.optionsButton.style;\n var s_content = DOM.container.style;\n\n if (s_options.display == \"\" || s_options.display == \"none\") {\n s_obutton.background = \"#1D8EC2\";\n s_options.display = \"block\";\n ...
[ "0.6976563", "0.6837331", "0.6821743", "0.6732825", "0.6667165", "0.6592242", "0.6580228", "0.6570265", "0.65371704", "0.65312874", "0.6512953", "0.6505019", "0.6499225", "0.6489242", "0.64814955", "0.6471558", "0.6471105", "0.64474756", "0.64261067", "0.6418619", "0.6412249"...
0.65150553
10
deletes menu style if inner width is greater then 910px and adds style if it is less than 910px
function unresponsiveIt() { var w = window.innerWidth; var menu = document.getElementById('menu'); if(w > 910) { menu.removeAttribute('style'); } else { if(!menu.hasAttribute('style')) { menu.style.display = "none"; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zoommerce_reduce_menu_width(target, maxval) {\n\t\tvar full_width = 0;\n\t\tjQuery(target).each(function( index ) { \n\t\t\tif((jQuery(this).width() + full_width) > maxval) {\n\t\t\t\tjQuery(this).remove();\n\t\t\t}\n\t\t\tfull_width = full_width + jQuery(this).width(); \n\t\t});\n\t}", "function fix...
[ "0.6426955", "0.64262205", "0.61829597", "0.61654186", "0.6131967", "0.6058456", "0.6046958", "0.60201263", "0.6006105", "0.60042626", "0.5994593", "0.59876513", "0.5986602", "0.5921952", "0.59200716", "0.5906168", "0.5901126", "0.5884823", "0.5884823", "0.5884242", "0.585055...
0.5836467
21
firebase authentications upload imege
function uploadImage(fileName){ // Create a root reference var ref = firebase.storage().ref(); const file = fileName.get(0).files[0] const name = (+new Date()) + '-' + file.name const metadata = { contentType: file.type } const task = ref.child(name).put(file, metadata) var image_url = ''; task .then(snapshot => snapshot.ref.getDownloadURL()) .then(url => { image_url = url ; console.log('image name : ' + name) console.log('image url : ' + image_url ); $('#showimg').attr('src',image_url) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "uploadPic(e){e.preventDefault();this.disableUploadUi(true);var imageCaption=this.imageCaptionInput.val();this.generateImages().then(pics=>{// Upload the File upload to Firebase Storage and create new post.\nfriendlyPix.firebase.uploadNewPic(pics.full,pics.thumb,this.currentFile.name,imageCaption).then(postId=>{pag...
[ "0.6560675", "0.6305817", "0.624269", "0.61011344", "0.6066942", "0.6059108", "0.600547", "0.5945225", "0.5942427", "0.5942397", "0.5903922", "0.58726823", "0.5871168", "0.58657265", "0.5861364", "0.58466053", "0.5845028", "0.58172005", "0.5794753", "0.5787748", "0.5767396", ...
0.0
-1
This hooks provides an easy way to toggle a boolean flag for React components. The main use case for this will be toggling the visibility of something. All the provided actions are guaranteed to never change.
function useToggle(defaultToggled) { var _a = react_1.useState(defaultToggled), toggled = _a[0], setToggled = _a[1]; var previous = useRefCache_1.useRefCache(toggled); var enable = react_1.useCallback(function () { if (!previous.current) { setToggled(true); } // disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); var disable = react_1.useCallback(function () { if (previous.current) { setToggled(false); } // disabled since useRefCache // eslint-disable-next-line react-hooks/exhaustive-deps }, []); var toggle = react_1.useCallback(function () { setToggled(function (prevVisible) { return !prevVisible; }); }, []); return [toggled, enable, disable, toggle, setToggled]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function useToggle(initialValue = false) {\n return useReducer((state) => !state, initialValue);\n }", "function toggle() {\n setIsToggledOn(prev => !prev)\n }", "function toggleVisibility() {\n setVisibility(isVisible => !isVisible);\n }", "function toggleVisibility() {\n setVisib...
[ "0.6426882", "0.6402232", "0.6319086", "0.6319086", "0.63146967", "0.63133144", "0.62943745", "0.62693316", "0.62507075", "0.62469745", "0.62299156", "0.622156", "0.6218546", "0.61967343", "0.61577326", "0.61526763", "0.6147466", "0.60926026", "0.6073071", "0.6019223", "0.601...
0.62812465
7
This Component is currently a WIP
function QUERY_POLL_RESULTS(pollId){ return gql` { poll(id:${pollId}){ title responses{ selection } } }` }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Component() { }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n ...
[ "0.6411473", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "0.6385544", "...
0.0
-1
Need to Aggregate Results, Transfering Load to Server May be better
function aggregate(arr) { var a = [], b = [], prev; for ( var i = 0; i < arr.length; i++ ) { if ( arr[i] !== prev ) { a.push(arr[i]); b.push(1); } else { b[b.length-1]++; } prev = arr[i]; } return b; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "aggregate(aggregateSteps) {\n return new Promise((res, rej) => {\n this.model.aggregate(aggregateSteps, (err, result) => {\n if (err) {\n return rej(err);\n }\n else {\n return res(result);\n }\n ...
[ "0.62260324", "0.6206334", "0.6167573", "0.59330964", "0.5926676", "0.5911214", "0.5895202", "0.58774596", "0.5843023", "0.5825346", "0.5808714", "0.57756174", "0.5750155", "0.5666822", "0.5640852", "0.56233287", "0.56208974", "0.5620738", "0.55973715", "0.55828196", "0.55783...
0.0
-1
Constructs a new event emitter instance.
function EventEmitter() { /** * Registered listeners. * @type {Object.<string,*>} * @private */ this._listeners = {}; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n }", "function EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n ...
[ "0.7668809", "0.7668809", "0.7648649", "0.7648649", "0.7648649", "0.7648649", "0.76392597", "0.76034755", "0.75937414", "0.7593319", "0.75529844", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.75167024", "0.74682486", "0.74186385", "0.7392862", "0.7...
0.0
-1
Throws a `Cancel` if cancellation has been requested.
function throwIfCancellationRequested(config) { if (config.cancelToken) { config.cancelToken.throwIfRequested(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async cancel() {\n throw new Error(this.cancelMessage);\n }", "cancel() {\n throw new Error(\"Not implemented.\")\n }", "isCanceled(cancelled) {\n if (cancelled) {\n throw new Error(\"Cancelled request\");\n }\n }", "function throwIfCancellationRequested(config) {\n ...
[ "0.79484594", "0.7737491", "0.75342494", "0.7447438", "0.7424596", "0.7386911", "0.7386911", "0.7386911", "0.7386911", "0.7386911", "0.7206988", "0.7168578", "0.71630925", "0.7162724", "0.7143389", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397495", "0.71397...
0.0
-1
Determine if we're running in a standard browser environment This allows axios to run in a web worker, and reactnative. Both environments support XMLHttpRequest, but not fully standard globals. web workers: typeof window > undefined typeof document > undefined reactnative: navigator.product > 'ReactNative' nativescript navigator.product > 'NativeScript' or 'NS'
function isStandardBrowserEnv() { if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) { return false; } return ( typeof window !== 'undefined' && typeof document !== 'undefined' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n ...
[ "0.80759513", "0.80718875", "0.8061416", "0.8040616", "0.80331844", "0.80331844", "0.8031049", "0.8020131" ]
0.0
-1
base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBase64() {\n var s = this.getDump();\n\n var ch =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var c1, c2, c3, e1, e2, e3, e4;\n var l = s.length;\n var i = 0;\n var r = \"\";\n\n do {\n c1 = s.charCodeAt(i);\n e1 = c1 >> 2;\n c2 = s.charCod...
[ "0.7704935", "0.73232865", "0.7285503", "0.72289795", "0.71821845", "0.7121846", "0.71039695", "0.7087322", "0.7060962", "0.6978246", "0.69750506", "0.69333935", "0.68980336", "0.68980336", "0.6893018", "0.68776006", "0.6873852", "0.6873852", "0.68521667", "0.6835299", "0.681...
0.0
-1
Expects r and s to be positive DER integers. The DER format uses the most significant bit as a sign bit (& 0x80). If the significant bit is set AND the integer is positive, a 0x00 is prepended. Examples: 0 => 0x00 1 => 0x01 1 => 0xff 127 => 0x7f 127 => 0x81 128 => 0x0080 128 => 0x80 255 => 0x00ff 255 => 0xff01 16300 => 0x3fac 16300 => 0xc054 62300 => 0x00f35c 62300 => 0xff0ca4
function encode (r, s) { var lenR = r.length var lenS = s.length if (lenR === 0) throw new Error('R length is zero') if (lenS === 0) throw new Error('S length is zero') if (lenR > 33) throw new Error('R length is too long') if (lenS > 33) throw new Error('S length is too long') if (r[0] & 0x80) throw new Error('R value is negative') if (s[0] & 0x80) throw new Error('S value is negative') if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded') if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded') var signature = Buffer.allocUnsafe(6 + lenR + lenS) // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] signature[0] = 0x30 signature[1] = signature.length - 2 signature[2] = 0x02 signature[3] = r.length r.copy(signature, 4) signature[4 + lenR] = 0x02 signature[5 + lenR] = s.length s.copy(signature, 6 + lenR) return signature }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode (r, s) {\n\t var lenR = r.length\n\t var lenS = s.length\n\t if (lenR === 0) throw new Error('R length is zero')\n\t if (lenS === 0) throw new Error('S length is zero')\n\t if (lenR > 33) throw new Error('R length is too long')\n\t if (lenS > 33) throw new Error('S length is too long')\n\t i...
[ "0.6717918", "0.6536851", "0.64941883", "0.645361", "0.6337883", "0.58806163", "0.584603", "0.5633133", "0.5474051", "0.5386055", "0.53648365", "0.5350876", "0.52888596", "0.5244996", "0.5232132", "0.52289146", "0.5219259", "0.52143675", "0.5202433", "0.5198171", "0.5176764",...
0.6521301
10
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prot...
[ "0.7398729", "0.7261122", "0.7261122", "0.69321644", "0.6614716", "0.6482389", "0.64594245", "0.6351272", "0.6344033", "0.6344033", "0.6322819", "0.6322819", "0.6123587", "0.61221385", "0.60969925", "0.60739726", "0.6069109", "0.60670304", "0.60664034", "0.60634947", "0.60634...
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new...
[ "0.6596565", "0.61714965", "0.60477644", "0.6025667", "0.5921966", "0.58883363", "0.58471066", "0.5780482", "0.5777901", "0.57056165", "0.5629252", "0.5589546", "0.557242", "0.5466943", "0.54559976", "0.5343446", "0.53264683", "0.53212196", "0.53055847", "0.5275151", "0.52675...
0.0
-1
Could use `inherits` module, but don't want to move from single file architecture yet.
function inherits (ctor, superCtor) { ctor.super_ = superCtor; var TempCtor = function () {}; TempCtor.prototype = superCtor.prototype; ctor.prototype = new TempCtor(); ctor.prototype.constructor = ctor; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inherit(){}", "function SuperclassBare() {}", "function SuperclassBare() {}", "function inherited() { }", "function inheritsFrom(child, parent){\nchild.prototype = Object.create(parent.prototype);\n}", "function inheritFrom(subfn,superfn) {\n\tvar r = function () {}\n\tr.prototype = superfn.prot...
[ "0.7401219", "0.72619385", "0.72619385", "0.6934079", "0.66181535", "0.64842397", "0.64601207", "0.63533044", "0.6344312", "0.6344312", "0.6324127", "0.6324127", "0.61254305", "0.61223876", "0.61002636", "0.6075639", "0.6069061", "0.6068982", "0.6067097", "0.6064537", "0.6064...
0.0
-1
CooleyTukey algorithm for FFT slightly revisited to rely on looping instead of recursion
function FFTM (x, y) { this.x = x; this.y = y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function FFTNayuki(n) {\n \n this.n = n;\n this.levels = -1;\n\n for (var i = 0; i < 32; i++) {\n if (1 << i == n) {\n this.levels = i; // Equal to log2(n)\n }\n }\n if (this.levels == -1) {\n throw \"Length is not a power of 2\";\n }\n\n this.cosTable = new...
[ "0.65954375", "0.6168972", "0.6044958", "0.6022759", "0.591924", "0.58853126", "0.5843347", "0.577806", "0.57772064", "0.5703021", "0.562801", "0.55890924", "0.5570078", "0.5464318", "0.54534", "0.5339202", "0.5326124", "0.5318228", "0.53027326", "0.52718914", "0.52644837", ...
0.0
-1
alternative to using Object.keys for old browsers
function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getKeys(obj) {\n return Object.keys(obj); // Yes it is builtin!\n }", "function Object_keys(obj) {\n\t if (Object.keys) return Object.keys(obj)\n\t else {\n\t var res = [];\n\t for (var key in obj) res.push(key);\n\t return res;\n\t }\n\t}", "function keys(obj){\n return Object....
[ "0.7384008", "0.731263", "0.7241272", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.7200854", "0.71108866", "0.6997259", "0.6959686", "0.6932814", "0.69273907", "0.6917455", "0.6880489", "0.68795663", "0.6870773", ...
0.0
-1
Do not cache `Buffer.isEncoding` when checking encoding names as some modules monkeypatch it to support additional encodings
function normalizeEncoding(enc) { var nenc = _normalizeEncoding(enc); if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); return nenc || enc; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function detectUTF8(txt) {\n if(txt) return txt.match(/([\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEF][\\x80-\\xBF][\\x80-\\xBF]|\\xF0[\\x90-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[\\xF1-\\xF7][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|\\xF8[\\x88-\\xBF][\\x80-\\xBF][\\x80-\\xBF][\\x80-\\xBF]|[...
[ "0.66366535", "0.65744627", "0.6534928", "0.64787394", "0.6463427", "0.6265117", "0.6263352", "0.62615985", "0.62555206", "0.6209522", "0.6144942", "0.6139519", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364", "0.6107364"...
0.0
-1
Checks the type of a UTF8 byte, whether it's ASCII, a leading byte, or a continuation byte. If an invalid byte is detected, 2 is returned.
function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; return byte >> 6 === 0x02 ? -1 : -2; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckByte(_byte) {\n if (_byte <= 0x7F) return 0;else if (_byte >> 5 === 0x06) return 2;else if (_byte >> 4 === 0x0E) return 3;else if (_byte >> 3 === 0x1E) return 4;\n return _byte >> 6 === 0x02 ? -1 : -2;\n} // Checks at most 3 bytes at the end of a Buffer in order to detect an", "function $lrG1...
[ "0.8007454", "0.79413825", "0.7896979", "0.78161865", "0.78161865", "0.77798647", "0.7769451", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668", "0.7756668",...
0.0
-1
Checks at most 3 bytes at the end of a Buffer in order to detect an incomplete multibyte UTF8 character. The total number of bytes (2, 3, or 4) needed to complete the UTF8 character (if applicable) are returned.
function utf8CheckIncomplete(self, buf, i) { var j = buf.length - 1; if (j < i) return 0; var nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 1; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } return nb; } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){...
[ "0.8212385", "0.8212385", "0.8134619", "0.8134619", "0.8054928", "0.8054928", "0.80309063", "0.80119467", "0.78480685", "0.7844014", "0.7777412", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.77512926", "0.7...
0.0
-1
Validates as many continuation bytes for a multibyte UTF8 character as needed or are available. If we see a noncontinuation byte where we expect one, we "replace" the validated continuation bytes we've seen so far with a single UTF8 replacement character ('\ufffd'), to match v8's UTF8 decoding behavior. The continuation byte check is included three times in the case where all of the continuation bytes for a character exist in the same buffer. It is also done this way as a slight performance increase instead of using a loop.
function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; return '\ufffd'; } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb;}if(--j<i||nb===-2)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){...
[ "0.7937871", "0.7937871", "0.74657726", "0.73097616", "0.73097616", "0.71145594", "0.6709752", "0.6588986", "0.6557973", "0.6544995", "0.6481389", "0.6435539", "0.63858587", "0.6272498", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114", "0.5986114"...
0.0
-1
Attempts to complete a multibyte UTF8 character using bytes from a Buffer.
function utf8FillLast(buf) { var p = this.lastTotal - this.lastNeed; var r = utf8CheckExtraBytes(this, buf, p); if (r !== undefined) return r; if (this.lastNeed <= buf.length) { buf.copy(this.lastChar, p, 0, this.lastNeed); return this.lastChar.toString(this.encoding, 0, this.lastTotal); } buf.copy(this.lastChar, p, 0, buf.length); this.lastNeed -= buf.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return '\\ufffd';}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return '\\ufffd';}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return '\\ufffd';}}}}// Attempts to complete a ...
[ "0.71276367", "0.70124817", "0.6781994", "0.67014897", "0.6564168", "0.6473516", "0.6473516", "0.6347521", "0.634379", "0.634379", "0.6313653", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", "0.6169375", ...
0.0
-1
Returns all complete UTF8 characters in a Buffer. If the Buffer ended on a partial character, the character's bytes are buffered until the required number of bytes are available.
function utf8Text(buf, i) { var total = utf8CheckIncomplete(this, buf, i); if (!this.lastNeed) return buf.toString('utf8', i); this.lastTotal = total; var end = buf.length - (total - this.lastNeed); buf.copy(this.lastChar, 0, end); return buf.toString('utf8', i, end); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[]
[]
0.0
-1
For UTF8, a replacement character is added when ending on a partial character.
function utf8End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) return r + '\ufffd'; return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString('utf8',i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString('utf8',i,end);}// For UTF-8, a replacement character is added when ending on a partial",...
[ "0.6675062", "0.6675062", "0.6231528", "0.6222556", "0.6221065", "0.6221065", "0.5836165", "0.58046544", "0.58046544", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.5802127", "0.56987494", "0.5690213", "0.5690213", "0.5660663", "0.5636449", ...
0.0
-1
UTF16LE typically needs two bytes per character, but even if we have an even number of bytes available, we need to check if we end on a leading/high surrogate. In that case, we need to wait for the next two bytes in order to decode the last character properly.
function utf16Text(buf, i) { if ((buf.length - i) % 2 === 0) { var r = buf.toString('utf16le', i); if (r) { var c = r.charCodeAt(r.length - 1); if (c >= 0xD800 && c <= 0xDBFF) { this.lastNeed = 2; this.lastTotal = 4; this.lastChar[0] = buf[buf.length - 2]; this.lastChar[1] = buf[buf.length - 1]; return r.slice(0, -1); } } return r; } this.lastNeed = 1; this.lastTotal = 2; this.lastChar[0] = buf[buf.length - 1]; return buf.toString('utf16le', i, buf.length - 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isUTF16 (data) {\n var i = 0\n var len = data && data.length\n var pos = null\n var b1, b2, next, prev\n\n if (len < 2) {\n if (data[0] > 0xFF) {\n return false\n }\n } else {\n b1 = data[0]\n b2 = data[1]\n if (b1 === 0xFF && // BOM (little-endian)\n ...
[ "0.69665134", "0.6921958", "0.6921958", "0.6815354", "0.67462623", "0.67462623", "0.67347175", "0.67347175", "0.67262256", "0.66409534" ]
0.0
-1
For UTF16LE we do not explicitly append special replacement characters if we end on a partial character, we simply let v8 handle that.
function utf16End(buf) { var r = buf && buf.length ? this.write(buf) : ''; if (this.lastNeed) { var end = this.lastTotal - this.lastNeed; return r + this.lastChar.toString('utf16le', 0, end); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $lrG1$var$utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.len...
[ "0.61745626", "0.61719906", "0.61677617", "0.6157869", "0.6157869", "0.6081929", "0.6043509", "0.58793575", "0.58793575", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5811206", "0.5790016", "0.5790016", "0.5742851", "0.570861", "0.5700932",...
0.0
-1
Pass bytes on through for singlebyte encodings (e.g. ascii, latin1, hex)
function simpleWrite(buf) { return buf.toString(this.encoding); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function utf8CheckExtraBytes(self,buf,p){if((buf[0]&0xC0)!==0x80){self.lastNeed=0;return\"\\uFFFD\";}if(self.lastNeed>1&&buf.length>1){if((buf[1]&0xC0)!==0x80){self.lastNeed=1;return\"\\uFFFD\";}if(self.lastNeed>2&&buf.length>2){if((buf[2]&0xC0)!==0x80){self.lastNeed=2;return\"\\uFFFD\";}}}}// Attempts to complete...
[ "0.63480157", "0.63194925", "0.6203319", "0.61778533", "0.6119751", "0.6044178", "0.5955961", "0.5948356", "0.59131217", "0.59131217", "0.59131217", "0.5899713", "0.58946466", "0.5892134", "0.5868687", "0.5868687", "0.5868687", "0.5868687", "0.5787701", "0.57683253", "0.57243...
0.0
-1
Encode a buffer as a base58check encoded string
function encode (payload) { var checksum = checksumFn(payload) return base58.encode(Buffer.concat([ payload, checksum ], payload.length + 4)) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode(buffer, version) {\n\tversion = version || 0\n\n\t// FIXME: `new Buffer(buffer)` is unnecessary if input is a Buffer\n\tvar version = new Buffer([ version ])\n\tvar payload = new Buffer(buffer)\n\n\tvar message = Buffer.concat([ version, payload ])\n\tvar checksum = sha256(message).slice(0, 4)\n\n\...
[ "0.7658369", "0.7200657", "0.70704764", "0.6996845", "0.6938743", "0.6932482", "0.68172807", "0.6767494", "0.6751692", "0.67067915", "0.670423", "0.6684465", "0.6655286", "0.65639096", "0.6387093", "0.630735", "0.62225014", "0.6030916", "0.6015538", "0.6015538", "0.6015538", ...
0.6869967
11