query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
POST /webs POST /webs.json | def create
@web = Web.new(web_params)
respond_to do |format|
if @web.save
format.html { redirect_to @web, notice: 'Web was successfully created.' }
format.json { render :show, status: :created, location: @web }
else
format.html { render :new }
format.json { render js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"def create\n @webtoon = Webtoon.new(webtoon_params)\n\n respond_to do |format|\n if @webtoon.save\n format.html { redirect_to @webtoon, notice: 'We... | [
"0.63210946",
"0.5958433",
"0.5936645",
"0.5894691",
"0.5861048",
"0.58557266",
"0.58455706",
"0.5697086",
"0.5642276",
"0.5636574",
"0.5621937",
"0.55018014",
"0.54857093",
"0.5477344",
"0.5440458",
"0.5398539",
"0.5395116",
"0.5392223",
"0.538897",
"0.53792363",
"0.5373494"... | 0.6659848 | 0 |
DELETE /webs/1 DELETE /webs/1.json | def destroy
@web.destroy
respond_to do |format|
format.html { redirect_to webs_url, notice: 'Web was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @web = Web.find(params[:id])\n @web.destroy\n\n respond_to do |format|\n format.html { redirect_to webs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @web_app = WebApp.find(params[:id])\n @web_app.destroy\n\n respond_to do |format|\n form... | [
"0.76778334",
"0.713998",
"0.7040803",
"0.7021795",
"0.6971132",
"0.69428355",
"0.69316286",
"0.69179",
"0.68594915",
"0.68535453",
"0.68518025",
"0.6830644",
"0.681978",
"0.6812523",
"0.68051267",
"0.6794138",
"0.6793108",
"0.6793108",
"0.6793108",
"0.6793108",
"0.67692804",... | 0.7401935 | 1 |
Provides operations to manage the defaultManagedAppProtections property of the microsoft.graph.deviceAppManagement entity. | def default_managed_app_protections()
return MicrosoftGraph::DeviceAppManagement::DefaultManagedAppProtections::DefaultManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_managed_app_protections=(value)\n @default_managed_app_protections = value\n end",
"def default_managed_app_protections\n return @default_managed_app_protections\n end",
"def ios_managed_app_protections()\n return MicrosoftGraph::De... | [
"0.77753145",
"0.72597766",
"0.6829432",
"0.6721182",
"0.64629275",
"0.6291577",
"0.6066823",
"0.6062792",
"0.5831713",
"0.5815131",
"0.57798344",
"0.5612159",
"0.55968827",
"0.5468354",
"0.545257",
"0.541068",
"0.5343736",
"0.5313879",
"0.53048956",
"0.52950567",
"0.52796584... | 0.8005835 | 0 |
Provides operations to manage the iosManagedAppProtections property of the microsoft.graph.deviceAppManagement entity. | def ios_managed_app_protections()
return MicrosoftGraph::DeviceAppManagement::IosManagedAppProtections::IosManagedAppProtectionsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ios_managed_app_protections=(value)\n @ios_managed_app_protections = value\n end",
"def ios_managed_app_protections\n return @ios_managed_app_protections\n end",
"def default_managed_app_protections()\n return MicrosoftGraph::DeviceAppManag... | [
"0.7477903",
"0.69932246",
"0.6872003",
"0.6630619",
"0.64953953",
"0.6470286",
"0.6329817",
"0.6088134",
"0.6011512",
"0.5970006",
"0.5940825",
"0.57495624",
"0.5685943",
"0.5636086",
"0.56063616",
"0.5560754",
"0.5548923",
"0.55247676",
"0.55194473",
"0.5437535",
"0.5385764... | 0.78540516 | 0 |
Provides operations to manage the managedAppPolicies property of the microsoft.graph.deviceAppManagement entity. | def managed_app_policies()
return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def managed_app_policies=(value)\n @managed_app_policies = value\n end",
"def app_management_policies=(value)\n @app_management_policies = value\n end",
"def managed_app_policies\n return @managed_app_policies\n end",
"def managed_... | [
"0.75470936",
"0.69188136",
"0.6849626",
"0.658735",
"0.63462585",
"0.5977279",
"0.5651906",
"0.5556686",
"0.5510073",
"0.54415226",
"0.5242824",
"0.52209496",
"0.51883256",
"0.51432425",
"0.51116073",
"0.50694996",
"0.50259125",
"0.5020367",
"0.4961551",
"0.49563906",
"0.494... | 0.77995986 | 0 |
Provides operations to manage the managedAppRegistrations property of the microsoft.graph.deviceAppManagement entity. | def managed_app_registrations()
return MicrosoftGraph::DeviceAppManagement::ManagedAppRegistrations::ManagedAppRegistrationsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def managed_app_registrations=(value)\n @managed_app_registrations = value\n end",
"def managed_app_registrations\n return @managed_app_registrations\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def device_app... | [
"0.72985137",
"0.67457193",
"0.6265421",
"0.6120318",
"0.5852492",
"0.5804979",
"0.57139933",
"0.55794626",
"0.5397568",
"0.5307091",
"0.5282389",
"0.5274645",
"0.5209892",
"0.5108425",
"0.50594586",
"0.50440323",
"0.49683988",
"0.49683988",
"0.49335074",
"0.4924272",
"0.4843... | 0.7485382 | 0 |
Provides operations to manage the managedAppStatuses property of the microsoft.graph.deviceAppManagement entity. | def managed_app_statuses()
return MicrosoftGraph::DeviceAppManagement::ManagedAppStatuses::ManagedAppStatusesRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def managed_app_statuses=(value)\n @managed_app_statuses = value\n end",
"def managed_app_statuses\n return @managed_app_statuses\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_apps\n ... | [
"0.79606086",
"0.72728515",
"0.63220656",
"0.56817997",
"0.5501011",
"0.5481292",
"0.5354721",
"0.5318809",
"0.52537566",
"0.5229585",
"0.5186789",
"0.51442635",
"0.5122658",
"0.51043147",
"0.50992763",
"0.50816673",
"0.5009185",
"0.49941427",
"0.4993908",
"0.49923635",
"0.49... | 0.7845098 | 1 |
Provides operations to manage the managedEBooks property of the microsoft.graph.deviceAppManagement entity. | def managed_e_books()
return MicrosoftGraph::DeviceAppManagement::ManagedEBooks::ManagedEBooksRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def managed_e_books=(value)\n @managed_e_books = value\n end",
"def managed_apps=(value)\n @managed_apps = value\n end",
"def managed_devices=(value)\n @managed_devices = value\n end",
"def managed_e_books\n return @... | [
"0.6486972",
"0.6339535",
"0.6086713",
"0.59717584",
"0.57540375",
"0.5637973",
"0.5522624",
"0.54124457",
"0.53652656",
"0.5345044",
"0.5313149",
"0.5286193",
"0.526265",
"0.522382",
"0.51898265",
"0.5176836",
"0.51441675",
"0.5120621",
"0.5119191",
"0.51069444",
"0.5078245"... | 0.69566834 | 0 |
Provides operations to manage the mdmWindowsInformationProtectionPolicies property of the microsoft.graph.deviceAppManagement entity. | def mdm_windows_information_protection_policies()
return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mdm_windows_information_protection_policies=(value)\n @mdm_windows_information_protection_policies = value\n end",
"def windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProt... | [
"0.7528585",
"0.71643025",
"0.71293247",
"0.6655285",
"0.62881017",
"0.61900556",
"0.6021546",
"0.59574395",
"0.5909645",
"0.5811215",
"0.5615959",
"0.5498525",
"0.5464466",
"0.5408088",
"0.5201753",
"0.51493996",
"0.5114892",
"0.49813446",
"0.4949016",
"0.4862762",
"0.485927... | 0.7908284 | 0 |
Provides operations to manage the mobileAppCategories property of the microsoft.graph.deviceAppManagement entity. | def mobile_app_categories()
return MicrosoftGraph::DeviceAppManagement::MobileAppCategories::MobileAppCategoriesRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mobile_app_categories=(value)\n @mobile_app_categories = value\n end",
"def mobile_app_categories\n return @mobile_app_categories\n end",
"def mx_l7_application_categories\r\n MXL7ApplicationCategoriesController.instance\r\n end",
"def device_ca... | [
"0.7375698",
"0.6684424",
"0.58831906",
"0.5819288",
"0.5618737",
"0.5590688",
"0.5517008",
"0.5508222",
"0.53401375",
"0.53401375",
"0.53374296",
"0.51919377",
"0.5146399",
"0.5146399",
"0.5131816",
"0.5037006",
"0.50210446",
"0.5013232",
"0.49747172",
"0.49650228",
"0.49510... | 0.74035686 | 0 |
Provides operations to manage the mobileAppConfigurations property of the microsoft.graph.deviceAppManagement entity. | def mobile_app_configurations()
return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mobile_app_configurations=(value)\n @mobile_app_configurations = value\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameter... | [
"0.6725974",
"0.63592434",
"0.6272889",
"0.627158",
"0.6231614",
"0.62301904",
"0.613656",
"0.5974369",
"0.57873327",
"0.56845045",
"0.56845045",
"0.5633411",
"0.5614081",
"0.5583626",
"0.5522805",
"0.55174464",
"0.54779404",
"0.5474169",
"0.54059184",
"0.5382686",
"0.5354790... | 0.71362567 | 0 |
Provides operations to manage the mobileApps property of the microsoft.graph.deviceAppManagement entity. | def mobile_apps()
return MicrosoftGraph::DeviceAppManagement::MobileApps::MobileAppsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mobile_apps=(value)\n @mobile_apps = value\n end",
"def device_app_management()\n return MicrosoftGraph::DeviceAppManagement::DeviceAppManagementRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_mobile_app\n @mobile_app = MobileApp.find... | [
"0.72200453",
"0.68944633",
"0.6520375",
"0.6520375",
"0.64326906",
"0.6157296",
"0.60891485",
"0.5919858",
"0.5884511",
"0.57775664",
"0.5759725",
"0.57033116",
"0.5698578",
"0.5651597",
"0.564872",
"0.5612222",
"0.55787176",
"0.5562505",
"0.5546961",
"0.552165",
"0.5484573"... | 0.7214287 | 1 |
Provides operations to call the syncMicrosoftStoreForBusinessApps method. | def sync_microsoft_store_for_business_apps()
return MicrosoftGraph::DeviceAppManagement::SyncMicrosoftStoreForBusinessApps::SyncMicrosoftStoreForBusinessAppsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def i_cloud_block_managed_apps_sync\n return @i_cloud_block_managed_apps_sync\n end",
"def sync\n Logger.d(\"Sync invoked for ContactsSync\")\n find_all_contacts_with_email { |emails|\n Logger.d(\"Going to sync #{emails.length} contacts\")\n # Save the contacts on the se... | [
"0.5747459",
"0.5391222",
"0.53708833",
"0.53315777",
"0.5279871",
"0.52146894",
"0.5201553",
"0.51331216",
"0.5074301",
"0.5056382",
"0.4947139",
"0.4921181",
"0.49015215",
"0.4881808",
"0.48788768",
"0.48672387",
"0.48614055",
"0.4861185",
"0.4819095",
"0.4816582",
"0.48079... | 0.82963526 | 0 |
Provides operations to manage the targetedManagedAppConfigurations property of the microsoft.graph.deviceAppManagement entity. | def targeted_managed_app_configurations()
return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end",
"def targeted_managed_app_configurations\n return @targeted_managed_app_configurations\n end",
"def managed_apps=(value)\n @managed_apps = va... | [
"0.7347386",
"0.66561866",
"0.6338508",
"0.6231292",
"0.5843936",
"0.57476366",
"0.5617837",
"0.5516933",
"0.54802245",
"0.545087",
"0.5377525",
"0.5345815",
"0.5259468",
"0.5168223",
"0.51356244",
"0.49590248",
"0.4925007",
"0.49247476",
"0.4818033",
"0.4807955",
"0.4793031"... | 0.7684352 | 0 |
Provides operations to manage the vppTokens property of the microsoft.graph.deviceAppManagement entity. | def vpp_tokens()
return MicrosoftGraph::DeviceAppManagement::VppTokens::VppTokensRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpp_tokens=(value)\n @vpp_tokens = value\n end",
"def vpp_tokens\n return @vpp_tokens\n end",
"def managed_app_policies()\n return MicrosoftGraph::DeviceAppManagement::ManagedAppPolicies::ManagedAppPoliciesRequestBuilder.new(@path_parameter... | [
"0.58985525",
"0.5865783",
"0.53844005",
"0.51103204",
"0.5009265",
"0.48977032",
"0.48176557",
"0.4722188",
"0.46599543",
"0.4658059",
"0.45846778",
"0.4567695",
"0.45508134",
"0.4543258",
"0.45325553",
"0.45120335",
"0.45057854",
"0.4498486",
"0.44790214",
"0.445957",
"0.44... | 0.6854494 | 0 |
Provides operations to manage the windowsInformationProtectionPolicies property of the microsoft.graph.deviceAppManagement entity. | def windows_information_protection_policies()
return MicrosoftGraph::DeviceAppManagement::WindowsInformationProtectionPolicies::WindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mdm_windows_information_protection_policies()\n return MicrosoftGraph::DeviceAppManagement::MdmWindowsInformationProtectionPolicies::MdmWindowsInformationProtectionPoliciesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def windows_information_protection_policies=(va... | [
"0.741853",
"0.7280711",
"0.7244826",
"0.68403834",
"0.6824301",
"0.62857646",
"0.6271584",
"0.6042058",
"0.59910494",
"0.5934107",
"0.58292943",
"0.5700528",
"0.5619593",
"0.5529103",
"0.53095096",
"0.5308677",
"0.52143645",
"0.5134495",
"0.5103885",
"0.48595434",
"0.4809522... | 0.7787505 | 0 |
Create custom method_missing method If the called method is not explicitly defined then it tries to find the method definition in the QUERYlike patterns. And if the method is there it builds a request based on the pattern definition. | def method_missing(method_name, *args, &block)
begin
invoke_query_api_pattern_method(method_name, *args, &block)
rescue PatternNotFoundError
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end",
"def method_missing(method_name, *args)\n req(method_name.to_s)\n end",
"def method_missing(method, *args, &block)\n self.class.class_eval do\n attr_accessor method.t... | [
"0.68908876",
"0.6640613",
"0.6578027",
"0.6505683",
"0.6474533",
"0.63532174",
"0.63520944",
"0.63334846",
"0.6246511",
"0.62444043",
"0.62444043",
"0.6210736",
"0.6193969",
"0.6192093",
"0.6170323",
"0.6157224",
"0.61466014",
"0.6145581",
"0.61400056",
"0.61383915",
"0.6127... | 0.7029882 | 0 |
Computes single Query API pattern parameter | def compute_query_api_pattern_param(query_api_method_name, source, params_with_defaults, used_query_params) # :nodoc:
case
when source.is_a?(Hash) then compute_query_api_pattern_hash_data(query_api_method_name, source, params_with_defaults, used_query_params)
when source.is_a?(Array) th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_query_api_pattern_params(query_api_method_name, container, used_query_params)\n container[:params] = compute_query_api_pattern_param(query_api_method_name, container[:params], container[:params_with_defaults], used_query_params)\n end",
"def compute_query_api_pattern_based_params(que... | [
"0.68365395",
"0.64351565",
"0.62785095",
"0.62463754",
"0.61687696",
"0.6143873",
"0.6143873",
"0.6137482",
"0.6137482",
"0.6137482",
"0.61180097",
"0.6101446",
"0.6075014",
"0.60418373",
"0.60298634",
"0.59711194",
"0.59711194",
"0.5954473",
"0.5954473",
"0.59298915",
"0.58... | 0.7036557 | 0 |
1. sets all joinable join_requests as member/participant 2. ensure user_id has a join_request for joinable 3. sets user_id as the organizer/creator for joinable 4. create a chat_message to let people know about this new organizer/creator | def to user_id, message
return yield false, USER_NOT_FOUND unless user = User.find(user_id)
return yield false, INVALID_JOINABLE unless joinable_is_valid?
owner_join_request = JoinRequest.where(joinable: @joinable, user_id: user_id, role: member_type).first_or_create
ApplicationRecord.transact... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join!(user)\n # It loads up all the user because in the case where the chat is saved but the chat_participations have not been saved,\n # this is the only way to ensure we don't have duplicates.\n return if self.chat_participations.map(&:user_id).include?(user.id)\n self.chat_participations.create!... | [
"0.668035",
"0.61500156",
"0.60958534",
"0.5935227",
"0.586472",
"0.586472",
"0.5839209",
"0.5829119",
"0.582883",
"0.5818461",
"0.5803809",
"0.57498085",
"0.5695783",
"0.5689204",
"0.5628463",
"0.5624066",
"0.5599365",
"0.5590072",
"0.5586949",
"0.55716646",
"0.5555593",
"... | 0.6975022 | 0 |
Read and transform a template using a map of keyvalue pairs template must refer to a relative filename (without extension ".st") that uses the syntax: $var$ (StringTemplate lib for Java) | def process_template(template_name,map)
template = File.dirname(__FILE__) + "/../templates/#{template_name}.st"
map['timestamp']=Time.now.httpdate
File.open(template,'r') do | f |
# detect words inside dollar sign pairs
replaced = f.read.gsub(/(\$\w*\$)/) do | match |
key = mat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_replace template, myhash\n #tmpltext=File::read(template);\n\n t = template.dup\n t.gsub!( /##(.*?)##/ ) {\n #raise \"Key '#{$1}' found in template but the value has not been set\" unless ( myhash.has_key?( $1 ) )\n myhash[ $1 ].to_s\n }\n t\n end",
"def template(file, temp... | [
"0.7095161",
"0.6911082",
"0.6651287",
"0.64512587",
"0.6411285",
"0.640328",
"0.6368353",
"0.6345529",
"0.6284182",
"0.62681",
"0.61360824",
"0.61357534",
"0.6080982",
"0.6074778",
"0.60469043",
"0.6046569",
"0.60050505",
"0.599368",
"0.5984869",
"0.5967799",
"0.59600604",
... | 0.7969874 | 0 |
def Lookup the Ruby class refered to by a model name | def to_class(model_name)
Kernel.const_get(model_name.to_s.camelize)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def class_from_name\n if model_name.to_s.include? \"_\"\n ns, *klass = model_name.to_s.split(\"_\").collect(&:camelize)\n begin\n \"#{ns}::#{klass.join(\"\")}\".constantize\n rescue NameError\n \"#{ns}#{klass.join(\"\")}\".constantize\n end\n ... | [
"0.7741191",
"0.7725917",
"0.77190685",
"0.7625627",
"0.7589509",
"0.7567288",
"0.7484071",
"0.74534875",
"0.7410137",
"0.73734826",
"0.7340206",
"0.7282993",
"0.72777945",
"0.7259289",
"0.7258466",
"0.72416747",
"0.7139413",
"0.71297276",
"0.71297276",
"0.71224797",
"0.70982... | 0.7933407 | 0 |
Creates a new Config. The configuration is loaded from the file 'hiera.yaml' which is expected to be found in the given module_dir. | def initialize(module_dir, diagnostics)
@module_dir = module_dir
config_file = File.join(module_dir, 'hiera.yaml')
validator = ConfigChecker.new(diagnostics)
begin
data = YAML.load_file(config_file)
validator.validate(data, config_file)
unless diagnostics.errors?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options={})\n config = options[:config]\n if config.nil?\n # Look in codedir first, then confdir\n config = File.join(Util.code_dir, 'hiera.yaml')\n config = File.join(Util.config_dir, 'hiera.yaml') unless File.exist?(config)\n end\n @config = Config.load(config)\n\n Co... | [
"0.66142774",
"0.6323906",
"0.6308874",
"0.6004687",
"0.5995144",
"0.595492",
"0.5898234",
"0.5880586",
"0.5851178",
"0.58310044",
"0.5776565",
"0.5755142",
"0.572212",
"0.57084197",
"0.56564426",
"0.56489426",
"0.5616188",
"0.561147",
"0.56078607",
"0.559351",
"0.55861735",
... | 0.7328607 | 0 |
GET /tunning_diagrams GET /tunning_diagrams.json GET /tunning_diagrams.xml | def index
@tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @tunning_diagrams }
format.xml { render xml: @tunning_diagrams }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end",
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n e... | [
"0.64302707",
"0.6269652",
"0.5962418",
"0.56608623",
"0.55094826",
"0.54959035",
"0.5261463",
"0.52576977",
"0.5217472",
"0.5156205",
"0.5143938",
"0.51160264",
"0.5092586",
"0.50656277",
"0.5062149",
"0.5048742",
"0.49743572",
"0.49710086",
"0.4951045",
"0.49499214",
"0.494... | 0.7052123 | 0 |
GET /tunning_diagrams/1 GET /tunning_diagrams/1.json GET /tunning_diagrams/1.xml | def show
respond_to do |format|
format.html # show.html.erb
format.json { render json: @tunning_diagram }
format.xml { render xml: @tunning_diagram }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tunning_diagrams = TunningDiagram.accessible_by(current_ability).search(params[:search]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunning_diagrams }\n format.xml { render xml: @tunning_diagrams }\n end\n end",... | [
"0.7020619",
"0.63848007",
"0.6086284",
"0.6053616",
"0.5594579",
"0.54399014",
"0.5396608",
"0.5376734",
"0.5370773",
"0.53577954",
"0.53278077",
"0.5285031",
"0.52596384",
"0.52386945",
"0.52247274",
"0.5216956",
"0.5213363",
"0.51792276",
"0.51583666",
"0.5145195",
"0.5141... | 0.6766607 | 1 |
GET /tunning_diagrams/new GET /tunning_diagrams/new.json GET /tunning_diagrams/new.xml | def new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @tunning_diagram }
format.xml { render xml: @tunning_diagram }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @diagram = Diagram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @diagram }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { r... | [
"0.6363906",
"0.60876155",
"0.60338914",
"0.6027419",
"0.60028416",
"0.59563315",
"0.59469086",
"0.59221077",
"0.59199166",
"0.59083074",
"0.58987087",
"0.58923894",
"0.5888841",
"0.5875507",
"0.5871645",
"0.5839852",
"0.5836289",
"0.5830615",
"0.5829557",
"0.5827808",
"0.582... | 0.75504357 | 0 |
PUT /tunning_diagrams/1 PUT /tunning_diagrams/1.json PUT /tunning_diagrams/1.xml | def update
respond_to do |format|
if @tunning_diagram.update_attributes(params[:tunning_diagram])
format.html { redirect_to @tunning_diagram, notice: I18n.t('controllers.update_success', name: @tunning_diagram.class.model_name.human) }
format.json { head :no_content }
format.xml { hea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_tunning_diagram\n @tunning_diagram = TunningDiagram.accessible_by(current_ability).find(params[:id])\n end",
"def tunning_diagram_params\n params.require(:tunning_diagram).permit()\n end",
"def update\n @diagram = Diagram.find(params[:id])\n\n respond_to do |format|\n if @diagram.up... | [
"0.5468396",
"0.540846",
"0.5381618",
"0.5317307",
"0.52022266",
"0.50914097",
"0.5015315",
"0.49808025",
"0.49579468",
"0.4956918",
"0.4947348",
"0.4920314",
"0.48651648",
"0.48610976",
"0.48513702",
"0.482983",
"0.48271123",
"0.4812472",
"0.47715932",
"0.4768334",
"0.474988... | 0.6469807 | 0 |
DELETE /tunning_diagrams/1 DELETE /tunning_diagrams/1.json DELETE /tunning_diagrams/1.xml | def destroy
#@tunning_diagram = TunningDiagram.find(params[:id])
if @tunning_diagram.destroy && @tunning_diagram.destroy
respond_to do |format|
format.html { redirect_to tunning_diagrams_url, notice: I18n.t('controllers.destroy_success', name: @tunning_diagram.class.model_name.human) }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @diagramm = Diagramm.find(params[:id])\n @diagramm.destroy\n\n respond_to do |format... | [
"0.6749001",
"0.63204056",
"0.6253094",
"0.61594135",
"0.61372536",
"0.60985154",
"0.6084779",
"0.6075024",
"0.6073417",
"0.6040757",
"0.6013109",
"0.59900504",
"0.5987455",
"0.5973118",
"0.59715456",
"0.5968056",
"0.5964777",
"0.5962027",
"0.59588146",
"0.59562695",
"0.59466... | 0.68134 | 0 |
Roll dices for the current round and calculates score | def roll
@dice_set.clear
@dice_set.roll(@available_dices)
calculate_points
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n while @current_roll < @rolls.size - 1\n init_roll\n\n if strike?\n score_strike\n elsif spare?\n score_spare\n else\n score_roll\n end \n end\n \n return @total_score\n end",
"def score\n while @current_roll < @rolls.size - 1\n init_r... | [
"0.7530656",
"0.7526535",
"0.7526535",
"0.7419668",
"0.741699",
"0.7372666",
"0.7356575",
"0.7356575",
"0.7301996",
"0.7237499",
"0.72321147",
"0.7179739",
"0.7173664",
"0.71542454",
"0.7114859",
"0.7105003",
"0.7073966",
"0.7071923",
"0.7055875",
"0.70199597",
"0.699146",
... | 0.77730453 | 0 |
send notification in french to this address | def notify_french(dest)
mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tender_updated\n @greeting = \"Χαίρετε\"\n\n mail to: \"to@example.org\"\n end",
"def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end",
"def notify_shipped(order)\n @order = order\n @info = @order.info\n email = @order.user.email\n s... | [
"0.654578",
"0.65252733",
"0.64850813",
"0.6276096",
"0.62659794",
"0.6239277",
"0.6083753",
"0.6067907",
"0.5981108",
"0.5964361",
"0.59534293",
"0.59455216",
"0.5942909",
"0.5942316",
"0.59048444",
"0.5872955",
"0.58694094",
"0.58549124",
"0.5846537",
"0.5846181",
"0.58425"... | 0.6973913 | 0 |
send notification in english to this address | def notify_english(dest)
mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_french(dest)\n mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))\n end",
"def tender_updated\n @greeting = \"Χαίρετε\"\n\n mail to: \"to@example.org\"\n end",
"def admin_broadcast(desired_locale, emails_as_string, subject, body)\n ActionMailer::Base.smtp_settings = AP... | [
"0.64111954",
"0.6263988",
"0.62529945",
"0.62239",
"0.6223147",
"0.62105626",
"0.6192396",
"0.61874944",
"0.61850315",
"0.6183237",
"0.613429",
"0.6119588",
"0.6111077",
"0.6101984",
"0.6058111",
"0.6035919",
"0.6025501",
"0.6006228",
"0.5996783",
"0.5979157",
"0.5969079",
... | 0.7066022 | 0 |
Test that the correct sentence is chosen, given the input | def test_sentence_choice
assert_equal('This is a great test',
WordPlay.best_sentence(['This is a test',
'This is another test',
'This is a great test'],
%w{test great this}))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sentence_choice\n assert_equal('This is a great test', \n WordPlay.best_sentence(['This is a test',\n 'This is a great test'],\n %w{test great this}))\n assert_equal('This is a great test', WordPlay.best_... | [
"0.7755298",
"0.6958053",
"0.69062454",
"0.6733327",
"0.6602947",
"0.65434533",
"0.6469821",
"0.64494824",
"0.6417932",
"0.63412744",
"0.63381684",
"0.63208",
"0.6262111",
"0.6249105",
"0.6216082",
"0.621405",
"0.6162877",
"0.61574835",
"0.61547",
"0.6128183",
"0.61276066",
... | 0.7765891 | 0 |
Test that basic pronouns are switched by switch_pronouns | def test_basic_pronouns
assert_equal("i am a robot", WordPlay.switch_pronouns("you are a robot"))
assert_equal("you are a person", WordPlay.switch_pronouns("i am a person"))
assert_equal("i love you", WordPlay.switch_pronouns("you love me"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pronouns\n assert_equal('I am a robot', WordPlay.switch_pronouns('You are a robot'))\n assert_equal('You are a person', WordPlay.switch_pronouns('I am a person'))\n assert_equal('I love you', WordPlay.switch_pronouns('You love me'))\n assert_equal('You suck balls', WordPlay.switch_pronouns('I ... | [
"0.87323207",
"0.85730827",
"0.831533",
"0.82682353",
"0.6167959",
"0.5877165",
"0.5877165",
"0.5872348",
"0.5810333",
"0.56944364",
"0.56425726",
"0.56394184",
"0.5601467",
"0.55877566",
"0.5563721",
"0.55607045",
"0.5539707",
"0.552242",
"0.5400427",
"0.53895354",
"0.538016... | 0.8657003 | 1 |
Initializes the bot object, loads in the external YAML data file and sets the bot's name. Raises an exception if the data loading process fails. | def initialize(options)
@name = options[:name] || "Unnamed Bot"
begin
@data = YAML.load(File.open(options[:data_file]).read)
rescue
raise "Can't load bot data"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(options)\n\t\t@name = options[:name] || \"Unnamed Bot\" # name = name otherwise it is an Unnamed bot\n\t\tbegin\n\t\t\t@data = YAML.load(File.read(options[:data_file]))\n\t\trescue \n\t\t\traise \"Can't load bot data\"\n\t\tend\n\tend",
"def initialize(options)\n\t\t@name = options[:name] || \"Unn... | [
"0.771837",
"0.7648457",
"0.7572003",
"0.61225015",
"0.5986048",
"0.58580446",
"0.58363676",
"0.583599",
"0.5745516",
"0.57450503",
"0.57012063",
"0.55806094",
"0.55806094",
"0.55789787",
"0.5577239",
"0.55616033",
"0.55525935",
"0.55413663",
"0.5503913",
"0.5503913",
"0.5502... | 0.7728877 | 0 |
Chooses a random response phrase from the :responses hash and substitutes metadata into the phrase | def random_response(key)
random_index = rand(@data[:responses][key].length)
@data[:responses][key][random_index].gsub(/\[name\]/, @name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_response(key)\n\t\trandom_index = rand(@data[:responses][key].length)\n\t\t@data[:responses][key][random_index].gsub(/\\[name\\]/,@name)\n\tend",
"def response_to(input)\n prepared_input = preprocess(input.downcase)\n sentence = best_sentence(prepared_input)\n reversed_sentence = WordPlay.swi... | [
"0.72853094",
"0.6784648",
"0.6619443",
"0.6593563",
"0.6586191",
"0.6484881",
"0.63402075",
"0.6267631",
"0.6192105",
"0.6165832",
"0.60533893",
"0.60341126",
"0.590889",
"0.58956814",
"0.5831062",
"0.57584804",
"0.5692721",
"0.5670045",
"0.5644329",
"0.56239384",
"0.5616981... | 0.73591137 | 0 |
Substitutes words and phrases on supplied input as dictated by the bot's :presubs data | def perform_substitutions(input)
@data[:presubs].each { |s| input.gsub!(s[0], s[1]) }
input
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translator\n # Greet your user in the language of their people.\n puts [\"SUP KID? \",\n \t \"What didja say? \",\n \t \"How ya doan? \",\n \t \"How ahrya?\",\n \t \"How 'bout them Sox? \",\n \t \"How 'bout them Pats? \"].sample\n\n # Get their response and lop off the carriage return, Massachusetts Le... | [
"0.68777394",
"0.67341346",
"0.67172587",
"0.6672194",
"0.6643442",
"0.6517552",
"0.6492399",
"0.6474987",
"0.6468659",
"0.64544314",
"0.64428633",
"0.64399314",
"0.6407532",
"0.63612056",
"0.6349674",
"0.63430846",
"0.6334027",
"0.6243357",
"0.62378657",
"0.6188131",
"0.6142... | 0.7240941 | 0 |
Using the single word keys from :responses, we search for the sentence that uses the most of them, as it's likely to be the 'best' sentence to parse | def best_sentence(input)
hot_words = @data[:responses].keys.select do |k|
k.class == String && k =~ /^\w+$/
end
WordPlay.best_sentence(input.sentences, hot_words)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_responses(sentence)\n responses = []\n\n # Find all patterns to try to match against\n @data[:responses].keys.each do |pattern|\n next unless pattern.is_a?(String)\n\n # For each pattern, see if the supplied sentence contains\n # a match. Remove substitution symbols (*) before checking.\... | [
"0.7121943",
"0.67639285",
"0.6570952",
"0.62986463",
"0.6152937",
"0.612665",
"0.60802275",
"0.6064807",
"0.6060163",
"0.60441655",
"0.6015933",
"0.5998066",
"0.59933066",
"0.59491307",
"0.5948895",
"0.5944669",
"0.59445024",
"0.59289426",
"0.59289426",
"0.5908157",
"0.58794... | 0.71103525 | 1 |
Using a supplied sentence, go through the bot's :responses data set and collect together all phrases that could be used as responses | def possible_responses(sentence)
responses = []
# Find all patterns to try to match against
@data[:responses].keys.each do |pattern|
next unless pattern.is_a?(String)
# For each pattern, see if the supplied sentence contains
# a match. Remove substitution symbols (*) before checking.
# Push al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phrases\n response[\"phrases\"]\n end",
"def response_to(input)\n\t\tprepared_input = preprocess(input).downcase # Taking the input, processing and prepare it\n\t\tsentence = best_sentence(prepared_input) # Finding the best sentence to use based on input\n\t\tresponses = possible_responses(senten... | [
"0.6112034",
"0.6044615",
"0.60339415",
"0.59371984",
"0.5903337",
"0.5884288",
"0.5847992",
"0.57185256",
"0.5692795",
"0.5614652",
"0.55741954",
"0.55661863",
"0.55509245",
"0.55509245",
"0.5526807",
"0.5525261",
"0.550257",
"0.54948574",
"0.54942715",
"0.54906434",
"0.5456... | 0.8276681 | 0 |
total number of hosts available for the specified zone. It is the same value as provided in the XQueryCount header in the list_hosts API method ==== Returns response: body 'count' 'status' 200 indicates success | def count_hosts( zone_id)
request(
:expects => 200,
:method => 'GET',
:parser => Fog::Parsers::Zerigo::DNS::CountHosts.new,
:path => "/api/1.1/zones/#{zone_id}/hosts/count.xml"
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_host_templates\n get(\"zone_templates/#{id}/host_templates/count.xml\").body['count'].to_i\n end",
"def count(zone_id, version_id)\n call('domain.zone.record.count', zone_id, version_id)\n end",
"def zone_available_ip_count(zone_name, plan = nil)\n parameters = \"zone=#... | [
"0.7250891",
"0.68440694",
"0.6837091",
"0.6783943",
"0.6515743",
"0.6267639",
"0.6122488",
"0.5923488",
"0.585694",
"0.5724265",
"0.57075244",
"0.5673514",
"0.56047374",
"0.5581793",
"0.5523989",
"0.54913",
"0.54732513",
"0.54730624",
"0.54643935",
"0.5456252",
"0.54331946",... | 0.8165326 | 0 |
ScrapsController > show_scrap_topic : Render scrap topic to browser | def show_scrap_topic
render_404 and return if @scrap_topic.nil?
@scraps = @scrap_topic.scraps if @scrap_topic
flash[:notice] = 'This topic is empty, please add some scraps.'[:msg_empty_topic_add_scraps] if @scraps.length == 0
respond_to do |format|
format.html { render :action => 'scrap_topic' an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_inline_scrap_topic\n respond_to do |format|\n format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }\n format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => \"scrap\", :layout => false and return }\n format.xml { return }\n ... | [
"0.7173283",
"0.6974418",
"0.6898802",
"0.6822776",
"0.67724544",
"0.6731785",
"0.66351664",
"0.66268706",
"0.660618",
"0.6552798",
"0.6542236",
"0.6542236",
"0.6542236",
"0.6542236",
"0.65344536",
"0.65113366",
"0.6502551",
"0.64953625",
"0.64294374",
"0.6399049",
"0.6371876... | 0.7615448 | 0 |
ScrapsController > new_scrap_topic : Render new scrap topic form to browser | def new_scrap_topic
@scrap_topic = ScrapTopic.new
respond_to do |format|
format.html { return }
format.js { render :action => 'new_scrap_topic', :layout => false and return }
format.xml { return }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_topic\n click_link 'Add Topic' \n within 'form' do\n fill_in( 'Title', with: 'Shoes' )\n fill_in( 'Description', with: 'Shoes of desire' )\n click_button 'save' \n end\n end",
"def new\n @topic = Topic.new\n\n respond_to do |format|\n format.html # new.html.erb\n e... | [
"0.6986612",
"0.69399065",
"0.68541425",
"0.68117905",
"0.6781969",
"0.6774142",
"0.6752361",
"0.66998386",
"0.66387737",
"0.6631269",
"0.6629747",
"0.6596712",
"0.65840435",
"0.655308",
"0.653429",
"0.6531935",
"0.6494144",
"0.6494144",
"0.6494144",
"0.6494144",
"0.6494144",... | 0.783379 | 0 |
ScrapsController > create_scrap_topic : Create new scrap topic and render to browser | def create_scrap_topic
@scrap_topic = ScrapTopic.new
@scrap_topic.title = params[:scrap_topic][:title].strip
@scrap_topic.user_id = current_user.id
begin
ScrapTopic.transaction do
tag = Tag.find_or_create_by_name(params[:scrap_topic][:title].strip)
@scrap_topic.save!
respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_scrap_topic\n @scrap_topic = ScrapTopic.new\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'new_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n end",
"def create\n return if cancelled?\n begin\n if params[:... | [
"0.77216476",
"0.7318679",
"0.72042066",
"0.7189846",
"0.7126289",
"0.7122961",
"0.7110386",
"0.7031366",
"0.7031366",
"0.7017458",
"0.7017458",
"0.70102733",
"0.7008804",
"0.6986532",
"0.6983561",
"0.6973378",
"0.696002",
"0.69316626",
"0.6923276",
"0.6884412",
"0.68751824",... | 0.7519294 | 1 |
ScrapsController > edit_scrap_topic : Render edict scrap topic form to browser | def edit_scrap_topic
if can_modify_scrap_topic?
respond_to do |format|
format.html { return }
format.js { render :action => 'edit_scrap_topic', :layout => false and return }
format.xml { return }
end
else
render_401 and return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n frm.button(:value=>\"Edit\").click\n AddEditAnnouncements.new(@browser)\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def edit\n # return an HTML form for editing ... | [
"0.6503634",
"0.6389094",
"0.6389094",
"0.6387619",
"0.6355652",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"0.62464166",
"... | 0.69367373 | 0 |
ScrapsController > update_scrap_topic : Update scrap topic and render to browser NOT IMPLEMENTED! | def update_scrap_topic
# Not allowed for now
render_401 and return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit_scrap_topic\n if can_modify_scrap_topic?\n respond_to do |format|\n format.html { return }\n format.js { render :action => 'edit_scrap_topic', :layout => false and return }\n format.xml { return }\n end\n else\n render_401 and return\n end\n end",
"def updat... | [
"0.6591119",
"0.64784265",
"0.6426784",
"0.63999075",
"0.6395567",
"0.6357706",
"0.6332408",
"0.63239807",
"0.63239354",
"0.6258436",
"0.6236693",
"0.62352145",
"0.62208545",
"0.6215314",
"0.6213119",
"0.6212678",
"0.6205931",
"0.6199405",
"0.6181844",
"0.6180103",
"0.6145935... | 0.7629243 | 0 |
ScrapsController > show : Render scrap to browser, right now only used by ParallelText scraps | def show
render_404 and return if @scrap.nil?
respond_to do |format|
format.html { redirect_to show_scrap_path(@scrap.slug) and return }
format.js { render :action => "scrap", :layout => false and return }
format.xml { return }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrap\n target_url = CGI.unescape(params[:target_url])\n css_selector = CGI.unescape(params[:css_selector])\n @element_id = params[:ele_id]\n\n @scrapped_text = QuickScrapper.scrap(target_url, css_selector)\n first_word_index = params[:first_word_index] || 0\n last_word_index = params[:last_w... | [
"0.67932236",
"0.66783774",
"0.6636916",
"0.6622841",
"0.65262365",
"0.65173715",
"0.6498611",
"0.64275295",
"0.63732743",
"0.63636744",
"0.6354494",
"0.63435",
"0.6343397",
"0.63291085",
"0.6305021",
"0.63038",
"0.62529355",
"0.6230974",
"0.6214712",
"0.6199106",
"0.6199106"... | 0.6803512 | 0 |
ScrapsController > display_inline_scrap : Renders the current scrap or scrap topic to the browser | def display_inline_scrap_topic
respond_to do |format|
format.html { redirect_to scrap_topic_path(@scrap.scrap_topic.slug) and return }
format.js { @scraps = @scrap_topic.scraps if @scraps.nil?; render :partial => "scrap", :layout => false and return }
format.xml { return }
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrap\n target_url = CGI.unescape(params[:target_url])\n css_selector = CGI.unescape(params[:css_selector])\n @element_id = params[:ele_id]\n\n @scrapped_text = QuickScrapper.scrap(target_url, css_selector)\n first_word_index = params[:first_word_index] || 0\n last_word_index = params[:last_w... | [
"0.61379623",
"0.59060216",
"0.5880602",
"0.57654727",
"0.5665489",
"0.5661925",
"0.5659657",
"0.56046224",
"0.55786324",
"0.5577934",
"0.5569858",
"0.556565",
"0.5555811",
"0.55445313",
"0.55406237",
"0.5535658",
"0.55289745",
"0.552309",
"0.5522136",
"0.552085",
"0.5519992"... | 0.7434202 | 0 |
(scrap_topic) init_scrap_topic : Creates a scrap topic based on the new slug | def init_scrap_topic(title, user_id)
@scrap_topic = ScrapTopic.find_or_create_by_title(:title => title, :user_id => user_id, :parent_id => 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_topic\n if params[:id].nil?\n @topic = Topic.find_by(:permalink => params[:permalink])\n else\n @topic = Topic.find(params[:id])\n end\n end",
"def initialize(topic,prepend=\"\")\n @wiki ||= Wikipedia.find(prepend + topic)\n end",
"def create_topic!\n fora.pos... | [
"0.65486634",
"0.6187992",
"0.61843497",
"0.602363",
"0.6020988",
"0.6015673",
"0.5903364",
"0.59011114",
"0.58880544",
"0.58880544",
"0.5865893",
"0.5862448",
"0.5818125",
"0.58098865",
"0.57671744",
"0.56731987",
"0.56700873",
"0.56687266",
"0.56652015",
"0.5644188",
"0.561... | 0.7712068 | 0 |
(true) autoload_scrap_data : Loads scrap / scrap_topic data into request scope | def autoload_scrap_data
#
# Get ScrapTopic identifier from the querystring
if params[:scrap_topic_title]
scrap_topic_title = params[:scrap_topic_title]
elsif params[:scrap_topic_id]
if params[:scrap_topic_id].class == Array
scrap_topic_id = params[:scrap_topic_id][0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_data\n subclass_must_define\n end",
"def eager_load; end",
"def eager_load; end",
"def eager_load; end",
"def load_data\n # @categories = Category.find(:all)\n # @infoitems = Expert.find(:all)\n end",
"def load_feed\n \n @url_data_params ||= {}\n response = Fello... | [
"0.56630254",
"0.55869997",
"0.55869997",
"0.55869997",
"0.5576264",
"0.5533455",
"0.5526879",
"0.5526879",
"0.5526879",
"0.5526879",
"0.5438506",
"0.53440136",
"0.53169787",
"0.53122896",
"0.5303988",
"0.52137566",
"0.52052563",
"0.52052563",
"0.52052563",
"0.51941466",
"0.5... | 0.79650456 | 0 |
(boolean) can_modify_scrap_topic? : Return true if current user can modify the scrap | def can_modify_scrap_topic?
return (admin? or @scrap_topic.scraps.length == 0 or (logged_in? and @scrap_topic.user_id == current_user.id))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorized_to_modify_task?\n current_user.site_admin? || can_view_all_manuscript_managers_for_journal? || can_view_manuscript_manager_for_paper? ||\n allowed_manuscript_information_task? || metadata_task_collaborator? || allowed_reviewer_task? || task_participant?\n end",
"def reseller_allow_edit(perm... | [
"0.686958",
"0.66173726",
"0.6583648",
"0.6569846",
"0.6475908",
"0.6414751",
"0.6406812",
"0.6400748",
"0.63820064",
"0.6372664",
"0.6336224",
"0.63320404",
"0.63004464",
"0.6294726",
"0.62846977",
"0.62694776",
"0.6267185",
"0.62453514",
"0.6241524",
"0.62254846",
"0.622548... | 0.86594677 | 0 |
(boolean) scrap_user_logged_in? : Renders "tiddler status msg" or "tiddler msg" if not logged in | def scrap_user_logged_in?(error_in_empty_tiddler = false)
if !logged_in?
message = '<h3>'+'Please login first'[:error_login_first] + '</h3>'
respond_to do |format|
format.html { flash[:error] = message and render :action => 'create', :status => :unauthorized and return false }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_logged_in\n service_response = success\n render_api_response(service_response)\n end",
"def check_status\n if @current_user.blank?\n render :text => {\"continue\" => false}.to_json\n return\n end\n \n render :text => @current_user.real_time_notifications.to_json\n end",
... | [
"0.60554606",
"0.60521966",
"0.6011723",
"0.5927316",
"0.59044623",
"0.5818589",
"0.5803148",
"0.57557356",
"0.5747598",
"0.57026184",
"0.5696085",
"0.56866974",
"0.5606351",
"0.5597603",
"0.5585642",
"0.55816674",
"0.5581013",
"0.5577791",
"0.55694044",
"0.556765",
"0.555456... | 0.7296878 | 0 |
Run a command using 'artisan' ==== Parameters +command+ :: command to run | def artisan(command, options = {})
raise LaravelNotFoundError unless laravel_exists_in_directory?(@path)
php = `which php`.strip
raise RequiredLibraryMissingError, "php" unless php
command = "#{php} #{@path}/artisan #{command}"
output = `#{command}`
puts output unless options[:quiet]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_command(command)\n `#{command}`\nend",
"def execute(command)\n system(command)\n end",
"def execute_command(command)\n system(command)\n end",
"def run(command)\n @commands_to_run << command\n end",
"def rake(command, options = {})\n execute_command :rake, comman... | [
"0.70448864",
"0.69320637",
"0.68787193",
"0.67727023",
"0.67011297",
"0.6612411",
"0.65893614",
"0.6586468",
"0.6586468",
"0.6576517",
"0.65408194",
"0.6538971",
"0.6479874",
"0.64602405",
"0.645924",
"0.64582384",
"0.64582384",
"0.64547336",
"0.64460385",
"0.64445966",
"0.6... | 0.76547575 | 0 |
Return the path to the local cache directory for a given Source ==== Return +string+ :: Filepath to the local cache directory | def cache_directory
File.join(CacheFolder, make_md5(@source))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_path\n src = if %i(direct repo).include?(new_resource.source)\n package_metadata[:url]\n else\n new_resource.source.to_s\n end\n ::File.join(Chef::Config[:file_cache_path], ::File.basename(src))\n end",
"def cache_... | [
"0.7425864",
"0.6830605",
"0.6805839",
"0.6785696",
"0.6771832",
"0.67435277",
"0.6725107",
"0.6725107",
"0.67212343",
"0.67212343",
"0.67077017",
"0.6700639",
"0.6649551",
"0.6648104",
"0.66367656",
"0.6622296",
"0.6547174",
"0.6541506",
"0.6541182",
"0.65391",
"0.6508492",
... | 0.7448737 | 0 |
Check whether the app directory is empty? This is useful to know if we are trying to create the new application in an empty directory or not, so that we may know if we need to create this application forcefully? ==== Return +boolean+ :: True, if the app directory is an empty one. | def create_in_empty_directory?
is_empty_directory?(@path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n Dir.empty?(path)\n end",
"def empty_directory?\n directory? && Dir.entries(to_s).reject { |entry| entry == '.' || entry == '..' }.empty?\n end",
"def empty?( dir_path )\n connection.nlst( dir_path ).empty?\n end",
"def is_empty_directory?(dir = nil)\n dir ||= Dir.pwd... | [
"0.7720633",
"0.73840463",
"0.7190939",
"0.7189074",
"0.71495414",
"0.6966294",
"0.67965746",
"0.67876965",
"0.6669369",
"0.6601089",
"0.65078175",
"0.64743793",
"0.64563066",
"0.6444204",
"0.6403268",
"0.6388249",
"0.63646597",
"0.6342541",
"0.63320583",
"0.63096166",
"0.629... | 0.7992309 | 0 |
Check whether the specified source is a local directory or a URL? ==== Return +boolean+ :: True, if the source is a local directory. | def source_is_local?
File.directory?(@source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_file_source_a_remote_url?\n !self.remote_url.blank?\n end",
"def local_valid_repo?\n @local_dir_path.directory?\n end",
"def local_dir_exists?(full_path)\n File.directory?(full_path)\nend",
"def local?\n @uri.scheme == 'file'\n end",
"def is_local_path(path)\n (path =~ /^.:(\\/|\\\... | [
"0.71893734",
"0.70237935",
"0.6998091",
"0.697964",
"0.6873225",
"0.68724835",
"0.6759035",
"0.6664996",
"0.6627768",
"0.6596963",
"0.653044",
"0.6491668",
"0.64716196",
"0.63899654",
"0.6377403",
"0.6345643",
"0.63219124",
"0.6296141",
"0.6288866",
"0.62444174",
"0.62131816... | 0.8530504 | 0 |
Return the path to a tasks file by its name ==== Parameters +name+ :: string name of the tasks file ==== Return +string+ :: path to the tasks file | def tasks_file(name)
File.expand_path(File.join(@path, %w[ application tasks ], name))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name\n \"#{task_name}.rake\"\n end",
"def path_with_task_name(task_name)\n \"#{path}:#{task_name}\"\n end",
"def file_path\n File.join 'lib', 'woro_tasks', file_name\n end",
"def find_task(name)\n name = name.to_sym unless name.nil?\n @tasks[name]\n end",
"def ... | [
"0.7656034",
"0.7329245",
"0.71107155",
"0.6982276",
"0.6861047",
"0.6798232",
"0.65880334",
"0.64466214",
"0.64102185",
"0.63920736",
"0.6363892",
"0.628988",
"0.62888545",
"0.6229122",
"0.6141346",
"0.6029299",
"0.5956704",
"0.59522754",
"0.5868086",
"0.5866187",
"0.5860112... | 0.8417948 | 0 |
check if laravel framework exists in the current application's directory currently, this is performed by looking for the presence of 'artisan' file and the 'laravel' subdirectory. ==== Return +boolean+ :: true, if laravel framework exists | def has_laravel?
laravel_exists_in_directory?(@path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def laravel_exists_in_directory?(directory = nil, relative_to = nil)\n return false unless directory\n directory = File.expand_path(directory, relative_to)\n return false unless File.exists? File.join(directory, \"artisan\")\n return false unless File.directory? File.join(directory, \"laravel\"... | [
"0.7489911",
"0.6882119",
"0.66582793",
"0.6546062",
"0.6417397",
"0.6417397",
"0.6262782",
"0.6239475",
"0.6209952",
"0.61106825",
"0.61106825",
"0.60987264",
"0.6097039",
"0.60789406",
"0.60486525",
"0.6011561",
"0.60081226",
"0.59987277",
"0.59533024",
"0.5925606",
"0.5905... | 0.81347567 | 0 |
check if the cache exists for the source specified by the current application's directory this further makes sure that the cache really has laravel framework as we would expect it to ==== Return +boolean+ :: true, if the cache exists | def has_cache?
laravel_exists_in_directory?(@cache)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_exist?\n File.exist?(@cache_file)\n end",
"def cache_exists?\n File.exist?(cached_file)\n end",
"def cached?\n cache_path.exist?\n end",
"def exists?(path)\n return unless @cache_base\n\n File.exists?(@cache_base + path)\n end",
"def cached?\n cache_path.exis... | [
"0.8005785",
"0.7997671",
"0.76418144",
"0.76353294",
"0.7589856",
"0.74197555",
"0.7374245",
"0.71036744",
"0.70137954",
"0.6914038",
"0.6910787",
"0.6860674",
"0.68509674",
"0.6792968",
"0.67497194",
"0.66971934",
"0.6676467",
"0.6583283",
"0.65780044",
"0.6535317",
"0.6515... | 0.8678215 | 0 |
Depending on whether the 'force' parameter is provided, this method removes all the files in the directory specified by the application path, if the directory exists. Further, if the directory doesn't exist, it tries to create the directory specified by the application path. | def apply_force
show_info "Creating application forcefully!" if @options[:force]
FileUtils.rm_rf("#{@path}/.", :secure => true) if File.exists?(@path) and @options[:force]
FileUtils.mkdir_p @path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end",
"def destroy\n delete_fi... | [
"0.66909933",
"0.648186",
"0.64702094",
"0.6443755",
"0.6360182",
"0.6353173",
"0.6324998",
"0.625953",
"0.6253838",
"0.6253676",
"0.62265384",
"0.6222619",
"0.6222619",
"0.62038606",
"0.6202752",
"0.61912227",
"0.61766917",
"0.6137194",
"0.6097808",
"0.6086241",
"0.60836846"... | 0.70723313 | 0 |
This method downloads or updates the local cache for the current source. If the source is a directory on this machine, it will simply not do anything since that can interfere with an offline installation, and the user must update the source manually in this case. Otherwise, it uses git to update or download the source ... | def download_or_update_local_cache
# we have nothing to download if the source is a local directory
return if source_is_local?
# we need git for this purpose
raise RequiredLibraryMissingError, "git" if `which git`.empty?
# create the cache, and download or update as required
FileUti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_local(new_dest, fetch_if_missing = true)\n if !File.exists? @repo.cache_path\n if fetch_if_missing\n fetch\n else\n raise \"Source cache #{@repo.cache_path} not readable.\"\n end\n end\n FileUtils.cp_r @repo.cache_path, new_dest\n end",
"def after_source_download\... | [
"0.74836445",
"0.689803",
"0.6890024",
"0.6844942",
"0.67704976",
"0.6727353",
"0.66981936",
"0.66831",
"0.6519328",
"0.64912283",
"0.64382005",
"0.6381833",
"0.6327686",
"0.6295119",
"0.62374246",
"0.617224",
"0.61714286",
"0.61714286",
"0.6169956",
"0.61563486",
"0.6114985"... | 0.8832719 | 0 |
This method copies the files from the local cache to the directory of the application. | def copy_over_cache_files
FileUtils.cp_r "#{@cache}/.", @path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_cache\n @copy_cache ||= configuration[:copy_cache] == true ?\n File.join(Dir.tmpdir, configuration[:application]) :\n configuration[:copy_cache]\n end",
"def copy_cache\n @copy_cache ||= configuration[:copy_cache] == true ?\n File.join(Dir.tmpdir... | [
"0.7012994",
"0.7012419",
"0.64852726",
"0.6473215",
"0.6467962",
"0.6375926",
"0.63359153",
"0.6267059",
"0.62501717",
"0.62361443",
"0.6204939",
"0.6188377",
"0.6160009",
"0.61597955",
"0.613772",
"0.613772",
"0.61052877",
"0.60990757",
"0.60870713",
"0.60385495",
"0.600242... | 0.7810412 | 0 |
This method updates the permissions on the storage/ directory inside the newly created application. This method does not have a separate exposed call from the CLI. This can be skipped by passing 'noperms' flag for the 'new' command. | def update_permissions_on_storage
if @options[:perms]
response = system("chmod -R o+w #{File.join(@path, 'storage')}")
if response
say_success "Updated permissions on storage/ directory."
else
say_failed "Could not update permissions on storage/ directory."
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_permissions\n @permissions.each do |key|\n next if Lockdown::System.permission_assigned_automatically?(key)\n str = Lockdown.get_string(key)\n p = ::Permission.find(:first, :conditions => [\"name = ?\", str])\n unless p\n Lockdown.logger.info \">... | [
"0.5805985",
"0.5756673",
"0.57172704",
"0.5640863",
"0.54232675",
"0.53868926",
"0.53581667",
"0.5310384",
"0.52916706",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
"0.52620053",
... | 0.7075284 | 0 |
Once, we are done with the intallation, and an error occurs, this method handles the clean_up routine by removing the application directory we created, as well as the local cache for the source, that may exist. Keeping the local cache does not make sense, since we anyways can not create applications based on these 'cor... | def clean_up
FileUtils.rm_rf "#{@path}" unless create_in_current_directory?
FileUtils.rm_rf "#{@cache}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n tmpdir = File.join(OBS_BUILD_DIR,OBS_LOCAL_TMP)\n if File.exists?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end",
"def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might hav... | [
"0.6883739",
"0.6783197",
"0.6661202",
"0.6596878",
"0.6569509",
"0.6569509",
"0.65541524",
"0.6499908",
"0.6496716",
"0.64849186",
"0.6408572",
"0.6372577",
"0.6368637",
"0.63353187",
"0.63040847",
"0.62705773",
"0.62540424",
"0.6242853",
"0.62291646",
"0.62134784",
"0.61960... | 0.7219504 | 0 |
takes an array and splits it into left (less than) and right (greater than) by moving in from both sides, swapping values as positions move towards the midpoint | def partition_array(array, pivot)
left_i = 0
right_i = (last_i = array.length - 1)
# haven't crossed/met yet...
while left_i < right_i
while array[left_i] <= pivot && left_i < last_i
left_i += 1
end
while array[right_i] >= pivot && right_i > 0
right... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halve array\n middle = (array.size / 2.0).round - 1\n left = array[0..middle]\n right = array[(middle+1)..(array.last)]\n [left,right]\nend",
"def halve array\n middle = (array.length / 2.0).round\n left = [0..middle]\n right = [middle..(array.last)]\n [left,right]\nend",
"def partition_array(array... | [
"0.67236334",
"0.6612655",
"0.6607327",
"0.65570325",
"0.65525836",
"0.65409666",
"0.6538006",
"0.6522212",
"0.64546245",
"0.6434378",
"0.64074564",
"0.638098",
"0.6380611",
"0.6379941",
"0.63777274",
"0.6377023",
"0.63633555",
"0.6322366",
"0.6304697",
"0.6297341",
"0.628591... | 0.66755337 | 1 |
/Domain/EmailForward/Remove The command is intended to remove an existing Email Forwarding rule. Returned data: STATUS=SUCCESS or FAILURE TRANSACTID=Transaction ID Example return data: transactid=5c6690939950db9fad0a667eef0ebd8e status=SUCCESS | def remove_email_forward(source)
validate_list([["Source", source, :email] ])
options = { "Source" => source }
connection = Connection.new
connection.post("Domain/EmailForward/Remove", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_rule!(objectID, forward_to_replicas = false, request_options = {})\n res = delete_rule(objectID, forward_to_replicas, request_options)\n wait_task(res['taskID'], WAIT_TASK_DEFAULT_TIME_BEFORE_RETRY, request_options)\n return res\n end",
"def delete_rcpt( email )\n RESPONSE[\... | [
"0.62917656",
"0.6098368",
"0.5955882",
"0.5932887",
"0.5835132",
"0.57444125",
"0.57317466",
"0.57110476",
"0.5705981",
"0.5676933",
"0.56649",
"0.5634626",
"0.5616452",
"0.56115717",
"0.56015515",
"0.5593104",
"0.55889994",
"0.5573354",
"0.5528151",
"0.5524846",
"0.5507042"... | 0.66377723 | 0 |
/Domain/EmailForward/Update The command is intended to add a new Email Forwarding rule. Returned data: STATUS=SUCCESS or FAILURE TRANSACTID=Transaction ID Example return data: transactid=5c6690939950db9fad0a667eef0ebd8e status=SUCCESS | def update_email_forward(source, destination)
validate_list([["Source", source, :email],
["Destination", destination, :email]
])
options = {
"Source" => source,
"Destination" => destination
}
connection = Connection.new
connection.post("Domain/EmailForward/U... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateAnsweringRuleOnRoutingExt(client, accountId, extensionId, answeringRuleId, forwardingNumberId)\n body = {\n 'enabled' => true,\n 'forwarding' => {\n 'notifyMySoftPhones' => true,\n 'softPhonesRingCount' => 5,\n 'ringingMode' => 'Sequentially',\n 'rules': [{\n 'index': 1,... | [
"0.6653373",
"0.6351729",
"0.6191149",
"0.6186863",
"0.6149999",
"0.59082484",
"0.5866592",
"0.5849404",
"0.57930136",
"0.57204133",
"0.5687966",
"0.56239426",
"0.5602864",
"0.5567944",
"0.5561976",
"0.5529223",
"0.54956514",
"0.5493252",
"0.5486213",
"0.54797596",
"0.5466662... | 0.71392584 | 0 |
/Domain/EmailForward/List The command is intended to retrieve the list of email forwarding rules for a domain. Returned data: STATUS=SUCCESS or FAILURE RULE_[x]_SOURCE = the source for the rule [x] where [x] is a number starting with 1 and incrementing for each rule RULE_[x]_DESTINATION = the destination for rule [x] E... | def list_email_forwards(domain, range_from_optional, range_to_optional)
validate_list([ ["Domain", domain, :domain_format] ])
options = { "Domain" => domain }
optional_fields = [ ["rangeFrom", range_from_optional], ["rangeTo", range_to_optional] ]
options = set_optional_fields(optional_fields, o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_forwarding_rules(opts = {})\n data, _status_code, _headers = list_forwarding_rules_with_http_info(opts)\n return data\n end",
"def list_forwarding_rules_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ForwardingRuleApi... | [
"0.6648423",
"0.59676236",
"0.56102943",
"0.5593586",
"0.54867613",
"0.5458402",
"0.52998596",
"0.5162054",
"0.5085621",
"0.5046843",
"0.49879074",
"0.4986631",
"0.49463314",
"0.49278456",
"0.49263114",
"0.48895684",
"0.48881832",
"0.487571",
"0.48212102",
"0.4819853",
"0.481... | 0.7180608 | 0 |
Returns a collection of usersowners of apps for selection on challenge create or edit each User should be valid, i.e. to have an Org, otherwise skipped | def app_owners_for_select
User.real.map { |u| [u.select_text, u.id] if u.org }.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approvable_users\n @approvable_users ||= (controllable_users + editable_request_applicants + controllable_users.map{|uu|uu.editable_request_applicants}).flatten.uniq\n end",
"def unassigned_approvers_for_contract(contract)\n\n # todo: shouldnt have to use select here... theres a better way\n user_i... | [
"0.68761355",
"0.6455158",
"0.6327592",
"0.6300272",
"0.6257901",
"0.60782826",
"0.6037363",
"0.6017995",
"0.5982276",
"0.59057945",
"0.5870208",
"0.5833938",
"0.58004457",
"0.57840556",
"0.5711231",
"0.57083935",
"0.570725",
"0.57026416",
"0.5691462",
"0.56893307",
"0.567089... | 0.7603173 | 0 |
GET /metric_sources GET /metric_sources.json | def index
@metric_sources = MetricSource.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_sources\n src.collect{|v| v['source']}\n end",
"def v1_measurement_sources_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v1_measurement_sources_get ...\"\n end\n # resource path\n local_var_... | [
"0.66277605",
"0.6445829",
"0.6391722",
"0.6261962",
"0.62494874",
"0.62383044",
"0.6093816",
"0.60848826",
"0.60661703",
"0.60651433",
"0.6038971",
"0.6007916",
"0.5851436",
"0.58012366",
"0.57615757",
"0.5693575",
"0.5676205",
"0.5592717",
"0.55799645",
"0.55794305",
"0.556... | 0.7550348 | 0 |
POST /metric_sources POST /metric_sources.json | def create
@metric_source = MetricSource.new(metric_source_params)
respond_to do |format|
if @metric_source.save
format.html { redirect_to @metric_source, notice: 'Metric source was successfully created.' }
format.json { render :show, status: :created, location: @metric_source }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @metric_sources = MetricSource.all\n end",
"def metric_source_params\n params.require(:metric_source).permit(:host, :port, :database)\n end",
"def v1_measurement_sources_post(body, opts = {})\n v1_measurement_sources_post_with_http_info(body, opts)\n return nil\n end",
"d... | [
"0.6303889",
"0.6221403",
"0.5960758",
"0.583662",
"0.58281815",
"0.58133495",
"0.572284",
"0.5559883",
"0.554318",
"0.53869396",
"0.5359682",
"0.53440577",
"0.53251487",
"0.52945566",
"0.5258054",
"0.52345407",
"0.52301395",
"0.5214242",
"0.5211699",
"0.51959276",
"0.5182485... | 0.709647 | 0 |
PATCH/PUT /metric_sources/1 PATCH/PUT /metric_sources/1.json | def update
respond_to do |format|
if @metric_source.update(metric_source_params)
format.html { redirect_to @metric_source, notice: 'Metric source was successfully updated.' }
format.json { render :show, status: :ok, location: @metric_source }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_metric_source\n @metric_source = MetricSource.find(params[:id])\n end",
"def update\n source = Source.find_by(id: params[:source_id])\n unless source_params[:name] == source.name\n render json: {error: 'You cannot change external api for a source, you must delete that source if you wis... | [
"0.6190008",
"0.61090916",
"0.5785837",
"0.5718648",
"0.5637591",
"0.56240416",
"0.5618999",
"0.5611183",
"0.5611183",
"0.55883193",
"0.55845875",
"0.5579154",
"0.5569169",
"0.5560742",
"0.5555492",
"0.55501014",
"0.55487114",
"0.55292803",
"0.55226487",
"0.5513215",
"0.54824... | 0.7165161 | 0 |
DELETE /metric_sources/1 DELETE /metric_sources/1.json | def destroy
@metric_source.destroy
respond_to do |format|
format.html { redirect_to metric_sources_url, notice: 'Metric source was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @source = Source.find(params[:id])\n @source.destroy\n\n respond_to do |format|\n format.html { redirect_to report_sources_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content... | [
"0.66007483",
"0.65632063",
"0.6531628",
"0.6472765",
"0.6459897",
"0.6456585",
"0.6456585",
"0.6414121",
"0.6391749",
"0.6391665",
"0.6391665",
"0.6309538",
"0.62866175",
"0.62614095",
"0.62511986",
"0.6240843",
"0.6223965",
"0.6222224",
"0.6214232",
"0.62033653",
"0.6199345... | 0.77900636 | 0 |
Marshals the _request_object_ to a JSON string using request_objectto_h | def marshal(request_object)
JSON.pretty_generate(request_object.to_h)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_json(*_args)\n @request.to_json\n end",
"def to_json(*_args)\n @request.to_json\n end",
"def encode(object)\n object.to_json\n end",
"def json\n Oj.to_json(@req)\n end",
"def to_json\n request.clone.to_json\n end",
"def toJSON(object)\n\t\tre... | [
"0.69770724",
"0.69770724",
"0.6881005",
"0.6627694",
"0.6525249",
"0.6495019",
"0.64930177",
"0.64788723",
"0.6333703",
"0.63162804",
"0.6252275",
"0.6227398",
"0.6222578",
"0.61889935",
"0.6159585",
"0.6138563",
"0.6137749",
"0.6137749",
"0.6108434",
"0.6108434",
"0.6097783... | 0.8793168 | 0 |
Unmarshals a JSON string into an object of type _klass_ using klass.new_from_hash | def unmarshal(json_string, klass)
if json_string.nil?
return nil
elsif json_string.length == 0
return ''
end
if klass.respond_to?(:new_from_hash)
klass.new_from_hash(JSON.load(json_string))
else
raise NotImplementedError
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json(json:, klass:)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass)\n end",
"def from_json(json:, klass:, use_alias: false)\n hash = JSON.load(json)\n from_hash(hash: hash, klass: klass, use_alias: use_alias)\n end",
"def from_json(json)\n new JSON.par... | [
"0.7809021",
"0.7148607",
"0.70119697",
"0.695165",
"0.6752648",
"0.65935934",
"0.6579648",
"0.638095",
"0.63557273",
"0.6327854",
"0.63100433",
"0.6272995",
"0.6204618",
"0.620255",
"0.6185165",
"0.61575234",
"0.6112106",
"0.6112106",
"0.6105587",
"0.6105587",
"0.60926837",
... | 0.8070366 | 0 |
isMe(str) Passed a string, and returns the string as a pastel with the background depending on a randomly generated number | def isMe(str)
case $prng1.rand(1..6)
when 1
return $pastel.red(str)
when 2
return $pastel.green(str)
when 3
return $pastel.yellow(str)
when 4
return $pastel.blue(str)
when 5
return $pastel.magenta(str)
when 6
return $pastel.cyan(str)
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.on_red(str)\n when 2\n return $pastel.on_green(str)\n when 3\n return $pastel.on_yellow(str)\n when 4\n return $pastel.on_blue(str)\n when 5\n return $pastel.on_magenta(str)\n when 6\n re... | [
"0.6822564",
"0.62595063",
"0.5952448",
"0.58726877",
"0.57527214",
"0.5648092",
"0.5625498",
"0.56076586",
"0.5595542",
"0.55714715",
"0.5563615",
"0.556184",
"0.5527345",
"0.5523645",
"0.5500495",
"0.54868793",
"0.5482332",
"0.5478909",
"0.5471816",
"0.5457307",
"0.54439515... | 0.8011491 | 0 |
onMe(str) Passed a string, and returns it as a pastel string with the background changed Depending on a random number | def onMe(str)
case $prng1.rand(1..6)
when 1
return $pastel.on_red(str)
when 2
return $pastel.on_green(str)
when 3
return $pastel.on_yellow(str)
when 4
return $pastel.on_blue(str)
when 5
return $pastel.on_magenta(str)
when 6
return $pastel.on_cy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isMe(str)\n case $prng1.rand(1..6)\n when 1\n return $pastel.red(str)\n when 2\n return $pastel.green(str)\n when 3\n return $pastel.yellow(str)\n when 4\n return $pastel.blue(str)\n when 5\n return $pastel.magenta(str)\n when 6\n return $pastel.cy... | [
"0.7293182",
"0.6238231",
"0.61357147",
"0.60416496",
"0.60021955",
"0.5953776",
"0.5866313",
"0.5863987",
"0.5830028",
"0.57968444",
"0.5793305",
"0.57177734",
"0.56975555",
"0.5678245",
"0.5678075",
"0.5672203",
"0.5615061",
"0.5598038",
"0.5596516",
"0.553829",
"0.5522357"... | 0.7763928 | 0 |
returnFont(str) Passed a string, and returns it as a TTYfont which always has a new line at the end, which the font is dependent on a random number | def returnFont(str)
case $prng1.rand(1..5)
# when 1
# $fontFont = TTY::Font.new("3d")
# return $fontFont.write(str)
when 2
$fontFont = TTY::Font.new(:doom)
return $fontFont.write(str)
when 3
$fontFont = TTY::Font.new(:standard)
return $fontFont.write(str)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now... | [
"0.6373198",
"0.62699497",
"0.5854242",
"0.5825746",
"0.5771107",
"0.5691184",
"0.5671456",
"0.56694084",
"0.56310356",
"0.56266737",
"0.56012356",
"0.5599312",
"0.55815506",
"0.55778265",
"0.5555534",
"0.5555534",
"0.55336475",
"0.5479716",
"0.5475523",
"0.5461922",
"0.54548... | 0.7918338 | 0 |
getIsMe() Returns an integer array (max 6) of user picked numbers, which corresponds to the colors that work well with the command prompt (this program has not yet been tested to work in any Linux Kernel, for reasons of lazyness) Note to self: GET THIS SHIT TO WORK, THEN MAKE EACH SELECTION REPRESENT THAT COLOR, DO THI... | def getIsMe()
puts "Enter the colors you want the printed string to be"
puts "1) Red\n2) Green\n3) Yellow\n4) Blue\n5) Magenta\n6) Cyan"
isMeString = gets.chomp.split(", ")
(0...isMeString.length()).each do |i|
isMeString[i] = isMeString[i].to_i
end
puts "Chosen Numbers: #{isMeString}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOnMe()\n puts \"Enter the colors you want the background of the printed strings to be ON (the background)\"\n puts \"1) Red\\n2) Green\\n3) Yellow\\n4) Blue\\n5) Magenta\\n6) Cyan\"\n onMeString = gets.chomp.split(\", \")\n (0...onMeString.length()).each do |i|\n onMeString[i] = onMeStrin... | [
"0.6934101",
"0.6502392",
"0.6462207",
"0.6407704",
"0.63438225",
"0.6285216",
"0.6257975",
"0.61168754",
"0.6062321",
"0.60447246",
"0.59515584",
"0.59136915",
"0.5904335",
"0.58938307",
"0.58680624",
"0.58318514",
"0.5769378",
"0.5742568",
"0.5686361",
"0.56224257",
"0.5611... | 0.67435735 | 1 |
printRandom(int duration) Passed an integer, interpreted as a duration in seconds for a while loop to run, prints out random symbols in a string array in randomly picked colors for a given duration, and then calls the menu function | def printRandom(duration)
st = "q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m,Q,W,E,R,T,Y,U,I,O,P,A,S,D,F,G,H,J,K,L,Z,X,C,V,B,N,M,1,2,3,4,5,6,7,8,9,0,!,@,#,$,%,^,&,*,(,),_,+,[,],|,{,}"
x = st.split(",")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now... | [
"0.7819071",
"0.7719222",
"0.7337845",
"0.6795813",
"0.6752646",
"0.6651901",
"0.65144366",
"0.6267164",
"0.6201734",
"0.618687",
"0.6175224",
"0.6157515",
"0.6077647",
"0.6062917",
"0.6056033",
"0.6046337",
"0.60086596",
"0.59682584",
"0.5912481",
"0.5898218",
"0.58981365",
... | 0.78929853 | 0 |
printStringS(string printMe, int duration) Passed a string and a duration, the code creates a string array split at a comma followed by a space. I know there can be some problems with this but this was the first thing that came to mind. I could use a regex but what ever. This does the same exact thing as the other prin... | def printStringS(printMe, duration)
x = printMe.split(", ")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime) do
print "#{isMe(onMe(x[$prng.rand(0...x.length())]))}"
currentTime = Time.now.to_i
end
menu()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n return array\n\nend",
"def space_separated(str: raise)\n\tfirst_index = 0\n\tlast_index = 0\n\tresults = []\n\n\tstr.size.times do\n\t\tcheck_string = str[first_index..last_index]\n\t\tif DICTIONARY[check_string]\n\t\t\tres... | [
"0.5394821",
"0.5392412",
"0.53802735",
"0.53696316",
"0.5271568",
"0.525917",
"0.5206748",
"0.5192149",
"0.5184887",
"0.5177218",
"0.5157017",
"0.51315856",
"0.51269263",
"0.5062674",
"0.5057844",
"0.5055729",
"0.5043236",
"0.50301117",
"0.5020443",
"0.49807832",
"0.497843",... | 0.6095845 | 0 |
printStringFont(printMe, duration) Passed a string and a duration, the code creates an array | def printStringRandomFont(printMe, duration)
x = printMe.split(", ")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime) do
print "#{isMe(onMe("\n#{returnFont(x[$prng.rand(0...x.length())])}\n\n"))}"
currentTime = Time.now.to_i
end
me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printRandomFont(duration)\n st = \"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9\"\n x = st.split(\",\")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime)do\n ... | [
"0.7082753",
"0.70182985",
"0.6287385",
"0.59701514",
"0.5935123",
"0.57840484",
"0.5696641",
"0.5671314",
"0.5583725",
"0.55798",
"0.55558866",
"0.55276823",
"0.5523067",
"0.5484647",
"0.5476543",
"0.54740113",
"0.5458908",
"0.54549724",
"0.5443103",
"0.54390556",
"0.5432878... | 0.7331457 | 0 |
printRandomFont(duration) Prints random fonts in random colors. THere's a weird issue about a space at the end of the print statement and I don't like it :( | def printRandomFont(duration)
st = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9"
x = st.split(",")
currentTime = Time.now.to_i
futureTime = currentTime + duration
while (currentTime <= futureTime)do
print "#{isMe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printStringRandomFont(printMe, duration)\n x = printMe.split(\", \")\n currentTime = Time.now.to_i\n futureTime = currentTime + duration\n while (currentTime <= futureTime) do\n print \"#{isMe(onMe(\"\\n#{returnFont(x[$prng.rand(0...x.length())])}\\n\\n\"))}\"\n currentTime = Time.now... | [
"0.8265744",
"0.67774516",
"0.66434515",
"0.6322893",
"0.62821245",
"0.60768193",
"0.60268307",
"0.59610516",
"0.59377813",
"0.59319305",
"0.5915328",
"0.587851",
"0.5870912",
"0.58537483",
"0.58437955",
"0.5835893",
"0.58138955",
"0.58035374",
"0.57865846",
"0.5748406",
"0.5... | 0.84779274 | 0 |
Cache the first elements (if not cached already) and returns it. | def first
check_corrupted
cache_ele if @eles.empty?
return @eles.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first\n items.compact.first\n end",
"def get_first\n return @head.data if @head\n return @head\n end",
"def first\n self.take(1)[0]\n end",
"def first\n @head.lru_next\n end",
"def first\n @ordered_elements.first\n end",
"def get_first\n return @head ? @head.data : n... | [
"0.6740814",
"0.67160505",
"0.6685045",
"0.6624165",
"0.6600085",
"0.6591254",
"0.6564186",
"0.65391654",
"0.6535495",
"0.65317184",
"0.6508876",
"0.65011096",
"0.6491118",
"0.64525986",
"0.64417773",
"0.6436038",
"0.64311564",
"0.6399928",
"0.6399928",
"0.6398635",
"0.637434... | 0.73728454 | 0 |
Yields each countkey and caches element for returning it by using the []method. | def each_index(&block)
enum = Enumerator.new do |yielder|
begin
@each_index = {}
count = 0
self.each do |ele|
# Remove previous element to not take up memory.
count_before = count - 1
@each_index.delete(count_before) if @each_index.key?(count_before)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](key)\n i = 1\n desired_index = index(key, size)\n while @items[desired_index].key != key\n desired_index += i**2\n i += 1\n end\n\n return @items[desired_index].value\n end",
"def each_key(&block); end",
"def finalize\n yield [key, @count]\n end",
"def each\n @... | [
"0.65200365",
"0.641567",
"0.64118683",
"0.6328605",
"0.63226575",
"0.6300463",
"0.6259036",
"0.62395865",
"0.61929506",
"0.6191512",
"0.61428714",
"0.6076651",
"0.5988484",
"0.5986315",
"0.5951433",
"0.59340775",
"0.59340775",
"0.59335816",
"0.5923167",
"0.5921202",
"0.59028... | 0.6580912 | 0 |
Caches a given amount of elements. | def cache_ele(amount = 1)
begin
@mutex.synchronize do
while @eles.length <= amount
@eles << @enum.next
@length_cache += 1
end
end
rescue StopIteration
@end = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache(count)\n @cached_elements = active_elements.pop(count)\n return\n end",
"def caching rows\n raise ArgumentError, \"Invalid caching size. Must be a non-negative integer.\" unless rows.is_a?(Fixnum) && rows >= 0\n spawn :@caching, rows\n end",
"def reappend_el(index)\n element = @cache... | [
"0.7288147",
"0.65581906",
"0.6442266",
"0.6291514",
"0.6197986",
"0.61684155",
"0.61306196",
"0.6063331",
"0.6041663",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.60035473",
"0.5966043",
"0.5913687",
"0.58923423",
"0.58374834",
"0.5... | 0.6586287 | 1 |
Crea los MD a partir de las ayudas de las herramientas | def create_md tool
original = tool[1].split("\n")
new = []
note = false
# Cambia las rutas y < y > por código HTML
def diple l
return l.gsub('de +++YAML+++ en <http://pecas.cliteratu.re>', 'de [+++YAML+++](yaml.html)')
.gsub('de JavaScript en <http://pecas.cliteratu.re>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_md\n @md ||= [\n \"[🔙 🏡](#{project_readme_path})\",\n '',\n \"# #{title} (#{year})\",\n '',\n \"By the #{adjective} [#{author}](#{homepage})\",\n '',\n '## Links:',\n '',\n \"- [Purchase #{title}](#{purchase})\",\n '',\n '## Chapter Notes:',\n ... | [
"0.5654948",
"0.5615741",
"0.5470057",
"0.541697",
"0.5363079",
"0.53075135",
"0.53068924",
"0.52131814",
"0.52057517",
"0.51363",
"0.51253265",
"0.51243556",
"0.50982094",
"0.50778276",
"0.50778276",
"0.5072326",
"0.50687176",
"0.5067654",
"0.5010212",
"0.49945396",
"0.49335... | 0.61998576 | 0 |
"cache_page" alias method which effectivly forces the domain name to be prepended to the page cache path. Note that the "caches_page" method called on actions within a controller is affected by this as well | def cache_page_with_domain(content = nil, options = nil)
return unless perform_caching && caching_allowed
path = "/#{request.host}"
path << case options
when Hash
url_for(options.merge(:only_path => true,
:skip_relative_url_root => true, :format => params[:format]))
when S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_cache(page)\n if page\n \"/page-#{page}\"\n else\n \"\"\n end\n end",
"def cache_page(content = nil, options = nil)\n return unless perform_caching && caching_allowed\n\n path = case options\n when Hash\n url_for(options.merge(:only_path => true, :sk... | [
"0.7399514",
"0.6926317",
"0.68699867",
"0.67377055",
"0.6641414",
"0.66082925",
"0.65276724",
"0.6514265",
"0.6491977",
"0.6366616",
"0.61459774",
"0.6093058",
"0.6084344",
"0.5999851",
"0.59539056",
"0.5940506",
"0.5912845",
"0.5832463",
"0.58030003",
"0.5802468",
"0.579204... | 0.7539716 | 0 |
If doesn't have a current appointment, was already given a dose, allow them to all changes they'd like to Otherwise check if patient can schedule (checking the conditions) | def can_update_profile?
!@patient.appointments.current || # if there's no appointment, allow
@patient.doses.count.positive? || # if there's already a dose, allow
@patient.can_schedule? # if it's the user 1st dose and there's an appointment, check if they can still schedule
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doctor_double_booked #We check this against all of the doctors appointments \n this_start = self.start_time #Instance methods that are called on a particular doctor's appointment \n this_end = self.end_time \n conflict = doctor.appointments.any? do |appointment| \n #Look through all of the doctors... | [
"0.7215266",
"0.68634623",
"0.65881354",
"0.6581343",
"0.6581343",
"0.6477333",
"0.64772683",
"0.6449904",
"0.64198446",
"0.639106",
"0.6371733",
"0.6347831",
"0.63122517",
"0.62951106",
"0.6294801",
"0.6292406",
"0.62743455",
"0.6224108",
"0.6198988",
"0.61689717",
"0.616555... | 0.7544121 | 0 |
returns the list of media types available for this resource to be deserialized from | def media_types
Restfulie::MediaType.default_types + MediaType.medias_for(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_types\n return @media_types\n end",
"def media_type_representations\n custom_representations + Restfulie::MediaType.default_representations.dup\n end",
"def media_types=(value)\n @media_types = value\n end",
"def available_content_types\n ... | [
"0.81824464",
"0.7180635",
"0.69721913",
"0.6924355",
"0.6907955",
"0.6860248",
"0.68008566",
"0.6589313",
"0.6581141",
"0.654005",
"0.65085536",
"0.6504488",
"0.6468978",
"0.64427537",
"0.6439476",
"0.6425805",
"0.6425805",
"0.64250743",
"0.6379401",
"0.63503253",
"0.6342117... | 0.83236927 | 0 |
this model's custom representations. those representations were added through media_type definitions | def custom_representations
@custom_representations ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media_type_representations\n custom_representations + Restfulie::MediaType.default_representations.dup\n end",
"def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discrimi... | [
"0.81593436",
"0.6921461",
"0.69098604",
"0.69098604",
"0.6891906",
"0.67368144",
"0.67271805",
"0.6653601",
"0.6595624",
"0.6521771",
"0.64532167",
"0.6426585",
"0.64094967",
"0.63534504",
"0.63534504",
"0.63127947",
"0.62968343",
"0.62768227",
"0.6275648",
"0.61798555",
"0.... | 0.73142064 | 1 |
Structure and Content assertions Fully assert db structure after full migration | def see_full_schema
assert_schema do |s|
s.table "activities" do |t|
t.column "id", :integer
t.column "actor_id", :integer
t.column "action", :string
t.column "created_at", :datetime
t.column "updated_at", :datetime
t.column "project_id", :integer
t.colu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_content_model\n add_relationship(:has_model, \"info:fedora/hull-cModel:examPaper\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\")\n end",
"def assert_content_model\n add_relationship... | [
"0.65234965",
"0.64974135",
"0.629223",
"0.6128113",
"0.6087569",
"0.601674",
"0.5858129",
"0.584822",
"0.58205354",
"0.58180493",
"0.57787365",
"0.57128763",
"0.5705589",
"0.5703517",
"0.57033545",
"0.5679172",
"0.5679172",
"0.5662987",
"0.5647087",
"0.5620317",
"0.56112397"... | 0.67981 | 0 |
A simple structure to use as the content for the nodes. Create this structure for the tests ++ | ROOT | +++ | | ++ ++ CHILD1 | | ++ | | ++ ++ CHILD2 | | ++ | | ++ ++ ++ CHILD3 ++ CHILD4 | ++ ++ Some basic setup to create the nodes for the test tree. | def setup
@root = Tree::TreeNode.new("ROOT", "Root Node")
@child1 = Tree::TreeNode.new("Child1", "Child Node 1")
@child2 = Tree::TreeNode.new("Child2", "Child Node 2")
@child3 = Tree::TreeNode.new("Child3", "Child Node 3")
@child4 = Tree::TreeNode.new("Child4", "Grand Child 1")
@chi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_test_tree\n @root << @child1\n @root << @child2\n @root << @child3 << @child4\n end",
"def test_root_setup\n assert_not_nil(@root , \"Root cannot be nil\")\n assert_nil(@root.parent , \"Parent of root node should be nil\")\n assert_not_nil(@root.name , \"Na... | [
"0.74892026",
"0.69768673",
"0.6536382",
"0.6532576",
"0.64579844",
"0.6425516",
"0.6425516",
"0.6415502",
"0.63244176",
"0.63095903",
"0.6268332",
"0.6256298",
"0.6199389",
"0.6199389",
"0.6164461",
"0.61095846",
"0.6101349",
"0.60315055",
"0.60315055",
"0.6016662",
"0.60127... | 0.76316243 | 0 |
Create the actual test tree. | def setup_test_tree
@root << @child1
@root << @child2
@root << @child3 << @child4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_csharp_test_node\n @stack = []\n @stack.push(@root)\n @test_case_stack = []\n csharp_regex = Regexp.union([/^namespace/, /^public/, /^\\[TestFixture\\]/, /^\\[Test\\]/, /^\\[TestCase/])\n original_file_string = File.read(@file_name)\n lines = original_file_string.split(\"\\n\")\n li... | [
"0.74843407",
"0.74843407",
"0.7450539",
"0.7450539",
"0.6970523",
"0.67445105",
"0.67445105",
"0.673366",
"0.6630002",
"0.6599638",
"0.65196586",
"0.6453513",
"0.6437223",
"0.63942397",
"0.63213277",
"0.6312018",
"0.6307778",
"0.6289122",
"0.62722176",
"0.62221694",
"0.62182... | 0.7683765 | 0 |
Test the equivalence of size and length methods. | def test_length_is_size
setup_test_tree
assert_equal(@root.size, @root.length, "Length and size methods should return the same result")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size(*) end",
"def size(*) end",
"def size?() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size\n length\n end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def ... | [
"0.75586134",
"0.75586134",
"0.74102986",
"0.7407792",
"0.7407792",
"0.7407792",
"0.7407792",
"0.7407792",
"0.7407792",
"0.73437035",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",
"0.7316878",... | 0.7759589 | 0 |
Test the first_sibling method. | def test_first_sibling
setup_test_tree
# TODO: Need to fix the first_sibling method to return nil for nodes with no siblings.
assert_same(@root, @root.first_sibling, "Root's first sibling is itself")
assert_same(@child1, @child1.first_sibling, "Child1's first sibling is itself")
assert_sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_first_sibling_eh\n setup_test_tree\n\n assert(@root.is_first_sibling?, \"Root's first sibling is itself\")\n assert( @child1.is_first_sibling?, \"Child1's first sibling is itself\")\n assert(!@child2.is_first_sibling?, \"Child2 is not the first sibling\")\n assert(!@child3.is_f... | [
"0.79009914",
"0.7566066",
"0.7036902",
"0.69206107",
"0.6722695",
"0.6710509",
"0.6663359",
"0.6630579",
"0.65792525",
"0.65449476",
"0.63982356",
"0.6392025",
"0.6339048",
"0.63280016",
"0.6317552",
"0.6300825",
"0.62610334",
"0.6217274",
"0.62068033",
"0.62030685",
"0.6179... | 0.8353498 | 0 |
Test the is_first_sibling? method. | def test_is_first_sibling_eh
setup_test_tree
assert(@root.is_first_sibling?, "Root's first sibling is itself")
assert( @child1.is_first_sibling?, "Child1's first sibling is itself")
assert(!@child2.is_first_sibling?, "Child2 is not the first sibling")
assert(!@child3.is_first_sibling?, "C... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_first_sibling\n setup_test_tree\n\n # TODO: Need to fix the first_sibling method to return nil for nodes with no siblings.\n assert_same(@root, @root.first_sibling, \"Root's first sibling is itself\")\n assert_same(@child1, @child1.first_sibling, \"Child1's first sibling is itself\")\n... | [
"0.8011443",
"0.7393663",
"0.68509376",
"0.67709875",
"0.6767636",
"0.6628235",
"0.6586078",
"0.65065676",
"0.64640445",
"0.6428762",
"0.6379756",
"0.6361455",
"0.63255423",
"0.6273904",
"0.6273167",
"0.62536615",
"0.6253361",
"0.62115103",
"0.61885977",
"0.61577463",
"0.6157... | 0.7982871 | 1 |
Test the is_last_sibling? method. | def test_is_last_sibling_eh
setup_test_tree
assert(@root.is_last_sibling?, "Root's last sibling is itself")
assert(!@child1.is_last_sibling?, "Child1 is not the last sibling")
assert(!@child2.is_last_sibling?, "Child2 is not the last sibling")
assert( @child3.is_last_sibling?, "Child3's l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last?\n !right_sibling\n end",
"def test_last_sibling\n setup_test_tree\n\n assert_same(@root, @root.last_sibling, \"Root's last sibling is itself\")\n assert_same(@child3, @child1.last_sibling, \"Child1's last sibling should be child3\")\n assert_same(@child3, @child2.last_siblin... | [
"0.83869696",
"0.76460224",
"0.73134035",
"0.7301334",
"0.7240698",
"0.6910003",
"0.6863837",
"0.6729055",
"0.6729055",
"0.66619647",
"0.6660469",
"0.6627207",
"0.6570848",
"0.6570848",
"0.6557216",
"0.6557216",
"0.65351707",
"0.65260994",
"0.64273703",
"0.64195675",
"0.63713... | 0.7951246 | 1 |
Test the last_sibling method. | def test_last_sibling
setup_test_tree
assert_same(@root, @root.last_sibling, "Root's last sibling is itself")
assert_same(@child3, @child1.last_sibling, "Child1's last sibling should be child3")
assert_same(@child3, @child2.last_sibling, "Child2's last sibling should be child3")
assert_sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_is_last_sibling_eh\n setup_test_tree\n\n assert(@root.is_last_sibling?, \"Root's last sibling is itself\")\n assert(!@child1.is_last_sibling?, \"Child1 is not the last sibling\")\n assert(!@child2.is_last_sibling?, \"Child2 is not the last sibling\")\n assert( @child3.is_last_sibl... | [
"0.78397834",
"0.7777814",
"0.75926775",
"0.6686773",
"0.66590345",
"0.6619843",
"0.6617082",
"0.6594998",
"0.6557912",
"0.63980746",
"0.6383031",
"0.63199455",
"0.6260094",
"0.62564456",
"0.6239777",
"0.62381005",
"0.62360746",
"0.6223332",
"0.6221834",
"0.6216103",
"0.62147... | 0.80057913 | 0 |
Test the siblings method, which is essentially an iterator. | def test_siblings
setup_test_tree
# Lets first collect the siblings in an array.
siblings = []
@child1.siblings { |sibling| siblings << sibling}
assert_equal(2, siblings.length, "Should have two siblings")
assert(siblings.include?(@child2), "Should have 2nd child as sibling")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inelastic_siblings\n siblings\n end",
"def ppl_many_siblings\n raise NotImplementedError\n end",
"def siblings\n without_self self_and_siblings\n end",
"def siblings\n self_and_siblings - [self]\n end",
"def siblings\n self_and_siblings - [self]\n end... | [
"0.70834196",
"0.6983204",
"0.6980295",
"0.6934281",
"0.6934281",
"0.6934281",
"0.6865605",
"0.6863374",
"0.6852279",
"0.6826814",
"0.6826814",
"0.68249834",
"0.6802441",
"0.67338663",
"0.67019105",
"0.66974765",
"0.66627675",
"0.6584337",
"0.6557576",
"0.6557038",
"0.6531824... | 0.7606843 | 0 |
Test the is_only_child? method. | def test_is_only_child_eh
setup_test_tree
assert( @root.is_only_child? , "Root is an only child")
assert(!@child1.is_only_child?, "Child1 is not the only child")
assert(!@child2.is_only_child?, "Child2 is not the only child")
assert(!@child3.is_only_child?, "Child3 is not the only child"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_only_child?\n return false if parent.nil? # root\n 1 == parent.children.size\n end",
"def is_child?\n !is_parent?\n end",
"def child?\n false\n end",
"def child?\n true\n end",
"def is_only_child?\n return call_ancestry_method(:is_only_child?) if use_ancestry?\n\n rel... | [
"0.8115992",
"0.80901664",
"0.8003854",
"0.7896261",
"0.788674",
"0.7732107",
"0.7650381",
"0.7649291",
"0.7649291",
"0.7621647",
"0.74487025",
"0.741235",
"0.741235",
"0.741235",
"0.7374786",
"0.7319415",
"0.72612846",
"0.71617126",
"0.71441275",
"0.7141895",
"0.7136186",
... | 0.8213884 | 0 |
Test the next_sibling method. | def test_next_sibling
setup_test_tree
assert_nil(@root.next_sibling, "Root does not have any next sibling")
assert_equal(@child2, @child1.next_sibling, "Child1's next sibling is Child2")
assert_equal(@child3, @child2.next_sibling, "Child2's next sibling is Child3")
assert_nil(@child3.next... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_sibling\n\t\treturn next_sibling_of @current_node\n\tend",
"def next_sibling\n return @links[:next_sibling]\n end",
"def next_sibling_of(node)\n\t\treturn valid(node) ? node.next_sibling : nil\n\tend",
"def next_sibling=(other); end",
"def assert_next_sibling(id, expected_sibling_id)\n ... | [
"0.76542443",
"0.76073545",
"0.7462824",
"0.7378023",
"0.7237333",
"0.71161175",
"0.70956135",
"0.67643636",
"0.6759868",
"0.6719854",
"0.66626745",
"0.6623448",
"0.654384",
"0.65373915",
"0.64451945",
"0.64451945",
"0.6405785",
"0.63927156",
"0.63911545",
"0.6361223",
"0.630... | 0.7859511 | 0 |
Test the previous_sibling method. | def test_previous_sibling
setup_test_tree
assert_nil(@root.previous_sibling, "Root does not have any previous sibling")
assert_nil(@child1.previous_sibling, "Child1 does not have previous sibling")
assert_equal(@child1, @child2.previous_sibling, "Child2's previous sibling is Child1")
asse... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_sibling\n return @links[:previous_sibling]\n end",
"def prev_sibling_of(node)\n\t\treturn valid(node) ? node.previous_sibling : nil\n\tend",
"def prev_sibling\n\t\treturn prev_sibling_of @current_node\n\tend",
"def previous_sibling=(other); end",
"def previous_sibling\n return nil... | [
"0.7949191",
"0.78544027",
"0.77540195",
"0.7651189",
"0.7334865",
"0.73188716",
"0.7155193",
"0.70268035",
"0.7015421",
"0.7009322",
"0.6913326",
"0.6905757",
"0.690292",
"0.6900668",
"0.6895148",
"0.6839489",
"0.6709548",
"0.6701049",
"0.6685996",
"0.6659306",
"0.66137254",... | 0.82296556 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.