query stringlengths 9 14.6k | document stringlengths 8 5.39M | metadata dict | negatives listlengths 0 30 | negative_scores listlengths 0 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
A function for handling what happens when the form to create a new pet is submitted | function handleFormSubmit(event) {
event.preventDefault();
// Wont submit the pet if we are missing a body, title, or owner
if (
!titleUpdate.val().trim() ||
!bodyUpdate.val().trim() ||
!driverSelect.val()
) {
return;
}
// Constructing a newPet object to hand to the datab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function handleFormSubmitted(event) {\n // prevent the default (because the default is that submitting a form refreshes the page)\n event.preventDefault();\n console.log(event);\n // actually add a new pet to our table\n var nameInput = document.getElementById('name');\n var nameValue = nameInput['value'];\n... | [
"0.7626596",
"0.6925378",
"0.6840316",
"0.6755437",
"0.65864784",
"0.64268047",
"0.64258975",
"0.6324423",
"0.6312736",
"0.629328",
"0.6236222",
"0.6231432",
"0.6223151",
"0.6207623",
"0.6200093",
"0.61960363",
"0.6188154",
"0.6159671",
"0.6132351",
"0.6074062",
"0.6063419",
... | 0.7368379 | 1 |
Submits a new pet and brings user to home page upon completion | function submitPet(pet) {
$.post("/api/pets", pet, function() {
window.location.href = "/owners";
});
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function signUpPet(animal, petName) {\n $.post(\"/api/petProfile\", {\n animal: animal,\n petName: petName,\n })\n .then(() => {\n window.location.replace(\"/dashboard\");\n // If there's an error, handle it by throwing up a bootstrap alert\n })\n .cat... | [
"0.7165937",
"0.6853659",
"0.68242663",
"0.66437626",
"0.65321964",
"0.6229095",
"0.61355096",
"0.61246437",
"0.609649",
"0.60905826",
"0.60843503",
"0.5990345",
"0.5988501",
"0.59821594",
"0.5979732",
"0.5975705",
"0.5943919",
"0.59263957",
"0.59134567",
"0.5868995",
"0.5851... | 0.8123003 | 0 |
A function to get drivers and then render our list of drivers | function getDrivers() {
$.get("/api/drivers", renderDriverList);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function renderDriverList(data) {\n if (!data.length) {\n window.location.href = \"/drivers\";\n }\n $(\".hidden\").removeClass(\"hidden\");\n var rowsToAdd = [];\n for (var i = 0; i < data.length; i++) {\n rowsToAdd.push(createDriverRow(data[i]));\n }\n driverSelect.empty();\n co... | [
"0.6733465",
"0.66469085",
"0.6448684",
"0.631151",
"0.60898465",
"0.5910424",
"0.5876438",
"0.575453",
"0.57439864",
"0.56667006",
"0.5581936",
"0.55442137",
"0.5537256",
"0.55277246",
"0.54964876",
"0.5490183",
"0.54900146",
"0.5487717",
"0.5420362",
"0.5414034",
"0.5409285... | 0.8258579 | 0 |
Function to either render a list of drivers, or if there are none, direct the user to the page to create an driver first | function renderDriverList(data) {
if (!data.length) {
window.location.href = "/drivers";
}
$(".hidden").removeClass("hidden");
var rowsToAdd = [];
for (var i = 0; i < data.length; i++) {
rowsToAdd.push(createDriverRow(data[i]));
}
driverSelect.empty();
console.log(rowsToAdd);... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getDrivers() {\n $.get(\"/api/drivers\", renderDriverList);\n }",
"static async addVehicle (req, res) {\n const userDetails = req.session.userDetails\n // come back to think about this cause there's no where else to redirect this thing to\n try{\n const {result, resbo... | [
"0.6667615",
"0.5874856",
"0.57302356",
"0.5713933",
"0.54305285",
"0.5276301",
"0.5244438",
"0.52413803",
"0.5179512",
"0.5163738",
"0.5145284",
"0.51237637",
"0.5084033",
"0.50714785",
"0.5054888",
"0.5039834",
"0.50372404",
"0.5024646",
"0.502359",
"0.4989647",
"0.4977781"... | 0.7074335 | 0 |
Creates the driver options in the dropdown | function createDriverRow(driver) {
var listOption = $("<option>");
listOption.attr("value", driver.id);
listOption.text(driver.name);
return listOption;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"populate_dropdown() {\n let dropdown = $(\"#vertex-shader\");\n this.shader_lib.vertex_info.map((x, i) => {\n $('<option>')\n .val(i)\n .html(x.title)\n .appendTo(dropdown);\n });\n }",
"_register_view_options() {\n let curren... | [
"0.6866479",
"0.68174404",
"0.66830844",
"0.65990806",
"0.65595293",
"0.65565604",
"0.653497",
"0.6522262",
"0.64940214",
"0.6466699",
"0.64506114",
"0.6433529",
"0.642746",
"0.64251316",
"0.63938004",
"0.633036",
"0.63069963",
"0.62905437",
"0.6283194",
"0.6280899",
"0.62731... | 0.701443 | 0 |
Description: Asynchonize all actions in actions array Type: General Note: Function type must be 'async' and returns Promise Usage: dispatch(['actionA', 'actionB']) | async asyncActions({dispatch, commit}, actions){
for(var index in actions)
await dispatch(actions[index])
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function triggerActions(count) {\n // must call processAction\n const list = []\n for (let i = 0; i < count; i++) {\n list.push(new Promise(function(resolve, reject) {\n processAction(i + 1, function(data) { resolve(data) })\n }))\n }\n Promise.all(list).then(function(responses) {\n responses.ma... | [
"0.65652454",
"0.640445",
"0.63440156",
"0.63386464",
"0.62526834",
"0.6250407",
"0.61324614",
"0.6116234",
"0.6103812",
"0.6008686",
"0.5978253",
"0.597716",
"0.59496725",
"0.59273165",
"0.5882346",
"0.588079",
"0.5876562",
"0.58540297",
"0.5817102",
"0.58096033",
"0.5806626... | 0.8260404 | 0 |
Hash key for the cell at x, y in the clue map | function clueMapKey(x, y) {
return x + '_' + y;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_hash(pt) {\n return (15485867 + pt.X) * 15485867 + pt.Y;\n }",
"hash() {\n var result;\n result = boardsize * this.x + this.y;\n result = boardsize * result + this.dist;\n return result;\n }",
"function locHash(loc) {\n return \"\" + loc.x + \"+\" + loc.y;\n }",
"function xy_to_id(c... | [
"0.7276259",
"0.67266035",
"0.6641328",
"0.64785814",
"0.6478305",
"0.6441642",
"0.6439258",
"0.64114165",
"0.6295056",
"0.61340165",
"0.6106978",
"0.60778314",
"0.60702056",
"0.60577923",
"0.6024452",
"0.598986",
"0.59715116",
"0.59248006",
"0.5882548",
"0.58661056",
"0.5859... | 0.7181967 | 1 |
A map for looking up clues that a given cell relates to | function buildClueMap(clues) {
var map = {};
_.forEach(clues, function (clue) {
_.forEach(cellsForEntry(clue), function (cell) {
var key = clueMapKey(cell.x, cell.y);
if (map[key] === undefined) {
map[key] = {};
}
if (isAcross(clue)) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function highlight(concept) {\n var the_map = {\n opinions:\"chartreuse\",\n life:\"yellow\",\n }\n return the_map[concept]\n}",
"initCellMaps() {\n this.cellGroupIndexMap = {\n \"cell_0_0\":[0,3,6],\n \"cell_1_0\":[0,4],\n \"cell_2_0\":[0,5,7],\n \"cel... | [
"0.5670865",
"0.5668234",
"0.5604789",
"0.55617714",
"0.5560861",
"0.5560216",
"0.54960054",
"0.5481495",
"0.5452656",
"0.54317355",
"0.5429743",
"0.53810894",
"0.53438115",
"0.5317453",
"0.52582407",
"0.5246052",
"0.52399826",
"0.52333826",
"0.52333826",
"0.5233171",
"0.5233... | 0.6596155 | 0 |
since this is a pure component, we don't want to store state But, we still need a way to construct the current values of quantity, amount and interval | calcCurrentValues() {
const { values, tier } = this.props;
let quantity, amount, singleAmount, interval, presets;
// Case 1: handle presets. Both interval and amount are changeable
if (tier.presets) {
presets = tier.presets.filter(p => !isNaN(p)).map(p => parseInt(p, 10));
interval = (valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"calculateQuantity() {\n console.log('Calculating quantity... ');\n const symbol = this.symbol.meta;\n const minQuantity = symbol.minQty;\n const maxQuantity = symbol.maxQty;\n const quantitySigFig = symbol.quantitySigFig;\n const stepSize = symbol.stepSize; //minimum quan... | [
"0.60515034",
"0.6032507",
"0.5972825",
"0.5751803",
"0.5748365",
"0.5725595",
"0.5688649",
"0.56860113",
"0.5685451",
"0.56797564",
"0.56502825",
"0.5608799",
"0.5594934",
"0.55813074",
"0.55727416",
"0.55552036",
"0.55539495",
"0.5543458",
"0.5523595",
"0.55160576",
"0.5507... | 0.6894482 | 0 |
The listFilterHandler is used to filter the order of the product listings. | function listFilterHandler(listingsArray) {
//setListing(listingsArray.sort((a, b) => a.price < b.price))
listingsArray.sort((a, b) => a.price < b.price);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function captureFilter() {\n updateProductList();\n event.preventDefault();\n}",
"function handleFilterList() {\n if (startDate === \"\" || endDate === \"\") {\n notify(\n \"warning\",\n \"Para filtrar a lista de ordens de serviço atendidas os dados do periodo devem estar preenchidos, por... | [
"0.60438585",
"0.59148157",
"0.58359176",
"0.5801816",
"0.57341564",
"0.57268643",
"0.5644063",
"0.55909157",
"0.5552187",
"0.5550947",
"0.5405235",
"0.5405235",
"0.5367376",
"0.53522104",
"0.53503597",
"0.53501904",
"0.532723",
"0.5325234",
"0.5322588",
"0.5311051",
"0.52943... | 0.6400062 | 0 |
The FilterPrice function sorts the array by price (low to high). | function FilterPrice(listingsArray) {
setPulled(listingsArray.sort((a, b) => a.price > b.price));
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function FilterByPrice(price) {\n return products.filter(function (item) {\n return item.price <= price;\n });\n}",
"function priceSortLowTop(array){\n\tarray.sort(function(a, b){\n\t\tvar price1= a.price, price2= b.price;\n\t\tif(price1== price2) return 0;\n\t\treturn price1> price2? 1: -1;\n\t\t});\n\t\t\... | [
"0.73673606",
"0.6900415",
"0.6689904",
"0.66714203",
"0.666838",
"0.6664881",
"0.64781797",
"0.6424541",
"0.6418046",
"0.62737775",
"0.6270525",
"0.6270316",
"0.6217926",
"0.60683",
"0.6062399",
"0.5940459",
"0.591244",
"0.5878927",
"0.5860792",
"0.57805336",
"0.5744304",
... | 0.7251792 | 1 |
5 Write a function that returns a function that calculates a decimal value of the given octal number. Input: 034 Output: 28 | function octalToDec(number) {
function inner() {
return parseInt(number);
}
return inner();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function octToDec(num){\n\tvar i = 0;\n\tvar result = 0;\n\t\n\twhile(num > 0){\n\t<!-- If num is not a binary value -->\n\t\tif(num % 10 > 7){ result = -1; break;}\n\t\n\t\telse{\n\t\tresult += num % 10 * Math.pow(8,i);\n\t\ti++;\n\t\tnum = Math.floor(num / 10);\n\t\t}\n\t}\n\treturn result;\n}",
"function decT... | [
"0.70291543",
"0.6173294",
"0.600074",
"0.5953356",
"0.5944672",
"0.58749384",
"0.58471996",
"0.5815409",
"0.58024377",
"0.5780049",
"0.57417715",
"0.5715952",
"0.57051593",
"0.57006127",
"0.5659652",
"0.56186044",
"0.5605035",
"0.5603655",
"0.55940145",
"0.5531743",
"0.55294... | 0.7358834 | 0 |
6 Write a function that checks if a given string is valid password. The password is valid if it is at least 6 characters long and contains at least one digit. The function should receive two callbacks named successCallback and errorCallback that should be called in case password is correct or invalid. Input: JSGuru Out... | function checksCallback(password, errorCallback, validPassword) {
var lengthCheck;
var digitCheck;
if (password.length >= 6) {
lengthCheck = true;
} else {
lengthCheck = false;
}
digitCheck = false;
for (var i = 0; i < password.length; i++) {
var character = passwor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function isValidPassword(password) {\n\n\n}",
"function checkPassword(password){\n var upperAlphaChars = /[A-Z]/;\n var lowerAlphaChars = /[a-z]/;\n var numbers = /[0-9]/;\n var nonalphaChars = /\\W|_/;\n\n\t//document.getElementById(\"loginUsernameError\").innerHTML=\"Testing\";\n ... | [
"0.7715553",
"0.76431006",
"0.74716055",
"0.743368",
"0.74312204",
"0.73916495",
"0.7373309",
"0.7368976",
"0.7357541",
"0.73104084",
"0.72633743",
"0.72616273",
"0.7203727",
"0.719954",
"0.71986747",
"0.7147802",
"0.7128299",
"0.7115824",
"0.71094877",
"0.71074414",
"0.71053... | 0.80175 | 0 |
Send a message to the page script. | function messagePageScript() {
window.postMessage({
direction: "from-content-script",
message: "Message from the content script"
}, "https://mdn.github.io");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sendText(message, mobile_number) {\n var scriptToSendText =\n \"window.WAPI.sendMessageToID('\" +\n mobile_number +\n \"@c.us', '\" +\n message.replaceAll(\"BREAK_LINE\", \"\\\\n\") +\n \"',function(data){console.log(data)})\";\n page.evaluate(scriptToSendText);\n console.log(scriptToSen... | [
"0.6940337",
"0.64902407",
"0.63708746",
"0.63126814",
"0.6281369",
"0.61653423",
"0.61439085",
"0.61002934",
"0.60877156",
"0.607134",
"0.60320395",
"0.6025189",
"0.5989373",
"0.5965413",
"0.5962616",
"0.5945864",
"0.59420246",
"0.59222966",
"0.58871144",
"0.586345",
"0.5837... | 0.7241465 | 0 |
Add or remove ARIA attributes. Uses jQuery's width() function to determine the size of the window and add the default ARIA attributes for the menu toggle if it's visible. | function onResizeARIA() {
if ( 643 > _window.width() ) {
button.attr( 'aria-expanded', 'false' );
menu.attr( 'aria-expanded', 'false' );
button.attr( 'aria-controls', 'primary-menu' );
} else {
button.removeAttr( 'aria-expanded' );
menu.removeAttr( 'aria-expanded' );
button.removeAttr( 'aria-contr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function onResizeARIA() {\n if ( window.innerWidth < 910 ) {\n if ( menuToggle.hasClass( 'toggled-on' ) ) {\n menuToggle.attr( 'aria-expanded', 'true' );\n } else {\n menuToggle.attr( 'aria-expanded', 'false' );\n }\n\n if ( siteHeade... | [
"0.66550815",
"0.660517",
"0.5907728",
"0.56250393",
"0.55748415",
"0.55064845",
"0.5503742",
"0.55033946",
"0.5458503",
"0.54566985",
"0.540773",
"0.52748775",
"0.52505785",
"0.5221479",
"0.52081376",
"0.51707476",
"0.5162445",
"0.51520157",
"0.5148838",
"0.51410586",
"0.513... | 0.66928697 | 0 |
Function to add a new action button | function addNewButton() {
$("#addGif").on("click", function () {
var action = $("#input").val().trim();
if (action == "") {
// added so user cannot add a blank button
return false;
}
actions.push(action);
disp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createButton (action, name) {\n var button = document.createElement('button');\n button.innerHTML = name;\n button.setAttribute('id', action);\n document.getElementById('visualizer').appendChild(button);\n}",
"function addButton(data){\n\t\tif (data.length>0){\n\t\t\t\tnewbutton=\"<button class='str... | [
"0.741595",
"0.70466673",
"0.6969539",
"0.69396996",
"0.6927998",
"0.6899592",
"0.684332",
"0.68338895",
"0.6763799",
"0.67588776",
"0.67349225",
"0.67255837",
"0.67143106",
"0.6660578",
"0.66408116",
"0.66084176",
"0.6575613",
"0.65602726",
"0.65528405",
"0.64833975",
"0.644... | 0.7253555 | 1 |
Mock configuration values (requires a cleanup call) | mockConfig(key, value) {
let config = lookup('config')
let hasKey = key in config
let oldValue = config[key]
config[key] = value
pendingCleanup.push(() => {
if (!hasKey) {
delete config[key]
} else {
config[key] = oldValue
}
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"config() {\n return {\n mock: process.env.NOMOCK === undefined\n };\n }",
"after(configs) {\n console.log('mock request finished', configs);\n }",
"cleanConfig() {\n if (this.config) {\n this.config['file'] = null;\n this.config['descriptor'] = null;\n }\n }",
"static... | [
"0.68475246",
"0.6108339",
"0.60058963",
"0.5936671",
"0.57759005",
"0.57385147",
"0.5602578",
"0.55993533",
"0.5574469",
"0.5538866",
"0.546863",
"0.546863",
"0.54559714",
"0.5451477",
"0.5438162",
"0.5312271",
"0.5305087",
"0.52987236",
"0.52983356",
"0.5280236",
"0.5277027... | 0.7889708 | 0 |
Create temp directories (requires a cleanup call) | async tempDir() {
let dir = await mkdtemp(resolve(tmpdir(), 'peon-test-'))
pendingCleanup.push(async() => {
await remove(dir)
})
return dir
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function mk_temp() {\n fs.mkdir(g_DOWNLOAD_DIR + g_TEMP, function (err) {\n if (err) {\n if (err.code == 'EEXIST') existing_chunks_checker(g_allChunks); // ignore the error if the folder already exists\n else console.log('Error MkDir: ' + err.code); // something else went wrong\n ... | [
"0.7616566",
"0.76158637",
"0.70929956",
"0.69044864",
"0.6692166",
"0.6614545",
"0.6548889",
"0.6527581",
"0.6522259",
"0.64232045",
"0.63918483",
"0.6389464",
"0.6370022",
"0.6344564",
"0.63211673",
"0.6318463",
"0.627605",
"0.62668455",
"0.62352175",
"0.621647",
"0.6214394... | 0.7627239 | 0 |
Instead of directly calling CallActivity, passing workflow toolbar call via this method, so that find/set viewcontext for button. | function CallWorkflowToolbarActivity(button) {
var view = $(document).find(Optum.StepWise.CommonUI.ViewSelector);
var viewContext = Optum.StepWise.CommonUI.GetViewContext(view);
CallActivity(button, viewContext);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"render() {\n const { attributes, defaultFrom } = this.props.task\n return (\n <IconButton\n icon={<Call />}\n className={callbutton}\n onClick={(e) => {\n this.props.flex.Actions.invokeAction('StartOutboundCall', {\n destination: defaultFrom,\n taskAtt... | [
"0.5686263",
"0.54747903",
"0.51041454",
"0.50610346",
"0.49756804",
"0.49490768",
"0.48388964",
"0.47920838",
"0.4770944",
"0.4734489",
"0.47118548",
"0.47000092",
"0.46907103",
"0.46901175",
"0.46626186",
"0.46606705",
"0.46552405",
"0.46545208",
"0.46507382",
"0.46317303",
... | 0.7771263 | 0 |
Returns id to update. If the request is not updatable, '0' returned. | get updatableId () {
const isUpdatable = this.isPending || this.isRejected
return isUpdatable ? String(this.id) : '0'
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getNewId(){\r\n this._id = this._id || this.data && this.data.length || 0;\r\n this._id++;\r\n\r\n return this._id;\r\n }",
"function idUpdate(){\n dynamID.currID = dynamID.currID + 1;\n return (dynamID.currID - 1);\n}",
"getId() {\n uniqueId++\n return uniqueId;\n }"... | [
"0.6109258",
"0.60660297",
"0.5948874",
"0.5923962",
"0.5879068",
"0.5879068",
"0.5879068",
"0.5879068",
"0.5879068",
"0.5879068",
"0.5879068",
"0.5870624",
"0.5870624",
"0.5860661",
"0.5855968",
"0.58479744",
"0.58479744",
"0.58479744",
"0.5824869",
"0.5803242",
"0.5787597",... | 0.75555974 | 0 |
Generate stats for 'Market Mondays' | async function markets() {
try {
const client = new CoinMarketCap(process.env.COINMARKETCAP_API_KEY)
const currency = 'CAD';
const cryptoCount = 5;
const prices = await client.getTickers({limit: cryptoCount, convert: currency});
console.log('Market Monday\n');
console.log(`Top ${cryptoCount}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getWeeklyWeather () {\n apiFiveDayUrl = `https://api.openweathermap.org/data/2.5/forecast?q=${cityNameUri}&units=imperial&appid=${key}`;\n\n fetch(apiFiveDayUrl)\n .then(function (response) {\n if (response.ok) {\n response.json().then(function (data) {\n ... | [
"0.5648431",
"0.5585001",
"0.55847216",
"0.5565518",
"0.54358935",
"0.54327387",
"0.54114187",
"0.53934014",
"0.5356732",
"0.5345336",
"0.5340876",
"0.5328332",
"0.5324608",
"0.52067673",
"0.5175433",
"0.5170202",
"0.51679444",
"0.5155823",
"0.51530355",
"0.5135622",
"0.51256... | 0.5687711 | 0 |
MAKE RADIAL GRADIENT WITH WIDTH AND HEIGHT | function radialGradient(width, height) {
var texture = document.querySelector('#canvas');
if ( texture && texture.getContext ) {
texture.width = width;
texture.height = height;
var textureCtx = texture.getContext('2d');
if ( textureCtx ) {
var gradient = textur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function Grad(x, y, z) {\n this.x = x; this.y = y; this.z = z\n }",
"function r({w,r,x=10,y=20}){\n return w+r+x+y;\n }",
"get r() { return Math.sqrt(this.x*this.x + this.y*this.y); }",
"gradw(rVec, resultVec) {\r\n\t\tvar r = rVec.norm(), h = this.smoothingRadius;\r\n\t\trVec.mult(945.0/(32.0*... | [
"0.57855374",
"0.5758094",
"0.57127476",
"0.55706084",
"0.5566933",
"0.5381053",
"0.5361555",
"0.5354665",
"0.5341065",
"0.53261286",
"0.5278164",
"0.5276229",
"0.5270136",
"0.52596027",
"0.52521867",
"0.52521867",
"0.52521867",
"0.52521867",
"0.52521867",
"0.52521867",
"0.52... | 0.60303414 | 0 |
Example stemmer, which expects the tree to equal `otherWord`. | function stemmer() {
return function (cst) {
visit(cst, 'WordNode', function (node) {
node.data = {
'stem': nlcstToString(node)
};
});
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function tokenizeWord(word, callback) {\n \"use strict\";\n var match, parts = [], stemmedPart, singularPart, singularMetaphones, stemmedMetaphones, token;\n\n // TODO: Improve that. Should be in the stemmer actually\n //if (-1 === (match = word.match(/^([#\"',;:!?(.\\[{])*([a-z0-9]+)+([,;:!?)\\]}\"'.]... | [
"0.5649758",
"0.5405843",
"0.52317417",
"0.52143013",
"0.52143013",
"0.521207",
"0.521207",
"0.521207",
"0.521207",
"0.5212047",
"0.52110106",
"0.51703805",
"0.5146049",
"0.51216733",
"0.5114945",
"0.51127154",
"0.510222",
"0.5049849",
"0.50245005",
"0.50245005",
"0.5018398",... | 0.6719994 | 0 |
Update Contact Details Section | function updateContactDetailsSection()
{
// Contact Name
document.getElementById("contactFullName").innerHTML = contactArray[contactListSettings.currentContactIndex].firstName + " " + contactArray[contactListSettings.currentContactIndex].lastName;
// If the Contact is a Favourite
if(contactArray[contactListSetting... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function editContact(){\n var id = readLineSync.question('Lua chon id contact can sua: ');\n var name = readLineSync.question('name: ');\n var phone = readLineSync.question('phoneNum:');\n listContact[id].Name = name;\n listContact[id].Phone = phone;\n save();\n console.log(\"\\nsua thanh cong... | [
"0.69423425",
"0.68192554",
"0.6781242",
"0.67311656",
"0.6610526",
"0.6512428",
"0.6499509",
"0.6476881",
"0.64557356",
"0.64306813",
"0.6384387",
"0.6353706",
"0.6285289",
"0.62662905",
"0.6238962",
"0.6236104",
"0.61845595",
"0.6157441",
"0.6152531",
"0.612882",
"0.6123915... | 0.7379276 | 0 |
Sort Contacts By First Name | function sortContactsByFirstName()
{
contactArray.sort(sortContactsFName);
function sortContactsFName(a, b)
{
var contactFirstNameA = a.firstName.toLowerCase();
var contactFirstNameB = b.firstName.toLowerCase();
if(contactFirstNameA > contactFirstNameB)
{
return 1
}
else if(contactFirstNameA < contac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortContactsByLastName()\n{\n\tcontactArray.sort(sortContactsLName);\n\tfunction sortContactsLName(a, b)\n\t{\n\t\tvar contactLastNameA = a.lastName.toLowerCase();\n\t\tvar contactLastNameB = b.lastName.toLowerCase();\n\n\t\tif(contactLastNameA > contactLastNameB)\n\t\t{\n\t\t\treturn 1\n\t\t}\n\t\telse i... | [
"0.8112475",
"0.78268474",
"0.7661919",
"0.75415695",
"0.7389836",
"0.73395973",
"0.73360354",
"0.710859",
"0.69199383",
"0.6919386",
"0.6904469",
"0.678243",
"0.6748155",
"0.67140794",
"0.66942596",
"0.663602",
"0.6593869",
"0.65282434",
"0.6506649",
"0.650553",
"0.64891666"... | 0.87092227 | 0 |
Sort Contacts By Last Name | function sortContactsByLastName()
{
contactArray.sort(sortContactsLName);
function sortContactsLName(a, b)
{
var contactLastNameA = a.lastName.toLowerCase();
var contactLastNameB = b.lastName.toLowerCase();
if(contactLastNameA > contactLastNameB)
{
return 1
}
else if(contactLastNameA < contactLastNam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sortContactsByFirstName()\n{\n\tcontactArray.sort(sortContactsFName);\n\tfunction sortContactsFName(a, b)\n\t{\n\t\tvar contactFirstNameA = a.firstName.toLowerCase();\n\t\tvar contactFirstNameB = b.firstName.toLowerCase();\n\n\t\tif(contactFirstNameA > contactFirstNameB)\n\t\t{\n\t\t\treturn 1\n\t\t}\n\t\... | [
"0.76919186",
"0.7519812",
"0.74484694",
"0.74071795",
"0.73497456",
"0.733918",
"0.726322",
"0.7010636",
"0.6964866",
"0.69338506",
"0.6798731",
"0.66473234",
"0.6646733",
"0.66196334",
"0.6613195",
"0.6597512",
"0.652875",
"0.6522984",
"0.6415846",
"0.64018095",
"0.634173",... | 0.87659216 | 0 |
returns a winner string | function getWinner(){
if(player1.score > player2.score){
winner = "Player1"
} else if(player2.score > player1.score){
winner = "Player2";
} else {
winner = "Draw"
}
return winner;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"winnerString(){\n var winnersText = \"Game Over!\\n\";\n var winners = getWinners();\n\n for (let index = 0; index < winners.length; index++) {\n winnersText += winners[index].toString();\n if(index < winners.length){\n winnersText += \" and \";\n ... | [
"0.8475914",
"0.7399261",
"0.7380139",
"0.7341227",
"0.73333037",
"0.72752875",
"0.7225271",
"0.72002137",
"0.71822596",
"0.71562666",
"0.7140873",
"0.71317285",
"0.71200985",
"0.7104445",
"0.7104034",
"0.70918655",
"0.70827013",
"0.7035457",
"0.70318824",
"0.7014476",
"0.700... | 0.7897949 | 1 |
add card obj to selection array | function addCardObjToSelectedCardArr(cardObj){
selectedCards.push(cardObj);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addCard(target) {\n cardSelections.push(target);\n }",
"function addToSelectedCards(index) {\n \n if (includes(selectedCards, index) || includes(matchedCards, index)) {\n return;\n }\n \n if (selectedCards.length < 2) {\n selectedCards.push(index);\n } else {\n selectedCards = [... | [
"0.74436164",
"0.6775288",
"0.6691141",
"0.6627961",
"0.6543877",
"0.64553493",
"0.6423826",
"0.63682145",
"0.6317542",
"0.6289295",
"0.62543947",
"0.6238649",
"0.62275255",
"0.6226601",
"0.6177856",
"0.61427456",
"0.6080853",
"0.6078377",
"0.60582936",
"0.6047648",
"0.603933... | 0.8373981 | 0 |
add card obj to display array | function addCardObjToDisplayedArr(cardObj){
displayedCard.push(cardObj)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function addCardObj(cardObj){\n cardObjArr.push(cardObj);\n }",
"add(card){\n this.list.push(card);\n }",
"add(card){\n this.cards.push(card);\n }",
"function appendCardList (card) {\n openCards.push(card);\n }",
"function showCard (obj) {\n cardsFlipped.push(obj[0].childre... | [
"0.7508402",
"0.7207375",
"0.7203965",
"0.71399486",
"0.7103402",
"0.70936966",
"0.7092016",
"0.7092016",
"0.70774883",
"0.7049673",
"0.7006818",
"0.6945775",
"0.691405",
"0.6913288",
"0.690716",
"0.68886894",
"0.68584365",
"0.6817115",
"0.6777227",
"0.67659795",
"0.67453504"... | 0.82165104 | 0 |
insert a card obj at a specific position of display array | function insertIntoDisplayedCardArr(cardObj, index){
displayedCard.splice(index,0,cardObj)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function insertCard(deck, card, idx)\n{\n\tif (!idx)\n\t{\n\t\tidx = topOfDeck();\n\t}\n\t\t\n\tdeck.splice(idx, 0, card);\n}",
"function insertCards(deck, cards, idx)\n{\n\tdeck.splice(idx, 0, cards);\n}",
"function addCardObjToDisplayedArr(cardObj){\n displayedCard.push(cardObj)\n }",
"function p... | [
"0.7240079",
"0.71073574",
"0.706713",
"0.6929169",
"0.67529386",
"0.67384577",
"0.65136516",
"0.6413657",
"0.63127834",
"0.6246625",
"0.62039113",
"0.6193522",
"0.6178602",
"0.6172371",
"0.61470926",
"0.6133227",
"0.6116855",
"0.6115496",
"0.6099301",
"0.6093515",
"0.6092851... | 0.7736614 | 0 |
from: calculate luminanace of a color | function luminanace(r, g, b) {
var a = [r, g, b].map(function (v) {
v /= 255;
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
});
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
} //calculate contrast between two rgb colors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function luminanace (r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow((v + 0.055) / 1.055, 2.4)\n })\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}",
"function luminanace(r, g, b) {\n var a = [r, g, b].map(function (v... | [
"0.779118",
"0.77557945",
"0.736872",
"0.73055804",
"0.7250498",
"0.71520346",
"0.70735717",
"0.6979069",
"0.6962442",
"0.69543",
"0.6949745",
"0.69195986",
"0.69004875",
"0.68847525",
"0.68519783",
"0.6808186",
"0.6804963",
"0.679933",
"0.67774576",
"0.6477366",
"0.6454998",... | 0.77915686 | 0 |
First function to be called, initializes the App and draws clock image. | function initClockApp()
{
// Register our callback on window resize event.
window.addEventListener('resize', resizeCanvas, false);
// Resize 2d canvas to fill the whole window.
resizeCanvas();
// Paint the clock image for first time.
paintClock();
// Repaint the clock image every second.
setIn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initApp(){\n startClock('#clock1');\n startClock('#clock2');\n startClock('#clock3');\n}",
"function init() {\r\n\t// CUSTOMIZE YOUR APP\r\n\tsetTitle(\"Meteor Masher\"); // set title\r\n\tsetByLine(\"by M.T., Stephen Lewis Secondary, 2016\"); // set name\r\n\t\r\n\tsetCanvasSize(canvasX,canvas... | [
"0.72341484",
"0.70278156",
"0.70049024",
"0.6799743",
"0.6744119",
"0.6733912",
"0.66353315",
"0.6553784",
"0.65260017",
"0.65185076",
"0.6479092",
"0.6477463",
"0.6463797",
"0.64613533",
"0.6448759",
"0.6440626",
"0.64221615",
"0.64143455",
"0.63771254",
"0.63553774",
"0.63... | 0.84811026 | 0 |
Returns default config for a tinymce editor. | function getDefaultConfig(editorId) {
const config = Alchemy.TinymceDefaults
config.language = Alchemy.locale
config.selector = `#${editorId}`
config.init_instance_callback = initInstanceCallback
return config
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getConfig(editorId) {\n const editorConfig = tinymceCustomConfigs[editorId] || {}\n return { ...getDefaultConfig(editorId), ...editorConfig }\n}",
"static get defaultConfig() {\n return {\n /**\n * Set to true to select the field text when editing starts\n * @config {Boolean}\n ... | [
"0.7726596",
"0.70178795",
"0.6806791",
"0.67680734",
"0.6705726",
"0.66740274",
"0.6619452",
"0.65768045",
"0.63275766",
"0.6295114",
"0.6074809",
"0.6029186",
"0.59662557",
"0.59319377",
"0.5907601",
"0.5893766",
"0.5795882",
"0.57848376",
"0.5783051",
"0.5783051",
"0.57830... | 0.8234575 | 0 |
Returns configuration for given custom tinymce editor selector. It uses the +.getDefaultConfig+ and merges the custom parts. | function getConfig(editorId) {
const editorConfig = tinymceCustomConfigs[editorId] || {}
return { ...getDefaultConfig(editorId), ...editorConfig }
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getConfig() {\n\tvar config = {};\n\t\n\t// Use current project's root folder as a starting point.\n\t// If no project is active, use current folder as a fallback:\n\tvar configpath = editorProjectPath || editorDirectoryPath;\n\t\n\t// Search for custom config file recursively up to the home folder:\n\tco... | [
"0.65916777",
"0.59844863",
"0.5677252",
"0.56206477",
"0.555319",
"0.55348897",
"0.54864734",
"0.5475652",
"0.5438239",
"0.54097027",
"0.5388529",
"0.538055",
"0.5345383",
"0.5344512",
"0.5344512",
"0.53256005",
"0.5311922",
"0.52949935",
"0.52689743",
"0.51581675",
"0.51324... | 0.72892845 | 0 |
initialize IntersectionObserver if it is not already initialized the observer will initialize Tinymce if the textarea becomes visible | function initializeIntersectionObserver() {
if (tinymceIntersectionObserver === null) {
const observerCallback = (entries, observer) => {
entries.forEach((entry) => {
if (entry.intersectionRatio > 0) {
initTinymceEditor(entry.target)
// disable observer after the Tinymce was init... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"_initIntersectionObserver() {\n if (!hasIntersectionObserver) {\n return;\n }\n\n this._observer = new IntersectionObserver(this._observerHandler.bind(this), this.options.observerOptions);\n\n if (this.ListenerQueue.length) {\n this.ListenerQueue.forEach(listener => {\n t... | [
"0.726916",
"0.72669643",
"0.6331033",
"0.62637174",
"0.60979885",
"0.59087074",
"0.5849221",
"0.5838563",
"0.57591355",
"0.57001954",
"0.5622304",
"0.5567217",
"0.55275273",
"0.54867834",
"0.54024434",
"0.53067416",
"0.5305211",
"0.5294625",
"0.52886266",
"0.52794105",
"0.52... | 0.8318863 | 0 |
Initializes one specific TinyMCE editor | function initTinymceEditor(textarea) {
const editorId = textarea.id
const config = getConfig(editorId)
// remove editor instance, if already initialized
removeEditor(editorId)
if (config) {
const spinner = new Alchemy.Spinner("small")
textarea.closest(".tinymce_container").prepend(spinner.spin().el.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"initWith(options) {\n tinymce.init({ ...Alchemy.TinymceDefaults, ...options })\n }",
"function fnInitialiseEditor()\n {\n elRoot.parentNode.classList.add('-active');\n\n // if it’s already there…\n if (oEditor !== null)\n {\n oEditor.setup();\n return;\n }\n\n // load raw markup ... | [
"0.715309",
"0.71276915",
"0.6964567",
"0.69570833",
"0.6947951",
"0.6849996",
"0.68086284",
"0.6780873",
"0.6726459",
"0.670652",
"0.670652",
"0.6680523",
"0.6672597",
"0.66717887",
"0.6516873",
"0.6488418",
"0.64859426",
"0.64797074",
"0.64737105",
"0.6450099",
"0.6442533",... | 0.766871 | 0 |
Initializes all TinyMCE editors with given ids | init(ids) {
initEditors(ids)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function initEditors(ids) {\n initializeIntersectionObserver()\n\n ids.forEach((id) => {\n const editorId = `tinymce_${id}`\n const textarea = document.getElementById(editorId)\n\n if (textarea) {\n tinymceIntersectionObserver.observe(textarea)\n } else {\n console.warn(`Could not initializ... | [
"0.81478643",
"0.6346094",
"0.6204562",
"0.6199315",
"0.6151673",
"0.6070843",
"0.5924725",
"0.5897854",
"0.5897683",
"0.588028",
"0.5761357",
"0.5735988",
"0.5685881",
"0.5684198",
"0.565595",
"0.5609469",
"0.55878305",
"0.5561873",
"0.5475944",
"0.5448669",
"0.5440587",
"... | 0.8080941 | 1 |
Initializes TinyMCE editor with given options | initWith(options) {
tinymce.init({ ...Alchemy.TinymceDefaults, ...options })
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"init() {\n // Get saved editor settings if any or default values from SettingsHandler\n const initialLanguage = settingsHandler.getEditorLanguageMode();\n const initialContent = settingsHandler.getEditorContent();\n\n this.engine.setTheme('ace/theme/monokai');\n this.engine.$bloc... | [
"0.683308",
"0.6720581",
"0.6636635",
"0.66127867",
"0.6604836",
"0.6584834",
"0.65205735",
"0.6420968",
"0.6420968",
"0.64150614",
"0.6329456",
"0.6264471",
"0.6188737",
"0.6179409",
"0.61392367",
"0.61195827",
"0.6030616",
"0.6026359",
"0.6008906",
"0.5996566",
"0.59685016"... | 0.8370957 | 0 |
Removes the TinyMCE editor from given dom ids. | remove(ids) {
ids.forEach((id) => removeEditor(`tinymce_${id}`))
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"removeFrom(selector) {\n // the selector is a jQuery selector - it has to be refactor if we taking care of the calling methods\n $(selector).each(function (element) {\n removeEditor(element.id)\n })\n }",
"function removeEditor(id) {\n\ttinyMCE.execCommand('mceRemoveEditor', false, id)\n}",
"fun... | [
"0.7098811",
"0.70571494",
"0.70097506",
"0.6490934",
"0.61263996",
"0.5982925",
"0.58768684",
"0.5819864",
"0.57850724",
"0.57721645",
"0.57544494",
"0.5743985",
"0.57390434",
"0.57175076",
"0.56306285",
"0.5579498",
"0.55549335",
"0.55549335",
"0.55459565",
"0.55191374",
"0... | 0.8169467 | 0 |
Remove all tinymce instances for given selector | removeFrom(selector) {
// the selector is a jQuery selector - it has to be refactor if we taking care of the calling methods
$(selector).each(function (element) {
removeEditor(element.id)
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"remove(ids) {\n ids.forEach((id) => removeEditor(`tinymce_${id}`))\n }",
"function removeTinyMCE(){\n tinymce.remove('div');\n }",
"function removeAll(selector)\n {\n var allElements = timelineContainer.querySelectorAll(selector);\n for(var i=0; i<allElements.length; i++)... | [
"0.70316863",
"0.68617487",
"0.67591786",
"0.6226611",
"0.6202437",
"0.61814374",
"0.59650975",
"0.596053",
"0.5903186",
"0.5901008",
"0.5892672",
"0.58675027",
"0.58353716",
"0.5772452",
"0.57663566",
"0.57210976",
"0.5721065",
"0.5718265",
"0.56936115",
"0.56838405",
"0.567... | 0.74177796 | 0 |
set tinymce configuration for a given selector key | setCustomConfig(key, configuration) {
tinymceCustomConfigs[key] = configuration
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"mwSetSelector(selector = \".mw-selector\"){\r\n this.mwSelector = selector\r\n }",
"function initializeTinyMCE(selector, height, menuBar, plugins, toolbar1) {\n tinymce.remove(selector);\n tinymce.init({\n selector: selector,\n height: height,\n skin: \"lightgray\",\n men... | [
"0.59408116",
"0.54543096",
"0.5426759",
"0.5332711",
"0.530345",
"0.51373476",
"0.51181394",
"0.51127017",
"0.49916622",
"0.4953461",
"0.49379835",
"0.49322343",
"0.48914164",
"0.48828825",
"0.4882612",
"0.48799965",
"0.48337787",
"0.47919753",
"0.47894025",
"0.4783378",
"0.... | 0.7144791 | 0 |
Returns an image loaded by the given alias (if exists) | getImage(alias) {
if (this._imgAlias.hasOwnProperty(alias)) {
return this._imgLoaded[this._imgAlias[alias]]
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getFile(alias) {\n if (this._fileAlias.hasOwnProperty(alias)) {\n return this._fileLoaded[this._fileAlias[alias]]\n }\n }",
"function getImage(name) {\n const image = images[name];\n\n if (image.includes('https')) return image;\n\n return imageMap[image];\n }",
"function g... | [
"0.648291",
"0.6479299",
"0.64598453",
"0.6148401",
"0.5869091",
"0.5793364",
"0.5786855",
"0.5629449",
"0.5604977",
"0.5598803",
"0.55592555",
"0.550273",
"0.5495626",
"0.5492124",
"0.54616135",
"0.5461051",
"0.5427929",
"0.5393621",
"0.53597635",
"0.5348607",
"0.5339978",
... | 0.80475575 | 0 |
Returns an audio loaded by the given alias (if exists) | getAudio(alias) {
if (this._audioAlias.hasOwnProperty(alias)) {
return this._audioLoaded[this._audioAlias[alias]]
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getSound(instrument) {\n // If the instrument has not been found, terminate process\n if (!map.has(instrument)) process.exit(1);\n\n // Instrument exists, return it sound\n return map.get(instrument);\n}",
"function getAudio(byteArray) {\n var base64 = arrayBufferToBase64(byteArray);\n var audioUR... | [
"0.64330447",
"0.6356319",
"0.6240382",
"0.6230217",
"0.62080234",
"0.62027955",
"0.6097491",
"0.6094328",
"0.60703254",
"0.6047748",
"0.60474485",
"0.60308796",
"0.6026117",
"0.6004775",
"0.5991001",
"0.59872735",
"0.5974048",
"0.5954483",
"0.59450155",
"0.593784",
"0.593278... | 0.83717537 | 0 |
Returns a file loaded by the given alias (if exists) | getFile(alias) {
if (this._fileAlias.hasOwnProperty(alias)) {
return this._fileLoaded[this._fileAlias[alias]]
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getImage(alias) {\n if (this._imgAlias.hasOwnProperty(alias)) {\n return this._imgLoaded[this._imgAlias[alias]]\n }\n }",
"function get_file (file){\n return path.resolve(temp_dir + '/' + file);\n }",
"function getSrc(src) {\n if ((0, _includes2.default)(src, 'http')) {\n... | [
"0.60585797",
"0.57263774",
"0.5644304",
"0.56110567",
"0.54909533",
"0.5428113",
"0.5425044",
"0.5405986",
"0.5402377",
"0.53637105",
"0.53617936",
"0.53597516",
"0.5345069",
"0.53370076",
"0.52779514",
"0.5222093",
"0.5204828",
"0.52006906",
"0.51956254",
"0.5171764",
"0.51... | 0.7951018 | 0 |
Restores to the original state an array of objectified data | static restoreArray(array) {
let result = [];
array.forEach(function (elem) {
if (elem._otype) {
result.push(Objectify.restore(elem, elem._otype));
}
});
return result;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"restoreOriginalState() {\n\n\t\tconst originalValueOffset = this.valueSize * 3;\n\t\tthis.binding.setValue( this.buffer, originalValueOffset );\n\n\t}",
"_revertToOriginal() {\n this._storage = {}\n this._length = 0\n this._head = 0\n }",
"replace(data) {\n return this.reset(this.deserialize(data)... | [
"0.64795494",
"0.6151585",
"0.6094533",
"0.60829836",
"0.60780036",
"0.6077374",
"0.6077374",
"0.6077374",
"0.60719675",
"0.6064414",
"0.60356355",
"0.6034164",
"0.6012774",
"0.60104865",
"0.6004565",
"0.5949749",
"0.59465265",
"0.5939781",
"0.59086585",
"0.58770806",
"0.5828... | 0.66121554 | 0 |
Checks if a given object contains the objectify method | static hasObjectify(object) {
return isObjectAssigned(object) && isFunction(object.objectify);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function IsObject(x) {\n\t return typeof x === \"object\" ? x !== null : typeof x === \"function\";\n\t }",
"function IsObject(x) {\r\n return typeof x === \"object\" ? x !== null : typeof x === \"function\";\r\n }",
"function IsObject(x) {\r\n return type... | [
"0.6610817",
"0.6591022",
"0.65426606",
"0.6540632",
"0.6540632",
"0.6540632",
"0.6540632",
"0.6540632",
"0.6540632",
"0.6540632",
"0.6509865",
"0.6509865",
"0.6509865",
"0.64823115",
"0.64823115",
"0.6364861",
"0.6363402",
"0.63218546",
"0.6275841",
"0.6181254",
"0.6154283",... | 0.8019068 | 0 |
Restores an object of a given type | static restore(data, typeName) {
try {
let type = isObjectAssigned(typeName) ? typeName : data._otype;
type = eval(type);
if (type && type.restore) {
return type.restore(data);
}
} catch (ex) {
Objectify._logger.error("Failed to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static restoreFromString(jsonString, typeName) {\n return Objectify.restore(JSON.parse(jsonString), typeName);\n }",
"function restoreOldGame(p_JSON,p_type){\n\t _currVars.myVars.myType = p_type;\n\t var tempObj = JSON.parse(p_JSON);\n\t $(\".content\").html(tempObj.myHtml)\n\t _currVars.myVars = t... | [
"0.61442524",
"0.58880746",
"0.58059883",
"0.5666223",
"0.5647684",
"0.5499317",
"0.5498522",
"0.54091954",
"0.53964883",
"0.53111804",
"0.52796066",
"0.52657205",
"0.52566135",
"0.52245575",
"0.5176847",
"0.51722044",
"0.51691383",
"0.51669353",
"0.513826",
"0.51199305",
"0.... | 0.65045285 | 0 |
Restores an object from a string | static restoreFromString(jsonString, typeName) {
return Objectify.restore(JSON.parse(jsonString), typeName);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function convertStringToObj(str) {\n try {\n var o = eval(\"(\" + str + \")\"); // eval(str);\n return o;\n } catch (ex) {\n console_log(ex.name + \":\" + ex.message + \":\" + ex.location + \":\" + ex.text);\n }\n }",
"function ... | [
"0.65510553",
"0.6189867",
"0.61829776",
"0.61829776",
"0.5932401",
"0.591544",
"0.5775236",
"0.5753639",
"0.5710674",
"0.564598",
"0.5620965",
"0.55961823",
"0.5483756",
"0.54761183",
"0.54738826",
"0.5470734",
"0.54586196",
"0.54086137",
"0.5370381",
"0.53573084",
"0.533646... | 0.7235365 | 0 |
Gets a filename from a given path | static getFilename(path) {
let index = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
return path.substring((index >= 0 && index < path.length - 1 ? index + 1 : 0), path.length);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFileNameFromPath(path) {\n var index = path.lastIndexOf('/');\n var extIndex = path.lastIndexOf('.');\n return path.substring(index , extIndex);\n }",
"function getFileNameFromPath(path) {\n var index = path.lastIndexOf('/');\n var extIndex = path.lastIndexOf('.');\n return... | [
"0.8411676",
"0.83233076",
"0.8240528",
"0.81694806",
"0.8120081",
"0.7976007",
"0.78130645",
"0.7786604",
"0.7748093",
"0.74840873",
"0.70592207",
"0.7056657",
"0.7046501",
"0.6973672",
"0.6950396",
"0.6946463",
"0.69364625",
"0.6812562",
"0.679135",
"0.6790552",
"0.6669583"... | 0.8567765 | 0 |
Gets a file extension from a given path | static getFileExtension(path) {
return path.substring(path.lastIndexOf('.'), path.length);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getFileExtension( path ) {\n\n if ( path.indexOf( \".\" ) > -1 ) {\n return path.split( \".\" ).pop();\n }\n\n return \"\";\n }",
"getExtension(path) {\n let basename = path.split(/[\\\\/]/).pop()\n ,pos = basename.lastIndexOf(\".\"... | [
"0.8459771",
"0.8400551",
"0.8168963",
"0.81557536",
"0.8122872",
"0.8122872",
"0.8072947",
"0.8072947",
"0.8040791",
"0.7577451",
"0.7556836",
"0.75455767",
"0.7488688",
"0.736894",
"0.73363906",
"0.72746617",
"0.724029",
"0.7221996",
"0.72215325",
"0.7215235",
"0.7211874",
... | 0.8734136 | 0 |
Checks if pathA can be contained inside pathB | static relativeTo(pathA, pathB) {
return Path.wrapDirectoryPath(pathA).indexOf(Path.wrapDirectoryPath(pathB)) === 0;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"isAncestor(path, another) {\n return path.length < another.length && Path.compare(path, another) === 0;\n }",
"isAncestor(path, another) {\n return path.length < another.length && Path.compare(path, another) === 0;\n }",
"function needsJoin(pathA, pathB) {\n\t\tvar firstA = pathA.firstSegment.point;\n\... | [
"0.63700813",
"0.63700813",
"0.6291174",
"0.62823874",
"0.62823874",
"0.627115",
"0.627115",
"0.6065883",
"0.6065883",
"0.6057032",
"0.59802073",
"0.59802073",
"0.5969666",
"0.5969666",
"0.5820808",
"0.58163583",
"0.57832146",
"0.576516",
"0.55960864",
"0.5591635",
"0.5554781... | 0.6944826 | 0 |
Makes the full path relative to the base path | static makeRelative(basePath, fullPath) {
return fullPath.replace(Path.wrapDirectoryPath(basePath), "");
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function getAbsolutePath(relative) {\n\treturn getBaseURL() + relative\n}",
"function abspath2rel(base_path, target_path) {\n var tmp_str = '';\n base_path = base_path.split('/');\n base_path.pop();\n target_path = target_path.split('/');\n while(base_path[0] === target_path[0]... | [
"0.69681126",
"0.69562054",
"0.6833034",
"0.6770167",
"0.6755699",
"0.67294705",
"0.66904944",
"0.66815245",
"0.6672603",
"0.6658843",
"0.6642154",
"0.66417414",
"0.66408426",
"0.6632548",
"0.6632548",
"0.659211",
"0.6553142",
"0.651798",
"0.6513082",
"0.6513082",
"0.6513082"... | 0.76618826 | 0 |
Set this as the active game | setActive() {
GameManager.activeGame = this;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setActive() {\n GameManager.activeGame = this;\n }",
"isActive() {\r\n return this.gameActive;\r\n }",
"setActive () {\n\t\tthis._active = true;\n\t\tthis.$element.addClass('screenlayer-active');\n\t}",
"constructor(){\n this.current_game = new Game()\n }",
"set currentGame(game) {\n ... | [
"0.8227622",
"0.6931114",
"0.6618192",
"0.6308913",
"0.62666816",
"0.6186641",
"0.61309487",
"0.6084413",
"0.6062412",
"0.60167617",
"0.60081226",
"0.6006107",
"0.6002265",
"0.6001834",
"0.587775",
"0.5863257",
"0.5853593",
"0.5849123",
"0.5831729",
"0.5811681",
"0.5791953",
... | 0.8352136 | 0 |
Returns an array with all the game objects of this scene. All child game objects are included. | getAllGameObjects() {
let result = [];
// TODO: make it a private function
function recursive(gameObjects) {
gameObjects.forEach(function (elem) {
result.push(elem);
recursive(elem.getChildren());
});
}
recursive(this._gam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function recursive(gameObjects) {\n gameObjects.forEach(function (elem) {\n result.push(elem);\n recursive(elem.getChildren());\n });\n }",
"get sceneTopLevelGraphComponents() {\n this.__collectTopLevelSceneGraphComponents();\n return this.... | [
"0.6299845",
"0.6294394",
"0.61514294",
"0.60649943",
"0.59803003",
"0.5946314",
"0.58710456",
"0.58504593",
"0.58269835",
"0.58139247",
"0.57764477",
"0.57315135",
"0.57225096",
"0.5716456",
"0.5712903",
"0.566662",
"0.56613463",
"0.56613463",
"0.56513494",
"0.5638748",
"0.5... | 0.7745853 | 0 |
Generates and assigns a component to the given game object. The component is returned in the function call | assign(scriptName, gameObject) {
let component = this.generateComponent(scriptName);
gameObject.addComponent(component);
return component;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createComponent(obj){\n\t\t\tvar comp = new Component(obj.selector, obj.template, obj.ctrlFunc);\n\t\t\tthis[componentSymbol].push({\n\t\t\t\tname: obj.name,\n\t\t\t\tcomponent: comp\n\t\t\t});\n\t\t\treturn comp;\n\t\t}",
"addComponent(components) {\n if (components == null || components == undefined) return... | [
"0.6763366",
"0.6245724",
"0.6222089",
"0.6145825",
"0.6121207",
"0.6089206",
"0.6076369",
"0.6072408",
"0.60449094",
"0.6031113",
"0.6025037",
"0.5999619",
"0.5998784",
"0.59912723",
"0.5984033",
"0.5969276",
"0.5968227",
"0.59533685",
"0.5910254",
"0.590401",
"0.590401",
... | 0.7702268 | 0 |
Generates a component from one stored script | generateComponent(scriptName) {
if (!this._store[scriptName]) {
return null;
}
let component = Object.create(this._store[scriptName].prototype);
component._name = scriptName;
// now we need to assign all the instance properties defined:
let properties = this... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"generateComponentList () {\n \n let componentsObj = []\n , match;\n \n while ((match = utils.regExp.componentDeclaration.exec(this.scriptBody)) !== null) {\n componentsObj.push(match);\n }\n\n if (componentsObj && componentsObj.length > 0) {\n let thirdPartyComponentJson = (\n ... | [
"0.65497446",
"0.6153773",
"0.6124488",
"0.61145",
"0.5998969",
"0.59452856",
"0.5922757",
"0.59024364",
"0.58871675",
"0.5881633",
"0.5854584",
"0.5854584",
"0.5854584",
"0.5853529",
"0.5853529",
"0.5853529",
"0.5853529",
"0.5853529",
"0.5853529",
"0.5853529",
"0.5853529",
... | 0.67692244 | 0 |
plays the current audio source | play() {
this._source.play();
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function playSound() {\n // play the source now\n soundSource.noteOn(context.currentTime);\n }",
"function play() {\n\t\tthis.audio.play();\n\t}",
"play() {\n\t\t// create new audio source\n\t\tlet source = audioContext.createBufferSource();\n\t\t// load our previously stored audio buffer into the source\... | [
"0.8143854",
"0.8004802",
"0.785765",
"0.7805408",
"0.76500785",
"0.76395273",
"0.7636819",
"0.75712717",
"0.7482007",
"0.74702823",
"0.741169",
"0.7376386",
"0.7366784",
"0.7351003",
"0.7350638",
"0.7341086",
"0.73248994",
"0.72892267",
"0.7278686",
"0.7132878",
"0.7122568",... | 0.81650436 | 0 |
Creates a shader from the content of a script tag | createShaderFromScript(gl, scriptId, shaderType) {
// look up the script tag by id.
let shaderScriptElem = document.getElementById(scriptId);
if (!shaderScriptElem) {
this._logger.warn("Unknown script target element, discarding..");
return null;
}
// extr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"static load_shader(scriptid, attrs) {\n var script = document.getElementById(scriptid);\n var text = script.text;\n\n var ret = new ShaderProgram(undefined, undefined, undefined, [\"position\", \"normal\", \"uv\", \"color\", \"id\"]);\n\n var lowertext = text.toLowerCase();\n var vshader =... | [
"0.7471014",
"0.689821",
"0.6789846",
"0.6684797",
"0.6680869",
"0.6620733",
"0.66050345",
"0.6586126",
"0.6585329",
"0.6551231",
"0.6545256",
"0.6545046",
"0.65424526",
"0.6534845",
"0.65231866",
"0.65092236",
"0.65062934",
"0.649667",
"0.64633167",
"0.64290726",
"0.64117414... | 0.7373915 | 1 |
Creates a program based on both vertex and fragment given scripts | createProgramFromScripts(gl, vertexScript, fragmentScript) {
let vshader = this.createShader(gl, vertexScript, "vertex");
let fshader = this.createShader(gl, fragmentScript, "fragment");
if (isObjectAssigned(vshader) && isObjectAssigned(fshader)) {
return this.createProgram(gl, vsha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"createProgramFromScriptElements(gl, vertexScriptId, fragmentScriptId) {\n let vshader = this.createShaderFromScript(gl, vertexScriptId, \"vertex\");\n let fshader = this.createShaderFromScript(gl, fragmentScriptId, \"fragment\");\n\n if (isObjectAssigned(vshader) && isObjectAssigned(fshader)) ... | [
"0.714123",
"0.7062068",
"0.7047",
"0.7035019",
"0.6985165",
"0.6812578",
"0.67808145",
"0.6640991",
"0.6561623",
"0.65582263",
"0.6534119",
"0.6501943",
"0.6479795",
"0.6452518",
"0.6435585",
"0.64183027",
"0.6362469",
"0.634895",
"0.6346139",
"0.6332806",
"0.63268745",
"0... | 0.7570604 | 0 |
endregion region Methods Setup shader logic | setup() {
if (this.compile()) {
let shaderManager = GameManager.activeGame.getShaderManager();
if (shaderManager) {
shaderManager.useShader(this);
} else {
this._gl.useProgram(this._program);
}
// cache some script loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"setup() {\n if (this.compile()) {\n let shaderManager = GameManager.activeGame.getShaderManager();\n if (shaderManager) {\n shaderManager.useShader(this);\n } else {\n this._gl.useProgram(this._program);\n }\n\n // cache some script locations:\n this.cacheUniformLocat... | [
"0.7822198",
"0.76118183",
"0.7534086",
"0.7326561",
"0.7325143",
"0.73199326",
"0.7313384",
"0.7230024",
"0.7194978",
"0.7190023",
"0.7187809",
"0.7182712",
"0.71538794",
"0.7137377",
"0.71065897",
"0.70643777",
"0.7059901",
"0.7059901",
"0.7047366",
"0.70278686",
"0.7024535... | 0.77716243 | 1 |
Cache the uniform locations for faster reutilization | cacheUniformLocations(keys) {
for (let i = 0; i < keys.length; ++i) {
let type = typeof(this.uniforms[keys[i]]);
if (type !== "object"){
debug.warn("Shader's uniform " + keys[i] + " is not an object.");
continue;
}
this.uniforms[k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cacheUniformLocations(keys) {\n for (let i = 0; i < keys.length; ++i) {\n let type = typeof this.uniforms[keys[i]];\n\n if (type !== \"object\") {\n this._logger.warn(\"Shader's uniform \" + keys[i] + \" is not an object.\");\n continue;\n }\n\n this.uniforms[keys[i]]._location... | [
"0.7674713",
"0.71045774",
"0.70163625",
"0.6996651",
"0.64765537",
"0.6368233",
"0.623138",
"0.6068472",
"0.60522306",
"0.5925508",
"0.59091514",
"0.59091514",
"0.59091514",
"0.59091514",
"0.59091514",
"0.59077036",
"0.59067535",
"0.5887458",
"0.5886276",
"0.5886276",
"0.588... | 0.7709681 | 0 |
Cache the attribute locations for faster reutilization | cacheAttributeLocations(keys) {
for (let i = 0; i < keys.length; ++i) {
this.attributes[keys[i]] = this._gl.getAttribLocation(this._program, keys[i]);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"cacheAttributeLocations(keys) {\n for (let i = 0; i < keys.length; ++i) {\n this.attributes[keys[i]] = this._gl.getAttribLocation(this._program, keys[i]);\n }\n }",
"cacheUniformLocations(keys) {\n for (let i = 0; i < keys.length; ++i) {\n let type = typeof(this.uniforms[keys[i]]);\... | [
"0.83929116",
"0.6445635",
"0.6404672",
"0.62223065",
"0.6152567",
"0.6071625",
"0.6035095",
"0.59382224",
"0.58915716",
"0.57718754",
"0.5770852",
"0.5770852",
"0.57464",
"0.57464",
"0.57464",
"0.57420737",
"0.5736062",
"0.57167196",
"0.57065773",
"0.5687472",
"0.56731224",
... | 0.83042663 | 1 |
Syncs all the uniforms attached to this shader | syncUniforms() {
this._textureCount = 1;
for (let key in this.uniforms) {
this.syncUniform(this.uniforms[key]);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"syncUniforms() {\n this._textureCount = 1;\n\n for (let key in this.uniforms) {\n this.syncUniform(this.uniforms[key]);\n }\n }",
"setUniforms(uniformArray){\n let uniformLocationNames = this.vertexShader.getUniformLocationNames().concat(this.fragmentShader.getUniformLocationNames());\n\n le... | [
"0.84564817",
"0.70526814",
"0.7031401",
"0.69435066",
"0.6869491",
"0.678215",
"0.6570104",
"0.62918276",
"0.62918276",
"0.6268975",
"0.6268975",
"0.6261269",
"0.6258628",
"0.6247523",
"0.6247523",
"0.6247523",
"0.6247523",
"0.6246135",
"0.62429917",
"0.62421274",
"0.6240935... | 0.8556222 | 0 |
Synchronizes/updates the values for the given uniform | syncUniform(uniform) {
let location = uniform._location;
let value = uniform.value;
let gl = this._gl;
// depending on the uniform type, WebGL has different ways of synchronizing values
// the values can either be a Float32Array or JS Array object
switch (uniform.type) {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"syncUniform(uniform) {\n let location = uniform._location;\n let value = uniform.value;\n let gl = this._gl;\n\n // depending on the uniform type, WebGL has different ways of synchronizing values\n // the values can either be a Float32Array or JS Array object\n switch (uniform.type) {\n case... | [
"0.7634379",
"0.68754464",
"0.6868149",
"0.6801007",
"0.67013353",
"0.6114922",
"0.59930974",
"0.59853333",
"0.59772074",
"0.5825954",
"0.57847804",
"0.5733918",
"0.5579767",
"0.5576122",
"0.5561799",
"0.55526555",
"0.55429786",
"0.55429786",
"0.5538137",
"0.5531551",
"0.5523... | 0.7650296 | 0 |
get socket buffer amount | get buffer () {
return this.socket ? this.socket.bufferedAmount : null;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"get length() {\n return this.buf.length;\n }",
"static get MAX_BUFFER_LENGTH() {\n return clarinet.MAX_BUFFER_LENGTH;\n }",
"function size (buffer) {\n validate(buffer);\n\n return buffer.numberOfChannels * buffer.getChannelData(0).byteLength;\n}",
"get bytesReceived() {return this._bytes... | [
"0.6691725",
"0.65791655",
"0.64881825",
"0.633578",
"0.6329417",
"0.6268368",
"0.6268368",
"0.6268368",
"0.6268368",
"0.62315",
"0.6211825",
"0.60860676",
"0.6033802",
"0.60089374",
"0.5968442",
"0.5968442",
"0.5946662",
"0.5921692",
"0.5920671",
"0.5906707",
"0.5880996",
... | 0.79638815 | 0 |
Force atlas grunt multitask | function multitask() {
// Merge task-specific and/or target-specific options with these defaults.
var options = this.options({});
// Iterate over all specified file groups.
this.files.forEach(function(f) {
// Concat specified files.
var src = f.src.filter(function(filepath) {
// Wa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function createMultiTask(grunt, name) {\n grunt.registerMultiTask(name, 'Check the files exits.', function() {\n var done = this.async();\n grunt.util.async.forEachSeries(this.filesSrc, function(file, next) {\n // echo\n grunt.log.writeln('- ' + file);\n\n var body = fs.readFileSync(file, {en... | [
"0.59448177",
"0.56487745",
"0.5647511",
"0.5640229",
"0.55495757",
"0.5538108",
"0.5525325",
"0.55224764",
"0.5515765",
"0.5493257",
"0.5380742",
"0.53289926",
"0.5290272",
"0.52669364",
"0.5241361",
"0.5222466",
"0.52196133",
"0.52162516",
"0.51880234",
"0.51659214",
"0.515... | 0.59454066 | 0 |
draw an junction block | function junction_block(x, color) {
let junction_block = svg.paper.rect(x, 445, 2, 10).attr({
fill: color,
stroke: 'none',
});
return junction_block
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"draw(){\n noStroke();\n if(this.getHover() || this.getSelected()){\n fill(BLUE_5); //needs a constant\n }\n else{\n fill(this.col);\n }\n \n push();\n beginShape(); //CCW\n vertex(this.getX() - (this.w)/2.0, this.getY() + (this.h)... | [
"0.6347114",
"0.6185463",
"0.60120684",
"0.5925785",
"0.5921405",
"0.5879815",
"0.58770174",
"0.58261126",
"0.5812693",
"0.5799382",
"0.5774704",
"0.5770262",
"0.5763966",
"0.5761998",
"0.5759448",
"0.57594323",
"0.57588214",
"0.57388085",
"0.573729",
"0.57292783",
"0.5728588... | 0.7182122 | 0 |
This method checks that month input is appropriate (not empty, max of 2 digits, no letters, between 1 & 12) | validateMonth(input) {
// Handles an empty input field
if (input === "") {
return "Month field cannot be empty";
}
// Prevents users from putting in more than 2 characters
if (input.length > 2) {
return "Month length must not exceed 2";
}
// Checks for non-numeric ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function validateMonth(month)\n {\n var valid = true;\n if(isNaN(month))\n {\n valid = false;\n }\n else\n {\n var num = parseInt(month);\n if (num <1 || num >12)\n {\n valid = false;\n }\n }\n... | [
"0.80803806",
"0.7886935",
"0.7886935",
"0.7754031",
"0.75513375",
"0.75513375",
"0.7546887",
"0.7289533",
"0.7119208",
"0.71015996",
"0.7070103",
"0.69558406",
"0.6916438",
"0.6916438",
"0.6911194",
"0.6911194",
"0.68002045",
"0.6798188",
"0.67662084",
"0.6732542",
"0.671561... | 0.8322412 | 0 |
fills in the video details. this is necessary so that the markdown can be rendered without waiting for the oembed data request the argument is the embedded element | function fillEmbed(video) {
let href = video.getAttribute("data-url")
let service = services[video.getAttribute("data-service")]
getOembedMetadata(service.oembed, href, (err, data) => {
if(err) {
video.querySelector(".embedded-video-title").textContent = "Error Finding Video"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function embedVideo(data) {\n $('iframe').attr('src', 'https://www.youtube.com/embed/' + data.items[0].id.videoId)\n $('h3').text(data.items[0].snippet.title)\n $('.description').text(data.items[0].snippet.description)\n}",
"function showVideo(video, videoDiv) {\n let titleH2 = document.createElement... | [
"0.7009393",
"0.6713979",
"0.656578",
"0.6552129",
"0.6531946",
"0.6489279",
"0.6487706",
"0.64867973",
"0.645081",
"0.6424162",
"0.6419214",
"0.6389659",
"0.61928946",
"0.61242366",
"0.60479677",
"0.60240126",
"0.6020187",
"0.6016225",
"0.6006429",
"0.60036635",
"0.599792",
... | 0.764119 | 0 |
This function displays user input name search matches from a JSON object. This method will loop through our JSON object checking if any of the name values are the same as the user's input value. If so we will display the full object entry for the user to see, otherwise we will send a no results found message back in th... | function findMatch() {
// take search input and make all lower case (so that we can check case-insensitively)
// also split the word up into space separated bits to check for partial searches
let searchName = document.getElementById("search").value.toString().toUpperCase().trim();
// build our out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function searchJson(searchInput) {\n var contents = searchRequest.response;\n var results = \"\";\n for(var i = 0; i < contents.length; i++){\n if(contents[i]['nm'] === searchInput || contents[i]['cty'] === searchInput || contents[i]['hse'] === searchInput || contents[i]['yrs'] === searchInput){\n ... | [
"0.76515734",
"0.67122245",
"0.66285604",
"0.66090876",
"0.64880383",
"0.6423886",
"0.6423773",
"0.6374155",
"0.6365294",
"0.63230205",
"0.62972337",
"0.6286919",
"0.627979",
"0.627625",
"0.6237654",
"0.6221658",
"0.6206415",
"0.61999273",
"0.61949",
"0.6187657",
"0.61793864"... | 0.7986874 | 0 |
JS Socket code to access RTMonitor realtime sirivm data | function RTMonitorAPI(client_data) {
// client_data will passed to rt_monitor at connect time
// to help identify/validate the client.
// client_data = { rt_client_id: <unique id for this client>
// rt_client_name: <some descriptive name, e.g. display name>
// rt_cli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function gotSocket()\n{\n const r = window.radioclient;\n\n r.transmitting = true; // Just so that receive will start.\n receive();\n notice(\"Connected.\");\n document.getElementsByClassName('Controls')[0].id = 'ControlsVisible';\n}",
"function measureMoistureLevel(socket) {\n var data = pin.read();\n ... | [
"0.65598696",
"0.64618534",
"0.6444041",
"0.63514555",
"0.6286911",
"0.62512296",
"0.61949915",
"0.6151776",
"0.61246145",
"0.61035305",
"0.60521054",
"0.60413635",
"0.60413635",
"0.60197484",
"0.594663",
"0.5925596",
"0.588577",
"0.58823156",
"0.5857902",
"0.58177865",
"0.58... | 0.66919935 | 0 |
Generates enemies and their sprites from gamedata and pushes them into the spawnableEnemies array. | generateEnemies() {
for (let i = 0; i < gameData.level.enemies.length; i++) {
const enemy = gameData.level.enemies[i];
enemy.spawnTime = gameData.level.spawnRate * (i + 1) + (enemy.wave * 600)
enemy.gameObject = this.add.sprite(0, 0, enemy.type)
enemy.gameObject.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function spawnEnemies(_game, enemyCount) {\n for (var i = 0; i < enemyCount; i++) {\n var spawnTile = pickSpawnTile();\n var type = Phaser.Math.Between(0, GLOBALS.ENEMY_TYPES.length - 1);\n var lvl = Phaser.Math.Between(1, 10);\n // enemies.push(new enemy(i, _game.physics.add.sprite(spawnTile.x, spawn... | [
"0.75440145",
"0.7348623",
"0.7235705",
"0.69815755",
"0.69623524",
"0.6962282",
"0.693923",
"0.69340545",
"0.6916421",
"0.68889344",
"0.6876842",
"0.6829461",
"0.68103886",
"0.67637",
"0.67624384",
"0.67279387",
"0.66820925",
"0.6677319",
"0.6674108",
"0.6666477",
"0.6630998... | 0.7721952 | 0 |
gets tile coordinate you are pointing at and attempts to place tower. Will use to check where you can build towers. | placeTower() {
var x = layer.getTileX(game.input.activePointer.worldX);
var y = layer.getTileY(game.input.activePointer.worldY);
var tile = map.getTile(x, y, layer);
//if else if else - checks to see if the tile already has a tower, and if the tile index(id/type) can be built on.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getNearestTower(board, x, y, mine) {\n var towers_to_check = [];\n var result = [];\n if(mine == 0) {\n // get all towers on the board that are not mine\n for (let i = 0; i < board_size; i++) {\n for (let j = 0; j < board_size; j++ ) {\n ... | [
"0.6883591",
"0.660443",
"0.64209974",
"0.6385818",
"0.6382776",
"0.63692164",
"0.6251835",
"0.6222129",
"0.6205008",
"0.617288",
"0.6168327",
"0.6153477",
"0.61304426",
"0.60798323",
"0.60763866",
"0.6074378",
"0.6010987",
"0.59913725",
"0.5990136",
"0.5968327",
"0.5922175",... | 0.76131976 | 0 |
checkEnemySpawn checks if there is still an enemy in the spawnableEnemies array and checks the current game time vs the spawn time for the enemy. | checkEnemySpawn() {
var nextEnemy = gameState.spawnableEnemies[0]
// console.log('UPDATE:', game.time.now, gameState.spawnableEnemies[0])
if (nextEnemy && gameClock >= nextEnemy.spawnTime) {
this.spawnEnemy(nextEnemy)
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function spawnMultipulEnemies() {\n if (enemies.length <= numberOfEnemies && deadEnemies <= numberOfEnemies){\n if (newEnemySpawn.isDone() ) {\n enemies.push(new Enemy (enemyX, enemyY, pathToFollow, cellHeight, cellWidth, enemyHealth));\n newEnemySpawn.reset();\n }\n }\n \n for(let i = 0; i < e... | [
"0.6474048",
"0.6332474",
"0.62563527",
"0.625486",
"0.6165818",
"0.6150056",
"0.61228824",
"0.6088875",
"0.6029583",
"0.6017122",
"0.5998516",
"0.5987118",
"0.5972668",
"0.59544",
"0.593672",
"0.5904937",
"0.5875424",
"0.5870853",
"0.5867518",
"0.58233637",
"0.58115864",
"... | 0.83171034 | 0 |
weighted sampling with replacement uses binary search lookup against cumulative weight | function sampleRW(size, buffer, index, weight) {
const n = index.length;
const w = new Float64Array(n);
let sum = 0;
for (let i = 0; i < n; ++i) {
w[i] = (sum += weight(index[i]));
}
const bisect = bisector(ascending).right;
for (let i = 0; i < size; ++i) {
buffer[i] = index[bisect(w, sum * rand... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sampleNW(size, buffer, index, weight) {\n const n = index.length;\n if (size >= n) return index;\n\n const w = new Float32Array(n);\n const k = new Uint32Array(n);\n for (let i = 0; i < n; ++i) {\n k[i] = i;\n w[i] = -Math.log(random()) / weight(index[i]);\n }\n\n k.sort((a, b) => w[a] - w[b]... | [
"0.64416337",
"0.6379931",
"0.60956925",
"0.6056574",
"0.60162526",
"0.6005553",
"0.59790814",
"0.59695065",
"0.59145725",
"0.59070855",
"0.58409876",
"0.5820791",
"0.58062434",
"0.57770675",
"0.57024884",
"0.5700352",
"0.5691752",
"0.56905186",
"0.56738",
"0.5599193",
"0.558... | 0.6391108 | 1 |
weighted sample without replacement uses method of Efraimidis and Spirakis TODO: could use minheap to improve efficiency | function sampleNW(size, buffer, index, weight) {
const n = index.length;
if (size >= n) return index;
const w = new Float32Array(n);
const k = new Uint32Array(n);
for (let i = 0; i < n; ++i) {
k[i] = i;
w[i] = -Math.log(random()) / weight(index[i]);
}
k.sort((a, b) => w[a] - w[b]);
for (let i ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function selectFromWeights(source) {\n var data = source.list;\n var weightList = [];\n var sum = 0;\n var randomNumber = Math.random(1);\n //console.log(\"Random Number = \" + randomNumber);\n\n for (var entry in data) {\n var entryToAdd = [];\n entr... | [
"0.6213306",
"0.6137563",
"0.60535794",
"0.58860594",
"0.58783686",
"0.58208215",
"0.5789803",
"0.57890016",
"0.5779977",
"0.57661515",
"0.57590336",
"0.57414806",
"0.5735248",
"0.5735142",
"0.5651933",
"0.5591392",
"0.55647886",
"0.55434203",
"0.5540521",
"0.5499285",
"0.549... | 0.6723804 | 0 |
For verifying all random generated nodes are connected | function verifyAllNodesAreConnected(range){
globalData.links = globalData.links.filter((link) => { // For delete links which are from a node to the same
return link.source !== link.target
})
let complement = { // unadded items complement used for verifying all nodes are connected
csources: arrayRange(0, r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"fullyConnected(){\n\n let totalNumberOfConnections = 0; // count the total no of connections that can be made in this genome\n let noOfNodesInEachLayer = 0; // count the no of nodes in a particular layer\n let tempX = this.nodes[0].x; // store the x coordinate of current layer\n let ... | [
"0.6816242",
"0.6788619",
"0.6063295",
"0.6041892",
"0.60296744",
"0.598848",
"0.5970731",
"0.5876245",
"0.5839507",
"0.5819202",
"0.5819202",
"0.5794288",
"0.57729614",
"0.57679015",
"0.5747785",
"0.57473564",
"0.57473564",
"0.5717766",
"0.57133",
"0.57124275",
"0.57018524",... | 0.7618155 | 0 |
For getting Neighborhood of al nodes | function getAllNodesNeighborhood(){
globalData.nodes.map(function(node){
node.neighbors = getNeighborhoodLabels(node.index)
neighborhoodLengths.push(node.neighbors.length)
d3.select('#' + node.label)
.attr('neighborhood', node.neighbors.toString())
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"fetchNeighborhoods() {\n return this._getIndexRange('neighborhood');\n }",
"getNeighbors(node) {\n const neighbors = [];\n Object.values(node.walls).forEach((side) => {\n if (side instanceof Cell) {\n neighbors.push(side);\n }\n })\n return neighbors; \n }",
"getNeighbors(node... | [
"0.72619826",
"0.71805465",
"0.7035612",
"0.68629235",
"0.6841323",
"0.66401887",
"0.66310096",
"0.6630437",
"0.65502137",
"0.65308505",
"0.6517531",
"0.6515623",
"0.65081024",
"0.6493282",
"0.64756",
"0.64627373",
"0.64524114",
"0.6423962",
"0.64163935",
"0.64074737",
"0.636... | 0.80174375 | 0 |
For filling a neighborhood from a node | function fillNeighborhoodNodes(nodeIndex, color){// Fill neighborhood
let v = d3.select('#node' + nodeIndex)
let neighborhood = v.attr('neighborhood').split(',')
if(neighborhood.length)
neighborhood.map(function(neighborLabel){
let node = d3.select('#' + neighborLabel)
if(!node.attr('clique-part'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"addNeighbor(node) {\n neighbors.push(node)\n }",
"assignNeighbours(){\n\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n\n if(this.grid[i][j].isBomb){\n this.grid[i][j].surroundingBombs = -1;\n ... | [
"0.6880471",
"0.648406",
"0.6481957",
"0.64794725",
"0.6470612",
"0.6454425",
"0.6301922",
"0.62729585",
"0.6230772",
"0.62268865",
"0.62037843",
"0.61708826",
"0.6167006",
"0.60265344",
"0.6025443",
"0.6013991",
"0.60027176",
"0.59667593",
"0.59464884",
"0.5930119",
"0.59167... | 0.75052196 | 0 |
For showing the node label | function showNodeLabelText(nodeLabel){
let n = d3.select('#' + nodeLabel)
svg.append("text") // Name label text
.attr('id', 'text' + n.attr('label'))
.attr('label', 'textNode' + n.attr('label'))
.attr('class', 'textNode')
.attr('x', function() { return n.attr('cx') })
.attr('y', function() { return n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"drawName(node) {\n if (!node) return;\n\n var w = REN.NODE_WIDTH; \n var pt = this._ps.toScreen(node.p);\n\n let text = `${node.data.label} (${node.data.activationValue.toFixed(2)})`;\n \n this._ctx.fillStyle = REN.FONT_COLOR;\n this._ctx.font = REN.FONT_STYL... | [
"0.72012705",
"0.70842165",
"0.69907373",
"0.6967573",
"0.68699795",
"0.68441856",
"0.6831843",
"0.6782034",
"0.67710435",
"0.6767262",
"0.66856617",
"0.6631499",
"0.659684",
"0.65890753",
"0.6583332",
"0.6536164",
"0.65339464",
"0.6523988",
"0.6513999",
"0.6509112",
"0.64749... | 0.7878476 | 0 |
For filling all nodes of a subset | function fillNodes(R, color = cliqueColor){
// console.log(R, color)
if(!R)
return
R.map(function(node){
d3.select('#node' + node.index)
.attr('fill', color)
.attr('clique-part',true)
})
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function fillNeighborhoodNodes(nodeIndex, color){// Fill neighborhood \n\t\tlet v = d3.select('#node' + nodeIndex)\n\t\tlet neighborhood = v.attr('neighborhood').split(',')\n\t\tif(neighborhood.length)\n\t\t\tneighborhood.map(function(neighborLabel){\n\t\t\t\tlet node = d3.select('#' + neighborLabel)\n\t\t\t\tif(!... | [
"0.6286857",
"0.5852955",
"0.5823981",
"0.5803193",
"0.5803193",
"0.57379276",
"0.5702678",
"0.5692586",
"0.56871355",
"0.56818306",
"0.56807184",
"0.5660555",
"0.5590274",
"0.55779153",
"0.55304384",
"0.55304384",
"0.55259526",
"0.5519496",
"0.54085785",
"0.54040325",
"0.540... | 0.6464449 | 0 |
For fill all nodes of all cliques found | function fillCliqueNodes(index, color = cliqueColor){
if(!foundCliques[index])
return
document.getElementById('selectedClique').innerHTML = 'Clique' + index
foundCliques.map(function(clique, index){
fillNodes(clique, cliqueColor)
})
fillNodes(foundCliques[index], selectedCliqueColor)
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sol(){\n\n\n var resultat = new Set();\n\n for(var i=0 ; i<nb_nodes ; i++) // complexity O(n^3)\n {\n initialiser();\n marquer = new Array();\n marquer1= new Array();\n marquer2= new Array();\n dfs(i);\n marquer1 = marquer.splice(0,marquer.length); // copy marquer in marquer 1\n ... | [
"0.6330561",
"0.6022281",
"0.57685614",
"0.5665503",
"0.5619457",
"0.5573809",
"0.5571513",
"0.5567067",
"0.55612266",
"0.54884386",
"0.5479021",
"0.5455355",
"0.5452305",
"0.5437634",
"0.53973806",
"0.53890795",
"0.53849006",
"0.5372215",
"0.53656566",
"0.53632903",
"0.53596... | 0.70815086 | 0 |
For getting and filling maximal clique | function fillMaximalClique(){
let maximalClique = []
foundCliques.map(function(clique, index){
let button = document.createElement("button")
button.classList.add('btn', 'effect01')
button.setAttribute('index', index)
button.setAttribute('id', 'clique' + index)
let newContent = document.createTextNode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"removeMax() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}",
"dequeue (){\n // let removedRoot = this.values[0];\n //replace with last added value\n //TEACHERS SOLUTION\n const min = this.values[0];\n const end = this.values.pop();\n //EDGE CASE IF NO... | [
"0.61405814",
"0.6108492",
"0.6067955",
"0.60464734",
"0.6027998",
"0.5980123",
"0.5901103",
"0.58957815",
"0.5894046",
"0.58932364",
"0.5883076",
"0.5852535",
"0.58346105",
"0.58310515",
"0.582979",
"0.5791417",
"0.57804614",
"0.5770163",
"0.5753877",
"0.57530594",
"0.573258... | 0.7180931 | 0 |
Filters events that don't match region checks. Function's context is "check" entry from regions. | function filterByMatch(event) {
return ;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"filterEvent(event) {\n return false;\n }",
"handleEventFiltering() {\n this.events = this.filterByType(this.replicaSetEvents.events, this.eventType);\n this.events = this.filterBySource(this.events, this.eventSource);\n }",
"static filterEvents(eventGrps, available) {\n if (available('2... | [
"0.6190717",
"0.58981776",
"0.54278314",
"0.534304",
"0.53351724",
"0.5124037",
"0.51043826",
"0.50776",
"0.50739545",
"0.5034781",
"0.50268537",
"0.50240844",
"0.5021201",
"0.50155777",
"0.50099546",
"0.4970533",
"0.49635628",
"0.49593973",
"0.49509445",
"0.49222666",
"0.491... | 0.62792253 | 0 |
Make primtives types like strings into objects. | function coercePrimitiveToObject(obj) {
if(isPrimitiveType(obj)) {
obj = object(obj);
}
if(noKeysInStringObjects && isString(obj)) {
forceStringCoercion(obj);
}
return obj;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"#instantiatePrimitive(type, value) {\n const typeOf = {\n number: new Number(value),\n string: new String(value),\n boolean: new Boolean(value)\n }\n\n return typeOf[type];\n }",
"function objectify(wat) {\n let objectified;\n switch (true) {\n case w... | [
"0.6069322",
"0.57193273",
"0.57166237",
"0.5705447",
"0.5699203",
"0.5681672",
"0.56416947",
"0.56125176",
"0.56125176",
"0.5592014",
"0.5592014",
"0.5592014",
"0.5580698",
"0.55754",
"0.5540325",
"0.5526681",
"0.5501369",
"0.5498651",
"0.549113",
"0.5476646",
"0.5440685",
... | 0.5782351 | 1 |
The ISO format allows times strung together without a demarcating ":", so make sure that these markers are now optional. | function prepareTime(format, loc, iso) {
var timeSuffixMapping = {'h':0,'m':1,'s':2}, add;
loc = loc || English;
return format.replace(/{([a-z])}/g, function(full, token) {
var separators = [],
isHours = token === 'h',
tokenIsRequired = isHours && !iso;
if(token === 't') {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function formatIsoTimeString(marker) {\n return padStart(marker.getUTCHours(), 2) + ':' +\n padStart(marker.getUTCMinutes(), 2) + ':' +\n padStart(marker.getUTCSeconds(), 2);\n }",
"function reformatTime(isoTime) {\n\t\tvar hours = parseInt(isoTime.substring(0, 2), 10),\n\t\t\tmin... | [
"0.66020423",
"0.63848466",
"0.601804",
"0.60124904",
"0.59259194",
"0.590246",
"0.5886226",
"0.58806914",
"0.5863989",
"0.5854725",
"0.5848693",
"0.5846525",
"0.58368134",
"0.5823146",
"0.58195925",
"0.5817475",
"0.57716614",
"0.57476085",
"0.57476085",
"0.57476085",
"0.5747... | 0.6697439 | 0 |
If the month is being set, then we don't want to accidentally traverse into a new month just because the target month doesn't have enough days. In other words, "5 months ago" from July 30th is still February, even though there is no February 30th, so it will of necessity be February 28th (or 29th in the case of a leap ... | function checkMonthTraversal(date, targetMonth) {
if(targetMonth < 0) {
targetMonth = targetMonth % 12 + 12;
}
if(targetMonth % 12 != callDateGet(date, 'Month')) {
callDateSet(date, 'Date', 0);
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function adjustDayOfMonth(self) {\n var fields = self.fields;\n var year = fields[YEAR];\n var month = fields[MONTH];\n var monthLen = getMonthLength(year, month);\n var dayOfMonth = fields[DAY_OF_MONTH];\n if (dayOfMonth > monthLen) {\n self.set(DAY_OF_MONTH, m... | [
"0.62077534",
"0.62077534",
"0.6142886",
"0.61021745",
"0.60804176",
"0.60804176",
"0.6024908",
"0.60218126",
"0.59856087",
"0.5964575",
"0.5964575",
"0.5927172",
"0.5859608",
"0.58467954",
"0.58439225",
"0.5809077",
"0.5775746",
"0.57734424",
"0.57708985",
"0.5710777",
"0.56... | 0.7566306 | 0 |
Create the Edit and Delete buttons for a row | function rowButtons( id, lastname ) {
return '<form id="actions"><input class="btn btn-mini btn-success" type="button" value="Edit" onClick="javascript:editGo(' + id + ')"/>' +
'<input class="btn btn-mini btn-warning" type="button" value="Delete" onClick="javascript:deleteGo(' + id + ', "' + lastname... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function editAction(edit_row) {\r\n let editBtn = document.createElement('button')\r\n editBtn.innerHTML = 'Edit';\r\n editBtn.className = 'edit-btn';\r\n edit_row.appendChild(editBtn)\r\n editBtn.addEventListener('click', function() {\r\n btn.i... | [
"0.716688",
"0.711196",
"0.6788628",
"0.67447335",
"0.66960466",
"0.6684762",
"0.6674999",
"0.6666416",
"0.66370624",
"0.6631219",
"0.6537314",
"0.6510638",
"0.6501247",
"0.6496299",
"0.647713",
"0.64335877",
"0.6421403",
"0.64104325",
"0.6372243",
"0.63310194",
"0.6318227",
... | 0.720466 | 0 |
Return dataTypes if were taken, otherwise call getting Data Types from database. | function getDataTypes(hardReload) {
if ((!areDataTypesLoaded && !areDataTypesLoading) || hardReload) {
getDataTypesFromDatabase();
}
return dataTypes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"getSpeechesForDataTypes(dataTypes) {\n var tmp = [];\n for (var i = 0; i < dataTypes.length; i++) {\n tmp[i] = this._dataTypes[dataTypes[i]] ? this._dataTypes[dataTypes[i]] : undefinedDataType;\n }\n return tmp;\n }",
"function fetchDataTypes() {\n $http({\n method: 'P... | [
"0.67170084",
"0.64248633",
"0.6287654",
"0.62639034",
"0.5994927",
"0.598301",
"0.5772273",
"0.576507",
"0.5689408",
"0.56512535",
"0.5629136",
"0.5589173",
"0.55784464",
"0.55770993",
"0.5550201",
"0.55435205",
"0.5487619",
"0.5481801",
"0.5370113",
"0.5364375",
"0.53495085... | 0.73412395 | 0 |
Return subTypes if were taken, otherwise call getting subTypes from database. | function getSubTypes() {
if (!areSubTypesLoaded && !areSubTypesLoading) {
getSubTypesByAjax();
}
return subTypes;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function getOSubTypeFilters() {\n try {\n var subTypeFilters = await getIndexedDBStorage('sub-type-filters');\n if(!subTypeFilters) {\n getWsOSubTypeFilterRBind(true, getOSubTypeFilterMenus);\n return false;\n }\n getOSubTypeFilterMenus(subTypeFilters); ... | [
"0.6544626",
"0.61801845",
"0.6058538",
"0.582697",
"0.57254285",
"0.56873304",
"0.55113083",
"0.5464905",
"0.5444466",
"0.54040897",
"0.53371674",
"0.52392846",
"0.5192774",
"0.50915885",
"0.50599086",
"0.5037578",
"0.49862725",
"0.4935642",
"0.4925262",
"0.49157652",
"0.490... | 0.74347013 | 0 |
Return measureClasses if were taken, otherwise call getting measureClasses from database. | function getMeasureClasses() {
if (!areMeasureClassesLoaded && !areMeasureClassesLoading) {
getMeasureClassesByAjax();
}
return measureClasses;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"classes() {\n return this.dataset.reduce(function(acc, val) {\n if (!acc.includes(val.c)) {\n acc.push(val.c);\n }\n return acc;\n }, []);\n }",
"getMeasureCount() {\n return this.measures.length;\n }",
"function classify() {\n\n if (colorScheme == \"null... | [
"0.5496738",
"0.5135542",
"0.5050906",
"0.49643233",
"0.49641255",
"0.49275342",
"0.48899886",
"0.48763022",
"0.47898683",
"0.4731183",
"0.4646399",
"0.46382454",
"0.4633989",
"0.4602233",
"0.45960027",
"0.4578353",
"0.45714167",
"0.45663437",
"0.45494777",
"0.45277202",
"0.4... | 0.78956693 | 0 |
Write a script that finds the max and min number from a sequence of numbers. | function problem03_MinMaxOfSequence() {
alert('Min/Max of sequence');
var numbers = [],
number,
min = Number.MAX_VALUE,
max = Number.MIN_VALUE;
while (number = prompt('Enter number (Enter to exit)')) {
numbers.push(parseInt(number));
}
for (number in numbers) {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function findMinAndMax(value){\n value.sort(function (a, b) { return a - b });\n console.log(\"Min -> %d\\nMax -> %d\", value[0], value[value.length-1]);\n}",
"function Max_Finder() {\r\n let numbers = EntryCheckForManyNumbers();\r\n let max = numbers [0]; \r\n let min = numbers [numbe... | [
"0.7496441",
"0.74681556",
"0.74176884",
"0.73242384",
"0.72974235",
"0.7265637",
"0.7231489",
"0.7167258",
"0.71117854",
"0.707794",
"0.70232755",
"0.702136",
"0.69525284",
"0.69224924",
"0.69031936",
"0.6885068",
"0.68694514",
"0.6858341",
"0.6848117",
"0.6798695",
"0.67874... | 0.77481735 | 0 |
Async function which repeats until the element matching the specified `query` has a calculated display matching the specified `displayValue`. | async function waitForElementWithDisplay(query, displayValue) {
repeatUntil(() => {
const el = awaitRemoteCall.waitForElementStyles(appId, query, 'display');
if (el && el.display === displayValue) {
return el;
}
return test.pending(
'Element `%s` with display `%s` is not fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async function waitForElementWithDisplay(query, displayValue) {\n await repeatUntil(async () => {\n const caller = getCaller();\n const el =\n await remoteCall.waitForElementStyles(appId, query, ['display']);\n if (el && el.styles && el.styles.display === displayValue) {\n return ... | [
"0.82107764",
"0.62274283",
"0.57078075",
"0.5701241",
"0.5701241",
"0.5701241",
"0.56891394",
"0.56846124",
"0.54363406",
"0.5401518",
"0.536119",
"0.5345889",
"0.53376824",
"0.5335577",
"0.5325755",
"0.532336",
"0.5322299",
"0.53216034",
"0.5317866",
"0.5282629",
"0.5262692... | 0.8289951 | 0 |
Naive broadphase implementation, used in lack of better ones. | function NaiveBroadphase(){
Broadphase.apply(this);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function NaiveBroadphase(){\n\t Broadphase.apply(this);\n\t}",
"function NaiveBroadphase(){\n Broadphase.call(this, Broadphase.NAIVE);\n}",
"function NaiveBroadphase() {\n Broadphase.call(this, Broadphase.NAIVE);\n }",
"function newPhase() {\n\t// expand outer ... | [
"0.7152064",
"0.6958394",
"0.64167225",
"0.6252558",
"0.6101759",
"0.5974334",
"0.5662272",
"0.5615096",
"0.55425483",
"0.5541662",
"0.54324645",
"0.54200417",
"0.54200417",
"0.54200417",
"0.54200417",
"0.54200417",
"0.53881526",
"0.53836787",
"0.5339466",
"0.5339466",
"0.533... | 0.70186013 | 1 |
Write a function identityf that takes an argument and returns a function that returns that argument | function identityf(x) {
return identity(x);
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function identityf(x) {\n return function() {\n return identity(x);\n };\n}",
"function identityf(x) {\n\treturn function () {\n\t\treturn x;\n\t};\n}",
"function identity(fn){return fn;}",
"function identity(fn) {\n return fn;\n}",
"function identity(fn) {\n return fn;\n}",
"function identity(fn)... | [
"0.8369788",
"0.7912355",
"0.7818665",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
"0.77651465",
... | 0.80848294 | 1 |
Write a function addf that adds from two invocations | function addf(a) {
return (b) => {
return add(a, b);
};
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function add2Parameters(e, f) {\n return e + f;\n}",
"function add() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var acc = args[0];\n for (var i = 1; i < args.length; i++) {\n acc = _add_two(acc, args[i]);\n }\n retu... | [
"0.7933756",
"0.7605035",
"0.7588072",
"0.75824237",
"0.7571013",
"0.7555555",
"0.7553189",
"0.7553189",
"0.7482912",
"0.74087375",
"0.7369963",
"0.730306",
"0.7292125",
"0.72817487",
"0.72817487",
"0.72817487",
"0.72817487",
"0.7264233",
"0.7229033",
"0.72184676",
"0.721422"... | 0.79314363 | 1 |
Loop with a break statement | function break_Loop() {
for(y=0; y < 100; y++) {
if (y === 12) {break;} //when y is 12 it jumps out of the for loop using 'break'
content += "The number is " + y + "<br>";
}
document.getElementById("breakup").innerHTML = content;
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function breakTheLoop() {\n for (let i = 0; i < 45; i++) {\n console.log(i);\n break;\n }\n}",
"function Break() {}",
"function useBreak(array, index) {\n for (var i = 0; i < array.length; i++) {\n if (i > index) {\n break;\n }\n console.log(array[i]);\n }\n}",
"function isLoopBreak(s... | [
"0.76148766",
"0.68104535",
"0.6563033",
"0.63642716",
"0.6350343",
"0.6350343",
"0.62757444",
"0.62331873",
"0.61197823",
"0.606711",
"0.6038054",
"0.5937857",
"0.5821694",
"0.57817745",
"0.574887",
"0.57183903",
"0.570731",
"0.5638823",
"0.5630882",
"0.56217396",
"0.5616636... | 0.70344687 | 1 |
Loop with a continue statement | function continue_Loop() {
for(y=0; y < 10; y++) {
if (y === 4) {continue;} //when y is 4 it jumps over one iteration in the loop
//and will not display "The number is 4"
content += "The number is " + y + "<br>";
}
document.getElementById("continues").inne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function useContinue(array, index) {\n for (var i = 0; i < array.length; i++) {\n if (i === index) {\n continue; //This tells to go to the next iteration\n }\n console.log(array[i]);\n }\n}",
"function LabeledContinue( limit, expect ) {\n i = 0;\n result1 = \"pass\";\n result2 = \"pass\"... | [
"0.67773384",
"0.6555475",
"0.64582044",
"0.639109",
"0.62578475",
"0.62197447",
"0.61849487",
"0.6172169",
"0.61526346",
"0.6076243",
"0.6057382",
"0.6036035",
"0.5997064",
"0.5982316",
"0.5973506",
"0.5925478",
"0.5870396",
"0.58502614",
"0.5823268",
"0.58040583",
"0.580122... | 0.7137795 | 0 |
Adding Result to csv file | function addToResultsFile(){
userResult = userResult.concat("\r\n");
console.log("Im in addToResultsFile. userResult is " + userResult);
require([fsModule], function (require){
fs.stat('Results.csv', function (err, stat) {
if (err == null) {
console.log('File exists');
//write the actual data and end w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function exportResults() {\n var filename = 'HM-BusinessLicenseResults_' + (new Date()).getTime() + '.csv';\n var charset = \"utf-8\";\n var items;\n\n if (results.length <= 0){\n items = convertToCSV(businesses);\n } else {\n items = convertToCSV(results);\n }\n\n var blob = new Blob([items], {\n... | [
"0.6922032",
"0.6652956",
"0.6595853",
"0.6482234",
"0.6445484",
"0.6410996",
"0.6387275",
"0.6344177",
"0.632126",
"0.6320413",
"0.63154936",
"0.623977",
"0.62225235",
"0.617965",
"0.61618686",
"0.61443585",
"0.6142856",
"0.6128384",
"0.6127662",
"0.60818213",
"0.607796",
... | 0.75119245 | 0 |
returns the total height and width sum of all elements matching the selector | function sizesSum() {
if (o.advanced.updateOnSelectorChange === true) {
o.advanced.updateOnSelectorChange = "*";
}
var total = 0,
sel = mCSB_container.find(o.advanced.updateOnSelectorChange);
if (o.advanced.updateOnSelectorChange && sel.length > 0) {
sel.each(function () {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"function sizesSum(){\n\t\t\t\tif(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange=\"*\";}\n\t\t\t\tvar total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);\n\t\t\t\tif(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=$(this).height()+$(this).wi... | [
"0.7579429",
"0.7533111",
"0.7378641",
"0.73525226",
"0.73525226",
"0.73525226",
"0.73525226",
"0.7328905",
"0.7313716",
"0.7303446",
"0.7303446",
"0.7303446",
"0.72981465",
"0.6414845",
"0.63079673",
"0.6204203",
"0.59564674",
"0.59346145",
"0.5888262",
"0.58681834",
"0.5837... | 0.7723947 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.