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
Set the param `name` and `value`, and whether it's an ID
def initialize(name, value, id: nil) @id = !id.nil? @name = name @value = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_param name, value\n @params[name] = value\n end", "def set_ID(value)\n set_input(\"ID\", value)\n end", "def set_ID(value)\n set_input(\"ID\", value)\n end", "def set_ID(value)\n set_input(\"ID\", value)\n end", "def set_ID(value)\n ...
[ "0.71587837", "0.71168405", "0.7057304", "0.7057304", "0.7057304", "0.7057304", "0.7054625", "0.7054625", "0.7054625", "0.7054625", "0.7054625", "0.7054625", "0.7054625", "0.7054625", "0.70538574", "0.70538574", "0.70538574", "0.681492", "0.6777696", "0.6629388", "0.66136485"...
0.681098
18
Is the param an ID param?
def id? @id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id?\n @kind == :id\n end", "def id?\n !id.nil? && !id.empty?\n end", "def is?(id)\n self.id == id\n end", "def id?\n true\n end", "def id?(str); end", "def id_param\n params[:id]\n end", "def id_or_param(id)\n id = id.to_param if id.respond_to?(:to_param)\n id\nend", ...
[ "0.75988513", "0.7229824", "0.7116058", "0.70930094", "0.69777226", "0.69650614", "0.6955634", "0.6925845", "0.6840699", "0.6807745", "0.6751716", "0.6749274", "0.67441094", "0.6698757", "0.6698324", "0.6638137", "0.65559596", "0.650467", "0.64965045", "0.64914364", "0.649143...
0.7252292
1
Format the param for the URI
def to_s url_value = value.to_s.tr('#;\'""', '').gsub(' ', '%20') id? ? "/#{value}" : "#{name}=#{url_value}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_param\n if url\n url.gsub(/[\\/\\ \\.]/,'-')+\"-\"+id.to_s\n end\n end", "def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end", "def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end", "def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end", "def params\n '(...
[ "0.74323905", "0.7086067", "0.7078761", "0.7078761", "0.6904989", "0.67622167", "0.67513996", "0.67180777", "0.6696313", "0.6683052", "0.66770357", "0.66461605", "0.6633823", "0.6598605", "0.6582708", "0.6567622", "0.6552669", "0.65516233", "0.6547042", "0.65430516", "0.65191...
0.60772175
99
GET /resource/sign_up def new super end POST /resource
def create if params[:guest] @user = User.create(name_family: "", name_first: "", name_family_kana: "", name_first_kana: "", phone_number: "", handle_name: "guest#{ SecureRandom.random_number(9999) }", user_status: "guest", password: SecureRandom.alphanumeric(6), confirmed_at: DateTime.now) @user.update(email: "#{ @user.handle_name }@guest.com") sign_in @user flash[:notice] = 'ゲスト会員でログインしました。' redirect_to root_path return end @user = User.new(sign_up_params) render :new and return if params[:back] super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_up(resource_name, resource)\n end", "def create\n build_resource(sign_up_params)\n\n resource.save\n render_resource(resource)\n end", "def sign_up(resource_name, resource)\n redirect_to users_url\n end", "def create\n build_resource(configure_sign_up_params)\n resource.save\n ...
[ "0.80235255", "0.79409707", "0.7856617", "0.7851732", "0.78483105", "0.7736225", "0.7698232", "0.7696791", "0.766601", "0.76571316", "0.76565135", "0.76415867", "0.7629917", "0.76215833", "0.76215833", "0.76022613", "0.7593545", "0.75699675", "0.7566963", "0.754741", "0.75428...
0.0
-1
GET /resource/edit def edit super end PUT /resource def update super end DELETE /resource def destroy super end GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now. This is useful if the user wants to cancel oauth signing in/up in the middle of the process, removing all OAuth session data. def cancel super end
def confirm @user = User.new(sign_up_params) if @user.invalid? flash.now[:danger] = '入力内容にエラーがあります。' render :new return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end", "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end", "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registrat...
[ "0.7221104", "0.7221104", "0.7221104", "0.7221104", "0.7221104", "0.7221104", "0.69282806", "0.689518", "0.689518", "0.689518", "0.689518", "0.689518", "0.689518", "0.689518", "0.6400225", "0.61787146", "0.60425323", "0.60310197", "0.5987721", "0.5794447", "0.57316256", "0....
0.0
-1
The path used after sign up for inactive accounts.
def after_inactive_sign_up_path_for(resource) users_sign_up_email_notice_path(email: resource.email) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n end", "def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n end", "def after_inactive_sign_up_path_for(resource)\n respond_to?(:root_path) ? root_path : \"/\"\n ...
[ "0.7342214", "0.7208575", "0.7208575", "0.7208575", "0.7208575", "0.7208575", "0.72034144", "0.7187855", "0.71851933", "0.71851933", "0.7151745", "0.7103472", "0.7103472", "0.71002626", "0.71002626", "0.7090088", "0.70668596", "0.70622385", "0.70227474", "0.701897", "0.699565...
0.65517175
91
The original array should not be modified. Do not use the method Arrayrotate or Arrayrotate! for your implementation.
def rotate_array(arr1) arr2 = arr1.clone num = arr2.shift arr2.push(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate_without_changing(arr)\n\nend", "def rotate_array(arr)\n\narr_new = arr.clone\narr_new.push(arr_new[0]).shift\narr_new\nend", "def rotate_array(array)\n new_array = array.dup \n new_array << new_array.shift \nend", "def rotate_array(array)\n copy = array.dup\n popped = copy.shift\n copy << pop...
[ "0.80690056", "0.79565656", "0.7907823", "0.78724414", "0.78618693", "0.78250295", "0.7816789", "0.78018546", "0.77996", "0.77783126", "0.7766457", "0.774603", "0.7736174", "0.7696607", "0.7691767", "0.76847947", "0.76847947", "0.7672108", "0.7668077", "0.7651841", "0.7637995...
0.7175782
81
New method is probably unnecessary bc we're not using a separate page for job creation
def new @job = Job.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_job\n j = self.class.new\n j.save\n end", "def new\n @job = Job.new\n end", "def new\n @job = current_user.jobs.new\n end", "def new\n createJobWithDefaults\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @job }\n end\...
[ "0.82364637", "0.80588377", "0.74654317", "0.73756826", "0.7356615", "0.73312753", "0.7298466", "0.7252946", "0.72511494", "0.72475064", "0.7235023", "0.7228528", "0.7203786", "0.7203786", "0.71913475", "0.7179574", "0.71747965", "0.717366", "0.7160679", "0.71600693", "0.7145...
0.80882406
1
Create method for a job, pass in params and save to DB
def create @job = Job.new(job_params) if @job.save redirect_to jobs_path else puts @job.errors.full_messages redirect_to new_job_path, :notice => "Please ensure that your Job name is unique and at least 4 characters long. Also, job prices must be at least $1,000, the number of containers must be at least 1, and the job description must be at least 50 characters" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_job(params = {})\n Bitmovin::Job.create(params)\n end", "def new_job\n j = self.class.new\n j.save\n end", "def create\n @job = Job.new(job_params)\n @job.creator = current_user\n @job.tasks.each do |task|\n if @job.job_type.present?\n task.type = \"#{@job.job...
[ "0.72726256", "0.72698563", "0.7162988", "0.7043654", "0.70234567", "0.69954556", "0.6699622", "0.66528285", "0.6618631", "0.65838504", "0.6560736", "0.65596354", "0.6546343", "0.6546328", "0.65238965", "0.6522081", "0.65220344", "0.6510427", "0.65076697", "0.64833605", "0.64...
0.0
-1
Grab the job by ID and delete from the DB
def destroy @job = Job.find(params[:id]) @job.destroy redirect_to jobs_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(id)\n connection.delete do |req|\n req.url \"job/#{id}\"\n end\n end", "def delete\n job_resource.delete\n end", "def pop id\n jobs.where(id: id).delete == 1\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def destroy\n ...
[ "0.7904377", "0.7674076", "0.76346654", "0.7559556", "0.74161893", "0.72143185", "0.71249187", "0.71095216", "0.70001286", "0.6975348", "0.6937986", "0.6918939", "0.69148713", "0.6911283", "0.68821186", "0.68657917", "0.6812013", "0.68042064", "0.67614996", "0.67193997", "0.6...
0.7017379
8
takes in an argument of each player's name and returns the number of points scored for each player
def num_points_scored(player_name) points_scored = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if player_name == element[:player_name] points_scored = element[:points] end end end points_scored end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_points_scored(playerName)\n player_stats(playerName)[:points]\nend", "def num_points_scored(name)\n # given an array of player data (hashes), find the one whose name matches\n # What is a player?\n\n ## iterate over the list of players\n ## Find the one whose `player_name` matches the name that we'r...
[ "0.8482539", "0.8462881", "0.8426978", "0.8426604", "0.8362583", "0.83523196", "0.8350999", "0.8314141", "0.8291615", "0.82809937", "0.8267365", "0.82330036", "0.8224494", "0.8215532", "0.8215164", "0.82134825", "0.8198912", "0.81896913", "0.81770766", "0.81629115", "0.816142...
0.80172306
31
takes in an argument of each player's name and returns the shoe size for each player.
def shoe_size(player_name) shoe_size = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if player_name == element[:player_name] shoe_size = element[:shoe] end end end shoe_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shoe_size(playerName)\n player_stats(playerName)[:shoe]\nend", "def shoe_size(name)\n game_hash.each do |location, attributes|\n attributes[:players].each do |player, stats|\n if player == name\n return stats[:shoe]\n end\n end\n end\nend", "def shoe_size(player_name)\n # get lis...
[ "0.8331757", "0.8289549", "0.8249626", "0.8216039", "0.8206345", "0.819636", "0.8140684", "0.81297284", "0.8117755", "0.8111576", "0.8087906", "0.8053738", "0.80438155", "0.80408627", "0.80408543", "0.7984852", "0.79645425", "0.7949038", "0.7946782", "0.7927519", "0.79154754"...
0.79327404
19
takes in an argument of the team name and returns an array of that team's colors
def team_colors(team_name) team_colors =[] game_hash.each do |key, value| if team_name == value[:team_name] team_colors = value[:colors] end end team_colors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_colors(team_name)\n # returns an array of team colors for team_name\n game_hash.each do |location, team_hash|\n team_hash.each do |team_keys, team_values|\n if team_hash[:team_name] == team_name && team_keys == :colors\n return team_values\n end\n end\n end\n end", ...
[ "0.8578719", "0.8391721", "0.8357738", "0.8294135", "0.8263465", "0.8256242", "0.8199804", "0.7922589", "0.78990376", "0.7862863", "0.78451866", "0.7821129", "0.7775147", "0.77733517", "0.77648693", "0.7759884", "0.77579445", "0.7754289", "0.775266", "0.77487135", "0.7700524"...
0.7987099
7
returns an array of the team names
def team_names team_names = [] game_hash.each do |key, value| team_names << value[:team_name] end team_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team_names\n names = []\n game_hash.each do | team, attributes|\n names << game_hash[team][:team_name]\n end\n return names\nend", "def team_names\n teams = []\n teams << game_hash[:home][:team_name]\n teams << game_hash[:away][:team_name]\n return teams\nend", "def team_names\n [\n game_has...
[ "0.80939364", "0.80788344", "0.79899544", "0.78676367", "0.7864855", "0.7824203", "0.78219295", "0.7781196", "0.7767686", "0.7720156", "0.771153", "0.770495", "0.76896465", "0.7658703", "0.7636084", "0.76340324", "0.7618313", "0.76120883", "0.7543202", "0.7533682", "0.746319"...
0.74411684
23
takes in an argument of a team name and returns an array of the jersey numbers for that team
def player_numbers(team_name) jersey_numbers = [] game_hash.each do |key, value| players = value[:players] players.each do |element| if team_name == value[:team_name] jersey_numbers << element[:number] end end end jersey_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_numbers (team_name)\n all_jersies = [];\n lookup_by_team(team_name)[:players].map { |player|\n all_jersies << player[:number];\n }\n all_jersies; \nend", "def player_numbers(team_name)\n team = all_team_info(team_name)\n team[:players].map do |player|\n player[:number]\n end\nend", "def...
[ "0.7718034", "0.758916", "0.7485235", "0.74147606", "0.73736066", "0.72283465", "0.7224072", "0.72091806", "0.719434", "0.7001195", "0.69616693", "0.6952364", "0.6940804", "0.6909693", "0.6885017", "0.6776557", "0.6755795", "0.6752789", "0.66742516", "0.66511226", "0.66278684...
0.73606056
5
takes in an argument of a player's name and returns a hash of that player's stats
def player_stats(player_name) player_stats = {} game_hash.each do |key, value| players = value[:players] players.each do |element| if player_name == element[:player_name] player_stats = element end end end player_stats end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_stats(playerName)\n players[playerName]\nend", "def player_stats(player_name)\n stats = {}\n player_data.each do |player|\n if player_name == player[:player_name]\n stats[:number] = player[:number]\n stats[:shoe] = player[:shoe]\n stats[:points] = player[:points]\n stats[:reb...
[ "0.829199", "0.8267107", "0.81799257", "0.7997076", "0.7915917", "0.7881513", "0.77695644", "0.77468187", "0.77437425", "0.77432245", "0.77162296", "0.7710667", "0.76548606", "0.76191735", "0.75450796", "0.7522114", "0.75060034", "0.7487589", "0.7473361", "0.74175286", "0.740...
0.75914836
14
get the value of the largest shoe size from nested hashes
def big_shoe_rebounds_helper shoes_array = [] game_hash.each do |key, value| players = value[:players] players.each do |element| shoes_array << element[:shoe] end end shoes_array.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def big_shoe_rebounds\n max_shoe = 0 \n max_rebounds = 0 \n game_hash.each do |place, team|\n # team.each do |attribute, data|\n team[:players].each do |player|\n if player[:shoe] > max_shoe\n max_shoe = player[:shoe]\n max_rebounds = player[:rebounds]\n # if attribute == :...
[ "0.75827384", "0.7579307", "0.7533061", "0.7518699", "0.74928224", "0.7463482", "0.7407533", "0.7379056", "0.73089004", "0.7287553", "0.72401804", "0.7227878", "0.71497", "0.7137327", "0.71170396", "0.7095184", "0.707025", "0.70632684", "0.7053743", "0.7029415", "0.700824", ...
0.7246217
10
return the number of rebounds associated with the player who has the largest shoe size call for big_shoe_rebounds_helper method for largest shoe size value
def big_shoe_rebounds big_shoe_rebounds_helper rebounds = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if big_shoe_rebounds_helper == element[:shoe] rebounds = element[:rebounds] end end end rebounds end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def big_shoe_rebounds\n largest = 0\n player = \"\"\n game_hash.each do |location, team_data|\n team_data[:players].each do |k, v|\n if largest < shoe_size(k)\n largest = shoe_size(k)\n player = k\n end\n end\n end\n return player_stats(player)[:rebounds]\nend", "def big_shoe...
[ "0.80811167", "0.78823954", "0.7828941", "0.78199196", "0.7789355", "0.7764541", "0.77242464", "0.76932526", "0.76470387", "0.7564081", "0.75427043", "0.7429015", "0.7396975", "0.7359249", "0.73538435", "0.7348216", "0.7331923", "0.7321135", "0.73049545", "0.7291918", "0.7260...
0.62105566
45
get the most point value out of nested hashes
def most_points_scored_helper point_array = [] game_hash.each do |key, value| players = value[:players] players.each do |element| point_array << element[:point] end end point_array.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nested_hash_value(obj,key)\n if obj.respond_to?(:key?) && obj.key?(key)\n obj[key]\n elsif obj.respond_to?(:each)\n r = nil\n obj.find{ |*a| r=nested_hash_value(a.last,key) }\n r\n end\n end", "def nested_hash_value(obj, key)\n if obj.respond_to?(:key?) && obj.key?(key)\n ...
[ "0.6714332", "0.6360091", "0.628169", "0.619168", "0.6176877", "0.61521226", "0.6151148", "0.61485916", "0.6119174", "0.6090538", "0.60589504", "0.6046051", "0.6031095", "0.6031046", "0.60277444", "0.60220224", "0.5998259", "0.5972374", "0.5971574", "0.59564763", "0.59561664"...
0.62586707
3
get name of player who has the most points call for most_points_scored_helper method for the most point value
def most_points_scored most_points_scored_helper most_point_player = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if most_points_scored_helper == element[:points] most_point_player = element[:player_name] binding.pry end end end most_point_player end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_points_scored\n stat_by_player = collect_stat_by_name(:points)\n player_with_max_stat = find_max_stat_by_player(stat_by_player)\n player_with_max_stat\nend", "def most_points_scored\nplayer_with_most(:points)\nend", "def most_points_scored\n max = nil\n name = nil \n game_hash.each do |tea...
[ "0.8707019", "0.8369475", "0.8163598", "0.8062321", "0.80060923", "0.79683435", "0.7927824", "0.79091674", "0.7881958", "0.7877949", "0.7877699", "0.7838546", "0.7805667", "0.76648533", "0.7613934", "0.74363506", "0.73643124", "0.72288483", "0.71332175", "0.71227586", "0.6947...
0.78361255
12
get the name of the team that has the most point call for most_points_scored_helper method for the most point value
def winning_team most_points_scored_helper winning_team = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if most_points_scored_helper == element[:points] winning_team = value[:team_name] end end end winning_team end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_points_scored\n stat_by_player = collect_stat_by_name(:points)\n player_with_max_stat = find_max_stat_by_player(stat_by_player)\n player_with_max_stat\nend", "def most_points_scored\n max = nil\n name = nil \n game_hash.each do |team, team_values|\n team_values[:players].each do |player...
[ "0.78349376", "0.78238046", "0.76193845", "0.7595045", "0.75749916", "0.7520147", "0.7511903", "0.7460804", "0.7440023", "0.74248517", "0.74134076", "0.7394511", "0.7382089", "0.7364735", "0.7362181", "0.7353519", "0.7315314", "0.7237047", "0.7232516", "0.71962947", "0.712679...
0.71505743
20
get the name of the player who has the longest name
def player_with_longest_name long_name = "" name = [] game_hash.each do |key, value| players = value[:players] players.each do |element| name << element[:player_name] end end long_name = name.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_with_longest_name\n longestName.max_by(&:length)\nend", "def longestName\n players.collect do|name, stats|\n name\n end\nend", "def player_with_longest_name\n players.keys.sort_by { |name| name.length }[-1]\nend", "def player_with_longest_name\n max_name = 0\n player_name = ''\n game_has...
[ "0.8462513", "0.8298032", "0.8206874", "0.8015377", "0.80132943", "0.8008113", "0.78741866", "0.7840296", "0.7802557", "0.7739924", "0.77303714", "0.7699729", "0.7613901", "0.7405772", "0.7305078", "0.72881687", "0.7042357", "0.6967857", "0.6936379", "0.6843906", "0.667529", ...
0.7966559
6
get a value of the most steal out of nest hashes
def most_steal steals_array = [] game_hash.each do |key, value| players = value[:players] players.each do |element| steals_array << element[:steals] end end steals_array.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_steals\r\n result={}\r\n game_hash.each do |k, v|\r\n v.each do| p, d|\r\n if p==:players\r\n d.each do |t, s|\r\n result[t]=s[:steals]\r\n end\r\n end\r\n end\r\n end \r\n result.max_by {|name, steal| steal}[0]\r\nend", "def player_with_most_steal\n...
[ "0.6826024", "0.6674992", "0.65617746", "0.64648676", "0.64617866", "0.6359441", "0.6357724", "0.6244962", "0.6224344", "0.6196666", "0.6189823", "0.6182067", "0.6117061", "0.61119974", "0.6091024", "0.60790616", "0.6076696", "0.6047398", "0.6040627", "0.60305303", "0.6027587...
0.6605294
2
returns true if the player with the longest name had the most steals call for most_steal method for most steals value
def long_name_steals_a_ton? most_steal player_with_longest_name most_steal_player = "" game_hash.each do |key, value| players = value[:players] players.each do |element| if most_steal == element[:steals] most_steal_player = element[:player_name] end end end player_with_longest_name.eql?(most_steal_player) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def long_name_steals_a_ton?\n # find player with longest name\n # find player with most steals\n # are they the same? if so return true\n player_with_most_steals = players.max_by { |player| player[:steals]}\n player_with_longest_name == player_with_most_steals[:player_name] ? true : false\nend", "def player...
[ "0.83984166", "0.8018024", "0.7930376", "0.7890101", "0.7861253", "0.782541", "0.7807", "0.7768586", "0.7667189", "0.73800737", "0.73522544", "0.73369884", "0.7293563", "0.7262977", "0.72582364", "0.70773137", "0.6990415", "0.6969831", "0.6904037", "0.6740576", "0.67013735", ...
0.76223177
9
pull_request An instance of `Gitlab::GithubImport::Representation::PullRequest`. project An instance of `Project` client An instance of `Gitlab::GithubImport::Client`
def initialize(pull_request, project, client) @pull_request = pull_request @project = project @client = client @user_finder = UserFinder.new(project, client) @milestone_finder = MilestoneFinder.new(project) @issuable_finder = GithubImport::IssuableFinder.new(project, pull_request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_request\n @pull_request ||= GitHub::PullRequest.new config.github_repo, pull_request_id\n end", "def pull_request\n @pull_request ||= ApiFactory.new 'Repos::PullRequest'\n end", "def initialize(pull_request, project, client)\n @pull_request = pull_request\n @project =...
[ "0.7613197", "0.7535036", "0.74305475", "0.71156293", "0.7105916", "0.69908655", "0.6926368", "0.668362", "0.65809363", "0.6436999", "0.6396265", "0.63749653", "0.6325514", "0.6286152", "0.6236867", "0.6093387", "0.60714126", "0.60422426", "0.600118", "0.5934453", "0.59133595...
0.73422337
3
Creates the merge request and returns its ID. This method will return `nil` if the merge request could not be created.
def create_merge_request author_id, author_found = user_finder.author_id_for(pull_request) description = MarkdownText .format(pull_request.description, pull_request.author, author_found) # This work must be wrapped in a transaction as otherwise we can leave # behind incomplete data in the event of an error. This can then lead # to duplicate key errors when jobs are retried. MergeRequest.transaction do attributes = { iid: pull_request.iid, title: pull_request.truncated_title, description: description, source_project_id: project.id, target_project_id: project.id, source_branch: pull_request.formatted_source_branch, target_branch: pull_request.target_branch, state: pull_request.state, milestone_id: milestone_finder.id_for(pull_request), author_id: author_id, assignee_id: user_finder.assignee_id_for(pull_request), created_at: pull_request.created_at, updated_at: pull_request.updated_at } # When creating merge requests there are a lot of hooks that may # run, for many different reasons. Many of these hooks (e.g. the # ones used for rendering Markdown) are completely unnecessary and # may even lead to transaction timeouts. # # To ensure importing pull requests has a minimal impact and can # complete in a reasonable time we bypass all the hooks by inserting # the row and then retrieving it. We then only perform the # additional work that is strictly necessary. merge_request_id = GithubImport .insert_and_return_id(attributes, project.merge_requests) merge_request = project.merge_requests.find(merge_request_id) # These fields are set so we can create the correct merge request # diffs. merge_request.source_branch_sha = pull_request.source_branch_sha merge_request.target_branch_sha = pull_request.target_branch_sha merge_request.keep_around_commit merge_request.merge_request_diffs.create merge_request.id end rescue ActiveRecord::InvalidForeignKey # It's possible the project has been deleted since scheduling this # job. In this case we'll just skip creating the merge request. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_merge_request\n author_id, author_found = user_finder.author_id_for(pull_request)\n\n description = MarkdownText\n .format(pull_request.description, pull_request.author, author_found)\n\n attributes = {\n iid: pull_request.iid,\n title: pull_re...
[ "0.73900646", "0.61362076", "0.5963965", "0.5914421", "0.575673", "0.56790936", "0.5651269", "0.56320393", "0.55533135", "0.55192494", "0.54797155", "0.54768485", "0.5442953", "0.54006183", "0.53523564", "0.53218585", "0.53190446", "0.5318726", "0.53093743", "0.5298456", "0.5...
0.73148835
1
Retrieve the single key entity key_id > Key entity to retrieve
def key(key_id) from_resource :key, connection.get(api_uri("keys/#{key_id}")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n @entity.key\n end", "def get(key)\n response = db.get_item(@table_name, {'HashKeyElement' => {'S' => key}})\n get_item_from_body(response.body)\n end", "def key\n raise MissingID if not defined?(@id)\n model.key[id]\n end", "def key_id\n return @key_id\n...
[ "0.74242085", "0.7196329", "0.71342546", "0.7097863", "0.7097863", "0.7097863", "0.6985345", "0.69767517", "0.6927272", "0.6860692", "0.6838979", "0.67966497", "0.6790066", "0.6777842", "0.6775579", "0.6765062", "0.6751275", "0.67457896", "0.67415947", "0.6734398", "0.6734398...
0.7448889
0
Create a new credentials to use with authentication to an +Instance+ key_name > The name of the key create_opts : public_key > Your SSH public key (eg. ~/.ssh/id_rsa.pub)
def create_key(key_name, create_opts={}) create_resource :key, create_opts.merge(:name => key_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addkey\n key = \"#{ENV['HOME']}/.ssh/id_rsa.pub\"\n run \"ssh-keygen -t rsa -N \\\"#{named_options[\"passphrase\"]}\\\" -f #{key}\" unless File.exists?(key)\n\n key_contents = File.read(key)\n run_remote_command \"mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo \\\"#{key_contents}\\\" >> ~...
[ "0.6977951", "0.6951907", "0.6871366", "0.67717516", "0.67148125", "0.66883767", "0.66281927", "0.6614723", "0.6573178", "0.6505641", "0.6492712", "0.64526665", "0.64517045", "0.63975954", "0.6386288", "0.6298802", "0.6273891", "0.6258252", "0.625214", "0.62324995", "0.622957...
0.6089515
26
Destroy the SSH key
def destroy_key(key_id) destroy_resource :key, key_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sshkey.destroy\n respond_to do |format|\n format.html { redirect_to sshkeys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @key.destroy\n end", "def destroy\n @public_key.destroy\n # PublicKey.regenerate_authorized_keys\n GitWit.remove_auth...
[ "0.7481765", "0.7321833", "0.7242094", "0.7203642", "0.7185435", "0.71564114", "0.71496004", "0.71203697", "0.694589", "0.6934434", "0.67786974", "0.67015857", "0.6678979", "0.667458", "0.666785", "0.6657595", "0.6657595", "0.6576723", "0.6501405", "0.64694065", "0.6444922", ...
0.7307177
2
Define the collection name to use for loading resource reference fields off the parent variant.
def collection_name 'resource_reference_fields' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_name\n @collection_name ||=\n if @resource_options.key?(:collection_name)\n @resource_options.fetch(:collection_name).to_s\n else\n tools.string.pluralize(qualified_resource_name)\n end # if-else\n end", "def collection_name\n @collection_name ...
[ "0.79171926", "0.77519023", "0.77481306", "0.7463434", "0.7463434", "0.7463434", "0.741733", "0.73870486", "0.73870486", "0.7379581", "0.7369357", "0.7277277", "0.7195023", "0.7182436", "0.7172106", "0.71306396", "0.708896", "0.6979195", "0.6979195", "0.6979195", "0.6979195",...
0.71119815
16
GET /calculations GET /calculations.json
def index @calculations = Calculation.all respond_to do |format| format.html # index.html.erb format.json { render json: @calculations } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n @calculation = Calculation.all # retrieve all calculations from calculations table \n json_response(@calculation) # respond with the array of calculations\n end", "def index\n @calculations = Calculation.all\n end", "def index\n @calculations = Calculation.all\n end", "d...
[ "0.7434753", "0.6852225", "0.6852225", "0.67286074", "0.66498965", "0.6561769", "0.65463716", "0.6545544", "0.6373962", "0.6278501", "0.6221157", "0.61928725", "0.615725", "0.6134993", "0.6093321", "0.6025831", "0.598965", "0.5931852", "0.5888927", "0.587562", "0.5838186", ...
0.740877
1
GET /calculations/1 GET /calculations/1.json
def show @calculation = Calculation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @calculation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\r\n @calculations = Calculation.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @calculations }\r\n end\r\n end", "def index \n @calculation = Calculation.all # retrieve all calculations from calculations table \n json...
[ "0.72421575", "0.72213733", "0.7179272", "0.6840381", "0.673372", "0.66166925", "0.6613311", "0.6613311", "0.6597197", "0.654033", "0.6253858", "0.60466266", "0.6034872", "0.5920738", "0.59108174", "0.58920765", "0.58920765", "0.58920765", "0.58805853", "0.5860136", "0.583948...
0.7122084
3
GET /calculations/new GET /calculations/new.json
def new @calculation = Calculation.new respond_to do |format| format.html # new.html.erb format.json { render json: @calculation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @calculation = Calculation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calculation }\n end\n end", "def new\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json:...
[ "0.81450444", "0.7303158", "0.70378155", "0.7015228", "0.69886464", "0.68957376", "0.6890773", "0.6878913", "0.6863218", "0.6856263", "0.68270636", "0.6823399", "0.6801196", "0.6788598", "0.6777019", "0.672875", "0.6722084", "0.6683228", "0.6673259", "0.6668418", "0.6656534",...
0.8099165
1
POST /calculations POST /calculations.json
def create @calculation = Calculation.new(params[:calculation]) respond_to do |format| if @calculation.save format.html { redirect_to @calculation, notice: 'Calculation created!' } format.json { render json: @calculation, status: :created, location: @calculation } else format.html { render action: "new" } format.json { render json: @calculation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@calculation = Calculation.new(calculation_params)\n\n\t\trespond_to do |format|\n\t\t\tif @calculation.save\n\t\t\t\tformat.html { redirect_to @calculation, notice: 'Calculation was successfully created.' }\n\t\t\t\tformat.json { render :index, status: :created, location: @calculation }\n\t\t\tels...
[ "0.71114403", "0.70816237", "0.7076553", "0.7047309", "0.68759865", "0.65583706", "0.6417625", "0.6398019", "0.6256294", "0.6237161", "0.62060803", "0.61930114", "0.6139439", "0.6107491", "0.60732174", "0.604229", "0.6018506", "0.59945315", "0.59683377", "0.59538764", "0.5923...
0.6937131
4
PUT /calculations/1 PUT /calculations/1.json
def update @calculation = Calculation.find(params[:id]) respond_to do |format| if @calculation.update_attributes(params[:calculation]) format.html { redirect_to @calculation, notice: 'Calculation updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @calculation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @calculation = Calculation.find(params[:id])\n\n respond_to do |format|\n if @calculation.update_attributes(params[:calculation])\n format.html { redirect_to @calculation, notice: 'Calculation was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.7037516", "0.6888306", "0.68324", "0.68220377", "0.64238155", "0.626745", "0.619062", "0.61011916", "0.61011916", "0.61011916", "0.6046996", "0.6030663", "0.5981297", "0.596486", "0.5956404", "0.59533876", "0.5927228", "0.5908924", "0.59013057", "0.5884981", "0.58815217", ...
0.7051392
0
DELETE /calculations/1 DELETE /calculations/1.json
def destroy @calculation = Calculation.find(params[:id]) @calculation.destroy respond_to do |format| format.html { redirect_to calculations_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @calculation = Calculation.find(params[:id])\n @calculation.destroy\n\n respond_to do |format|\n format.html { redirect_to calculations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @calculation.destroy\n respond_to do |format|\n format.html...
[ "0.75162756", "0.7231101", "0.7231101", "0.7228235", "0.69406617", "0.68644524", "0.6853649", "0.68336225", "0.67739105", "0.6741753", "0.6679101", "0.65751445", "0.6571261", "0.6534553", "0.6472354", "0.6469433", "0.6469433", "0.6467913", "0.64459866", "0.64169604", "0.64004...
0.7457885
1
Befehl zum automatischen Befuellen der leeren Calculation Spalten
def aggregate calc_id = Calculation.find(params[:id]).id # loeschen alter Werte Demand0.where(calculation_id: calc_id).delete_all Demand1.where(calculation_id: calc_id).delete_all Demand2.where(calculation_id: calc_id).delete_all @specialty = Specialty.all #if Demand0.where(calculation_id: calc_id).empty? dem_mon = 0 dem_tue = 0 dem_wed = 0 dem_thu = 0 dem_fri = 0 # Fuer alle Specialties summiere die OP Zeiten der Patienten Typ 0 @specialty.each do |n| dem_mon = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'0').sum(:op_time) dem_tue = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'0').sum(:op_time) dem_wed = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'0').sum(:op_time) dem_thu = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'0').sum(:op_time) dem_fri = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'0').sum(:op_time) Demand0.create!(calculation_id: calc_id, specialty_id: Specialty.find(n).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri) end @specialty.each do |m| dem_mon = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'1').sum(:op_time) dem_tue = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'1').sum(:op_time) dem_wed = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'1').sum(:op_time) dem_thu = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'1').sum(:op_time) dem_fri = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'1').sum(:op_time) Demand1.create!(calculation_id: calc_id, specialty_id: Specialty.find(m).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri) end @specialty.each do |o| dem_mon = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'2').sum(:op_time) dem_tue = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'2').sum(:op_time) dem_wed = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'2').sum(:op_time) dem_thu = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'2').sum(:op_time) dem_fri = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'2').sum(:op_time) Demand2.create!(calculation_id: calc_id, specialty_id: Specialty.find(o).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri) end flash[:started] = "Demands calculated!" redirect_to calculations_path # else # flash[:not_available] = "Demands already aggregated!" # redirect_to calculations_path # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculation\n end", "def calculated; end", "def uberX_fare_calculator\nend", "def _calc\n raise \"you have to imprement your _calc\"\n end", "def recalculate\n end", "def recalculate\n\tend", "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n o...
[ "0.73452026", "0.7162655", "0.6794592", "0.67557526", "0.6532008", "0.6508314", "0.6458266", "0.6441018", "0.6393988", "0.63911426", "0.63828975", "0.637919", "0.6378219", "0.636912", "0.636912", "0.6344298", "0.6330372", "0.62663054", "0.6260076", "0.62349695", "0.6190096", ...
0.0
-1
status_is? is defined in ModelObjectStatus
def workflow_status_is?(*status_code) self.status_is?(:workflow_status, status_code) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status? status\n read_attribute(:status) == fetch_status_code(status)\n end", "def status?\n return data.atk_class == 3\n end", "def status_object\n @status\n end", "def status\n @object.status\n end", "def object_status\n super\n end", "def object_status\n ...
[ "0.73897135", "0.7181082", "0.6973604", "0.6935741", "0.6866858", "0.6866858", "0.6866858", "0.68567234", "0.68506634", "0.6804407", "0.6782077", "0.6728102", "0.6726124", "0.6707228", "0.6645548", "0.6628865", "0.65991277", "0.65842706", "0.65729505", "0.65679365", "0.655794...
0.6347759
45
there should be only one WorkflowProcess running against self but if there are more than one, this returns them all
def current_workflow_processes wf_processes = [] RuoteKit.engine.processes.each do |wfp| wf_processes << wfp if wfp.target == self end wf_processes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processes\n workflow_status.process_statuses.map do |process|\n WorkflowProcessPresenter.new(view: view, process_status: process)\n end\n end", "def participatory_process_groups\n @participatory_process_groups ||= Decidim::ParticipatoryProcesses::OrganizationParticipatoryProcessGroups.new(...
[ "0.64891934", "0.5849321", "0.5830176", "0.57732254", "0.57732254", "0.5756193", "0.57354796", "0.57328534", "0.5668437", "0.5598077", "0.5595474", "0.55924225", "0.55756885", "0.5575254", "0.55305636", "0.54824334", "0.54240805", "0.527123", "0.5264228", "0.5218119", "0.5173...
0.70588326
0
workflows that has my model defined as :target_model
def targeted_workflows Workflow.for_target_model(self.class) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_model\n self.class.target_model\n end", "def workflow\n end", "def target_model=(new_value)\n @target_model = new_value unless const_defined?(:TargetModel)\n end", "def target_model(*args)\n if args.blank?\n const_defined?(:TargetModel) ? const_get(:TargetModel) : (@target...
[ "0.6794593", "0.67087245", "0.6225793", "0.6212545", "0.61589926", "0.6082262", "0.6047702", "0.593992", "0.5902543", "0.5902543", "0.588356", "0.5858735", "0.58462423", "0.5844691", "0.57358366", "0.57143795", "0.56925106", "0.56685597", "0.5651677", "0.5622436", "0.5622436"...
0.73434436
0
NOTE: this is generic regardless of workflow a generic checking regardless of workflow
def workflow_launchable? !workflow_status_is?(:pending) && current_workflow_processes.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check\n \n end", "def check\n \n end", "def checks; end", "def result_of_checking; end", "def check ; true ; end", "def multi_check\n raise NotImplementedError\n end", "def check\n each { |m| m.check }\n end", "def check(*args)\n proc...
[ "0.7271637", "0.7271637", "0.7092444", "0.66804045", "0.6505542", "0.65039545", "0.6265336", "0.61189586", "0.6117705", "0.610201", "0.59727466", "0.59426296", "0.59191966", "0.5914728", "0.5908744", "0.5904486", "0.5899597", "0.586403", "0.58137316", "0.58085275", "0.5799727...
0.0
-1
workflow process life cycle hook
def before_workflow_launch(workflow, user) #raise "Must implement in target model!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflow\n end", "def on_begin_process()\n # subclasses may override this method \n end", "def on_process(&block); end", "def manage_processes\n puts \"in manage process\"\nend", "def before_fork\n \n end", "def handle_child_workflow_execution_started(event)\n hand...
[ "0.72147274", "0.677459", "0.64145815", "0.64018697", "0.63432986", "0.63422596", "0.63348335", "0.63065237", "0.6270491", "0.6270491", "0.62669903", "0.6212899", "0.61702716", "0.6161626", "0.61505884", "0.61404276", "0.61368644", "0.61116713", "0.61065835", "0.61054534", "0...
0.6023301
28
restore status when started the workflow
def on_workflow_cancel restore_status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore\r\n @status = @stack.shift if @stack.size > 0\r\n end", "def reset_workflow_status\n self.set_association_by_code(model_status_attr_name, :draft)\n self.set_association_by_code(:workflow_status, :draft)\n self.save!\n end", "def mark_as_restored\n @restored = true\n end", ...
[ "0.6732395", "0.66807383", "0.66630137", "0.65385896", "0.65248686", "0.63119376", "0.62689906", "0.6125496", "0.6119668", "0.60942894", "0.6080488", "0.6080488", "0.60755795", "0.6047078", "0.6043234", "0.59840775", "0.5976197", "0.5933942", "0.5919614", "0.59135765", "0.589...
0.789039
0
NOTE: This is meant for debugging/testing purpose. use with _CAUTION_
def reset_workflow_status self.set_association_by_code(model_status_attr_name, :draft) self.set_association_by_code(:workflow_status, :draft) self.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def inspect; end", "def ins...
[ "0.7300319", "0.64144474", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254", "0.63793254",...
0.0
-1
end of Workflow process lifecycle related logic TODO: the following needs refactoring workflow related rights
def add_right(op, role) h = self.hhash h['overview'] ||= {} h['overview'][op] = role self.update_attribute(:hhash, h) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_end_process()\n # subclasses may override this method\n end", "def workflow\n end", "def after_processing\n end", "def end\n end", "def post_process\n end", "def post_process; end", "def finish\r\n #\r\n end", "def finish()\n #This is a stub, used for i...
[ "0.6512664", "0.6204987", "0.6048223", "0.59883624", "0.59850395", "0.59198755", "0.58746964", "0.58654237", "0.586032", "0.58509856", "0.5817104", "0.5746617", "0.5739583", "0.5736883", "0.5736653", "0.5733135", "0.57325304", "0.5730589", "0.5717992", "0.5706475", "0.5706093...
0.0
-1
this is only for test
def bypass_validation(validate_name) bypass_arr = hhash['bypass_validate'] bypass_arr ? bypass_arr.include?(validate_name) : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def spec; end", "def spec; end", "def weber; end", "def refutal()\n end", "def run; end", "def run; end", "def run; end", "def run; end", "def ru...
[ "0.78251135", "0.6828747", "0.6828747", "0.6828747", "0.6828747", "0.6743626", "0.66197586", "0.640668", "0.640668", "0.6386049", "0.6383687", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.6347487", "0.62518567", ...
0.0
-1
POST /likes POST /likes.json
def create @comment = Comment.new(comment_params) @post = Post.find(@comment.post_id) respond_to do |format| if @comment.save format.html { redirect_to @post, notice: 'Comment was successfully created.' } format.json { render :show, status: :created, location: @comment } else format.html { render :new } format.json { render json: @post.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postlikes\n render json: @likes.length, status: 200\n end", "def create_likes\n end", "def create_likes\n end", "def create_likes\n end", "def create\n @todo_like = Todo::Like.new(todo_like_params)\n @todo_user.likes << @todo_like\n\n if @todo_like.save\n render :show, status...
[ "0.75674856", "0.7365325", "0.7365325", "0.7365325", "0.71373385", "0.71334076", "0.71098936", "0.70753795", "0.7032261", "0.6999443", "0.69441414", "0.69065136", "0.68951523", "0.68781835", "0.6871843", "0.68529326", "0.6852574", "0.68463427", "0.68358713", "0.6783308", "0.6...
0.0
-1
resolves URI: checks for aliases and script aliases and if found,replace them in the path,appends document root and index file if necessary.
def resolve uri_to_be_resolved = @uri.clone if script? uri_to_be_resolved full_path = replace_script_aliases(uri_to_be_resolved) elsif alias? uri_to_be_resolved full_path = replace_aliases(uri_to_be_resolved) else full_path = File.join(@conf.document_root,uri_to_be_resolved) @uri_without_doc_root = uri_to_be_resolved.clone end if (! File.file? full_path) && ( @http_method.casecmp("PUT") != 0) full_path = File.join(full_path,get_directory_index) end @resolved_uri = full_path.clone full_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve\n file_location = modify_uri\n # Adding doc root if path is not aliased. Handling pathname joining\n if(file_location == @request.uri)\n file_location = File.join(@conf.document_root, file_location)\n end\n # If the path is directory, add dir index to serve index file\n ...
[ "0.7511949", "0.6875278", "0.6136526", "0.57610554", "0.57379055", "0.57137984", "0.56941134", "0.56630707", "0.56172264", "0.55750716", "0.556779", "0.55360097", "0.55006963", "0.5493996", "0.5474102", "0.5438525", "0.5320743", "0.52838206", "0.52794224", "0.5269239", "0.526...
0.7943661
0
check if URI is script alias
def script?(uri) @conf.script_alias?(uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script_aliased?\n uri = @request.uri\n @conf.script_aliases.each do |a|\n if uri.include? a\n return true\n end\n end\n false\n end", "def alias?(uri)\n @conf.alias?(uri)\n end", "def alias_for? url\n aliases.map(&:url).any? { |alurl| Alias.urleq url, alu...
[ "0.81057155", "0.7351256", "0.6727231", "0.6460147", "0.64318043", "0.6308274", "0.630146", "0.62818253", "0.62672836", "0.62588155", "0.6160795", "0.6108271", "0.61063004", "0.6040978", "0.602705", "0.60210353", "0.5954521", "0.5949826", "0.5943234", "0.5938924", "0.5916119"...
0.873067
0
check if URI is alias
def alias?(uri) @conf.alias?(uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alias_for? url\n aliases.map(&:url).any? { |alurl| Alias.urleq url, alurl }\n end", "def has_alias?\n !@alias.nil?\n end", "def is_alias?; end", "def alias?\r\n show_alias_flg == 'yes'\r\n end", "def mapped_uri?(uri)\n return get_name(uri) != nil\n end", "def alias?\n false\n...
[ "0.7955607", "0.75113416", "0.7394995", "0.7110393", "0.7039104", "0.70246416", "0.69858825", "0.69123447", "0.68542826", "0.680161", "0.6783894", "0.67539847", "0.67477226", "0.67211705", "0.67203796", "0.66672647", "0.6607583", "0.65743184", "0.65595216", "0.6557946", "0.65...
0.86135864
0
repalce all aliases in provided path
def replace_aliases(path) new_path = path.clone @conf.alias.each do |aliases,alias_path| new_path.sub!(aliases,alias_path) end new_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_script_aliases(path)\n new_path = path.clone\n @conf.script_alias.each do |s_aliases,script_alias_path|\n new_path.sub!(s_aliases, script_alias_path)\n end\n new_path\n end", "def reload_aliases!\n clear_aliases_cache\n end", "def alias_path(path)\n end", "d...
[ "0.7171691", "0.6739749", "0.66780365", "0.6541226", "0.6395581", "0.63826877", "0.6369729", "0.610088", "0.6046676", "0.59789383", "0.59560454", "0.5921314", "0.59126043", "0.580257", "0.5788865", "0.5788865", "0.5788865", "0.5743092", "0.5709616", "0.56822807", "0.56569964"...
0.80489135
0
replace all the script aliases in provided path
def replace_script_aliases(path) new_path = path.clone @conf.script_alias.each do |s_aliases,script_alias_path| new_path.sub!(s_aliases, script_alias_path) end new_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_aliases(path)\n new_path = path.clone\n @conf.alias.each do |aliases,alias_path|\n new_path.sub!(aliases,alias_path) \n end\n new_path\n end", "def script_alias_path(path)\n end", "def script_aliases\n end", "def script_alias_path(path)\n @script_alias_pa...
[ "0.7928374", "0.7436031", "0.70725787", "0.6954148", "0.67369896", "0.66873974", "0.6536964", "0.6350815", "0.6257287", "0.62185067", "0.6089089", "0.60321146", "0.59854305", "0.59854305", "0.57013583", "0.56842595", "0.5682209", "0.5621893", "0.56202257", "0.5585572", "0.555...
0.88642997
0
do parse at parallel
def parse(id, body, format) case format when 'rss' then update_rss(id, body) else p 'error : unknown format' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_all\n while parse_one_entry; end\n end", "def parse; end", "def parse; end", "def parse; end", "def parsed; end", "def parsed; end", "def each(&block)\n parse.each(&block)\n end", "def jobs\r\n @parser.jobs\r\n end", "def parse(data); end", "def parse_loop!\n ...
[ "0.6403032", "0.62973946", "0.62973946", "0.62973946", "0.615873", "0.615873", "0.61392075", "0.6130313", "0.608362", "0.6078287", "0.6066964", "0.60632277", "0.60478526", "0.602529", "0.589506", "0.5891655", "0.5830754", "0.5830754", "0.57193923", "0.57165945", "0.5708344", ...
0.0
-1
get title and link from rss
def update_rss(id, body) doc = Nokogiri::XML(body) doc.xpath('rss/channel/item').each do |i| title = i.xpath('title').text link = i.xpath('link').text st = @sql.prepare "select exists(select 1 from article_lists where article_url=?)" st.execute(link).each_with_index do |res, index| insert_article_list(res, id, title, link) if index == 0 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_for_rss_title\n content_for_rss_meta(\"title\")\n end", "def grab_urls_and_titles(feed)\n feed.remove_namespaces! #so that we can get to the titles easily\n urls = feed.search(\"//entry/link[@rel='alternate']\").map { |link| link[\"href\"] }\n titles = feed.search(\"//en...
[ "0.7649108", "0.7483892", "0.74380183", "0.72454035", "0.7135089", "0.7121671", "0.70790845", "0.70292723", "0.6974738", "0.69234174", "0.68687755", "0.68420887", "0.67627835", "0.6687608", "0.66662663", "0.66637105", "0.66417724", "0.6627186", "0.6625298", "0.6619423", "0.66...
0.0
-1
insert row into article_lists
def insert_article_list(res, id, title, link) if res['exists(select 1 from article_lists where article_url=?)'] == 0 stmt = @sql.prepare "insert into article_lists (site_list_id, title, article_url) values(?,?,?)" stmt.execute(id, title, link) id_res = @sql.query 'select last_insert_id() from article_lists' roles = @sql.query "select role from site_roles where deleted_at is null and site_list_id=#{id} order by priority desc" r = @http.get(link, :follow_redirect => true) id_res.each_with_index {|nowid, i| extract_html(r.body, roles, nowid['last_insert_id()']) if r.status == 200 && i == 0} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_article(article)\n self.article_lists.create(:article_id => article.id)\n end", "def insert_article(id, body, s)\n if id == nil\n stmt = @sql.prepare \"insert into articles (original_article, article) values(?,?)\"\n stmt.execute(body, s)\n else\n stmt = @sql.prepare \"...
[ "0.7265486", "0.6745791", "0.6273309", "0.5981071", "0.59658855", "0.5950182", "0.59281963", "0.59002787", "0.5840815", "0.58074284", "0.57969123", "0.5796502", "0.57241076", "0.57158875", "0.5706307", "0.5704643", "0.567828", "0.5666803", "0.5645687", "0.56451344", "0.563603...
0.73977304
0
get raw html and parse raw string
def extract_html(body, roles, id=nil) doc = Nokogiri::HTML(body) s = '' roles.each do |r| doc.search(r['role']).each do |d| s = d.text break unless s.empty? end break unless s.empty? end insert_article(id, body, s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_raw_html(el, &block); end", "def html raw_text\n EscapeUtils.escape_html(decode_html(raw_text))\n end", "def grab_html\n\t\t@raw_html = HTTParty.get(@url)\n\t\t@soft_html = Nokogiri::HTML(@raw_html.body)\n\tend", "def parse_html(source)\n Nokogiri::HTML(open(source))\n end", "def pars...
[ "0.7503692", "0.728232", "0.66900885", "0.66342396", "0.6626174", "0.6571223", "0.64824295", "0.6461417", "0.64175195", "0.64121443", "0.63867", "0.63806075", "0.6372763", "0.63505137", "0.6336364", "0.6325081", "0.6309106", "0.62835723", "0.6283111", "0.6219213", "0.6204519"...
0.0
-1
insert html and trimmed text
def insert_article(id, body, s) if id == nil stmt = @sql.prepare "insert into articles (original_article, article) values(?,?)" stmt.execute(body, s) else stmt = @sql.prepare "insert into articles (article_list_id, original_article, article) values(?,?,?)" stmt.execute(id, body, s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_markup_pre(text); end", "def simple_format(text, html_options={})\n # text = text.to_s.dup\n # text.gsub!(/\\r\\n?/, \"\\n\") # \\r\\n and \\r -> \\n\n # text.gsub!(/\\n\\n+/, \"</p>\\n\\n<p>\") # 2+ newline -> paragraph\n # text.gsub!(/([^\\n]\\n)(?=[^\\n])/, '\\1<br />' + \"\\n\")...
[ "0.6784011", "0.6782105", "0.671563", "0.6686656", "0.65944684", "0.6573915", "0.6470433", "0.64364856", "0.642588", "0.6415768", "0.6410819", "0.64021605", "0.64021605", "0.64021605", "0.64021605", "0.63877267", "0.63739675", "0.6363579", "0.63497096", "0.6339559", "0.629205...
0.0
-1
end module ============================================================================== set crawler's pid ==============================================================================
def register_pid redis = Redis.new c = redis.get('crawler_count') c = 1 if c == nil redis.set('crawler' + c.to_s, $$) redis.set('crawler_count', c.to_i + 1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pid() end", "def pid() end", "def pid() end", "def pid; end", "def pid; end", "def pid; end", "def pid(*) end", "def pid\n end", "def set_crawler\n @crawler = Crawler.find(params[:id])\n end", "def set_crawler\n @crawler = Crawler.find(params[:id])\n end", "def set_crawler\...
[ "0.536763", "0.536763", "0.536763", "0.53534967", "0.53534967", "0.53534967", "0.5156729", "0.5154034", "0.5149025", "0.5149025", "0.5149025", "0.50666726", "0.49483112", "0.484656", "0.48131937", "0.47996634", "0.47557166", "0.4753464", "0.47235367", "0.4717428", "0.46512318...
0.53323114
6
============================================================================== entry point ==============================================================================
def main Dotenv.load # get arg time = ARGV.length < 2 ? '15m' : "%s%s" % [ARGV[0], ARGV[1]] # check environment variables # exit if not set those if ENV['ND_DB_HOST'] == nil || ENV['ND_DB_USER'] == nil || ENV['ND_DB_PASS'] == nil || ENV['ND_DB_NAME'] == nil puts 'environment value has not set' puts 'you have to set ND_DB_{NAME,USER,PASS,HOST}' exit(1) end Process.daemon scheduler = Rufus::Scheduler.new register_pid scheduler.every time do ND::NDCrawl.new(ENV['ND_DB_HOST'], ENV['ND_DB_USER'], ENV['ND_DB_PASS'], ENV['ND_DB_NAME']).main end scheduler.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def private; end", "def main\n\n end", "def run() end", "def run\n \n end", "def run\n \n end", "def run\n end", "def run\n end", ...
[ "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.7726561", "0.74506104", "0.7423036", "0.7371923", "0.7359057", "0.7359057", "0.72786665", "0.7260866", "0.7214603", "0.72045094", "0.7184685", "0.7184685", "0.7184685", ...
0.0
-1
GET /articles GET /articles.json
def index @articles = Article .where(:state => [Article::STATES[:accepted], Article::STATES[:featured]]) .search(params[:search]) .order('accepted desc') respond_to do |format| format.html # index.html.erb format.json { render json: @articles } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def articles\n @articles = Article.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def index\n @articles = Article.all\n\n respond_to do |format|\n format.json { render json: @articles }\n end\n end", ...
[ "0.78240407", "0.7758083", "0.7749739", "0.76505834", "0.76505834", "0.76505834", "0.76505834", "0.76505834", "0.76505834", "0.7613034", "0.75501996", "0.74417776", "0.7362878", "0.73561686", "0.73561686", "0.73561686", "0.73561686", "0.73561686", "0.73561686", "0.73561686", ...
0.0
-1
GET /articles/1 GET /articles/1.json
def show @article = Article.find(params[:id]) @comments = @article.comments if user_signed_in? @rating_currentuser = @article.ratings.find_by_user_id(current_user.id) @rating_currentuser ||= current_user.ratings.new end respond_to do |format| format.html # show.html.erb format.json { render json: @article } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.er...
[ "0.7745946", "0.75169533", "0.7514653", "0.7483779", "0.74794465", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.7427753", ...
0.0
-1
GET /articles/new GET /articles/new.json
def new @article = current_user.articles.new respond_to do |format| format.html # new.html.erb format.json { render json: @article } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @article = Article.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n\n @article = Article.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render...
[ "0.81520903", "0.8133036", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045",...
0.7677582
27
POST /articles POST /articles.json
def create @article = current_user.articles.new(params[:article]) respond_to do |format| if @article.save format.html { redirect_to @article, notice: 'Article was successfully created.' } format.json { render json: @article, status: :created, location: @article } else format.html { render action: "new" } format.json { render json: @article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n ...
[ "0.7152922", "0.70896465", "0.70896465", "0.70896465", "0.70896465", "0.70896465", "0.70896465", "0.70896465", "0.70896465", "0.70838183", "0.7064576", "0.70552313", "0.70552313", "0.70552313", "0.70552313", "0.70552313", "0.70552313", "0.70552313", "0.70552313", "0.70552313", ...
0.6686363
46
PUT /articles/1 PUT /articles/1.json
def update @article = current_user.articles.find(params[:id]) if @article.approved? params[:article].delete(:title) params[:article].delete(:teaser) end respond_to do |format| if @article.update_attributes(params[:article]) format.html { redirect_to @article, notice: 'Article was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @article.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end", "def update\n @article ...
[ "0.71448934", "0.71328723", "0.7000779", "0.687161", "0.68509907", "0.67842317", "0.6784048", "0.6777738", "0.6773994", "0.6773994", "0.6773994", "0.6773994", "0.6773721", "0.67725927", "0.6765536", "0.6765536", "0.6765536", "0.6765536", "0.6765536", "0.6765536", "0.6765536",...
0.0
-1
DELETE /articles/1 DELETE /articles/1.json
def destroy @article = current_user.articles.find(params[:id]) # only draft, submitted or rejected articles can be deleted by the user if @article.approved? flash[:error] = 'The article could not be deleted.' else @article.destroy end respond_to do |format| format.html { redirect_to articles_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n res...
[ "0.7844117", "0.7832465", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", "0.78202105", ...
0.0
-1
Initialize EM channel for internal distribution
def initialize(channel) @consumer_channel = EM::Channel.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize()\n @consumer_channel = EM::Channel.new\n start()\n end", "def initialize \n\t\t@config = nil\n\t\t@defaultChannel = 0\n\t\t@previousChannel = 0\n\t\t@currentChannel = 0\n\tend", "def initialize(room = AMQ::Protocol::EMPTY_STRING)\n @room = room\n @connection = AMQPChannelBroker.get...
[ "0.7557884", "0.6491545", "0.610751", "0.57623225", "0.57425153", "0.56980294", "0.5637855", "0.5607923", "0.55869997", "0.5539549", "0.55101746", "0.54820335", "0.54727614", "0.54625714", "0.54218924", "0.54218924", "0.54157466", "0.5393607", "0.5386901", "0.5377975", "0.536...
0.7455002
1
Broadcast data to customers
def publish(data) @consumer_channel.push data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcast\n end", "def broadcast_check_for_apps!\n @account.self_and_all_descendant_customers.find_each do |customer|\n ServiceRunnerJob.perform_later(\n \"DeviceBroadcasts::Customer\",\n customer,\n { type: \"apps\", payload: {} }.to_json\n )\n end\n en...
[ "0.65400046", "0.6530544", "0.64601874", "0.6391485", "0.61568546", "0.60808885", "0.6053614", "0.59757775", "0.5948892", "0.593127", "0.5903999", "0.58443624", "0.5746847", "0.5742891", "0.5737071", "0.57338697", "0.5709646", "0.56986123", "0.5695918", "0.5673357", "0.566741...
0.0
-1
this is overridden in Admin::ResourceController to respond correctly
def sited_model? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource; end", "def resource\n\n end", "def singular_resource\n super.decorate\n end", "def resources; end", "def resources; end", "def active_admin_resource_for(klass)\n\n\n\n if respond_to? :active_admin_namespace\n\n\n\n ...
[ "0.67146915", "0.64617646", "0.6362783", "0.63525903", "0.63525903", "0.62403804", "0.62316316", "0.6210297", "0.6177714", "0.612175", "0.6082677", "0.6049299", "0.6000571", "0.5989653", "0.5985481", "0.5953603", "0.592153", "0.5887942", "0.5868323", "0.58621335", "0.5847728"...
0.0
-1
chains will attach here
def discover_current_site site_from_host end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildChain chain # chain is an array\n chain.each do |link|\n addLink link, self\n end\n end", "def test_chain\n #puts \"---------------test_chain-----------------\"\n\n t1 = t2 = t3 = t4 = nil\n GraphBuilder::Builder.build do |b|\n t1 = b.add(Thing1.new)\n b.chain do\n ...
[ "0.67063725", "0.66193116", "0.62538713", "0.62203693", "0.61957514", "0.6154854", "0.61080784", "0.6083351", "0.6083351", "0.60528934", "0.59270185", "0.58974713", "0.5880027", "0.5875142", "0.58525586", "0.5764493", "0.57299614", "0.5639", "0.5628936", "0.5615535", "0.56071...
0.0
-1
and add more ways to determine the current site
def site_from_host Site.find_for_host(request.host) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_site; end", "def discover_current_site\n site_from_host\n end", "def determine_site\n @current_site.nil? ? nil : @current_site.name\n end", "def current_site\n Site.current\n end", "def site; end", "def site; end", "def site; end", "def site; end", "def site; end", "de...
[ "0.829453", "0.7989378", "0.7606777", "0.7520299", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0.7269722", "0...
0.6754734
41
Checks whether the user is allowed to use this plugin Informs them and returns false if not This method is copied from plugins/phrases.rb so We may want to move it to our super class (PluginBase)
def authed?(irc) if !$user.caps(irc, 'op', 'owner').any? irc.reply "You aren't allowed to use this command" return false end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_allowed?(plugin_name); end", "def plugin_allowed?(plugin_name)\n !site.safe || whitelist.include?(plugin_name)\n end", "def can_proceed?(plugins, plugin_name)\n plugins = plugins.select do |plugin|\n plugin['name'] == plugin_name\n end\n\n return false i...
[ "0.7042889", "0.6744555", "0.6572638", "0.6494967", "0.6357215", "0.63278216", "0.6250822", "0.6250822", "0.62476367", "0.6247064", "0.6247064", "0.6201723", "0.6187513", "0.6158468", "0.61495316", "0.61381465", "0.6136943", "0.61226094", "0.6120435", "0.61155784", "0.6115235...
0.0
-1
=begin Name : challenge_convert.rb Description : Week 1 Challenge Convert Author : Yoann Le Touche Date : 20110119 License : MIT license =end Convert Fahrenheit to Celsius
def fahrenheit_to_celsius(temp) (temp.to_f - 32) * 5/9 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def challenge1\t\n\tputs \"Type '1' to convert from Celsius to Fahrenheit OR type '2' to convert from Fahrenheit to Celsius\"\n\tc_or_f = gets.chomp.to_i\n\n\tif c_or_f == 1\n\t\tputs \"Enter Celsius Temperature:\"\n\t\tc_to_f = gets.chomp.to_i\n\t\tdef fahrenheit(temp)\n\t\t\treturn (temp * 1.80) + 32\n\t\tend\n\...
[ "0.73740566", "0.73128635", "0.7284003", "0.7219258", "0.7131336", "0.71074796", "0.7074016", "0.7022339", "0.70141906", "0.69993114", "0.6972473", "0.6932624", "0.6900601", "0.68907344", "0.6869952", "0.6859429", "0.68179524", "0.6793522", "0.67891544", "0.6765178", "0.67359...
0.6786764
19
Convert Celsius to Fahrenheit
def celsius_to_fahrenheit(temp) temp.to_f * 9/5 + 32 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "def toCelsius(fahrenheit)\n return ((fahrenheit-32)*5.0/9.0).round\nend", "def celsius_to_fahrenheit(celsius)\n (celsius.to_f * 9) / 5 + 32\nend", "def convert_to_celsius(fahrenheit)\n celsius = (5*(fahrenheit.to_f - 32))/9\n ...
[ "0.85621315", "0.85612863", "0.85164046", "0.8500131", "0.8490014", "0.84437686", "0.8374901", "0.83176243", "0.83150935", "0.8314515", "0.8314066", "0.8284991", "0.82805455", "0.8263341", "0.82417434", "0.82219213", "0.82092005", "0.82016665", "0.82016665", "0.81997925", "0....
0.8616567
0
Convert Fahrenheit to Kelvin
def fahrenheit_to_kelvin(temp) (temp.to_f + 459.67) * 5/9 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kelvin_to_fahrenheit(temp)\n temp.to_f * 9/5 - 459.67\nend", "def kelvin_to_fahrenheit(temp)\n 1.8 * (temp - 273) + 32\n end", "def convert(_Fahrenheit)\n (_Fahrenheit.to_f - 32) * 5 / 9\n end", "def convert(fahrenheit)\n celsius = (5 * (fahrenheit - 32))/9\nend", "def convert_to_celsius(fahren...
[ "0.82461184", "0.79594994", "0.77662957", "0.76723105", "0.75761265", "0.7519359", "0.75179344", "0.7488525", "0.7459277", "0.7451383", "0.7448878", "0.7435929", "0.7435929", "0.7427321", "0.73963326", "0.73812574", "0.7376201", "0.7375708", "0.7372016", "0.7329374", "0.73245...
0.8289218
0
Convert Kelvin to Fahrenheit
def kelvin_to_fahrenheit(temp) temp.to_f * 9/5 - 459.67 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fahrenheit_to_kelvin(temp)\n (temp.to_f + 459.67) * 5/9\nend", "def kelvin_to_fahrenheit(temp)\n 1.8 * (temp - 273) + 32\n end", "def convert(_Fahrenheit)\n (_Fahrenheit.to_f - 32) * 5 / 9\n end", "def toFahrenheit(celsius)\n return (celsius*9.0/5.0).round+32\nend", "def toFahrenheit(celsius)\n...
[ "0.8189414", "0.8119704", "0.7698203", "0.75739", "0.75739", "0.7470573", "0.74686605", "0.7417044", "0.7402682", "0.7399592", "0.7381601", "0.73482955", "0.7347726", "0.7337662", "0.7326262", "0.7304178", "0.7303741", "0.72985685", "0.72676724", "0.72523767", "0.72482735", ...
0.8403565
0
Instantiate a new embeds_one association.
def initialize(base, target, association) super do characterize_one(_target) bind_one characterize_one(_target) update_attributes_hash(_target) _base._reset_memoized_descendants! _target.save if persistable? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one(name, options={})\n configure_for_key_correspondence if options[:using] === :key\n create_association(:one, name, options)\n end", "def has_one(*attrs)\n associate(Associations::HasOne, attrs)\n end", "def has_one(association, **options, &block)\n create_association(...
[ "0.68472254", "0.67159724", "0.66298115", "0.6607885", "0.640901", "0.63729477", "0.62999505", "0.6298188", "0.6228997", "0.6123966", "0.60922974", "0.6069196", "0.6063412", "0.6016926", "0.59853375", "0.5979373", "0.59644663", "0.59091884", "0.5697186", "0.56537575", "0.5618...
0.0
-1
Substitutes the supplied target documents for the existing document in the association.
def substitute(replacement) return self if replacement == self if _assigning? _base.add_atomic_unset(_target) unless replacement else update_target_when_not_assigning(replacement) end unbind_one return nil if replace_with_nil_document(replacement) replace_with(replacement) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute(replacement)\n if replacement\n new_docs, docs = replacement.compact, []\n new_ids = new_docs.map(&:_id)\n remove_not_in(new_ids)\n new_docs.each do |doc|\n docs.push(doc) if doc.send(foreign_key) != _base.send(_associatio...
[ "0.64535195", "0.6017908", "0.5899009", "0.5838751", "0.546346", "0.5424802", "0.5419934", "0.53875303", "0.53534037", "0.53199106", "0.5316496", "0.53086257", "0.52914184", "0.5290265", "0.5281727", "0.52060777", "0.52060777", "0.52006817", "0.5144934", "0.5118144", "0.50837...
0.54158837
7
Instantiate the binding associated with this association.
def binding Binding.new(_base, _target, _association) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binding\n HasMany::Binding.new(_base, _target, _association)\n end", "def create\n super\n push_binding(instance_eval(\"#{name.to_s}\"))\n end", "def create_binding_object(params)\n o = Object.new\n o.instance_eval do\n klass = class << self; self; end\n # f...
[ "0.6803947", "0.6661606", "0.6475957", "0.6475957", "0.6388953", "0.6388953", "0.62574255", "0.62214935", "0.62181914", "0.6211139", "0.620808", "0.61951125", "0.61907125", "0.6168781", "0.6117813", "0.6102626", "0.6102626", "0.60528743", "0.6017325", "0.59232354", "0.5829885...
0.76929617
0
Are we able to persist this association?
def persistable? _base.persisted? && !_binding? && !_building? && !_assigning? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_persist?\n @can_persist\n end", "def already_persisted?\n false\n end", "def can_persist!\n @can_persist = true\n end", "def persisted?\n true\n end", "def persisted?\n true\n end", "def persisted?\n true\n end", "def persisted?\n own...
[ "0.76096016", "0.74094635", "0.7383813", "0.7377292", "0.73631954", "0.73631954", "0.73541313", "0.7344123", "0.73108953", "0.73088837", "0.7281012", "0.72425497", "0.72318655", "0.72318655", "0.7200907", "0.7200907", "0.719221", "0.718554", "0.718554", "0.718554", "0.718554"...
0.7404246
2
Update the _base's attributes hash with the _target's attributes
def update_attributes_hash(replacement) if replacement _base.attributes.merge!(_association.store_as => replacement.attributes) else _base.attributes.delete(_association.store_as) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload\n attributes.each_key { |key| send \"#{key}=\", target.send(key) }\n end", "def reload\n attributes.each_key { |key| send \"#{key}=\", target.send(:[], key.to_sym) }\n end", "def set_target_attributes(_target)\n raise NoMethodError, \"subclasses must implement #{__method__}\"\n end",...
[ "0.6835284", "0.66499704", "0.6338407", "0.6148317", "0.6118413", "0.60418963", "0.59215105", "0.59085435", "0.5875459", "0.5872335", "0.5852807", "0.5789826", "0.5774367", "0.5757632", "0.5750343", "0.5729764", "0.57180125", "0.57180125", "0.57180125", "0.57180125", "0.57138...
0.61604756
3
When not ``_assigning?``, the target may need to be destroyed, and may need to be marked as a new record. This method takes care of that, with extensive documentation for why it is necessary.
def update_target_when_not_assigning(replacement) # The associated object will be replaced by the below update if non-nil, so only # run the callbacks and state-changing code by passing persist: false in that case. _target.destroy(persist: !replacement) if persistable? # A little explanation on why this is needed... Say we have three assignments: # # canvas.palette = palette # canvas.palette = nil # canvas.palette = palette # Where canvas embeds_one palette. # # Previously, what was happening was, on the first assignment, # palette was considered a "new record" (new_record?=true) and # thus palette was being inserted into the database. However, # on the third assignment, we're trying to reassign the palette, # palette is no longer considered a new record, because it had # been inserted previously. This is not exactly accurate, # because the second assignment ultimately removed the palette # from the database, so it needs to be reinserted. Since the # palette's new_record is false, Mongoid ends up "updating" the # document, which doesn't reinsert it into the database. # # The change I introduce here, respecifies palette as a "new # record" when it gets removed from the database, so if it is # reassigned, it will be reinserted into the database. _target.new_record = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_create\n self.target_id = target.id if target\n end", "def assign_to_or_mark_for_destruction(record, attributes, allow_destroy)\n if has_destroy_flag?(attributes) && allow_destroy\n record.mark_for_destruction\n else\n record.attributes = attributes.except(*UNAS...
[ "0.64409065", "0.6101106", "0.6060451", "0.56467754", "0.56270486", "0.5512907", "0.55080277", "0.5476435", "0.5476435", "0.5469456", "0.5458135", "0.54001266", "0.5342423", "0.53363824", "0.5329079", "0.5297243", "0.5297243", "0.5294903", "0.5282327", "0.5259119", "0.5253117...
0.6889295
0
Checks the argument. If it is nonnil, this method does nothing. Otherwise, it performs the logic for replacing the current document with nil.
def replace_with_nil_document(replacement) return false if replacement update_attributes_hash(replacement) # when `touch: true` is the default (see MONGOID-5016), creating # an embedded document will touch the parent, and will cause the # _descendants list to be initialized and memoized. If the object # is then deleted, we need to make sure and un-memoize that list, # otherwise when the update happens, the memoized _descendants list # gets used and the "deleted" subdocument gets added again. _reset_memoized_descendants! true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orchio_put_if_none_match(document)\n orchio_put_if_match(document, '\"*\"')\n end", "def current_document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); end", "def document=(_arg0); ...
[ "0.608952", "0.603545", "0.591059", "0.591059", "0.591059", "0.591059", "0.591059", "0.591059", "0.591059", "0.591059", "0.591059", "0.5850837", "0.5835166", "0.58265686", "0.57743007", "0.5731339", "0.57272863", "0.56992084", "0.5602767", "0.5602767", "0.55546737", "0.5546...
0.6420476
0
Replaces the current document with the given replacement document, which may be a Hash of attributes.
def replace_with(replacement) replacement = Factory.build(klass, replacement) if replacement.is_a?(::Hash) self._target = replacement characterize_one(_target) bind_one update_attributes_hash(_target) _target.save if persistable? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def update!(**args)\n @document = args[:document] if args.key?(:document)\n end", "def update!(**args)\n @document = args[:document] if args.key?(:document)\n end", "def replace_w...
[ "0.62434226", "0.615767", "0.615767", "0.61509955", "0.6005295", "0.5939491", "0.5875507", "0.58267623", "0.5822902", "0.5800155", "0.567699", "0.5673599", "0.5658164", "0.56363446", "0.5617907", "0.5611545", "0.5570885", "0.5558419", "0.55564487", "0.5550552", "0.5520973", ...
0.617725
1
Returns true if the association is an embedded one. In this case always true.
def embedded? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedded?\n self.class.embedded?\n end", "def embedded?\n @embedded == true\n end", "def embedded_many?\n metadata && metadata.macro == :embeds_many\n end", "def embedded?\n @embedded ||= (cyclic ? _parent.present? : self.class.embedded?)\n end", "def embedded_one?\n...
[ "0.8063945", "0.8035006", "0.7805588", "0.7761704", "0.75790787", "0.7533445", "0.7488147", "0.7475171", "0.72763926", "0.7199154", "0.7159485", "0.7073828", "0.70297766", "0.69647026", "0.681443", "0.6773686", "0.6740853", "0.67292356", "0.6677392", "0.66617984", "0.66270274...
0.76401955
4
Get the path calculator for the supplied document.
def path(document) Mongoid::Atomic::Paths::Embedded::One.new(document) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(document)\n Mongoid::Atomic::Paths::Root.new(document)\n end", "def calc_path\n endpoint = grid.target\n while endpoint\n search.path[endpoint] = true\n endpoint = search.came_from[endpoint]\n end\n end", "def path(document)\n relation.path(document)\n e...
[ "0.5550895", "0.5461945", "0.5427463", "0.5365803", "0.5274974", "0.5226613", "0.52163804", "0.5138868", "0.50805545", "0.50558", "0.4981231", "0.4946259", "0.49394098", "0.49111882", "0.4869029", "0.48473248", "0.48376", "0.4801279", "0.4801279", "0.4801279", "0.47942993", ...
0.5090977
8
GET /wait_orders GET /wait_orders.json
def index @wait_orders = WaitOrder.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue\n # yesterday's undone orders will still have fulfilled = NULL\n @orders = Order.get_queue_orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def getorders(args={})\n {\n :method=> \"GetOrders\"\n ...
[ "0.67628324", "0.6483807", "0.6349028", "0.63377416", "0.6289587", "0.6288997", "0.62744534", "0.62607634", "0.6247733", "0.6150131", "0.61109257", "0.610041", "0.6059946", "0.6016371", "0.5999167", "0.5998659", "0.5994348", "0.59843004", "0.59826714", "0.59775937", "0.595999...
0.7540077
0
GET /wait_orders/1 GET /wait_orders/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @wait_orders = WaitOrder.all\n end", "def queue\n # yesterday's undone orders will still have fulfilled = NULL\n @orders = Order.get_queue_orders\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def driver_sin...
[ "0.7251683", "0.6625857", "0.64342576", "0.6305513", "0.6303744", "0.6297839", "0.62863916", "0.62766016", "0.619288", "0.6190392", "0.6114396", "0.6111385", "0.61021394", "0.61005366", "0.60901946", "0.60756284", "0.6053564", "0.6046569", "0.5980293", "0.59762585", "0.597137...
0.0
-1
POST /wait_orders POST /wait_orders.json
def create @wait_order = WaitOrder.new(wait_order_params) respond_to do |format| if @wait_order.save format.html { redirect_to @wait_order, notice: 'Wait order was successfully created.' } format.json { render action: 'show', status: :created, location: @wait_order } else format.html { render action: 'new' } format.json { render json: @wait_order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def wait_order_params\n params.require(:wait_order).permit(:product_id, :code, :num, :state, :create_user_id, :modify_user_id, :stop_user_id, :stoped_at, :s...
[ "0.6768809", "0.64870954", "0.62699634", "0.620431", "0.6176262", "0.6111157", "0.61098814", "0.6054212", "0.5984392", "0.5980476", "0.5847687", "0.5821096", "0.5813519", "0.5808586", "0.5778051", "0.5729082", "0.5725091", "0.57096905", "0.5709219", "0.57032937", "0.56986564"...
0.7055403
0
PATCH/PUT /wait_orders/1 PATCH/PUT /wait_orders/1.json
def update respond_to do |format| if @wait_order.update(wait_order_params) format.html { redirect_to @wait_order, notice: 'Wait order was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @wait_order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @order.single?\n if( (Time.now + 1.hour <= Time.parse(@order.place_date + ' ' + @order.timeslot.start)) && (!@order.completed? ) && @order.update(update_order_params) )\n render json: @order, status: 200\n else\n render json: {'errorrs': ['Order can not be updat...
[ "0.65267634", "0.64942825", "0.6368446", "0.62889147", "0.6223465", "0.6165568", "0.610337", "0.6087384", "0.6028499", "0.6024941", "0.6024941", "0.60216594", "0.5983467", "0.59805506", "0.5979719", "0.5977603", "0.59720874", "0.59520775", "0.5951619", "0.59478545", "0.593528...
0.7179443
0
DELETE /wait_orders/1 DELETE /wait_orders/1.json
def destroy @wait_order.destroy respond_to do |format| format.html { redirect_to wait_orders_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def delete\n client.delete(\"/#{id}\")\n end", ...
[ "0.6867175", "0.67813617", "0.66923213", "0.66606194", "0.6533984", "0.65273947", "0.6497349", "0.6471236", "0.6447069", "0.64125115", "0.63905793", "0.63872206", "0.6367298", "0.63648134", "0.6363883", "0.63636667", "0.63533145", "0.6346849", "0.63341683", "0.633323", "0.631...
0.7319019
0
Use callbacks to share common setup or constraints between actions.
def set_wait_order @wait_order = WaitOrder.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def wait_order_params params.require(:wait_order).permit(:product_id, :code, :num, :state, :create_user_id, :modify_user_id, :stop_user_id, :stoped_at, :serial, :save_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
TODO Email should be sent asynchronousely TODO Email should be sent via external provider (Gmail?) TODO Implement other in questionnaire answer FIXME Export to excel should work without warning
def index # State machine stuff current_user.came_home eval current_user.redirect, binding() return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_survey_completion_emails\n return unless EMAILS_ENABLED\n\n UserMailer.survey_completed(@sheet).deliver_now\n end", "def send_gmail_to_listing(worksheet_key)\n\n\n# first we connect to gmail with the $gmail variable (where our logs are stored)\n\t$gmail\n\t\n#we go through each email adresse \n\t...
[ "0.68105644", "0.67936456", "0.67909104", "0.67602265", "0.66981775", "0.65896845", "0.65476096", "0.6543738", "0.6516828", "0.64244515", "0.64014184", "0.63989586", "0.63987637", "0.63682765", "0.63620603", "0.6357387", "0.635587", "0.6346689", "0.6327292", "0.6323374", "0.6...
0.0
-1
Estimate the integral between +x1+ and +x2+ of the block.
def integral(x1, x2, &f) x1, x2 = [x2, x1] if x1 > x2 # total is used to compute the trapezoid approximations. It is more or # less a total of all f() values computed so far. The trapezoid # method assigns half as much weight to f(x2) and f(x1) as it does to # all other f() values, so f(x2) and f(x1) are divided by two here. total = (yield(x1) + yield(x2))/2.0 call_cnt = 2 step_len = (x2 - x1).to_f estimate = total * step_len # 0th trapezoid approximation. row = [estimate] split = 1 steps = 2 aborted = false abs_error = nil loop do # Don't let step_len drop below the limits of numeric precision. # (This should prevent infinite loops, but not loss of accuracy.) if x1 + step_len/steps == x1 || x2 - step_len/steps == x2 aborted = true break end # Compute the (split)th trapezoid approximation. x = x1 + step_len/2 while x < x2 total += yield(x) call_cnt += 1 x += step_len end row.unshift total * step_len / 2 # Compute the more refined approximations, based on the (split)th # trapezoid approximation and the various (split-1)th refined # approximations stored in @row. pow4 = 4.0 1.upto(split) do |td| row[td] = row[td-1] + (row[td-1]-row[td])/(pow4 - 1) pow4 *= 4 end # row[0] now contains the (split)th trapezoid approximation, # row[1] now contains the (split)th Simpson approximation, and # so on up to row[split] which contains the (split)th Romberg # approximation. # Is this estimate accurate enough? old_estimate = estimate estimate = row[-1] abs_error = (estimate - old_estimate).abs if call_cnt >= min_call_cnt break if abs_error <= absolute_error || abs_error <= relative_error * estimate.abs if call_cnt >= max_call_cnt aborted = true break end end split += 1 step_len /=2 steps *= 2 end Estimate.new(estimate, aborted, call_cnt, abs_error) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_integrate(t1, pde1, t2, pde2)\n b = (Math.log(pde1) - Math.log(pde2)) / (t2 - t1)\n a = (pde1 - pde2) / (Math.exp(-b * t1) - Math.exp(-b * t2))\n (-a / b) * ((Math.exp(-b * t2) - Math.exp(-b * t1)))\n end", "def integral(f, a, b, dx)\n add_dx = lambda { |x| x + dx}\n sum(f, a + dx / 2.0, add_...
[ "0.60909045", "0.5898542", "0.56059927", "0.55770344", "0.546419", "0.546419", "0.5375797", "0.52645326", "0.52376777", "0.51644546", "0.51603657", "0.5154649", "0.5075469", "0.49988654", "0.49985772", "0.49808842", "0.4921257", "0.48939556", "0.48424697", "0.48352623", "0.48...
0.64348596
0
The application needs a won status that is always there and is distinguished.
def can_be_destroyed? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def won?\n end", "def won?\n end", "def won?\n won_checker\n end", "def won\n status = self.current_status\n hasUnderscore = status.include?(\"_\")\n return !hasUnderscore\n end", "def won?\n # Fill this in\n end", "def won\n if (object.result == 1 and object.white == current_user)...
[ "0.65054476", "0.65054476", "0.6479159", "0.6460958", "0.639445", "0.63727343", "0.6197628", "0.6035635", "0.59328496", "0.5908442", "0.5900649", "0.5894273", "0.58168525", "0.58013916", "0.5784779", "0.5780387", "0.57595634", "0.5755427", "0.5725592", "0.5717754", "0.5715915...
0.0
-1
defines method 'print_all', which calls '.read' on the file
def print_all(f) puts f.read end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_all(f)\t\t\t\t\t\t\t\t#prints the entire file\r\n puts f.read\r\nend", "def print_all(f)\n\t# print what is read from the file\n\tputs f.read()\n# ends the print_all function definition\nend", "def print_all(f)\n#execute the read method on f. read requires f to be a file\n\tputs f.read()\nend", "d...
[ "0.8284805", "0.8111233", "0.81045735", "0.8056378", "0.8023794", "0.8022416", "0.79013705", "0.78834707", "0.78787255", "0.78498703", "0.78493965", "0.78493965", "0.78493965", "0.7842318", "0.78395665", "0.7839454", "0.7839454", "0.7839454", "0.7839454", "0.78328454", "0.782...
0.76992786
58
defines method 'rewind', which calls '.seek', which brings us back to the numbered (in this case 0) line.
def rewind(f) f.seek(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rewind\n @sio_pos = 0\n @_st_lineNumber = 0\n end", "def rewind() end", "def rewind() end", "def rewind() end", "def rewind() end", "def rewind(f)\n #seeks for f at line 0\n f.seek(0)\n end", "def rewind(f)\n # sets the line counter to 0\n f.seek(0)\n # end of function block\nend",...
[ "0.8293446", "0.82756776", "0.82756776", "0.82756776", "0.82756776", "0.8266996", "0.82190466", "0.80636585", "0.80636585", "0.8031258", "0.8031258", "0.8031258", "0.7957091", "0.7950408", "0.79323524", "0.7928508", "0.792794", "0.79117984", "0.79117984", "0.79042226", "0.789...
0.786548
59
defines method 'print_a_line' which takes a number as the 'line_count' and a filename as 'f'. The 'gets.chomp'is called to end the printing at the end of the line.
def print_a_line(line_count, f) puts "#{line_count}, #{f.gets.chomp}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_a_line(line_count, f)\n\t# prints a line of the file, wherever it left off last\n\tputs \"#{line_count} #{f.readline()}\"\n# ends the print_a_line function definition\nend", "def print_a_line(line_count, f)\n puts \"#{line_count}, #{f.gets.chomp}\" # First 'puts' preps a slot for the line item number,...
[ "0.8307455", "0.81130713", "0.805692", "0.8035336", "0.80343324", "0.80343324", "0.7983188", "0.79829574", "0.79382384", "0.78288996", "0.7826879", "0.7826879", "0.7826879", "0.7826879", "0.7826879", "0.77986044", "0.7780602", "0.7769293", "0.77529967", "0.7743109", "0.774310...
0.773306
43
Public: decrypts text via keyed columnar transposition. The decryption method converts the ciphertext to an array, each row within which comprises +width+ characters. Each row in the array is reversed and the entire array is transposed, after which the array is converted back to a string. === Parameter(s) +ciphertext+ +String+: the text to be decrypted. +width+ +Integer+: the width of each row in the intermediary table required for transposition. === Return Value +String+: the decrypted text. === Example Assuming +K3+ is part 3 of the Kryptos sculpture: +decrypt(decrypt(K3, 4), 48)+ +=> Results in the plaintext+
def decrypt(ciphertext, width) matrix = ciphertext.chars.each_slice(width).map(&:join) matrix.each_with_index do |_, index| matrix[index] = matrix[index].split('') end matrix.map(&:reverse).transpose.join('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(ciphertext)\n plaintext = \"\"\n for i in 0...ciphertext.length\n key = @alphabet.index(ciphertext[i]);\n key = mod(key-@shift, @alphabet.length)\n plaintext = plaintext + @alphabet.at(key)[0]\n end\n return plaintext\n end", "def deciph...
[ "0.70614463", "0.68658525", "0.68150556", "0.67327327", "0.66415966", "0.6528842", "0.6526137", "0.65228814", "0.63051075", "0.6212968", "0.61809194", "0.61616135", "0.60071486", "0.59898704", "0.59712315", "0.5950221", "0.59352577", "0.5895109", "0.5895007", "0.5846591", "0....
0.8483796
0
This is called after the record is saved to store the changes on the model, including anything done in before_save validations
def notify_changes create_crumb unless watched_changes.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_as_saved!\n self.saved_attributes = attributes.dup\n self\n end", "def save!(*)\n super.tap do\n changes_applied\n end\n end", "def after_save(record)\n \n end", "def adjust_after_create\n # The record is in @record, do what you will, this preced...
[ "0.7285408", "0.71312916", "0.7111", "0.7052423", "0.7029116", "0.6995591", "0.69832397", "0.69115305", "0.6779266", "0.6768957", "0.67324895", "0.6731686", "0.6731686", "0.6729116", "0.67064786", "0.67064786", "0.67064786", "0.67064786", "0.67064786", "0.6689308", "0.6681156...
0.0
-1