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 |
|---|---|---|---|---|---|---|
Provide dotnotation for querying a given field in a hash | def get(field)
self.class.get(field, @data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hget(key, field); end",
"def hget(key, field); end",
"def [](key); @data[\"@fields\"][key] end",
"def [](name_or_sym_or_field)\n return field_reference[:attr_syms ][name_or_sym_or_field] if @field_map[:attr_syms ].has_key?(name_or_sym_or_field)\n return field_reference[:ui_labels ][name_... | [
"0.6513315",
"0.6513315",
"0.6140465",
"0.608292",
"0.60823107",
"0.6074198",
"0.60019165",
"0.59801096",
"0.59112257",
"0.59112257",
"0.5903261",
"0.58459395",
"0.58398944",
"0.57936364",
"0.57936364",
"0.5762117",
"0.57412",
"0.57407683",
"0.5733737",
"0.5733721",
"0.573181... | 0.51167625 | 86 |
the reports are defined below, call them here | def health(result)
[
file_descriptor_health(result),
heap_health(result),
inflight_events_health(result),
config_reload_health(result),
cpu_usage_health(result)
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report\n \n end",
"def report\n\t\tend",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def reporters; end",
"def set_report\n end",
"def repor... | [
"0.8163039",
"0.8163039",
"0.8163039",
"0.8163039",
"0.8163039",
"0.78186905",
"0.7806983",
"0.7634999",
"0.7634999",
"0.7634999",
"0.7634999",
"0.7634999",
"0.747564",
"0.7172527",
"0.70665944",
"0.70599747",
"0.70109004",
"0.69881946",
"0.69478065",
"0.690919",
"0.68937624"... | 0.0 | -1 |
timing from timing, but in miliseconds as int | def timing_ms
return nil if timing.nil?
(timing * 1000).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toMillis(time); (time.to_f * 1000).to_i end",
"def to_i\n return @tv_sec\n end",
"def to_i\n ( @msecs / SEC_TO_MS ).to_i\n end",
"def ms\n ((duration * 1000.0) + 0.4999).to_i\n end",
"def toMillis(time)\n (time.to_f * 1000).to_i\n end",
"def conv_to_ms(time)\n time.to_i * 100... | [
"0.76771617",
"0.7437365",
"0.7434122",
"0.7271383",
"0.71799505",
"0.7130562",
"0.70172995",
"0.6938291",
"0.6929284",
"0.6929284",
"0.69255435",
"0.69114655",
"0.6880989",
"0.68776226",
"0.6858582",
"0.6856748",
"0.6852783",
"0.6784135",
"0.6771234",
"0.67615694",
"0.675947... | 0.7859509 | 0 |
Returns a BentoSearch::Results::Pagination, that should be suitable for passing right to Kaminari (although Kaminari isn't good about doc/specing it's api, so might break), or convenient methods for your own custom UI. | def pagination
Pagination.new( total_items, search_args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate(options={})\n populate_pagination_attributes_from_options(options)\n limit(per_page)\n offset((page - 1) * per_page)\n self\n end",
"def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n req... | [
"0.7002864",
"0.692399",
"0.6922977",
"0.69188535",
"0.69029593",
"0.68638366",
"0.68592197",
"0.6752563",
"0.673639",
"0.67318875",
"0.6716958",
"0.67121804",
"0.67104745",
"0.66515446",
"0.6626498",
"0.6618475",
"0.65415335",
"0.6523257",
"0.649676",
"0.6495882",
"0.6494747... | 0.78444946 | 0 |
Builds the UPS track request XML | def build
add_access_request
add_track_request
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end",
"def build_request\n b = builder\n xml = b.TrackReque... | [
"0.8409703",
"0.7598848",
"0.7558859",
"0.6803268",
"0.6791081",
"0.67383367",
"0.6463479",
"0.63313615",
"0.626974",
"0.6140423",
"0.5849358",
"0.58045816",
"0.58000916",
"0.57798904",
"0.5768779",
"0.575665",
"0.5745359",
"0.56893253",
"0.56817013",
"0.56251",
"0.5625088",
... | 0.56854767 | 18 |
Adds the user credentials to the XML | def add_access_request
builder.AccessRequest do |ar|
ar.AccessLicenseNumber key
ar.UserId user_id
ar.Password password
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_user_info(username, xml); end",
"def append_user_info(username, xml)\n end",
"def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n ... | [
"0.7695233",
"0.74894786",
"0.6770173",
"0.6685865",
"0.6685865",
"0.66853124",
"0.66234434",
"0.6519485",
"0.6301698",
"0.62635404",
"0.6209953",
"0.6000035",
"0.5964191",
"0.5964191",
"0.5917635",
"0.5852695",
"0.5841391",
"0.57159114",
"0.56562644",
"0.5632684",
"0.5632629... | 0.0 | -1 |
Adds the track request and package id to the XML | def add_track_request
builder.TrackRequest do |tr|
tr.Request do |r|
r.RequestAction 'Track'
r.RequestOption 'activity'
end
tr.TrackingNumber package_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tracking_xml_request\n xml = \"\"\n\n builder = ::Builder::XmlMarkup.new :target => xml \n builder.TrackRequest :USERID => config.user_id do |t|\n t.TrackID :ID => package_id\n end\n\n xml\n end",
"def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n... | [
"0.7677618",
"0.64049155",
"0.63727844",
"0.6119992",
"0.57718766",
"0.575136",
"0.56225926",
"0.54293156",
"0.539019",
"0.537151",
"0.5367615",
"0.5322508",
"0.5283332",
"0.5208822",
"0.5149135",
"0.5122942",
"0.5113031",
"0.5101291",
"0.5068815",
"0.50633854",
"0.5037167",
... | 0.7230143 | 1 |
Return the set of scenario names that match any of the filter tags. | def find_tagged_scenarios(filter_tags)
scenario_names = Set.new
puts "Finding scenarios for tags: #{filter_tags.to_a.join(',')}" if @options.verbose
# Tags are only found on scenarios, not on scenario snapshots.
@xml.css(@@scenario_css).each { |scenario|
scenario_name = scenario.css('> name').first.text
puts "Scenario: #{scenario_name}" if @options.verbose
scenario_tags = Set.new scenario.css('> tags > tag > key').to_ary.map { |element| element.text }
scenario_tags.each { |tag|
puts " tag: #{tag}"
} if @options.verbose
# Save the scenario if has any of the desired tags.
if filter_tags.intersect?(scenario_tags)
puts "Saving!" if @options.verbose
scenario_names.add(scenario_name)
end
}
return scenario_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filtered_features(rollout, feature_names)\n feature_names.select do |feature_name|\n feature = rollout.get(feature_name)\n user_match = params[:user].nil? || feature.users.member?(params[:user])\n group_match = params[:group].nil? || feature.groups.member?(params[:group].to_sym)\n ... | [
"0.6148673",
"0.5996852",
"0.59230363",
"0.588044",
"0.57986975",
"0.5741542",
"0.5741542",
"0.57228947",
"0.56667614",
"0.5648297",
"0.5606047",
"0.5581511",
"0.55743426",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5539368",
"0.5520142",
"0.55033755"... | 0.7191651 | 0 |
Remove the scenario nodes from the XML if they are not in the set of names. | def prune_scenarios(scenarios)
puts "Pruning scenarios" if @options.verbose
@xml.css(@@scenario_css).each { |scenario|
maybe_remove_by_name(scenarios, scenario)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maybe_remove_by_name(names, node)\n name = node.css('> name').first.text\n unless names.include?(name)\n puts \"Removing #{name}\" if @options.verbose\n node.remove\n end\n end",
"def remove_unwanted_nodes!\n # Search for and remove all unwanted nodes\n unwanted_node... | [
"0.6421488",
"0.56612766",
"0.56329477",
"0.5563776",
"0.5466608",
"0.5398912",
"0.53700596",
"0.5368225",
"0.53591275",
"0.5210821",
"0.51593137",
"0.50182086",
"0.5003634",
"0.49909928",
"0.49882585",
"0.49364218",
"0.49134445",
"0.49026427",
"0.48700303",
"0.48643607",
"0.... | 0.67085594 | 0 |
Remove the scenario snapshot nodes from the XML if they are not in the set of names. | def prune_scenario_snapshots(scenarios)
puts "Pruning scenario snapshots" if @options.verbose
@xml.css(@@scenario_snapshot_css).each { |scenario|
maybe_remove_by_name(scenarios, scenario)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_scenarios(scenarios)\n puts \"Pruning scenarios\" if @options.verbose\n @xml.css(@@scenario_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def maybe_remove_by_name(names, node)\n name = node.css('> name').first.text\n unless names.incl... | [
"0.60914105",
"0.58967745",
"0.56786567",
"0.5563567",
"0.54616946",
"0.5207714",
"0.51869094",
"0.5173847",
"0.51720977",
"0.5106251",
"0.50360286",
"0.5019571",
"0.501253",
"0.49688137",
"0.49577254",
"0.4918427",
"0.4905298",
"0.4900966",
"0.4900966",
"0.48483473",
"0.4837... | 0.69846034 | 0 |
Remove the node if its name is not in the set of names | def maybe_remove_by_name(names, node)
name = node.css('> name').first.text
unless names.include?(name)
puts "Removing #{name}" if @options.verbose
node.remove
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def remove_by_name(name)\... | [
"0.6908283",
"0.6833559",
"0.6672077",
"0.6588125",
"0.65815926",
"0.6570124",
"0.6461994",
"0.6332501",
"0.6268391",
"0.6190306",
"0.6138525",
"0.606481",
"0.600416",
"0.59804296",
"0.5978531",
"0.5959963",
"0.59552765",
"0.594098",
"0.59403324",
"0.59398866",
"0.5894887",
... | 0.85201734 | 0 |
Remove any actionwords that are outside of the transitive closure of actionwords used by any scenario. | def prune_actionwords
puts "Pruning actionwords" if @options.verbose
prune_actionwords_by_css(@@scenario_css, @@actionword_css)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(scenario_css, actionword_css)\n # Extend them with actionwords used by other used actionwords.\n used = actionwords_dependencies(actionword_css, used)\... | [
"0.68649906",
"0.66337466",
"0.6424658",
"0.62941176",
"0.6172114",
"0.6169122",
"0.59207404",
"0.58657616",
"0.58453155",
"0.5820251",
"0.58099174",
"0.57677454",
"0.576726",
"0.57628775",
"0.57475144",
"0.57159156",
"0.5669873",
"0.5655601",
"0.56493205",
"0.56476796",
"0.5... | 0.76887316 | 0 |
Remove any actionword snapshots that are outside of the transitive closure of actionword snapshots used by scenario snapshot. | def prune_actionword_snapshots
puts "Pruning actionword snapshots" if @options.verbose
prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_scenario_snapshots(scenarios)\n puts \"Pruning scenario snapshots\" if @options.verbose\n @xml.css(@@scenario_snapshot_css).each { |scenario|\n maybe_remove_by_name(scenarios, scenario)\n }\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n... | [
"0.6792635",
"0.6239948",
"0.5851001",
"0.5826752",
"0.57545805",
"0.55934626",
"0.55515474",
"0.5526933",
"0.5452708",
"0.5410271",
"0.5407932",
"0.53349936",
"0.53194255",
"0.5315133",
"0.5301955",
"0.5291168",
"0.5281954",
"0.5270992",
"0.5254728",
"0.52510095",
"0.5239408... | 0.7840464 | 0 |
Remove any actionwords (or snapshot) that are outside of the transitive closure of actionwords (or snapshots) used by any scenario (or snapshot). The CSS parameters distinguish between regular and snapshot nodes. | def prune_actionwords_by_css(scenario_css, actionword_css)
# Collect the actionwords used by all scenarios.
used = collect_actionwords_used(scenario_css, actionword_css)
# Extend them with actionwords used by other used actionwords.
used = actionwords_dependencies(actionword_css, used)
puts "There are a total of #{used.size} actionwords used" if @options.verbose
# Remove actionwords that are not used at all.
remove_unused_actionwords(actionword_css, used)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionword_snapshots\n puts \"Pruning actionword snapshots\" if @options.verbose\n prune_actionwords_by_css(@@scenario_snapshot_css, @@actionword_snapshot_css)\n end",
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_... | [
"0.79946834",
"0.7345866",
"0.66261476",
"0.61249495",
"0.5825226",
"0.55441695",
"0.5343493",
"0.5292753",
"0.52809054",
"0.5133913",
"0.51336557",
"0.5082633",
"0.50660133",
"0.50631106",
"0.5049368",
"0.50325966",
"0.50088835",
"0.49683133",
"0.49630055",
"0.49398515",
"0.... | 0.6875046 | 2 |
Remove actionwords that are not used at all. | def remove_unused_actionwords(actionword_css, used)
puts "Pruning unused actionwords" if @options.verbose
@xml.css(actionword_css).each { |actionword|
name = actionword_name(actionword)
next if used.include?(name)
puts "Removing actionword #{name}" if @options.verbose
actionword.remove
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def prune_actionwords_by_css(scenario_css, actionword_css)\n # Collect the actionwords used by all scenarios.\n used = collect_actionwords_used(sce... | [
"0.84033304",
"0.73765475",
"0.6942694",
"0.6475218",
"0.6336258",
"0.630052",
"0.6211874",
"0.61870295",
"0.6169382",
"0.6165828",
"0.61352384",
"0.6096829",
"0.60734624",
"0.6053031",
"0.6035455",
"0.5985325",
"0.59657174",
"0.59465915",
"0.5917317",
"0.58991075",
"0.587539... | 0.8296502 | 1 |
Collect the actionwords used by all scenarios. | def collect_actionwords_used(scenario_css, actionword_css)
puts "Collecting actionwords used in any scenario" if @options.verbose
used = Set.new
@xml.css(scenario_css).each { |scenario|
scenario.css('> steps > call').each { |call|
actionword = call_actionword(call)
if used.add?(actionword)
puts "Discovered actionword used by scenario: #{actionword}" if @options.verbose
end
}
}
puts "Collected #{used.size} actionwords used by scenarios" if @options.verbose
return used
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prune_actionwords\n puts \"Pruning actionwords\" if @options.verbose\n prune_actionwords_by_css(@@scenario_css, @@actionword_css)\n end",
"def used_scenarios # :nodoc:\n @used_scenarios ||= []\n @used_scenarios = (@used_scenarios.collect(&:used_scenarios) + @used_scenarios).flatten... | [
"0.6519867",
"0.6182899",
"0.6127681",
"0.58613205",
"0.57795054",
"0.5767499",
"0.5762958",
"0.57237923",
"0.56967515",
"0.56808627",
"0.56432855",
"0.559837",
"0.55878776",
"0.5583826",
"0.5583826",
"0.55816233",
"0.5512266",
"0.5501076",
"0.5497171",
"0.5497114",
"0.546951... | 0.73929775 | 0 |
Extend them with actionwords used by other used actionwords. | def actionwords_dependencies(actionword_css, used)
pass = 0
while true
pass += 1
puts "Finding actionwords used by other actionwords, pass #{pass}" if @options.verbose
more = actionwords_dependencies_once(actionword_css, used)
return used if more.empty?
puts "Found #{more.size} additional actionwords, pass #{pass}" if @options.verbose
used.merge(more)
end
puts "Found no additional actionwords, pass #{pass}" if @options.verbose
return used
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_actions\n super.merge({ \"search\" => \"You search the grimy pool\"\n\n })\n end",
"def append_action actions\n params = {}\n instance_variables.each do | each |\n params[ each.to_s.sub( '@', '' ).to_sym ] = instance_variable_get( each )\n end\n method = \"append... | [
"0.61245245",
"0.6098465",
"0.6014924",
"0.5864513",
"0.5829635",
"0.5822884",
"0.5811096",
"0.5806737",
"0.5778767",
"0.5653884",
"0.56375074",
"0.56196284",
"0.5607628",
"0.55108744",
"0.54634947",
"0.54524875",
"0.54424477",
"0.5416994",
"0.5411146",
"0.5399562",
"0.537187... | 0.56769884 | 9 |
Return actionwords used by any of the specified words. | def actionwords_dependencies_once(actionword_css, used)
more = Set.new
@xml.css(actionword_css).each { |actionword|
name = actionword_name(actionword)
# See if this actionword is used.
next unless used.include?(name)
# See if this actionword calls others.
actionword.css('> steps > call').each { |call|
called_actionword = call_actionword(call)
unless used.include?(called_actionword)
if more.add?(called_actionword)
puts "Discovered actionword used by actionword: #{called_actionword}" if @options.verbose
end
end
}
}
return more
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend",
"def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def words\n terms.collect { |t| t.word }\n end",
"de... | [
"0.72112685",
"0.6747691",
"0.66346747",
"0.6633761",
"0.6623424",
"0.65441126",
"0.6516868",
"0.65078235",
"0.647826",
"0.64744496",
"0.6411992",
"0.6367868",
"0.63501537",
"0.6345962",
"0.6319598",
"0.628229",
"0.6230228",
"0.6198642",
"0.61829686",
"0.61670345",
"0.6147581... | 0.60112655 | 32 |
GET /courses GET /courses.json | def index
@courses = Course.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).or... | [
"0.7943374",
"0.78571063",
"0.7742233",
"0.77291006",
"0.77291006",
"0.769397",
"0.76710325",
"0.7652614",
"0.7529415",
"0.7444514",
"0.74417686",
"0.7399327",
"0.7372976",
"0.73656887",
"0.73555505",
"0.73475164",
"0.73119664",
"0.7271907",
"0.72710526",
"0.72255695",
"0.722... | 0.716966 | 41 |
GET /courses/1 GET /courses/1.json | def show
if current_person.type == 'Teacher'
redirect_to teachers_load_course_url(course_id: params[:id])
else
redirect_to :controller => 'controllername', :action => 'actionname'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do... | [
"0.7639248",
"0.7600732",
"0.7561499",
"0.7498261",
"0.7492566",
"0.7492566",
"0.7460362",
"0.7459336",
"0.7438278",
"0.7280991",
"0.7248682",
"0.7241407",
"0.723878",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.721023",
"0.71961445"... | 0.0 | -1 |
POST /courses POST /courses.json | def create
puts params[:start_date]
@course = Course.new
@course.start_date = params[:start_date]
@course.end_date = params[:end_date]
@course.name = params[:name]
@course.teacher = current_person
if @course.save
render :show, status: :created, location: @course
else
render json: @course.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @cour... | [
"0.76898974",
"0.73798543",
"0.7334656",
"0.72327256",
"0.72273064",
"0.7157716",
"0.7128817",
"0.71268123",
"0.7109645",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.71044004",
"0.7092889",
"0.70824045",
"0.70697033",
"0.7053714",
"0... | 0.0 | -1 |
PATCH/PUT /courses/1 PATCH/PUT /courses/1.json | def update
if @course.update(course_params)
render :show, status: :ok, location: @course
else
render json: @course.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end",
"def update\n @course = Course.find(params[:id])\n respond_to do |format|\n if @course.update(courses_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n f... | [
"0.7237433",
"0.71370995",
"0.712077",
"0.7102229",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7081047",
"0.7052598",
"0.7046341",
"0.6967642",
"0.69664824",
"0.69642204",
"0.6953834",
"0.69491524",
"0.69340473",
"0.692915",
... | 0.683525 | 29 |
DELETE /courses/1 DELETE /courses/1.json | def destroy
@course.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n ... | [
"0.7721861",
"0.7706616",
"0.7706616",
"0.7706616",
"0.7706616",
"0.76949435",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.769475",
"0.7648452",
"0.76395434",
"0.7618923",
"0.7607887",
"0.7589502... | 0.7181132 | 92 |
Use callbacks to share common setup or constraints between actions. | def set_course
@course = Course.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 course_params
params.require(:course).permit(:name, :start_date, :end_date, :rating, :query)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Modify this to work for every day, every direction | def find_best_clusters(lat,long, catch_time, direction, week_day)
temporal_delta = 600
#max = Float::INFINITY
max = BigDecimal::INFINITY
near_stop = nil
#Analisis geografico
stops.where(:direction => direction).each_with_index do |stop, index|
candidate = Bus.geographic_distance([stop.latitude, stop.longitude], [lat,long])
if candidate < max
near_stop = stop
max = candidate
end
end
#Analisis temporal, para el paradero seleccionado
max_time = Float::INFINITY
best_guess = nil
near_stop.centroids.where(:direction => direction).each do |centroid|
candidate = Bus.temporal_distance(centroid.catch_time, catch_time.to_i)
if candidate < max_time and centroid.catch_time > catch_time.to_i
best_guess = centroid
max_time = candidate
end
end
#se mapea la resta a todas las filas
#time_data = time_data.map {|z| z - catch_time.to_i }
#Donde la diferencia de tiempo sea mayor que 0 (no haya pasado aun) y sea mas grande de un minuto
#time_data = time_data.sort.find{|x| x > 0 && x > 60 }
#Si no encuentras recomendaciones, te pasaste del limite y te recomiendo la que pasa mas temprano
if best_guess.nil? or best_guess.blank?
best_guess = Sapeada.where(:stop_id => near_stop.id, :direction => direction, :bus_id => 1, :week_day => week_day).order("catch_time ASC").first
[near_stop.latitude, near_stop.longitude, best_guess.catch_time]
else
[near_stop.latitude, near_stop.longitude, best_guess.catch_time - catch_time.to_i]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_day ; true ; end",
"def workpattern(days,from_time,to_time,type)\n DAYNAMES[days].each {|day| @values[day].workpattern(from_time,to_time,type)} \n refresh\n end",
"def day() end",
"def w_day; end",
"def cwday\n end",
"def update_daily_happiness_distributions! \n Happiness... | [
"0.62152857",
"0.6039324",
"0.6021748",
"0.59950733",
"0.5927979",
"0.5892359",
"0.5870011",
"0.58354634",
"0.5822771",
"0.5766951",
"0.57126355",
"0.57124937",
"0.5703526",
"0.56507933",
"0.56471735",
"0.56451434",
"0.5631321",
"0.56176317",
"0.55364335",
"0.5509229",
"0.550... | 0.0 | -1 |
Use this method to add an error to self. | def add_error(_reportable)
@errors << _reportable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_error(error)\n @errors.add(error)\n self\n end",
"def add_error(message)\n self.errors << message\n end",
"def add_error(error)\n @errors = error\n @errors\n end",
"def add(message)\n @errors << message\n end",
"def add_error(message, filename = @node.f... | [
"0.8243063",
"0.80558074",
"0.7950723",
"0.7356352",
"0.73140335",
"0.71420443",
"0.71251047",
"0.70297253",
"0.7001883",
"0.69996834",
"0.6988718",
"0.6953746",
"0.6856497",
"0.68534",
"0.6845249",
"0.6827493",
"0.67884904",
"0.6772826",
"0.673111",
"0.67273486",
"0.6689635"... | 0.7279308 | 5 |
Use this method to add an array of errors to self. | def add_errors(_errors)
_errors.sort { |a,b|
a_attrs = [a.location[:filename], a.location[:line]].compact
b_attrs = [b.location[:filename], b.location[:line]].compact
a_attrs <=> b_attrs
}.each do |e|
self.add_error(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_errors(errors)\n self.errors += errors\n end",
"def add_error mess_err\n @errors ||= Array::new\n @errors << mess_err\n end",
"def add_error(error)\n @errors = error\n @errors\n end",
"def add_errors(errs)\n errs.each {|k,v| errors.add(k,v)}\n end",
"def add_error(... | [
"0.8483225",
"0.80361515",
"0.7496819",
"0.7252849",
"0.6993664",
"0.69861704",
"0.69451845",
"0.69421756",
"0.69051695",
"0.69051695",
"0.6889737",
"0.6889737",
"0.6787421",
"0.6781962",
"0.6779697",
"0.676831",
"0.6753134",
"0.6733873",
"0.6733873",
"0.6675513",
"0.66574556... | 0.66447026 | 22 |
Use this method to add a stat to self | def add_stat(_stat)
@stats << _stat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_stat(stat, value)\n if !@stats\n @stats = {}\n end\n @stats[stat.to_stat] = value\n return\n end",
"def add_stat(stat, value)\n stat = stat.to_stat\n if !@stats.dig(stat)\n @stats[stat] = 0\n end\n @stats[stat] += value\n ... | [
"0.8017741",
"0.77860576",
"0.7700662",
"0.76309556",
"0.712947",
"0.67609125",
"0.6358136",
"0.61119956",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.6021904",
"0.5974127",
"0.5968674",
"0.59612155",
"0.59242463",
"0.5920013",
"0.5855428"... | 0.83773816 | 0 |
Use this method to add an array of stats to self | def add_stats(_stats)
_stats.each do |e|
self.add_stat(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_statistics stats_arr\n stats_arr.each do |stats|\n add_statistic stats\n end\n return\n end",
"def add_stats(_stat)\n _stats.each do |e|\n self.add_stat(e)\n end\n end",
"def add_stat(_stat)\n @stats << _stat\n end",
"def add_stat(_stat... | [
"0.8443807",
"0.7653427",
"0.70880955",
"0.70880955",
"0.6861522",
"0.6848111",
"0.64869463",
"0.6356509",
"0.6243366",
"0.62416124",
"0.60114145",
"0.5980633",
"0.5970151",
"0.59541655",
"0.5826832",
"0.575475",
"0.56737167",
"0.5659582",
"0.56567943",
"0.55887175",
"0.55738... | 0.8081521 | 1 |
Use this method to add a warning to self. | def add_warning(_reportable)
@warnings << _reportable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warning!\n self.severity = :WARNING\n end",
"def warning(warning)\n end",
"def warn(*args)\n self.warned = true\n super\n end",
"def add_warning warning\n case warning.warning_set\n when :template\n @template_warnings << warning\n when :warning\n @wa... | [
"0.7921977",
"0.77657574",
"0.74992317",
"0.74814683",
"0.7446021",
"0.7424565",
"0.7310911",
"0.7310911",
"0.7310911",
"0.71964884",
"0.7127155",
"0.7112689",
"0.7101785",
"0.70930606",
"0.70703787",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831",
"0.7049831... | 0.74167085 | 6 |
Use this method to add an array of warnings to self. | def add_warnings(_warnings)
_warnings.sort { |a,b|
a_attrs = [a.location[:filename], a.location[:line]].compact
b_attrs = [b.location[:filename], b.location[:line]].compact
a_attrs <=> b_attrs
}.each do |e|
self.add_warning(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_warning warning\n case warning.warning_set\n when :template\n @template_warnings << warning\n when :warning\n @warnings << warning\n when :controller\n @controller_warnings << warning\n when :model\n @model_warnings << warning\n else\n raise \"Unknown warning: #{w... | [
"0.7382409",
"0.7146982",
"0.7146982",
"0.69986415",
"0.670339",
"0.6692137",
"0.6649567",
"0.6592601",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.65808284",
"0.6457175",
"0.64405024",
"0.6411167",
"0.63801503",
"0.633... | 0.67395276 | 4 |
def hensel_lift_int(g0, f0, char, height) | def hensel_lift_int(g0, f0, char, height, where)
# self in MPolynomial/int
# g0 in Polyomial/Z, candidate of factor of f0
# f0 in Polyomial/Z, one variable reduction of self
pheight = gelfond_bound(char)
fk = _hensel_lift(g0, f0, char, height, where) do |ha, ary, cofacts|
# fk = _hensel_lift(g0, f0, char, height) {|ha, ary, cofacts|
decompose_on_cofactors_p_adic(ha, ary, cofacts, char, pheight)
end
mod = char**pheight
g = centorize(fk[0], mod)
h = centorize(fk[1], mod)
r = self - g * h
return [g, h] if r.zero?
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _hensel_lift(g0, f0, _char, height, where)\n # self in MPolynomial/ZorZp\n # g0 in Polyomial/ZorZp, candidate of factor of f0\n # f0 in Polyomial/ZoZzp, one variable reduction of self\n\n ring = self.class\n ring_one = g0.class\n\n h0, r0 = f0.divmod g0\n raise 'each_product ... | [
"0.6756319",
"0.59891397",
"0.59089667",
"0.54016984",
"0.54016984",
"0.5349509",
"0.52849376",
"0.52835315",
"0.5272911",
"0.5272869",
"0.5238195",
"0.5232296",
"0.5231523",
"0.5223748",
"0.51866883",
"0.5155542",
"0.5133706",
"0.5095948",
"0.50814325",
"0.5079901",
"0.50125... | 0.759003 | 0 |
TODO: refactor and split into smaller methods | def determine_guess_results
b_pegs = 0
w_pegs = 0
key = answer.uniq
key.each_with_index do |letter|
if answer.count(letter) == guess.count(letter)
w_pegs += answer.count(letter)
elsif answer.count(letter) > guess.count(letter)
w_pegs += guess.count(letter)
elsif answer.count(letter) < guess.count(letter)
w_pegs += answer.count(letter)
end
end
(0..3).each do |i|
if answer[i] == guess[i]
b_pegs += 1
w_pegs -= 1
end
end
[b_pegs, w_pegs]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def identify; end",
"def suivre; end",
"def operations; end",
"def operations; end",
"def formation; end",
"def implementation; end",
"def implementatio... | [
"0.7096715",
"0.6259547",
"0.6144516",
"0.59675795",
"0.59675795",
"0.59675795",
"0.59675795",
"0.5933431",
"0.5803701",
"0.5747484",
"0.5747484",
"0.5740496",
"0.56610054",
"0.56610054",
"0.56061745",
"0.5559254",
"0.55100816",
"0.54885006",
"0.5478619",
"0.5452374",
"0.5437... | 0.0 | -1 |
Function to convert temperature from F to C | def ftoc(tempF)
(tempF - 32.0) * (5.0 / 9.0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend",
"def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend",
"def fahrenheit_to_celsius(te... | [
"0.8613084",
"0.83204573",
"0.7954015",
"0.78662324",
"0.78627825",
"0.78130615",
"0.77978206",
"0.77776915",
"0.7765729",
"0.7744475",
"0.77359027",
"0.76678294",
"0.7656265",
"0.76501656",
"0.764235",
"0.76362187",
"0.7594201",
"0.7577809",
"0.7562048",
"0.7501264",
"0.7492... | 0.0 | -1 |
Function to convert temperature from C to F | def ctof(tempC)
(tempC * (9.0/5.0)) + 32
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertCtoFandFtoC\n\t\tif @tempUnit == \"fahrenheit\"\n\t\t\tresult = ((@temperature - 32) * 5/9)\n\t\telsif @tempUnit == \"celsius\"\n\t\t\tresult = ((@temperature + 32) * 9/5)\n\t\tend\n\t\treturn (result).round(3)\n\tend",
"def ftoc(temperature)\n return celsius = (temperature.to_f - 32) * 5 / 9\nend"... | [
"0.8510651",
"0.79467314",
"0.7892267",
"0.78504086",
"0.7839058",
"0.77893746",
"0.77348834",
"0.77185833",
"0.7712618",
"0.7669913",
"0.7649201",
"0.76183236",
"0.7608102",
"0.7553515",
"0.75512105",
"0.7539552",
"0.75175256",
"0.75160843",
"0.75104564",
"0.7508012",
"0.748... | 0.7185243 | 41 |
builds up individual multiline cells | def build_up_cells(cells, row)
partial_cell = parse_row_to_partial_cell(row)
partial_cell.each.with_index do |cell, index|
if cells[index]
cells[index] += "#{cell.strip} "
else
cells[index] = "#{cell.strip} "
end
end
return cells
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_table_body\n data.each_with_index do |row, i|\n output << \",\\n\" if i > 0 \n build_row(row)\n end\n output << \"\\n\"\n end",
"def split_simple_body(builder, data, cls)\n gen_cols = data.transpose.map { |col| col.join(\"\\n\") }\n\n builder.tr do\n builder.t... | [
"0.6576302",
"0.65076566",
"0.6271136",
"0.6228634",
"0.60777557",
"0.6075187",
"0.5960811",
"0.5939252",
"0.59364307",
"0.5923387",
"0.5904228",
"0.58841896",
"0.58690476",
"0.5864388",
"0.58562833",
"0.5839511",
"0.5835323",
"0.58218694",
"0.5820298",
"0.5771718",
"0.576661... | 0.6178314 | 4 |
the variable page_size is defined in config.yaml, this is the maximum number of posts displayed per page | def paginate(num)
l = sorted_articles
npages = (l.length - 1) / num
for i in 1..(npages)
create_old_page "/page/", i, npages, num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def posts_per_page\n 20\n end",
"def max_per_page\n 200\n end",
"def page_size\n params[:page] ? ( params[:page][:size] || Kaminari.config.default_per_page ) : Kaminari.config.default_per_page\n end",
"def default_page_size\n 50\n end",
"def page_size\n 50\n end",
"def page_si... | [
"0.8019611",
"0.75908804",
"0.7435789",
"0.74218476",
"0.74117035",
"0.73368174",
"0.7328669",
"0.7290259",
"0.7181609",
"0.715609",
"0.71258926",
"0.711822",
"0.71164864",
"0.6961871",
"0.69452214",
"0.6880982",
"0.68584293",
"0.68452185",
"0.6808244",
"0.67049843",
"0.67045... | 0.0 | -1 |
Utiliza los comandos gitfetch y gitmerge para descargar los cambios desde el repositorio central. En caso de que existan conflictos al hacer el merge y el auto merge falle se conservan las diferentes versiones de los archivos en conflicto. | def pull()
begin
@git.fetch('origin')
rescue Git::GitExecuteError => e
raise DownloadException, "Error al bajar los cambios desde el servidor" , caller
else
begin
merge_message = @git.gcommit('FETCH_HEAD').message
@git.merge("origin/master","-m #{merge_message}: merge")
rescue Git::GitExecuteError => e
if(e.to_s.include?("not something we can merge")) or (e.to_s.include?("Not a valid object name FETCH_HEAD"))
Logger::log(@carpeta, Logger::INFO,"El repositorio esta vacio")
elsif(e.to_s.include?("Automatic merge failed")) #hay conflicto
@git.each_conflict{ |f|
ours_commit = @git.gcommit('ORIG_HEAD')
ours_author = ours_commit.author.name
theirs_commit = @git.gcommit('MERGE_HEAD')
theirs_author = theirs_commit.author.name
if (ours_author == theirs_author)
add_ours = " ("+ours_author+" v1)"
add_theirs = " ("+theirs_author+" v2)"
else
add_ours = " ("+ours_author+")"
add_theirs = " ("+theirs_author+")"
end
nombre = f.chomp(File.extname(f))
fno = nombre+add_ours+File.extname(f)
@git.checkout_file("--ours",f)
File.rename(@project_path+"/"+f,@project_path+"/"+fno)
fnt = nombre+add_theirs+File.extname(f)
@git.checkout_file("--theirs",f)
File.rename(@project_path+"/"+f,@project_path+"/"+fnt)
@git.add(fno)
@git.add(fnt)
@git.remove(f)
}
@git.commit("#{merge_message}: merge commit")
else
raise DownloadException, "Error al bajar los cambios desde el servidor" , caller
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_res... | [
"0.568908",
"0.56599104",
"0.56224823",
"0.56084764",
"0.55893725",
"0.5587493",
"0.5567275",
"0.5531521",
"0.5517185",
"0.5504404",
"0.5498998",
"0.5495448",
"0.5491704",
"0.5481084",
"0.54740185",
"0.5457019",
"0.54464674",
"0.5419919",
"0.5407316",
"0.54018587",
"0.5369302... | 0.80469036 | 0 |
Sube los cambios al repositorio central con el comando gitpush | def push()
begin
@git.push('origin','master')
rescue Git::GitExecuteError => e
if (e.to_s.include?("refspec master does not match any"))
Logger::log(@carpeta,Logger::INFO,"No hay cambios para subir al servidor")
else
raise UploadException, "Error al subir los cambios al servidor" , caller
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_push_commits\n shellout(\"git push #{config[:remote]} #{config[:branch]}\")\n end",
"def pushToGitRemotes(branch = 'develop', force = 0)\n if force\n force = \"-f\"\n else\n force = \"\"\n end\n remotes = `git remote`.split(\"\\n\")\n remotes.each do |remote|\n remote.chomp!\n UI... | [
"0.74114776",
"0.7387404",
"0.7243618",
"0.7201484",
"0.70708066",
"0.7069984",
"0.69383234",
"0.6921488",
"0.6850011",
"0.6847535",
"0.6771367",
"0.6753159",
"0.6740835",
"0.67203516",
"0.67033094",
"0.66916025",
"0.66830003",
"0.6663842",
"0.6655203",
"0.6582987",
"0.656242... | 0.75067854 | 0 |
Permite consultar si un archivo o carpeta existe dentro de la carpeta del proyecto. Se utiliza desde DRuboxGUI para manejar el caso de agregar archivos o carpetas repetidos. | def fileExists?(file, newPath = nil)
path = (newPath == nil)? @project_path : newPath["path"]
File.exists?(path+"/"+File.basename(file))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_imagen?\n\t\tFile.exists?\n\tend",
"def file_exists?(file)\n false\n end",
"def verificador_ruta\n file = nil\n begin\n file = File.open(\"#{@ruta_archivo}\", 'r')\n rescue SystemCallError\n @contenido = nil\n puts \"Error!\\nEl archivo no se puede leer.\"\n e... | [
"0.6728578",
"0.6471624",
"0.646653",
"0.6438518",
"0.6438518",
"0.63817686",
"0.63741714",
"0.636239",
"0.63604754",
"0.6352555",
"0.63347673",
"0.6323255",
"0.63035977",
"0.6294324",
"0.6289",
"0.6256983",
"0.6239063",
"0.62352854",
"0.62275344",
"0.61993045",
"0.6195633",
... | 0.62043864 | 19 |
Elimina de la carpeta del proyecto el archivo o carpeta especificado. | def remove(rm_path)
# ver si hacer el git remove aca o dejarlo antes del sync como esta ahora
if(File.ftype(rm_path) == 'directory')
FileUtils.remove_dir(rm_path)
else
FileUtils.remove_file(rm_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del\n File.delete(@file)\n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def rm path\n end",
"def remove(filename); end",
"def incluir_destinatario\n incluir_destinatario_btn.click\n end",
"def supprimerFichier(unNom)\n\t\tif File.exist?(\"../sauvegard... | [
"0.63917804",
"0.63202995",
"0.61624736",
"0.61607045",
"0.61333877",
"0.61278594",
"0.60424095",
"0.602734",
"0.599683",
"0.5979504",
"0.5957537",
"0.5914335",
"0.5900527",
"0.58839047",
"0.5882638",
"0.5870734",
"0.5848289",
"0.58261925",
"0.58226347",
"0.5816931",
"0.57882... | 0.0 | -1 |
GET /ordertypes GET /ordertypes.json | def index
@ordertypes = Ordertype.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def show\n @order_types = OrderType.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @order_type }\n end\n end",
"def order_type\n ... | [
"0.7890538",
"0.671826",
"0.67100203",
"0.66971916",
"0.66732836",
"0.6648629",
"0.6518288",
"0.6477284",
"0.64612776",
"0.64070094",
"0.64044064",
"0.63516015",
"0.6324883",
"0.6271054",
"0.6235804",
"0.6213634",
"0.6207",
"0.62014174",
"0.61956173",
"0.61920404",
"0.6161160... | 0.7299939 | 1 |
GET /ordertypes/1 GET /ordertypes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def index\n @ordertypes = Ordertype.all\n end",
"def order_type\n @order_type = current_store.order_types.find(params[:order_type_id])\n @order.update_columns(order_type_id: @order_type.id)\n... | [
"0.7319608",
"0.7125079",
"0.6971704",
"0.69204456",
"0.6682912",
"0.6438151",
"0.64320487",
"0.6385158",
"0.62747073",
"0.6257035",
"0.6257035",
"0.62124866",
"0.62102795",
"0.61840785",
"0.6169655",
"0.61463976",
"0.6145837",
"0.6144645",
"0.61348253",
"0.61330533",
"0.6126... | 0.0 | -1 |
POST /ordertypes POST /ordertypes.json | def create
@ordertype = Ordertype.new(ordertype_params)
respond_to do |format|
if @ordertype.save
format.html { redirect_to @ordertype, notice: 'Ordertype was successfully created.' }
format.json { render :show, status: :created, location: @ordertype }
else
format.html { render :new }
format.json { render json: @ordertype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ordertype_params\n params.require(:ordertype).permit(:ordertype)\n end",
"def order_type_params\n params.require(:order_type).permit(:name)\n end",
"def create\n authorize_action_for OrderType, at: current_store\n @order_type = current_store.order_types.build(order_type_params.merge(p... | [
"0.7014541",
"0.67785084",
"0.67351127",
"0.6542919",
"0.6210796",
"0.6193922",
"0.60826963",
"0.6035125",
"0.600708",
"0.5991922",
"0.5978389",
"0.59754276",
"0.59653944",
"0.5946889",
"0.5852937",
"0.5852937",
"0.5827234",
"0.5827234",
"0.58212745",
"0.5801622",
"0.57518244... | 0.677696 | 2 |
PATCH/PUT /ordertypes/1 PATCH/PUT /ordertypes/1.json | def update
respond_to do |format|
if @ordertype.update(ordertype_params)
format.html { redirect_to @ordertype, notice: 'Ordertype was successfully updated.' }
format.json { render :show, status: :ok, location: @ordertype }
else
format.html { render :edit }
format.json { render json: @ordertype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n respond_to do |format|\n if @order_type.update_attributes(params[:order_type])\n format.html { redirect_to(@order_type, :notice => 'Order type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n forma... | [
"0.6783567",
"0.65430456",
"0.65090114",
"0.62711287",
"0.6224711",
"0.6114056",
"0.6108647",
"0.6083961",
"0.60739654",
"0.60398984",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725",
"0.6027725"... | 0.6956288 | 0 |
DELETE /ordertypes/1 DELETE /ordertypes/1.json | def destroy
@ordertype.destroy
respond_to do |format|
format.html { redirect_to ordertypes_url, notice: 'Ordertype was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n\n @order_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(order_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @order_type = OrderType.find(params[:id])\n @order_type.destroy\n\n respond_to do |format|\n format.html { redire... | [
"0.7579391",
"0.7552989",
"0.73088604",
"0.73066485",
"0.7041011",
"0.7018504",
"0.69273555",
"0.6910929",
"0.689931",
"0.6796804",
"0.67916507",
"0.6786921",
"0.67775506",
"0.6767241",
"0.6756268",
"0.6738183",
"0.67265767",
"0.6714707",
"0.669098",
"0.666532",
"0.6663207",
... | 0.7599985 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ordertype
@ordertype = Ordertype.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 ordertype_params
params.require(:ordertype).permit(:ordertype)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_fsjs_capital
@fsjs_capital = FsjsCapital.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def fsjs_capital_params
params.require(:fsjs_capital).permit(:yyyy, :m1, :m2, :m3, :m4)
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.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289... | 0.0 | -1 |
methods can be listed after they are called!! | def restaurant_params
# this comes from the post
params.require(:restaurant).permit(:name, :address, :category)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def display_method_list\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def calls; end",
"def calls; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def method_missing(method, *args, &block)\n if list.respond... | [
"0.8022493",
"0.7680752",
"0.76802385",
"0.76802385",
"0.76802385",
"0.76802385",
"0.6920352",
"0.6920352",
"0.6794192",
"0.6794192",
"0.677444",
"0.6755108",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.669361",
"0.6693... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 2 | def my_array_modification_method!(source, thing_to_modify)
source.dup # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def me... | [
"0.7134334",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.70315117",
"0.7021147",
"0.69491255",
"0.68972754",
"0.68972754",
"0.68972754",
"0.68972754",
"0.68492544",
... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 3 | def my_array_sorting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def me... | [
"0.71901274",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7059931",
"0.7031411",
"0.6946713",
"0.6946713",
"0.6946713",
"0.6946713",
"0.6915114",
"0.68856174",
"0.68856174",
... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. Person 4 | def my_array_deletion_method!(source, thing_to_delete)
source.delete_if do |item|
item.to_s.include? thing_to_delete
end
source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def extract_method_details; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end",
"def method_name; end"... | [
"0.7254151",
"0.70765764",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.7059034",
"0.6998407",
"0.6998407",
"0.6998407",
"0.6998407",
"0.6904436",
"0.6850036",
"0.6850036",
... | 0.0 | -1 |
Identify and describe the Ruby method(s) you implemented. I used the method delete, which removes an item (but doesn't return the modified hash or array, so you have to do that) Also used the method delete_if which gives delete a conditional And lastly used the method include? which double checks if the object has the secondary object located inside of it (in this case a string) Also used the to_s method to make sure I didn't get a fixnum error when iterating through the loop. Person 5 | def my_array_splitting_method(source)
source # This line is here to make sure all tests initially fail. Delete it when you begin coding.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def my_hash_deletion_method(source, thing_to_delete)\n p\tsource.delete_if { |pets| pets.to_s.include?(thing_to_delete) }\nend",
"def delete_friend(person, delete_friend)\n person[:friends].delete(\"Rick\")\n return person[:friends]\nend",
"def deletion_method(hash)\r\n\r\n hash.delete_if{|spell,number| ... | [
"0.696907",
"0.65272593",
"0.6385985",
"0.6348721",
"0.6339784",
"0.6277978",
"0.6249639",
"0.62004536",
"0.61658144",
"0.61466336",
"0.61051655",
"0.6099654",
"0.6090178",
"0.6090178",
"0.6085557",
"0.6060284",
"0.605527",
"0.6053183",
"0.60416955",
"0.60336673",
"0.6015666"... | 0.0 | -1 |
GET /coupen_types GET /coupen_types.json | def index
@coupen_types = CoupenType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coupom_types = CoupomType.all\n end",
"def index\n \n\tbegin\n\t\t@coupon_types = CouponType.all\n\n\trescue Mongoid::Errors::DocumentNotFound\n\t\trespond_to do |format|\n\t\t\t#format.json { render :json => \"No Coupon Types Have Been Created Yet.\\n\", status: 603}\n\t\t\treturn\n\t\tend\n\t... | [
"0.716676",
"0.64807814",
"0.64701545",
"0.644464",
"0.644104",
"0.64343053",
"0.6409283",
"0.6407858",
"0.6406903",
"0.6405533",
"0.63803643",
"0.6347476",
"0.6346175",
"0.6337616",
"0.6324703",
"0.63045275",
"0.629083",
"0.6286564",
"0.62821025",
"0.62558126",
"0.6255596",
... | 0.7566974 | 0 |
GET /coupen_types/1 GET /coupen_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coupen_types = CoupenType.all\n end",
"def index\n @coupom_types = CoupomType.all\n end",
"def set_coupen_type\n @coupen_type = CoupenType.find(params[:id])\n end",
"def show \n\t\n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\t\t\n\trescue Mongoid::Errors::Document... | [
"0.7432242",
"0.7118397",
"0.6791593",
"0.6660852",
"0.6571711",
"0.6562576",
"0.6544305",
"0.64649165",
"0.6396315",
"0.63866025",
"0.6367504",
"0.63568884",
"0.63338315",
"0.63324124",
"0.63275254",
"0.6219977",
"0.61909163",
"0.6143824",
"0.6116025",
"0.61125684",
"0.61123... | 0.0 | -1 |
POST /coupen_types POST /coupen_types.json | def create
@coupen_type = CoupenType.new(coupen_type_params)
respond_to do |format|
if @coupen_type.save
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully created.' }
format.json { render :show, status: :created, location: @coupen_type }
else
format.html { render :new }
format.json { render json: @coupen_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coupen_type_params\n params.require(:coupen_type).permit(:name)\n end",
"def create\n @coupom_type = CoupomType.new(coupom_type_params)\n\n respond_to do |format|\n if @coupom_type.save\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully created.' }\n ... | [
"0.70385176",
"0.6710483",
"0.66877604",
"0.6647953",
"0.6505263",
"0.6422461",
"0.6422461",
"0.6392261",
"0.63638484",
"0.63638484",
"0.6353293",
"0.62287486",
"0.62278",
"0.62106705",
"0.62097865",
"0.61978686",
"0.611895",
"0.6017734",
"0.59565437",
"0.5917742",
"0.5899071... | 0.7370861 | 0 |
PATCH/PUT /coupen_types/1 PATCH/PUT /coupen_types/1.json | def update
respond_to do |format|
if @coupen_type.update(coupen_type_params)
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully updated.' }
format.json { render :show, status: :ok, location: @coupen_type }
else
format.html { render :edit }
format.json { render json: @coupen_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @coupom_type.update(coupom_type_params)\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully updated.' }\n format.json { render :show, status: :ok, location: @coupom_type }\n else\n format.html { render :edit }\n ... | [
"0.71082723",
"0.68169534",
"0.6547716",
"0.6391595",
"0.6372694",
"0.632521",
"0.6222657",
"0.62001365",
"0.6187064",
"0.6149943",
"0.6126606",
"0.6122269",
"0.6119579",
"0.6110995",
"0.61019546",
"0.6099041",
"0.6094051",
"0.6083716",
"0.6080255",
"0.60695124",
"0.6067825",... | 0.7335809 | 0 |
DELETE /coupen_types/1 DELETE /coupen_types/1.json | def destroy
@coupen_type.destroy
respond_to do |format|
format.html { redirect_to coupen_types_url, notice: 'Coupen type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @coupom_type.destroy\n respond_to do |format|\n format.html { redirect_to coupom_types_url, notice: 'Coupom type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n\tbegin\n\t\t@coupon_type = CouponType.find(params[:id])\n\trescue M... | [
"0.77692837",
"0.73111403",
"0.7237445",
"0.7132078",
"0.7112005",
"0.70950085",
"0.7061055",
"0.7049216",
"0.70418173",
"0.7008364",
"0.69754964",
"0.6968433",
"0.6944002",
"0.6910477",
"0.68965703",
"0.68942624",
"0.6891273",
"0.68879384",
"0.68775094",
"0.6869592",
"0.6850... | 0.78857017 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_coupen_type
@coupen_type = CoupenType.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def coupen_type_params
params.require(:coupen_type).permit(:name)
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.6978086",
"0.6780264",
"0.6742658",
"0.6738813",
"0.67338693",
"0.65908474",
"0.6501793",
"0.6495506",
"0.64796513",
"0.64755446",
"0.6454826",
"0.6437561",
"0.6377127",
"0.63722163",
"0.6364058",
"0.63178706",
"0.62979764",
"0.62968165",
"0.62913024",
"0.6289789",
"0.6289... | 0.0 | -1 |
GET /wi_mn_d_min_t_airs GET /wi_mn_d_min_t_airs.json | def index
@wi_mn_d_min_t_airs = WiMnDMinTAir.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wi_mn_d_max_t_airs = WiMnDMaxTAir.all\n end",
"def set_wi_mn_d_min_t_air\n @wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])\n end",
"def index\n @wi_mn_d_ave_t_airs = WiMnDAveTAir.all\n end",
"def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @test... | [
"0.59565115",
"0.5927309",
"0.57154316",
"0.53676003",
"0.5325007",
"0.5277965",
"0.52665216",
"0.52609336",
"0.52189827",
"0.51970005",
"0.5190639",
"0.5188427",
"0.5179144",
"0.5156998",
"0.51558995",
"0.5152989",
"0.513864",
"0.51361364",
"0.511528",
"0.5098247",
"0.508716... | 0.70168614 | 0 |
GET /wi_mn_d_min_t_airs/1 GET /wi_mn_d_min_t_airs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @wi_mn_d_min_t_airs = WiMnDMinTAir.all\n end",
"def set_wi_mn_d_min_t_air\n @wi_mn_d_min_t_air = WiMnDMinTAir.find(params[:id])\n end",
"def index\n @wi_mn_d_max_t_airs = WiMnDMaxTAir.all\n end",
"def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format... | [
"0.6597702",
"0.5655484",
"0.5642752",
"0.55193466",
"0.5504933",
"0.5463161",
"0.546218",
"0.54491854",
"0.53673214",
"0.53597885",
"0.5355809",
"0.5354891",
"0.5331018",
"0.52802956",
"0.5275506",
"0.524105",
"0.5238976",
"0.52034867",
"0.5200694",
"0.51999426",
"0.5197389"... | 0.0 | -1 |
POST /wi_mn_d_min_t_airs POST /wi_mn_d_min_t_airs.json | def create
@wi_mn_d_min_t_air = WiMnDMinTAir.new(wi_mn_d_min_t_air_params)
respond_to do |format|
if @wi_mn_d_min_t_air.save
format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully created.' }
format.json { render action: 'show', status: :created, location: @wi_mn_d_min_t_air }
else
format.html { render action: 'new' }
format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wi_mn_d_min_t_air_params\n params.require(:wi_mn_d_min_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w... | [
"0.6112241",
"0.5985104",
"0.5892586",
"0.57599187",
"0.5685592",
"0.56528795",
"0.53249526",
"0.525221",
"0.5033373",
"0.49917242",
"0.49442983",
"0.49180514",
"0.48814836",
"0.4849706",
"0.48446652",
"0.48306322",
"0.47757375",
"0.47728518",
"0.4736686",
"0.47185472",
"0.47... | 0.6202855 | 0 |
PATCH/PUT /wi_mn_d_min_t_airs/1 PATCH/PUT /wi_mn_d_min_t_airs/1.json | def update
respond_to do |format|
if @wi_mn_d_min_t_air.update(wi_mn_d_min_t_air_params)
format.html { redirect_to @wi_mn_d_min_t_air, notice: 'Wi mn d min t air was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @wi_mn_d_min_t_air.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.e... | [
"0.6148725",
"0.61286503",
"0.6090131",
"0.6058306",
"0.60359174",
"0.60052246",
"0.5954133",
"0.59177804",
"0.58842295",
"0.5876892",
"0.584949",
"0.5849037",
"0.58466804",
"0.58432025",
"0.58316815",
"0.58052087",
"0.57933533",
"0.57925725",
"0.5758916",
"0.57509",
"0.57471... | 0.6378901 | 0 |
DELETE /wi_mn_d_min_t_airs/1 DELETE /wi_mn_d_min_t_airs/1.json | def destroy
@wi_mn_d_min_t_air.destroy
respond_to do |format|
format.html { redirect_to wi_mn_d_min_t_airs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @wi_mn_d_ave_t_air.destroy\n respond_to do |format|\n format.html { redirect_to wi_mn_d_ave_t_airs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wi_mn_d_max_t_air.destroy\n respond_to do |fo... | [
"0.686416",
"0.68330896",
"0.6811838",
"0.6715225",
"0.6504514",
"0.6485748",
"0.6480327",
"0.645311",
"0.6410107",
"0.6407281",
"0.63999367",
"0.63999367",
"0.63999367",
"0.63999367",
"0.6393333",
"0.63785666",
"0.633594",
"0.63330674",
"0.6317885",
"0.6311852",
"0.6273572",... | 0.70311284 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_wi_mn_d_min_t_air
@wi_mn_d_min_t_air = WiMnDMinTAir.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 wi_mn_d_min_t_air_params
params.require(:wi_mn_d_min_t_air).permit(:date, :time, :latitude, :w980, :w976, :w972, :w968, :w964, :w960, :w956, :w952, :w948, :w944, :w940, :w936, :w932, :w928, :w924, :w920, :w916, :w912, :w908, :w904, :w900, :w896, :w892, :w888, :w884, :w880, :w876, :w872, :w868, :w864, :w860)
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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def transaction_params
params.require(:transaction).permit(:user_id, :account_id, :transaction_endpoint_id, :transfer_to, :category_id, :type, :amount, :transaction_at, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.71217275",
"0.7052942",
"0.6947555",
"0.6903013",
"0.6735074",
"0.67167085",
"0.6687677",
"0.66765445",
"0.66602796",
"0.65548825",
"0.6524274",
"0.6455697",
"0.6451343",
"0.645123",
"0.64465624",
"0.6433475",
"0.64118403",
"0.64118403",
"0.6390524",
"0.6378871",
"0.637887... | 0.0 | -1 |
Get the service checks for the given service | def acquire_service_data
if config[:tags] && config[:service]
tags = config[:tags].split(',').to_set
services = []
Diplomat::Health.service(config[:service]).each do |s|
if s['Service']['Tags'].to_set.superset? tags
services.push(*s['Checks'])
end
end
services
elsif config[:nodename]
data = []
begin
services = Diplomat::Node.get(config[:nodename]).Services
rescue StandardError
services = {}
end
services.each_value do |service|
Diplomat::Health.checks(service['Service']).each do |check|
data.push(check) if check.Node == config[:nodename]
end
end
data
elsif config[:all]
Diplomat::Health.state('any')
else
Diplomat::Health.checks(config[:service])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def service_check(service_id)\n check(\"service:#{service_id}\")\n end",
"def services\n\t\tselect {|x| x.class == Service }\n\tend",
"def service_checker(on=false, off=false)\n begin\n\t\t ms_ports = list_of_services()\n rescue\n update_list_of_services()\n ms_ports = list_of_serv... | [
"0.6917605",
"0.67740923",
"0.65145516",
"0.6446592",
"0.61736524",
"0.61547637",
"0.60500294",
"0.60347956",
"0.6033983",
"0.6026999",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.60115975",
"0.6003372",
"... | 0.671223 | 2 |
This helper method allows preformatting of values before updating the config itself. This is useful if a particular config requires a special format, for example the daily_scheduled_tasks must be an array of symbols. | def format_config_value(key, value)
case key.to_sym
when :daily_scheduled_tasks
return value.select(&:present?).map(&:to_sym)
when :feedback_overdue_days, :max_walk_minutes, :maximum_booking_notice
return value.to_i
when :require_user_confirmation
return (value == "true")
when :trapeze_ada_funding_sources
return value.delete(' ').split(',')
else
return value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_configuration(configuration)\n format_options = I18n.t(:'number.format', :raise => true) rescue {}\n format_options[:delimiter] = format_options[:delimiter] || ','\n format_options[:separator] = format_options[:separator] || '.'\n\n # update it with a maybe given defa... | [
"0.62285084",
"0.6226422",
"0.6087763",
"0.6024515",
"0.5980758",
"0.580525",
"0.57846725",
"0.57813936",
"0.5546969",
"0.5489075",
"0.5469479",
"0.5385163",
"0.5374382",
"0.5365147",
"0.5335698",
"0.5319579",
"0.52993584",
"0.52795297",
"0.52763087",
"0.52660257",
"0.5216567... | 0.7150406 | 0 |
Add more helper methods to be used by all tests here... sign_in is a Devise helper method, not available in integration tests password isn't part of table so can't pull from user fixture | def my_sign_in(user)
password = user.password || "password"
post_via_redirect user_session_path, user: {email: user.email, password: password}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def test_sign_in(user)\n controller.sign_in(user)\n end",
"def log_in_as(user) # with devise gem\n if integration_test?\n include Devise::Test::IntegrationHelpers\n else\n sign_in(user, scope: :user)\n end\n login_as(u... | [
"0.6452",
"0.6373258",
"0.626031",
"0.6260092",
"0.62346244",
"0.622802",
"0.6201655",
"0.60788375",
"0.6021736",
"0.6007976",
"0.5984497",
"0.590856",
"0.5762111",
"0.57342404",
"0.5725186",
"0.5620658",
"0.5611941",
"0.5594393",
"0.5594346",
"0.55831563",
"0.5564694",
"0.... | 0.0 | -1 |
Constructor; only really needs access to the args | def initialize(args)
# Remember the args
@args = args
# Set some colour defaults
colourable(255, 0, 0, 0)
# And some default sizes and positions
@w = @h = @source_w = @source_h = 128
@source_x = @source_y = @angle = 0
@path = "counter#{object_id}"
@count = 0
# Place us somewhere sensible
movable_location(args.grid.center_x - @w / 2, (args.grid.h - @h) / 2)
# Create an appropriate render target
args.render_target(@path).borders << { x: 0, y: 0, w: @w, h: @h, r: @r, g: @g, b: @b, a: 255 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(args)\n end",
"def initialize(*args); end",
"def initialize(*args)\n @args = args\n end",
"def initialize(*args)\n end",
"def initialize(args)\n @args = args\n end",
"def initialize(*args)\n end",
"def initialize(*args)\n super(args[0], args[1])\n end",
"def ... | [
"0.8707507",
"0.8541406",
"0.85241747",
"0.8523356",
"0.85013187",
"0.8342937",
"0.8335487",
"0.822595",
"0.82007104",
"0.81685346",
"0.81685346",
"0.81685346",
"0.81276506",
"0.8039838",
"0.8017806",
"0.7924771",
"0.7924771",
"0.7924771",
"0.7924771",
"0.7924771",
"0.7911635... | 0.0 | -1 |
Central update, that works through all the mixin updates | def update
# Run through the mixin updates
colourable_update
movable_update
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update() end",
"def update\n super\n end",
"def update ; end",
"def setup\n @auto_update = true\n super\n reload rescue update\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def upd... | [
"0.6929733",
"0.6865742",
"0.6824354",
"0.6742376",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6740493",
"0.6620576",
"0.6620576",
"0.6620576",
"0.6620576",
"0.6606291",
"0.65677416",
"0.65628797",
"0.65609616",
"0.65328974",... | 0.78583175 | 0 |
Counter set; this triggers the resize/move/fade cycle | def count=(value)
# So, set the count to the new value
@count = value
# Clear the render target; this shouldn't be necessary, but render_targets
# on HTML don't seem to entirely get cleared down
args.render_target(@path).solids << { x: 0, y: 0, w: @w, h: @h, r: 0, g: 0, b: 0, a: 0 }
args.render_target(@path).borders.clear
# Update the text
args.render_target(@path).labels << {
x: 10, y: 128,
r: 255, g: 255, b: 255, a: 255,
font: 'vertices/fonts/Kenney Future Square.ttf',
size_enum: 50, text: @count.to_s
}
# Set the position back to the start, and set it drifting up
movable_location(@args.grid.center_x, @args.grid.center_y - 250)
movable_location(@args.grid.center_x - 175, @args.grid.center_y + 250, 60)
movable_size(128, 128)
movable_size(768, 768, 60)
# At the same time, set the colour red and fade
colourable(255, 0, 0, 255)
colourable(0, 0, 0, 0, 60)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize\n trigger(:_clear_)\n\n trigger(:_refresh_)\n\n true\n end",
"def update\n if @counter == 30\n self.x -= 1\n elsif @counter == 60\n self.x += 1\n @counter = 0\n end\n @counter += 1\n end",
"def update\n if @counter ... | [
"0.5921596",
"0.5839004",
"0.58372986",
"0.58085775",
"0.574214",
"0.56776756",
"0.5651255",
"0.5648269",
"0.5640809",
"0.5630085",
"0.5630085",
"0.5601897",
"0.55345285",
"0.54416454",
"0.5415734",
"0.53738296",
"0.53547806",
"0.5336068",
"0.53299934",
"0.5323138",
"0.529001... | 0.5083694 | 39 |
Visibility flag, to control when we draw | def visible?
@a.nonzero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def appear\n refresh\n self.visible = true\n self.opacity = 255\n end",
"def visible=(visible)\n @visible = visible\n @cEnemyGraphic.visible = visible... | [
"0.7019021",
"0.69710094",
"0.6854344",
"0.6829289",
"0.67845243",
"0.67040294",
"0.6660779",
"0.6658635",
"0.6645908",
"0.6615044",
"0.66106784",
"0.6597247",
"0.6597247",
"0.65938485",
"0.659243",
"0.6578994",
"0.6577314",
"0.6567152",
"0.6547323",
"0.6545704",
"0.6544195",... | 0.0 | -1 |
Tenant has a name, age, and credit score | def initialize(name:, age:, credit_score:)
@name, @age, @credit_score = name, age, credit_score
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_tenant tenant\n\n # Tenant Validation\n if tenant.credit_rating == \"Bad\"\n p \"WARNING: Tenant #{tenant.name} has a BAD credit rating\"\n elsif @apt_tenants.size > @apt_bed\n p \"WARNING: Apartment is full\"\n else\n @apt_tenants << tenant\n p \"Tenant: #{tenant.name} is a... | [
"0.62302345",
"0.5788495",
"0.5766995",
"0.5702385",
"0.56919",
"0.56896234",
"0.5681666",
"0.56674016",
"0.56405187",
"0.56180865",
"0.56058127",
"0.56043535",
"0.5517204",
"0.5516877",
"0.55091155",
"0.54895276",
"0.548087",
"0.54567635",
"0.5438842",
"0.5437327",
"0.543679... | 0.5465643 | 17 |
has a credit rating | def credit_rating
Credit_Ratings.credit_chart(credit_score)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_competitor_rate\n if self.rate_type == 3\n true\n else\n false\n end\n end",
"def can_rate?(person)\n person != self.reviewer && person != self.reviewee && !self.rated_by?(person)\n end",
"def can_add_rating?(val)\n return true if admin || (val.abs>=0 && val.abs<=1)\n stat_... | [
"0.6786806",
"0.6570166",
"0.6503046",
"0.6384611",
"0.6347282",
"0.6308448",
"0.62910366",
"0.6288569",
"0.62809926",
"0.62809926",
"0.6258923",
"0.62306863",
"0.62268543",
"0.62268543",
"0.6215576",
"0.6205519",
"0.6204829",
"0.61822915",
"0.61723477",
"0.61533403",
"0.6152... | 0.7597337 | 0 |
Multiple sentences within parentheses or quotes are kept together, unless parentheses span multiple paragraphs. Allows for ... within a sentence. Does not split on ! or ? | def to_sentences(paragraph)
#---------------- Step 1: Break up paragraph into pieces based on punctuation.
old_sentences = paragraph.split(/(?<=\."|\.\)|\.)(?<!\.\s\.|\.\s\."|\.\s\.\))\s(?!\.)|(?<=\.\s\.\s\.\s\."|\.\s\.\s\.\s\.\)|\.\s\.\s\.\s\.)\s/)
# splits on space in two cases: 1. if preceded by exactly one dot, possibly followed by ) or "
# 2. if preceded by four dots, possibly followed by ) or "
# (exactly one dot before SPLIT no dot after) OR (four dots before SPLIT)
#---------------- Step 2: Re-join some pieces so that embedded quotes and parenthetical remarks aren't broken.
new_sentences = []
old_count = 0 # position in old array built in Step 1
new_count = 0 # position in new array built now in Step 2
while old_count < old_sentences.length
# each step in outer while loop adds a new element to new_sentences
skip = 0 # skip keeps track of how many elements of old_sentences are used
new_sentences[new_count] = old_sentences[old_count]
while old_count + skip < old_sentences.length and (new_sentences[new_count].count('"')%2 == 1 or new_sentences[new_count].count('(') != new_sentences[new_count].count(')'))
# each step in inner while loop checks last element of new_sentences for mismatched quotes or parentheses, ...
if new_sentences[new_count].count(')') > new_sentences[new_count].count('(')
old_sentences[old_count] = old_sentences[old_count].sub!(/\)/, "")
break
end # ... if there's a mismatched right parenthesis, deletes it, ...
if old_count + skip + 1 == old_sentences.length and (new_sentences[new_count].count('(') > new_sentences[new_count].count(')'))
old_sentences[old_count] = old_sentences[old_count].sub!(/\(/, "")
skip = -1
new_count -= 1
break # ... if there's a mismatched left parenthesis or quote,
end # joins next element of old_sentences to current new_sentence, unless
# reach end of paragraph with mismatch; then deletes mismatched ( or ',
# not joining subsequent elements of old_sentences to current new_sentence.
skip += 1
new_sentences[new_count] = new_sentences[new_count] + " " + old_sentences[old_count + skip]
end
new_count += 1
old_count += skip + 1
end
#---------------- Step 3: Make sure each piece starts and ends with a single quote.
sentences_with_quotes = []
new_sentences.each do |x|
x = x.chomp
x = "'"+x if x[0] != "'"
x = x+"'" if x[x.length-1] != "'"
sentences_with_quotes << x
end
return sentences_with_quotes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_sentences\n #break text first by paragraph then into chunks delimited by a period\n #but these are not quite sentences yet\n chunks = (self.split(/\\n+/).map { |p| \"#{p}\\n\".split(/\\.(?:[^\\w])/) }).flatten.compact\n \n #if a sentence is split at Mr.|Ms.|Dr.|Mrs. \n #then recombine it ... | [
"0.72827095",
"0.69987595",
"0.65290505",
"0.6498287",
"0.63844633",
"0.63075703",
"0.6297986",
"0.6218041",
"0.6177309",
"0.61281294",
"0.61161005",
"0.60057205",
"0.59208435",
"0.5904949",
"0.59015435",
"0.5860213",
"0.58392644",
"0.5820989",
"0.58187157",
"0.58087635",
"0.... | 0.7494692 | 0 |
linear search: starting at the beginning, iterate over each in a (sortunspecific) collection until find target, else reach the end and return nil | def linear_search(students, fname)
students.find_index {|student| student.first_name == fname} || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nums.size - 1\n\n while (start_ind + 1 < last_ind) do\n mid = start_ind + (last_ind - start_ind) / 2\n\n if nums[mid] == target\n return mid\n end\n\n if nums[start_in... | [
"0.65944445",
"0.65672314",
"0.651508",
"0.648661",
"0.64403623",
"0.64139146",
"0.6364704",
"0.63337964",
"0.63286805",
"0.6320612",
"0.6314959",
"0.6306802",
"0.6301765",
"0.6269499",
"0.6250207",
"0.6232159",
"0.6222722",
"0.6220933",
"0.62133783",
"0.62069046",
"0.6206886... | 0.0 | -1 |
binary search, starting at the middle of a sorted collection. return object if its the target if not test if target is higher or lower; if higher, ditch the first half (so range is now middle+1 through the end) if lower, ditch the second half (so range is now array start through middle1) ...and do the same thing: pick the middle, return obj if its a winner, else test if higher or lower, yada yada; until found, else nil | def binary_search(students, ssn)
students.sort #must sort for binary search
students.index(students.bsearch {|student| ssn <=> student.ssn}) || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_search(target, collection, min_index = 0, max_index = collection.size - 1)\n return nil if collection.empty?\n loop do\n return nil if max_index < min_index\n index_to_check = mid_point(min_index, max_index)\n return index_to_check if collection[index_to_check] == target\n min_index = inde... | [
"0.7927643",
"0.7670685",
"0.7563275",
"0.7428967",
"0.7346572",
"0.7320674",
"0.7233133",
"0.72018576",
"0.7197814",
"0.7166591",
"0.71544456",
"0.7141897",
"0.7140128",
"0.7138975",
"0.7105885",
"0.7105787",
"0.7097939",
"0.7093132",
"0.70920753",
"0.7076504",
"0.70725834",... | 0.0 | -1 |
GET /invoices GET /invoices.json | def index
if current_user.is_god?
@invoices = Invoice.all
else
render_404
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n '/api/invoices'\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def index\n @invoices = Invoice.all.order(invoice_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_pag... | [
"0.8260273",
"0.80758405",
"0.76502985",
"0.7614473",
"0.75937253",
"0.75332034",
"0.7477495",
"0.74386454",
"0.7431247",
"0.7425549",
"0.74059653",
"0.73953325",
"0.7360913",
"0.7349729",
"0.7328933",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.7307544",
"0.730754... | 0.0 | -1 |
GET /invoices/1 GET /invoices/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n '/api/invoices'\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso... | [
"0.79701793",
"0.7758278",
"0.75787675",
"0.7569881",
"0.7548523",
"0.75110555",
"0.738",
"0.73394597",
"0.7339335",
"0.72982484",
"0.7200606",
"0.71963847",
"0.7190236",
"0.7119396",
"0.7113203",
"0.7111051",
"0.7105783",
"0.70660424",
"0.70660424",
"0.70660424",
"0.70660424... | 0.0 | -1 |
POST /invoices POST /invoices.json | def create
@invoices ||= Array.new
@cart_ids = params[:cart]
@carts = Cart.where(id: @cart_ids)
invoice_service = InvoiceService.new
checkig_accoutn_service = CheckingAccountService.new
license_service = LicenseService.new
@carts.each do |cart|
@invoice = Invoice.new
@checking_account = CheckingAccount.new
@invoice.attributes = {user_id: current_user.id, script_id: cart.script_id, value: cart.price.value, invoice_status_id: 1, script_file: invoice_service.generate_invoice_script_file(cart.script), notes: '', pay_date: nil, ship_date: nil, shipped_to: current_user.email, shipped_via: 'email', pay_method_id: 1, workplace_id: cart.workplace_id}
@invoices.push(@invoice)
cart.update_attribute(:full_sale, true)
end
respond_to do |format|
if @invoices.each(&:save)
@invoices.each do |i|
invoice_service.create_download_file(i)
invoice_service.send_invoice(i.user_id, i)
checkig_accoutn_service.initialize_checking_account(i)
license_service.initialize_license(i)
end
flash[:cart_ids] = @cart_ids
format.html { redirect_to final_buys_path }
format.json { render :show, status: :created, location: @invoice }
else
format.html { render :new }
format.json { render json: @invoice.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = ... | [
"0.75937945",
"0.7456611",
"0.74087155",
"0.7326695",
"0.7287125",
"0.7256666",
"0.72499394",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241388",
"0.7241144",
"0.72316873",
"0.7176308",
"0.7151988",
"0.71232617",
"0.711376",
"0.7104752",
"0.70377934"... | 0.6720158 | 34 |
PATCH/PUT /invoices/1 PATCH/PUT /invoices/1.json | def update
respond_to do |format|
if @invoice.update(invoice_params)
format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }
format.json { render :show, status: :ok, location: @invoice }
else
format.html { render :edit }
format.json { render json: @invoice.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to invoices_url, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { rende... | [
"0.69752765",
"0.692251",
"0.6877344",
"0.6877344",
"0.6873207",
"0.6814988",
"0.67839533",
"0.67467403",
"0.67467403",
"0.6732075",
"0.6712139",
"0.6684655",
"0.66579384",
"0.6605136",
"0.65999866",
"0.65964717",
"0.65934354",
"0.65294355",
"0.6501596",
"0.6474816",
"0.64472... | 0.6623451 | 20 |
DELETE /invoices/1 DELETE /invoices/1.json | def destroy
@invoice.destroy
respond_to do |format|
format.html { redirect_to invoices_url, notice: 'Invoice was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |... | [
"0.79230964",
"0.7888429",
"0.7888429",
"0.7888429",
"0.7888429",
"0.78234553",
"0.7737917",
"0.7577448",
"0.75553495",
"0.75475377",
"0.75383025",
"0.75333583",
"0.75324756",
"0.75324756",
"0.75324756",
"0.75324756",
"0.75324756",
"0.7517249",
"0.7465006",
"0.743595",
"0.738... | 0.75435287 | 20 |
Use callbacks to share common setup or constraints between actions. | def set_invoice
@invoice = Invoice.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 invoice_params
params.require(:invoice).permit(:id, :user_id, :script_id, :value, :invoice_status_id, :notes, :pay_date, :ship_date, :shipped_to, :shipped_via, :workplace_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.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
An after_filter to automatically add the analytics code. If you intend to use the link_to_tracked view helpers, you need to set Rubaidh::GoogleAnalytics.defer_load = false to load the code at the top of the page (see | def add_google_analytics_code
if GoogleAnalytics.asynchronous_mode
response.body.sub! /(<\/[hH][eE][aA][dD][^>]*>)/, "#{google_analytics_code}\\1" if response.body.respond_to?(:sub!)
elsif GoogleAnalytics.defer_load
response.body.sub! /<\/[bB][oO][dD][yY]>/, "#{google_analytics_code}</body>" if response.body.respond_to?(:sub!)
else
response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, "\\1#{google_analytics_code}" if response.body.respond_to?(:sub!)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b_tracking_code(account_id, track_page_id)\n <<-SCRIPT\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n _gaq.push(['gwo._trackPageview', '/#{track_p... | [
"0.703339",
"0.6973199",
"0.6697001",
"0.65942514",
"0.65533406",
"0.6511194",
"0.6384741",
"0.6372845",
"0.63507175",
"0.6273839",
"0.62098646",
"0.61770165",
"0.5982149",
"0.5900619",
"0.5883343",
"0.57762104",
"0.5755805",
"0.57469094",
"0.5710566",
"0.5514713",
"0.5475650... | 0.6632354 | 3 |
def self.set_browser_object headless = Headless.new headless.start | def login
@browser.goto "instagram.com/accounts/login/"
@browser.text_field(:name => "username").set "#{@username}"
@browser.text_field(:name => "password").set "#{@password}"
@browser.button(:text => 'Log in').click
sleep(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headless!; end",
"def headless!; end",
"def browse url\n @@headless = Headless.new\n @@headless.start\n @@browser = Watir::Browser.start url\n end",
"def headless\n @data[\"headless\"]\n end",
"def setup_browser(url)\n browser = Watir::Browser.new :firefox, headles... | [
"0.84048975",
"0.84048975",
"0.7735231",
"0.75207347",
"0.72269386",
"0.72180605",
"0.71694225",
"0.69854164",
"0.66866857",
"0.6423492",
"0.6323302",
"0.63228554",
"0.6306019",
"0.6263963",
"0.6215962",
"0.61913985",
"0.61792785",
"0.61792785",
"0.6155904",
"0.61448663",
"0.... | 0.0 | -1 |
def new_play_method current_user.update_column('playMethod', params[:playMethod].to_i == 0 ? 0 : 1) redirect_to :back end | def user_exists?
@user = User.where(:username => params[:user][:username]).where(["id NOT IN (?)", current_user.id])
if @user != []
respond_to do |format|
format.json { render :json => false}
end
else
respond_to do |format|
format.json { render :json => true}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_wizard_rate\n init_variables_from_sessions\n\n if params[:back_button]\n redirect_to new_wizard_channel_room_admin_room_type_channel_mappings_path\n else\n @room_type_channel_mapping.skip_rate_configuration = true\n\n if @room_type_channel_mapping.valid?\n # do nothing\n ... | [
"0.579221",
"0.56878626",
"0.5668381",
"0.564404",
"0.5602526",
"0.5593674",
"0.5591387",
"0.55530745",
"0.55356467",
"0.55318135",
"0.5528649",
"0.5519881",
"0.5515503",
"0.54978216",
"0.54766285",
"0.54743505",
"0.5473848",
"0.5473471",
"0.5452995",
"0.5441237",
"0.54376465... | 0.0 | -1 |
def resource_name :user end def resource | def sign_up_params
params.require(:user).permit(:email, :password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_name\n\t :user\n\tend",
"def resource_name\r\n :user\r\n end",
"def resource_name\n\t\t:user\n\tend",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_name\n :user\n end",
"def resource_... | [
"0.9371055",
"0.9356753",
"0.933402",
"0.9297249",
"0.9297249",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0.92466325",
"0... | 0.0 | -1 |
Cookbook Name:: dmd Recipe:: default Copyright 2016, YOUR_COMPANY_NAME All rights reserved Do Not Redistribute | def install_dmd(source, file, build_dir, prefix)
remote_file "#{Chef::Config[:file_cache_path]}/#{file}" do
source source + file
mode '0644'
action :create_if_missing
not_if "test -e #{prefix}/linux/bin64/dmd"
end
bash "install-#{build_dir}" do
user 'root'
cwd Chef::Config[:file_cache_path]
code <<-EOH
set -e
rm -r #{build_dir} || true
tar xf #{file}
rm -r #{prefix} || true
cp -r #{build_dir} #{prefix}
rm -r #{build_dir}
EOH
not_if "test -e #{prefix}/linux/bin64/dmd"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cookbook_copyright(*args, &block)\n ChefConfig::Config.cookbook_copyright(*args, &block) || \"YOUR_NAME\"\n end",
"def dcv_package\n \"nice-dcv-#{node['cluster']['dcv']['version']}-#{node['cluster']['base_os']}-#{dcv_url_arch}\"\nend",
"def upgrade_direct!\n package \"Chef Development Kit... | [
"0.6678347",
"0.62990755",
"0.5932485",
"0.5849501",
"0.57798064",
"0.5748133",
"0.5626334",
"0.5623038",
"0.55313396",
"0.55291367",
"0.5514266",
"0.54686016",
"0.5433542",
"0.54313076",
"0.54295355",
"0.54104596",
"0.5406422",
"0.5391768",
"0.53777385",
"0.53777385",
"0.537... | 0.5193749 | 32 |
Returns an array of hashes, containing a "name" key and a "last_built" key The api returns build names with a starting slash, this will remove them. | def list_all
response_json = @client.api_get_request("/api/build")
return nil unless response_json
response_json["builds"].map do |build|
{
:name => build["uri"].sub(/^\//,''),
:uri => build["uri"],
:lastStarted => build["lastStarted"]
}
end.sort{ |x,y| x[:name] <=> y[:name]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_build_git_data\n describe = @repo.recent_tag_name()\n m = describe.match(/(\\D*)(\\d+)/)\n build = 0\n if (m && m.length == 3)\n build = m[2].to_i\n tag_name = m[1]\n if (build > 0)\n puts \"most recent tag found is for build #{build}\"\n else\n build = 0\n ... | [
"0.584786",
"0.5784656",
"0.5387258",
"0.5155561",
"0.5073297",
"0.5059637",
"0.5050596",
"0.5013301",
"0.49894422",
"0.49527505",
"0.494674",
"0.49460056",
"0.49014577",
"0.48917812",
"0.48629564",
"0.48529044",
"0.48496342",
"0.48386088",
"0.4824336",
"0.48113132",
"0.48076... | 0.67674875 | 0 |
Different implementation of pbCanChooseMove, ignores Imprison/Torment/Taunt/Disable/Encore | def pbCanChooseMovePartial?(idxPokemon,idxMove)
thispkmn = @battlers[idxPokemon]
thismove = thispkmn.moves[idxMove]
return false if !thismove
return false if thismove.pp<=0
if thispkmn.effects[PBEffects::ChoiceBand] &&
thismove.id!=thispkmn.effects[PBEffects::ChoiceBand] &&
thispkmn.hasActiveItem?(:CHOICEBAND)
return false
end
# though incorrect, just for convenience (actually checks Torment later)
if thispkmn.effects[PBEffects::Torment] && thispkmn.lastMoveUsed
return false if thismove.id==thispkmn.lastMoveUsed
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbCanChooseMovePartial?(idxPokemon,idxMove)\n thispkmn=@battlers[idxPokemon]\n thismove=thispkmn.moves[idxMove]\n if !thismove||thismove.id==0\n return false\n end\n if thismove.pp<=0\n return false\n end\n if thispkmn.effects[PBEffects::ChoiceBand]>=0 && \n thismove.id!=th... | [
"0.709426",
"0.7005747",
"0.6958453",
"0.659601",
"0.65264434",
"0.62771046",
"0.623979",
"0.6228839",
"0.62142336",
"0.6211058",
"0.6202936",
"0.6202936",
"0.6190619",
"0.61391425",
"0.61338425",
"0.611215",
"0.6110754",
"0.61061174",
"0.60931545",
"0.6076005",
"0.6068306",
... | 0.7128005 | 0 |
Renders a standard form for the given entry and attributes. The form is rendered with a basic save and cancel button. If a block is given, custom input fields may be rendered and attrs is ignored. An options hash may be given as the last argument. | def crud_form(object, *attrs, &block)
options = attrs.extract_options!
cancel_url = get_cancel_url(object, options)
standard_form(object, options) do |form|
content = if block_given?
capture(form, &block)
else
form.labeled_input_fields(*attrs)
end
content << form.standard_actions(cancel_url)
content.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crud_form(*attrs, &block)\n options = attrs.extract_options!\n attrs = default_crud_attrs - %i[created_at updated_at] if attrs.blank?\n attrs << options\n standard_form(path_args(entry), *attrs, &block)\n end",
"def standard_form name, object, &block\n url = { :action => object.new_record... | [
"0.67744756",
"0.65925753",
"0.6542068",
"0.6239564",
"0.61956066",
"0.6089052",
"0.600753",
"0.59631395",
"0.5943752",
"0.56568545",
"0.56546175",
"0.56438816",
"0.56063324",
"0.5604265",
"0.5575987",
"0.5453502",
"0.5431545",
"0.5416182",
"0.5407022",
"0.5397343",
"0.538299... | 0.6838591 | 0 |
Create a table of the current entries with the default or the passed attributes in its columns. If attrs are present, the first column will link to the show action. Edit and destroy actions are appended to the end of each row. If a block is given, the column defined there will be inserted between the given attributes and the actions. An options hash for the table builder may be given as the last argument. | def crud_table(*attrs, &block)
options = attrs.extract_options!
attributes = (block_given? || attrs.present?) ? attrs : default_attrs
first = attributes.shift
table(entries, options) do |t|
col_show(t, first) if first
t.sortable_attrs(*attributes)
yield t if block_given?
add_table_actions(t)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crud_table(*attrs, &block)\n attrs, options = explode_attrs_with_options(attrs, &block)\n first = attrs.shift\n plain_table_or_message(entries, options) do |t|\n t.attr_with_show_link(first) if first\n t.sortable_attrs(*attrs)\n yield t if block_given?\n standard_table_actions(t)\n... | [
"0.74814767",
"0.71632415",
"0.6712874",
"0.66115165",
"0.65701383",
"0.63809794",
"0.63164794",
"0.61700785",
"0.61553603",
"0.60609627",
"0.59231657",
"0.58755726",
"0.5837494",
"0.5837494",
"0.58272314",
"0.5771241",
"0.57452124",
"0.5705394",
"0.56821764",
"0.5673844",
"0... | 0.7765324 | 0 |
Adds a set of standard action link column (show, edit, destroy) to the given table. | def add_table_actions(table)
action_col_edit(table)
action_col_destroy(table)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_table_actions(table)\n action_col_show(table)\n action_col_edit(table)\n action_col_destroy(table)\n end",
"def standard_table_actions(table)\n table.edit_action_col\n table.destroy_action_col\n end",
"def action_col_edit(table, &block)\n action_col(table) do |e|\n path = actio... | [
"0.7962735",
"0.7610893",
"0.6865187",
"0.6865187",
"0.6479736",
"0.6479736",
"0.6389209",
"0.61375916",
"0.6081967",
"0.60744476",
"0.60744476",
"0.5918653",
"0.5857348",
"0.5831888",
"0.58283824",
"0.58004254",
"0.57994765",
"0.57664526",
"0.5489636",
"0.5437461",
"0.543746... | 0.77921575 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.