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
Adds ActiveRecord like behavior... obj.attribute and obj.attribute=
def method_missing(m, *args) if m =~ /^\w+=$/ self.store(m.to_s.chop.to_sym, args[0]) elsif self[m] self[m] else 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block)\n attribute = method.to_s\n\n if attribute =~ /=$/ # Define property -- does not have to exist\n attribute = attribute.chop\n self.changed_attributes[attribute] = args[0]\n self.attributes[attribute] = args[0]\n else\n return supe...
[ "0.63366854", "0.62917686", "0.604256", "0.6030619", "0.60144436", "0.6006607", "0.5989939", "0.5973373", "0.5934919", "0.5910228", "0.58683234", "0.5862554", "0.5861144", "0.58536553", "0.58130896", "0.5791642", "0.57739097", "0.5773152", "0.5762754", "0.57625943", "0.574481...
0.0
-1
::build_key(Hash) builds the key to be used in the records hash
def build_key(h) keys.inject('') {|acc, key| acc = "#{acc}\x01#{h[key]}"}[1..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_key(last_part)\n [scope[:id], super].compact.join(\"_\")\n end", "def build_key(instance)\n @key_processor.call(instance)\n end", "def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end", "def generate_key; end", "def key_builder()\n Transforme...
[ "0.6941861", "0.6864663", "0.6850445", "0.6696811", "0.66181946", "0.65570074", "0.646316", "0.62811035", "0.6219578", "0.6214155", "0.6207073", "0.61115026", "0.6111386", "0.6093192", "0.6086668", "0.60743064", "0.6071319", "0.6060819", "0.605909", "0.603762", "0.6027215", ...
0.63530964
7
::find(Hash) find will find records using == pass whatever key/values you want to search by find(player_id: 'matt', year: 2000) => return records with player_id = matt AND year = 2000 Will first look for a record with matching keys (fast). If args do not contain all key columns ::find will resort to what is basically a...
def find(*args) raise ArgumentError unless args[0].is_a?(Hash) r = [] # If args[0] has ALL of the class keys then look based on the key values # If args[0] does not have ALL of the class keys then drop to the table scan approach if args[0].has_keys?(keys) # If the keys of args are a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_player(player_name)\n all_players.find do |player|\n player[:player_name] == player_name\n end\nend", "def find_player(players, name)\n players.find do |player|\n player[:player_name] == name\n end\nend", "def player_stats(name)\n all_players.find do |player|\n player[:player_name] =...
[ "0.7402024", "0.73556584", "0.67871195", "0.6769848", "0.6615293", "0.6615293", "0.6536027", "0.6450532", "0.6193148", "0.6191058", "0.613636", "0.6063024", "0.6037542", "0.59945506", "0.59932274", "0.59749794", "0.5931227", "0.5921537", "0.590049", "0.5874375", "0.58661056",...
0.6920382
2
Does what is says on the tin, finds the max attribute for a list of filters The filters are of the same format as those used in find attribute should be a Symbol representing the attribute that is used in the comparison find_max(:home_runs, year: year, league: league, "at_bats>" => 400)
def find_max(attribute, *filters) winner = [] max = 0 found = find(filters[0]) if found found.each do |r| if r.send(attribute) > max winner = [r] max = r.send(attribute) elsif r.send(attribute) == max winner << r end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_w_biggest_feet\n all_players[1].max_by { |stats| stats[:shoe] }\n end", "def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to...
[ "0.6365856", "0.6260234", "0.61932373", "0.614294", "0.6131541", "0.6122067", "0.6117758", "0.61088896", "0.6075084", "0.60710573", "0.6028975", "0.6002671", "0.5995976", "0.5981836", "0.5976314", "0.5931158", "0.5907509", "0.5887445", "0.58872306", "0.58867836", "0.58822817"...
0.7803913
0
Loads records into itself. Does this by either creating a new descendant of Record and adding it to itself OR updating the existing Record object, typically adding the new values to the existing values Accepts a Hash, does not to be a descendant of Record. Remember the Hash must have the required keys to be accepted by...
def load(record, bulk = false) return unless record.is_a?(Hash) && record.has_keys?(keys) if bulk # just insert the record, this is a bulk load of data new(record) else # Do I already have a record with these key values? s = {} keys.each { |k| s[k] = record[k] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load\n assert_keys_present!\n record_collection.load! unless loaded?\n self\n end", "def load\n records.load\n end", "def load record\n end", "def load(hash)\n Loader.load(hash)\n end", "def load\n records.__send__(:load)\n ...
[ "0.66704416", "0.6573629", "0.6523509", "0.62833554", "0.61761177", "0.60578054", "0.6022379", "0.60009927", "0.59410113", "0.59296924", "0.58928734", "0.5875669", "0.5794726", "0.57470393", "0.57234097", "0.5708958", "0.5693412", "0.5672977", "0.5635607", "0.55982864", "0.55...
0.65152854
3
TERMS USED Expands the Terms Used section of the sidebar
def expand_sidebar_terms_used scroll_to_top sleep Config.click_wait wait_for_element_and_click terms_used_button_locator unless exists?(terms_used_expanded_div_locator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terms\n @title = \"community terms\"\n end", "def usage_terms\n if request.post?\n # OPTIMIZE check if really submitted the form (hidden variable?)\n current_user.usage_terms_accepted!\n redirect_to root_path\n else\n @usage_term = UsageTerm.current\n \n @title = \"Med...
[ "0.6495364", "0.63975066", "0.63738275", "0.62862617", "0.62862617", "0.62587607", "0.6238618", "0.60637724", "0.60387164", "0.5925459", "0.5905178", "0.58800775", "0.5860869", "0.584349", "0.5833397", "0.58110964", "0.5793787", "0.57736355", "0.5768858", "0.5740081", "0.5725...
0.70468295
0
Clicks the link for a Term in the sidebar
def click_sidebar_term(term) wait_for_element_and_click terms_used_term_link_locator(term) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_term_list_link\n wait_for_page_and_click term_lists_link\n end", "def click(link); end", "def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend", "def open_tree(text)\n @browser.link(:title=>text).parent.ins.fire_event(\"onclick\")...
[ "0.764306", "0.6752082", "0.66479707", "0.6445817", "0.63761234", "0.61413175", "0.6138972", "0.60705096", "0.6070192", "0.60258365", "0.6012082", "0.59648883", "0.59554744", "0.5894778", "0.585016", "0.58383757", "0.5815546", "0.57941294", "0.57565683", "0.573391", "0.572145...
0.8166563
0
USED BY Expands the Used By section of the sidebar
def expand_sidebar_used_by scroll_to_top sleep Config.click_wait wait_for_element_and_click used_by_button_locator unless exists?(used_by_expanded_div_locator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand_sidebar_terms_used\n scroll_to_top\n sleep Config.click_wait\n wait_for_element_and_click terms_used_button_locator unless exists?(terms_used_expanded_div_locator)\n end", "def ad_widget_sidebar\n # \"TODO AD\"\n end", "def sidebar_items\n @sidebar_items ||= []\n end", "def sideb...
[ "0.64556384", "0.61762285", "0.59648603", "0.55098176", "0.55032516", "0.549653", "0.5470928", "0.54383785", "0.5410035", "0.53747666", "0.5345445", "0.5314899", "0.5309623", "0.5298067", "0.5284704", "0.52830094", "0.5277303", "0.5268032", "0.5260406", "0.52171165", "0.52161...
0.6414986
1
Clicks the link for a Used By record in the sidebar
def click_sidebar_used_by(identifier) wait_for_element_and_click used_by_link_locator(identifier) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(link); end", "def click_add_agency_link\n add_agency_link.click\n end", "def click_on_link(selector)\n\n click_link(selector)\n\n end", "def clickPeopleLink()\n sleep(5)\n @driver.find_element(:xpath, \"//*[@id='main-content']/nav/div[2]/div/a[3]\").click\n wait = Selenium::W...
[ "0.66410124", "0.60669893", "0.59921783", "0.59702003", "0.5911426", "0.5911378", "0.59097755", "0.5909129", "0.58887035", "0.58873075", "0.58635974", "0.585307", "0.58484554", "0.576875", "0.57506216", "0.5731281", "0.5729309", "0.5721427", "0.5701784", "0.5695334", "0.56782...
0.6680862
0
RELATED PROCEDURES Clicks the Add button to relate two procedures
def click_add_related_procedure wait_for_element_and_click related_procedures_add_button end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_button_clicked\n\t\t\n\t\t\t# Eventually create browse form\n\t\t\tcreate_browse_form\n\t\t\n\t\t\t# Show and activate the child window\n\t\t\tshow_browse_form\n\t\tend", "def add\n frm.button(:value=>\"Add\").click\n end", "def add\n\tend", "def add\n\nend", "def relate\n model_to_relate = ...
[ "0.6177135", "0.58542484", "0.57246864", "0.567157", "0.565887", "0.56314176", "0.56216884", "0.55899304", "0.55809355", "0.5579343", "0.5579343", "0.5465366", "0.54579383", "0.54198515", "0.54137146", "0.5388567", "0.53793865", "0.5369571", "0.53536034", "0.5308312", "0.5306...
0.74824476
0
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.require(:post).permit(:name, :content, :filename, :category_id, :filename_cache) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
symbolize :gender, :in => [ :male, :female ], :scopes => true, :methods => true
def url(*args) avatar.url(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gender; end", "def gender\n case\n when male && female then :unisex\n when male then :male\n when female then :female\n end\n end", "def female?\n self.gender == 'f'\n end", "def male?\n self.gender == 'm'\n end", "def show_gender\n Gender[gender.to_i]\n end", "def gender\...
[ "0.66298956", "0.66271234", "0.6385531", "0.6367747", "0.63103837", "0.6243089", "0.62033874", "0.6176855", "0.60856324", "0.60773575", "0.60495204", "0.6042786", "0.60294867", "0.59900033", "0.5988032", "0.5982858", "0.59232825", "0.58830416", "0.5881686", "0.58685666", "0.5...
0.0
-1
render_menu(), or more precisely menu_items() doesn't seem to work well for rendering a top menu when you want the ancestor item of the current page highlighted. The problem is that it compares each menu item with the current page, when the current page may be several levels deep under one of the menu items. Fortunatel...
def render_menu2(aOptions=nil) opts = { :from_top => 0, # menu root is how many levels down from root (0 = roots immediate children) :depth => 1, # depth of menu from menu root :show_all_siblings => true } opts.merge!(aOptions) if aOptions selected_page = opts[:page] || @page ancestors =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu_ancestors\n # NOTE Root level menus are not links, shift it off. \"Home\" crumb is handled in app controller\n @menu_ancestors ||= (master_menu.try(:ancestors) || []).tap {|m| m.shift }\n end", "def main_menu(include_children=true,&block)\n menu_items = []\n \n if (root_menus=SiteMenu.r...
[ "0.659602", "0.6453171", "0.6433179", "0.6383069", "0.63428205", "0.63373566", "0.62784916", "0.6257125", "0.6248722", "0.6214005", "0.6153425", "0.61468077", "0.6118969", "0.60924864", "0.60623074", "0.6056167", "0.60294676", "0.6025751", "0.60221696", "0.5986065", "0.597360...
0.7418573
0
Construct tree_nodes, an array of arrays each array a level in tree. Each level is a list children to the parents in the level before
def construct_category_tree(aRootCategory) level_nodes = case aRootCategory when String [Category.find_by_name(aRootCategory)] when Category [aRootCategory] when CategoryType [aRootCategory.categories.top_level] else CategoryType.first.categories.top_level end tree_nodes = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tree(arr)\n #arr.shuffle!\n arr.each do |x|\n if @root == nil\n @root = Node.new(x)\n else\n current_node = @root\n until current_node == nil\n if x < current_node.value\n parent = current_node\n direction = \"left\"\n current...
[ "0.7015684", "0.69572264", "0.68652356", "0.6830258", "0.68123347", "0.6779125", "0.6756247", "0.6737687", "0.67179346", "0.6705485", "0.670259", "0.6699491", "0.6623843", "0.65716577", "0.65564376", "0.6523076", "0.65201753", "0.64332837", "0.6431727", "0.6424456", "0.641611...
0.0
-1
:base_url (String) : prepended to menu urls eg. /products :category (String) : name of current category eg. 'Shoes' :id_prefix (String) : will be prepended to ids of menu eg. 'section_'
def category_menu_items(aRootCategory, aOptions={}) aBaseUrl = (aOptions[:base_url] || '') aIdPrefix = (aOptions[:id_prefix] || '') category = aOptions[:category] category = category.name.urlize('+') if category.is_a?(Category) tree_nodes = construct_category_tree(aRootCategory) # now turn tree_node...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base_url_path=(_arg0); end", "def base_url_path; end", "def baseurl=(_arg0); end", "def base_url\n context[:base_url] || \"/\"\n end", "def base_url(id = \"\", action = nil)\n route = base_route + \"/\" + id.to_s\n if action.present?\n route += \"/\" + action\n end\n ...
[ "0.6487596", "0.6391506", "0.62922287", "0.614285", "0.6136714", "0.61279094", "0.6098871", "0.6082665", "0.60777044", "0.603265", "0.60315883", "0.6018697", "0.59907556", "0.59907556", "0.5974497", "0.59681296", "0.5953587", "0.5943927", "0.5881499", "0.5881499", "0.58807844...
0.0
-1
Column name for the submission ID.
def sid_column end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_name\n Name.new(\"#{name}_id\")\n end", "def column_name\n ensure_setup!\n column.name.to_sym\n end", "def column_name\n name.to_sym\n end", "def column_name; end", "def my_column_name\n return @my_column_name if defined? @my_column_name\n if is_sq?\n ...
[ "0.77341586", "0.7024261", "0.70159256", "0.6764477", "0.6644978", "0.6613423", "0.6572826", "0.64936095", "0.6487555", "0.64858884", "0.6404345", "0.63927025", "0.6389578", "0.63862026", "0.6364175", "0.6361552", "0.6304455", "0.62587744", "0.62017363", "0.6190688", "0.61498...
0.5807475
55
Rank students by their adjusted consultant points.
def setup_rank_by_consulting @sem_studs_hash.sort_by{|x| x[:last_consultant_day]}.map{|x| x[:user]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ranked_points\n points.to_f/User.top_ranked.points.to_f * 100\n end", "def calculate_rank_and_grade \n points_off = 0\n points_off += self.opt_out_count * 5 \n points_off += self.un_solicited_count * 10 \n points_off += self.sell_count * 21 \n points_off += self.vulg...
[ "0.6800633", "0.67904353", "0.6621305", "0.64310455", "0.63388455", "0.6307201", "0.6282247", "0.6023717", "0.5857143", "0.5825918", "0.57696533", "0.576617", "0.57252467", "0.5710875", "0.56971353", "0.5690036", "0.56745404", "0.5644349", "0.56396025", "0.5623147", "0.562118...
0.6811722
0
Establish a new consultant group
def establish_new_group(user_id, obj, is_consult) # Bracket 0 = normal # Bracket 1 = unplaced students # Bracket 2 = absent students new_team = {} new_team[:consultant_id] = nil new_team[:consultant_id] = user_id if is_consult new_team[:objective_id] = obj new_team[:user_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createGroup\n call :createGroup\n end", "def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end", "def init_personal_group\n group = Group.new(_id: id, is_personal:true, name: email)\n group.save\n\n se...
[ "0.7107463", "0.69258714", "0.68401337", "0.67514014", "0.6701233", "0.66381806", "0.66364247", "0.650004", "0.6480461", "0.6479748", "0.642315", "0.6417816", "0.64137936", "0.6412405", "0.64120287", "0.6395035", "0.6395035", "0.6395035", "0.6395035", "0.6395035", "0.6386066"...
0.679784
3
SORT APPRENTICES INTO CONSULTANT GROUPS First, try to place apprentices into groups offering their learn Requests
def place_apprentices_by_requests def find_student_by_request(team) this_obj = team[:objective_id] these_studs = @sem_studs_hash .select{|x| x[:learn_request] == this_obj && @unplaced_students.include?(x[:user]) }.map{|x| x[:user]} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_kids(num_groups)\n kids = self.elemental_session_bookings.map(&:kid_id)\n total_kids = kids.count\n group_quorum = 10\n num_groups = 4\n categories = [\"age\"]\n match_points_arr = []\n\t\n\tif group_quorum < total_kids\n\t\t(0...kids.count).each do |i|\n\t\t\t(0...i).each do |j|\n\t\t\t...
[ "0.5842704", "0.53931254", "0.5353704", "0.53458846", "0.53281885", "0.53130054", "0.5240079", "0.52131146", "0.5171698", "0.5149591", "0.51266366", "0.5119281", "0.5091516", "0.5087027", "0.5085085", "0.50821984", "0.5080885", "0.50631315", "0.50522673", "0.5048365", "0.5041...
0.62230307
0
Most students probably won't be placed by their requests. Place them by the group that can fit them. Look for readiness next
def add_to_group(team, this_user) team[:user_ids] << this_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_apprentices_by_requests\n def find_student_by_request(team)\n this_obj = team[:objective_id]\n these_studs = @sem_studs_hash\n .select{|x|\n x[:learn_request] == this_obj &&\n @unplaced_students.include?(x[:user])\n }.map{|x...
[ "0.73876476", "0.6697955", "0.64205486", "0.62104386", "0.62004906", "0.613155", "0.59736985", "0.5956701", "0.5887975", "0.5871509", "0.58211905", "0.58023185", "0.5756648", "0.5749707", "0.570072", "0.5679717", "0.56414557", "0.56043166", "0.55840725", "0.5580634", "0.55754...
0.0
-1
We need to centralize logic for navigating a MVW's members to find a thumbnail file set. This is a hack to use the helper's logic for doing that. refactor ticketed as
def helper @helper ||= ManifestBuilder::ManifestHelper.new.tap do |helper| helper.singleton_class.include(ThumbnailHelper) helper.define_singleton_method(:image_tag) do |url, _opts| url end helper.define_singleton_method(:image_path) do |url| url end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_thumbnail_file\n map_set = MapSet.find(geo_work.id)\n image_work = map_set.thumbnail\n return unless image_work\n image_work_presenter = ImageWorkShowPresenter.new(SolrDocument.new(image_work.to_solr), nil)\n file_set_id = image_work_presenter.solr_document.representativ...
[ "0.6656756", "0.636969", "0.6358138", "0.63074905", "0.61021787", "0.5976462", "0.5933115", "0.58867013", "0.57478994", "0.5713906", "0.5699172", "0.5674707", "0.5657208", "0.5645035", "0.5640589", "0.55804366", "0.55737185", "0.55377537", "0.553586", "0.5534529", "0.55258125...
0.0
-1
we are creating a empty array
def line(katz_deli) # we are defining the method line thats take the arguement of katz_deli if(katz_deli.length == 0) # if the above statment is true than it will run the code below puts "The line is currently empty." #what will be out put if the if statment = true else line_with_guest = "The line is current...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize; @ary = []; end", "def create_empty_array\n @outcome_array = Array.new(find_number_of_rows+1) { Array.new(find_number_of_columns+1) }\nend", "def build_array\n arr = []\n yield(arr)\n arr \n end", "def initialize\n @array = []\n end", "def to_a; []; end", "def create...
[ "0.75164014", "0.7448181", "0.72010976", "0.7027814", "0.6970403", "0.69548714", "0.69473845", "0.69341236", "0.6928652", "0.69131714", "0.69034225", "0.68978107", "0.6871326", "0.6747174", "0.6725007", "0.6626741", "0.6601602", "0.6570333", "0.6561494", "0.650412", "0.647495...
0.0
-1
Wraps check_authorization in order to prevent nested child routes from being validated by the forums controller
def check_forum_authentication check_authentication unless controller_name != "forums" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def authorize_destroy\n if forum?\n redirect_to home_url unless current_person.admin?\n elsif blog?\n authorize_change\n end\n end", "def authorize_new\n if for...
[ "0.6344656", "0.63339394", "0.6275228", "0.6252201", "0.62207353", "0.61569166", "0.61564386", "0.6139566", "0.61321557", "0.61321557", "0.6130728", "0.6114601", "0.6110252", "0.6101472", "0.60497195", "0.60368407", "0.60334057", "0.6025907", "0.60230273", "0.60212535", "0.60...
0.6847551
0
Summarize the number of entries/latest entry for a feed
def feed_status_summary feed entry_report = case nmatches = feed.feed_entries.size when 0 "No&nbsp;entries" when 1 "One&nbsp;entry" else "#{nmatches}&nbsp;entries" end time_report = (feed.updated_at.today?) ? "Today" : "#{time_ago_in_words feed.updated_at} ago" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feeds_with_top_tweets\n\n end", "def initial_unread_entries\n update unread_entries: feed.entries.count\n end", "def total_entries\n @total_entries ||= begin\n @watched_cursor.rewind!\n @watched_cursor.map {|w| w['movie_id'] }.uniq.size\n end\n end", "def feed_items_count\n read_...
[ "0.6645568", "0.66129774", "0.6552451", "0.6542986", "0.63604975", "0.6318069", "0.63042504", "0.6249046", "0.6221749", "0.6161122", "0.6151567", "0.6119621", "0.60870934", "0.6082616", "0.6063337", "0.60149956", "0.5999919", "0.5987132", "0.5955673", "0.59521055", "0.5947931...
0.6957136
0
GET /products GET /products.json
def index @products = Product.admin_grid(params).order(sort_column + " " + sort_direction). paginate(:page => pagination_page, :per_page => pagination_rows) if params[:show_search].present? @show_search = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def products\n request :public, :get, :products\n end", "def index\n @products = Product.all\n render json: @products\n end", "def index\n begin\n ...
[ "0.79500145", "0.7929853", "0.79054135", "0.77477723", "0.76619905", "0.7622153", "0.762195", "0.762195", "0.762195", "0.76070404", "0.75873625", "0.75828224", "0.7578298", "0.75750685", "0.7565435", "0.7565435", "0.7565435", "0.7565435", "0.7530454", "0.7523024", "0.75097287...
0.0
-1
GET /products/1 GET /products/1.json
def show # to add tools to product if params[:select].present? @new_parent = Product.find(params[:select]) if @new_parent ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id) end end @products = Product.admin_grid(params).order(sort_column + " " +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n jso...
[ "0.77234405", "0.76326126", "0.76310503", "0.7606898", "0.7575656", "0.7552185", "0.7506532", "0.7484357", "0.74552315", "0.74494064", "0.74374163", "0.7421134", "0.7362316", "0.73180485", "0.7317839", "0.7317839", "0.7317839", "0.7315688", "0.7311242", "0.73086977", "0.72935...
0.0
-1
POST /products POST /products.json
def create trim_name = product_params[:name].strip @product = Product.new(product_params) respond_to do |format| if @product.save @product.update_attributes(:name => trim_name) ProductVariant.create(:product_id => @product.id, :price => 0) format.html { redirect_back_or(admin_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:products]\n params[:products].each do |product|\n @...
[ "0.7674954", "0.7589692", "0.756074", "0.7531862", "0.7531213", "0.7507928", "0.7420413", "0.7391407", "0.7374718", "0.7355908", "0.73231804", "0.72869605", "0.7144144", "0.7050259", "0.7047559", "0.70415026", "0.7037288", "0.7037288", "0.7037288", "0.70322204", "0.70255643",...
0.0
-1
PATCH/PUT /products/1 PATCH/PUT /products/1.json
def update respond_to do |format| if @product.update(product_params) format.html { redirect_to action: 'show', notice: 'Product was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @product.err...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @colle...
[ "0.7269931", "0.6935652", "0.68690825", "0.6846676", "0.68126076", "0.67678404", "0.6749974", "0.6741848", "0.67151767", "0.6700884", "0.6686023", "0.66597176", "0.6654553", "0.66536564", "0.664067", "0.664067", "0.66382414", "0.6631012", "0.6631012", "0.6627257", "0.6620688"...
0.65274733
51
DELETE /products/1 DELETE /products/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to admin_merchandise_products_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end", ...
[ "0.7716644", "0.759276", "0.7548364", "0.7502707", "0.7502162", "0.7474083", "0.74392855", "0.74177706", "0.74084336", "0.7370349", "0.7352984", "0.73479444", "0.73356533", "0.73356533", "0.73356533", "0.7330906", "0.7330906", "0.7330906", "0.7330906", "0.7330906", "0.7330906...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_product @product = Product.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def product_params params.require(:product).permit(:name, :image, :nature, :menu_parent, :variant_name, :video, :how2fix, :description, :meta_description, :meta_keyword, :views, :active,:tool_id, :new_parent_map => ['product_id', 'select']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
Scope the connection by the fields you're interested in. By default, the connection will load all the possible fields for the connection, which can result in a fairly large overhead if you're only interested in the `first_name`, for example. The parameter to this method can be almost anything which can intuitively be c...
def fields(*fields) ConnectionScope.new(*_scope_initializer_args(:fields, fields.flatten.join(","))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields(fields = nil)\n set_option(:fields, fields)\n end", "def all_person_fields(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'personFields', params)\n end", "def field(*fields)\n options = fields.extract_options!\n\n ...
[ "0.63638735", "0.62269753", "0.6222647", "0.61156267", "0.61156267", "0.5954569", "0.59200466", "0.5911276", "0.5887628", "0.5887628", "0.586328", "0.58568573", "0.5836781", "0.57825875", "0.57805395", "0.57643974", "0.5733263", "0.57302755", "0.5721541", "0.5701152", "0.5689...
0.69241256
0
If the number is divisible by 3 alone Return string "Mined" If the number is divisible by 5 alone Return string "Minds" If the number is divisible by 3 and 5 Return string "Mined Minds"
def fizzbuzz(num) if num % 3 == 0 "Mined" elsif num == 5 "Minds" else num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cracklepop_number(number)\n ret = number\n ret = 'Crackle' if number.divisible_by?(3)\n ret = 'Pop' if number.divisible_by?(5)\n ret = 'CracklePop' if number.divisible_by?(3, 5)\n\n ret\nend", "def crackle(number)\n\treturn \"Crackle\" if number % 3 == 0\nend", "def divisible(n)\n if n != nil\n # di...
[ "0.7816328", "0.7279769", "0.7057157", "0.6958595", "0.6919789", "0.68990153", "0.688847", "0.67596275", "0.6728542", "0.67090577", "0.66965866", "0.6656405", "0.66404486", "0.6630404", "0.6602594", "0.6591056", "0.6572354", "0.6565825", "0.6543677", "0.65403116", "0.65114224...
0.63549316
32
the mutation method _obj is parent object, which in this case is nil args are the arguments passed _ctx is the GraphQL context (which would be discussed later)
def call(_obj, args, ctx) Story.create( title: args["title"], user_id: args["user_id"], content: args["content"] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end", "def update!(**args)\n @mutation_context = args[:mutation...
[ "0.65591615", "0.65591615", "0.65591615", "0.5901533", "0.58603203", "0.5798668", "0.5695678", "0.56949794", "0.5446301", "0.5358371", "0.5354488", "0.53041923", "0.5261099", "0.5225616", "0.51936144", "0.515589", "0.515589", "0.5145289", "0.5116805", "0.508859", "0.5081262",...
0.0
-1
rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def me q = Question.approved @my_answers_count = Question.approved.where(id: current_account.answers.map(&:parent_id)).count @unanswered_questions_count = Question.approved.where(children_count: 0) .where.not(id: current_account.answers.map(&:parent_id)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def strategy; end", "def schubert; end", "def offences_by; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def ...
[ "0.72951365", "0.6076349", "0.6040893", "0.6040893", "0.59723234", "0.5928117", "0.58679", "0.5848406", "0.57834214", "0.57834214", "0.57834214", "0.57834214", "0.5734111", "0.5734111", "0.5733732", "0.5697679", "0.5682407", "0.5677162", "0.5677162", "0.5677162", "0.56716436"...
0.0
-1
should return a resource record of some type for this linked document
def record_for(link_def) data[link_def["type"]][link_def["id"]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_type\n document_type\n end", "def resource_type\n document_type\n end", "def resource\n return Object unless resource_type\n return resource_type.constantize unless resource_id\n return _resource\n end", "def resource\n @document.resource\n end", "def get_type\n re...
[ "0.71243876", "0.71243876", "0.7010044", "0.69144475", "0.67356896", "0.6727988", "0.6681352", "0.66014284", "0.64201856", "0.6366705", "0.6326897", "0.62909", "0.6290639", "0.6256519", "0.62484443", "0.62484443", "0.62484443", "0.62484443", "0.6240031", "0.62360364", "0.6222...
0.6147065
25
Each new object of class Computer needs a username and password. Create empty hash to track files.
def initialize(username, password) @username = username @password = password @files = {} @@users[username] = password end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(username, password)\n # set the instance variables to respectives these parameters\n @username = username\n @password = password\n @@users[username] = password\n # instance variable = empty hash\n @files = {}\n end", "def initialize(username, password)\n @username = usern...
[ "0.73739845", "0.7106942", "0.6380158", "0.62162167", "0.6190767", "0.6176218", "0.612617", "0.6072431", "0.6025665", "0.6021882", "0.59886515", "0.59886515", "0.5936839", "0.5898892", "0.5814478", "0.57893586", "0.57819265", "0.5767114", "0.5748159", "0.5741892", "0.57345355...
0.7226912
1
Define a method called create with a single parameter, filename. Declare a variable called time and set it to the current time.
def create(filename) time = Time.now @files[filename] = time puts "#{filename} was created by #{@username} at #{time}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end", "def create(filename)\n @filename = filename\n time = Time.now\n @@fil...
[ "0.8221944", "0.79424167", "0.76661503", "0.68853724", "0.68579865", "0.6801479", "0.6698036", "0.6535289", "0.6515122", "0.6416029", "0.6345898", "0.63428044", "0.63242024", "0.6317148", "0.62533474", "0.6164655", "0.6090458", "0.60827214", "0.60778004", "0.6058254", "0.6005...
0.8109628
1
precisely once. Test it with these strings: blueberry blackberry black berry strawberry
def match_in_string?(string, regex) string.match(regex).class == MatchData end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_string(string)\n\tzombie_apocalypse_supplies = [\"hatchet\", \"rations\", \"water jug\", \"binoculars\",\n \"shotgun\", \"compass\", \"CB radio\", \"batteries\"]\n\tzombie_apocalypse_supplies.each do |item|\n\t\tif string.downcase == item.downcase\n\t\t\treturn true\n\t\tend\...
[ "0.602526", "0.5929596", "0.5899397", "0.5888235", "0.58733344", "0.58348966", "0.58283037", "0.5801027", "0.5777898", "0.5770887", "0.5749583", "0.5743439", "0.5741446", "0.5731136", "0.5720296", "0.57175905", "0.57120174", "0.57108575", "0.5687362", "0.5684958", "0.5682986"...
0.0
-1
Print RuboCop report for a single file, using `MSMFGSpecHelper::Logger`
def file_finished(file, offenses) report = { task: 'lint', file_path: Pathname.new(file).relative_path_from(Pathname.pwd).to_s } offenses.each do |offense| severity = case offense.severity.name when :refactor, :convention, :warning then :warn ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_to_report_file message\n @spec_report_file.puts message\n end", "def __log_report(file)\n print \"Rendering `#{file}'...\" if @ocproblem.verbose\n yield\n puts \"done!\" if @ocproblem.verbose\n end", "def print\n # TODO: add a flag for textmate, the ugliest format ever...
[ "0.69768345", "0.61930376", "0.6100125", "0.6039978", "0.5964437", "0.58882016", "0.5842301", "0.58361524", "0.5784942", "0.576321", "0.57596016", "0.5741968", "0.57358146", "0.572451", "0.570415", "0.570415", "0.570415", "0.570415", "0.570415", "0.5700925", "0.5682777", "0...
0.51957
76
Si es departamento, devuelve el mismo, si es organizacion, devuelve su parent
def department if self.is_a?(Department) self elsif self.is_a?(Entity) self.parent end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent\n raise \"undefined parent Organization\" unless organization?\n organization\n end", "def departamento_nombre\n\t departamento.nombre if departamento\n\tend", "def set_socioeduk_saude_jovens_tipo_parentesco_doenca_mental\n @socioeduk_saude_jovens_tipo_parentesco_doenca_mental = Socio...
[ "0.6445309", "0.6319082", "0.6147643", "0.59194165", "0.5776527", "0.5751189", "0.57474893", "0.5695838", "0.56937087", "0.5659756", "0.564169", "0.56400096", "0.56342196", "0.56188357", "0.55841094", "0.5576676", "0.55664074", "0.55559534", "0.55445534", "0.55309165", "0.552...
0.66368973
0
Clasifica el organismo como Departament o Entity en funcion de si es de primer nivel o de segundo
def set_type if self.parent_id == nil self.type = "Department" else self.type = "Entity" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_modeling?\n !self[:modeling].nil? && self[:modeling] == false\n end", "def division?\n role?('division')\n end", "def ubicacion_tipo_nombre_entidad\n if self.tipo.eql?(\"pais\")\n \"#{self.nombre}\"\n elsif self.tipo.eql?(\"localidad\")\n \"#{self.nombre} (#{self.entidad_super...
[ "0.5999507", "0.5827423", "0.5720141", "0.5709233", "0.56551", "0.5577606", "0.5568735", "0.55567324", "0.5538454", "0.55216163", "0.54311454", "0.5424218", "0.53752375", "0.53752375", "0.53752375", "0.5370529", "0.53568745", "0.5348342", "0.5347196", "0.5313429", "0.5313429"...
0.0
-1
96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883...
def greatest_adjacent_product the_number = 73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eight \n max = 0\n number = 73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428...
[ "0.8318526", "0.8155133", "0.77896565", "0.7728969", "0.7616885", "0.7607735", "0.7344614", "0.732034", "0.695027", "0.69386166", "0.6837421", "0.6713042", "0.6710271", "0.67045087", "0.66803104", "0.66124415", "0.6591698", "0.65568787", "0.65398365", "0.65242857", "0.6522086...
0.79425454
2
GET /pain_assessments GET /pain_assessments.json
def index @pain_assessment = current_business.pain_assessments.order(created_at: :desc).paginate(:page => params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @assessments = Assessment.all\n end", "def index\n @assessments = Assessment.all\n end", "def set_pain_assessment\n @pain_assessment = current_business.pain_assessments.find(params[:id])\n end", "def index\n @skill_assessments = SkillAssessment.all\n end", "def index\n @r...
[ "0.7257797", "0.7257797", "0.69900686", "0.69598925", "0.6856204", "0.68119395", "0.67836154", "0.6622857", "0.66170627", "0.66121083", "0.66121083", "0.655486", "0.65537983", "0.6504575", "0.6486101", "0.64361936", "0.6374776", "0.63483226", "0.6334013", "0.6318794", "0.6292...
0.7501314
0
GET /pain_assessments/1 GET /pain_assessments/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pain_assessment = current_business.pain_assessments.order(created_at: :desc).paginate(:page => params[:page])\n end", "def set_pain_assessment\n @pain_assessment = current_business.pain_assessments.find(params[:id])\n end", "def index\n @assessments = Assessment.all\n end", "def ...
[ "0.74601173", "0.71207505", "0.6985227", "0.6985227", "0.6739707", "0.6714822", "0.6659107", "0.662901", "0.6544868", "0.65355057", "0.6531331", "0.65038896", "0.6480194", "0.64459974", "0.6419523", "0.63585377", "0.6351303", "0.6332235", "0.6313846", "0.63109255", "0.6305748...
0.0
-1
POST /pain_assessments POST /pain_assessments.json
def create @pain_assessment = current_business.pain_assessments.new(pain_assessment_params) @pain_assessment.author_id = current_user.id respond_to do |format| if @pain_assessment.save format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully created.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pain_assessment\n @pain_assessment = current_business.pain_assessments.find(params[:id])\n end", "def create\n\n @assessment = Assessment.new(assessment_params)\n respond_to do |format|\n if @assessment.save\n format.html { redirect_to @assessment, notice: 'YASASSSS.' }\n ...
[ "0.69822407", "0.6832219", "0.67722523", "0.67396677", "0.6705", "0.6705", "0.65134525", "0.64793986", "0.63964456", "0.63941574", "0.6305196", "0.6265506", "0.62467676", "0.62453645", "0.62265843", "0.6213298", "0.6204474", "0.6204474", "0.62014276", "0.6163955", "0.61173046...
0.74313664
0
PATCH/PUT /pain_assessments/1 PATCH/PUT /pain_assessments/1.json
def update @pain_assessment.author_id = current_user.id respond_to do |format| if @pain_assessment.update(pain_assessment_params) format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully updated.' } format.json { render :show, status: :ok, location: @p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @assessment = Assessment.find(params[:id])\n\n respond_to do |format|\n if @assessment.update_attributes(params[:assessment])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.jso...
[ "0.689098", "0.68687105", "0.68016803", "0.68016803", "0.6691825", "0.6691825", "0.6619459", "0.65311795", "0.6529464", "0.6464546", "0.64582175", "0.63798237", "0.63680834", "0.636238", "0.63453877", "0.63100666", "0.6304655", "0.62988955", "0.6287924", "0.6284061", "0.62829...
0.7277623
0
DELETE /pain_assessments/1 DELETE /pain_assessments/1.json
def destroy @pain_assessment.destroy respond_to do |format| format.html { redirect_to app_pain_assessments_path, notice: 'PainAssessment was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mx_assessment.destroy\n respond_to do |format|\n format.html { redirect_to mx_assessments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @assessment = @department.assessments.find(params[:id])\n @assessment.destroy\n respond_to do |format|\n ...
[ "0.7338534", "0.72790176", "0.72507924", "0.72507924", "0.72507924", "0.72065514", "0.7170686", "0.71692497", "0.71692497", "0.7149595", "0.7095018", "0.70831686", "0.70613366", "0.69930184", "0.69364053", "0.6904731", "0.69047004", "0.68188524", "0.6815543", "0.68121564", "0...
0.76953703
0
Use callbacks to share common setup or constraints between actions.
def set_pain_assessment @pain_assessment = current_business.pain_assessments.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pain_assessment_params params.require(:pain_assessment).permit(:date, :business_id, :author_id, :resident_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.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
after_action :get_overall_rating, :only => [:new, :create, :edit, :update]
def index @rating = Rating.all # This is where the list of all the ratings of the stylists will be controlled end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n set_rating\n end", "def after_save(review)\n\t\t# rating\n\t\treview.user.score += review.rating? ? 1 : 0\n\n\t\t# review\n\t\treview.user.score += review.review? ? 5 : 0\n\n\t\t# save\n\t\treview.user.save\n\tend", "def after_save\n if rateable.respond_to? :after_rate\n rateable.after_r...
[ "0.6481068", "0.6472281", "0.63616025", "0.6328339", "0.6328339", "0.6284904", "0.62660205", "0.6257719", "0.6231725", "0.6231725", "0.6223265", "0.61667067", "0.6126601", "0.6075091", "0.60502005", "0.605013", "0.5956398", "0.5916899", "0.5909036", "0.5900045", "0.58865577",...
0.0
-1
This Challenge can be solved with 1 line solution (using arr.sort! and return middle element. The complexity is O(nlogn) This solution using QuickSelect: can reduce the complexity to O(n)
def partition(list, left, right, pivotIndex) pivotValue = list[pivotIndex] list[pivotIndex], list[right] = list[right], list[pivotIndex] storeIndex = left for i in (left...right) do if list[i] < pivotValue list[storeIndex], list[i] = list[i], list[storeIndex] storeIndex += 1 end end list...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def single_in_sorted(arr)\n mid = arr.length / 2\n if arr[mid] != arr[mid - 1] && arr[mid] != arr[mid + 1]\n return arr[mid]\n elsif arr[mid] == arr[mid + 1]\n return single_in_sorted(arr.drop(mid + 1))\n else\n return single_in_sorted(arr.take(mid))\n\n end\n\n\nend", "def quickselect!(kth_lowest_...
[ "0.7244934", "0.69236714", "0.68335557", "0.6736551", "0.6717226", "0.6683258", "0.66703874", "0.66510946", "0.661539", "0.6568443", "0.6527609", "0.6516125", "0.65095156", "0.6484579", "0.6451456", "0.6448797", "0.6446792", "0.6426078", "0.6424159", "0.6411627", "0.6408128",...
0.0
-1
def get_joinable_order(drone, warehouse, orders) best_order = nil best_distance = nil
def get_best_warehouse(order) results = Array.new(@warehouses.count).fill(0) @warehouses.each_with_index do |warehouse, index| warehouse_products = warehouse.products.clone order.products.each do |product| if warehouse_products[product] > 0 results[index] += 1 #@products[product] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_orders\n return Order.where(:status => 'ordered', :dropper_id => nil, :picker_id => nil) if self.pickup_boy?\n end", "def my_pick_orders\n return Order.where(:status => 'ordered', :picker_id => self.id) if self.pickup_boy?\n end", "def first_buy_order(buy_orders, official_spread)\n # buy_or...
[ "0.59243983", "0.5734112", "0.5732149", "0.56509125", "0.5614541", "0.55894053", "0.5583726", "0.5540932", "0.54910725", "0.5458828", "0.54115546", "0.5369539", "0.53544736", "0.53357375", "0.5334593", "0.53297085", "0.5326688", "0.5322279", "0.5290783", "0.5277347", "0.52625...
0.6294835
0
events are only created inside the domain
def readonly? persisted? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_events\n end", "def events_hosting\n Event.where(:creator_uid => self.uid)\nend", "def set_event_values\n self.domain ||= self.class.event_domain\n end", "def send_events; end", "def events\n end", "def events; end", "def events; end", "def events; end", "def events; end", ...
[ "0.7527756", "0.65610856", "0.6554557", "0.6552576", "0.6492963", "0.64742863", "0.64742863", "0.64742863", "0.64742863", "0.64742863", "0.64742863", "0.64742863", "0.64742863", "0.64115363", "0.64115363", "0.6384104", "0.6375064", "0.6358738", "0.6316535", "0.6225385", "0.62...
0.0
-1
Applies pagination settings to given scope. If inherited_resources is used it applies automatically. If used standalone must be called manually.
def apply_pagination_scope(scope) settings = pagination_settings settings = instance_exec(&settings) if settings.is_a?(Proc) unless settings.nil? page = settings[:page] || params[:page] per_page = settings[:per_page] padding = settings[:padding] if defin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_pagination(params, scope = self.all)\n if params[:page] || params[:per_page]\n scope = scope.paginate(\n page: params[:page] || 1,\n per_page: params[:per_page] || 20\n )\n end\n return scope\n end", "def with_pagination(pagination_params)...
[ "0.6601141", "0.6488104", "0.63791925", "0.6113513", "0.6092171", "0.6065488", "0.60525084", "0.59461606", "0.5903651", "0.586508", "0.5819398", "0.5779137", "0.5677363", "0.5665094", "0.5629673", "0.55941087", "0.55878764", "0.5522995", "0.5504532", "0.5504352", "0.54672426"...
0.79208076
0
GET /additional_services/1 GET /additional_services/1.json
def show @additional_service = AdditionalService.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @additional_service } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @additional_services = AdditionalService.all\n end", "def index\n @additionalservices = Additionalservice.all\n end", "def new\n @additional_service = AdditionalService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @additional_servi...
[ "0.7451394", "0.7371144", "0.7018415", "0.69068617", "0.6894719", "0.65564173", "0.6489595", "0.64665836", "0.6344314", "0.6169999", "0.605221", "0.6044272", "0.60043645", "0.5966838", "0.5941017", "0.5914045", "0.59109795", "0.5908046", "0.5905937", "0.58519757", "0.5822322"...
0.76170367
0
GET /additional_services/new GET /additional_services/new.json
def new @additional_service = AdditionalService.new respond_to do |format| format.html # new.html.erb format.json { render json: @additional_service } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @additional_service = AdditionalService.new(params[:additional_service])\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' }\n format.json { render json: @additional_...
[ "0.7498198", "0.73963356", "0.72606117", "0.70817906", "0.70817906", "0.70817906", "0.70817906", "0.68509", "0.68182534", "0.6778154", "0.6723556", "0.6692901", "0.657204", "0.65616375", "0.64886796", "0.6448766", "0.64472014", "0.6435146", "0.6398034", "0.6396687", "0.638974...
0.8192642
0
POST /additional_services POST /additional_services.json
def create @additional_service = AdditionalService.new(params[:additional_service]) respond_to do |format| if @additional_service.save format.html { redirect_to @additional_service, notice: 'Additional service was successfully created.' } format.json { render json: @additional_service, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_service(service={})\n request :post, '/services', service\n end", "def create\n @additional_service = AdditionalService.new(additional_service_params)\n\n respond_to do |format|\n if @additional_service.save\n format.html { redirect_to @additional_service, notice: 'Additional servic...
[ "0.7555844", "0.7426057", "0.7327112", "0.683911", "0.6758901", "0.66150624", "0.65815437", "0.65059406", "0.64508414", "0.6351287", "0.62756616", "0.61025906", "0.60481876", "0.60402066", "0.59968853", "0.5961918", "0.59580153", "0.59104973", "0.5899899", "0.588846", "0.5865...
0.7364588
2
PUT /additional_services/1 PUT /additional_services/1.json
def update @additional_service = AdditionalService.find(params[:id]) respond_to do |format| if @additional_service.update_attributes(params[:additional_service]) format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' } format.json { head :no_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @additional_service.update(additional_service_params)\n format.html { redirect_to @additional_service, notice: 'Additional service was successfully updated.' }\n format.json { render :show, status: :ok, location: @additional_service }\n else\n ...
[ "0.70934635", "0.70091677", "0.6966768", "0.6937908", "0.68231666", "0.6451618", "0.64483017", "0.63923717", "0.63584095", "0.6331202", "0.6251804", "0.6200184", "0.61866444", "0.61866444", "0.6177144", "0.6173667", "0.61543465", "0.6060043", "0.6023341", "0.5959342", "0.5913...
0.71078664
0
DELETE /additional_services/1 DELETE /additional_services/1.json
def destroy @additional_service = AdditionalService.find(params[:id]) @additional_service.destroy respond_to do |format| format.html { redirect_to additional_services_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @additional_service.destroy\n respond_to do |format|\n format.html { redirect_to additional_services_url, notice: 'Additional service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n ...
[ "0.74314827", "0.74287176", "0.73705024", "0.6736056", "0.6716321", "0.66728973", "0.667206", "0.667206", "0.667206", "0.6660654", "0.6646439", "0.66420424", "0.6537314", "0.6535117", "0.64957553", "0.64701766", "0.64647055", "0.6459228", "0.64477783", "0.6417064", "0.6414769...
0.7646257
0
Public: Set the language id for the search filter. lang_id The id of the language. Maximum 3, comma separated. Ids can be found at Examples Yifysubs.language = 13 English Yifysubs.search("...") Results will be only English subtitles Yifysubs.language = "13,38" English, Spanish ...
def language=(lang_id) @lang_id = lang_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def language_id=(value)\n @language_id = value\n end", "def lang(lang)\n @query[:lang] = lang\n self\n end", "def set_language\n @language = Language.find(params[:id])\n end", "def set_language\n @language = Language.find(params[:id])\n end", "def set_...
[ "0.65664834", "0.63334656", "0.6244978", "0.6244978", "0.6219665", "0.62133634", "0.61773556", "0.61773556", "0.6163941", "0.6127439", "0.60784715", "0.60730696", "0.6008292", "0.5894602", "0.5823342", "0.5772695", "0.57657886", "0.56348675", "0.56119597", "0.5584905", "0.551...
0.6825234
0
can't use the class method that sets the same, as we have subclasses using this value as well
def xml_tag :comparison end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setter__\n \"#{self}=\"\n end", "def set; end", "def set; end", "def actual=(value)\n throw \"must be provided by subclass\"\n end", "def _setter_method\n :\"_#{self[:name]}=\"\n end", "def new_value(old_value)\n raise 'to be implemented in subclass'\n end", "d...
[ "0.6975054", "0.6883465", "0.6883465", "0.6735882", "0.66006714", "0.65437716", "0.64507216", "0.62754893", "0.6274873", "0.625671", "0.6231389", "0.6202802", "0.6151343", "0.6146001", "0.6124407", "0.6114369", "0.6109671", "0.6109671", "0.61050504", "0.60251504", "0.60177165...
0.0
-1
The option to clone gold is here for for performance reasons only. The report stats are calculated right inside the Gold report, which holds all baseline figures. When there is more than one Reviewable present, we need to clone gold, otherwise we would break the calculated values. The easy way out would be to clone gol...
def report(clone_gold = false) @report ||= begin @gold = @gold.clone if clone_gold # container includes SentenceReviews, which contain WordsReviews r = @gold.report r.each_value(&:init_diff) each_value do |d| d.report_diff(r, @unique_differences) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beta_review_info\n super || reload\n BetaReviewInfo.new(super)\n end", "def gold\n @gold\n end", "def test_current_gold_silver\n \t@gold_rush.prospector.num_gold = 2\n \t@gold_rush.prospector.num_silver = 3\n \tassert_equal 3, @gold_rush.prospector.num_gold\n \tassert_equal 2, @g...
[ "0.5193948", "0.5179086", "0.51602846", "0.5154822", "0.5146682", "0.5141665", "0.5082838", "0.5047887", "0.50141305", "0.5003746", "0.4974873", "0.49604738", "0.49563196", "0.49349573", "0.4922748", "0.49168327", "0.4908113", "0.4908113", "0.4908113", "0.4903694", "0.4890590...
0.66633356
0
If no status provided, wait for pipeline to complete
def wait_for_latest_pipeline(status: nil, wait: nil, reload: false) wait ||= Support::Repeater::DEFAULT_MAX_WAIT_TIME finished_status = %w[passed failed canceled skipped manual] wait_until(max_duration: wait, reload: reload, sleep_interval: 1) do status ? latest_pipeli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_complete\n tries = 0\n status = nil\n sleep 1\n while tries < 100\n status = self.status\n puts \"Waiting... status=\" + status[\"status\"]\n if status[\"status\"] != \"queued\" && status[\"status\"] != \"running\"\n break\n end\n sleep...
[ "0.6876307", "0.64733034", "0.6398455", "0.62442744", "0.62179077", "0.6209196", "0.6100995", "0.608398", "0.6041062", "0.6037789", "0.6004364", "0.5969355", "0.5969355", "0.5969355", "0.59342825", "0.5900884", "0.5870585", "0.58693856", "0.5852515", "0.58303416", "0.58280444...
0.72667134
0
defines a filter proc with the given name
def define_filter(name, &block) filters[name.to_sym] = block nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(name, function)\n filters = (self.model.design_doc['filters'] ||= {})\n filters[name.to_s] = function\n end", "def filter(name, &block)\n @filters[name.to_s] = block\n end", "def named_filter; end", "def filter(name, **options)\n define_method(na...
[ "0.75423944", "0.7503386", "0.74173003", "0.70264786", "0.7005397", "0.6990609", "0.6947377", "0.6913103", "0.6795174", "0.6724381", "0.6723614", "0.6577531", "0.6562277", "0.6555246", "0.64789015", "0.64698064", "0.6462657", "0.6433149", "0.64188874", "0.6358532", "0.6358532...
0.7708116
0
before_action :authenticate GET /users GET /users.json
def index @users = User.all render json: @users.to_json(include: :preferences), status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end", "def auth\n\n @user = current_user\n render json: @user\n...
[ "0.71885", "0.7097855", "0.7011263", "0.69580764", "0.6839956", "0.6839956", "0.6832325", "0.67981285", "0.67705077", "0.6668242", "0.6663241", "0.66620183", "0.66595984", "0.66518563", "0.66285586", "0.66195685", "0.66195685", "0.661565", "0.6600004", "0.65797305", "0.656353...
0.0
-1
GET /users/1 GET /users/1.json
def show render json: @user.to_json(include: :preferences), status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.722...
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params.except(:preferences)) types = user_params[:preferences].split(",") password = "TPSW_servidor" @user.password = AESCrypt.encrypt(@user.password, password) #logger.info(@user) if @user.save types.each { |type| pref = Preference.find_by(type_of_pla...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update if @user.update(user_params) render json: @user.to_json(include: :preferences), status: :ok else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.7226113", "0.71298933", "0.70042306", "0.69043857", "0.68226177", "0.6815946", "0.6709818", "0.669393", "0.6681972", "0.6674142", "0.6673297", "0.66659427", "0.66659427", "0.66601443", "0.66601443", "0.6655739", "0.6649701", "0.6644151", "0.6642196", "0.6636578", "0.661886...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.7875345", "0.77512276", "0.7713299", "0.76091963", "0.7471578", "0.74069583", "0.74069583", "0.73691666", "0.7345325", "0.7339192", "0.73272485", "0.7309725", "0.73092926", "0.73057216", "0.7296841", "0.72904414", "0.7290419", "0.72891515", "0.72831494", "0.7249661", "0.72...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.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
User Authentication def authenticate key = "TPSW_servidor" email = request.headers["email"] pass = request.headers["password"] authenticate_or_request_with_http_basic do |username,password|
def credential_params params.require(:user).permit(:email,:password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n ...
[ "0.8081996", "0.8062401", "0.8061027", "0.8056477", "0.79586077", "0.7912766", "0.7865949", "0.78284657", "0.77585536", "0.7721329", "0.769917", "0.7652836", "0.762087", "0.7529574", "0.7466862", "0.7445367", "0.74403435", "0.74371624", "0.74368316", "0.7427293", "0.7399051",...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:name,:email,:password,:android_id,:preferences) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
The method checks to see that the multiplication is possible by matricy rules. we must have the same amount of columns in the 2nd matrix as rows in the first. we can transpose the second matrix if it has the same amount of rows which will rotate it giving it the same amount of columns as rows in the first if this is wh...
def rows_to_columns?(matrix_1, matrix_2) return if matrix_1.length == matrix_2.length new_arr = [] if matrix_1.length == matrix_2[0].length temp_arr = [] element = 0 while element != matrix_1.length matrix_2.each do |arr| temp_arr << arr[element] end new_arr << te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strassen_matrix_multiplication(a, b)\n if a.length > 1\n a_splited = split_matrix(a, a.length)\n b_splited = split_matrix(b, a.length)\n else\n a_splited = a.map {|item| item[0]}\n b_splited = b.map {|item| item[0]}\n end\n\n p1 = calculate_p1(a_splited, b_splited)\n p2 = cal...
[ "0.71123767", "0.6994926", "0.69832957", "0.69599813", "0.6952199", "0.6924479", "0.68632174", "0.6835702", "0.68184227", "0.6677865", "0.6586881", "0.63850904", "0.62699735", "0.61899054", "0.6139327", "0.60426366", "0.6021336", "0.60032314", "0.5865102", "0.5833948", "0.583...
0.7405451
0
method to return poems
def recite(number) # validate number validate_number(number) # get lyrics in range number to last index i = @size - number final_lyrics = [] while i < @size final_lyrics.push(@lyrics[i]) i+=1 end final_lyrics = final_lyrics.join(' ') return "This is " + final_lyric...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_poems(num_poems, verbose_output = nil)\n num_poems.times do |i|\n poem_attributes = RandomPoetryScraper::Scraper.new.scrape_poem_page\n\n if poem = RandomPoetryScraper::Poem.new(poem_attributes)\n puts \"#{i + 1} poem(s) fetched succesfully.\" if verbose_output\n...
[ "0.6280435", "0.61555594", "0.57971936", "0.5755697", "0.55901074", "0.54294944", "0.5411095", "0.53928626", "0.53928626", "0.5334402", "0.5248041", "0.5230999", "0.52197075", "0.52195716", "0.5212645", "0.5195361", "0.51821834", "0.51708305", "0.51452374", "0.51372415", "0.5...
0.0
-1
method to return random poems
def recite_random number = rand(1..@size) return recite(number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_poems(num_poems, verbose_output = nil)\n num_poems.times do |i|\n poem_attributes = RandomPoetryScraper::Scraper.new.scrape_poem_page\n\n if poem = RandomPoetryScraper::Poem.new(poem_attributes)\n puts \"#{i + 1} poem(s) fetched succesfully.\" if verbose_output\n...
[ "0.71285486", "0.65601224", "0.6510813", "0.6358455", "0.6243436", "0.62336034", "0.6228651", "0.622116", "0.61990935", "0.6143777", "0.61113125", "0.6101359", "0.6080195", "0.6052848", "0.6052848", "0.6040095", "0.6036175", "0.6008491", "0.60039115", "0.60027796", "0.6002779...
0.0
-1
method to return subjects
def recite_subject(number) # validate number validate_number(number) i = @size - number final_subjects = [] while i < @size subjects = get_subject(@lyrics[i]) subjects.each do |subject| final_subjects.push(subject) end i+=1 end final_subjects = format_final_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subjects\n links = frm.table(:class=>\"listHier\").links.find_all { |link| link.title=~/View announcement/ }\n subjects = []\n links.each { |link| subjects << link.text }\n return subjects\n end", "def subjects\r\n subjects = []\r\n range =\"#{group[:first_message]}-\"\r\n connect...
[ "0.7875999", "0.78650194", "0.7755582", "0.7751951", "0.7668053", "0.7626429", "0.76182795", "0.7472717", "0.73144853", "0.7308622", "0.72428435", "0.7224843", "0.7152835", "0.7117327", "0.71125376", "0.7056329", "0.69454455", "0.6942492", "0.69328207", "0.69071305", "0.69065...
0.0
-1
method to return random subjects
def recite_random_subject number = rand(1..@size) return recite_subject(number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qs_about()\n total_arr = cat_count\n randnums = rand_numbers(total_arr)\n $nums = valid_nums(randnums)\n subjects = get_subjects($nums)\nend", "def generate_subjectid\n\t\tsubjectids = ( (1..999999).to_a - StudySubject.select('subjectid'\n\t\t\t).collect(&:subjectid).collect(&:to_i) )\n\t\tsprintf(\"%06d...
[ "0.72642946", "0.6802747", "0.6718793", "0.67027754", "0.6667263", "0.6200729", "0.61523056", "0.61234844", "0.61018556", "0.60942686", "0.6074749", "0.6074749", "0.60074526", "0.5998574", "0.5996634", "0.596963", "0.5935274", "0.5891447", "0.58609086", "0.58469737", "0.58065...
0.8158921
0
method to parse subjects from lyric
def get_subject(lyric) arr = lyric.gsub(' and ', 'and').split('and') subjects = [] for item in arr item = item.split(' ') subjects.push(item[0..1].join(' ')) if item[0].downcase == 'the' end return subjects end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'tem...
[ "0.6826222", "0.68097675", "0.642952", "0.6384804", "0.6360388", "0.6317471", "0.6300299", "0.6204819", "0.6161548", "0.5926557", "0.5923805", "0.5902405", "0.58985126", "0.5865145", "0.5842191", "0.580426", "0.5791379", "0.5784992", "0.57809025", "0.5740402", "0.56765264", ...
0.73333055
0
method to format subjects into expected output
def format_final_subject(subjects) if subjects.size == 1 subjects[0] elsif subjects.size == 2 subjects[0] + ' and ' + subjects[1] else last_subject = subjects.pop() subjects.join(', ') + ' and ' + last_subject end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n ...
[ "0.6848691", "0.6828904", "0.6656136", "0.65910786", "0.6378892", "0.6204025", "0.61988086", "0.59966743", "0.59746593", "0.59657884", "0.59155184", "0.58949906", "0.58870417", "0.5886916", "0.5886142", "0.58770466", "0.5848942", "0.5820265", "0.5788531", "0.5765803", "0.5750...
0.73056084
0
method to validate input
def validate_number(number) valid_number = number.class == Integer && number.positive? && number <= @size raise "invalid number, please input number with integer dataType in range 1 - #{@size}" unless valid_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate\n \n \n end", "def validate\r\n\r\n end", "def valid?(_) true end", "def valid?(_) true end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate\n end...
[ "0.76954406", "0.76954406", "0.76954406", "0.76954406", "0.7672446", "0.7630813", "0.7545327", "0.7545327", "0.75113434", "0.7450131", "0.7450131", "0.7450131", "0.7440066", "0.7440066", "0.7422125", "0.7370045", "0.73582", "0.73582", "0.73582", "0.72855103", "0.72846", "0....
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_contest @contest = Contest.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def contest_params params.require(:contest).permit(:name, :starts_in) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
GET /aggregators GET /aggregators.json
def index if @current_user @pools = @current_user.pools else render :splash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def aggregations\n response['aggregations'] ? Hashie::Mash.new(response['aggregations']) : nil\n end", "def index\n @event_aggs = EventAgg.all\n end", "def aggregates\n @aggregates\n end", "def ...
[ "0.6043749", "0.6001817", "0.59450865", "0.58637154", "0.57715577", "0.5681377", "0.55537045", "0.54788744", "0.5466949", "0.5460701", "0.54594153", "0.54324615", "0.5399359", "0.5393512", "0.53932565", "0.5334973", "0.52975017", "0.52724785", "0.5255685", "0.52523005", "0.52...
0.0
-1
GET /aggregators/1 GET /aggregators/1.json
def show @pool = @current_user.pools.find_by(id: params[:id]) render layout: 'angular' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_aggregations\r\n LinkAggregationsController.instance\r\n end", "def index\n @event_aggs = EventAgg.all\n end", "def aggregations\n @aggregations ||= AggregationSet.new\n end", "def show\n @survey = Survey.find_by_user(params[:id])\n @aggregation = aggregate(@sur...
[ "0.5713067", "0.5651265", "0.5631858", "0.5616316", "0.55059385", "0.5498219", "0.5491518", "0.542174", "0.5364873", "0.5361105", "0.5303652", "0.523051", "0.52294844", "0.51431537", "0.5139324", "0.5138442", "0.5109691", "0.5081426", "0.5060502", "0.5008554", "0.50029963", ...
0.0
-1
POST /aggregators POST /aggregators.json
def create @pool = Pool.new(pool_params) @pool.owner = @current_user @pool.users.push @current_user respond_to do |format| if @pool.save format.html { redirect_to pool_path(@pool), notice: 'Aggregator was successfully created.' } format.json { render action: 'show', status: :creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate(request)\n end", "def create\n @generic_table_aggregation = GenericTable::Aggregation.new(params[:generic_table_aggregation])\n\n respond_to do |format|\n if @generic_table_aggregation.save\n format.html { redirect_to @generic_table_aggregation, notice: 'Aggregation was success...
[ "0.5420508", "0.5218046", "0.50824374", "0.5074182", "0.5020145", "0.50153875", "0.49879348", "0.49611288", "0.4824625", "0.48203033", "0.48068547", "0.480618", "0.4776066", "0.4733325", "0.4732933", "0.47244304", "0.47124568", "0.46692583", "0.4667704", "0.4644492", "0.46438...
0.471869
16
PATCH/PUT /aggregators/1 PATCH/PUT /aggregators/1.json
def update respond_to do |format| if @pool.update(pool_params) format.html { redirect_to @pool, notice: 'Aggregator was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @pool.errors, status: :u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_aggregator(new_obj,params)\n return false\n end", "def update_aggregator(new_obj,params)\n return false\n end", "def update_aggregator(new_obj,params)\n return false\n end", "def update\n @aggregate = Aggregate.find(params[:id])\n=begin\n keys = params[\"aggregate\"][\"metrics\"]...
[ "0.57825726", "0.57825726", "0.57825726", "0.5532222", "0.53495055", "0.52852446", "0.5221087", "0.5198605", "0.5088129", "0.5072388", "0.5051529", "0.505128", "0.5040279", "0.50393236", "0.50393236", "0.5029368", "0.50141823", "0.500985", "0.49880213", "0.4986102", "0.498247...
0.47347987
61
DELETE /aggregators/1 DELETE /aggregators/1.json
def destroy @pool.destroy respond_to do |format| format.html { redirect_to aggregators_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event_agg.destroy\n respond_to do |format|\n format.html { redirect_to event_aggs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @generic_table_aggregation = GenericTable::Aggregation.find(params[:id])\n @generic_table_aggregation.destroy\n\n res...
[ "0.6501186", "0.64401156", "0.6372922", "0.6176044", "0.60492086", "0.59994864", "0.59531313", "0.5884357", "0.58794016", "0.5878334", "0.581689", "0.57939065", "0.5793729", "0.57929677", "0.578595", "0.5761565", "0.57556504", "0.5751977", "0.5714186", "0.57054627", "0.569429...
0.619278
3
Use callbacks to share common setup or constraints between actions.
def set_pool @pool = Pool.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def pool_params params.require(:pool).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
Returns 401 response. To handle malformed / invalid requests.
def invalid_authentication Log.error("invalid_authentication") render json: {error: 'Invalid authentication'}, status: :unauthorized end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end", "def unauthorized\n [ 401, {'Content-Type' ...
[ "0.76328546", "0.758432", "0.75080186", "0.749968", "0.74849254", "0.74807656", "0.74807656", "0.74807656", "0.74807656", "0.74807656", "0.7479978", "0.7453964", "0.74525934", "0.74525934", "0.74525934", "0.74525934", "0.7421042", "0.74079967", "0.7392542", "0.7365732", "0.73...
0.6847597
75
Returns 400 response. To handle incomplete requests without required headers.
def invalid_user_id Log.error("Error: Header 'user-id' not sent in the request.") render json: {error: "Header 'user-id' not sent."}, status: :bad_request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bad_request\n [ 400, {'Content-Type'=>'text/plain', 'Content-Length'=>'0'},\n [''] ]\n end", "def bad_request_response(env)\n if head_request?(env)\n [ 400, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\" }, [] ]\n else\n [ 400, { \"conte...
[ "0.77536047", "0.7732229", "0.74158794", "0.727295", "0.7238075", "0.71666884", "0.7042859", "0.7042859", "0.6900951", "0.68961054", "0.68961054", "0.68961054", "0.68961054", "0.6839671", "0.68348616", "0.67195636", "0.6639012", "0.6610982", "0.6599833", "0.6593153", "0.65472...
0.0
-1
Deconstructs the Authorization header and decodes the JWT token.
def payload @auth_header = JsonWebToken.decryptPayload(request.headers['Authorization']) @token = @auth_header.split(' ').last JsonWebToken.decode(@token) rescue StandardError => e Log.error("Rescue error in Method: def payload: ", e) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n ...
[ "0.763521", "0.758563", "0.75312126", "0.75128394", "0.7373574", "0.72972375", "0.72487795", "0.7101584", "0.69802225", "0.6833449", "0.6791964", "0.6788787", "0.6783103", "0.6757063", "0.6692864", "0.66557354", "0.6642322", "0.6642322", "0.6642322", "0.6642322", "0.6642322",...
0.6372672
38
Never trust parameters from the scary internet, only allow the white list through.
def project_control_histories_params params.require('project_control_histories').permit(:project_control_id, :project_control_attr, :text, :history_type, :is_reply_to, :user_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.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 /sub_gtps GET /sub_gtps.json
def index @sub_gtps = SubGtp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbo...
[ "0.61949754", "0.5725893", "0.56259453", "0.55781984", "0.55577964", "0.5530254", "0.54966575", "0.5496181", "0.54302746", "0.5408375", "0.53587776", "0.5336093", "0.52957004", "0.5229701", "0.51867485", "0.5180283", "0.5175828", "0.51649904", "0.5145965", "0.5129961", "0.512...
0.722433
0
GET /sub_gtps/1 GET /sub_gtps/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sub_gtps = SubGtp.all\n end", "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def index\n # TODO pull out api key before pushing to github & pull out binding prys\n res = HTTParty.get URL, headers:...
[ "0.68962336", "0.5986153", "0.58766574", "0.5807525", "0.57401013", "0.5645969", "0.56210005", "0.5582041", "0.55711025", "0.5510548", "0.54402107", "0.5411999", "0.5407031", "0.53820485", "0.53808045", "0.53421533", "0.5297811", "0.5285034", "0.52610904", "0.525053", "0.5245...
0.0
-1
POST /sub_gtps POST /sub_gtps.json
def create @sub_gtp = SubGtp.new(sub_gtp_params) respond_to do |format| if @sub_gtp.save format.html { redirect_to @sub_gtp, notice: 'Sub gtp was successfully created.' } format.json { render :show, status: :created, location: @sub_gtp } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tls_sub_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TlsSubscriptionsApi.create_tls_sub ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/tls/subscriptions'\n\n # qu...
[ "0.5835363", "0.5747482", "0.57066196", "0.5633748", "0.5562357", "0.54748213", "0.54548544", "0.54420084", "0.5393428", "0.53742737", "0.53255564", "0.5301529", "0.52832377", "0.52280676", "0.51795715", "0.5159156", "0.51436085", "0.5119258", "0.51124334", "0.5103617", "0.50...
0.6645464
0
PATCH/PUT /sub_gtps/1 PATCH/PUT /sub_gtps/1.json
def update respond_to do |format| if @sub_gtp.update(sub_gtp_params) format.html { redirect_to @sub_gtp, notice: 'Sub gtp was successfully updated.' } format.json { render :show, status: :ok, location: @sub_gtp } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n\t\t\t @sub = Sub.find(params[:id])\n\t\t\t if @sub.update(sub_params)\n\t\t\t head :no_content\n\t\t\t else\n\t\t\t render json: @sub.errors, status: :unprocessable_entity\n\t\t\t end\n\t\t...
[ "0.6270675", "0.6114849", "0.59789985", "0.59726346", "0.59498155", "0.5909107", "0.58495784", "0.57982093", "0.57978445", "0.5771945", "0.5760918", "0.5747025", "0.57262623", "0.57116205", "0.56823164", "0.568131", "0.56514645", "0.5642751", "0.56414855", "0.5637449", "0.563...
0.64926213
0
DELETE /sub_gtps/1 DELETE /sub_gtps/1.json
def destroy @sub_gtp.destroy respond_to do |format| format.html { redirect_to sub_gtps_url, notice: 'Sub gtp was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\",...
[ "0.74728155", "0.69126844", "0.6564806", "0.65409786", "0.6529923", "0.64986163", "0.64894533", "0.64578295", "0.64013386", "0.63689953", "0.6352145", "0.63478905", "0.63365746", "0.6335811", "0.63329995", "0.62831527", "0.62811387", "0.62750876", "0.6265369", "0.62631226", "...
0.7083955
1