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
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to the fields on a type. This includes if a field has been removed from a type, if a field has changed type, or if a nonnull field is added to an input type.
function findFieldsThatChangedType(oldSchema, newSchema) { return [].concat(findFieldsThatChangedTypeOnObjectOrInterfaceTypes(oldSchema, newSchema), findFieldsThatChangedTypeOnInputObjectTypes(oldSchema, newSchema)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findFieldsThatChangedType(oldSchema, newSchema) {\n\t var oldTypeMap = oldSchema.getTypeMap();\n\t var newTypeMap = newSchema.getTypeMap();\n\n\t var breakingFieldChanges = [];\n\t Object.keys(oldTypeMap).forEach(function (typeName) {\n\t var oldType = oldTypeMap[typeName];\n\t var newType = new...
[ "0.81117535", "0.78107697", "0.77804893", "0.77804893", "0.7756349", "0.7756349", "0.77397376", "0.7731341", "0.7702492", "0.7565131", "0.73513144", "0.728823", "0.728823", "0.70311517", "0.70311517", "0.69454265", "0.68164635", "0.68164635", "0.68164635", "0.6685037", "0.668...
0.7791692
3
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to removing types from a union type.
function findTypesRemovedFromUnions(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var typesRemovedFromUnion = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) { return; } var typeNamesInNewUnion = Object.create(null); newType.getTypes().forEach(function (type) { typeNamesInNewUnion[type.name] = true; }); oldType.getTypes().forEach(function (type) { if (!typeNamesInNewUnion[type.name]) { typesRemovedFromUnion.push({ type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, description: type.name + ' was removed from union type ' + typeName + '.' }); } }); }); return typesRemovedFromUnion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findRemovedTypes(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n\n var breakingChanges = [];\n Object.keys(oldTypeMap).forEach(function (typeName) {\n if (!newTypeMap[typeName]) {\n breakingChanges.push({\n type: BreakingCh...
[ "0.795675", "0.795675", "0.7945895", "0.79275715", "0.78931415", "0.78279424", "0.71366733", "0.7054868", "0.70357794", "0.70357794", "0.7021732", "0.69486105", "0.69200313", "0.66691905", "0.6646488", "0.6608136", "0.6602106", "0.6602106", "0.64400434", "0.64400434", "0.6410...
0.79045427
5
Given two schemas, returns an Array containing descriptions of any dangerous changes in the newSchema related to adding types to a union type.
function findTypesAddedToUnions(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var typesAddedToUnion = []; Object.keys(newTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLUnionType) || !(newType instanceof _definition.GraphQLUnionType)) { return; } var typeNamesInOldUnion = Object.create(null); oldType.getTypes().forEach(function (type) { typeNamesInOldUnion[type.name] = true; }); newType.getTypes().forEach(function (type) { if (!typeNamesInOldUnion[type.name]) { typesAddedToUnion.push({ type: DangerousChangeType.TYPE_ADDED_TO_UNION, description: type.name + ' was added to union type ' + typeName + '.' }); } }); }); return typesAddedToUnion; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findTypesAddedToUnions(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var typesAddedToUnion = [];\n\n var _arr11 = Object.keys(newTypeMap);\n\n for (var _i11 = 0; _i11 < _arr11.length; _i11++) {\n var typeName = _arr11[_i11];\n va...
[ "0.78702915", "0.76301306", "0.7412617", "0.7412617", "0.74009883", "0.7070576", "0.7035441", "0.7035441", "0.7005445", "0.68193376", "0.68171537", "0.68171537", "0.6798756", "0.6781975", "0.6781975", "0.6754903", "0.65813017", "0.6446255", "0.6431304", "0.63871443", "0.63271...
0.7796355
1
Given two schemas, returns an Array containing descriptions of any breaking changes in the newSchema related to removing values from an enum type.
function findValuesRemovedFromEnums(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var valuesRemovedFromEnums = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) { return; } var valuesInNewEnum = Object.create(null); newType.getValues().forEach(function (value) { valuesInNewEnum[value.name] = true; }); oldType.getValues().forEach(function (value) { if (!valuesInNewEnum[value.name]) { valuesRemovedFromEnums.push({ type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, description: value.name + ' was removed from enum type ' + typeName + '.' }); } }); }); return valuesRemovedFromEnums; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findValuesRemovedFromEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesRemovedFromEnums = [];\n\n var _arr12 = Object.keys(oldTypeMap);\n\n for (var _i12 = 0; _i12 < _arr12.length; _i12++) {\n var typeName = _arr12[_i12]...
[ "0.7888479", "0.77966124", "0.7791469", "0.7791469", "0.7784727", "0.77698714", "0.7019526", "0.701425", "0.6918426", "0.6918426", "0.68979543", "0.68979543", "0.68916214", "0.6875969", "0.682712", "0.675889", "0.67334795", "0.66772974", "0.654103", "0.654103", "0.6487319", ...
0.7840628
2
Given two schemas, returns an Array containing descriptions of any dangerous changes in the newSchema related to adding values to an enum type.
function findValuesAddedToEnums(oldSchema, newSchema) { var oldTypeMap = oldSchema.getTypeMap(); var newTypeMap = newSchema.getTypeMap(); var valuesAddedToEnums = []; Object.keys(oldTypeMap).forEach(function (typeName) { var oldType = oldTypeMap[typeName]; var newType = newTypeMap[typeName]; if (!(oldType instanceof _definition.GraphQLEnumType) || !(newType instanceof _definition.GraphQLEnumType)) { return; } var valuesInOldEnum = Object.create(null); oldType.getValues().forEach(function (value) { valuesInOldEnum[value.name] = true; }); newType.getValues().forEach(function (value) { if (!valuesInOldEnum[value.name]) { valuesAddedToEnums.push({ type: DangerousChangeType.VALUE_ADDED_TO_ENUM, description: value.name + ' was added to enum type ' + typeName + '.' }); } }); }); return valuesAddedToEnums; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findValuesAddedToEnums(oldSchema, newSchema) {\n var oldTypeMap = oldSchema.getTypeMap();\n var newTypeMap = newSchema.getTypeMap();\n var valuesAddedToEnums = [];\n\n var _arr13 = Object.keys(oldTypeMap);\n\n for (var _i13 = 0; _i13 < _arr13.length; _i13++) {\n var typeName = _arr13[_i13];\n v...
[ "0.7961201", "0.7452213", "0.7186998", "0.7186998", "0.7143121", "0.6903845", "0.6899022", "0.68724793", "0.68724793", "0.68663436", "0.6860933", "0.6849344", "0.6849344", "0.68405265", "0.6779417", "0.67071426", "0.6547236", "0.65066653", "0.64276445", "0.63447815", "0.63329...
0.7793059
1
Create a lookup array where anything but characters in `chars` string and alphanumeric chars is percentencoded.
function getEncodeCache(exclude) { var i, ch, cache = encodeCache[exclude]; if (cache) { return cache; } cache = encodeCache[exclude] = []; for (i = 0; i < 128; i++) { ch = String.fromCharCode(i); if (/^[0-9a-z]$/i.test(ch)) { // always allow unencoded alphanumeric characters cache.push(ch); } else { cache.push('%' + ('0' + i.toString(16).toUpperCase()).slice(-2)); } } for (i = 0; i < exclude.length; i++) { cache[exclude.charCodeAt(i)] = exclude[i]; } return cache; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encodeReserved(str) {\n return str\n .split(/(%[0-9A-Fa-f]{2})/g)\n .map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part).replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n }\n return part;\n })\n .join(\"\");\n}", "f...
[ "0.5715229", "0.5715229", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.563952", "0.52993435", "0.5293197", "0.52926946", "0.52698267", "0.5252457", "0.52500165", "0.52387434", "0.52289...
0.0
-1
Encode unsafe characters with percentencoding, skipping already encoded sequences. string string to encode exclude list of characters to ignore (in addition to azAZ09) keepEscaped don't encode '%' in a correct escape sequence (default: true)
function encode(string, exclude, keepEscaped) { var i, l, code, nextCode, cache, result = ''; if (typeof exclude !== 'string') { // encode(string, keepEscaped) keepEscaped = exclude; exclude = encode.defaultChars; } if (typeof keepEscaped === 'undefined') { keepEscaped = true; } cache = getEncodeCache(exclude); for (i = 0, l = string.length; i < l; i++) { code = string.charCodeAt(i); if (keepEscaped && code === 0x25 /* % */ && i + 2 < l) { if (/^[0-9a-f]{2}$/i.test(string.slice(i + 1, i + 3))) { result += string.slice(i, i + 3); i += 2; continue; } } if (code < 128) { result += cache[code]; continue; } if (code >= 0xD800 && code <= 0xDFFF) { if (code >= 0xD800 && code <= 0xDBFF && i + 1 < l) { nextCode = string.charCodeAt(i + 1); if (nextCode >= 0xDC00 && nextCode <= 0xDFFF) { result += encodeURIComponent(string[i] + string[i + 1]); i++; continue; } } result += '%EF%BF%BD'; continue; } result += encodeURIComponent(string[i]); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function encode(string, exclude, keepEscaped) {\n var i,\n l,\n code,\n nextCode,\n cache,\n result = '';\n\n if (typeof exclude !== 'string') {\n // encode(string, keepEscaped)\n keepEscaped = exclude;\n exclude = encode.defaultChars;\n }\n\n if (typeof keepEscaped === 'undef...
[ "0.70509595", "0.7022723", "0.69763297", "0.69763297", "0.6932053", "0.69195807", "0.69184864", "0.6918012", "0.6918012", "0.685554", "0.685554", "0.68133795", "0.67973626", "0.6783974", "0.6783863", "0.6750289", "0.674726", "0.674726", "0.674726", "0.67047244", "0.669837", ...
0.6875842
21
Helper function to produce an HTML tag.
function tag(name, attrs, selfclosing) { if (this.disableTags > 0) { return; } this.buffer += ('<' + name); if (attrs && attrs.length > 0) { var i = 0; var attrib; while ((attrib = attrs[i]) !== undefined) { this.buffer += (' ' + attrib[0] + '="' + attrib[1] + '"'); i++; } } if (selfclosing) { this.buffer += ' /'; } this.buffer += '>'; this.lastOut = '>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateTagHTML (tag){//generates HTML for a given tag\n return `<li class='tag'><div class='tag-box'>${tag}</div></li>`;\n}", "function makeTag (tagName, strValue) {\n return \"<\"+tagName+\">\"+strValue+\"</\"+tagName+\">\"\n}", "function construct_tag(tag_name){\n render_tag = '<li class=\"post_...
[ "0.7636893", "0.7044232", "0.6863288", "0.6822727", "0.6554763", "0.6554763", "0.65362567", "0.652912", "0.64953357", "0.6466779", "0.6429916", "0.64055514", "0.64045453", "0.6374015", "0.63322645", "0.6286156", "0.624827", "0.62282234", "0.62282234", "0.62115824", "0.6124934...
0.63478655
15
Helper function to produce an XML tag.
function tag(name, attrs, selfclosing) { var result = '<' + name; if(attrs && attrs.length > 0) { var i = 0; var attrib; while ((attrib = attrs[i]) !== undefined) { result += ' ' + attrib[0] + '="' + this.esc(attrib[1]) + '"'; i++; } } if(selfclosing) { result += ' /'; } result += '>'; return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTag (tagName, strValue) {\n return \"<\"+tagName+\">\"+strValue+\"</\"+tagName+\">\"\n}", "function generateTagHTML (tag){//generates HTML for a given tag\n return `<li class='tag'><div class='tag-box'>${tag}</div></li>`;\n}", "function tag(name, attrs, selfclosing) {\n if (this.disableTags > 0...
[ "0.68416274", "0.6388546", "0.6172389", "0.6172389", "0.6143003", "0.6018994", "0.6016187", "0.59621674", "0.5952655", "0.5907922", "0.5903759", "0.58211493", "0.58099604", "0.58099604", "0.5798369", "0.5760406", "0.57307625", "0.57222605", "0.5701785", "0.5634361", "0.561980...
0.6426543
2
Hint: it may be helpful to get the height of your BST
function isBalanced(root) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BSTHeight(tree) {\n if (!tree.key) return 0;\n \n let left = 0, right = 0;\n\n if (!tree.left && !tree.right) {\n return 1;\n }\n \n if (tree.left) {\n left = BSTHeight(tree.left);\n }\n\n if (tree.right) {\n right = BSTHeight(tree.right);\n }\n\n return Math.max(left, right) + 1;\n}",...
[ "0.79384416", "0.7804322", "0.7765133", "0.7689893", "0.7654854", "0.76354414", "0.7625294", "0.75867087", "0.75360733", "0.7525977", "0.75185895", "0.7499543", "0.7476348", "0.74641347", "0.7440004", "0.74331814", "0.7379618", "0.735894", "0.7308425", "0.7269455", "0.7248694...
0.0
-1
If the subscription(s) have been received, render the page, otherwise show a loading icon.
render() { return (this.props.ready) ? this.renderPage() : <Loader active>Getting data</Loader>; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showLoading() {\n if (loadingMessageId === null) {\n loadingMessageId = rcmail.display_message('loading', 'loading');\n }\n }", "render() {\n return (this.props.ready) ? this.renderPage() : <Loader>Getting data</Loader>;\n }", "render() {\n return (this.props.read...
[ "0.6480619", "0.6350569", "0.6349684", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "0.6306368", "...
0.629345
36
Render the page once subscriptions have been received.
renderPage() { const shows = Anime.collection.find({}).fetch(); return ( <div className="gray-background"> <Container> <Header as="h2" textAlign="center">AniMoo List</Header> <Table celled> <Table.Header> <Table.Row> <Table.HeaderCell>Title</Table.HeaderCell> <Table.HeaderCell>Image</Table.HeaderCell> <Table.HeaderCell>Summary</Table.HeaderCell> <Table.HeaderCell>Episodes</Table.HeaderCell> <Table.HeaderCell>Rating</Table.HeaderCell> <Table.HeaderCell>Add To Favorites</Table.HeaderCell> </Table.Row> </Table.Header> <Table.Body> {this.props.anime.slice((this.state.activePage - 1) * 25, this.state.activePage * 25).map((show) => <AnimeItem key={show._id} anime={show} />)} </Table.Body> </Table> <Pagination activePage={this.activePage} totalPages={Math.ceil(shows.length / 25)} firstItem={{ content: <Icon name='angle double left'/>, icon: true }} lastItem={{ content: <Icon name='angle double right'/>, icon: true }} prevItem={{ content: <Icon name='angle left'/>, icon: true }} nextItem={{ content: <Icon name='angle right'/>, icon: true }} onPageChange={this.handlePageChange} /> </Container> </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleAPILoaded()\n{\n requestSubscriptionList();\n}", "function _render(){\n\t\tinfo = {\n\t\t\t\tpublishers_array: publishers_array\n\t\t}\n\t\t$element.html(Mustache.render(template, info))\n\t}", "function dataSubmittedPage() {\r\n app.getView().render('subscription/emarsys_datasubmitted');\...
[ "0.6166739", "0.6032917", "0.5972155", "0.5954931", "0.5884055", "0.583181", "0.57925886", "0.5769471", "0.5769471", "0.5769471", "0.56891847", "0.5639037", "0.5632166", "0.56310517", "0.56310517", "0.5630244", "0.5607981", "0.55974364", "0.55900705", "0.5580156", "0.5557037"...
0.0
-1
Wait for the window to finish loading
function loadListener() { window.removeEventListener("load", loadListener, false); AlwaysReader.init(window); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function window_OnLoad() {\n await initialLoad();\n}", "function waitViewerToLoad() {\n\t\tif(!document.VLVChart)\n\t\t{\n\t\t\t// not loaded, try again in 200ms\n\t\t\tsetTimeout(waitViewerToLoad, 200);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// loaded. Poll events\n\t\t\tobjChart = document.VLVChart;\n\t\t\tPo...
[ "0.71897006", "0.67051417", "0.6670822", "0.6446899", "0.64305687", "0.64215", "0.63693374", "0.63647753", "0.63168645", "0.6312839", "0.6277075", "0.6274329", "0.6229013", "0.6201349", "0.6194943", "0.6186003", "0.6175848", "0.6147557", "0.61468637", "0.6143661", "0.6128239"...
0.0
-1
Perform the analysis. This must be called before writeTypingsFile().
analyze() { if (this._astEntryPoint) { throw new Error('DtsRollupGenerator.analyze() was already called'); } // Build the entry point const sourceFile = this._context.package.getDeclaration().getSourceFile(); this._astEntryPoint = this._astSymbolTable.fetchEntryPoint(sourceFile); const exportedAstSymbols = []; // Create a DtsEntry for each top-level export for (const exportedMember of this._astEntryPoint.exportedMembers) { const astSymbol = exportedMember.astSymbol; this._createDtsEntryForSymbol(exportedMember.astSymbol, exportedMember.name); exportedAstSymbols.push(astSymbol); } // Create a DtsEntry for each indirectly referenced export. // Note that we do this *after* the above loop, so that references to exported AstSymbols // are encountered first as exports. const alreadySeenAstSymbols = new Set(); for (const exportedAstSymbol of exportedAstSymbols) { this._createDtsEntryForIndirectReferences(exportedAstSymbol, alreadySeenAstSymbols); } this._makeUniqueNames(); this._dtsEntries.sort((a, b) => a.getSortKey().localeCompare(b.getSortKey())); this._dtsTypeDefinitionReferences.sort(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "postAnalysis() { }", "processTypings(files) {\n // Set hashes of the app's typings.\n files.forEach(file => {\n let isAppTypings = this.isDeclarationFile(file) &&\n !this.isPackageFile(file);\n\n let path = file.getPathInPackage();\n if (isAppTypings && !this._typingsMap.has(path)) {\...
[ "0.5682125", "0.55620515", "0.5528616", "0.54487497", "0.5186837", "0.51358396", "0.50535023", "0.50306", "0.49961954", "0.49456286", "0.4872391", "0.48717216", "0.48588556", "0.48485678", "0.48256865", "0.48208138", "0.47816533", "0.4761912", "0.46887577", "0.46489328", "0.4...
0.59221
0
Generates the typings file and writes it to disk.
writeTypingsFile(dtsFilename, dtsKind) { const indentedWriter = new IndentedWriter_1.IndentedWriter(); this._generateTypingsFileContent(indentedWriter, dtsKind); node_core_library_1.FileSystem.writeFile(dtsFilename, indentedWriter.toString(), { convertLineEndings: "\r\n" /* CrLf */, ensureFolderExists: true }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function typings() {\n const tmpDir = './typings/tmp';\n const blocklySrcs = [\n \"core/\",\n \"core/components\",\n \"core/components/tree\",\n \"core/components/menu\",\n \"core/keyboard_nav\",\n \"core/renderers/common\",\n \"core/renderers/measurables\",\n \"core/theme\",\n \"core/...
[ "0.7189702", "0.6461203", "0.6074944", "0.5802386", "0.57882553", "0.5659313", "0.55635446", "0.5557573", "0.54775023", "0.5312856", "0.52679414", "0.52399546", "0.5210028", "0.51979256", "0.51685524", "0.51669836", "0.5165133", "0.5160877", "0.5146327", "0.51181906", "0.5097...
0.729225
0
Ensures a unique name for each item in the package typings file.
_makeUniqueNames() { const usedNames = new Set(); // First collect the explicit package exports for (const dtsEntry of this._dtsEntries) { if (dtsEntry.exported) { if (usedNames.has(dtsEntry.originalName)) { // This should be impossible throw new Error(`Program bug: a package cannot have two exports with the name ${dtsEntry.originalName}`); } dtsEntry.nameForEmit = dtsEntry.originalName; usedNames.add(dtsEntry.nameForEmit); } } // Next generate unique names for the non-exports that will be emitted for (const dtsEntry of this._dtsEntries) { if (!dtsEntry.exported) { let suffix = 1; dtsEntry.nameForEmit = dtsEntry.originalName; while (usedNames.has(dtsEntry.nameForEmit)) { dtsEntry.nameForEmit = `${dtsEntry.originalName}_${++suffix}`; } usedNames.add(dtsEntry.nameForEmit); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "processTypings(files) {\n // Set hashes of the app's typings.\n files.forEach(file => {\n let isAppTypings = this.isDeclarationFile(file) &&\n !this.isPackageFile(file);\n\n let path = file.getPathInPackage();\n if (isAppTypings && !this._typingsMap.has(path)) {\n this._typingsMa...
[ "0.58403444", "0.57442", "0.5719649", "0.5575649", "0.5575649", "0.5556027", "0.5556027", "0.5552457", "0.5389013", "0.52895075", "0.5261061", "0.5215282", "0.5211531", "0.5206816", "0.5181104", "0.50838786", "0.50370914", "0.50254107", "0.49946228", "0.49946228", "0.4979858"...
0.68521297
0
Before writing out a declaration, _modifySpan() applies various fixups to make it nice.
_modifySpan(span, dtsEntry, astDeclaration, dtsKind) { const previousSpan = span.previousSibling; let recurseChildren = true; switch (span.kind) { case ts.SyntaxKind.JSDocComment: // If the @packagedocumentation comment seems to be attached to one of the regular API items, // omit it. It gets explictly emitted at the top of the file. if (span.node.getText().match(/(?:\s|\*)@packagedocumentation(?:\s|\*)/g)) { span.modification.skipAll(); } // For now, we don't transform JSDoc comment nodes at all recurseChildren = false; break; case ts.SyntaxKind.ExportKeyword: case ts.SyntaxKind.DefaultKeyword: case ts.SyntaxKind.DeclareKeyword: // Delete any explicit "export" or "declare" keywords -- we will re-add them below span.modification.skipAll(); break; case ts.SyntaxKind.InterfaceKeyword: case ts.SyntaxKind.ClassKeyword: case ts.SyntaxKind.EnumKeyword: case ts.SyntaxKind.NamespaceKeyword: case ts.SyntaxKind.ModuleKeyword: case ts.SyntaxKind.TypeKeyword: case ts.SyntaxKind.FunctionKeyword: // Replace the stuff we possibly deleted above let replacedModifiers = ''; // Add a declare statement for root declarations (but not for nested declarations) if (!astDeclaration.parent) { replacedModifiers += 'declare '; } if (dtsEntry.exported) { replacedModifiers = 'export ' + replacedModifiers; } if (previousSpan && previousSpan.kind === ts.SyntaxKind.SyntaxList) { // If there is a previous span of type SyntaxList, then apply it before any other modifiers // (e.g. "abstract") that appear there. previousSpan.modification.prefix = replacedModifiers + previousSpan.modification.prefix; } else { // Otherwise just stick it in front of this span span.modification.prefix = replacedModifiers + span.modification.prefix; } break; case ts.SyntaxKind.VariableDeclaration: if (!span.parent) { // The VariableDeclaration node is part of a VariableDeclarationList, however // the Entry.followedSymbol points to the VariableDeclaration part because // multiple definitions might share the same VariableDeclarationList. // // Since we are emitting a separate declaration for each one, we need to look upwards // in the ts.Node tree and write a copy of the enclosing VariableDeclarationList // content (e.g. "var" from "var x=1, y=2"). const list = TypeScriptHelpers_1.TypeScriptHelpers.matchAncestor(span.node, [ts.SyntaxKind.VariableDeclarationList, ts.SyntaxKind.VariableDeclaration]); if (!list) { throw new Error('Unsupported variable declaration'); } const listPrefix = list.getSourceFile().text .substring(list.getStart(), list.declarations[0].getStart()); span.modification.prefix = 'declare ' + listPrefix + span.modification.prefix; span.modification.suffix = ';'; } break; case ts.SyntaxKind.Identifier: let nameFixup = false; const identifierSymbol = this._typeChecker.getSymbolAtLocation(span.node); if (identifierSymbol) { const followedSymbol = TypeScriptHelpers_1.TypeScriptHelpers.followAliases(identifierSymbol, this._typeChecker); const referencedDtsEntry = this._dtsEntriesBySymbol.get(followedSymbol); if (referencedDtsEntry) { if (!referencedDtsEntry.nameForEmit) { // This should never happen throw new Error('referencedEntry.uniqueName is undefined'); } span.modification.prefix = referencedDtsEntry.nameForEmit; nameFixup = true; // For debugging: // span.modification.prefix += '/*R=FIX*/'; } } if (!nameFixup) { // For debugging: // span.modification.prefix += '/*R=KEEP*/'; } break; } if (recurseChildren) { for (const child of span.children) { let childAstDeclaration = astDeclaration; // Should we trim this node? let trimmed = false; if (SymbolAnalyzer_1.SymbolAnalyzer.isAstDeclaration(child.kind)) { childAstDeclaration = this._astSymbolTable.getChildAstDeclarationByNode(child.node, astDeclaration); const releaseTag = this._getReleaseTagForAstSymbol(childAstDeclaration.astSymbol); if (!this._shouldIncludeReleaseTag(releaseTag, dtsKind)) { const modification = child.modification; // Yes, trim it and stop here const name = childAstDeclaration.astSymbol.localName; modification.omitChildren = true; modification.prefix = `/* Excluded from this release type: ${name} */`; modification.suffix = ''; if (child.children.length > 0) { // If there are grandchildren, then keep the last grandchild's separator, // since it often has useful whitespace modification.suffix = child.children[child.children.length - 1].separator; } if (child.nextSibling) { // If the thing we are trimming is followed by a comma, then trim the comma also. // An example would be an enum member. if (child.nextSibling.kind === ts.SyntaxKind.CommaToken) { // Keep its separator since it often has useful whitespace modification.suffix += child.nextSibling.separator; child.nextSibling.modification.skipAll(); } } trimmed = true; } } if (!trimmed) { this._modifySpan(child, dtsEntry, childAstDeclaration, dtsKind); } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function attachLocalSpans(doc, change, from, to) {\n\t\t var existing = change[\"spans_\" + doc.id], n = 0;\n\t\t doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n\t\t if (line.markedSpans)\n\t\t { (existing || (existing = change[\"spans_\" + doc.id] = {}...
[ "0.57268137", "0.57213247", "0.5699011", "0.56869346", "0.56869346", "0.56869346", "0.5681026", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.5663481", "0.56591445", "0.56591445", "0.565914...
0.73561174
0
NOTE: THIS IS A TEMPORARY WORKAROUND. In the near future we will overhaul the AEDoc parser to separate syntactic/semantic analysis, at which point this will be wired up to the same ApiDocumentation layer used for the API Review files
_getReleaseTagForDeclaration(declaration) { let releaseTag = ReleaseTag_1.ReleaseTag.None; // We don't want to match "bill@example.com". But we do want to match "/**@public*/". // So for now we require whitespace or a star before/after the string. const releaseTagRegExp = /(?:\s|\*)@(internal|alpha|beta|public)(?:\s|\*)/g; const sourceFileText = declaration.getSourceFile().text; for (const commentRange of TypeScriptHelpers_1.TypeScriptHelpers.getJSDocCommentRanges(declaration, sourceFileText) || []) { // NOTE: This string includes "/**" const comment = sourceFileText.substring(commentRange.pos, commentRange.end); let match; while (match = releaseTagRegExp.exec(comment)) { let foundReleaseTag = ReleaseTag_1.ReleaseTag.None; switch (match[1]) { case 'internal': foundReleaseTag = ReleaseTag_1.ReleaseTag.Internal; break; case 'alpha': foundReleaseTag = ReleaseTag_1.ReleaseTag.Alpha; break; case 'beta': foundReleaseTag = ReleaseTag_1.ReleaseTag.Beta; break; case 'public': foundReleaseTag = ReleaseTag_1.ReleaseTag.Public; break; } if (releaseTag !== ReleaseTag_1.ReleaseTag.None && foundReleaseTag !== releaseTag) { // this._analyzeWarnings.push('WARNING: Conflicting release tags found for ' + symbol.name); return releaseTag; } releaseTag = foundReleaseTag; } } return releaseTag; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function exportIodocs(src){\n var obj = clone(src,false);\n obj.swagger = '2.0';\n obj.info = {};\n obj.info.version = obj.version || '1';\n obj.info.title = obj.name;\n obj.info.description = obj.description;\n obj.paths = {};\n\n var u = url.parse(obj.basePath+obj.publicPath);\n obj.sc...
[ "0.6819972", "0.6600354", "0.6525554", "0.64226204", "0.62938106", "0.61691725", "0.61278695", "0.59683883", "0.58856326", "0.587375", "0.5792791", "0.5733502", "0.5733502", "0.572565", "0.572565", "0.569983", "0.5597127", "0.5591373", "0.55203974", "0.5476188", "0.5469906", ...
0.0
-1
Two numbers are relatively prime if their greatest common factor is 1. In other worst if they cannot be divided by any common numbers other than 1, they are relatively prime. 13, 16, 9, 5, an 119 are all relatively prime because there share no common factors except for 1, to easily see this I will show their factorizations, 13, 2 x 2 x 2 x 2, 3 x 3, 5, 17 x 7 Create a function that takes 2 inputs, an number, n and a list, l. The function should return a list of all the numbers in l that are relatively prime to n. n and all numbers in l will be positive integers greater than or equal to 0. Some examples: relatively_prime(8, [1,2,3,4,5,6,7]) >>> [1,3,5,7] relatively_prime(15, [72,27,32,61,77,11,40]) >>> [32, 61, 77, 11, 40] relatively_prime(210, [15,100,2222222,6,4,12369,99]) >>> []
function gcd(a,b) { return (b===0) ? a : gcd( b, a%b); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function smallestPrimeOf(n) {\n for(let i=2; i<Math.ceil(Math.sqrt(n)); i++) {\n if(n % i == 0) {\n return i;\n }\n }\n return n;\n}", "function nextPrime(n){\n if(n === 0){return 2;}\n var answer = 0;\n function isPrime(num, start) {\n for ( var i = 2; i < num; i++ ) {\n ...
[ "0.6503214", "0.6483699", "0.6259035", "0.6149936", "0.6098556", "0.6085731", "0.6061442", "0.6059811", "0.60493255", "0.60318154", "0.59825945", "0.5920506", "0.589946", "0.5890826", "0.5889013", "0.5868843", "0.5868289", "0.5864898", "0.5863611", "0.58463246", "0.58426946",...
0.0
-1
No sockets in minscripten
function adjtimex(tx) { const [mode, result] = readUint(tx); if (!result) return -EFAULT; if (mode !== 0 && mode !== ADJ_OFFSET_SS_READ) return -EPERM; if (!writeFill(tx, 0, sizeofTimex)) return -EFAULT; return TIME_OK; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Socket() {}", "initSockets() {\n ;\n }", "function settaSocket(s){\r\n\t\"use strict\";\r\n\tsocket=s;\r\n}", "function on_socket_get(message) {\"use strict\"; }", "function Server() {}", "__ssl() {\n /// TODO: nothing, I guess?\n }", "function wst_client() {\n this.tcpServe...
[ "0.6149176", "0.61252487", "0.59384966", "0.56086254", "0.559202", "0.5523177", "0.55183905", "0.54619616", "0.5425321", "0.5383393", "0.53784853", "0.53077674", "0.5256524", "0.52435595", "0.5237733", "0.5230596", "0.5208514", "0.5205358", "0.518955", "0.51776093", "0.513549...
0.0
-1
No multiprocess in minscripten
function exit(status) { throw new ExitException(status); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isProcessableParallel() {\n return false;\n }", "process() {}", "process() {}", "function singleThread() {\n\n process.argv[2] = 'estoy programando en node.js';\n process.argv[3] = 2+5;\n \n\n console.log('-------------------------------------------');\n console.log('EL PROCESO DE NODE.JS'...
[ "0.584577", "0.5704992", "0.5704992", "0.5629925", "0.54633343", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.54133075", "0.5406037", "0.5295608", "0.5294036", "0.5263957", "0.51970196", "0.51805997", "0.5130743", "0.5126131", "0.5124282", "0.51148...
0.0
-1
another method for opposite function
function opposite(d1, d2){ let dic={'NORTH':'SOUTH', 'WEST':'EAST', 'SOUTH':'NORTH', 'EAST':'WEST'} //if (dic[d1]===d2) return true return dic[d1]===d2 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function opposite(t, a, b) {\n\t\t\treturn t[0] != a && t[0] != b ? t[0] : t[1] != a && t[1] != b ? t[1] : t[2];\n\t\t}", "function opposite(number) {\n //your code here\n return -number;\n}", "function opposite(number) {\n return -number;\n}", "function opposite(number) {\n return(-number);\n}", "fu...
[ "0.7713208", "0.74177945", "0.7300315", "0.72357374", "0.7231619", "0.7230499", "0.7105349", "0.7087361", "0.66610557", "0.663712", "0.6598386", "0.65563947", "0.6515124", "0.648685", "0.64836067", "0.64836067", "0.6464711", "0.6440583", "0.6440583", "0.6418673", "0.6336347",...
0.0
-1
Some things to restore the previous session's selection
function scriptPath() { try { return app.activeScript; } catch (e) { return File(e.fileName); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function selectionRestore() {\n if (savedSelection) {\n rangy.restoreSelection(savedSelection);\n savedSelection = false;\n }\n}", "function restoreOptions() {\n var i, len, elements, elem, setting, set;\n\n elements = mainview.querySelectorAll('#skinSection input');\n fo...
[ "0.8070127", "0.69869334", "0.6934845", "0.69180346", "0.6888552", "0.68706656", "0.6828675", "0.6809891", "0.6706013", "0.6687331", "0.6664929", "0.6613561", "0.66055036", "0.6592532", "0.65911496", "0.6523383", "0.6508823", "0.64703935", "0.64642227", "0.6448113", "0.639022...
0.0
-1
Convert an array of ListItems to an array of strings
function getQueryNames(sel) { var arr = []; for (var i = 0; i < sel.length; i++) { arr.push(sel[i].text); } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStringArray(items) {\n // Return empty array if undefined or null\n if (!items) return [];\n // If string, split by commas\n if (typeof items === \"string\") items = items.split(\",\");\n // Trim and convert all to lowercase\n var length = items.length;\n ...
[ "0.68316925", "0.67684793", "0.6746222", "0.67011017", "0.6582725", "0.65249354", "0.64473766", "0.64360195", "0.6361075", "0.62616557", "0.6246455", "0.6209374", "0.604988", "0.6044432", "0.59681624", "0.58981097", "0.58836764", "0.58815295", "0.58758014", "0.5857577", "0.58...
0.0
-1
Create an array of GREP queries from the app and the user folder
function findQueries(queryType) { function findQueriesSub(dir) { var f = Folder(dir).getFiles('*.xml'); return f; } var indesignFolder = function() { if ($.os.indexOf ('Mac') > -1) { return Folder.appPackage.parent; } else { return Folder.appPackage; } } var queryFolder = app.scriptPreferences.scriptsFolder.parent.parent + "/Find-Change Queries/" + searchTypeResults[queryType].folder + "/"; var appFolder = indesignFolder() + '/Presets/Find-Change Queries/' + searchTypeResults[queryType].folder + '/' + $.locale; // Create dummy separator file var dummy = File(queryFolder + "----------.xml"); dummy.open('w'); dummy.write(''); dummy.close(); var list = findQueriesSub(appFolder); list = list.concat(findQueriesSub(queryFolder)); for (var i = list.length - 1; i >= 0; i--) { list[i] = decodeURI(list[i].name.replace('.xml', '')); } searchTypeResults[queryType].results = list; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getUsers() {\n const users = [];\n return new Promise((resolve, reject) => {\n // Scan for keys starting with user:\n this.rdsCli.scan(0, 'MATCH', 'user:*', 'COUNT', 100, (err, reply) => {\n if (err) {\n reject();\n }\n\n const totalUsers = reply[1].length;\n le...
[ "0.55193484", "0.5497706", "0.5363746", "0.53192085", "0.52674216", "0.5230066", "0.51623124", "0.50635934", "0.5048695", "0.5041904", "0.4993227", "0.4981733", "0.49244386", "0.4919895", "0.49186534", "0.49010453", "0.489128", "0.48582524", "0.48229757", "0.4820361", "0.4813...
0.48040754
21
Local task progress bar
function createLocalProgressBar(message, total) { localProgressBar = new Window('palette', message, undefined, {closeButton:false}); localProgressBar.progressbar = localProgressBar.add('progressbar', undefined, 0, total); localProgressBar.progressbar.preferredSize.width = 300; localProgressBar.show(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function ProgressBar(timer) {\r\n var div = 100 / timer;\r\n percent = 0;\r\n\r\n var counterBack = setInterval(function () {\r\n percent += div;\r\n if (percent <= 100) {\r\n document.getElementById(\"PBar\").style.width = 0 + percent + \"%\";\r\n document.getEle...
[ "0.74066514", "0.7207696", "0.71808034", "0.7170998", "0.7129276", "0.712523", "0.7119566", "0.71169984", "0.71169984", "0.71169984", "0.71169984", "0.7077858", "0.7073955", "0.70446193", "0.70411485", "0.69790316", "0.69390196", "0.693149", "0.69177324", "0.6910491", "0.6907...
0.6632001
53
this one returns an array of all prime factors of a given number
function getAllFactorsFor(remainder) { var factors = [], i; for (i = 2; i <= remainder; i++) { while ((remainder % i) === 0) { factors.push(i); remainder /= i; } } return factors; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getPrimeFactors(num) {\n const solution = [];\n let divisor = 2;\n while (num > 2) {\n if (num % divisor === 0) {\n solution.push(divisor);\n num = num / divisor;\n } else divisor++;\n }\n return solution;\n}", "function get_prime_factors(number) {\n number = Math.floor(number);\n ...
[ "0.84773177", "0.841825", "0.8261534", "0.8256249", "0.8255569", "0.82413673", "0.8226271", "0.8195013", "0.81867373", "0.81858087", "0.81778604", "0.8174697", "0.8132914", "0.80744773", "0.80608726", "0.80603385", "0.80320275", "0.8021769", "0.79962844", "0.79853904", "0.798...
0.74810165
43
solution 1 this solution is not as efficient when combined with sieveOfEratosthenes
function isPrime(num) { if(num < 2) return false; for(let i=2; i < num; i++){ if(num%i===0) return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function problem10() {\n \"use strict\";\n var i, j, k, l, m, s, a; // i, j, k are counters, others are defined as we go\n l = Math.floor((2000000 - 1) / 2); //not sure why we're going halfway\n a = [];\n for (i = 0; i < l; i += 1) {\n a[i] = true; // make a whole bunch of numbers true\n }...
[ "0.7412198", "0.73908293", "0.7140912", "0.70860124", "0.7053972", "0.7002826", "0.6992587", "0.6902719", "0.6829928", "0.6818398", "0.6794026", "0.6762354", "0.66830647", "0.6665328", "0.6628076", "0.6616925", "0.6615266", "0.6578122", "0.6536002", "0.64150083", "0.63946134"...
0.0
-1
return all prime numbers from 0 to that number
function sieveOfEratosthenes(n) { let primes = []; for(let i=0; i <= n; i++) { if(isPrime(i)) primes.push(i); } return primes; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function primeNumbers(n) {\n let primes = [];\n\n nextPrime:\n for (let i = 2; i <= n; i++) {\n for (let j = 2; j < i; j++) {\n if (i % j === 0) {\n continue nextPrime;\n }\n }\n \n primes.push(i);\n }\n\n return primes;\n}", "function getPrimeNumbers(num) {\n let primes = []...
[ "0.74690133", "0.74147207", "0.7381841", "0.73522687", "0.7327391", "0.726779", "0.72537005", "0.7204794", "0.71823853", "0.71614563", "0.7159606", "0.7132848", "0.7123628", "0.70880824", "0.7079946", "0.70765793", "0.70729786", "0.70672655", "0.70388967", "0.7024804", "0.701...
0.7023341
20
You are given two positive integers a and b (a < b <= 20000). Complete the function which returns a list of all those numbers in the interval [a, b) whose digits are made up of prime numbers (2, 3, 5, 7) but which are not primes themselves. non prime single digit : 1, 4, 6, 8, 9
function notPrimes(a,b) { let nonPrimeArr = []; for(let i = a; i <= b; i++) { if(!isPrime(i) && checkForPrimeDigits(i)) { nonPrimeArr.push(i) } } return nonPrimeArr; function checkForPrimeDigits(num) { let numStr = num.toString(); for(let elem of numStr) { if(elem!=='2' && elem!=='3' && elem!=='5' && elem!=='7') { return false; } } return true; } function isPrime(num) { if(num < 2) return false; for(let i=2; i < num; i++){ if(num%i===0) return false; } return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function notPrimes(a,b){\n let arr = [];\n for (let i = a; i < b; i++){\n if (!/[014689]/.test(i)) {\n for (let j = 2; j <= Math.sqrt(i); j++){\n if (i % j === 0) { arr.push(i); break;}\n }\n }\n }\n return arr;\n}", "function primes(limit) {\n let ...
[ "0.8612787", "0.7368873", "0.7118093", "0.70932066", "0.7036627", "0.69277114", "0.6901608", "0.68667215", "0.67853785", "0.6782012", "0.67624044", "0.6757332", "0.67366874", "0.67043066", "0.6678171", "0.6563992", "0.6545962", "0.6520927", "0.6482521", "0.647499", "0.6472921...
0.84410274
1
this will be the file that renders categories to the page we will bring in the categories reducer and TODO: get the categories to populate TODO: create an action for when active, send category data
function Categories() { const dispatch = useDispatch(); const category = useSelector((state) => state.categories.categoryList); const activate = (category, description) => { dispatch(action.activated(category, description)) } return ( <div> <Typography>Browse our Categories</Typography> {category.map((item) => { return <Button key={item._id} onClick={() => activate(item.name, item.description)}>{ item.name }</Button> })} </div> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function categories() {\n // assign categories object to a variable\n var categories = memory.categories;\n // loop through categories\n for (category in categories) {\n // call categories render method\n memory.categories[category].render()...
[ "0.73967123", "0.69341886", "0.6782816", "0.6651629", "0.66173035", "0.65676314", "0.6554418", "0.6543957", "0.6488017", "0.6430285", "0.6400187", "0.63998014", "0.633934", "0.63388056", "0.63328326", "0.6329658", "0.6308752", "0.6296203", "0.6268805", "0.62648886", "0.625928...
0.6727549
3
swap ranks of index p1 with index p2
function swap(p1, p2, MAX) { p1 = validateIndex(p1, MAX); p2 = validateIndex(p2, MAX); if(p1 == p2) return; dbo.collection("names").findOne({rank: p1}, function(err, ar1) { dbo.collection("names").findOne({rank: p2}, function(err, ar2) { var temp = ar1.name ar1.name = ar2.name; ar2.name = temp; temp = ar1.id; ar1.id = ar2.id; ar2.id = temp; temp = ar1.complaints; ar1.complaints = ar2.complaints; ar2.complaints = temp; dbo.collection("names").updateOne( { rank: p1 }, {$set:ar1}, { upsert: true } ); dbo.collection("names").updateOne( { rank: p2}, {$set: ar2}, { upsert: true } ); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "swapNodes(idx1, idx2) {\n const VALS = this.values;\n\n const temp = VALS[idx1];\n VALS[idx1] = VALS[idx2];\n VALS[idx2] = temp;\n }", "_swap(idx1, idx2) {\n let _tempElement = this._elementHeap[idx1];\n let _tempPriority = this._priorityHeap[idx1];\n\n this._elementHeap[idx1] =...
[ "0.7171404", "0.7030536", "0.68232614", "0.6681308", "0.6681308", "0.6655838", "0.6653531", "0.6548508", "0.65203524", "0.6495802", "0.6488088", "0.64756966", "0.6435612", "0.64281464", "0.6386124", "0.63697207", "0.6349006", "0.6334449", "0.63189596", "0.6303532", "0.6256077...
0.69879603
2
Handlers that decide when the first movestart is triggered
function mousedown(e){ var data; if (!isLeftButton(e)) { return; } data = { target: e.target, startX: e.pageX, startY: e.pageY, timeStamp: e.timeStamp }; add(document, mouseevents.move, mousemove, data); add(document, mouseevents.cancel, mouseend, data); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function first_slide(ev)\n {\n ev.preventDefault();\n activate(0); // Move the \"active\" class\n // console.log(\"first: current = \"+current+\" t -> \"+timecodes[current]);\n seek_video();\n }", "onMove() {\n }", "function fireNextFrame() {\n // Trigger event for animator.\...
[ "0.6078157", "0.6058513", "0.6043513", "0.6043513", "0.6019449", "0.6016569", "0.59896827", "0.5972413", "0.5972413", "0.59477246", "0.5897895", "0.58940095", "0.58647436", "0.5821168", "0.5813959", "0.5802339", "0.57808834", "0.57383794", "0.5729757", "0.5729566", "0.5721087...
0.0
-1
Logic for deciding when to trigger a movestart.
function checkThreshold(e, template, touch, fn) { var distX = touch.pageX - template.startX, distY = touch.pageY - template.startY; // Do nothing if the threshold has not been crossed. if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } triggerStart(e, template, touch, distX, distY, fn); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "triggerPulled() {\n if (this.state.traitorInGame && !this.state.showCountdown) {\n Vibration.vibrate();\n this.state.triggersRemaining = this.state.triggersRemaining - 1;\n if (this.state.triggersRemaining <= 0) {\n //Traitor won as tracer ran out of triggers\n this.state.triggersRe...
[ "0.6432564", "0.58268195", "0.57948023", "0.5681667", "0.56473446", "0.5629448", "0.5608625", "0.56054014", "0.55810356", "0.55487853", "0.55378455", "0.5512543", "0.5504311", "0.550009", "0.5433698", "0.54334325", "0.5405912", "0.5402863", "0.5391505", "0.53673637", "0.53570...
0.0
-1
Handlers that control what happens following a movestart
function activeMousemove(e) { var event = e.data.event, timer = e.data.timer; updateEvent(event, e, e.timeStamp, timer); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMove() {\n }", "function forwardStep(e) {\n setMedia();\n media.currentTime = media.currentTime + trjs.param.forwardskip;\n }", "move(){\r\n if (this.counter % this.trajectory[this.step][Trajectory.Duration] == 0) {\r\n this.hide()\r\n this.ste...
[ "0.6623462", "0.61054426", "0.6044334", "0.59283423", "0.58105344", "0.58105344", "0.5781082", "0.5779033", "0.57457685", "0.57446814", "0.5743252", "0.57212174", "0.57212174", "0.57149047", "0.57080567", "0.57058436", "0.5705688", "0.5704663", "0.57036585", "0.56998116", "0....
0.0
-1
Logic for triggering move and moveend events
function updateEvent(event, touch, timeStamp, timer) { var time = timeStamp - event.timeStamp; event.type = 'move'; event.distX = touch.pageX - event.startX; event.distY = touch.pageY - event.startY; event.deltaX = touch.pageX - event.pageX; event.deltaY = touch.pageY - event.pageY; // Average the velocity of the last few events using a decay // curve to even out spurious jumps in values. event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; event.pageX = touch.pageX; event.pageY = touch.pageY; timer.kick(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMove() {\n }", "end() {\n if (this.mode !== mode.move) return;\n\n let bbox = this.bbox();\n let x = Box.snap(bbox.x);\n let y = Box.snap(bbox.y);\n this.setPosition(x, y);\n this.moveEndEvent.trigger();\n }", "function end(event) {\n\t\t\t_moving = false;\n\t\t}", "function _move...
[ "0.6817973", "0.67130524", "0.6543579", "0.651021", "0.64625555", "0.64032507", "0.63930976", "0.6391352", "0.63675624", "0.63491935", "0.6338625", "0.6311944", "0.6299001", "0.6279518", "0.62407154", "0.6232697", "0.622447", "0.62026554", "0.6194269", "0.6181375", "0.6160972...
0.0
-1
jQuery special event definition
function setup(data, namespaces, eventHandle) { // Stop the node from being dragged //add(this, 'dragstart.move drag.move', preventDefault); // Prevent text selection and touch interface scrolling //add(this, 'mousedown.move', preventIgnoreTags); // Tell movestart default handler that we've handled this add(this, 'movestart.move', flagAsHandled); // Don't bind to the DOM. For speed. return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_evtClick(event) { }", "function setEvent() {\n $('#plugin_submit').click(setConf);\n $('#plugin_cancel').click(browserBack);\n }", "_evtChange(event) { }", "function _eventHandler(data) {\n console.log(data);\n print2Console(\"EVENT\", data);\n\n\tdata = data.selected.firstChild.data;...
[ "0.6208069", "0.61712265", "0.6117725", "0.59664416", "0.59167016", "0.5903896", "0.58995515", "0.5869757", "0.58588725", "0.58588725", "0.58588725", "0.58588725", "0.58588725", "0.57951427", "0.5789245", "0.5789245", "0.57824004", "0.5751772", "0.5688772", "0.56794006", "0.5...
0.0
-1
by Diego Perini with modifications
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private internal fun...
[ "0.6601554", "0.65352565", "0.6248173", "0.59948987", "0.5959169", "0.5897094", "0.58391327", "0.57401186", "0.56591195", "0.5619805", "0.5592898", "0.5538822", "0.5532662", "0.54989", "0.5482116", "0.5448059", "0.54397273", "0.5438595", "0.5414127", "0.54138994", "0.5411371"...
0.0
-1
by Jed Schmidt with modifications
function selector(a){ a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]); var ret=[]; b!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]); return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "private public function m246() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "transient private internal fun...
[ "0.6518312", "0.6158009", "0.6157675", "0.58891916", "0.5859941", "0.58121234", "0.5739894", "0.5565203", "0.5461614", "0.542565", "0.5376566", "0.5360241", "0.5356987", "0.53195894", "0.52952313", "0.5234067", "0.5139211", "0.51173764", "0.5113671", "0.50827587", "0.5049621"...
0.0
-1
shallow object property extend
function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static iextend(obj) {\n // eslint-disable-next-line prefer-rest-params\n each(slice.call(arguments, 1), function (source) {\n for (let prop in source) {\n if ({}.hasOwnProperty.call(source, prop)) {\n obj[prop] = source[prop];\n }\n }\n });\n return obj;\n }", "stati...
[ "0.6932442", "0.69047314", "0.6878075", "0.6754211", "0.67336607", "0.6692845", "0.6692648", "0.6692648", "0.66892767", "0.66783905", "0.6675184", "0.6662802", "0.66591", "0.66442406", "0.66268665", "0.66268665", "0.66211367", "0.6619446", "0.66177124", "0.66173476", "0.66173...
0.0
-1
Helper Methods Unlock the modal for animation.
function unlockModal() { locked = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function lockModal() {\n locked = true;\n }", "function lockModal() {\n locked = true;\n }", "function unlockForEdit() {\n\t$(modalTextTitle).prop(\"disabled\",false);\n\t$(modalTextTitle).css(\"border-bottom\", \"2px solid #7C8487\");\n\n\t$(modalTextareaDescription).prop(\"disabled\",...
[ "0.72454244", "0.72454244", "0.6896535", "0.6820743", "0.67881566", "0.6694964", "0.66023105", "0.65635765", "0.6528138", "0.6525814", "0.6525814", "0.6509781", "0.6484871", "0.6479335", "0.646648", "0.6439817", "0.6433108", "0.6390839", "0.638449", "0.6374887", "0.63701576",...
0.8249799
1
Lock the modal to prevent further animation.
function lockModal() { locked = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function unlockModal() {\n locked = false;\n }", "function unlockModal() {\n locked = false;\n }", "function lock() {\n $('button').attr(\"disabled\", \"true\");\n }", "function lockActions() {\n $('.modal').find('.actions-container')\n .children().first() //...
[ "0.77020603", "0.77020603", "0.6724566", "0.66888505", "0.6680284", "0.6579386", "0.65182763", "0.6472608", "0.64131486", "0.639402", "0.6376364", "0.6302623", "0.62310976", "0.6218524", "0.619525", "0.6177555", "0.6141152", "0.6130219", "0.61241496", "0.6108205", "0.60983217...
0.8878073
1
Closes all open modals.
function closeOpenModals() { // // Get all reveal-modal elements with the .open class. // var $openModals = $( ".reveal-modal.open" ); // // Do we have modals to close? // if ( $openModals.length === 1 ) { // // Set the modals for animation queuing. // modalQueued = true; // // Trigger the modal close event. // $openModals.trigger( "reveal:close" ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "closeAll() {\n let i = this.openModals.length;\n while (i--) {\n this.openModals[i].close();\n }\n }", "function bs_close_all_modals() {\n $('.modal, [role=\"dialog\"]').modal('hide');\n $('.modal-backdrop').remove();\n $('body').removeClass('modal-open');\n}", "func...
[ "0.84376395", "0.77613777", "0.7760164", "0.7690232", "0.76874083", "0.7605883", "0.7605883", "0.7605883", "0.74058515", "0.7212445", "0.71493334", "0.71299577", "0.7102482", "0.69917834", "0.6903182", "0.6827299", "0.6744225", "0.67415535", "0.6714342", "0.67139536", "0.6621...
0.7577199
9
Animates the modal opening. Handles the modal 'open' event.
function openAnimation() { // // First, determine if we're in the middle of animation. // if ( !locked ) { // // We're not animating, let's lock the modal for animation. // lockModal(); // // Close any opened modals. // closeOpenModals(); // // Now, add the open class to this modal. // modal.addClass( "open" ); // // Are we executing the 'fadeAndPop' animation? // if ( options.animation === "fadeAndPop" ) { // // Yes, we're doing the 'fadeAndPop' animation. // Okay, set the modal css properties. // // // Set the 'top' property to the document scroll minus the calculated top offset. // cssOpts.open.top = $doc.scrollTop() - topOffset; // // Flip the opacity to 0. // cssOpts.open.opacity = 0; // // Set the css options. // modal.css( cssOpts.open ); // // Fade in the background element, at half the speed of the modal element. // So, faster than the modal element. // modalBg.fadeIn( options.animationSpeed / 2 ); // // Let's delay the next animation queue. // We'll wait until the background element is faded in. // modal.delay( options.animationSpeed / 2 ) // // Animate the following css properties. // .animate( { // // Set the 'top' property to the document scroll plus the calculated top measure. // "top": $doc.scrollTop() + topMeasure + 'px', // // Set it to full opacity. // "opacity": 1 }, /* * Fade speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal reveal:opened event. // This should trigger the functions set in the options.opened property. // modal.trigger( 'reveal:opened' ); }); // end of animate. } // end if 'fadeAndPop' // // Are executing the 'fade' animation? // if ( options.animation === "fade" ) { // // Yes, were executing 'fade'. // Okay, let's set the modal properties. // cssOpts.open.top = $doc.scrollTop() + topMeasure; // // Flip the opacity to 0. // cssOpts.open.opacity = 0; // // Set the css options. // modal.css( cssOpts.open ); // // Fade in the modal background at half the speed of the modal. // So, faster than modal. // modalBg.fadeIn( options.animationSpeed / 2 ); // // Delay the modal animation. // Wait till the modal background is done animating. // modal.delay( options.animationSpeed / 2 ) // // Now animate the modal. // .animate( { // // Set to full opacity. // "opacity": 1 }, /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal reveal:opened event. // This should trigger the functions set in the options.opened property. // modal.trigger( 'reveal:opened' ); }); } // end if 'fade' // // Are we not animating? // if ( options.animation === "none" ) { // // We're not animating. // Okay, let's set the modal css properties. // // // Set the top property. // cssOpts.open.top = $doc.scrollTop() + topMeasure; // // Set the opacity property to full opacity, since we're not fading (animating). // cssOpts.open.opacity = 1; // // Set the css property. // modal.css( cssOpts.open ); // // Show the modal Background. // modalBg.css( { "display": "block" } ); // // Trigger the modal opened event. // modal.trigger( 'reveal:opened' ); } // end if animating 'none' }// end if !locked }// end openAnimation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "open() {\n this.modal.jQueryModalFade.addClass('modal_fade_trick');\n this.modal.jQueryModalWindow.css('display', 'block');\n this.jQueryName.focus();\n }", "function modalAnimation() {}", "modalOpen(){\n\t\tthis.setState({modalAppear: true})\n\t}", "function openModal() {\n setOpen(true);\n }"...
[ "0.72274184", "0.71450293", "0.7141732", "0.7109374", "0.7081208", "0.70157766", "0.6918489", "0.68839055", "0.6869721", "0.68123823", "0.67818654", "0.67528653", "0.67508465", "0.6713749", "0.6665212", "0.6662611", "0.6645355", "0.6645355", "0.6643038", "0.66234994", "0.6621...
0.7665859
1
Closes the modal element(s) Handles the modal 'close' event.
function closeAnimation() { // // First, determine if we're in the middle of animation. // if ( !locked ) { // // We're not animating, let's lock the modal for animation. // lockModal(); // // Clear the modal of the open class. // modal.removeClass( "open" ); // // Are we using the 'fadeAndPop' animation? // if ( options.animation === "fadeAndPop" ) { // // Yes, okay, let's set the animation properties. // modal.animate( { // // Set the top property to the document scrollTop minus calculated topOffset. // "top": $doc.scrollTop() - topOffset + 'px', // // Fade the modal out, by using the opacity property. // "opacity": 0 }, /* * Fade speed. */ options.animationSpeed / 2, /* * End of animation callback. */ function () { // // Set the css hidden options. // modal.css( cssOpts.close ); }); // // Is the modal animation queued? // if ( !modalQueued ) { // // Oh, the modal(s) are mid animating. // Let's delay the animation queue. // modalBg.delay( options.animationSpeed ) // // Fade out the modal background. // .fadeOut( /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed property. // modal.trigger( 'reveal:closed' ); }); } else { // // We're not mid queue. // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if !modalQueued } // end if animation 'fadeAndPop' // // Are we using the 'fade' animation. // if ( options.animation === "fade" ) { // // Yes, we're using the 'fade' animation. // modal.animate( { "opacity" : 0 }, /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Set the css close options. // modal.css( cssOpts.close ); }); // end animate // // Are we mid animating the modal(s)? // if ( !modalQueued ) { // // Oh, the modal(s) are mid animating. // Let's delay the animation queue. // modalBg.delay( options.animationSpeed ) // // Let's fade out the modal background element. // .fadeOut( /* * Animation speed. */ options.animationSpeed, /* * End of animation callback. */ function () { // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); }); // end fadeOut } else { // // We're not mid queue. // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if !modalQueued } // end if animation 'fade' // // Are we not animating? // if ( options.animation === "none" ) { // // We're not animating. // Set the modal close css options. // modal.css( cssOpts.close ); // // Is the modal in the middle of an animation queue? // if ( !modalQueued ) { // // It's not mid queueu. Just hide it. // modalBg.css( { 'display': 'none' } ); } // // Trigger the modal 'closed' event. // This should trigger any method set in the options.closed propety. // modal.trigger( 'reveal:closed' ); } // end if not animating // // Reset the modalQueued variable. // modalQueued = false; } // end if !locked }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "'click .close' (event) {\n console.log(\"MODAL CLOSED VIA X\");\n modal.hide();\n }", "closeModal() {\n this.close();\n }", "function close() {\n $modalInstance.dismiss();\n }", "function closeModal() {\n if (modalController) {\n modalC...
[ "0.77563965", "0.7622132", "0.7581933", "0.75813425", "0.75560737", "0.75253475", "0.7521087", "0.7492387", "0.7418996", "0.7387039", "0.7387039", "0.7387039", "0.73749846", "0.73536456", "0.73076594", "0.7279166", "0.7277782", "0.72513795", "0.72486603", "0.72446233", "0.723...
0.0
-1
end closeAnimation Destroys the modal and it's events.
function destroy() { // // Unbind all .reveal events from the modal. // modal.unbind( '.reveal' ); // // Unbind all .reveal events from the modal background. // modalBg.unbind( '.reveal' ); // // Unbind all .reveal events from the modal 'close' button. // $closeButton.unbind( '.reveal' ); // // Unbind all .reveal events from the body. // $( 'body' ).unbind( '.reveal' ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function closeModal() {\n close.click(function(e) {\n gameEnd.removeClass('show');\n start();\n });\n}", "function closeAnimation() {\n //\n // First, determine if we're in the middle of animation.\n //\n if ( !locked ) {\n //\n // We're not animating, let's ...
[ "0.74375325", "0.73502976", "0.73502976", "0.7322071", "0.7182829", "0.7116376", "0.70620614", "0.7037047", "0.69913936", "0.69836074", "0.6978616", "0.6906821", "0.6898675", "0.6836635", "0.68324727", "0.6832158", "0.68224967", "0.6791035", "0.67685413", "0.6745313", "0.6744...
0.6657155
36
Converts JSON to HTML table
function convertToTable(json){ var table = '<table>'; for (x in json){ table += '<tr>'; for (y in json[x]){ table = table + '<td>' + json[x][y] + '</td>'; } table += '</tr>'; } table += '</table>'; return table; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeTable(json) {\n var obj = JSON.parse(json),\n table = $(\"<table>\"),\n row, value, i;\n\n for (i = 0; i < obj.rows.length; i++) {\n row = $(\"<tr>\");\n row.append(\"<td>\" + obj.rows[i].key + \"</td>\");\n value = obj.rows[i].value...
[ "0.8157815", "0.794002", "0.72810906", "0.72794", "0.72413075", "0.72397435", "0.7226649", "0.7022742", "0.7007057", "0.699789", "0.6955359", "0.6935765", "0.681017", "0.6798629", "0.67899024", "0.67751575", "0.67607105", "0.6730741", "0.6730741", "0.6716402", "0.66984075", ...
0.80924743
1
Abort the api call
abort() { source.cancel() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "abort () {\n this.request.abort();\n }", "function abortRequest(){\n this.aborted = true;\n this.clearTimeout();\n this.emit('abort');\n}", "abort () {\n this.requests.forEach(req => req.abort())\n super.abort()\n }", "cancel() {\n if (this._requestTask && typeof this._requestTask.abor...
[ "0.81136954", "0.76359", "0.7565169", "0.73976916", "0.7347391", "0.7263224", "0.72632205", "0.719874", "0.7179605", "0.69478905", "0.69353133", "0.68929744", "0.6869565", "0.68594706", "0.68445784", "0.684434", "0.68271357", "0.68074214", "0.67733204", "0.67709816", "0.67704...
0.66733384
24
Attach 'g' tag to svg reference
getSvgNode() { const { config, className } = this.props; const node = this.svgNode; return d3.select(node) .select(`.${className}__group`) .attr('transform', `translate(${config.marginLeft}, ${config.marginTop})`); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gCreate(tag) { return document.createElementNS('http://www.w3.org/2000/svg', tag); }", "function SVGWrap() {}", "getSvgRef() {\n return this.svggroup;\n }", "function g(id = null, classList) {\n let g = document.createElementNS(Svg.svgNS, \"g\");\n if (id != null)\n ...
[ "0.70142496", "0.67238516", "0.6707693", "0.66033876", "0.6601479", "0.6581008", "0.65510505", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.6515375", "0.64681643", "0.64557517", "0.64357746", "0.64344984", "0.64332086", "0.64280814", "0.6377617", "0.637...
0.0
-1
counts adjacent cells of type
function countAdjacent(val, row, column) { var ret = 0; //Iterate over adjacent for(var i = row-1; i <=row+1; ++i){ for(var j = column-1; j <=column+1; ++j){ if(i < 0 || i >=rows) continue if(j < 0 || j >= columns) continue if(i == row && j == column) continue //Increment in dictionary var index = (i*rows) + j; if(curGeneration[index] == val) { ++ret; } } } return ret; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_countNeighbours (cellX, cellY) {\n let neighbours = 0\n for (let x = -1; x < 2; x++) {\n for (let y = -1; y < 2; y++) {\n if (this.matrix[(cellX + x + this.sizeX) % this.sizeX][(cellY + y + this.sizeY) % this.sizeY] === 1) {\n neighbours++\n }\n }\n }\n neighbours -= (...
[ "0.6740658", "0.6686302", "0.6622562", "0.66177654", "0.6582243", "0.65606385", "0.6558473", "0.652471", "0.63512546", "0.6331398", "0.6325522", "0.6306116", "0.6291829", "0.62904614", "0.6272278", "0.6240216", "0.6173889", "0.6167412", "0.6133891", "0.613344", "0.61299247", ...
0.66390324
2
indexOf keep and return the first index of every theme Parameters : self : array, value : what we want
onlyUnique(value, index, self) { return self.indexOf(value) === index; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getThemeBelow(){\r\n //get the current theme url string\r\n var curr = $themeMenu.val();\r\n \r\n //find the index in the array\r\n var index = -1;\r\n for(var i = 1 ; i < themes.length ; i+=1){\r\n if(themes[i] === curr){\r\n index = i;\r\n break;\r\n ...
[ "0.6691184", "0.58646584", "0.5816226", "0.55927277", "0.5585501", "0.55358964", "0.5447397", "0.5438506", "0.54280365", "0.5406039", "0.54002887", "0.5366569", "0.5339307", "0.53385544", "0.5323902", "0.5315461", "0.5310467", "0.52950364", "0.52950364", "0.52674", "0.5262792...
0.51310813
47
method to return a random number
random(min, max) { //Math.random value is between 0 and 1. We use Math.floor in order to get an integer between min and max. return Math.floor(Math.random() * (max - min + 1)) + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomNumber () {}", "function getNumber() {\n return Math.random();\n}", "function randomNumber() {\r\n return Math.random;\r\n}", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function randomNumber(){\n return (Math.round(1 * Math.random()) + 1);\n }", "f...
[ "0.87659764", "0.8616641", "0.8549165", "0.84647435", "0.8441976", "0.8410082", "0.839208", "0.8376876", "0.83558387", "0.8351933", "0.82477206", "0.8238194", "0.8233361", "0.8217425", "0.8214662", "0.8199311", "0.81913215", "0.81840783", "0.8176416", "0.8168229", "0.8131849"...
0.0
-1
method to return a random non themed part of sentence
readRandomPart() { let randomPartIndex = this.random(0, this.addPart.length-1); return this.addPart[randomPartIndex].toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomizeSentence(sentence) {\n\n}", "function getword(partOfSpeech) {\n return partOfSpeech[Math.floor(Math.random() * partOfSpeech.length)];\n}", "function randomStartingPhrase() {\n if (Math.random() < 0.33) {\n return phrases[Math.floor(Math.random() * phrases.length)]\n }\n return ''\n}", ...
[ "0.7842455", "0.75747615", "0.74690783", "0.740224", "0.7359653", "0.71818244", "0.718092", "0.71750075", "0.7074708", "0.7059686", "0.7034547", "0.7031459", "0.6985719", "0.69676095", "0.6965873", "0.69494635", "0.69494635", "0.6946161", "0.69311845", "0.69005877", "0.690056...
0.0
-1
method to pick a random selected theme part of sentence and return it
readRandomThemedPart(theme) { //filter compare the theme of every elements of the array to return those with the theme we selected let filteredFirstPart = this.addPart.filter(element=>element.theme === theme); if (filteredFirstPart.length === 0) { filteredFirstPart = this.addPart; //if the variable stores nothing, we use the entire array console.warn("Aucune correspondance pour ce thème, toutes les phrases sont utilisées."); } //variable that select a random part a/mong filteredFirstPart. const selectedPartIndex = this.random(0,filteredFirstPart.length-1); return filteredFirstPart[selectedPartIndex].toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SelectWord() {\n\treturn words[Math.floor(Math.random()*words.length)];\n}", "static readRandomSentence(theme) {\r\n console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); \r\n }", "function selec...
[ "0.74161154", "0.738704", "0.7358178", "0.72726977", "0.71537715", "0.71203005", "0.70771426", "0.7031855", "0.70303464", "0.6998866", "0.6977343", "0.6971064", "0.6950724", "0.6921006", "0.69105035", "0.68811274", "0.6880051", "0.6840534", "0.6801679", "0.67960584", "0.67669...
0.6808055
18
class with all second parts of sentence
constructor() { super(); this.addPart.push(new NormalPart("j'en ai conclu que la mousse au chocolat n'était mon fort, ")); this.addPart.push(new NormalPart("j'ai appellé les Avengers pour m'aider dans ma quête, ")); this.addPart.push(new NormalPart("j'ai crié après le perroquet ")); this.addPart.push(new NormalPart("j'ai toujours voulu devenir un super-héros ")); this.addPart.push(new NormalPart("mon copain a acheté des champignons hallucinogènes ")); this.addPart.push(new NormalPart("j'ai acheté des nouvelles épées kikoodelamortquitue ")); this.addPart.push(new NormalPart("Nina mon perroquet a crié son mécontentement ")); this.addPart.push(new NormalPart("ma copine m'a dit : Lui c'est un mec facile !, ")); this.addPart.push(new NormalPart("je me suis mise à écouter Rammstein ")); this.addPart.push(new NormalPart("j'ai ressorti ma vieille Nintendo DS ")); this.addPart.push(new NormalPart("le père Noël est sorti de sous la cheminée ")); this.addPart.push(new NormalPart("ma mère m'a dit : Rien ne vaut les gâteaux !, ")); this.addPart.push(new NormalPart("je me suis poussée à me remettre au sport ")); this.addPart.push(new NormalPart("un castor est sorti de la rivière ")); this.addPart.push(new NormalPart("Jean-pierre Pernault à parlé du Coronavirus au 20h çà m'a fait réfléchir, ")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sentence(part1, part2) {\n return part1 + part2;\n}", "function ClozeCard(fullText, cloze) {\n // first argument contains full sentence\n this.fullText = fullText;\n // 2nd argument contains removed words\n this.cloze = cloze;\n // method for replacing the removed words with ellipses ......
[ "0.5737212", "0.54941344", "0.5410099", "0.5369701", "0.5354802", "0.5353968", "0.5340265", "0.5315714", "0.52826196", "0.52625024", "0.5234835", "0.52286196", "0.5227268", "0.5195015", "0.5161688", "0.5161688", "0.51535517", "0.51467836", "0.51465833", "0.5129645", "0.510607...
0.0
-1
class with all third parts of sentence
constructor() { super(); this.addPart.push(new NormalPart("çà m'a donné la diarhée!")); this.addPart.push(new NormalPart("j'ai déclaré forfait.")); this.addPart.push(new NormalPart("de toute façon le coronavirus va tous nous tuer!")); this.addPart.push(new NormalPart("du coup à la place, j'ai chanté du Feder sous la douche.")); this.addPart.push(new NormalPart("et sinon, l'apocalypse est toujours prévu pour 2012?")); this.addPart.push(new NormalPart("toutefois, je suis toujours en train de bûcher sur ce projet!")); this.addPart.push(new NormalPart("toute contente, j'ai pris mon copain dans les bras.")); this.addPart.push(new NormalPart("je regrette déjà mon régime... ")); this.addPart.push(new NormalPart("et finalement j'ai appris que mon vol pour la Thailande était annulé... :'(")); this.addPart.push(new NormalPart("du coup je suis allée acheter des oeufs.")); this.addPart.push(new NormalPart("et je me rends compte qu'inventer des phrases sans queue ni tête était un vrai sport !")); this.addPart.push(new NormalPart("c'est alors que mon chat s'est mis à bouder car il avait plus de croquette.")); this.addPart.push(new NormalPart("et je me suis rendue compte que le confinement c'est pas si mal en fait.")); this.addPart.push(new NormalPart("c'est là que j'ai compris que lire un dictionnaire en Anglais n'aiderait en rien.")); this.addPart.push(new NormalPart("faut dire que lire Le monde de Narnia qui fait 1200pages çà m'a bien motivé!")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeClassName(text) {\n\treturn text.toLowerCase().replace(' ', '_');\n}", "classify(phrase) { return this.clf.classify(phrase) }", "function $c(a,b){var c=a.getAttribute(\"class\")||\"\";-1==(\" \"+c+\" \").indexOf(\" \"+b+\" \")&&(c&&(c+=\" \"),a.setAttribute(\"class\",c+b))}", "function $c(a,b){v...
[ "0.56275976", "0.5519651", "0.54939574", "0.54939574", "0.5457164", "0.5452373", "0.54422134", "0.5434054", "0.5388739", "0.53813875", "0.5364217", "0.5349868", "0.53496706", "0.5311877", "0.5299774", "0.52774864", "0.5274068", "0.52543515", "0.5242325", "0.52358925", "0.5216...
0.0
-1
Method that add the three parts to make one sentence.
static readRandomSentence(theme) { console.log(Main.firstPartlistImpl.readRandomThemedPart(theme) + Main.secondPartListImpl.readRandomPart() + Main.thirdPartListImpl.readRandomPart()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sentence(part1, part2) {\n return part1 + part2;\n}", "function createSentence() { \n var sentence = noun[1] + ' ' + verb[1] + ' ' + preposition[1]; \n return sentence;\n}", "function prosesSentence(name, age, addres, hobby){\n return name + age + addres + hobby }", "function process...
[ "0.7262592", "0.71608746", "0.7085116", "0.6888762", "0.68186605", "0.6756931", "0.672306", "0.6660628", "0.66434205", "0.64102817", "0.63987917", "0.6297102", "0.6293899", "0.6198951", "0.61930394", "0.6184027", "0.6174484", "0.61708903", "0.6140403", "0.6123345", "0.6068085...
0.0
-1
Empty to hold prototypical stuff.
function Runner() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty() {}", "function Empty(...
[ "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "0.6612634", "...
0.0
-1
AppDefaulState: This function will update state in every page.
appDefaultState(userLogged) { this.setState({ user: userLogged }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setApplicationState( state ){\n console.log(\"Setting APPLICATION STATE to: \" + state );\n switch ( state ){\n \n case ApplicationState.LOGGED_IN:\n currentApplicationState = ApplicationState.LOGGED_IN;\n $(\"#signinLink\").css(\"display\", \"none\");\n \t$(\"#r...
[ "0.6572873", "0.6453642", "0.6252108", "0.61839354", "0.606696", "0.59711236", "0.59583545", "0.5891898", "0.57992995", "0.57646614", "0.57525814", "0.57509196", "0.57421947", "0.57408786", "0.56599134", "0.56398267", "0.5619595", "0.55940866", "0.5587352", "0.5586463", "0.55...
0.52556455
54
ComponentDidMount: This function will get Data from LocalStorage.
componentDidMount () { const isLogged = JSON.parse(localStorage.getItem('UserSession')); if (isLogged) { // console.log("Stored session: ", this.isLogged); this.setState({ user: isLogged }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "componentDidMount() {\n console.log('fetching data');\n // JSON.stringify takes object and makes it into string representation\n // JSON.parse takes string representation, and puts into JSON object\n try {\n const json = localStorage.getItem('options');\n const opt...
[ "0.7768264", "0.7742203", "0.7730184", "0.7592346", "0.7570624", "0.7541107", "0.7512477", "0.7474179", "0.7451228", "0.7445406", "0.7441839", "0.74187446", "0.7415352", "0.7409873", "0.739625", "0.73962253", "0.7390547", "0.7359969", "0.7358407", "0.73338425", "0.7331953", ...
0.0
-1
rewrite log4js configuration file by replacing relative paths to absolute
function correcting(log_file) { console.log("Logger: opening log-conf file: " + log_file); var log = fs.readFileSync(log_file, 'utf8'); var d = false; var json = JSON.parse(log, function(key, value) { if (key == 'filename') { var dirname = utils.dirname(value); var basename = value.replace(dirname, ''); var file = utils.search_file(dirname); file = path.join(file, basename) if (file != value) { value = file; d = true; } } return value; }); if (d) { var logFileCorrect = log_file + ".new"; console.log("Logger: write corrections to " + logFileCorrect); fs.writeFileSync(logFileCorrect, JSON.stringify(json, null, 2)); return logFileCorrect; } else { console.log("Logger: Config-file - There is nothing to correct!!!"); } return log_file; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_loadFileConfig() {\n try {\n let lines = fs.readFileSync(this._LOGLOVE_CONFIG).toString().split('\\n');\n for (let line of lines) {\n let levelPattern = line.split('=');\n this._setLevelAndPatterns(levelPattern[0], levelPattern[1]);\n }\n } catch (err) {\n // console.log('_...
[ "0.54720616", "0.5089851", "0.50360763", "0.5010054", "0.4969121", "0.49680153", "0.4944592", "0.49240178", "0.47732988", "0.47269222", "0.469177", "0.46910536", "0.46713278", "0.46398327", "0.46238816", "0.46063665", "0.45993313", "0.45690107", "0.45314348", "0.4530905", "0....
0.54788125
0
function to format date
function getDate(unixTime){ var time = new Date(unixTime * 1000); var day1 = time.getDate().toString(); if(day1.length < 2){ var day = '0' + day1; }else { var day = day1; } var month1 = (time.getMonth() + 1).toString(); if(month1.length < 2){ var month = '0' + month1; }else { var month = month1; } var year = time.getFullYear(); var date = day + '/' + month + '/' + year; return date; }
{ "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}", "function formatDate(date) {\n var day = date.getDate();\n var month = date.getMonth() + 1; //Months are zero based\n var year = date.getFullYear();\n...
[ "0.80229896", "0.78982013", "0.7876802", "0.7856424", "0.7775405", "0.77482456", "0.7740092", "0.77229714", "0.7717673", "0.7711721", "0.769446", "0.76909953", "0.7690983", "0.76804984", "0.76715106", "0.7670629", "0.76665986", "0.7664738", "0.7658275", "0.7649787", "0.764621...
0.0
-1
function to capitalize first letter on each word
function capString(string){ //code found on stackoverflow var string = string.toLowerCase().replace(/\b[a-z]/g, function(letter) { return letter.toUpperCase(); }); return string; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "capitalizeFirstLetter(word) {\n return (word.charAt(0).toUpperCase() + word.substring(1));\n }", "function firstWordCapitalize(word){\n let firstCharcter = word[0].toUpperCase();\n return firstCharcter + word.slice(1);\n \n}", "function capitalize(str) {}", "function capitalizeFirst(input) {\n ...
[ "0.83369654", "0.8227217", "0.8150912", "0.81487024", "0.8126337", "0.8121958", "0.8079707", "0.80575496", "0.8043775", "0.8027983", "0.8012551", "0.8011028", "0.80065435", "0.8001606", "0.799241", "0.7973813", "0.7966155", "0.79582417", "0.79556155", "0.79449016", "0.7941870...
0.0
-1
function to calculate wind direction
function formatDirection(degree){ var direction = ''; if(degree >= 337.5 && degree <= 22.5){ direction = 'Northerly'; }else if(degree > 22.5 && degree < 67.5){ direction = 'North Easterly'; }else if(degree >= 67.5 && degree <= 112.5){ direction = 'Easterly'; }else if(degree > 112.5 && degree < 157.5){ direction = 'South Easterly'; }else if(degree >= 157.5 && degree <= 202.5){ direction = 'Southerly'; }else if(degree > 202.5 && degree < 247.5){ direction = 'South Westerly'; }else if(degree >= 247.5 && degree <= 292.5){ direction = 'Westerly'; }else { direction = 'North Westerly'; } return direction; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function windDirection(degrees) {\n var directions = {\n 1: { direction: \"N\", values: { min: 348, max: 360 } },\n 2: { direction: \"N\", values: { min: 0, max: 11 } },\n 3: { direction: \"N/NE\", values: { min: 11, max: 33 } },\n 4: { direction: \"NE\", values: { min: 33, max: 56 } },\n 5: { dire...
[ "0.79684556", "0.77626467", "0.74703056", "0.7360368", "0.7349593", "0.73072606", "0.7256872", "0.70944744", "0.6855189", "0.6819715", "0.6790993", "0.66338456", "0.6630767", "0.6629049", "0.654573", "0.65243214", "0.64488494", "0.64372087", "0.64254427", "0.6383728", "0.6355...
0.0
-1
_e.bindAll(".iconpluscircle", "click", numBoxPing) _e.bindAll(".iconminuscircleo", "click", numBoxReduce)
function numBoxPing() { var getlocalStorageGoods = JSON.parse(localStorage.getItem('localStorageGoods')) for (var k = 0; k < getlocalStorageGoods.length; k++) { if (this.parentNode.parentNode.parentNode.parentNode.id == getlocalStorageGoods[k].id && this.parentNode.parentNode.parentNode.parentNode.getAttribute("data-preorder") == getlocalStorageGoods[k].preorder) { getlocalStorageGoods[k].amount++ if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].stockamount) { _e.msgBox({ msg: "库存不足!", timeout: 2000, className: "error" }) return } if (this.getAttribute("data-promotionflag") == "3" || this.getAttribute("data-promotionflag") == "1" || this.getAttribute("data-promotionflag") == "4") { if (getlocalStorageGoods[k].amount > Number(getlocalStorageGoods[k].promotion[0].repeatpurchasetimes)) { _e.msgBox({ msg: "不享受优惠!", timeout: 700, className: "info" }) return } } if (this.getAttribute("data-promotionflag") == "2") { if (getlocalStorageGoods[k].amount > Number(getlocalStorageGoods[k].promotion[0].repeatpurchasetimes)) { _e.msgBox({ msg: "不享受优惠!", timeout: 700, className: "info" }) return } if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount <= Number(getlocalStorageGoods[k].promotion[0].reapttimes) - Number(getlocalStorageGoods[k].promotion[0].count)) { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + (Number(getlocalStorageGoods[k].price) * Number(getlocalStorageGoods[k].promotion[0].discount)) / 100) / 100 aaa = (aaa + (Number(getlocalStorageGoods[k].price) * Number(getlocalStorageGoods[k].promotion[0].discount)) / 100) } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } } else { document.querySelector(".cartTotail").innerHTML = '¥ ' + (aaa + Number(getlocalStorageGoods[k].price)) / 100 aaa = aaa + Number(getlocalStorageGoods[k].price) } if (getlocalStorageGoods[k].promotion.length != 0) { if (getlocalStorageGoods[k].promotionflag == 2) { if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].promotion[0].reapttimes - getlocalStorageGoods[k].promotion[0].count) { _e.msgBox({ msg: "不享受优惠!", timeout: 2000, className: "error" }) } } } if (getlocalStorageGoods[k].promotionflag == 1 || getlocalStorageGoods[k].promotionflag == 3 || getlocalStorageGoods[k].promotionflag == 4) { if (getlocalStorageGoods[k].promotion[0].count < getlocalStorageGoods[k].promotion[0].reapttimes) { if (getlocalStorageGoods[k].amount > getlocalStorageGoods[k].promotion[0].reapttimes - getlocalStorageGoods[k].promotion[0].count) { _e.msgBox({ msg: "不享受优惠!", timeout: 2000, className: "error" }) } } } } this.parentNode.childNodes[2].innerHTML = getlocalStorageGoods[k].amount localStorage.setItem('localStorageGoods', JSON.stringify(getlocalStorageGoods)) openCartTips() return } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bindEvents() {\n DOM.plusSign.click(toggleIcon);\n }", "addClickHandlers() {\n //boxes is outside the class you are going to loop over every element of this nodelist...\n boxes.forEach(box => {\n //..then add a event listener on each one\n box.addEventListen...
[ "0.6820984", "0.65524197", "0.65038896", "0.6407147", "0.6277526", "0.6021303", "0.5917084", "0.586625", "0.5861284", "0.5845981", "0.5845981", "0.5801187", "0.5793981", "0.5792882", "0.5785497", "0.5772975", "0.57663363", "0.5708488", "0.5704229", "0.5692664", "0.56768435", ...
0.0
-1
remove the task item from the right list
function deleteTask(tasks, uuid) { var i = 0; console.error('tasks', tasks); for (; i < tasks.length; i++) { if (uuid == tasks[i].uuid) { tasks.splice(i, 1); i--; } } return tasks; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeTask(){\n\t\t$(\".remove\").unbind(\"click\").click(function(){\n\t\t\tvar single = $(this).closest(\"li\");\n\t\t\t\n\t\t\ttoDoList.splice(single.index(), 1);\n\t\t\tsingle.remove();\n\t\t\ttoDoCount();\n\t\t\tnotToDoCount();\n\t\t\taddClear();\n\t\t});\n\t}", "function removeItem() {\n let item...
[ "0.7536835", "0.7423865", "0.74138796", "0.7353058", "0.73402566", "0.7332698", "0.72632897", "0.7210352", "0.71930885", "0.71805423", "0.7149886", "0.71437", "0.7131697", "0.71261984", "0.71178687", "0.7111676", "0.7039964", "0.7022255", "0.6984162", "0.69814265", "0.6964354...
0.0
-1
Delete the tasks from a specific team by a date range
function deleteTasksByTeamByRange(options, allTasks, myTasks) { var calls = []; Teams.getTasksRange(options) .then(function (tasks) { if(tasks.length == 0) { $rootScope.notifier.error($rootScope.ui.planboard.noTasksFounded); $rootScope.statusBar.off(); } else if (tasks.error) { $rootScope.notifier.error(result.error); } else { angular.forEach(tasks, function (task) { allTasks = deleteTask(allTasks, task.uuid); myTasks = deleteTask(myTasks, task.uuid); calls.push( TeamUp._ ( 'taskDelete', {second: task.uuid}, task ) ); }); $q.all(calls) .then(function (result) { if (result.error) { console.log('failed to remove task ', task); } else { var group = ($scope.section == 'teams') ? $scope.currentTeam : $scope.currentClientGroup; $scope.getTasks( $scope.section, group, moment($scope.timeline.range.start).valueOf(), moment($scope.timeline.range.end).valueOf() ); $rootScope.notifier.success($rootScope.ui.planboard.tasksDeleted(options)); } $rootScope.statusBar.off(); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "deleteTask(taskId) {\n // Create an empty array and store it in a new variable, newTasks\n const newTasks = [];\n\n // Loop over the tasks\n for (let i = 0; i < this.tasks.length; i++) {\n // Get the current task in the loop\n const task = this.tasks[i];\n\n // Check if the task id is no...
[ "0.6183778", "0.6146677", "0.6114453", "0.6088318", "0.6052065", "0.58599496", "0.57875973", "0.5784129", "0.5782057", "0.5766821", "0.571558", "0.571338", "0.5693251", "0.5689389", "0.56837016", "0.56749547", "0.5636516", "0.55587596", "0.5543796", "0.55289215", "0.5527656",...
0.7921611
0
Selects students whose last name starts with given string
function getStudentLastName(req, res, mysql, context, complete) { var sql = "SELECT Students.student_id AS id, Students.first_name AS fname, Students.last_name AS lname, Students.gpa AS gpa, Majors.name AS major FROM Students JOIN Majors ON Students.major_id = Majors.major_id WHERE Students.last_name LIKE " + mysql.pool.escape(req.params.s + '%') + "ORDER BY Students.last_name;" mysql.pool.query(sql, function(error, results, fields) { if (error) { res.write(JSON.stringify(error)); res.end(); } context.students = results; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStudentsFirstNameBeforeLastName(students) {\n var studentsWhoseFirstNameBeforeLastName = _.filter(students, function(student) {\n return student.firstName.toLowerCase() < student.lastName.toLowerCase();\n });\n return studentsWhoseFirstNameBeforeLastName;\n}", "function matchName(firs...
[ "0.68215805", "0.6281996", "0.60791564", "0.6056427", "0.6049755", "0.6038427", "0.6008068", "0.59941834", "0.59336984", "0.5910771", "0.5884608", "0.58817637", "0.5863166", "0.58549756", "0.5838958", "0.5838958", "0.5836742", "0.5831606", "0.58065706", "0.57824296", "0.57532...
0.54390603
45
Change blank values to Null
function checkNull(inserts) { for (i = 0; i < inserts.length; i++) { if (inserts[i] == '') { inserts[i] = null } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setNullIfBlank(obj) {\r\n if (isBlank(obj.value)) {\r\n obj.value = \"\";\r\n }\r\n }", "function convertEmptyToNull(row) {\n for(let key in row) {\n if (row[key] === EMPTY_VALUE) {\n row[key] = undefined;\n }\n }\n}", "fun...
[ "0.7699135", "0.73013365", "0.72626925", "0.70652324", "0.68414974", "0.6729144", "0.6695384", "0.6695384", "0.6695384", "0.6634962", "0.64586866", "0.6433121", "0.6426585", "0.6391421", "0.6328056", "0.6251073", "0.62502986", "0.62433225", "0.6242669", "0.6215686", "0.62143"...
0.64454305
11
When the animation ends, we clean the classes and resolve the Promise
function handleAnimationEnd(event) { event.stopPropagation(); node.classList.remove(`${prefix}animated`, animationName); resolve('Animation ended'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEnd() {\n element.off(css3AnimationEvents, onAnimationProgress);\n $$jqLite.removeClass(element, activeClassName);\n $$jqLite.removeClass(element, pendingClassName);\n if (staggerTimeout) {\n $timeout.cancel(staggerTimeout);\n }\n animateC...
[ "0.7152717", "0.7152717", "0.7152717", "0.71292853", "0.6968512", "0.6957535", "0.694036", "0.6877351", "0.6868623", "0.67361623", "0.66968536", "0.663338", "0.6600601", "0.64365", "0.6423742", "0.64029455", "0.63439643", "0.6340242", "0.63223475", "0.631843", "0.6305752", ...
0.6225465
27
Returns the unique dates determined by the accompanying comparison function
function uniqueDates(dates, compareFn) { var d = dates.concat(); // n-squared. can probably be better here. (_.union? _.merge?) for (var i = 0; i < d.length; ++i) { for (var j = i + 1; j < d.length; ++j) { if (compareFn(d[i], d[j]) === 0) { // remove the jth element from the array as it can be considered duplicate d.splice(j--, 1); } } } return d; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getSortedUniqueDate(bookings) {\n let uniqueDate = [];\n for (let i = 0; i < bookings.length -1; i++) {\n if(!uniqueDate.includes(bookings[i].date.substring(5,10))){\n uniqueDate.push(bookings[i].date.substring(5,10))\n }\n }\n const sortedUniqueDate= uniqueDate.sort()\n return sortedUniqu...
[ "0.63693047", "0.62496966", "0.6195258", "0.6165936", "0.60871106", "0.59565145", "0.58595645", "0.58589715", "0.5834164", "0.5825121", "0.58009577", "0.57928205", "0.57762784", "0.57596713", "0.5755276", "0.5740565", "0.5691843", "0.56712985", "0.5655792", "0.56167334", "0.5...
0.77713454
0
Compares two dates with the help of the provided comparator function
function compareDatesWithFunction(d1, d2, fnC) { var c1 = fnC(d1); var c2 = fnC(d2); if (c1 > c2) return 1; if (c1 < c2) return -1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compFunc(a, b)\n{\n\tif (a.date < b.date)\n\t\treturn 1;\n\telse if (a.date > b.date)\n\t\treturn -1;\n\telse\n\t\treturn 0;\n}", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.date > b.date ){\n return 1;\n }\n return 0;\n}", "function d...
[ "0.73501474", "0.7120855", "0.70249486", "0.70114815", "0.6975558", "0.69590884", "0.6923796", "0.6900942", "0.689917", "0.68973756", "0.68314284", "0.68014747", "0.6645342", "0.6622629", "0.6592738", "0.65926725", "0.6576781", "0.6573856", "0.6554653", "0.65489477", "0.65375...
0.7148702
1
Compares if dates appear in the same logical quarter
function compareQuarters(d1, d2) { var m1 = d1.getMonth(); var m2 = d2.getMonth(); var q1 = (Math.floor(m1 / 3) * 3); var q2 = (Math.floor(m2 / 3) * 3); if (q1 > q2) return 1; if (q1 < q2) return -1; return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareQuarterYears(d1, d2) {\n var r = compareYears(d1, d2);\n if (r === 0) {\n r = compareQuarters(d1, d2);\n }\n return r;\n }", "function getCurrentQuarter(){\n let startDate = new Date()\n let endDate = new Date()\n let month = endDate.getMonth()\n...
[ "0.69359875", "0.61757916", "0.6020083", "0.60103697", "0.59846246", "0.58858174", "0.5853647", "0.5846302", "0.5828677", "0.58286446", "0.5808071", "0.57497674", "0.5706315", "0.56884485", "0.5653579", "0.56431323", "0.56376064", "0.5606512", "0.5584658", "0.55477524", "0.55...
0.703043
0
Compares one date with another disregarding the year component
function compareDayMonths(d1, d2) { var r = compareMonths(d1, d2); if (r === 0) { r = compareDays(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function yearBefore(d1, d2) {\n return d1.getFullYear() < d2.getFullYear();\n }", "function _isSameYear(d1, d2) {\n return d1.getFullYear() === d2.getFullYear();\n }", "function compare(a, b) {\n if (a.year < b.year)\n return -1;\n if (a.year > b.year)\n ...
[ "0.75182384", "0.73213875", "0.72410834", "0.7218506", "0.70963746", "0.7042112", "0.6990564", "0.6975954", "0.6975954", "0.69589436", "0.6949617", "0.68140596", "0.6785169", "0.67357045", "0.67141765", "0.6707754", "0.6691076", "0.66772175", "0.6664204", "0.6663058", "0.6641...
0.0
-1
Compares one date with another disregarding the date component
function compareMonthYears(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareMonths(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareDate(a,b) {\n if (a.date < b.date)\n return -1;\n else if (a.date > b.date)\n return 1;\n else\n return 0;\n }", "function compare_date( a, b ) {\n if ( a.date < b.date){\n return -1;\n }\n if ( a.d...
[ "0.74821424", "0.7444953", "0.7418697", "0.7403151", "0.73120826", "0.72947305", "0.72802866", "0.71944666", "0.7190712", "0.7171819", "0.71715015", "0.7123507", "0.71179384", "0.7114633", "0.7094997", "0.7060516", "0.7027555", "0.70127356", "0.7008603", "0.7008603", "0.70086...
0.0
-1
Compares one date with another if they are the same quarter of the same year
function compareQuarterYears(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareQuarters(d1, d2); } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareQuarters(d1, d2) {\n var m1 = d1.getMonth();\n var m2 = d2.getMonth();\n var q1 = (Math.floor(m1 / 3) * 3);\n var q2 = (Math.floor(m2 / 3) * 3);\n if (q1 > q2) return 1;\n if (q1 < q2) return -1;\n return 0;\n }", "function _isNextYear(d1, d2) {...
[ "0.7048928", "0.6692871", "0.66361976", "0.65389264", "0.63547534", "0.63365585", "0.62701106", "0.6159095", "0.6129432", "0.6115656", "0.6101225", "0.60819244", "0.6069449", "0.6043508", "0.60178137", "0.5967939", "0.5959819", "0.5959819", "0.5906313", "0.5900762", "0.589904...
0.7781297
0
Compares one date with another disregarding all components less granular than the day
function compareDates(d1, d2) { var r = compareYears(d1, d2); if (r === 0) { r = compareMonths(d1, d2); if (r === 0) { r = compareDays(d1, d2); } } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareDates(a, b) {\n var aDate = a.date;\n var bDate = b.date;\n\n let comparison = 0;\n if (aDate > bDate) {\n comparison = 1;\n } \n else if (aDate < bDate) {\n comparison = -1;\n }\n \n return comparison;\n}", "function comparisonByDate(dateA, dateB) {\n ...
[ "0.6870402", "0.685053", "0.6787804", "0.6778648", "0.67775005", "0.6760404", "0.6747039", "0.67458457", "0.6737737", "0.669407", "0.66880023", "0.6683086", "0.6683086", "0.6683086", "0.6683086", "0.6683086", "0.66746813", "0.6653407", "0.6653407", "0.6587927", "0.6578936", ...
0.6533868
24
var answer = prompt("") / ADD YOUR CODE BELOW
function checkPassword() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ask(question){\n return prompt(question);\n }", "function ask(question){\n return prompt(question);\n }", "function promptThem() {\n\tvar userResponse = prompt(\"Type something:\");\n}", "function initialPrompt() {\n console.log(\"Let's play some scrabble!\");\n return input.q...
[ "0.81085867", "0.81085867", "0.7959594", "0.7829161", "0.77704936", "0.7763414", "0.77110785", "0.76751196", "0.7669665", "0.7664098", "0.76631385", "0.76544446", "0.7652089", "0.7645431", "0.76249534", "0.759468", "0.7588119", "0.7565853", "0.75559014", "0.7544984", "0.75445...
0.0
-1
TODO: don't use sync, use async
function genHash(password) { return bcrypt.hashSync(password, 8); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async method(){}", "static async method(){}", "function sync() {\n \n}", "async run() {\n }", "function done() {}", "async function asyncCall() {\n result = await resolveAfter2Seconds();\n result.forEach((indItem) =>\n printItem(\n indItem.title,\n ...
[ "0.6757941", "0.6624668", "0.62863904", "0.6182573", "0.61776364", "0.6065782", "0.6036318", "0.5987047", "0.5932615", "0.5932615", "0.5932615", "0.5913433", "0.58752793", "0.5870257", "0.5870257", "0.5870257", "0.5870257", "0.583579", "0.583579", "0.583579", "0.583579", "0...
0.0
-1
Recrusive Merge Sort merge sort breaks the arrays into smaller pieces and then sorts them comparing the pieces
function mergeSort(arr){ if(arr.length <= 1) return arr; // return a single element or no element depending on odd or even length let mid = Math.floor(arr.length/2); // cut the arr in half let left = mergeSort(arr.slice(0,mid)); // slice array from 0 to mid exclusive by second parameter, this will recursively call itself and slice itself even more let right = mergeSort(arr.slice(mid)); // sort right side of sliced array return merge(left, right); // sort the sliced arrays and return results until the very first stack frame }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mergeSort(array) {\r\n //まずアレイを一つずつ要素が入った子アレイを持つ親アレイにする。\r\n const decomposedArray = [];\r\n for (let ele of array) {\r\n decomposedArray.push([ele]);\r\n }\r\n\r\n //バラバラになったアレイdecomposedArrayを最終的に並べ替えて一つのアレイにする関数に渡す。この関数は、下に定義。\r\n return reduceArray(decomposedArray);\r\n\r\n //(1)親アレイの要素を半数にす...
[ "0.789814", "0.76659286", "0.76051456", "0.7557711", "0.75338113", "0.7510642", "0.7456831", "0.7444788", "0.743857", "0.74070936", "0.7398937", "0.7340965", "0.7330385", "0.73298585", "0.7328909", "0.7311629", "0.7310214", "0.7308759", "0.730648", "0.72966003", "0.7289358", ...
0.70249903
56
Pop Menu of Avatar
function userMenuTemplate() { return ` <div class="popover avatar-pop"> <div class="popover-inner"> <ul class="list"> <li class="list-item"><a class="btn" href="#">Profile</a></li> <li class="list-item"><button id="menu--setup" class="btn btn--reset" >Setting</button></li> <li class="list-item"><button id="btn--logout" class="btn btn--reset" >Logout</button></li> </ul> </div> </div>`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OperatE_avatarclearmenu(){\t\n\t\t/* custom the menucustom the menucustom the menucustom the menu\n\t\t * \n\t\t */\n\t\t/*\n\t\t *custom the menucustom the menucustom the menucustom the menu \n\t\t */\n\t\t \t\t\t\t\t \n\t\t/*hide the idea create menu*/\n\t\t$('#MenU_avatarclearback,#MenU_avatarclearco...
[ "0.63483787", "0.60360366", "0.6025923", "0.59213996", "0.5877805", "0.5851104", "0.58485466", "0.5841474", "0.5749216", "0.57234687", "0.57088906", "0.56457007", "0.56344396", "0.55779487", "0.5571478", "0.5559341", "0.5555883", "0.55438745", "0.55434906", "0.5507514", "0.55...
0.0
-1
avatar image e.g. alt="avatar
function authNavItemTemplate() { return ` ${JSON.parse(localStorage.getItem('userData')).nickname} <li class="nav-item"> <button id="menu--topAvatar" class="btn btn--reset"> <div class="avatar"> <img class="avatar-img" src="./assets/media/avatar.svg" alt="avatar"> </div> </button> </li>`; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AvatarURL( fn )\n{\n return 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/' + fn.substring( 0, 2 ) + '/' + fn + '.jpg';\n}", "function renderAvatar(user) {\n\tvar img = document.createElement('img')\n\timg.className = \"avatar\"\n\timg.src = user.avatarURL\n\timg.alt = \"\"\n\...
[ "0.7290859", "0.72849363", "0.71193886", "0.707134", "0.7067917", "0.7065247", "0.70588756", "0.7021117", "0.6947409", "0.6942486", "0.68954796", "0.68745506", "0.6841702", "0.6724568", "0.6671925", "0.66380215", "0.6635885", "0.65981466", "0.6590609", "0.6577588", "0.6558165...
0.0
-1
again, the hackiest bullet ever
function mousePressed() { if (pharah.ammoCapacity <= 0) { return false; } else { flip = true; shotSound.play(); pharah.ammoCapacity -= 1; //yeah, so here I create the bullet so it can be drawn. flip the bool, etc. b = new Bullet(pharah, mouseX, mouseY, .02); return false; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function special_bullet(_enemy,b_level) {\n\tvar _left = _enemy.offsetLeft;\n\tvar _top = _enemy.offsetTop;\n\tvar _width = _enemy.offsetWidth;\n\tvar _height = _enemy.offsetHeight;\n\tvar _space = Math.floor(_width / 5);\n\tvar ene_bullet = create_enemy_bullet(_left, _top + _height / 2, enemy_bullets[b_level]);\n...
[ "0.6111116", "0.61081576", "0.6070366", "0.6038821", "0.603126", "0.6014635", "0.597998", "0.5959703", "0.5946248", "0.5942812", "0.5901715", "0.58573765", "0.5853544", "0.5849044", "0.5840483", "0.5840483", "0.5840483", "0.58364546", "0.58075726", "0.5800599", "0.5800599", ...
0.54245335
93
just a helper function when I thought it would be cute to do so
function spawnEnemies(enemyArr, num) { for (let i = 0; i < num; i++) { enemyArr[i].display(); enemyArr[i].move(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static private protected inter...
[ "0.6342047", "0.60449404", "0.60239273", "0.5888331", "0.56321007", "0.55737513", "0.55453974", "0.5460224", "0.54267573", "0.5385835", "0.53846025", "0.5383574", "0.538021", "0.5295506", "0.5238226", "0.5203738", "0.5184301", "0.5184301", "0.5177063", "0.5177063", "0.5177063...
0.0
-1
instantiate all her important stuff
constructor(health, ammoCapacity) { this.xPos = 250; this.yPos = 250; this.sprite = pharahSprite; this.crosshair = crosshairSprite; this.accel = 0.1; this.xSpeed = 0; this.ySpeed = 0; this.gravity = 0.03; this.xLimit = 5; this.aimX = mouseX; this.aimY = mouseY; this.bulletX = this.sprite.width + (this.sprite.width / 2); this.bulletY = this.sprite.height + (this.sprite.height / 2); this.bulletSpeed = .02; this.ammoCapacity = ammoCapacity; this.fuelCapacity = rangeData;; this.fuel = rangeData; this.currentTime = 0; this.jumpSize = 50; this.jumpSpeed = .02; this.health = 1000; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init () {\n // Here below all inits you need\n }", "initialise () {}", "function initModules() {\n model_store = new Soapify.model_store();\n vc_navbar = new Soapify.viewcontroller_navbar();\n vc_info = new Soapify.viewcontroller_info();\n vc_map = new Soa...
[ "0.6835924", "0.6747634", "0.67198426", "0.6681028", "0.66585827", "0.6649186", "0.6649186", "0.6649186", "0.6649186", "0.6649186", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", "0.6646388", ...
0.0
-1
basic collision taken from KAPP notes
detectHit(x, y) { if(dist(x, y, this.xPos, this.yPos) < 50) { return true; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "collision () {\n }", "function collision (px,py,pw,ph,ex,ey,ew,eh){\nreturn (Math.abs(px - ex) *2 < pw + ew) && (Math.abs(py - ey) * 2 < ph + eh);\n \n}", "onCollision(response, other) {\n // Make all other objects solid\n return true;\n }", "onCollision(response, other) {\n // ...
[ "0.7815291", "0.7584494", "0.72525024", "0.72525024", "0.72280777", "0.71984136", "0.71654373", "0.7127391", "0.71147245", "0.7076632", "0.70550996", "0.70301557", "0.7013475", "0.7010389", "0.6982803", "0.69723916", "0.69542193", "0.6946078", "0.6944615", "0.69343364", "0.69...
0.0
-1
set the mouseX and mouseY offsets so the crosshair looks more centered
aim() { this.aimX = mouseX - (this.sprite.width / 2 - 33); this.aimY = mouseY - ((this.sprite.height / 2) + 10); image(this.crosshair, this.aimX, this.aimY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderCrosshairUpdateLogic () {\n crosshairX = SI.game.Renderer.getScene().getMouseX() - crosshairSpriteHalfSize;\n crosshairY = SI.game.Renderer.getScene().getMouseY() - crosshairSpriteHalfSize;\n }", "changeMousePos(x, y) {\n\t\tvar rect = this.canvas.getBoundingClientRect();\n\t\tthis.mousePos...
[ "0.7471149", "0.6857028", "0.6661967", "0.6461135", "0.6459944", "0.6454804", "0.6432006", "0.64254874", "0.6415586", "0.63053364", "0.62903816", "0.6275102", "0.6270356", "0.6257311", "0.6241621", "0.62300867", "0.6228995", "0.6214071", "0.6212384", "0.6211772", "0.6203972",...
0.61546606
28
not implemented, unfortuantely. Couldn't get it to work. Want to go back to it
jump() { let yDistance = this.yPos - this.jumpSize; this.yPos -= this.jumpSpeed * yDistance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "transient final protected i...
[ "0.7205108", "0.70692784", "0.68558437", "0.678435", "0.6586199", "0.65379435", "0.6341079", "0.6324782", "0.6271534", "0.6258766", "0.62465733", "0.6101953", "0.6073968", "0.60264665", "0.5912936", "0.58836424", "0.58747494", "0.586811", "0.58423746", "0.5811706", "0.5798759...
0.0
-1
this will move our character
move() { //contain logic within borders if (this.xPos + this.sprite.width > width) { this.xSpeed = 0; this.collided = true; this.xPos = width - this.sprite.width } if (this.xPos < 0) { this.xSpeed = 0; this.collided = true; this.xPos = 0; } if (this.yPos > height-238-this.sprite.height) { this.ySpeed = 0; this.collided = true; this.yPos = height-238 - this.sprite.height; } if (this.yPos < 0) { this.ySpeed = 0; this.collided = true; this.yPos = 0; } //kapp notes helpful as always // move left? if (keyIsDown(LEFT_ARROW) || keyIsDown(65)) { // subtract from character's xSpeed this.xSpeed -= this.accel; this.left = true; this.right = false; } // move right? if (keyIsDown(RIGHT_ARROW) || keyIsDown(68)) { // add to character's xSpeed this.xSpeed += this.accel; this.right = true; this.left = false; } //reload, basic if (keyIsDown(82)) { this.ammoCapacity = 8; } // fuel!! if (keyIsDown(32)) { if (this.fuel > 0) { //if you still have fuel, then use it this.ySpeed -= this.accel; } if (this.fuel > -250) { //250 is the threshold under 0 to simulate a "delay" since idk how millis() works this.fuel -= 15; } } //look at this sad commented out failure of a feature... maybe one day /* if (keyCode == SHIFT) { if (cooldown) { let yDistance = this.yPos - this.jumpSize; this.yPos -= this.jumpSpeed * yDistance; jumping = true; } }*/ //this I felt I wanted to do so that the left and right speeds //would naturally slow down over time. Felt unnatural otherwise. if (this.right) { this.xSpeed -= this.gravity; if (this.xSpeed < 0) { this.right = false; this.left = true; } } else if (this.left) { this.xSpeed += this.gravity; if (this.xSpeed > 0) { this.right = true; this.left = false; } } //the standard movement. Add gravity, speed to position this.ySpeed += this.gravity; this.xPos += this.xSpeed; this.yPos += this.ySpeed; //gradually grow your fuel overtime. A counter would've been great but I couldn't learn it in time... //no pun intended. if (this.fuel < this.fuelCapacity) { this.fuel += 5; } // speed limit! prevent the user from moving too fast this.xSpeed = constrain(this.xSpeed, -this.xLimit, this.xLimit); this.ySpeed = constrain(this.ySpeed, -25, 25); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move(){\n\n this.charY = windowHeight - 200;\n if (this.state === \"right\") this.charX += 4;\n if (this.state === \"left\") this.charX -= 4;\n \n }", "function movementChar () {\n player.movement();\n enemy.movement();\n }", "moveCharacter(data) {\n this.currentEnd = data;\n this._dur...
[ "0.83372414", "0.7929643", "0.75312644", "0.7495457", "0.7476283", "0.7460674", "0.7401486", "0.73511064", "0.72903544", "0.7283865", "0.72585624", "0.7254449", "0.72355175", "0.7222043", "0.71958673", "0.7181574", "0.7175159", "0.7152343", "0.71407807", "0.7139268", "0.71341...
0.70880014
23
simple display function (hallelujah)
display() { image(this.sprite, this.bulletX, this.bulletY); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display(n){\n document.write(\"<br/><font color=red> Value is \"+n+\"</font>\") \n // while display time big logic. \n}", "function sc_display(o, p) {\n if (p === undefined) // we assume not given\n\tp = SC_DEFAULT_OUT;\n p.appendJSString(sc_toDisplayString(o));\n}", "function disp...
[ "0.7217159", "0.7081442", "0.7027051", "0.7014715", "0.69218504", "0.683686", "0.6828447", "0.68092436", "0.67900914", "0.6785537", "0.67777014", "0.6762396", "0.6715106", "0.67006016", "0.6689735", "0.6689735", "0.667217", "0.66417915", "0.6608583", "0.65643364", "0.6560081"...
0.0
-1
OK... This idea came to me in the shower (literally) so it might be dumb But I thought if I ahd the X,Y of when the mouse was pressed, and I had the current x,y of the image, I could calculate the slope of the line connecting those two points, which is just the ratio of y pixels over x pixels and add to the x y vectors based on that slope. I ended up having to have four special cases for each quadrant as referenced by the console.logs There has to be a better way for this, but this is the best I could do and it's still not perfect (I haven't yet, but I assume at some point I could accidentally divide by 0 for example)
move() { let slope = this.yDist / this.xDist; //y is negative, x is positive if (this.yDist < 0 && this.xDist > 0) { slope = this.xDist / this.yDist; console.log("-Y, X"); //FINALLY WORKING this.bulletXSpeed -= slope; this.bulletYSpeed -= 1; } //y is positive, x is positive if (this.yDist > 0 && this.xDist > 0) { console.log("Y, X"); //GOOD, WORKING this.bulletXSpeed += 1; this.bulletYSpeed += slope; } //y is negative, x is negative if (this.yDist < 0 && this.xDist < 0) { console.log("-Y, -X"); //GOOD, WORKING this.bulletXSpeed -= 1; this.bulletYSpeed -= slope; } //y is positive, x is negative if (this.yDist > 0 && this.xDist < 0) { slope = this.xDist / this.yDist; //GOOD, WORKING console.log("Y, -X"); this.bulletXSpeed += slope; this.bulletYSpeed += 1; } //then just move regularly this.bulletX += this.bulletXSpeed; this.bulletY += this.bulletYSpeed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLinePoints(p1,p2)\n{\n\tvar slope;\n var begin;\n var end;\n var original;\n \n var horiz = Math.abs(p1[0]-p2[0]) > Math.abs(p1[1]-p2[1]); //Find pixel increment direction\n \n //Get start x,y and ending y\n if(horiz) //if pixel increment is left to right\n {\n if(p1[0]<p2[0]){begin=p1[...
[ "0.66716516", "0.66179675", "0.6589086", "0.6438045", "0.63898146", "0.6386042", "0.6368306", "0.62642664", "0.6229038", "0.6210238", "0.6186974", "0.6186974", "0.6075937", "0.6075937", "0.606271", "0.60574704", "0.60378623", "0.6033128", "0.6014169", "0.6009087", "0.5991708"...
0.0
-1
build me a badboi
constructor(x, y, image, speed) { this.xPos = x; this.yPos = y; this.sprite = image; this.xDest = random(10, width-10); this.speed = speed; this.destroyed = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "build () {}", "function buildProject(framework){\n const config = loadConfig(framework);\n fetchProjectSeed(config.seedName, () =>{\n let filefixer = fixAFileFn(Project.name, Project.description);\n costumizeSeed(config.filesToFix, filefixer); \n spinner.stop();\n successMsg('DO...
[ "0.6830166", "0.5791775", "0.57777995", "0.57323384", "0.565408", "0.5641167", "0.56114775", "0.5577755", "0.55452543", "0.55452543", "0.5522975", "0.5522975", "0.5514708", "0.5504475", "0.54798406", "0.54051936", "0.53570324", "0.5321873", "0.5311903", "0.5309624", "0.530666...
0.0
-1
this was the easiest way I could "delete" them, send them way offscreen and turn off their image... again, probably not the best way to do this.
display() { if (!this.destroyed) { image(this.sprite, this.xPos, this.yPos); } else { this.xPos = -999; this.yPos = -999; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deletePicture() {\n symbols = [];\n drawBG();\n }", "function reset_image_pod() {\n\tpod_photo = '';\n\tvar image = document.getElementById('imagepod');\n\timage.src = '';\n\timage.style.visibility = \"hidden\";\n}", "function removePicture () {\n document.getElementById(\"swayze\"...
[ "0.64858234", "0.6345992", "0.61264706", "0.6115912", "0.6114024", "0.611349", "0.6086371", "0.60614", "0.60431176", "0.6022043", "0.60099113", "0.59966797", "0.5977463", "0.5976565", "0.5967888", "0.5967557", "0.59592104", "0.5956257", "0.5946442", "0.5928878", "0.5922517", ...
0.0
-1
move! Use the kapp notes movement from Zelda to randomly choose positions and get closer to them by the "Speed" which was instantiated as I think .02 which was what we used in the notes (move 2% fo the distance etc.)
move() { if (abs(this.xPos - this.xDest) < 100) { this.xDest = random(10, width - 10); } let xDist = this.xDest - this.xPos; this.xPos += this.speed * xDist; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "move() {\n var dirx = Math.random() > 0.5 ? 1 : -1;\n var diry = Math.random() > 0.5 ? 1 : -1;\n var L = int((Math.random() * 20));\n var L2 = int((Math.random() * 20));\n this.endx = this.posx + (L * dirx);\n this.endy = this.posy + (L2 * diry);\n }", "move() {\n // Set velocit...
[ "0.69563997", "0.69024277", "0.68271327", "0.67059875", "0.6642084", "0.6587403", "0.6583635", "0.6583635", "0.65718764", "0.6566902", "0.65660465", "0.6489874", "0.6487074", "0.6462558", "0.6410705", "0.6395876", "0.6361665", "0.6357746", "0.6345826", "0.6327667", "0.6319998...
0.6861847
2
copied the random function from
function index (max){ return Math.floor(Math.random() * max) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SeededRandom(){}", "_random() {\n return Math.rnd();\n }", "function rng () {\n return random()\n }", "function rand(){\n return Math.random()\n}", "function rng() {\n return random();\n }", "function rng() {\n return random();\n }", "function random() {\n\t\tseed = Math.s...
[ "0.82018715", "0.80747074", "0.7944747", "0.79162353", "0.79158795", "0.79158795", "0.7891814", "0.78527", "0.78275573", "0.7821998", "0.7821998", "0.7784265", "0.77749586", "0.7752856", "0.7642491", "0.760407", "0.7581026", "0.75545657", "0.7548074", "0.75476843", "0.7547684...
0.0
-1
Run logic in schema at dataModelChange
_checkSchemaLogic(changedData) { changedData = changedData || {}; const model = this.exo.dataBinding.model; if (model && model.logic) { if (typeof (model.logic) === "function") { this.applyJSLogic(model.logic, null, model, changedData) } else if (model.logic && model.logic.type === "JavaScript") { let script = this.assembleScript(model.logic) this.applyJSLogic(null, script, model, changedData) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleModelDataChanged(dataObj) {\n //console.log('handleModelDataChanged', dataObj.payload);\n }", "function blockCall(change, dataModelName, entityName, data) {\n if (change.hasError === 0) {\n checkForPreviousError(change, dataModelName, entityName, data);\n ...
[ "0.6944443", "0.623674", "0.61815137", "0.6136637", "0.60225576", "0.59741586", "0.59573615", "0.57878226", "0.57763386", "0.5747086", "0.57308257", "0.5724112", "0.572185", "0.56812304", "0.56565136", "0.55925477", "0.558366", "0.5545544", "0.5545084", "0.5531364", "0.551550...
0.6816064
1
seems like grainrpc does not correctly send undefined over the wire for defaults args we can just use null instead. this may bite me in the future. maybe this is my fault due to json serialization
launchSmodemOptions(wd, options) { const name = './modem_main'; if( options === null || typeof options === 'undefined') { throw(new Error('launchSmodemOptions() requires options argument')); } // pick a unique input using a hash let hashInput = " " + Date.now() + " " + Math.random(); let suffix = crypto.createHash('sha1').update(hashInput).digest('hex').slice(0,8); let tmppath = "/tmp/init_" + suffix + ".json"; fs.writeFileSync(tmppath, JSON.stringify(options)); return this.launchSmodemConfigPath(wd, tmppath); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepArgumentsObject(args,defaultArgs){\r\n var argList = [].slice.call(args);\r\n var outArgs = {};\r\n // print('Default args:',defaultArgs);\r\n //See if first argument is an ee object instead of a vanilla js object\r\n var firstArgumentIsEEObj = false;\r\n var argsAreObject = false;\r\n try{\r\n...
[ "0.65109086", "0.6413269", "0.6271986", "0.6107597", "0.59349865", "0.58801085", "0.57775956", "0.57756746", "0.5773383", "0.5773383", "0.5773383", "0.5748266", "0.57292587", "0.5718133", "0.5711709", "0.56869704", "0.5684806", "0.5644212", "0.5635559", "0.5628659", "0.562508...
0.0
-1
seems like grainrpc does not correctly send undefined over the wire for defaults args we can just use null instead. this may bite me in the future. maybe this is my fault due to json serialization
launchSmodemConfigPath(wd, path1=null, path2=null) { const name = './modem_main'; console.log("launchSmodemConfigPath " + path1 + " " + path2); const defaults = { cwd: wd, env: process.env }; const args = []; if( path1 !== null) { args.push('--config'); args.push(path1); } if( path2 !== null) { args.push('--patch'); args.push(path2); } this.smodemHandle = spawn(name, args, defaults); // find.stdout.pipe(wc.stdin); this.smodemHandle.stdout.on('data', (data) => { let asStr = data.toString('ascii'); process.stdout.write(asStr); // without newline // console.log(`Number of files ${data}`); }); this.status = 'running'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function prepArgumentsObject(args,defaultArgs){\r\n var argList = [].slice.call(args);\r\n var outArgs = {};\r\n // print('Default args:',defaultArgs);\r\n //See if first argument is an ee object instead of a vanilla js object\r\n var firstArgumentIsEEObj = false;\r\n var argsAreObject = false;\r\n try{\r\n...
[ "0.65101206", "0.64128906", "0.62715596", "0.6108013", "0.5934983", "0.58800656", "0.57783073", "0.5775649", "0.5774528", "0.5774528", "0.5774528", "0.57475924", "0.5729939", "0.5718175", "0.5712314", "0.56857914", "0.5685447", "0.56456333", "0.56346846", "0.5630044", "0.5625...
0.0
-1
searches for entries and displays results matching the typed letters
function search(value){ // console.log("search: " + value); showSection(null, '#section-searchresults'); $('#section-searchresults h1').html("Results for: '" + value + "'"); controller.search(value); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchUserLocal()\n {\n var typed = this.value.toString().toLowerCase(); \n var results = document.getElementById(\"results-cont\").children;\n\n if(typed.length >= 2)\n { \n for(var j=0; j < results.length; j++)\n {\n ...
[ "0.67494947", "0.66835386", "0.66159165", "0.65978134", "0.65576327", "0.65293485", "0.64791554", "0.6406434", "0.63759327", "0.6361633", "0.6329947", "0.6320887", "0.6282645", "0.62643826", "0.6247176", "0.6240933", "0.6205758", "0.62028134", "0.61956656", "0.6189085", "0.61...
0.0
-1
store mpw for autodecryption for autofilling option
function tmpStoreMPW(){ // browser.storage.sync.get("mpw").then(function(res){ // if(res['mpw'] == CryptoJS.SHA512($('#modalInputMPW').val()).toString()){ // SM.setMPW($('#modalInputMPW').val()); // $('#modalMPW').modal('hide'); // // activate checkbox // $('#pref_autofill_password').prop('checked', true); // SM.updatePreferences('pref_autofill_password', true); // }else{ // alert("Entered password was not correct."); // } // }); doChallenge($('#modalInputMPW').val(), function(){ SM.setMPW($('#modalInputMPW').val()); $('#modalMPW').modal('hide'); // activate checkbox $('#pref_autofill_password').prop('checked', true); SM.updatePreferences('pref_autofill_password', true); }, function(){ alert("Entered password was not correct."); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveForPW(getPw) {\n const encryptPw = encrypt(getPw);\n localStorage.setItem(PW_LS, encryptPw);\n}", "function withMPDpref(str) { return 'mpd/'+MPD.password+'/'+str; }", "function encryptorInit() {\n var lock = document.getElementById(\"js-lock\");\n lock.addEventListener(\"click\", promptFor...
[ "0.6445947", "0.6183979", "0.5619672", "0.5609375", "0.55957896", "0.55320203", "0.54935944", "0.5448543", "0.5413816", "0.5399494", "0.53948253", "0.53691214", "0.53690016", "0.53467315", "0.53451246", "0.5340745", "0.533906", "0.5338819", "0.53238666", "0.5320482", "0.53181...
0.6788386
0