query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Create and return a new shopping cart, saving the ID in session | def create_cart
raise CartAlreadyExists if current_cart
@cart = Cart.create()
session[:current_cart] = @cart.id
if logged_in?
@cart.user = current_user
@cart.save
end
@cart
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # Add params[:id] to cart\n # logger.debug(\"Adding #{params[:id]} to the cart----------------------------------------\")\n id = params[:id].to_i\n\n existing_item = session[:shopping_cart].map { |item| item[\"id\"] }\n\n unless existing_item.include?(id)\n item = { id: id, quantit... | [
"0.84586173",
"0.8321419",
"0.83020395",
"0.8012303",
"0.7957303",
"0.79174095",
"0.7900518",
"0.78983563",
"0.7883294",
"0.78441435",
"0.783321",
"0.777768",
"0.7777461",
"0.7777461",
"0.7758748",
"0.77262115",
"0.7722921",
"0.7716986",
"0.7676409",
"0.7673001",
"0.767173",
... | 0.8418404 | 1 |
Update NAT Rule Update NAT Rule on Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def create_or_replace_policy_nat_rule_on_tier0(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
data, _status_code, _headers = create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'\n end\n #... | [
"0.6247005",
"0.6179279",
"0.6114617",
"0.60593206",
"0.594968",
"0.5935811",
"0.5866806",
"0.58327276",
"0.5791059",
"0.57652116",
"0.5698164",
"0.56929624",
"0.5628449",
"0.5568939",
"0.55483514",
"0.5537024",
"0.5489171",
"0.5453909",
"0.5429063",
"0.5428905",
"0.53440386"... | 0.5489958 | 16 |
Update NAT Rule Update NAT Rule on Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ...'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'\n end\n #... | [
"0.6246376",
"0.6178712",
"0.6114094",
"0.6058919",
"0.59496135",
"0.59358793",
"0.5832272",
"0.57897735",
"0.5764473",
"0.5696917",
"0.5692862",
"0.5628147",
"0.5568489",
"0.5547918",
"0.5538317",
"0.5488914",
"0.54869163",
"0.5452942",
"0.5429654",
"0.5429574",
"0.53447413"... | 0.58660144 | 6 |
Update NAT Rule Update NAT Rule on Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def create_or_replace_policy_nat_rule_on_tier0_0(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
data, _status_code, _headers = create_or_replace_policy_nat_rule_on_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'\n end\n #... | [
"0.62474126",
"0.61796147",
"0.61141855",
"0.6059116",
"0.5947865",
"0.5936847",
"0.58666795",
"0.5831153",
"0.57913524",
"0.576504",
"0.56983906",
"0.569337",
"0.5629458",
"0.5570244",
"0.55489355",
"0.5537237",
"0.5487863",
"0.5486735",
"0.54320055",
"0.542776",
"0.5347149"... | 0.5452029 | 18 |
Update NAT Rule Update NAT Rule on Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def create_or_replace_policy_nat_rule_on_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0 ...... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'\n end\n #... | [
"0.6247188",
"0.61794347",
"0.61141974",
"0.60589296",
"0.59482837",
"0.5935388",
"0.58666664",
"0.58316785",
"0.579052",
"0.569759",
"0.5692443",
"0.5628767",
"0.5568626",
"0.5548528",
"0.5537268",
"0.5489038",
"0.54888314",
"0.5453015",
"0.54303485",
"0.5428818",
"0.5345508... | 0.5765048 | 9 |
Delete NAT Rule Delete NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def delete_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})
delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n nil\n end",
"def delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})\n if @api_... | [
"0.6672188",
"0.6580341",
"0.65417004",
"0.6518225",
"0.6364286",
"0.6295357",
"0.5980605",
"0.5836673",
"0.5821534",
"0.58141136",
"0.57251936",
"0.5719902",
"0.56725246",
"0.5605472",
"0.5586906",
"0.55627877",
"0.55525625",
"0.54955566",
"0.54762614",
"0.54696816",
"0.5459... | 0.6759086 | 0 |
Delete NAT Rule Delete NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.delete_policy_nat_rule_from_tier0 ...'
end
# verify the required... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n nil\n end",
"def delete_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_fr... | [
"0.6759773",
"0.66731197",
"0.65421414",
"0.65195835",
"0.6365008",
"0.62960577",
"0.5979495",
"0.58372486",
"0.5820113",
"0.58125645",
"0.57246625",
"0.57201225",
"0.5673067",
"0.5607332",
"0.5587401",
"0.55621177",
"0.55544513",
"0.5494767",
"0.54767185",
"0.5468071",
"0.54... | 0.6580739 | 2 |
Delete NAT Rule Delete NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def delete_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})
delete_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n nil\n end",
"def delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})\n if @api_clie... | [
"0.6760363",
"0.6580996",
"0.65424055",
"0.65197235",
"0.6365114",
"0.62966585",
"0.5980519",
"0.58371115",
"0.58207095",
"0.5813512",
"0.5724099",
"0.5719988",
"0.5671874",
"0.5607759",
"0.5587288",
"0.5563763",
"0.5554861",
"0.549595",
"0.5477044",
"0.54687214",
"0.546077",... | 0.66736543 | 1 |
Delete NAT Rule Delete NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def delete_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.delete_policy_nat_rule_from_tier0_0 ...'
end
# verify the requ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n nil\n end",
"def delete_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n delete_policy_nat_rule_fr... | [
"0.67595196",
"0.66729337",
"0.6579815",
"0.6519458",
"0.6364976",
"0.6295195",
"0.5979848",
"0.5836236",
"0.58203727",
"0.5812245",
"0.5724329",
"0.5719156",
"0.56716055",
"0.5606332",
"0.558598",
"0.55621207",
"0.55534303",
"0.54951787",
"0.5475693",
"0.5467695",
"0.5459428... | 0.6541197 | 3 |
Get NAT Rule Get NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def get_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})
data, _status_code, _headers = get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n data, _status_code, _headers = get_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n data\n end",
"def get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opt... | [
"0.6661023",
"0.6515721",
"0.64741963",
"0.59178627",
"0.5879523",
"0.586156",
"0.5687388",
"0.5655917",
"0.55970514",
"0.559133",
"0.5551168",
"0.55030507",
"0.5322865",
"0.5312553",
"0.53111285",
"0.5287594",
"0.52816075",
"0.5258819",
"0.5222419",
"0.5159132",
"0.5158778",... | 0.67074734 | 0 |
Get NAT Rule Get NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.get_policy_nat_rule_from_tier0 ...'
end
# verify the required param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n data, _status_code, _headers = get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n data\n end",
"def get_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n da... | [
"0.6707653",
"0.6661334",
"0.6475057",
"0.59195185",
"0.5881189",
"0.58607227",
"0.56888026",
"0.5656983",
"0.559813",
"0.5592742",
"0.5552379",
"0.550414",
"0.53243595",
"0.5312565",
"0.5312079",
"0.5287541",
"0.52814585",
"0.5260122",
"0.5222728",
"0.51598763",
"0.5158632",... | 0.6516573 | 2 |
Get NAT Rule Get NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def get_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})
data, _status_code, _headers = get_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n data, _status_code, _headers = get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n data\n end",
"def get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = ... | [
"0.6708041",
"0.651564",
"0.64740443",
"0.5917879",
"0.5879354",
"0.5858204",
"0.5687523",
"0.5655768",
"0.5596973",
"0.5591372",
"0.5550865",
"0.5502934",
"0.53234917",
"0.5312166",
"0.5311888",
"0.5286534",
"0.5280293",
"0.5258547",
"0.52207255",
"0.51586527",
"0.51576596",... | 0.6661448 | 1 |
Get NAT Rule Get NAT Rule from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def get_policy_nat_rule_from_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.get_policy_nat_rule_from_tier0_0 ...'
end
# verify the required p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_policy_nat_rule_from_tier0(tier_0_id, nat_id, nat_rule_id, opts = {})\n data, _status_code, _headers = get_policy_nat_rule_from_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, opts)\n data\n end",
"def get_policy_nat_rule_from_tier0_0(tier_0_id, nat_id, nat_rule_id, opts = {})\n da... | [
"0.6707556",
"0.66611385",
"0.6516326",
"0.5918743",
"0.5880378",
"0.58594936",
"0.568809",
"0.56563973",
"0.55974287",
"0.559188",
"0.55516726",
"0.5503338",
"0.5323521",
"0.531316",
"0.5311813",
"0.5285553",
"0.5281182",
"0.5259074",
"0.52223927",
"0.51595384",
"0.51584333"... | 0.64747477 | 3 |
List NAT Rules List NAT Rules from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def list_policy_nat_rules_from_tier0(tier_0_id, nat_id, opts = {})
data, _status_code, _headers = list_policy_nat_rules_from_tier0_with_http_info(tier_0_id, nat_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policy_nat_rules_from_tier0_0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list_policy_nat_rules_from_tier0_0_with_http_info(tier_0_id, nat_id, opts)\n data\n end",
"def router_nat_list_all(timeout=10)\n\t\t\t\t\t\tnat_cmd = \"iptables -t nat -nvL\"\n\t\t\t\t\t\trouter_sen... | [
"0.673355",
"0.619647",
"0.6174504",
"0.60975236",
"0.58984",
"0.5886311",
"0.54843485",
"0.54401916",
"0.5274119",
"0.5212257",
"0.5190434",
"0.5183915",
"0.5114071",
"0.50844216",
"0.50644916",
"0.5020283",
"0.5012967",
"0.49723446",
"0.49436936",
"0.4899459",
"0.48783606",... | 0.6881152 | 0 |
List NAT Rules List NAT Rules from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def list_policy_nat_rules_from_tier0_with_http_info(tier_0_id, nat_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.list_policy_nat_rules_from_tier0 ...'
end
# verify the required parameter 'tie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policy_nat_rules_from_tier0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list_policy_nat_rules_from_tier0_with_http_info(tier_0_id, nat_id, opts)\n data\n end",
"def list_policy_nat_rules_from_tier0_0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list... | [
"0.6880846",
"0.67331016",
"0.6196475",
"0.60970396",
"0.5897707",
"0.5884702",
"0.5482841",
"0.5438901",
"0.5274577",
"0.5211557",
"0.5189858",
"0.51841927",
"0.51137865",
"0.50841194",
"0.5066081",
"0.5019495",
"0.50140744",
"0.49716598",
"0.4943044",
"0.48999974",
"0.48760... | 0.6174059 | 3 |
List NAT Rules List NAT Rules from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def list_policy_nat_rules_from_tier0_0(tier_0_id, nat_id, opts = {})
data, _status_code, _headers = list_policy_nat_rules_from_tier0_0_with_http_info(tier_0_id, nat_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policy_nat_rules_from_tier0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list_policy_nat_rules_from_tier0_with_http_info(tier_0_id, nat_id, opts)\n data\n end",
"def router_nat_list_all(timeout=10)\n\t\t\t\t\t\tnat_cmd = \"iptables -t nat -nvL\"\n\t\t\t\t\t\trouter_send_cm... | [
"0.68826365",
"0.6196259",
"0.6174164",
"0.6097101",
"0.5898571",
"0.5885698",
"0.5483281",
"0.54400164",
"0.52741",
"0.5212463",
"0.5190703",
"0.5183828",
"0.5112691",
"0.5083044",
"0.5064738",
"0.5018796",
"0.50133115",
"0.49731806",
"0.49448252",
"0.4900747",
"0.48783046",... | 0.67350155 | 1 |
List NAT Rules List NAT Rules from Tier0 denoted by Tier0 ID, under NAT section denoted by . Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT section please refer to PolicyNAT schema. | def list_policy_nat_rules_from_tier0_0_with_http_info(tier_0_id, nat_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.list_policy_nat_rules_from_tier0_0 ...'
end
# verify the required parameter ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_policy_nat_rules_from_tier0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list_policy_nat_rules_from_tier0_with_http_info(tier_0_id, nat_id, opts)\n data\n end",
"def list_policy_nat_rules_from_tier0_0(tier_0_id, nat_id, opts = {})\n data, _status_code, _headers = list... | [
"0.68820167",
"0.6734451",
"0.6195467",
"0.61744404",
"0.5898674",
"0.58850837",
"0.5482988",
"0.5440727",
"0.52745277",
"0.5211983",
"0.5190259",
"0.518437",
"0.5113696",
"0.50841016",
"0.5064801",
"0.5019753",
"0.501378",
"0.4972087",
"0.49452478",
"0.49004737",
"0.4878121"... | 0.60975236 | 4 |
Create or update a NAT Rule on tier0 If a NAT Rule is not already present on Tier0 denoted by Tier0 ID, under NAT section denoted by , create a new NAT Rule. If it already exists, update the NAT Rule. Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT sect... | def patch_policy_nat_rule_on_tier0(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ... | [
"0.67935175",
"0.67359906",
"0.6726627",
"0.6718939",
"0.6414082",
"0.61899394",
"0.6130108",
"0.6064714",
"0.5753645",
"0.5700036",
"0.563075",
"0.55766284",
"0.5568786",
"0.5558128",
"0.55396044",
"0.5503086",
"0.5484456",
"0.54589874",
"0.5417988",
"0.54075027",
"0.5400480... | 0.607834 | 7 |
Create or update a NAT Rule on tier0 If a NAT Rule is not already present on Tier0 denoted by Tier0 ID, under NAT section denoted by , create a new NAT Rule. If it already exists, update the NAT Rule. Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT sect... | def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'
end
# verify t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ... | [
"0.6793122",
"0.6735539",
"0.6725423",
"0.67176247",
"0.6412981",
"0.61291796",
"0.60769635",
"0.6063466",
"0.5754283",
"0.57006496",
"0.56305563",
"0.55756503",
"0.5567846",
"0.5557864",
"0.5538717",
"0.55032516",
"0.54847294",
"0.5458097",
"0.5417493",
"0.54072136",
"0.5399... | 0.61890316 | 5 |
Create or update a NAT Rule on tier0 If a NAT Rule is not already present on Tier0 denoted by Tier0 ID, under NAT section denoted by , create a new NAT Rule. If it already exists, update the NAT Rule. Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT sect... | def patch_policy_nat_rule_on_tier0_0(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
patch_policy_nat_rule_on_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ... | [
"0.67927337",
"0.67352194",
"0.6725467",
"0.67178786",
"0.6413159",
"0.61883605",
"0.61285824",
"0.6076475",
"0.5753573",
"0.5699993",
"0.5629602",
"0.5576302",
"0.5567941",
"0.55569553",
"0.55378056",
"0.5501783",
"0.5483262",
"0.54574925",
"0.5417034",
"0.5408247",
"0.53985... | 0.6062735 | 8 |
Create or update a NAT Rule on tier0 If a NAT Rule is not already present on Tier0 denoted by Tier0 ID, under NAT section denoted by , create a new NAT Rule. If it already exists, update the NAT Rule. Under tier0 there will be 3 different NATs(sections). (INTERNAL, USER and DEFAULT) For more details related to NAT sect... | def patch_policy_nat_rule_on_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0_0 ...'
end
# veri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ... | [
"0.6793621",
"0.6735925",
"0.67254734",
"0.6717827",
"0.641188",
"0.61907303",
"0.607823",
"0.6064555",
"0.57555133",
"0.570189",
"0.5631647",
"0.5575069",
"0.5568692",
"0.5558867",
"0.55373293",
"0.5504281",
"0.5485669",
"0.5458306",
"0.5417798",
"0.54076684",
"0.54015464",
... | 0.6130751 | 6 |
we set up our calendar by defining the weeks and setting different classes to dates using the CalendarWeeks and AssignClasses classes | def to_a
CalendarWeeks.new(@date).to_a.map do |week|
week.map do |date|
[date, AssignClasses.new(date).to_s]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else\n @start_date = @today\n until @start_date.strftime(\"%a\") == \"Mon\"\n @start_date -= 1\n end\n end\n @end_date = @start_dat... | [
"0.7206965",
"0.68458706",
"0.640769",
"0.6382899",
"0.62462497",
"0.62363875",
"0.6220485",
"0.61735547",
"0.6164334",
"0.61064214",
"0.6079941",
"0.6025349",
"0.6007839",
"0.5976585",
"0.5963544",
"0.5855018",
"0.57975316",
"0.57928765",
"0.5784924",
"0.57562476",
"0.575624... | 0.56745803 | 29 |
we get date ranges of our calendar and divide them up in equal groups of 7 dates each group | def to_a
(first_calendar_day..last_calendar_day).to_a.in_groups_of(7)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def week_date_ranges\n (1..ReportWeeks).map do |week|\n begin_date = @start_date + (7*(week-1))\n begin_date .. (begin_date + 6)\n end\n end",
"def ops_calendar\n # setup calendar cells\n @today = Date.today - 3\n if @today.strftime(\"%a\") == \"Mon\"\n @start_date = @today\n else... | [
"0.6909435",
"0.67693895",
"0.6616569",
"0.6578849",
"0.65195936",
"0.63318527",
"0.6325515",
"0.62997204",
"0.6253671",
"0.6232973",
"0.6194096",
"0.6136874",
"0.61331975",
"0.6093561",
"0.60628814",
"0.6030409",
"0.6027267",
"0.6024718",
"0.60108244",
"0.60074645",
"0.59764... | 0.70945144 | 0 |
get our first calendar day by getting the beginning of the month of the param date then the beginning of week which is sunday in this case | def first_calendar_day
@date.beginning_of_month.beginning_of_week(:sunday)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStartDay(date)\t\n\t\tstartOfWeek = getStartOfWeek\n\t\t#Martin Dube contribution: 'start of the week' configuration\n\t\tunless date.nil?\t\t\t\n\t\t\t#the day of calendar week (0-6, Sunday is 0)\t\t\t\n\t\t\tdayfirst_diff = (date.wday+7) - (startOfWeek)\n\t\t\tdate -= (dayfirst_diff%7)\n\t\tend\t\t\n\t\td... | [
"0.8087314",
"0.79749197",
"0.77505046",
"0.7676108",
"0.76051813",
"0.7452074",
"0.7432931",
"0.73637336",
"0.736217",
"0.73184407",
"0.7276442",
"0.72665596",
"0.7253392",
"0.7250603",
"0.72167504",
"0.71988755",
"0.7192062",
"0.71800894",
"0.7174959",
"0.71346945",
"0.7103... | 0.9044026 | 0 |
get our last calendar day | def last_calendar_day
@date.end_of_month.end_of_week(:sunday)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_day\n @last_day ||= Date.new(year_number, month_number, -1)\n end",
"def last_day\n @last_day ||= months.last.last_day\n end",
"def last_business_day_of_month\n all_working_days_of_month.first\n end",
"def last_day\n start_date + rental_days.days\n end",
"def last_date\... | [
"0.7857664",
"0.7695298",
"0.7066525",
"0.7065339",
"0.689532",
"0.6810383",
"0.669683",
"0.664582",
"0.65874773",
"0.6516251",
"0.649086",
"0.6475732",
"0.64294827",
"0.6398402",
"0.63954425",
"0.637897",
"0.63541806",
"0.6344015",
"0.6330753",
"0.63244855",
"0.6318884",
"... | 0.8336448 | 0 |
we want to associate certain classes with our dates of the calendar so we can manipulate them and add designs | def to_s
[today, future, past, other_month].compact.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calendar_day_opt_classes(date, date_index, month_info)\n css_classes = []\n css_classes.push \"week-day-number-#{date_index % 7}\"\n css_classes.push \"week-number-#{date_index / 7}\"\n css_classes.push 'inactive' if date[:date].month != month_info[:month_date].month\n css_classes.push 'critical... | [
"0.68169457",
"0.63737476",
"0.61176264",
"0.60671717",
"0.60263574",
"0.59573436",
"0.59548575",
"0.5905012",
"0.5845969",
"0.5820197",
"0.57805073",
"0.5762525",
"0.57531464",
"0.57335335",
"0.568231",
"0.5677894",
"0.56775105",
"0.56759244",
"0.5660579",
"0.5629127",
"0.56... | 0.0 | -1 |
the different types of classes added to a date object depending on the date | def today
"today" if @date == Date.today
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end",
"def classes_for_day(day)\n days_classes = Tableau::ClassArray.new\n @classes.each { |c| days_classes << c if c.day == day }\n days_classes.count > 0 ? days_classes : nil\n end",
"... | [
"0.73528194",
"0.6324633",
"0.6142057",
"0.6126995",
"0.6046649",
"0.5942383",
"0.5941838",
"0.59104997",
"0.58582824",
"0.58531636",
"0.57334876",
"0.56944144",
"0.5665268",
"0.56326425",
"0.55655175",
"0.55645543",
"0.55553615",
"0.55553615",
"0.5528513",
"0.54561454",
"0.5... | 0.0 | -1 |
attr_accessible :title, :body Fetch a users gravatar | def gravatar
gravatar_id = Digest::MD5::hexdigest(email).downcase
"http://gravatar.com/avatar/#{gravatar_id}.png"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gravatar_for(user, options = {size:50})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n gravatar_url = \"https://secure.gravatar.com/avatar/#{gravatar_id}\"\n image_tag(gravatar_url, alt: user.firstname, class: \"gravatar\")\nend",
"def gravatar_for(user, options = { :size => 50 })\n grav... | [
"0.680719",
"0.6723818",
"0.6687609",
"0.6617974",
"0.656168",
"0.65376055",
"0.6471134",
"0.6445308",
"0.6445308",
"0.64381754",
"0.64299506",
"0.6405101",
"0.63900316",
"0.6367683",
"0.63618386",
"0.63458836",
"0.6332457",
"0.6303562",
"0.6295769",
"0.6291678",
"0.62838995"... | 0.6536226 | 6 |
List the count of all kites | def KiteCount
return kites.any? ? kites.count : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end",
"def counts\r\n @counts\r\n end",
"def count\n all.count\n end",
"def count\n all.size\n end",
"def joke_count # {{{\n\n @log.message :debug, \"Entering count function\... | [
"0.7281642",
"0.710959",
"0.71070874",
"0.7061868",
"0.70013595",
"0.6905018",
"0.6839541",
"0.6814879",
"0.67927605",
"0.67452055",
"0.6723762",
"0.6705124",
"0.66965955",
"0.6694922",
"0.6611957",
"0.66095257",
"0.6591906",
"0.6587669",
"0.65823805",
"0.6579828",
"0.6559085... | 0.7908182 | 0 |
Show only uncompleted kites | def ActiveKiteCount
return kites.where(:Completed => true).any? ? kites.where(:Completed => true).count : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_not_completed_items\n return @to_do_item.select { |x| x.is_done? == false }\n end",
"def show_not_completed_date_items\n return @to_do_with_date.select { |x| x.is_done? == false }\n end",
"def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == f... | [
"0.673198",
"0.62669724",
"0.621186",
"0.59788185",
"0.59693354",
"0.58705544",
"0.5831962",
"0.5799952",
"0.5751522",
"0.5745924",
"0.5743077",
"0.5721781",
"0.567365",
"0.56680036",
"0.56471455",
"0.56391525",
"0.5627553",
"0.5600861",
"0.5597888",
"0.5555315",
"0.55522597"... | 0.0 | -1 |
Show kites newer than the time range | def NewKites(time_range)
return Kite.where(:CreateDate => time_range)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age_worker(age_date)\n age_time = age_date.to_time\n ARGF.each do |l|\n project, type, age, last_seen = l.split \n last_seen = Time.at(last_seen.to_i)\n age_date = DateTime.parse(last_seen)\n puts l unless last_seen < age_date\n end\nend",
"def trucks_currently_open\n trucks = self.class.ge... | [
"0.5896425",
"0.580911",
"0.57830656",
"0.5627484",
"0.55666876",
"0.5554624",
"0.55488414",
"0.55229884",
"0.541954",
"0.5414374",
"0.54108375",
"0.53706753",
"0.5369857",
"0.5365509",
"0.5339607",
"0.5330281",
"0.5328211",
"0.5324419",
"0.53154576",
"0.53092945",
"0.5304818... | 0.700942 | 0 |
Count those new kites | def NewKiteCount(time_range)
@newkites = NewKites(time_range)
return @newkites.any? ? @newkites.count : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def KiteCount\n return kites.any? ? kites.count : 0\n end",
"def joke_count # {{{\n\n @log.message :debug, \"Entering count function\"\n\n jokes = Joke.all\n sources = Hash.new\n\n sources[ \"Total\" ] = jokes.length\n ... | [
"0.776792",
"0.7066331",
"0.6886832",
"0.6784671",
"0.6757118",
"0.6713328",
"0.6700039",
"0.64905286",
"0.64905286",
"0.64902157",
"0.64902157",
"0.64902157",
"0.6409458",
"0.6391788",
"0.6346701",
"0.62993455",
"0.6296222",
"0.629576",
"0.6271447",
"0.62284195",
"0.6200664"... | 0.7768112 | 0 |
Return the count of completed kites | def CompletedKitesCount
kites.any? ? kites.where(:Completed => true).count : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ActiveKiteCount\n return kites.where(:Completed => true).any? ? kites.where(:Completed => true).count : 0\n end",
"def total_complete\n tasks.select { |task| task.complete? }.count\n end",
"def KiteCount\n return kites.any? ? kites.count : 0\n end",
"def complete_check_count\r\n check_num... | [
"0.78254956",
"0.7514955",
"0.7314654",
"0.71822023",
"0.7101763",
"0.69599944",
"0.694649",
"0.6850551",
"0.6804507",
"0.67870873",
"0.67684704",
"0.6745445",
"0.6735387",
"0.668416",
"0.66261625",
"0.659184",
"0.6591822",
"0.6575871",
"0.65696424",
"0.65691566",
"0.6560136"... | 0.8295186 | 0 |
Number of comments made by this user | def CommentCount
return Comment.where(:user_id => id).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_comments\n\t \tcomments.count\n\t end",
"def number_of_commenting_users\n temp = describing_comments.collect{|comment| comment.submitter_id}.uniq.length\n ((temp >= @@low_amount_of_commenters)?(temp.to_s):(\"פחות מ-#{@@low_amount_of_commenters}\"))\n end",
"def comment_count\n com... | [
"0.79293793",
"0.7921563",
"0.7883997",
"0.7881407",
"0.7864624",
"0.7724404",
"0.7651044",
"0.74617356",
"0.745077",
"0.7449619",
"0.7449619",
"0.7245979",
"0.6992755",
"0.6940779",
"0.69296163",
"0.69213825",
"0.69102395",
"0.6889458",
"0.68340874",
"0.6784961",
"0.67741734... | 0.8096919 | 0 |
Listing of most recent people commenting, following, or becomming members of our kites | def RecentActivity
@followings = Follwing.where(:kite_id => kites.select("id"), :Type => "like").order("created_at DESC").take(5)
@comments = Comment.where(:kite_id => kites.select("id")).order("created_at DESC").take(5)
return (@followings + @comments).sort_by(&:created_at)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_comm\n\t\t\t@commenters = User.all.order('comments.id DESC').joins('LEFT JOIN comments ON \n\t\t\t\tcomments.user_id == users.id').group('users.id').where('comments.created_at >= ?',\n\t\t\t\t1.week.ago.utc).limit(10)\n\t\tend",
"def get_most_comments_made(num_users = 5)\n get_most_generic_for_users... | [
"0.69073904",
"0.6434515",
"0.621113",
"0.62063205",
"0.6192999",
"0.60944897",
"0.6058778",
"0.6036822",
"0.60322016",
"0.6019464",
"0.6012013",
"0.6010895",
"0.5969192",
"0.59494525",
"0.5947881",
"0.59438956",
"0.59269917",
"0.59263223",
"0.59226424",
"0.5916917",
"0.59138... | 0.70678264 | 0 |
Contains logic to set the age instance variable for this bio | def set_age
birthday = Date.parse(@birthday)
today = Date.today
if (birthday.month == today.month && birthday.day <= today.day) || (birthday.month < today.month)
@age = today.year - birthday.year
else
@age = today.year - birthday.year - 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def age=(new_age)\n @age = new_age\n end",
"def set_age=(value)\n\t\t@dog_age = value\n\tend",
"def age=(v) self['Age'] = v end",
"def age=(val)\n @age = val\n val = val.to_i rescue 0 # sometimes we get age: {\"Pr\" => nil}\n return unless val > 0\n return unless val < 200\n ... | [
"0.81952316",
"0.8078103",
"0.80515766",
"0.7953123",
"0.7870953",
"0.76871717",
"0.76871717",
"0.7465189",
"0.7464193",
"0.74414915",
"0.7438175",
"0.7419537",
"0.735419",
"0.7346078",
"0.73292863",
"0.7302484",
"0.7245975",
"0.7171742",
"0.713806",
"0.713806",
"0.71344304",... | 0.79890364 | 3 |
This sets up an accessor to the replicator plate, so that in the main geordisreplicator.rb program, we can see what's on the replicator plate (if anything) | def plate
@plate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rit_plate!(layout_name, instance_name, plate_name)\n Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])\n end",
"def plates\n @plates ||= plate_wrappers.collect(&:plate)\n end",
"def rit_plate!(layout_name, instance_name, plate_name)\n RitClient::Plate.get... | [
"0.6454652",
"0.6338162",
"0.6317823",
"0.63124245",
"0.63124245",
"0.63124245",
"0.63124245",
"0.6248719",
"0.6065085",
"0.59362024",
"0.5884649",
"0.57556325",
"0.56296486",
"0.5560325",
"0.55416423",
"0.5492264",
"0.5481562",
"0.5441679",
"0.5440123",
"0.5366943",
"0.53467... | 0.7160576 | 0 |
After the Enterprise is put together, this is the key method responsible for creating the drink. This is where your pry debugging should begin. Put a `binding.pry` at the beginning of this method and then manually execute each method to ensure it returns what's expect. | def replicate(recipe)
# Setup an instance variable for the recipe
# so that other methods can see what the recipe is
@recipe = recipe
# This transports a glass from the cupboard to inside the replicator.
# If this method is successful, it will return the glass that was
# transported and @insid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_a_drink\n soda.drink_a_soda\n puts \"You drank your soda!\"\n end",
"def beverage(drink)\n\t\t\tputs \"After dealing so many wonderful children, #{@name}, needed a break and a refreshing #{drink}.\"\n\t\tend",
"def create\n p \"HEEELLO\"\n binding.pry\n end",
"def drink_builder\n cust... | [
"0.63569933",
"0.6258279",
"0.6180569",
"0.6038083",
"0.5988634",
"0.5932284",
"0.57332337",
"0.5710839",
"0.5677235",
"0.5643578",
"0.55958533",
"0.5556945",
"0.55337125",
"0.5531498",
"0.5529376",
"0.550653",
"0.54835284",
"0.5417882",
"0.5406645",
"0.53730386",
"0.5356368"... | 0.0 | -1 |
This moves the glass from the cupboard to inside the replicator. | def retrieve_glass
@enterprise.transporter.energize(
@enterprise.cupboard.find_glass,
@enterprise.cupboard.shelf,
@inside_replicator
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pile(w)\n w.drag_to(@current)\n w.set_default_refresh_loc('tl')\n @current.x += PILE_OFFSET\n end",
"def mix\n\n # Abort if there is no glass inside the replicator.\n return unless glass_inside_replicator\n\n # Draw power if possible and then mix ingredients around.\n if @power && @ente... | [
"0.6207337",
"0.5815868",
"0.5804106",
"0.57919955",
"0.5726951",
"0.5718077",
"0.5707603",
"0.55339587",
"0.5505571",
"0.5503077",
"0.5476379",
"0.54341966",
"0.54236376",
"0.54092944",
"0.53861207",
"0.5376837",
"0.53484094",
"0.5342033",
"0.53366756",
"0.5316442",
"0.53000... | 0.0 | -1 |
This transports ingredients into the glass. | def transport_ingredients_to_glass
# Abort if there is no glass inside the replicator.
return unless glass_inside_replicator
# Go through recipe and transport each ingredient
# from pantry to glass, one by one.
@recipe.ingredients.each do |ingredient_name|
@enterprise.transporter.energize(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mix\n\n # Abort if there is no glass inside the replicator.\n return unless glass_inside_replicator\n\n # Draw power if possible and then mix ingredients around.\n if @power && @enterprise.reactor.draw_power(3)\n glass_inside_replicator.inside.contents.shuffle!.compact!\n end\n end",
"de... | [
"0.653186",
"0.6447666",
"0.62488383",
"0.62342215",
"0.6213606",
"0.6116174",
"0.61089295",
"0.6059206",
"0.60430753",
"0.6042016",
"0.60364145",
"0.6029882",
"0.6027603",
"0.6001233",
"0.5995063",
"0.5993018",
"0.5925648",
"0.58956987",
"0.58791834",
"0.58598953",
"0.585125... | 0.8402173 | 0 |
This mixes the ingredients around inside the replicator. | def mix
# Abort if there is no glass inside the replicator.
return unless glass_inside_replicator
# Draw power if possible and then mix ingredients around.
if @power && @enterprise.reactor.draw_power(3)
glass_inside_replicator.inside.contents.shuffle!.compact!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transport_ingredients_to_glass\n\n # Abort if there is no glass inside the replicator.\n return unless glass_inside_replicator\n\n # Go through recipe and transport each ingredient\n # from pantry to glass, one by one.\n @recipe.ingredients.each do |ingredient_name|\n @enterprise.transporte... | [
"0.7093342",
"0.686148",
"0.6828428",
"0.66431075",
"0.6596935",
"0.6462586",
"0.6443275",
"0.6314688",
"0.6306691",
"0.6180828",
"0.6146375",
"0.60705775",
"0.6012408",
"0.59747237",
"0.5912733",
"0.5912194",
"0.5866347",
"0.5820669",
"0.58186704",
"0.58003867",
"0.57502985"... | 0.7868074 | 0 |
This adjusts the temperature of the glass to what the recipes calls for. | def adjust_temperature
# Abort if there is no glass inside the replicator.
return unless glass_inside_replicator
# Transport glass to the reactor where the temperature adjustment will take place.
# If successful, @enterprise.reactor.core will now contain the glass
# and @inside_replicator will no ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_temperature\n\n temp = @temperature*1.8 + 32\n\n end",
"def adjust_mpg(mpg, mph)\n\tif mph > 60\n\t\ttemp = mph \n\t\ttemp = temp - 60 \n\t\tminus_mpg = temp * 2 \n\t\tnew_mpg = mpg - minus_mpg \n\tend \nend",
"def set_temperature(desired)\n desired *= 2 if last_status && last_status.tempera... | [
"0.58660805",
"0.5830521",
"0.57891655",
"0.5788782",
"0.5752999",
"0.56219107",
"0.56109667",
"0.5458463",
"0.5441461",
"0.5431039",
"0.53988224",
"0.5362414",
"0.534581",
"0.5342804",
"0.5338088",
"0.53379226",
"0.5329838",
"0.53105986",
"0.5304829",
"0.52621555",
"0.525488... | 0.7626394 | 0 |
Not very efficient. Come back later | def find_next_collatz(n)
if n == 1
return 1
elsif n % 2 == 0
n = n / 2
return n
else
n = (3 * n) + 1
return n
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def stderrs; end",
"def probers; end",
"def anchored; end",
"def schubert; end",
"def offences_by; end",
"def malts; end",
"def rassoc(p0) end",
"def suivre; end",
"def villian; end",
"def surge; end",
"def same; end",
"def berlioz; end",
"def deco_pos; end",
"def re... | [
"0.6084207",
"0.5937959",
"0.5927107",
"0.5859962",
"0.58395576",
"0.5772095",
"0.5596844",
"0.5498663",
"0.5494978",
"0.54010814",
"0.5399361",
"0.5398471",
"0.5394752",
"0.5360247",
"0.5353653",
"0.5337623",
"0.53250104",
"0.5303135",
"0.528254",
"0.5269999",
"0.5269999",
... | 0.0 | -1 |
RSpec mocks are checking if object responds to calls Due to fact that we use method_missing is delegating responsibility Dude class responds to all calls | def respond_to?(*)
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method, *args, &block)\n __check_expectation__(method, args)\n block.call if block\n end",
"def test_mock_which_responds_like_object_with_public_method_does_respond_when_method_is_not_stubbed\n object = Class.new do\n def foo; end\n public :foo\n end.new\n ... | [
"0.6621489",
"0.65387404",
"0.64560235",
"0.6447917",
"0.64422584",
"0.6418349",
"0.6293005",
"0.62928784",
"0.6239033",
"0.6222484",
"0.6217791",
"0.61503804",
"0.6139637",
"0.61377597",
"0.6137307",
"0.6112147",
"0.60879743",
"0.6068476",
"0.60570306",
"0.60444444",
"0.6039... | 0.0 | -1 |
Solve the board and get the solution | def solve(type = HumanSolver)
type.solve(@input)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve\n if invalid?\n nil\n elsif solved?\n self\n else\n x, y = @strategy.next_cell(@grid)\n\n # Try each of the possible values for cell [x, y] and if one leads to a solution, return that solution\n self[x, y].each do |val|\n next_game = self.clone\n... | [
"0.7742368",
"0.7604747",
"0.75884295",
"0.75717837",
"0.74347156",
"0.7342931",
"0.71969515",
"0.7180312",
"0.7149017",
"0.7104723",
"0.708465",
"0.7059681",
"0.69394904",
"0.69098985",
"0.6879356",
"0.6830359",
"0.67960155",
"0.67721987",
"0.6768006",
"0.67209935",
"0.66952... | 0.0 | -1 |
Solve the board by setting the solution to the current code on the board | def solve!(type = HumanSolver)
@input = type.solve(@input)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve\n if invalid?\n nil\n elsif solved?\n self\n else\n x, y = @strategy.next_cell(@grid)\n\n # Try each of the possible values for cell [x, y] and if one leads to a solution, return that solution\n self[x, y].each do |val|\n next_game = self.clone\n... | [
"0.7272265",
"0.7206328",
"0.7080216",
"0.70571625",
"0.6971197",
"0.69646055",
"0.69508016",
"0.692909",
"0.691134",
"0.69029504",
"0.6877553",
"0.6825239",
"0.6804277",
"0.66644543",
"0.66541624",
"0.65715784",
"0.6569129",
"0.6565506",
"0.6539605",
"0.6539487",
"0.65366656... | 0.5507501 | 98 |
Checks the board for its validation (Sudoku rules) | def valid?
(rows.all? &method(:valid_sequence?)) && (columns.all? &method(:valid_sequence?)) && (field_groups.all? &method(:valid_sequence?))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_board?\n self.valid_rows? && self.valid_cols? && self.valid_squares?\n end",
"def is_valid_sudoku(board)\n transposed_board = board.transpose\n board.each_with_index do |row, r_index|\n row.each_with_index do |cell, c_index|\n # check row\n # check column\n if !check_row(row, ce... | [
"0.76381123",
"0.76117206",
"0.7572253",
"0.75650245",
"0.7556553",
"0.75393736",
"0.746999",
"0.7462364",
"0.74550223",
"0.7320017",
"0.72086245",
"0.71907663",
"0.71424556",
"0.7089459",
"0.70075756",
"0.7006863",
"0.7004126",
"0.70002604",
"0.6911159",
"0.68837297",
"0.687... | 0.0 | -1 |
Returns all rows of the board | def rows
@rows ||= begin
row_indexes.map do |e|
e.map do |e|
@input[e]
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_board_rows()\n array_of_rows = []\n sudoku_board.each { |row| array_of_rows << row }\n end",
"def all_rows\n rows = []\n while row = next_row\n rows << row\n end\n return rows\n end",
"def rows\r\n @all_rows\r\n end",
"def all_rows\n @rows\... | [
"0.8334372",
"0.75463206",
"0.7353652",
"0.7294904",
"0.7234642",
"0.71277475",
"0.71065784",
"0.7016752",
"0.6998251",
"0.6989329",
"0.6930069",
"0.69039637",
"0.68595344",
"0.6808872",
"0.67659146",
"0.6747013",
"0.6742431",
"0.67387736",
"0.66968304",
"0.66953355",
"0.6683... | 0.6671613 | 22 |
Get a specific row | def row(index)
row_indexes(index).map do |e|
@input[e]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row_by_idx(idx)\n @row[idx]\n end",
"def row(row_id); get(\"#{link('rows')}/#{row_id}\"); end",
"def row(index)\n @rows[index]\n end",
"def row(index)\n @data[index]\n end",
"def get_row(board, row)\n\treturn board[row]\nend",
"def get_row(board, row)\n\tboard[row]\nen... | [
"0.796033",
"0.768491",
"0.7645459",
"0.7306998",
"0.7294574",
"0.7234113",
"0.7219784",
"0.72158897",
"0.7191448",
"0.71434796",
"0.7133448",
"0.71269464",
"0.7079399",
"0.70646656",
"0.7060341",
"0.7056298",
"0.7056298",
"0.7045656",
"0.70107096",
"0.700786",
"0.69917923",
... | 0.6300823 | 68 |
Get the row index for a field index | def row_index_for_field_index(index)
(index / @length).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def row_for_field_index(index)\n row(row_index_for_field_index(index))\n end",
"def header_row_index\n index(header)\n end",
"def xf_record_index(row, col, xf=nil)\n if xf.kind_of?(Format)\n return xf.xf_index\n elsif @row_formats.has_key?(row)\n return @row_formats[row].xf_inde... | [
"0.7522575",
"0.72796917",
"0.7062314",
"0.68886447",
"0.6814914",
"0.67592156",
"0.67527133",
"0.65111715",
"0.64781165",
"0.6475379",
"0.6437307",
"0.6395951",
"0.635397",
"0.6279775",
"0.6234396",
"0.6227935",
"0.62125677",
"0.6165769",
"0.61559194",
"0.6153497",
"0.612858... | 0.80973834 | 0 |
Get a row for a field index | def row_for_field_index(index)
row(row_index_for_field_index(index))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row_by_idx(idx)\n @row[idx]\n end",
"def row(index)\n @rows[index]\n end",
"def row(index)\n @data[index]\n end",
"def row_index_for_field_index(index)\n (index / @length).to_i\n end",
"def row(index)\n row_indexes(index).map do |e|\n @input[e]\n ... | [
"0.7735795",
"0.7128932",
"0.70060575",
"0.6928313",
"0.69088304",
"0.68695706",
"0.6837528",
"0.6699959",
"0.6615279",
"0.6606166",
"0.65597254",
"0.6536447",
"0.64511937",
"0.63046813",
"0.63044494",
"0.6301953",
"0.6251745",
"0.62297654",
"0.61696416",
"0.6120177",
"0.6080... | 0.86951375 | 0 |
Returns all columns of the board | def columns
@columns ||= begin
column_indexes.map do |e|
e.map do |e|
@input[e]
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_columns\n column_lines = []\n 0.upto(@@width - 1) do |column|\n column_line = \"\"\n 0.upto(@@height - 1) do |row|\n column_line << @board[row][column]\n end\n column_lines << column_line\n end\n column_lines\n end",
"def columns\n @board.transpose\n end",
"d... | [
"0.8486538",
"0.8366346",
"0.81048864",
"0.78353953",
"0.77155155",
"0.7684839",
"0.7560283",
"0.7276194",
"0.71510404",
"0.7124575",
"0.71157086",
"0.7060145",
"0.7008654",
"0.6982805",
"0.6979342",
"0.69650066",
"0.69545984",
"0.69489276",
"0.69274104",
"0.6901672",
"0.6899... | 0.6339707 | 71 |
Get a specific column | def column(index)
column_indexes(index).map do |e|
@input[e]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCol\n return @col\n end",
"def column(id)\n @columns[id]\n end",
"def column\n @__col\n end",
"def column(index)\n columns[index]\n end",
"def column(column_name)\n @columns.detect {|f| f.name == column_name.to_s}\n end",
"def column(name)\n @name_to_co... | [
"0.8039655",
"0.7987144",
"0.78118867",
"0.7703154",
"0.7663267",
"0.7599919",
"0.7583627",
"0.757529",
"0.75522053",
"0.7493691",
"0.7427768",
"0.7427768",
"0.73778725",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.7265... | 0.0 | -1 |
Get the column index for a field index | def column_index_for_field_index(index)
index % @length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_for_field_index(index)\n column(column_index_for_field_index(index))\n end",
"def get_col_from_index(idx)\n idx%cols\n end",
"def row_index_for_field_index(index)\n (index / @length).to_i\n end",
"def index_fields\n self.class.fields.values.select { |field| field.index }\n... | [
"0.7876987",
"0.7335003",
"0.70144004",
"0.69597167",
"0.68926466",
"0.68667436",
"0.6750672",
"0.6706528",
"0.6704935",
"0.66577345",
"0.66265035",
"0.6571185",
"0.6448778",
"0.6446024",
"0.63442457",
"0.63357425",
"0.63269895",
"0.63099784",
"0.6308875",
"0.6289281",
"0.624... | 0.7330599 | 2 |
Get a column for a field index | def column_for_field_index(index)
column(column_index_for_field_index(index))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_col_from_index(idx)\n idx%cols\n end",
"def column(index)\n end",
"def column(index)\n columns[index]\n end",
"def column(index)\n @columns[index]\n end",
"def column(index)\n column_indexes(index).map do |e|\n @input[e]\n end\n end",
"def column(ind... | [
"0.77350694",
"0.7512305",
"0.7425104",
"0.74081177",
"0.7279082",
"0.6943091",
"0.68345094",
"0.68327385",
"0.68118787",
"0.67588025",
"0.670719",
"0.66597503",
"0.66563267",
"0.6656279",
"0.66379964",
"0.66379964",
"0.66082335",
"0.65517694",
"0.65196425",
"0.64873",
"0.645... | 0.874204 | 0 |
Returns all field groups of the board | def field_groups
@field_groups ||= begin
field_group_indexes.map do |e|
e.map do |e|
@input[e]
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end",
"def groups\n return @groups\n end",
"def groups\n find(:group).map { |g| g.content }\n end",
"def groups\n @@groups =... | [
"0.66242975",
"0.6572671",
"0.65674746",
"0.65652454",
"0.6519818",
"0.6515428",
"0.64977163",
"0.6495426",
"0.64438576",
"0.6443343",
"0.64213103",
"0.64094967",
"0.6397386",
"0.6378256",
"0.6359249",
"0.6359249",
"0.6359249",
"0.6349925",
"0.63376224",
"0.6336591",
"0.62375... | 0.75642794 | 0 |
Get a specific column | def field_group(index)
field_group_indexes(index).map do |e|
@input[e]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCol\n return @col\n end",
"def column(id)\n @columns[id]\n end",
"def column\n @__col\n end",
"def column(index)\n columns[index]\n end",
"def column(column_name)\n @columns.detect {|f| f.name == column_name.to_s}\n end",
"def column(name)\n @name_to_co... | [
"0.8039655",
"0.7987144",
"0.78118867",
"0.7703154",
"0.7663267",
"0.7599919",
"0.7583627",
"0.757529",
"0.75522053",
"0.7493691",
"0.7427768",
"0.7427768",
"0.73778725",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.73553205",
"0.7265... | 0.0 | -1 |
Get the field group index for a field index eg. 80 is passed > you will get 8 | def field_group_index_for_field_index(index)
r = (row_index_for_field_index(index) / @field_size).to_i * @field_size
c = (column_index_for_field_index(index) / @field_size).to_i
r + c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_group_for_field_index(index)\n field_group(field_group_index_for_field_index(index))\n end",
"def field_group_indexes(get_at = nil)\n # 9x9 -> [[0,1,2,9,10,11,18,19,20], [3,4,5,12,13,14,21,22,23], ..... ]\n @@field_group_indexes[@length] ||= begin\n base = @length / @field_size... | [
"0.7892387",
"0.7494514",
"0.74695766",
"0.698626",
"0.6842663",
"0.6531873",
"0.6517846",
"0.6453197",
"0.6405512",
"0.6354743",
"0.62616384",
"0.60269976",
"0.5975464",
"0.59438443",
"0.58743906",
"0.5868548",
"0.58100826",
"0.5644258",
"0.56222785",
"0.5598438",
"0.5577605... | 0.8434331 | 0 |
Get a column for a field index | def field_group_for_field_index(index)
field_group(field_group_index_for_field_index(index))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_for_field_index(index)\n column(column_index_for_field_index(index))\n end",
"def get_col_from_index(idx)\n idx%cols\n end",
"def column(index)\n end",
"def column(index)\n columns[index]\n end",
"def column(index)\n @columns[index]\n end",
"def column(index)... | [
"0.874204",
"0.77350694",
"0.7512305",
"0.7425104",
"0.74081177",
"0.7279082",
"0.6943091",
"0.68345094",
"0.68327385",
"0.68118787",
"0.67588025",
"0.670719",
"0.66597503",
"0.66563267",
"0.6656279",
"0.66379964",
"0.66379964",
"0.66082335",
"0.65517694",
"0.65196425",
"0.64... | 0.0 | -1 |
Generates block indexes for the field groups | def field_group_indexes(get_at = nil)
# 9x9 -> [[0,1,2,9,10,11,18,19,20], [3,4,5,12,13,14,21,22,23], ..... ]
@@field_group_indexes[@length] ||= begin
base = @length / @field_size
temp_indexes = base.times.map { |count| base.times.map { |c| count + (base * c) } }
max_index = (length *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_group_index_for_field_index(index)\n r = (row_index_for_field_index(index) / @field_size).to_i * @field_size\n c = (column_index_for_field_index(index) / @field_size).to_i\n r + c\n end",
"def field_groups\n @field_groups ||= begin\n field_group_indexes.map do |e|\n ... | [
"0.65766245",
"0.6409725",
"0.6119608",
"0.59964097",
"0.58087134",
"0.5759627",
"0.5724061",
"0.5707277",
"0.5673169",
"0.56542397",
"0.56344604",
"0.56183904",
"0.558056",
"0.55689204",
"0.55681",
"0.5546707",
"0.5535347",
"0.5513124",
"0.54974174",
"0.54831314",
"0.5472309... | 0.65504515 | 1 |
Generates block indexes for the columns | def column_indexes(get_at = nil)
@@column_indexes[@length] ||= begin
@length.times.map do |count|
@length.times.map do |inner_count|
inner_count * @length + count
end
end
end
if get_at
@@column_indexes[@length][get_at]
else
@@column... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index\n index = {}\n count = 0\n (0...rows).each do |row|\n (0...cols).each do |col|\n next unless used?(row, col)\n index[[row, col]] = count\n count += 1\n end\n end\n\n index\n end",
"def each_column\n @chash.each_with_index { |c, i| \n next... | [
"0.6041138",
"0.5951915",
"0.5915894",
"0.5871017",
"0.5846795",
"0.5830225",
"0.5811573",
"0.575541",
"0.574176",
"0.57381886",
"0.5737409",
"0.5720385",
"0.56887776",
"0.56600165",
"0.56595415",
"0.5590289",
"0.55773044",
"0.55578053",
"0.5551288",
"0.5539443",
"0.5538372",... | 0.5906174 | 3 |
Generates block indexes for the rows | def row_indexes(get_at = nil)
@@row_indexes[@length] ||= begin
@length.times.map do |count|
@length.times.map do |inner_count|
inner_count + (count * @length)
end
end
end
if get_at
@@row_indexes[@length][get_at]
else
@@row_indexes[@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index\n index = {}\n count = 0\n (0...rows).each do |row|\n (0...cols).each do |col|\n next unless used?(row, col)\n index[[row, col]] = count\n count += 1\n end\n end\n\n index\n end",
"def each_with_index(zeroes = false, &_block)\n return enum_for :... | [
"0.6513503",
"0.611462",
"0.5997317",
"0.5960059",
"0.58860224",
"0.588371",
"0.5827657",
"0.5814833",
"0.5777183",
"0.5766656",
"0.57510597",
"0.57493424",
"0.5744697",
"0.57327384",
"0.5726217",
"0.567508",
"0.56477815",
"0.5642521",
"0.5610374",
"0.5590171",
"0.55610645",
... | 0.6062883 | 2 |
Check for a valid sequence, e.g. 9x9 sudoku a sequence can only contain one of each (19 uniqness) and only 19 is allowed | def valid_sequence?(input)
compacted_input = input.compact
input_valid = compacted_input.all? &method(:valid_number?)
input_valid && input.length == @length && compacted_input == compacted_input.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(section)\n \n #Rows, Columns or Blocks\n #--------------------------------------------------\n section.each do |i|\n check = i.sort.join.squeeze(\"0\")\n if check.length > check.split(\"\").uniq.length\n\tputs \"***************************************************\"\n\tputs \"Fail... | [
"0.669879",
"0.6654736",
"0.6584124",
"0.65783715",
"0.6563515",
"0.6560683",
"0.65593565",
"0.6443184",
"0.64305216",
"0.6417273",
"0.63791203",
"0.6362046",
"0.63616097",
"0.6352677",
"0.62641907",
"0.6257315",
"0.6255528",
"0.62426955",
"0.6242147",
"0.622478",
"0.62217",
... | 0.71533054 | 0 |
Function to test if a number is valid (eg. in a 9x9 sudoku: 19) | def valid_number?(num)
(1..@length).freeze.include? num
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isValidNumber(number)\t\t\n\t\t@sum = 0\n\t\t(0..8).each do |position| \n\t\t\t@digit = number.to_s[position].to_i\n\t\t\t@sum += @digit * (9 - position)\n\t\tend\n\t\t@sum % 11 == 0\n\tend",
"def valid?(num)\n odd = false\n num.to_s.gsub(/\\D/,'').reverse.split('').map(&:to_i).collect { |d... | [
"0.7781882",
"0.77651817",
"0.7733826",
"0.7672153",
"0.7496769",
"0.74873453",
"0.7470734",
"0.7439212",
"0.74096304",
"0.74080837",
"0.7351856",
"0.7340202",
"0.73313355",
"0.7293325",
"0.7281883",
"0.7272651",
"0.7230421",
"0.7210188",
"0.7204461",
"0.7204461",
"0.7194083"... | 0.7784874 | 0 |
Function to get the length of the sides of the board | def length
@length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_corners\n @number_of_sides\n end",
"def side_length\n\t\ttop = (@num_sides - 2) * Math::PI\n\t\tangle = top / (2 * @num_sides)\n\t\t@side_length = 2 * Math.cos(angle)\n\tend",
"def sides\n \t@labels.length #return 6\n end",
"def perimeter\n\n return @side_len * 4\n\n end",
"def boar... | [
"0.7536298",
"0.74865365",
"0.70815593",
"0.70609087",
"0.7015004",
"0.6957982",
"0.6860934",
"0.6859776",
"0.6791278",
"0.6707256",
"0.66669077",
"0.6656201",
"0.6648902",
"0.6648569",
"0.66294783",
"0.66294783",
"0.6627879",
"0.65345466",
"0.653416",
"0.6503619",
"0.6492960... | 0.0 | -1 |
Setup Rdm's internal settings | def setup(&block)
settings.instance_eval(&block) if block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_setting\n end",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n @rc_cfg = Red_Counter::Config.new\n end",
"def settings; end",
"def settings; end",
"def setup_config\n # To be Extended\n end",
"def setup(... | [
"0.6677246",
"0.6616988",
"0.644288",
"0.644288",
"0.6403997",
"0.63900447",
"0.62169933",
"0.61926055",
"0.6127893",
"0.61213946",
"0.6118458",
"0.61018234",
"0.60134625",
"0.60018146",
"0.60018146",
"0.60006285",
"0.6000511",
"0.59815705",
"0.5973383",
"0.5973383",
"0.59568... | 0.63030624 | 6 |
Creates a board initialized at the default starting position, or from FEN if given | def initialize( start_pos = nil )
return _initialize_fen( start_pos ) if start_pos
Chess.initial_pieces.each{ |piece, pos| self[pos] = piece }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def starting_board\n init_rows([0, 2], :black)\n init_rows([5, 7], :red)\n end",
"def generate_board\n [0, 1, 2].each do |row|\n 0.upto(7) do |col|\n offset = row + col\n self[[row, col]] = Piece.new([row, col], self, :B) if offset.odd?\n end\n end\n\n [5, 6, 7].each do |r... | [
"0.690688",
"0.68131703",
"0.6727722",
"0.65667164",
"0.64924115",
"0.6490574",
"0.6455053",
"0.6409947",
"0.6369164",
"0.63465434",
"0.6345642",
"0.63333285",
"0.6326935",
"0.6319246",
"0.6315299",
"0.63020176",
"0.6271772",
"0.62714857",
"0.6269584",
"0.6263789",
"0.6242183... | 0.62154937 | 25 |
TODO eliminate the string underpinnings of this class once callers use symbols / vectors | def [] x
super(x.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string()\n #This is a stub, used for indexing\n end",
"def symbols; end",
"def strings; end",
"def objects_and_symbols; end",
"def symbols() @symbols end",
"def String(p0) end",
"def symbol\n \n end",
"def symbol; end",
"def symbol; end",
"def symbol; end",
"def symbol; ... | [
"0.6298008",
"0.6251303",
"0.6210391",
"0.6170732",
"0.60711217",
"0.6027689",
"0.59851307",
"0.5910396",
"0.5910396",
"0.5910396",
"0.5910396",
"0.5910396",
"0.5910396",
"0.5826256",
"0.58224124",
"0.5686421",
"0.5685648",
"0.56465316",
"0.5622209",
"0.55985683",
"0.55985683... | 0.0 | -1 |
updates internals with a given move played Dereferences any existing piece we're moving onto or capturing enpassant Updates our EP square or nils it out | def play_move!( m )
self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }
piece_moved = self.delete(m.from_coord)
self[m.to_coord] = piece_moved
if m.castled==1
castling_rank = m.to_coord.rank.to_s
[['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_state(state, move)\n # Deep copy position (is this the easiest way?)\n position = Marshal.load(Marshal.dump(state[:position]))\n player = state[:player]\n opp = opponent(player)\n pieces = Marshal.load(Marshal.dump(state[:pieces]))\n from = move[0]\n to = move[1]\n force_analysis =... | [
"0.6751392",
"0.66764253",
"0.6621967",
"0.6559608",
"0.6528575",
"0.64655715",
"0.64248025",
"0.6343647",
"0.6315642",
"0.62978786",
"0.62830955",
"0.6270272",
"0.6263729",
"0.62082046",
"0.6185131",
"0.61670387",
"0.61638695",
"0.6157267",
"0.61513215",
"0.6146088",
"0.6102... | 0.7330915 | 0 |
Says whether you are a pawn moving sideways onto an empty square when an enpassant capture is available | def en_passant_capture?( from_coord, to_coord )
with ( self[from_coord] ) do |pawn|
return false unless pawn.function == :pawn
return false unless self.en_passant_square
return (from_coord.file != to_coord.file) && (self[to_coord]==nil)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_be_captured_en_passant?(x,y)\n return false unless piece = self.game.find_piece(x,y)\n return (piece.type == \"Pawn\") && (piece.white? != white?) && (piece.just_moved_two_spaces?)\n end",
"def update_capture_coord\n return true unless @piece_moving and @piece_moving.kind_of?(Pawn)\n if @pie... | [
"0.7138383",
"0.71127",
"0.6811559",
"0.6781526",
"0.66920584",
"0.66511524",
"0.6635105",
"0.65629375",
"0.6526753",
"0.6369323",
"0.6358507",
"0.63562036",
"0.6322228",
"0.6283537",
"0.6246828",
"0.62369996",
"0.6236361",
"0.6232468",
"0.62129456",
"0.61968917",
"0.61863965... | 0.69445515 | 2 |
simplest logic here if theres a move you're allowed which gets you out of check, you're not in checkmate contrast with more intelligent Capture/Block/Evade strategy | def in_checkmate?( side )
return false unless in_check?( side )
way_out = false
each_pair do |pos, piece|
next if piece.side != side
return false if way_out
piece.allowed_moves(self).each do |mv|
consider_move( Move.new( :from_coord => pos, :to_coord => mv ) ) do |b|
way_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpu_prevent\n current_turn = @state[:turn]\n @state[:turn] = current_turn == PLAYER_1_TURN ? PLAYER_2_TURN : PLAYER_1_TURN # pretend to be other player\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET\n board_remove_token(c) # remove the win... | [
"0.7266294",
"0.7215407",
"0.7214956",
"0.7170022",
"0.7170022",
"0.7068227",
"0.70560515",
"0.7053188",
"0.7049834",
"0.70124257",
"0.70090425",
"0.6965528",
"0.69515365",
"0.68727577",
"0.686677",
"0.6858701",
"0.68433964",
"0.68425345",
"0.6830251",
"0.68266755",
"0.681707... | 0.0 | -1 |
provides a format for tracing | def to_s( for_black = false )
output = '' # ' ' * (8 * 8 * 2) #spaces or newlines after each
ranks = %w{ 8 7 6 5 4 3 2 1 }
files = %w{ a b c d e f g h }
(ranks.reverse! and files.reverse!) if for_black
last_file = files[7]
ranks.each do |rank|
files.each do |file|
piece = self[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def log_formatter; end",
"def log_formatter; end",
"def formats; end",
... | [
"0.71998924",
"0.71998924",
"0.71998924",
"0.71998924",
"0.71998924",
"0.71998924",
"0.71998924",
"0.71998924",
"0.7179126",
"0.7179126",
"0.7179126",
"0.7112379",
"0.7112379",
"0.6657304",
"0.6657304",
"0.6624021",
"0.6518201",
"0.646022",
"0.64006025",
"0.6360821",
"0.63507... | 0.0 | -1 |
Assigns GitLab team members to be reviewer and maintainer for each change category that a Merge Request contains. | def spin(project, categories, timezone_experiment: false)
spins = categories.sort.map do |category|
including_timezone = INCLUDE_TIMEZONE_FOR_CATEGORY.fetch(category, timezone_experiment)
spin_for_category(project, category, timezone_experiment: including_timezone)
end
defa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_reviewer(new_reviewer)\n new_reviewer = new_reviewer.gsub(/^\\@/, \"\")\n editor = issue.body.match(/\\*\\*Editor:\\*\\*\\s*.@(\\S*)/)[1]\n new_body = issue.body.gsub(/\\*\\*Reviewer:\\*\\*\\s*(@\\S*|Pending)/i, \"**Reviewer:** @#{new_reviewer}\")\n github_client.add_collaborator(@nwo, new_reviewer)... | [
"0.63543427",
"0.63460445",
"0.54001546",
"0.5356484",
"0.52711916",
"0.5220872",
"0.5191116",
"0.5140257",
"0.5089794",
"0.5085962",
"0.507748",
"0.5067141",
"0.5056559",
"0.5037079",
"0.50207865",
"0.5002093",
"0.4998198",
"0.49959946",
"0.49900728",
"0.49694422",
"0.496497... | 0.0 | -1 |
Looks up the current list of GitLab team members and parses it into a useful form | def team
@team ||=
begin
data = Tooling::Danger::RequestHelper.http_get_json(ROULETTE_DATA_URL)
data.map { |hash| ::Tooling::Danger::Teammate.new(hash) }
rescue JSON::ParserError
raise "Failed to parse JSON response from #{ROULETTE_DATA_URL}"
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_members_for_output\n members = team_memberships.map do |tm|\n profile = tm.person_profile.published_version\n next unless profile.present?\n {\n title: profile.content_item.title,\n url_path: profile.content_item.url_path,\n role_holder_name: profile.role_holder_name... | [
"0.726413",
"0.71068215",
"0.6993693",
"0.69234216",
"0.6797192",
"0.6601716",
"0.65783584",
"0.65430784",
"0.650718",
"0.64497495",
"0.6411128",
"0.6384081",
"0.6352828",
"0.6333034",
"0.6308576",
"0.62754816",
"0.6270861",
"0.6267588",
"0.6261529",
"0.6070167",
"0.60617936"... | 0.0 | -1 |
Like +team+, but only returns teammates in the current project, based on project_name. | def project_team(project_name)
team.select { |member| member.in_project?(project_name) }
rescue => err
warn("Reviewer roulette failed to load team data: #{err.message}")
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def team_member_by_id(user_id)\n users_projects.find_by_user_id(user_id)\n end",
"def team_member_by_id(user_id)\n users_projects.find_by(user_id: user_id)\n end",
"def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n ... | [
"0.6798863",
"0.679874",
"0.648515",
"0.6460714",
"0.6446692",
"0.6433884",
"0.64185625",
"0.63107705",
"0.6270833",
"0.62191916",
"0.6195795",
"0.61874616",
"0.6178141",
"0.6149106",
"0.614689",
"0.6144261",
"0.61014223",
"0.60923094",
"0.60903275",
"0.60628504",
"0.6050693"... | 0.72200066 | 0 |
Known issue: If someone is rejected due to OOO, and then becomes not OOO, the selection will change on next spin | def spin_for_person(people, random:, timezone_experiment: false)
shuffled_people = people.shuffle(random: random)
if timezone_experiment
shuffled_people.find(&method(:valid_person_with_timezone?))
else
shuffled_people.find(&method(:valid_person?))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selected?; end",
"def selected?; end",
"def update_choice_skip\n return false\n end",
"def selected; end",
"def selected?; false; end",
"def selected?; false; end",
"def block_selection\n end",
"def select_intended\n select intended\n end",
"def select_intended\n sel... | [
"0.6400002",
"0.6400002",
"0.62920207",
"0.6281187",
"0.6274759",
"0.6274759",
"0.62531716",
"0.6136902",
"0.6136902",
"0.5920886",
"0.5836316",
"0.57968146",
"0.57968146",
"0.5709897",
"0.56621194",
"0.5632834",
"0.5626988",
"0.56177545",
"0.5609951",
"0.5603794",
"0.5598783... | 0.0 | -1 |
Creates and returns an ActivityStream::Stream for the predefined list of actors. | def activity_stream(name = :default)
ActivityStream::Stream.new(name, self, self.class.defined_streams[name])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activity_stream(name, opts = {})\n self.defined_streams ||= {}\n self.defined_streams[name.to_sym] = opts\n return nil\n end",
"def list_activity_stream_activity_stream(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ]\n\n #... | [
"0.6270302",
"0.6257098",
"0.6024177",
"0.5962973",
"0.5793608",
"0.5656123",
"0.56545293",
"0.56537366",
"0.5602304",
"0.55605793",
"0.5522825",
"0.5517342",
"0.5510603",
"0.5502781",
"0.547307",
"0.54068285",
"0.52984416",
"0.52919483",
"0.52740616",
"0.5267648",
"0.5254185... | 0.7154565 | 0 |
Override this to change the default actors | def followed_actors
self.class.all.map{|actor| [actor.class, actor.id]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actors\n actor\n end",
"def set_actor(name, email='')\n @current_actor = Grit::Actor.new( name, email )\n config['user.name'] = name\n config['user.email'] = email\n end",
"def inactive_actor\n end",
"def default *args\n @actor.gate.default( [ :object ] + args )\... | [
"0.64100903",
"0.6056799",
"0.6046905",
"0.59766346",
"0.59488904",
"0.59255934",
"0.58607167",
"0.58005226",
"0.5756441",
"0.5737797",
"0.5737797",
"0.55915236",
"0.55571824",
"0.5546121",
"0.5542631",
"0.551304",
"0.5506528",
"0.5490028",
"0.548568",
"0.5470881",
"0.5460833... | 0.0 | -1 |
Creates an activity_stream instance method that fetches all recent activity | def activity_stream(name, opts = {})
self.defined_streams ||= {}
self.defined_streams[name.to_sym] = opts
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def foreach_recent_activity\n CollectionWrapper.new(current_group.activities.desc(:created_at).page(params[:activity_page]).... | [
"0.67206573",
"0.66986746",
"0.6682808",
"0.6671079",
"0.664751",
"0.662864",
"0.656364",
"0.6543051",
"0.64399755",
"0.64347315",
"0.6422891",
"0.6422891",
"0.64088154",
"0.63815373",
"0.63570356",
"0.6314499",
"0.6275422",
"0.62699366",
"0.6262129",
"0.61934376",
"0.6189794... | 0.5988413 | 35 |
Use callbacks to share common setup or constraints between actions. | def set_drill
@drill = Drill.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def drill_params
params.require(:drill).permit(:question, solutions_attributes: [:id, :solution, :_destroy])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Loads current classroom and its syllabus | def load_classroom_syllabus
@classroom = Coursewareable::Classroom.find_by_slug!(request.subdomain)
@syllabus = @classroom.syllabus
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_classroom_syllabus\n @classroom = Coursewareable::Classroom.find_by_slug!(request.subdomain)\n @syllabus = @classroom.syllabus || @classroom.build_syllabus\n end",
"def set_classroom\n @classroom = @promo.classrooms.friendly.find(params[:id])\n end",
"def set_classroom\n\t\t@class... | [
"0.7557765",
"0.5721954",
"0.57018006",
"0.5672652",
"0.5652418",
"0.5652418",
"0.5652418",
"0.5652418",
"0.5652418",
"0.5652418",
"0.5499453",
"0.54966336",
"0.54664594",
"0.5375077",
"0.5364697",
"0.5339447",
"0.5324423",
"0.52758414",
"0.52329725",
"0.51988167",
"0.5149349... | 0.7743116 | 0 |
returns the remainder and outputs a string in a sentence | def mod(a, b)
a % b
c = a % b
puts " the remainder of #{a} divided by #{b} is #{c}"
return c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_maker(my_sentence)\n result=my_sentence.shift\n my_sentence.each { |x| result= result + \" \" + x.to_s }\n result=result + \".\"\n result.capitalize!\n end",
"def sentence_maker(a_single_argument)\n items = a_single_argument.count.to_i\n output = a_single_argument.values_at(0..(items-1... | [
"0.6316842",
"0.62507033",
"0.62069154",
"0.6203146",
"0.61903656",
"0.61802405",
"0.61647016",
"0.61623573",
"0.6131478",
"0.612992",
"0.612992",
"0.612992",
"0.612992",
"0.612992",
"0.612992",
"0.612992",
"0.6129722",
"0.608091",
"0.60786366",
"0.6078548",
"0.60765755",
"... | 0.0 | -1 |
Builds an AnypresenceExtension client for accessing the platform api. Returns a client | def ap_client(*adhoc_api_version)
version = adhoc_api_version.empty? ? 'latest' : adhoc_api_version[0]
@ap_client ||= AnypresenceExtension::Client.new(@account.api_host, @account.api_token, @account.application_id, version)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n @client ||= platform_klass::Client.new(@options)\n end",
"def api_client\n @api_client ||= WildFly::ApiClient.new\n end",
"def client\n @admin ||= User.find_by(is_admin: true)\n @auth_record ||= @admin.auth_record\n @client ||= CiscoAmpApi::V1::Client.new(@auth_record.api_clie... | [
"0.60811645",
"0.5644674",
"0.5507301",
"0.5422503",
"0.54013014",
"0.53281796",
"0.5305077",
"0.52429575",
"0.52423286",
"0.52049893",
"0.5202438",
"0.51741564",
"0.51739705",
"0.51717806",
"0.5171303",
"0.5161475",
"0.51433486",
"0.51403975",
"0.5120636",
"0.51126784",
"0.5... | 0.7177163 | 0 |
Gets object definition metadata using API call. Returns the parsed json response. | def object_definition_metadata
version = @account.api_version.nil? ? 'latest' : @account.api_version
response = ap_client(version).metadata.fetch
Rails.logger.info "response: " + response.inspect
parsed_json = []
case response.status
when 200
begin
parsed_json = Ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_definition_metadata\n version = self.api_version.nil? ? 'latest' : self.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n ... | [
"0.8509099",
"0.66008234",
"0.6155347",
"0.6115726",
"0.6094057",
"0.6070318",
"0.5950142",
"0.5945012",
"0.59230804",
"0.5921887",
"0.5900864",
"0.5854123",
"0.57811743",
"0.576636",
"0.5760506",
"0.5741182",
"0.5722494",
"0.5721818",
"0.5700167",
"0.5679002",
"0.5668013",
... | 0.84883696 | 1 |
Gets object definition names for an application Returns an array of object names. | def object_definition_mappings
parsed_json = object_definition_metadata
object_names = []
parsed_json.each do |object_definition|
object_names << object_definition["name"].downcase
end
object_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_names\n result = []\n ole_obj.Models.each do |el|\n result << el.name\n end\n result\n end",
"def objects_name\n full_object_name.pluralize.to_sym\n end",
"def object_instances\n return [] if object_definition.blank?\n \n latest_version = ::AP::Voi... | [
"0.66400445",
"0.66153586",
"0.6349387",
"0.6339501",
"0.6215746",
"0.6196953",
"0.6184881",
"0.5958924",
"0.5908597",
"0.5896434",
"0.5859271",
"0.5843575",
"0.5841358",
"0.58402145",
"0.57964265",
"0.57762885",
"0.5738547",
"0.5712227",
"0.56970704",
"0.5695381",
"0.5643619... | 0.6317075 | 4 |
it could be a good idea to remove it here itself. | def delete_drb_worker(t_data)
worker_name = t_data[:worker]
worker_key = t_data[:worker_key]
worker_name_key = gen_worker_key(worker_name,worker_key)
begin
worker_instance = reactor.live_workers[worker_name_key]
Process.kill('TERM',worker_instance.pid)
rescue Packet::Discon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove; end",
"def remove; end",
"def remove; end",
"def remove; end",
"def remove!; end",
"def remove\n __flag__ :remove\n end",
"def remove(entry); end",
"def remove_item\n\n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def remove(typ... | [
"0.7775165",
"0.7775165",
"0.7775165",
"0.7775165",
"0.7615679",
"0.7135588",
"0.70408404",
"0.66676044",
"0.6596251",
"0.6566685",
"0.65413547",
"0.6396195",
"0.63676614",
"0.6364002",
"0.6324789",
"0.63221073",
"0.63160753",
"0.63160753",
"0.63160753",
"0.63160753",
"0.6297... | 0.0 | -1 |
this method can receive one shot status reports or proper results | def worker_receive p_data
send_object(p_data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_status_report\n\t\treport = {\n\t\t\tversion: Assemblage::VERSION,\n\t\t\tstatus: self.status,\n\t\t\tuptime: self.uptime\n\t\t}\n\n\t\tmessage = Assemblage::Protocol.encode( :status_report, report )\n\n\t\tself.send_message( message )\n\tend",
"def report\n if data[:ping].nil?\n @fails += 1... | [
"0.63861585",
"0.6167166",
"0.6130159",
"0.6102721",
"0.6102721",
"0.6102721",
"0.6102721",
"0.6102721",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.60710806",
"0.6069444",
"0.6052029",
"0.6033785",
"0.600... | 0.0 | -1 |
Must include module to use it | def initialize(author, tweet)
@author = author
@tweet = tweet
@words = @tweet.split
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def included_modules() end",
"def included_modules; end",
"def included(mod); end",
"def include; end",
"def include; end",
"def included; end",
"def modules; end",
"def modules; end",
"def modules; end",
"def included_modules\n end",
"def conscientious_require; end",
"def library; end",
"... | [
"0.7652065",
"0.74035764",
"0.73591703",
"0.7191752",
"0.7191752",
"0.7169479",
"0.7112233",
"0.7112233",
"0.7112233",
"0.7064919",
"0.6828295",
"0.677449",
"0.677449",
"0.6745579",
"0.6657417",
"0.6627178",
"0.65889347",
"0.6542073",
"0.64590985",
"0.6444438",
"0.6400745",
... | 0.0 | -1 |
Codec used for the MP3 encoding This method returns the codec used by FFMPEG for the encoding (inside 'converter worker' task). Usage : object.codec | def codec
"-acodec libmp3lame -y"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def codec_name\n @av_stream[:codec][:codec_name]\n end",
"def audio_codec\n p self[:audio_codec], self[:audio_channels]\n @audio_codec ||= begin\n\n codec = case self[:audio_codec]\n when \"ac3\", \"aac\", \"mp3\", \"dca\"\n self[:audio_codec].upcase\n when \"eac3\"\n ... | [
"0.73105884",
"0.7222457",
"0.7164185",
"0.6789782",
"0.6775509",
"0.6644338",
"0.6442099",
"0.63621956",
"0.6238602",
"0.6186974",
"0.5979782",
"0.5885284",
"0.58740026",
"0.58340925",
"0.5558986",
"0.5493367",
"0.5465037",
"0.54512006",
"0.5436487",
"0.53835875",
"0.5382535... | 0.68416905 | 3 |
Crude bubble sort. Still not done, it makes unnecessary comparisons even after the array is sorted. Sean...fix this so that it stops once it is sorted. | def bubble_sort(numbers)
swap_count = 0
compare_count = 0
for i in 0..(numbers.length - 2)
for j in 0..(numbers.length-2-i)
compare_count += 1
# Swap numbers if the second number is greater than the first
if numbers[j] > numbers[j+1]
temp = numbers[j+1]
numbers[j+1] = numbers[j]
numbe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bubble_sort!(array)\n loop do\n sorted = true\n array.each_index do |index|\n if (array[index] <=> array[index + 1]) == 1\n array[index], array[index + 1] = array[index + 1], array[index]\n sorted = false\n end\n end\n break if sorted\n end\n array\nend",
"def bubble_so... | [
"0.7923804",
"0.7889633",
"0.7877704",
"0.78162223",
"0.7804148",
"0.7784673",
"0.7783532",
"0.7782487",
"0.77753896",
"0.7774239",
"0.7773399",
"0.7764864",
"0.77614456",
"0.7758115",
"0.7754065",
"0.7749639",
"0.7748845",
"0.7747376",
"0.7739385",
"0.7733007",
"0.77314806",... | 0.0 | -1 |
Sean........ fill this in with your algorithm. | def sean_sort(numbers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alg; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def anchored; end",
"def schubert; end",
"def schumann; ... | [
"0.7034088",
"0.6736691",
"0.6736691",
"0.6736691",
"0.6736691",
"0.6736691",
"0.67226094",
"0.67226094",
"0.67226094",
"0.67226094",
"0.627898",
"0.6226855",
"0.61466706",
"0.60027444",
"0.5985029",
"0.5914197",
"0.58875877",
"0.58875877",
"0.5868097",
"0.5807542",
"0.577533... | 0.0 | -1 |
Updates the passed record with hash data and stores primary key value into inventory_object. | def update_record!(record, hash, inventory_object)
record.assign_attributes(hash.except(:id))
if !inventory_collection.check_changed? || record.changed?
record.save
inventory_collection.store_updated_records(record)
end
inventory_object.id = record.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_record!(hash, inventory_object)\n record = inventory_collection.model_class.create!(hash.except(:id))\n inventory_collection.store_created_records(record)\n\n inventory_object.id = record.id\n end",
"def update_item(hash, item, qty)\n hash[ item ] = qty\nend",
"def updat... | [
"0.720747",
"0.6288065",
"0.6263576",
"0.622741",
"0.621084",
"0.6203327",
"0.6190279",
"0.61890733",
"0.61559397",
"0.61520666",
"0.61520666",
"0.61234635",
"0.61234635",
"0.6103938",
"0.60856366",
"0.6074222",
"0.60686743",
"0.60337806",
"0.6024785",
"0.6011106",
"0.5955761... | 0.8356912 | 0 |
Creates a new record in the DB using the passed hash data | def create_record!(hash, inventory_object)
record = inventory_collection.model_class.create!(hash.except(:id))
inventory_collection.store_created_records(record)
inventory_object.id = record.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(record_hash = {})\n record = new(record_hash)\n record.save\n end",
"def create!( hash )\n doc = new( hash )\n doc.save!\n end",
"def create(hash={})\n model = self.new(hash)\n model.save\n model\n end",
"def insert(id, hash)\n ... | [
"0.78161335",
"0.7456849",
"0.7336369",
"0.7112011",
"0.6651309",
"0.65438116",
"0.6523173",
"0.65026325",
"0.6493413",
"0.6470086",
"0.64549893",
"0.64533025",
"0.6435233",
"0.6375854",
"0.637207",
"0.63348067",
"0.6326716",
"0.6304827",
"0.6256752",
"0.6210215",
"0.62043923... | 0.71557474 | 3 |
Asserts we do not have duplicate records in the DB. If the record is duplicate we will destroy it. | def assert_unique_record(record, index)
# TODO(lsmola) can go away once we indexed our DB with unique indexes
if unique_db_indexes.include?(index) # Include on Set is O(1)
# We have a duplicate in the DB, destroy it. A find_each method does automatically .order(:id => :asc)
# so we a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_previously_invalid_records\n return unless InvalidRecord.table_exists?\n\n InvalidRecord.find_each(batch_size: Checker.batch_size) do |invalid_record|\n begin\n invalid_record.destroy if invalid_record.record.valid?\n rescue\n # Record does not exists.\n ... | [
"0.6767531",
"0.65753615",
"0.65296763",
"0.64595675",
"0.63721347",
"0.63438725",
"0.6219663",
"0.61639035",
"0.6157909",
"0.6109605",
"0.61081713",
"0.6076487",
"0.605795",
"0.604765",
"0.60423",
"0.60342723",
"0.60337645",
"0.6026721",
"0.5982492",
"0.596777",
"0.5947412",... | 0.76477855 | 0 |
GET /tickets/1 GET /tickets/1.json | def show
@ticket = Ticket.find(params[:id])
@reply = @ticket.replies.build
@scope = params[:scope]
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ticket }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def sho... | [
"0.79847324",
"0.7594627",
"0.74892443",
"0.73788136",
"0.73378736",
"0.73228",
"0.72324663",
"0.72324663",
"0.72324663",
"0.72324663",
"0.72324663",
"0.72324663",
"0.7211615",
"0.7164726",
"0.71515995",
"0.7104107",
"0.69843507",
"0.697633",
"0.69247264",
"0.6924492",
"0.689... | 0.0 | -1 |
PUT /tickets/1 PUT /tickets/1.json | def update
@ticket = Ticket.find(params[:id])
changes = ""
new_employee = params[:ticket][:employee_id].nil? || params[:ticket][:employee_id].empty? ? nil : Employee.find(params[:ticket][:employee_id])
unless new_employee == @ticket.employee
changes += "> Responsible changed from #{@ticket.employee ? @tic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @ticket.update_attributes(params[:ticket])\n\n respond_with(@story, @ticket)\n end",
"def update\n @ticket = @event.tickets.find(params[:id])\n r... | [
"0.7889341",
"0.69945663",
"0.6989293",
"0.6935721",
"0.6854655",
"0.6851879",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68403566",
"0.68029016",
"0.6772724",
"0.67701954",
"0.6749982",
"0.6736265",
"0.6736265",
"0.67348725",
"0.6734714",
"0.6734714",
"0.6734... | 0.0 | -1 |
Service calls Creates a user. | def create_user request_pb, options:, &block
request_json = JSON.parse ::Google::Showcase::V1beta1::CreateUserRequest.encode_json(request_pb)
uri = "/v1beta1/users"
body = request_pb.to_json
result_json = @client_stub.make_post_request(
uri: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n user = User.create!(user_params) # will raise an error if creation fails\n # call the authentication service\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token}\n json_response(response, :created)\n... | [
"0.8139052",
"0.80319023",
"0.7997257",
"0.79860485",
"0.7977386",
"0.794009",
"0.794009",
"0.794009",
"0.791384",
"0.79128456",
"0.7889471",
"0.78837204",
"0.7849755",
"0.78484946",
"0.7835469",
"0.77915215",
"0.77557635",
"0.7721298",
"0.77199894",
"0.77125573",
"0.7704347"... | 0.0 | -1 |
Retrieves the User with the given uri. | def get_user request_pb, options:, &block
request_json = JSON.parse ::Google::Showcase::V1beta1::GetUserRequest.encode_json(request_pb)
uri = "/v1beta1/#{request_pb.name}"
result_json = @client_stub.make_get_request(
uri: uri,
options: opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user(uri = nil, data = nil)\n\n # Return the user from the cache if available\n user = self.users[uri]\n return user if user\n\n # Get user from the JSON API and add to the cache\n #json = self.api.call(\"users/#{id_from_uri(uri)}\")\n #if json\n ... | [
"0.79577976",
"0.7375396",
"0.6746397",
"0.6728563",
"0.6668182",
"0.6614413",
"0.65746695",
"0.6540819",
"0.6508691",
"0.64798754",
"0.643963",
"0.6433776",
"0.6423629",
"0.6419832",
"0.6419609",
"0.64095324",
"0.63893515",
"0.6387508",
"0.6380789",
"0.6379927",
"0.6365813",... | 0.0 | -1 |
Deletes a user, their profile, and all of their authored messages. | def delete_user request_pb, options:, &block
request_json = JSON.parse ::Google::Showcase::V1beta1::DeleteUserRequest.encode_json(request_pb)
uri = "/v1beta1/#{request_pb.name}"
result_json = @client_stub.make_delete_request(
uri: uri,
opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\t\tsms_user_alert(\"User deleted: \")\n\t\t@user.destroy\n\t\tsession[:user_id] = nil\n\t\tredirect_to root_path, :notice => \"Profile deleted\"\n\tend",
"def delete_user\n client.delete(user)\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n recor... | [
"0.73634815",
"0.70380336",
"0.6896427",
"0.6845948",
"0.68009895",
"0.6788497",
"0.678572",
"0.6783087",
"0.6782123",
"0.6776512",
"0.6753447",
"0.6746103",
"0.6741311",
"0.6716674",
"0.6715166",
"0.67089367",
"0.66930693",
"0.6659159",
"0.66489613",
"0.6648446",
"0.6627198"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.