query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
=begin This is my help menu, just hard coded, nothing super special =end | def help(argm)
if(argm)
puts "Commands:"
printf "%-15s %-6s %-10s # Shows the list of commands available\n",
File.basename(__FILE__), "help", ""
printf "%-15s %-6s %-10s # Load a XML file\n",
File.basename(__FILE__), "-xml", "[filename]"
printf "%-15s %-6s %-10s # Allows you to search\n",
File.basenam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_help(menu)\n end",
"def help\r\n end",
"def help\r\n end",
"def help\n end",
"def action\n puts \"\\nHelp menu\"\n puts '=' * 'Help menu'.length + \"\\n\\n\"\n puts \" Command \\t Description\"\n puts \" \" + '-' * 'Command'.length + \" \\t \" + '-' * 'Description'.leng... | [
"0.7973272",
"0.79614145",
"0.79614145",
"0.78436524",
"0.7826377",
"0.7780761",
"0.7780761",
"0.7780761",
"0.7760398",
"0.7760398",
"0.7760398",
"0.7760398",
"0.7760398",
"0.7760398",
"0.7760398",
"0.7709324",
"0.7626743",
"0.75594705",
"0.75450665",
"0.7526712",
"0.7470586"... | 0.6891242 | 55 |
=begin This function opens the file, converts it into nokogiri. Then uses xpath to sort the xml into an array. That array becomes the instance variables for an email data type above. Then the email data type gets pushed into an array. It also has a error check, to make sure there is actually a file in the location sent... | def openFile(emaillist,emailXML)
begin
emails = Nokogiri::XML(File.open(emailXML))
emails.xpath("//record").each { |f| emaillist.push(Email.new(f.css(
'id//text()','first_name//text()','last_name//text()',
'email//text()','gender//text()','ip_address//text()',
'send_date//text()','email_body//text()','ema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser\n\t\t# read mail header from the file\n\t\tfile= File.open(\"header.txt\",\"r\")\n header=\"\"\n\t\tfile.each_line { |line|\n header= get_header_content(line).to_s\n check_google_apps(line)\n line=line.downcase\n\t\t\t#parser received value from mail header\n\t\t\tparser_received(line)\... | [
"0.578031",
"0.5718758",
"0.56521493",
"0.55936456",
"0.5449135",
"0.54150265",
"0.53880626",
"0.5276442",
"0.52632385",
"0.52509815",
"0.52408075",
"0.5211224",
"0.5198556",
"0.5158289",
"0.5145965",
"0.5114368",
"0.50607705",
"0.50304484",
"0.5025607",
"0.50067157",
"0.4980... | 0.6588536 | 1 |
=begin Just adds the commas and final brackets to the array so it is actually json =end | def jsonFinal(aryJson)
exit if aryJson.empty?
finalJson = "{"
aryJson.each do |i|
if aryJson.first.eql? i
finalJson += "\n"+i
else
finalJson += ",\n"+i
end
end
finalJson += "\n}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_with_speedy_arrays(source)\n source.to_json.gsub('\"[[[','[[[').gsub(']]]\"', ']]]').html_safe #.gsub('\\\\', '')\n end",
"def ArrJson(str)\n tmp = \"\"\n tmp += (\"[\" + str + \"]\")\n tmp\n end",
"def ArrJson(str)\n tmp = \"\"\n tmp += (\"[\" + str + \"]\")\n tmp\n end",
"d... | [
"0.6848592",
"0.66399026",
"0.66399026",
"0.66399026",
"0.66399026",
"0.6548489",
"0.6433472",
"0.6257847",
"0.61815965",
"0.60859317",
"0.5999705",
"0.5998707",
"0.5984601",
"0.5982342",
"0.593901",
"0.59373677",
"0.59059125",
"0.5904545",
"0.5903308",
"0.5903308",
"0.590094... | 0.59971786 | 12 |
=begin This is the main function. I wanted to put this into a function rather then just leaving this code floating in the abyss. This function mainly deals with the args. It also holds the main array of all the email objects. =end | def main(cmlInput)
emaillist,finalPrint = [],[]
emailXML = "emails.xml"
argm = nil
help(cmlInput.index("help"))
argm = cmlInput.index("-xml")
emailXML = cmlInput[argm+1] if argm != nil
emaillist = openFile(emaillist,emailXML)
argm = cmlInput.index("list")
if(argm)
emaillist.each {|e| finalPrint.push(e.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mailer; end",
"def main()\n # create the worker\n w = Worker.new\n # let him load his settings from the yamlfile\n w.load_settings\n \n # initialize the mails in the maildir\n w.init_mails\n w.init_senders\n w.init_author_mails\n w.unknown_authors\n w.author_mails\n puts\n... | [
"0.6505837",
"0.6464708",
"0.6241399",
"0.61890644",
"0.61178976",
"0.60584104",
"0.6012252",
"0.5990791",
"0.5990791",
"0.59896195",
"0.59896195",
"0.59746915",
"0.59744006",
"0.5973678",
"0.59634733",
"0.5962423",
"0.5954195",
"0.5921832",
"0.5921832",
"0.5921832",
"0.59218... | 0.6270201 | 2 |
Creates a new VMConnection to generate project JSON data. Returns true if json_data attributes is present. | def run
connection = VMConnection.new(report)
json_data = connection.generate_files_and_read_json
if json_data
self.json_data = json_data
save
return true
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project = Project.find(params[:project_id])\n @project_connection = @project.build_project_connection(project_connection_params)\n\n respond_to do |format|\n if @project_connection.save\n format.html { redirect_to new_project_project_choice_path(@project), notice: 'Project connec... | [
"0.53360873",
"0.5074805",
"0.48510295",
"0.48471588",
"0.47929397",
"0.477698",
"0.477698",
"0.47175923",
"0.4716898",
"0.47139227",
"0.4705631",
"0.47032434",
"0.4698133",
"0.46939024",
"0.4686889",
"0.46681857",
"0.46621522",
"0.4649699",
"0.46410415",
"0.46387398",
"0.463... | 0.58963186 | 0 |
use singular validate to call a custom validation method | def age
Date.current.year - self.year_of_birth
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validator; end",
"def validate\n\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validation; e... | [
"0.77047676",
"0.77047676",
"0.77047676",
"0.75703627",
"0.75703627",
"0.75703627",
"0.75703627",
"0.75509936",
"0.7543162",
"0.74771494",
"0.74771494",
"0.74771494",
"0.7464515",
"0.7464515",
"0.74634266",
"0.7364172",
"0.7362175",
"0.7362175",
"0.7362175",
"0.72297174",
"0.... | 0.0 | -1 |
A nice, simple banner. | def banner
puts "TITO-BOT\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def showBanner\n\treturn unless $options.show_banner\n\tputs <<BANNER\n ____ ____ ____ ___________ ____ __ __ ______\n / ___\\\\_/ __ \\\\ / \\\\_/ __ \\\\_ __ \\\\/ _ \\\\| | \\\\/ ___/\n / /_/ > ___/| | \\\\ ___/| | \\\\( <_> ) | /\\\\___ \\\\\n \\\\___ / \\\\___ >___| /\\\\___ ... | [
"0.8147714",
"0.8004381",
"0.7952882",
"0.7719419",
"0.7716341",
"0.7716341",
"0.7688248",
"0.762997",
"0.7585731",
"0.7567133",
"0.7439296",
"0.7395686",
"0.7369169",
"0.7277439",
"0.7212657",
"0.7109548",
"0.7079563",
"0.70624316",
"0.70615244",
"0.7032616",
"0.70266795",
... | 0.7363081 | 13 |
Set the version number because I like to have it around | def version
puts "Version 1.1"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version_number=(value)\n @version_number = value\n end",
"def version=(v)\n @version = v\n end",
"def setVersion(version)\r\n\t\t\t\t\t@version = version\r\n\t\t\t\tend",
"def set_version\n self.version ||= latest_version + 1\n end",
"def version=(arg)\n @version ... | [
"0.8077649",
"0.79418045",
"0.7939084",
"0.7932797",
"0.7862615",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.780551",
"0.7628935",
"0.7625397",
"0.7620277",
"0.7580587",
"0.7471192",
"0.7404487",
"0.7350013",
"0.731831... | 0.0 | -1 |
load a sql file, exiting and erroring if a problem is found | def safe_load_sql(sql_path_string)
sql_path = OpenStudio::Path.new(sql_path_string)
if OpenStudio::exists(sql_path)
sql = OpenStudio::SqlFile.new(sql_path)
else
OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', "#{sql_path} couldn't be found")
return false
end
return sql
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_sql(sql_user, sql_pwd, rules_file, error_file = nil, abort_on_error = false, &block)\n reject_count = 0\n instrument \"load_data\", :sql_user => sql_user,\n :rules_file => rules_file, :error_file => error_file,\n :abort_on_error => abort_on_error do |pay... | [
"0.7064346",
"0.67497915",
"0.6418604",
"0.59586704",
"0.5935459",
"0.58081436",
"0.57868767",
"0.575516",
"0.5697627",
"0.5691956",
"0.56867886",
"0.5668527",
"0.56412303",
"0.5633714",
"0.5632695",
"0.5632001",
"0.5567777",
"0.55623525",
"0.5557931",
"0.5524383",
"0.5508386... | 0.66329694 | 2 |
Convert from SEER to COP per the method specified in "Achieving the 30% Goal: Energy and cost savings analysis of ASHRAE Standard 90.12010 Thornton, et al 2011 | def seer_to_cop(seer)
cop = nil
# First convert from SEER to EER
eer = (-0.0182 * seer * seer) + (1.1088 * seer)
# Next convert EER to COP
cop = eer_to_cop(eer)
return cop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eer_to_cop(eer)\n \n cop = nil\n\n # r is the ratio of supply fan power to total equipment power at the rating condition,\n # assumed to be 0.12 for the reference buildngs per PNNL.\n r = 0.12\n \n cop = (eer/3.413 + r)/(1-r)\n \n return cop\n \nend",
"def cvss(data)\n\tav = data[\"av2\"]\n\tac = da... | [
"0.6666442",
"0.5876879",
"0.5718582",
"0.55521476",
"0.54277134",
"0.53720796",
"0.5350556",
"0.533563",
"0.523296",
"0.51966906",
"0.51277417",
"0.5127431",
"0.51198876",
"0.5110142",
"0.51097244",
"0.50736845",
"0.50639755",
"0.50607777",
"0.50510836",
"0.50462675",
"0.502... | 0.7313289 | 0 |
Convert from EER to COP per the method specified in "Achieving the 30% Goal: Energy and cost savings analysis of ASHRAE Standard 90.12010 Thornton, et al 2011 | def eer_to_cop(eer)
cop = nil
# r is the ratio of supply fan power to total equipment power at the rating condition,
# assumed to be 0.12 for the reference buildngs per PNNL.
r = 0.12
cop = (eer/3.413 + r)/(1-r)
return cop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seer_to_cop(seer)\n \n cop = nil\n\n # First convert from SEER to EER\n eer = (-0.0182 * seer * seer) + (1.1088 * seer)\n \n # Next convert EER to COP\n cop = eer_to_cop(eer)\n \n return cop\n \nend",
"def cp_e\n end",
"def operating_expenses_ccs\n fetch(:operating_expenses_ccs) do\n ... | [
"0.67961884",
"0.60489625",
"0.5467438",
"0.53677493",
"0.5334059",
"0.5289251",
"0.5262282",
"0.5243232",
"0.52094185",
"0.5178763",
"0.5170848",
"0.5168837",
"0.51247174",
"0.51033235",
"0.50765306",
"0.5063054",
"0.5060741",
"0.505805",
"0.5040258",
"0.5033164",
"0.5033027... | 0.68435645 | 0 |
Convert from COP to kW/ton | def cop_to_kw_per_ton(cop)
return 3.517/cop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toK\n if @unit == 'F' then\n @unit = 'K'\n @value = 5.0 / 9.0 * (@value + 459.67)\n elsif @unit == 'C' then\n @unit = 'K'\n @value += 273.15\n elsif @unit == 'R' then\n @unit = 'K'\n @value *= 5.0 / 9.0\n end\n self\n end",
"def toeuc; Kconv.toeuc(self) end",
"d... | [
"0.63004315",
"0.6226548",
"0.6048196",
"0.593991",
"0.59177595",
"0.57808733",
"0.5677811",
"0.5675534",
"0.5602668",
"0.5567766",
"0.55617034",
"0.55430996",
"0.55046666",
"0.5501396",
"0.5481014",
"0.5472873",
"0.546393",
"0.5433939",
"0.5401393",
"0.53606606",
"0.53524387... | 0.641335 | 0 |
A helper method to convert from kW/ton to COP | def kw_per_ton_to_cop(kw_per_ton)
return 3.517/kw_per_ton
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cop_to_kw_per_ton(cop)\n \n return 3.517/cop\n \nend",
"def toC\n if @unit == 'F' then\n @unit = 'C'\n @value = 5.0 / 9.0 * (@value - 32.0)\n elsif @unit == 'R' then\n @unit = 'C'\n @value = 5.0 / 9.0 * @value - 273.15\n elsif @unit == 'K' then\n @unit = 'C'\n @value ... | [
"0.6496912",
"0.61751336",
"0.5790558",
"0.5768322",
"0.5731425",
"0.57182574",
"0.57182574",
"0.57182574",
"0.5699773",
"0.56498283",
"0.56427664",
"0.5605399",
"0.55506694",
"0.55450755",
"0.55291635",
"0.55009174",
"0.5497795",
"0.5477481",
"0.54733914",
"0.5443987",
"0.54... | 0.6229922 | 1 |
A helper method to convert from AFUE to thermal efficiency | def afue_to_thermal_eff(afue)
return afue # Per PNNL doc, Boiler Addendum 90.1-04an
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combustion_eff_to_thermal_eff(combustion_eff)\n \n return combustion_eff - 0.007 # Per PNNL doc, Boiler Addendum 90.1-04an\n \nend",
"def convert_temp(value, fromUnits)\t\n\t\tif fromUnits == \"F\"\n\t\t\tconverted_value = (value - 32) / 1.8\n\t\telsif fromUnits == \"C\"\n\t\t\tconverted_value = (1.8 * val... | [
"0.68416697",
"0.6541279",
"0.644993",
"0.6435834",
"0.6404421",
"0.64004964",
"0.6372221",
"0.6370923",
"0.6353918",
"0.63251925",
"0.6318011",
"0.61966926",
"0.6174384",
"0.61084855",
"0.610801",
"0.6088033",
"0.6082628",
"0.60752565",
"0.60752565",
"0.60752565",
"0.6074064... | 0.82978237 | 0 |
A helper method to convert from combustion efficiency to thermal efficiency | def combustion_eff_to_thermal_eff(combustion_eff)
return combustion_eff - 0.007 # Per PNNL doc, Boiler Addendum 90.1-04an
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def afue_to_thermal_eff(afue)\n \n return afue # Per PNNL doc, Boiler Addendum 90.1-04an\n \nend",
"def convert_to_measured\n converter = 1\n case self.cost_unit\n when \"tsp\"\n converter = 0.16667 # convert to us_fl_oz \n self.cost_unit = \"us_fl_oz\"\n when \"tbsp\"\n ... | [
"0.7070031",
"0.66924965",
"0.6225824",
"0.61705333",
"0.61659545",
"0.6114233",
"0.60626775",
"0.6029607",
"0.60132414",
"0.5993492",
"0.59882075",
"0.5970094",
"0.5959387",
"0.5954112",
"0.59525526",
"0.59433585",
"0.593196",
"0.5923086",
"0.5920713",
"0.59158146",
"0.58912... | 0.7753533 | 0 |
Convert one infiltration rate at a given pressure to an infiltration rate at another pressure per method described here: where the infiltration coefficient is 0.65 | def adjust_infiltration_to_lower_pressure(initial_infiltration_rate_m3_per_s, intial_pressure_pa, final_pressure_pa, infiltration_coefficient = 0.65)
adjusted_infiltration_rate_m3_per_s = initial_infiltration_rate_m3_per_s * (final_pressure_pa/intial_pressure_pa)**infiltration_coefficient
return adjusted_infiltra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_infiltration_to_prototype_building_conditions(initial_infiltration_rate_m3_per_s)\n\n # Details of these coefficients can be found in paper\n alpha = 0.22 # unitless - terrain adjustment factor\n intial_pressure_pa = 75.0 # 75 Pa\n uh = 4.47 # m/s - wind speed\n rho = 1.18 # kg/m^3 - air density\n ... | [
"0.5940458",
"0.5670857",
"0.55417866",
"0.53041667",
"0.5276689",
"0.5231833",
"0.51937014",
"0.51806223",
"0.5133484",
"0.51269686",
"0.5120388",
"0.5117355",
"0.51026213",
"0.50848794",
"0.507111",
"0.50411195",
"0.50358474",
"0.50189",
"0.5008542",
"0.5005126",
"0.4983584... | 0.7398085 | 0 |
Convert the infiltration rate at a 75 Pa to an infiltration rate at the typical value for the prototype buildings per method described here: | def adjust_infiltration_to_prototype_building_conditions(initial_infiltration_rate_m3_per_s)
# Details of these coefficients can be found in paper
alpha = 0.22 # unitless - terrain adjustment factor
intial_pressure_pa = 75.0 # 75 Pa
uh = 4.47 # m/s - wind speed
rho = 1.18 # kg/m^3 - air density
cs = 0.1617... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_infiltration_to_lower_pressure(initial_infiltration_rate_m3_per_s, intial_pressure_pa, final_pressure_pa, infiltration_coefficient = 0.65)\n\n adjusted_infiltration_rate_m3_per_s = initial_infiltration_rate_m3_per_s * (final_pressure_pa/intial_pressure_pa)**infiltration_coefficient\n\n return adjusted... | [
"0.6774809",
"0.63462746",
"0.6241222",
"0.6146121",
"0.61363953",
"0.6098056",
"0.6028388",
"0.60170776",
"0.6011824",
"0.5985629",
"0.5973185",
"0.5949322",
"0.5945744",
"0.59111893",
"0.5911187",
"0.5871457",
"0.58580714",
"0.58556765",
"0.58369976",
"0.5770011",
"0.576820... | 0.7028768 | 0 |
cached gem specification path, if one exists | def gemspec_cached_path(spec_file_name)
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
paths.find {|path| File.file? path }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' ... | [
"0.73617226",
"0.72912604",
"0.7287723",
"0.71837795",
"0.70555204",
"0.70427233",
"0.6908694",
"0.6898931",
"0.6873734",
"0.68447465",
"0.6830519",
"0.68270683",
"0.68150365",
"0.6722855",
"0.6698501",
"0.6690421",
"0.6690421",
"0.66101617",
"0.6605831",
"0.66024196",
"0.659... | 0.7284187 | 3 |
Returns the path of the folder, note that '/' will be returned for root_folder | def path
folders = ancestors.reverse + [self]
folders.shift # Remove the root folder
path = File.join('/', folders.map(&:name))
Pathname.new(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def folder_path\n File.expand_path @folder_path\n end",
"def folder_path\n File.join(location.path, folder_name)\n end",
"def folder\n @root_folder\n end",
"def path\n File.join(Settings.root, folder_name.to_path)\n end",
"def folder_location\n @folder_location ||= Find.find(ro... | [
"0.869856",
"0.83572173",
"0.8322257",
"0.81849337",
"0.77628255",
"0.7719136",
"0.77152294",
"0.7619367",
"0.7615149",
"0.757454",
"0.7564094",
"0.74916",
"0.74827874",
"0.74239206",
"0.737667",
"0.7342129",
"0.733877",
"0.71734816",
"0.71425515",
"0.71277916",
"0.71079004",... | 0.71840525 | 17 |
Check if the folder is standalone and does not belongs to any owner(e.g. assessments). | def concrete?
owner_id.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ignored_folder?(folder)\n IGNORED_FOLDERS.include?(folder.display_name)\n end",
"def root?\n \tfolder_id.nil?\n end",
"def root_folder?\n if new_record?\n material_folders.find(&:root?).present?\n else\n material_folders.find_by(parent: nil).present?\n end\n end",
"def folde... | [
"0.63330793",
"0.6298555",
"0.6081449",
"0.6066676",
"0.6064275",
"0.60217345",
"0.5966576",
"0.5945765",
"0.5934571",
"0.59309137",
"0.5900033",
"0.5896803",
"0.58944637",
"0.5875391",
"0.58595395",
"0.58500606",
"0.579526",
"0.57923025",
"0.578711",
"0.57695544",
"0.5737101... | 0.0 | -1 |
Finds a unique name for `item` among the folder's existing contents by appending a serial number to it, if necessary. E.g. "logo.png" will be named "logo.png (1)" if the files named "logo.png" and "logo.png (0)" exist in the folder. | def next_uniq_child_name(item)
taken_names = contents_names(item).map(&:downcase)
name_generator = FileName.new(item.name, path: :relative, add: :always,
format: '(%d)', delimiter: ' ')
new_name = item.name
new_name = name_generator.create while taken_names.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_name_for(item)\n item.to_s\n end",
"def find_item(item)\n md5 = ItemBuilder.md5(item)\n items.find { |e| e[0] == md5 } if items\n end",
"def new_item(item)\n unless item.include?(File::SEPARATOR)\n prefixes = [\n config.get(:sfn_parameters, :directory),\n ... | [
"0.6482823",
"0.625801",
"0.6198706",
"0.6100265",
"0.59138644",
"0.5878353",
"0.5838393",
"0.58192736",
"0.5617407",
"0.5617407",
"0.5598795",
"0.55133253",
"0.55039823",
"0.5485873",
"0.5464746",
"0.54155916",
"0.53988665",
"0.53922987",
"0.53890705",
"0.5372857",
"0.530424... | 0.72760946 | 0 |
Finds a unique name for the current folder among its siblings. | def next_valid_name
parent.next_uniq_child_name(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_uniq_child_name(item)\n taken_names = contents_names(item).map(&:downcase)\n name_generator = FileName.new(item.name, path: :relative, add: :always,\n format: '(%d)', delimiter: ' ')\n new_name = item.name\n new_name = name_generator.create while tak... | [
"0.65733296",
"0.6330908",
"0.62743384",
"0.6200363",
"0.61055684",
"0.6028384",
"0.596243",
"0.59568715",
"0.5909005",
"0.5849339",
"0.5834728",
"0.577619",
"0.5755145",
"0.5753331",
"0.57521206",
"0.5750175",
"0.57385755",
"0.573297",
"0.5710253",
"0.565715",
"0.564139",
... | 0.6213896 | 3 |
Take Courseadvance_start_at_duration into account when calculating folder's start datetime. | def effective_start_at
start_at - course&.advance_start_at_duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance_start_at_duration\n settings(:course).advance_start_at_duration\n end",
"def advance_start_at_duration_days=(value)\n value = if value.present? && value.to_i > 0\n value.to_i.days\n else\n nil\n end\n settings(:course).advance_start_at_duratio... | [
"0.7354363",
"0.6702344",
"0.61709034",
"0.6105288",
"0.5917118",
"0.5914116",
"0.56040424",
"0.56004983",
"0.5599125",
"0.55621696",
"0.5488371",
"0.5476255",
"0.5426676",
"0.5424818",
"0.5424818",
"0.5424818",
"0.5424818",
"0.5424818",
"0.54066974",
"0.539925",
"0.5386565",... | 0.70960784 | 1 |
TODO: Not threadsafe, consider making all folders as materials Make sure that folder won't have the same name with other materials in the parent folder Schema validations already ensure that it won't have the same name as other folders | def validate_name_is_unique_among_materials
return if parent.nil?
# conflicts = parent.materials.where.has { |parent| name =~ parent.name }
conflicts = parent.materials.where(Course::Material.arel_table[:name].matches(name))
errors.add(:name, :taken) unless conflicts.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_hierarchy\n if folder\n # prevent the folder from being its own parent\n if folder.id == self.id then\n errors.add :folder_id, \"You cannot add a folder to itself!\"\n\n # or a parent being a child of one of its children\n elsif folder.is_child_of?(self) then\n err... | [
"0.5922334",
"0.59094167",
"0.58423257",
"0.56296825",
"0.55969334",
"0.5591153",
"0.55729115",
"0.550657",
"0.5481246",
"0.54812",
"0.5401524",
"0.5364624",
"0.5354702",
"0.53295153",
"0.5279031",
"0.5261636",
"0.5219901",
"0.51899207",
"0.5183442",
"0.5181536",
"0.51599705"... | 0.556171 | 7 |
Fetches the names of the contents of the current folder, except for an excluded_item, if one is provided. | def contents_names(excluded_item = nil)
excluded_material = excluded_item.instance_of?(Course::Material) ? excluded_item : nil
excluded_folder = excluded_item.instance_of?(Course::Material::Folder) ? excluded_item : nil
materials_names = materials.where.not(id: excluded_material).pluck(:name)
subfolders... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_items\n Dir[\"#{@context.repo_path}/data_bags/**/*.json\"].map do |e|\n e.split('/')[-2..-1].join('/').gsub('.json', '')\n end\n end",
"def fetch_items_from_filesystem_or_zip\n unless in_zip?\n @items = Dir.foreach(current_dir).map {|fn|\n load_item dir:... | [
"0.5736126",
"0.56989354",
"0.5664447",
"0.5590327",
"0.5473134",
"0.5464897",
"0.53944415",
"0.53825986",
"0.5376518",
"0.5347046",
"0.53365785",
"0.5320432",
"0.5309492",
"0.53074634",
"0.5297762",
"0.52931327",
"0.5280056",
"0.5273456",
"0.52657956",
"0.5264485",
"0.523136... | 0.7171475 | 0 |
Normalize the folder name | def normalize_filename
self.name = Pathname.normalize_filename(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalised_name(path)\n path == '/' ? '/' : File.basename(path)\n end",
"def name_to_dir(name)\n name.gsub(/[^-A-Za-z0-9_|\\[\\]]/, \"_\")\n end",
"def folder_name\n team_name = team.team.tr(' ', '-').strip_nonalnum\n team_name.unidowncase\n end",
"def normalize(name)\n na... | [
"0.7126731",
"0.70638186",
"0.7054799",
"0.6836607",
"0.6759518",
"0.67356557",
"0.668443",
"0.6657292",
"0.6636042",
"0.65931153",
"0.648365",
"0.64731187",
"0.64570814",
"0.64315796",
"0.6429415",
"0.63960844",
"0.6369974",
"0.6359121",
"0.63519937",
"0.6348651",
"0.6329453... | 0.7042213 | 3 |
Return false to prevent the userstamp gem from changing the updater during duplication | def record_userstamp
!duplicating?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_userstamp\n !@duplicating\n end",
"def modified_existing?\n false\n end",
"def updated?\n updater && author != updater\n end",
"def update_version?\n append_version?\n end",
"def updateable?\n false\n end",
"def save_version?\n version_condition_met... | [
"0.6959357",
"0.68603647",
"0.6647606",
"0.6633074",
"0.6462069",
"0.6455834",
"0.636948",
"0.6337273",
"0.6271795",
"0.62639517",
"0.61878085",
"0.618279",
"0.61824906",
"0.61824906",
"0.61480916",
"0.61480916",
"0.6121409",
"0.6108795",
"0.6104411",
"0.6101312",
"0.6097274"... | 0.69517446 | 2 |
The function should return a 2D array representing a complete pyramid with the given base. To construct a level of the pyramid, we take the sum of adjacent elements of the level below. | def pyramid_sum(base)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyramid_sum(base)\n levels = [base]\n (base.length-1).times do ||\n tmp_arr = []\n (0..levels[0].length-2).each do |i|\n tmp_arr << levels[0][i] + levels[0][i+1]\n end\n levels.unshift(tmp_arr)\n end\n return levels\n end",
"def pyramid_sum(base)\n\tarr = [base]\n\t\n ... | [
"0.8584751",
"0.8370464",
"0.8354732",
"0.8280637",
"0.8275854",
"0.82353204",
"0.82275194",
"0.82014865",
"0.816901",
"0.7979542",
"0.794384",
"0.78842664",
"0.78422517",
"0.7741309",
"0.76409614",
"0.7184985",
"0.6945291",
"0.69215393",
"0.68371195",
"0.6513535",
"0.6430523... | 0.7785233 | 13 |
Provid the user currently signed in. Returns: the user currently signed in | def current_user
@current_user ||= User.find_by_remember_token(cookies[:remember_token])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n User.find session[:user_id] if user_signed_in?\n end",
"def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end",
"def current_user\n if user_signed_in?\n ... | [
"0.77980113",
"0.77586657",
"0.77586657",
"0.76021135",
"0.7580399",
"0.7563109",
"0.7563109",
"0.754815",
"0.75460243",
"0.75354844",
"0.7454245",
"0.74279153",
"0.74279153",
"0.74276036",
"0.7426828",
"0.741682",
"0.7397718",
"0.7397718",
"0.73813224",
"0.7378789",
"0.73753... | 0.0 | -1 |
Check if there is a user signed in. Returns: true or false | def signed_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def user_signed_in?\n !!session[:user_id]\n end",
"def user_signed_in?\n session[:user_id].present? && User.find_by(id: session[:user_id])\n end",
"def user_signed_in?\n c... | [
"0.8165894",
"0.8137818",
"0.80721265",
"0.80401784",
"0.8036182",
"0.8018337",
"0.79955614",
"0.79917884",
"0.79917884",
"0.7974164",
"0.79735005",
"0.79735005",
"0.795727",
"0.79544497",
"0.79544497",
"0.79196703",
"0.79196703",
"0.79196703",
"0.79154605",
"0.79012865",
"0.... | 0.7866975 | 35 |
Sign out a user by removing the cookie. | def sign_out
self.current_user = nil
cookies.delete(:remember_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_out\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n current_user = nil\n end",
"def sign_out_user\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n\t\tcookies.delete(:remember_token)\n\t\tcurrent_user = nil... | [
"0.84814394",
"0.84021586",
"0.837678",
"0.83706677",
"0.8345665",
"0.83292973",
"0.83254045",
"0.83023316",
"0.8265371",
"0.82554334",
"0.82554334",
"0.82554334",
"0.82554334",
"0.82554334",
"0.82554334",
"0.82554334",
"0.82554334",
"0.8254896",
"0.8250755",
"0.82489324",
"0... | 0.8219314 | 22 |
Store the current url in session's variable Args : Returns : | def store_location
cookies[:return_to] = { value: request.fullpath, expires: 1.minute.from_now }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_location\n session[ :return_to ] = request.url if request.get?\n end",
"def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend",
"def store_location\n\t\tsession[:return_to] = request.u... | [
"0.75269717",
"0.73288286",
"0.73288286",
"0.73288286",
"0.7316092",
"0.7316092",
"0.7316092",
"0.7316092",
"0.7316092",
"0.7316092",
"0.7316092",
"0.7293728",
"0.7281674",
"0.7277874",
"0.7274388",
"0.72488266",
"0.72416526",
"0.72416526",
"0.72416526",
"0.72416526",
"0.7229... | 0.0 | -1 |
Redirect the user to the stored url or the default one provided Args : default path to redirect to Returns : | def redirect_back_or(default, message = nil)
redirect_to(cookies[:return_to] || default, message)
session.delete(:return_to)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_path(name, default = nil)\n stored_redirect_path(name) || default || root_path\n end",
"def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end",
"def redirect_back_or_default(default)\n redirect_to url_... | [
"0.7976481",
"0.795904",
"0.79515785",
"0.7878778",
"0.7872358",
"0.77907526",
"0.77755857",
"0.77673554",
"0.76756793",
"0.76717854",
"0.7663201",
"0.7637595",
"0.7621586",
"0.7594754",
"0.75842613",
"0.75672024",
"0.75665784",
"0.7546978",
"0.75409025",
"0.7540271",
"0.7536... | 0.0 | -1 |
method to get rid of commas or dollar signs in the input | def isNum?(num)
/[0-9]/.match(num.to_s) != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_cleansing(data)\n # Removes extra spaces, commas, dollar sign etc.\n data = data.strip.split('')\n (data - [',', '%', ' ', '$']).join\nend",
"def bill_clean(bill) \n\tbill.gsub(/[a-zA-Z]/, \"\").gsub(\"$\", \"\").to_f\nend",
"def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input... | [
"0.7435347",
"0.70754457",
"0.68549293",
"0.6824381",
"0.68088245",
"0.66951007",
"0.6694246",
"0.6649973",
"0.6645213",
"0.6572159",
"0.6495269",
"0.64860857",
"0.64732575",
"0.6409959",
"0.6409959",
"0.6331837",
"0.62976456",
"0.62976456",
"0.62695867",
"0.6243128",
"0.6240... | 0.0 | -1 |
method to get rid of the commas and dollar sign, I first make the argument cost into a string, then I put it into an array with the split method on '.' . $4,500.578 would give me [$4,500, 578] I iterate over the first element of the array and get rid of all the char that aren't numbers for the decimal part, I round the... | def modify(cost)
answer = ''
if cost == cost.to_f || cost == cost.to_i
return cost
else
cost = cost.to_s
arr = cost.split('.')
arr[0].each_char do |c|
if isNum?(c)
answer += c.to_s
end
end
end
return answer.to_i + arr[1].to_i.round(2)* 0.01
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_price(input)\n input[0] == \"$\" ? input[1..-1].to_f : input.to_f\n end",
"def discount(str)\n str.gsub(/\\$[0-9]+/){|x| price = x[/[0-9]+/].to_i; price = price - price*15/100; \"$#{price}\"}\nend",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend... | [
"0.71776927",
"0.710514",
"0.6850327",
"0.68258417",
"0.6785982",
"0.6738941",
"0.6738941",
"0.672834",
"0.65665776",
"0.6500461",
"0.6490608",
"0.6446193",
"0.6436594",
"0.6391342",
"0.63845676",
"0.63845676",
"0.63620615",
"0.63233167",
"0.63021106",
"0.6289035",
"0.6268088... | 0.7386163 | 0 |
a hash where the key is the trip id and the value is the amount of total saved. If nothing has been saved, the trip.id is not a key | def hash_trip_id_total_saved(trips)
hash = {}
trips.each do |trip|
if trip.savings!= 0
hash[trip.id] = total_saved_for_trip(trip)
end
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_trip_total\n (per_ticket_cost + checked_bag_cost + per_trip_accom)\n end",
"def total_spent_hours\n @total_spent_hours ||= TimeEntry.where(:meeting_id => id).sum(:hours).to_f\n end",
"def persist_total\n clinton = Candidate.find_by(name: 'Clinton')\n clinton.total += @clinton\n cl... | [
"0.59938896",
"0.5984894",
"0.5764719",
"0.5697574",
"0.56344813",
"0.56125706",
"0.5608432",
"0.5603985",
"0.5591994",
"0.55573905",
"0.55422384",
"0.55320776",
"0.5511745",
"0.5484189",
"0.54794437",
"0.5440953",
"0.5403232",
"0.5375099",
"0.53546494",
"0.53389347",
"0.5328... | 0.81624943 | 0 |
Purpose of overriding: create correctly encoded URLs for embedded screen shots | def embed_image(src, label)
id = "img_#{@img_id}"
@img_id += 1
if @io.respond_to?(:path) and File.file?(src)
out_dir = Pathname.new(File.dirname(File.absolute_path(@io.path)))
src = Pathname.new(File.absolute_path(src)).relative_path_from(out_dir)
end
# removi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\r\n assert_exists\r\n super({\"src\" => \"src\",\"width\" => \"width\",\"height\" => \"height\",\"alt\" => \"alt\"})\r\n end",
"def square_url\n thumb_url\n end",
"def encoded_thumb\n thumb = parse_thumb\n return unless thumb\n\n thumb_druid = thumb.split('/').first # the... | [
"0.60855037",
"0.6044628",
"0.5986834",
"0.59219754",
"0.5908111",
"0.5883283",
"0.58791953",
"0.5875824",
"0.58604586",
"0.58395153",
"0.582656",
"0.5737199",
"0.5711443",
"0.5708395",
"0.5707802",
"0.57038945",
"0.5698533",
"0.5696883",
"0.5670779",
"0.56468123",
"0.5624332... | 0.0 | -1 |
Purpose of overriding: update feature duration | def after_test_case(test_case, result)
if result.failed? and not @scenario_red
set_scenario_color_failed
end
@feature_duration += Cucumber::Formatter::DurationExtractor.new(result).result_duration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration; end",
"def duration; end",
"def duration; end",
"def duration; end",
"def duration; end",
"def update!(**args)\n @use_elapsed_duration = args[:use_elapsed_duration] if args.key?(:use_elapsed_duration)\n end",
"def update!(**args)\n @use_elapsed_duration = args[:us... | [
"0.66982174",
"0.66982174",
"0.66982174",
"0.66982174",
"0.66982174",
"0.66924995",
"0.66924995",
"0.66341007",
"0.6332648",
"0.62668824",
"0.6236278",
"0.62083316",
"0.61958635",
"0.6175113",
"0.61248255",
"0.608357",
"0.6045748",
"0.6039032",
"0.6037453",
"0.5997073",
"0.59... | 0.0 | -1 |
Purpose of overriding: update feature scenario and step counts | def print_stat_string(feature)
string = String.new
string << dump_count(@feature_scenario_count, 'scenario')
scenario_count = print_status_counts{|status| filter_by_status(@runtime.scenarios.last(@feature_scenario_count), status)}
string << scenario_count if scenario_count
string... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_step_count(features)\n count = 0\n features = features.instance_variable_get(\"@features\")\n features.each do |feature|\n #get background steps\n if feature.instance_variable_get(\"@background\")\n background = feature.instance_variable_get(\"@background\")\n ... | [
"0.66587853",
"0.6419323",
"0.62995946",
"0.61482525",
"0.60545284",
"0.6011071",
"0.59402835",
"0.59402835",
"0.5883602",
"0.58657223",
"0.5852839",
"0.5843825",
"0.5832263",
"0.5775648",
"0.5758333",
"0.5757879",
"0.57375157",
"0.5676401",
"0.56687987",
"0.5667618",
"0.5659... | 0.0 | -1 |
Add more helper methods to be used by all tests here... | def remove_non_permitted_booking_attrs hash
hash[:booking].delete_if {|k,v| k.to_s.in? %w(id hotel_id encrypted_cc_number encrypted_cc_cvv state customer_id rate discounted_rate created_at updated_at guid paid total) }
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def helpers; end",
"def... | [
"0.7330966",
"0.701972",
"0.701972",
"0.701972",
"0.6772961",
"0.6679903",
"0.6679903",
"0.6583205",
"0.65507036",
"0.6377433",
"0.63762784",
"0.632961",
"0.6280821",
"0.6280821",
"0.6249786",
"0.6142927",
"0.6137607",
"0.6121912",
"0.6108209",
"0.60972595",
"0.60949636",
"... | 0.0 | -1 |
Returns true if a test user is logged in. | def is_logged_in?
!session[:user_id].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end",
"def logged_in?\n if session[:username]\n if sessi... | [
"0.8132415",
"0.79302394",
"0.7916867",
"0.7894071",
"0.783421",
"0.7830268",
"0.78281486",
"0.78151375",
"0.7764021",
"0.7722835",
"0.7698386",
"0.7686089",
"0.76828593",
"0.76828593",
"0.7681316",
"0.76688963",
"0.76657265",
"0.76629454",
"0.76468843",
"0.76301366",
"0.7625... | 0.0 | -1 |
Log in as a particular user. | def log_in_as(user)
session[:user_id] = user.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_as(user)\n login(users(user).email, users(user).password)\n end",
"def login(user=:joerg)\r\n login_as(user)\r\n end",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if ch... | [
"0.79093844",
"0.75497735",
"0.7544059",
"0.75256014",
"0.74607694",
"0.7453915",
"0.74319816",
"0.7426717",
"0.7352159",
"0.7328012",
"0.7313094",
"0.72915596",
"0.72503793",
"0.72361374",
"0.7235982",
"0.7206849",
"0.71885103",
"0.7154581",
"0.71442896",
"0.71237147",
"0.71... | 0.68779314 | 63 |
GET /admin/posts/1 def show | def new
@blog = Admin::BlogModule.find(params[:blog_id])
@page = @blog.page
@post = Admin::BlogPost.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin\n @posts = Post.all\n end",
"def show\n\t \t@post = Post.published.friendly.find(params[:id])\n\t end",
"def show\n\t\t@post = Post.find(params[:id])\n end",
"def show\n @post = Post.find(params[:id]) #get the post from the id and return the post\n end",
"def show\n @post = ... | [
"0.77395034",
"0.75502706",
"0.7407073",
"0.73983914",
"0.73802686",
"0.73797214",
"0.73797214",
"0.73797214",
"0.7353694",
"0.7335899",
"0.7316011",
"0.7310947",
"0.7280235",
"0.7274374",
"0.72602034",
"0.72499067",
"0.72499067",
"0.72499067",
"0.72499067",
"0.72499067",
"0.... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_post
@post = Admin::BlogPost.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def post_params
params.require(:admin_blog_post).permit(:title, :body, :position, :image, :teaser)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
generate a random dns_name if azure_dns_name is empty | def get_dns_name(azure_dns_name, prefix = "az-")
return azure_dns_name unless azure_dns_name.nil?
if locate_config_value(:azure_vm_name).nil?
azure_dns_name = prefix + SecureRandom.hex(( MAX_VM_NAME_CHARACTERS - prefix.length) / 2)
else
azure_dns_name = locate_config_value(:a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end",
"def random_common_name(domain_name)\n cert_serial_number(domain_name).to_s(36)\n end",
"def domain_name\n Faker::Internet.domain_name\n end",
"def domain_name\n Faker::Internet.domain_name\n end",
... | [
"0.710071",
"0.710071",
"0.6819814",
"0.6819814",
"0.67092955",
"0.66662556",
"0.6536072",
"0.65289634",
"0.6487441",
"0.6459603",
"0.64124525",
"0.63951784",
"0.6390449",
"0.6382618",
"0.63825375",
"0.637747",
"0.637747",
"0.6317906",
"0.62716854",
"0.624957",
"0.6232143",
... | 0.79970336 | 0 |
GET /subscribers/1 GET /subscribers/1.json | def show
@subscriber = Subscriber.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @subscriber }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscriber(id_or_email)\n make_json_api_request :get, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}\"\n end",
"def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end",
"def show\n\n @subscriber = Subscriber.find(params[:id])\n\n respond_to d... | [
"0.77388203",
"0.7634598",
"0.74280024",
"0.73774445",
"0.7345014",
"0.7330656",
"0.71469235",
"0.71259916",
"0.7072152",
"0.6970554",
"0.6936619",
"0.6935477",
"0.6912732",
"0.6750059",
"0.65972066",
"0.6581586",
"0.6581586",
"0.6581586",
"0.65361416",
"0.6490314",
"0.648337... | 0.73992676 | 5 |
GET /subscribers/new GET /subscribers/new.json | def new
@subscriber = Subscriber.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @subscriber }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @breadcrumb = 'create'\n @subscriber = Subscriber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subscriber }\n end\n end",
"def new\n @subscriber = Subscriber.new\n @subscriber.account = @account\n\n respond_to do... | [
"0.80589277",
"0.74912596",
"0.7201779",
"0.70133185",
"0.6959608",
"0.69244933",
"0.68992144",
"0.68992144",
"0.68992144",
"0.68992144",
"0.68992144",
"0.68806523",
"0.68761605",
"0.6854824",
"0.6847739",
"0.68471277",
"0.6810826",
"0.68091387",
"0.6796237",
"0.6776736",
"0.... | 0.8033767 | 3 |
POST /subscribers POST /subscribers.json | def create
@subscriber = Subscriber.find_or_create_by_phonenumber(params[:subscriber][:phonenumber])
@client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']
@subscriber.phonenumber = params[:subscriber][:phonenumber]
@subscriber.phonenumber = @subscriber.phonenumber.gsub(/... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @subscriber = Subscriber.new(subscriber_params)\n\n respond_to do |format|\n if @subscriber.save\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully created.' }\n format.json { render :show, status: :created, location: @subscriber }\n else\n ... | [
"0.7317428",
"0.731076",
"0.73096126",
"0.70741594",
"0.707315",
"0.69829106",
"0.6963176",
"0.69536996",
"0.6886174",
"0.68259984",
"0.6772293",
"0.67319465",
"0.6642967",
"0.6582124",
"0.65672916",
"0.6563927",
"0.6546686",
"0.6516176",
"0.64925486",
"0.6472395",
"0.6459243... | 0.5806341 | 100 |
PUT /subscribers/1 PUT /subscribers/1.json | def update
@subscriber = Subscriber.find(params[:id])
respond_to do |format|
if @subscriber.update_attributes(params[:subscriber])
format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }
format.json { head :no_content }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @subscriber = Subscriber.find(params[:id])\n\n respond_to do |format|\n if @subscriber.update_attributes(params[:subscriber])\n format.html { redirect_to @subscriber, notice: 'Subscriber was successfully updated.' }\n format.json { head :ok }\n else\n format.html {... | [
"0.70377606",
"0.70377606",
"0.68467504",
"0.67896503",
"0.6667707",
"0.6666052",
"0.66286767",
"0.6599085",
"0.6505486",
"0.650356",
"0.6433736",
"0.6388022",
"0.6388022",
"0.6388022",
"0.6388022",
"0.6388022",
"0.6388022",
"0.63615185",
"0.63070214",
"0.6275235",
"0.62612",... | 0.6987206 | 2 |
DELETE /subscribers/1 DELETE /subscribers/1.json | def destroy
@subscriber = Subscriber.find(params[:id])
@subscriber.destroy
respond_to do |format|
format.html { redirect_to subscribers_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subscriber = Subscriber.find(params[:id])\n @subscriber.destroy\n\n re... | [
"0.794178",
"0.7923782",
"0.7802754",
"0.77783054",
"0.77302533",
"0.7588091",
"0.74162745",
"0.7325512",
"0.72669154",
"0.726173",
"0.7258234",
"0.7192651",
"0.7192651",
"0.70819443",
"0.70665675",
"0.70633245",
"0.7053913",
"0.70507365",
"0.7002493",
"0.69816566",
"0.698165... | 0.7879767 | 2 |
Define a scrape method that saves data | def scrape
articles = []
url = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_sport_2789.xml'
open(url) do |rss|
feed = RSS::Parser.parse(rss)
feed.items.each do |item|
articles << (interpret item)
end
end
articles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scrape\n end",
"def scrape_it\n \n end",
"def scrape()\n scrapeForCurrentData\n end",
"def single_scrape\n next_page()\n save_page()\nend",
"def scrape_details\n unscraped.each do |item|\n item.scrape_detail\n item.save!\n end\n end",
"def scrap\n @t... | [
"0.73033535",
"0.72592807",
"0.7236343",
"0.7162948",
"0.68185574",
"0.64402914",
"0.6198748",
"0.615654",
"0.60988975",
"0.60988975",
"0.6024148",
"0.60202956",
"0.60202956",
"0.6013334",
"0.6000305",
"0.6000305",
"0.59822726",
"0.59822726",
"0.5969378",
"0.5969378",
"0.5969... | 0.0 | -1 |
Define a interpret method that interprets article data after it parsed | def interpret(i)
article = Article.new
article.title = !i.title.nil? ? i.title : 'n/a'
article.source = @source
article.pub_date = !i.pubDate.nil? ? i.pubDate : nil
name = !i.source.nil? ? i.source.content : 'n/a'
article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name
art... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpret(d)\n article = Article.new\n\n if d['headline'] != []\n if !d['headline']['main'].nil?\n article.title = d['headline']['main']\n elsif !d['headline']['name'].nil?\n article.title = d['headline']['name']\n end\n end\n if article.title.nil?\n article.title ... | [
"0.72781974",
"0.69606066",
"0.66644573",
"0.6058153",
"0.60343397",
"0.60256314",
"0.60249645",
"0.60249645",
"0.60249645",
"0.60157776",
"0.60157776",
"0.5949825",
"0.5901967",
"0.58269054",
"0.57362443",
"0.56813633",
"0.56813025",
"0.5672242",
"0.56643665",
"0.566152",
"0... | 0.7356763 | 0 |
Clear all problems that haven't received a notice in the last month | def execute
nb_problem_resolved.tap do |nb|
if nb > 0
criteria.each do |problem|
ProblemDestroy.new(problem).execute
end
repair_database if @should_repair_database
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_checks\n @free_checks_available = FREE_CHECKS_PER_MONTH\n end",
"def clean!\n @changes = []\n end",
"def meet_requests_to_remove\n MeetRequest.outdated\n end",
"def clean_all\n\t\t\t\t\t@messages = []\n\t\t\t\tend",
"def cleanup\n @period = :monthly\n @ranged = nil\n ... | [
"0.6259963",
"0.58556885",
"0.58383274",
"0.5811753",
"0.57872635",
"0.5729074",
"0.5709205",
"0.5708807",
"0.5666455",
"0.56279886",
"0.56132853",
"0.5605442",
"0.55986756",
"0.55870223",
"0.5571116",
"0.5566006",
"0.54747933",
"0.54731697",
"0.5467162",
"0.5465526",
"0.5450... | 0.0 | -1 |
I spent [] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? The input is a positive integer of any length What is the output? (i.e. What should the cod... | def separate_comma(i)
if i <=3
return i
else new_i = i.to_s.reverse
arr = []
until new_i.empty?
arr << new_i.slice!(0..2)
end
return arr.join(",").reverse
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def separate_comma(integer)\n if integer >= 1000\n number_array = integer.to_s.split(\"\").reverse\n counter = 0\n array_for_reverse = []\n number_array.each do |digit|\n if counter % 3 == 0 && counter != 0\n array_for_reverse << \",\"\n end\n array_for_reverse << digit\n co... | [
"0.75382453",
"0.7442818",
"0.74128217",
"0.73936963",
"0.723494",
"0.72077423",
"0.72042835",
"0.7171357",
"0.71658224",
"0.71433365",
"0.7092397",
"0.7087647",
"0.7076477",
"0.70371854",
"0.70301336",
"0.70151556",
"0.7011688",
"0.69631636",
"0.69588286",
"0.69540644",
"0.6... | 0.6908555 | 25 |
GET /pds_projects GET /pds_projects.json | def select
@pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listprojects\n get('listprojects.json')['projects']\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def list\n get 'projects'\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n end",
"def projects\n Sifter.\n get(\"/api/pr... | [
"0.831529",
"0.81879324",
"0.7951836",
"0.78653824",
"0.7811529",
"0.7795813",
"0.77781695",
"0.7704259",
"0.76647615",
"0.75547177",
"0.74933964",
"0.7491792",
"0.7480502",
"0.74455553",
"0.74274194",
"0.742593",
"0.7363394",
"0.72883594",
"0.72864294",
"0.72544014",
"0.7245... | 0.0 | -1 |
GET /pds_projects/1 GET /pds_projects/1.json | def show
@project = @pds_project
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listprojects\n get('listprojects.json')['projects']\n end",
"def list\n get 'projects'\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def projects\n resource 'projects'\n end",
"def index\n @projects = Project.all\n render json: @projects, status: :ok\n... | [
"0.78318095",
"0.76996344",
"0.76590514",
"0.7530781",
"0.74550277",
"0.74208766",
"0.73832756",
"0.7360768",
"0.7333007",
"0.7325226",
"0.73196846",
"0.73106414",
"0.7275311",
"0.72697043",
"0.72697043",
"0.72697043",
"0.72697043",
"0.72697043",
"0.72697043",
"0.72697043",
"... | 0.0 | -1 |
POST /pds_projects POST /pds_projects.json | def create
@pds_project = PdsProject.new(pds_project_params)
respond_to do |format|
if @pds_project.save
format.html { redirect_to @pds_project, notice: 'Pds project was successfully created.' }
format.json { render :show, status: :created, location: @pds_project }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @urlroot = Designax::Application.config.urlroot\n if params[:pk] == \"new\" and params[:name] == \"project_name\"\n project_name = params[:value]\n @project = Project.new()\n @project.project_name = project_name\n else\n @project = Project.new(params[:project])\n end\n\... | [
"0.68175036",
"0.6809611",
"0.6790009",
"0.6753449",
"0.67296743",
"0.6707613",
"0.6647902",
"0.6619203",
"0.65967995",
"0.656886",
"0.65593016",
"0.6558177",
"0.65379345",
"0.6523073",
"0.65181285",
"0.65129536",
"0.65024114",
"0.6501721",
"0.64832205",
"0.6477203",
"0.64752... | 0.7189148 | 0 |
PATCH/PUT /pds_projects/1 PATCH/PUT /pds_projects/1.json | def update
respond_to do |format|
if @pds_project.update(pds_project_params)
format.html { redirect_to @pds_project, notice: 'Pds project was successfully updated.' }
format.json { render :show, status: :ok, location: @pds_project }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\t\t\t\t\t\t\t\t\t# Actually modifies the data and redirects (probably to index or show? depends)\n\t\t#@projec... | [
"0.7021489",
"0.69629997",
"0.6934891",
"0.68998516",
"0.68991417",
"0.6897245",
"0.6851841",
"0.6836478",
"0.68217784",
"0.6789663",
"0.67890453",
"0.6784623",
"0.67801183",
"0.67772514",
"0.67706347",
"0.6766306",
"0.6764884",
"0.67627174",
"0.6758651",
"0.6752676",
"0.6749... | 0.700689 | 1 |
DELETE /pds_projects/1 DELETE /pds_projects/1.json | def destroy
@pds_project.destroy
respond_to do |format|
format.html { redirect_to pds_projects_url, notice: 'Pds project was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n ... | [
"0.7474952",
"0.7335166",
"0.7335166",
"0.73300433",
"0.7329144",
"0.73261297",
"0.73232836",
"0.7308778",
"0.7308702",
"0.728972",
"0.7288949",
"0.72881204",
"0.72839457",
"0.72661895",
"0.72606134",
"0.7251296",
"0.72509366",
"0.72509366",
"0.72509366",
"0.72509366",
"0.725... | 0.74919176 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_pds_project
@pds_project = PdsProject.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def pds_project_params
params.require(:pds_project).permit(:project_number, :project_name, :project_name_EN, :Contractor, :companyID, :contract_number, :contract_date, :ProjectManager, :SWManager, :HWManager, :Factor, :Description, :Description_EN, :Notes, :BlobObj, :t, :contract_end_date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
the following tests are for denver addresses: | def test_inserts_single_csv_address
cma.populate_csv("./test/data/address.csv")
assert_equal 1, cma.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_address_validation\n response = nil\n assert_nothing_raised do\n #response = @carrier_prod.validate_addresses({'address_from' => @locations[:ottawa], 'address_to' => @locations[:beverly_hills]}, :test=>false)\n @carrier_prod.validate_addresses({'address_from' => Location.new(\n ... | [
"0.7312771",
"0.71737814",
"0.6982747",
"0.6897654",
"0.6862925",
"0.6855137",
"0.6829323",
"0.6806462",
"0.67870593",
"0.6748364",
"0.671126",
"0.6654471",
"0.6644899",
"0.6626993",
"0.6615754",
"0.6609097",
"0.66003436",
"0.6584004",
"0.6570027",
"0.6555618",
"0.6543278",
... | 0.0 | -1 |
the following are methods used within above tests: | def insert_words(words)
cm.populate(words.join("\n"))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def spec; end",
"def spec; end",
"def testing\n # ...\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; e... | [
"0.70311743",
"0.6887917",
"0.6887917",
"0.6756364",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
"0.67123556",
... | 0.0 | -1 |
GET /recipies GET /recipies.json | def index
@recipies = Recipy.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @recipies }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @recipy = Recipy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipy }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @disciplines = Discipline.all... | [
"0.6998507",
"0.64873695",
"0.6066693",
"0.5742134",
"0.5710294",
"0.5710109",
"0.5650806",
"0.56349534",
"0.5620779",
"0.560737",
"0.5598777",
"0.5568325",
"0.5557378",
"0.554794",
"0.55220836",
"0.5519973",
"0.55071205",
"0.548744",
"0.5472192",
"0.54654396",
"0.54523784",
... | 0.7690944 | 0 |
GET /recipies/1 GET /recipies/1.json | def show
@recipy = Recipy.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @recipy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def new\n @recipy = Recipy.new\n 2.times {@recip... | [
"0.7576407",
"0.6384861",
"0.5917361",
"0.5870566",
"0.58123845",
"0.56674695",
"0.5659419",
"0.56354177",
"0.5632687",
"0.5627602",
"0.56197435",
"0.5600415",
"0.5526415",
"0.5509085",
"0.54997754",
"0.5484542",
"0.5483383",
"0.5459958",
"0.5457376",
"0.5453616",
"0.5449483"... | 0.741517 | 1 |
GET /recipies/new GET /recipies/new.json | def new
@recipy = Recipy.new
2.times {@recipy.ingridients.build}
@items = Item.all
respond_to do |format|
format.html # new.html.erb
format.json { render json: @recipy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @recipy = Recipy.new(params[:recipy])\n\n respond_to do |format|\n if @recipy.save\n format.html { redirect_to @recipy, notice: 'Recipy was successfully created.' }\n format.json { render json: @recipy, status: :created, location: @recipy }\n else\n format.html { r... | [
"0.68652266",
"0.6774491",
"0.67652625",
"0.6741197",
"0.6724361",
"0.6678545",
"0.6643848",
"0.66364515",
"0.66344965",
"0.6625252",
"0.6611328",
"0.65841526",
"0.6583246",
"0.6583246",
"0.6583246",
"0.6583246",
"0.6583246",
"0.6571214",
"0.65631384",
"0.6557421",
"0.6542122... | 0.7370589 | 0 |
POST /recipies POST /recipies.json | def create
@recipy = Recipy.new(params[:recipy])
respond_to do |format|
if @recipy.save
format.html { redirect_to @recipy, notice: 'Recipy was successfully created.' }
format.json { render json: @recipy, status: :created, location: @recipy }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def new\n @recipy = Recipy.new\n 2.times {@recipy.ingridients.build}\n @items = Item.all\n\n respond_to do |format|\n format.ht... | [
"0.61748314",
"0.6143452",
"0.55477095",
"0.53410554",
"0.5334347",
"0.5280828",
"0.52225685",
"0.5206018",
"0.51948726",
"0.5156756",
"0.5146418",
"0.5137598",
"0.5110531",
"0.50218195",
"0.50170857",
"0.50139844",
"0.50081974",
"0.5004564",
"0.49929726",
"0.49788946",
"0.49... | 0.6895841 | 0 |
PUT /recipies/1 PUT /recipies/1.json | def update
@recipy = Recipy.find(params[:id])
respond_to do |format|
if @recipy.update_attributes(params[:recipy])
format.html { redirect_to @recipy, notice: 'Recipy was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n update_resource @ride, ride_params\n end",
"def create\n @recipy = Recipy.new(params[:recipy])\n\n respond_to do |format|\n if @recipy.save\n format.html { redirect_to @recipy, notice: 'Recipy was successfully created.' }\n format.json { render json: @recipy, status: :cr... | [
"0.60382736",
"0.6026295",
"0.5842325",
"0.5771993",
"0.57327783",
"0.5715103",
"0.5606009",
"0.55965894",
"0.5594826",
"0.5592275",
"0.5549429",
"0.54436445",
"0.5392838",
"0.5375316",
"0.5371105",
"0.5355507",
"0.5350915",
"0.5337339",
"0.5330224",
"0.5329973",
"0.5321193",... | 0.6898985 | 0 |
DELETE /recipies/1 DELETE /recipies/1.json | def destroy
@recipy = Recipy.find(params[:id])
@recipy.destroy
respond_to do |format|
format.html { redirect_to recipies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}... | [
"0.6469765",
"0.6456526",
"0.64089674",
"0.63885456",
"0.6386168",
"0.6378094",
"0.6358284",
"0.6350313",
"0.63496655",
"0.6340431",
"0.6327191",
"0.6321261",
"0.63206005",
"0.6313384",
"0.63120633",
"0.6307115",
"0.6295049",
"0.6285466",
"0.62843084",
"0.62824243",
"0.628068... | 0.7855129 | 0 |
add the rest of the tokens needed based on the grammar specified in the Scanner class "TinyScanner.rb" | def initialize(type,text)
@type = type
@text = text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 59)\n\n type = TOKENS\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 596:4: 'tokens' WS_LOOP '{'\n match(\"tokens\")\n ws_loop!\... | [
"0.6998206",
"0.66701525",
"0.6666354",
"0.6609052",
"0.64645815",
"0.63879263",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63688225",
"0.63217944",
"0.6310536",
"0.6294005",
"0.6276699",
"0.625874",
"0.62541044",
"0.6... | 0.0 | -1 |
Shortcut method to retrieve the ArtRest::System::GeneralConfiguration resource. Args : +base_url+ > Our Artifactory server's base URL +options+ > A Hash containing username and password Returns : The ArtRest::System::GeneralConfiguration resource | def get(base_url, options)
System::GeneralConfiguration.new("#{base_url}/api/system/configuration", options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def configuration(options = {})\n client = extract_client!(options)\n response = client.get(\"/api/system/configuration\")\n\n REXML::Document.new(response)\n end",
"def general\... | [
"0.64384955",
"0.6317477",
"0.6116116",
"0.60202533",
"0.59212655",
"0.5717997",
"0.56805086",
"0.5674194",
"0.5628669",
"0.5623111",
"0.5582134",
"0.5582134",
"0.5561507",
"0.555718",
"0.5520039",
"0.55003524",
"0.54811376",
"0.54639333",
"0.54636115",
"0.5448011",
"0.544395... | 0.8319394 | 0 |
GET /idti_services GET /idti_services.json | def index
@idti_services = IdtiService.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def find_service(id)\n self.class.get(\"/services/#{id}.json?api... | [
"0.7570144",
"0.7217119",
"0.7086521",
"0.7005357",
"0.6938271",
"0.68722737",
"0.68313646",
"0.6829849",
"0.665807",
"0.6591357",
"0.6523576",
"0.6509392",
"0.6509054",
"0.64190966",
"0.63895744",
"0.6346079",
"0.6336978",
"0.6334543",
"0.6289801",
"0.62849414",
"0.62629324"... | 0.75676835 | 1 |
GET /idti_services/1 GET /idti_services/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def index\n @idti_services = IdtiService.all\n end",
"def find_service(id)\n self.class.get(\"/services/#{id}.json?apikey=#{apikey}\")\n end",
"def set_idti_service\n @idti_service = IdtiService.find(params[:id])\n end",
"... | [
"0.79000086",
"0.73218745",
"0.7309297",
"0.71197844",
"0.6984323",
"0.68411064",
"0.6836252",
"0.6713661",
"0.66853446",
"0.66248626",
"0.6583308",
"0.6482128",
"0.6470543",
"0.64606506",
"0.6406949",
"0.6339627",
"0.6330011",
"0.6271778",
"0.6271778",
"0.6271778",
"0.626426... | 0.0 | -1 |
POST /idti_services POST /idti_services.json | def create
@idti_service = IdtiService.new(idti_service_params)
respond_to do |format|
if @idti_service.save
format.html { redirect_to @idti_service, notice: 'Idti service was successfully created.' }
format.json { render :show, status: :created, location: @idti_service }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_service(service={})\n request :post, '/services', service\n end",
"def set_idti_service\n @idti_service = IdtiService.find(params[:id])\n end",
"def idti_service_params\n params.require(:idti_service).permit(:name, :industry, :center_id)\n end",
"def service(id)\n request :get, \"/serv... | [
"0.67592144",
"0.6671625",
"0.6197228",
"0.61765784",
"0.61121035",
"0.6109973",
"0.609321",
"0.60023594",
"0.59880805",
"0.59713936",
"0.5938975",
"0.59128875",
"0.58882135",
"0.58773327",
"0.58754617",
"0.5875354",
"0.5863232",
"0.5841797",
"0.5794558",
"0.57933575",
"0.578... | 0.75517434 | 0 |
PATCH/PUT /idti_services/1 PATCH/PUT /idti_services/1.json | def update
respond_to do |format|
if @idti_service.update(idti_service_params)
format.html { redirect_to @idti_service, notice: 'Idti service was successfully updated.' }
format.json { render :show, status: :ok, location: @idti_service }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_service(id, options={})\n self.class.put(\"/services/#{id}.json?apikey=#{apikey}\", :query => {:service => options}, :body => {})\n end",
"def update\n remove_extra_value_from_hash(request.params,params[:service][:ccs_service_id])\n respond_to do |format|\n if @service.update(se... | [
"0.6739807",
"0.63526994",
"0.6295682",
"0.6295682",
"0.625702",
"0.6231123",
"0.6203511",
"0.6202032",
"0.61410385",
"0.6125608",
"0.6100439",
"0.6100439",
"0.6094504",
"0.6092725",
"0.6092725",
"0.60919285",
"0.60901755",
"0.6069289",
"0.6060623",
"0.6014431",
"0.600568",
... | 0.7053659 | 0 |
DELETE /idti_services/1 DELETE /idti_services/1.json | def destroy
@idti_service.destroy
respond_to do |format|
format.html { redirect_to idti_services_url, notice: 'Idti service was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(id)\n @service.delete(id)\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_t... | [
"0.7298449",
"0.7224648",
"0.7002146",
"0.69157505",
"0.68961215",
"0.68961215",
"0.68961215",
"0.6840532",
"0.6789166",
"0.6760826",
"0.67372745",
"0.671231",
"0.670822",
"0.6704722",
"0.6682979",
"0.6675785",
"0.66731834",
"0.66731834",
"0.66731834",
"0.6670636",
"0.6650553... | 0.7521018 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_idti_service
@idti_service = IdtiService.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def idti_service_params
params.require(:idti_service).permit(:name, :industry, :center_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /mailinglists/new GET /mailinglists/new.xml | def new
@mailinglist = Mailinglist.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mailinglist }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @mailing_list = MailingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mailing_list }\n end\n end",
"def new\n @email_list = EmailList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :x... | [
"0.7216693",
"0.7089765",
"0.69543743",
"0.6943103",
"0.675538",
"0.6719968",
"0.66498023",
"0.66247535",
"0.6546851",
"0.6545954",
"0.6526174",
"0.64844614",
"0.6471273",
"0.64395523",
"0.64369106",
"0.64353406",
"0.64114165",
"0.63788277",
"0.63591003",
"0.63543755",
"0.634... | 0.79031485 | 0 |
POST /mailinglists POST /mailinglists.xml | def create
@mailinglist = Mailinglist.new(params[:mailinglist])
respond_to do |format|
if @mailinglist.save
flash[:notice] = ''
format.html { redirect_to :controller => "home", :action => "gracias_mailinglist" }
format.xml { render :xml => @mailinglist, :status => :created, :loca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @mailing_list = MailingList.new(params[:mailing_list])\n\n respond_to do |format|\n if @mailing_list.save\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully created.' }\n format.json { render json: @mailing_list, status: :created, location: @mail... | [
"0.6663793",
"0.62725",
"0.6149709",
"0.6137611",
"0.6027844",
"0.6016935",
"0.5918023",
"0.58790636",
"0.5814525",
"0.581118",
"0.5807371",
"0.5774431",
"0.5763137",
"0.5761715",
"0.5683854",
"0.568366",
"0.5664408",
"0.56601226",
"0.5645518",
"0.5631441",
"0.5625207",
"0.... | 0.6807891 | 0 |
PUT /mailinglists/1 PUT /mailinglists/1.xml | def update
@mailinglist = Mailinglist.find(params[:id])
respond_to do |format|
if @mailinglist.update_attributes(params[:mailinglist])
flash[:notice] = 'Mailinglist was successfully updated.'
format.html { redirect_to(@mailinglist) }
format.xml { head :ok }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n if @mailing_list.update_attributes(params[:mailing_list])\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.6706949",
"0.65001416",
"0.6467532",
"0.6116687",
"0.60946196",
"0.60663426",
"0.6062383",
"0.6051192",
"0.6032332",
"0.6025619",
"0.59590065",
"0.5943985",
"0.59291786",
"0.59054255",
"0.590168",
"0.5836066",
"0.5825475",
"0.5797129",
"0.57861936",
"0.5775258",
"0.5763768... | 0.69465536 | 0 |
DELETE /mailinglists/1 DELETE /mailinglists/1.xml | def destroy
@mailinglist = Mailinglist.find(params[:id])
@mailinglist.destroy
respond_to do |format|
format.html { redirect_to(mailinglists_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mailing_list = MailingList.find(params[:id])\n @mailing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to mailing_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_list = EmailList.find(params[:id])\n @email_list.destr... | [
"0.7158792",
"0.70401376",
"0.6964492",
"0.68765527",
"0.6782538",
"0.6689531",
"0.6668699",
"0.6583591",
"0.65445065",
"0.6540138",
"0.6515136",
"0.6515136",
"0.64878255",
"0.64801145",
"0.64717984",
"0.6464227",
"0.6456155",
"0.6439853",
"0.6429376",
"0.63597995",
"0.632246... | 0.7700175 | 0 |
Add rectangle filled with given color. Give color in RGB hex format (e.g. '558ed5') | def add_filled_rectangle(transform, color)
shape = Shapes::FilledRectangle.new(transform, color)
shape_tree_xml.add_child(shape.build_node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_color(color)\n end",
"def fill_rectangle(x:, y:, width:, height:, color: nil, colour: nil)\n clr = color || colour\n clr = Color.new(clr) unless clr.is_a? Color\n ext_fill_rectangle([\n x, y, width, height,\n clr.r, clr.g, clr.b, clr.... | [
"0.728461",
"0.7029736",
"0.6633887",
"0.65893495",
"0.6556681",
"0.6507423",
"0.64792436",
"0.647149",
"0.63753384",
"0.63341445",
"0.630612",
"0.6277825",
"0.62712604",
"0.6252177",
"0.6238205",
"0.61952096",
"0.6190314",
"0.6180056",
"0.617455",
"0.61741966",
"0.6169861",
... | 0.730227 | 0 |
Add a text box at the given position with the given dimensions Pass distance values in EMUs (use PPTX::CM) Formatting values a are mostly raw OOXML Text Run Properties (rPr) element attributes. Examples: sz: font size (use PPTX::POINT) b: 1 for bold i: 1 for italic There are two custom properties: color: aabbcc (hex RG... | def add_textbox(transform, content, formatting={})
shape = Shapes::Textbox.new(transform, content, formatting)
shape_tree_xml.add_child(shape.build_node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vms_text_box(text, x, y, width, height, size = 10, style = :normal, align = :center, valign = :center, font_family = nil, font_color = nil)\n font_family = @standard_font if font_family.nil?\n font_color = @standard_color if font_color.nil?\n font(font_family,\n style: style)\n... | [
"0.65635145",
"0.6176465",
"0.6001725",
"0.58759356",
"0.566865",
"0.5641192",
"0.55926037",
"0.5572393",
"0.55549765",
"0.55177706",
"0.5485109",
"0.54719687",
"0.54687357",
"0.5444193",
"0.5423011",
"0.5397893",
"0.53502786",
"0.5337213",
"0.53195715",
"0.53195715",
"0.5317... | 0.55505455 | 9 |
Add a slide number that is recognized by Powerpoint as such and automatically updated See textbox for formatting. | def add_slide_number(transform, number, formatting={})
shape = Shapes::SlideNumber.new(transform, number, formatting)
shape_tree_xml.add_child(shape.build_node)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_next_slide\n if self.sequence-1>=1\n @slide=Slide.find_by_sequence_and_presentation_id(self.sequence-1,self.presentation_id)\n @slide.next_slide=self.id\n @slide.save\n end\n end",
"def next_slide()\n if @current_slide < @total_slides - 1\n @current_slide += 1\n ... | [
"0.6058388",
"0.6048339",
"0.60048616",
"0.57961816",
"0.5611455",
"0.55912995",
"0.55912524",
"0.55912524",
"0.55912524",
"0.55912524",
"0.55912524",
"0.5581441",
"0.5524407",
"0.5510513",
"0.55065244",
"0.5495008",
"0.54587394",
"0.5457788",
"0.5448342",
"0.5446388",
"0.541... | 0.7364818 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:name, :email, :password, :password_confirmation, :role, :description, :birthdate, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Attempts to locate the specified JAR(s) and require them. First we try to load the jar with the current load path, as this allows a library user to control where the JARs should be loaded from by setting the classpath or JRuby load path. Only if that fails do we fallback to attempting to locate the JARs on our own. | def load_jars(*jars)
jars.each do |jar|
unless $LOADED_FEATURES.find{ |f| f =~ Regexp.new(jar) }
log.finest "Loading jar #{jar}..."
begin
loaded = require(jar)
rescue LoadError
loaded = find_jar(jar)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_jars(paths)\n paths = [paths] unless paths.is_a?(Array)\n paths.each do |path|\n jar_pattern = File.join(path,\"**\", \"*.jar\")\n Dir[jar_pattern].each {|jar_file| require jar_file}\n end\n end",
"def require_jars!\n require 'jruby'\n\n # ask marc-marc4j gem to load... | [
"0.7161511",
"0.6990816",
"0.6662479",
"0.57568353",
"0.5586427",
"0.54780054",
"0.54413307",
"0.5300394",
"0.5246258",
"0.52318335",
"0.5224619",
"0.52161294",
"0.51305294",
"0.5060403",
"0.5057542",
"0.5014153",
"0.49974746",
"0.49606624",
"0.492621",
"0.49210948",
"0.49108... | 0.7490715 | 0 |
Find the specified jar using EPM_ORACLE_HOME as a starting point. | def find_jar(jar)
oh = java.lang.System.getProperty('EPM_ORACLE_HOME') || ENV['EPM_ORACLE_HOME']
unless oh
raise ConfigurationError, "No EPM_ORACLE_HOME defined. Set this as an environment " +
"variable or Java system property, or else add #{jar} to the classpath."
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crypto_jar_internal_path(jar)\n libs = jar_contents(jar).scan(\n %r{\n (?<=\\ )resources\\/.*\n (?<=\\/[0-9])\\/\n com\\.adobe\\.granite\\.crypto-[0-9]+\\.[0-9]+\\.[0-9]+[^\\.]*\\.jar$\n }x\n ).flatten\n\n raise(\"Found #{libs}, but single JAR file is exp... | [
"0.52112955",
"0.50324905",
"0.50005776",
"0.49905255",
"0.49770632",
"0.47981218",
"0.4769342",
"0.4737513",
"0.47250757",
"0.47216392",
"0.46955243",
"0.46913755",
"0.46253562",
"0.46114773",
"0.45772356",
"0.45556873",
"0.45453432",
"0.45280096",
"0.44936666",
"0.44871122",
... | 0.7973658 | 0 |
helper to create sample controlled vocab | def create_sample_controlled_vocab_terms_attributes(array)
attributes = []
array.each do |type|
attributes << { label: type }
end
attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate\n vocab_word = VocabWord.offset(rand(VocabWord.count)).first\n self.vocab_word = vocab_word\n VocabWord.with_same_type_as(vocab_word).except(vocab_word).sample(3).each do |word|\n self.choices << Choice.new(vocab_word: word)\n end\n self.choices << Choice.new(vocab_word: vocab_word... | [
"0.6313859",
"0.6298697",
"0.62593704",
"0.6141344",
"0.6062678",
"0.60039735",
"0.59675443",
"0.5906848",
"0.58850807",
"0.58275014",
"0.58135444",
"0.5797971",
"0.57460606",
"0.57352215",
"0.5706381",
"0.5670002",
"0.56602347",
"0.5626333",
"0.56151956",
"0.5575743",
"0.555... | 0.7020372 | 0 |
To add a new set of CV: example_cv = SampleControlledVocab.where(title: 'CV Title').first_or_create!( sample_controlled_vocab_terms_attributes: create_sample_controlled_vocab_terms_attributes(['CV 1', 'CV 2', 'CV 3']) ) Can later be used like that: create_custom_metadata_attribute(title: 'CM Metadata attribute using CV... | def create_custom_metadata_attribute(title:, required:, sample_attribute_type:, sample_controlled_vocab: nil)
CustomMetadataAttribute.where(title).create!(title: title, required: required,
sample_attribute_type: sample_attribute_type,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end",
"def ... | [
"0.5886217",
"0.5410165",
"0.5382338",
"0.5370302",
"0.5315625",
"0.52793854",
"0.52603185",
"0.5190098",
"0.5127211",
"0.5086911",
"0.50264484",
"0.49350277",
"0.4910407",
"0.48835465",
"0.48812354",
"0.48718685",
"0.48716813",
"0.48376575",
"0.4829535",
"0.4800634",
"0.4800... | 0.6774687 | 0 |
True if user is admin | def admin?
self.user_type == TYPES[:admin]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin?(user)\n user.admin > 0\n end",
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin?\n user = check_user\n user.role == User.role_types['Admin']\n ... | [
"0.89590496",
"0.88395226",
"0.88360894",
"0.88195956",
"0.8803838",
"0.87988275",
"0.878661",
"0.87481356",
"0.8745435",
"0.8744481",
"0.8739184",
"0.8730605",
"0.87143916",
"0.8711974",
"0.8701125",
"0.8693897",
"0.86879534",
"0.86635745",
"0.86584145",
"0.8654025",
"0.8647... | 0.86369425 | 21 |
True if user needs to assign a password | def needs_password?
self.new_record? || !self.password.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_required?\n @password_required\n end",
"def password_required?\n new? or password\n end",
"def password_required?\n false\n end",
"def password_required?\n false\n end",
"def password_required?\n new? or password\n end",
"def require_password?\n if ... | [
"0.82313204",
"0.820387",
"0.8080308",
"0.8080308",
"0.8077631",
"0.8002306",
"0.79951763",
"0.7974607",
"0.79582846",
"0.7943024",
"0.7884861",
"0.7873581",
"0.7873581",
"0.7873581",
"0.7873581",
"0.7873581",
"0.78689396",
"0.78552",
"0.7854832",
"0.7843229",
"0.78312784",
... | 0.7906251 | 11 |
Returns the full_name of the user | def full_name
"#{self.name} #{self.surname}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end",
"def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end",
"def full_name\n name = `fi... | [
"0.90090275",
"0.8722045",
"0.8691011",
"0.8684423",
"0.86262244",
"0.8503864",
"0.8478818",
"0.84257406",
"0.841513",
"0.84124637",
"0.8406687",
"0.8395993",
"0.8386591",
"0.8376731",
"0.83334875",
"0.83253425",
"0.8306719",
"0.8272479",
"0.81823003",
"0.81812274",
"0.812935... | 0.0 | -1 |
Validates that the email is unique per active users | def email_is_unique
active_users = User.active.where(:email => self.email)
active_users = active_users.exclude(self) unless self.new_record?
errors.add :email, 'ya existe' if active_users.count(:id) > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_email_user\n if self.class.where(email: email).count > 0\n errors.add(:email, :taken)\n end\n end",
"def email_must_be_unique\n if ((Organization.where(['email = ? AND id <> ?', self.email, self.id]).count > 0) or\n (Volunteer.where(['email = ?', self.email]).count > 0))\n\n ... | [
"0.8175742",
"0.7666619",
"0.75381094",
"0.73757344",
"0.7350498",
"0.731147",
"0.697236",
"0.6911994",
"0.6850418",
"0.6778837",
"0.6710761",
"0.6627234",
"0.66154826",
"0.6558671",
"0.6558051",
"0.6499699",
"0.6456191",
"0.64501834",
"0.6434129",
"0.6418474",
"0.6394954",
... | 0.84899336 | 0 |
GET /services GET /services.json | def index
if current_user.role? :monitorista
@services = Service.all
else
@services = Service.where(user_id: current_user.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end",
"def services\n ... | [
"0.7777552",
"0.777449",
"0.7438209",
"0.73864925",
"0.7264791",
"0.7223465",
"0.7217482",
"0.70817554",
"0.69659567",
"0.6894663",
"0.6884723",
"0.6880644",
"0.6869151",
"0.68193513",
"0.679946",
"0.6788263",
"0.6788263",
"0.6788263",
"0.67320096",
"0.6664671",
"0.6650039",
... | 0.0 | -1 |
GET /services/1 GET /services/1.json | def show
@service = Service.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json {
render :json => @service.to_json(:methods => [:polyline],:only => [:shipment])
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n ... | [
"0.75270754",
"0.7477992",
"0.71894914",
"0.7102449",
"0.7099407",
"0.7099407",
"0.7099407",
"0.7096293",
"0.6959161",
"0.6950294",
"0.6931149",
"0.68634444",
"0.6851751",
"0.68342865",
"0.6784193",
"0.6777289",
"0.6684241",
"0.6634103",
"0.658715",
"0.65441275",
"0.6543152",... | 0.0 | -1 |
POST /services POST /services.json | def create
@service = Service.new(service_params)
params[:service][:shipments_attributes].each do |k,ship|
ship.each do |k,device|
if k.to_s[/device_ids.*/]
device.each{|d| d.blank? ? d:Device.find(d).update(:assigned=>true)}
end
end
end
respond_to do |format|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_service(service={})\n request :post, '/services', service\n end",
"def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n e... | [
"0.7436081",
"0.7211055",
"0.6789605",
"0.6685143",
"0.66684335",
"0.6627667",
"0.6627667",
"0.659236",
"0.659236",
"0.659236",
"0.659236",
"0.659236",
"0.659236",
"0.65912724",
"0.65503854",
"0.6500538",
"0.6461458",
"0.6458402",
"0.6452619",
"0.64504534",
"0.64292943",
"0... | 0.0 | -1 |
PATCH/PUT /services/1 PATCH/PUT /services/1.json | def update
respond_to do |format|
if @service.update(service_params)
format.html { redirect_to @service, notice: 'Service was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @service.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n service.update(service_params)\n\n respond_with(service)\n end",
"def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def update\n ... | [
"0.665279",
"0.6637126",
"0.649423",
"0.6430556",
"0.6430556",
"0.64204186",
"0.6397555",
"0.62501574",
"0.6246304",
"0.6246304",
"0.62337315",
"0.62241524",
"0.62231463",
"0.62122774",
"0.62115115",
"0.6205756",
"0.61736095",
"0.61736095",
"0.61736095",
"0.61736095",
"0.6173... | 0.63450557 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.