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
Use callbacks to share common setup or constraints between actions.
def set_level @level = Level.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def level_params params.require(:level).permit(:nodes_list, :links_list, :number_of_nodes, :name, :flower_id, :game_id, :level_index) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Strip the legal description off the end of the place name.
def short_place_name # Drop the last word, it is always the legal description. words = place_name.split words.slice!(-1) if words.size > 1 words.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_supply_item_description(data)\n @description = @description.strip\n @description = @description.gsub(\"ß\",\"ss\")\n return @description\n end", "def sanitize_description\n self.description = Sanitize.fragment(self.description, Sanitize::Config::BASIC)\n end", "def clear_desc_helper...
[ "0.67845", "0.6662991", "0.6632498", "0.6444293", "0.643644", "0.64316756", "0.64316756", "0.63765925", "0.637489", "0.6217668", "0.62108326", "0.6208996", "0.620261", "0.6200705", "0.6174975", "0.6160568", "0.6155811", "0.61422586", "0.6137358", "0.61196864", "0.610557", "...
0.7720367
0
Add the xssrays main JS file to the victim DOM if there is a notyetstarted scan entry in the db.
def start_scan(hb, body) @body = body hb = BeEF::Core::Models::HookedBrowser.first(:id => hb.id) #TODO: we should get the xssrays_scan table with more accuracy, if for some reasons we requested #TODO: 2 scans on the same hooked browsers, "first" could not get the right r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_script_tags(fileContent)\n\n @doc = Nokogiri::HTML(fileContent)\n\n hasChanges = false\n\n headScript = @doc.at_css \"head script\"\n #check if head section already contains script\n if headScript == nil\n script = Nokogiri::HTML::DocumentFragment.parse '<script src=\"https://www.pow...
[ "0.5284737", "0.52472234", "0.51614755", "0.513495", "0.5046166", "0.49518847", "0.48183018", "0.48080644", "0.47960332", "0.47373208", "0.4705514", "0.47041076", "0.46879834", "0.4672423", "0.4657751", "0.4646072", "0.4640658", "0.46266326", "0.46219864", "0.4610055", "0.460...
0.5395707
0
stolen from the html formatter
def get_step_count(features) count = 0 features = features.instance_variable_get("@features") features.each do |feature| #get background steps if feature.instance_variable_get("@background") background = feature.instance_variable_get("@background") background.init ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_markup_html(text); end", "def html_markup_org(text); end", "def html_markup_text(text); end", "def html_markup_textile(text); end", "def formatter; end", "def formatter; end", "def formatter; end", "def to_html; end", "def html_markup_pre(text); end", "def format_as_span_html(name, attr,...
[ "0.73469216", "0.7331945", "0.70106673", "0.685852", "0.67991054", "0.67991054", "0.67991054", "0.6781612", "0.6773337", "0.6757685", "0.67378473", "0.67378473", "0.67378473", "0.66922945", "0.66922945", "0.66843545", "0.66843545", "0.66843545", "0.66843545", "0.66818404", "0...
0.0
-1
GET /docker_cfgs GET /docker_cfgs.json
def index @docker_cfgs = DockerCfg.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend", "def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end", "def index\n @cfgs = Cfg.all\n end", "def configuration\n _get(\"/system/configuration\") { |json| ...
[ "0.6590679", "0.6303524", "0.62529516", "0.58906597", "0.58280516", "0.5795003", "0.5685712", "0.56057507", "0.55796283", "0.55767864", "0.55728346", "0.55447704", "0.55054283", "0.5442954", "0.5419221", "0.5410386", "0.53715545", "0.5303685", "0.5299414", "0.52862597", "0.52...
0.7353785
0
GET /docker_cfgs/1 GET /docker_cfgs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @docker_cfgs = DockerCfg.all\n end", "def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend", "def index\n @cfgs = Cfg.all\n end", "def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end", "def configur...
[ "0.719186", "0.6504563", "0.61959845", "0.6162605", "0.57635695", "0.566735", "0.56260973", "0.5625457", "0.55753076", "0.5558121", "0.55257607", "0.54704666", "0.5466106", "0.5462566", "0.54331434", "0.5360658", "0.53539443", "0.53317344", "0.5310589", "0.5304832", "0.529289...
0.0
-1
POST /docker_cfgs POST /docker_cfgs.json
def create @docker_cfg = DockerCfg.new(docker_cfg_params) respond_to do |format| if @docker_cfg.save format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully created.' } format.json { render :show, status: :created, location: @docker_cfg } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def docker_cfg_params\n params.require(:docker_cfg).permit(:url, :auth, :email)\n end", "def index\n @docker_cfgs = DockerCfg...
[ "0.62701607", "0.60502195", "0.5705472", "0.55294424", "0.54385424", "0.53071445", "0.5297327", "0.5294959", "0.51998764", "0.5191767", "0.5185001", "0.5180456", "0.5171021", "0.5150128", "0.51157635", "0.509336", "0.50842595", "0.50606275", "0.50600713", "0.5042851", "0.5007...
0.65293795
0
PATCH/PUT /docker_cfgs/1 PATCH/PUT /docker_cfgs/1.json
def update respond_to do |format| if @docker_cfg.update(docker_cfg_params) format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully updated.' } format.json { render :show, status: :ok, location: @docker_cfg } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id...
[ "0.60054094", "0.5609754", "0.56033444", "0.5577615", "0.5518988", "0.55074143", "0.55067873", "0.5435359", "0.5428912", "0.53944427", "0.5324562", "0.5310807", "0.5304066", "0.52932334", "0.52890104", "0.52872807", "0.52841675", "0.52719164", "0.5263862", "0.52535075", "0.52...
0.66843307
0
DELETE /docker_cfgs/1 DELETE /docker_cfgs/1.json
def destroy @docker_cfg.destroy respond_to do |format| format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n conf.delete 'api'\n end", "def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |...
[ "0.63666695", "0.6163407", "0.6157467", "0.604893", "0.59399736", "0.5927168", "0.59170455", "0.58629817", "0.5857234", "0.5856907", "0.5848829", "0.58256614", "0.58090174", "0.58079714", "0.58030367", "0.5788703", "0.578436", "0.5780256", "0.5775013", "0.5762804", "0.5759943...
0.74122334
0
Use callbacks to share common setup or constraints between actions.
def set_docker_cfg @docker_cfg = DockerCfg.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def docker_cfg_params params.require(:docker_cfg).permit(:url, :auth, :email) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
METHOD new When users attempt to create a new facial recognition request, This method will be called
def new @matching = Matching.new puts "**********************************" puts request.host_with_port end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@matching = Matching.new(matching_params)\n\t\t#Detect the face\n\t\tif @matching.save\n\t\t\turi = URI('https://api.projectoxford.ai/face/v1.0/detect')\n\t\t uri.query = URI.encode_www_form({\n\t\t # Request parameters\n\t\t 'returnFaceId' => 'true'\n\t\t })\n\n\t\t request ...
[ "0.6593333", "0.6588765", "0.6059468", "0.6051499", "0.59199506", "0.591683", "0.5882553", "0.58488834", "0.5832536", "0.58229977", "0.5821608", "0.5821479", "0.58101577", "0.580272", "0.5787507", "0.5762744", "0.57550764", "0.5742039", "0.5736175", "0.5735589", "0.5735453", ...
0.0
-1
Method create This method is the core of the entire project. It would execute the following tasks: => create a new Matching object with the users' input (image) => constructe URI for HTTP request => API calls => parse results for the generation of views
def create @matching = Matching.new(matching_params) #Detect the face if @matching.save uri = URI('https://api.projectoxford.ai/face/v1.0/detect') uri.query = URI.encode_www_form({ # Request parameters 'returnFaceId' => 'true' }) request = Net::HTTP::Post.new(uri.request_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t@match = Match.new(match_params)\n\tend", "def run\n check_files_exist\n\n file_metadata = UploadFilesMetadataBuilder.build(files: files, mime_types: mime_types, basepath: basepath)\n upload_responses = UploadFiles.upload(file_metadata: file_metadata,\n ...
[ "0.62571275", "0.62432903", "0.6200726", "0.6112605", "0.6022256", "0.59414124", "0.59076524", "0.58390003", "0.58374584", "0.5784617", "0.5760692", "0.5702752", "0.5689429", "0.5688324", "0.5678753", "0.5672271", "0.5668011", "0.5640703", "0.5630589", "0.56259763", "0.561549...
0.69702965
0
parsing users' inputs from the form
def matching_params params.require(:matching).permit(:image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_form(entry)\n\t\t# set flag variable\n\t\t@@processed = true\n\t\t# check for inclusion of ||\n\t\tif(entry.include?\"||\")\n\t\t\t# get form\n\t\t\t@@form = getForm(entry)\n\t\t\t# split by ||\n\t\t\tins = entry.split(\"||\")\n\t\t\t# get user input\n\t\t\t@@last = ins[1]\n\t\telse\n\t\t\t# change fla...
[ "0.69718355", "0.64799494", "0.6403341", "0.60806066", "0.6078206", "0.603593", "0.5959013", "0.5953931", "0.5927367", "0.59078836", "0.58517945", "0.5836508", "0.5831095", "0.57706636", "0.5730447", "0.5724393", "0.57101077", "0.570802", "0.5689673", "0.56757456", "0.565255"...
0.0
-1
Utilities ========= ========= =========
def extract_data( filename, value ) data = IO.readlines( filename ) for i in 0..data.size()-1 #Get rid of special trailing characters data[i].chomp!(',') #then, strip away the identifying characters at the front data[i] = data[i].split(' ') for j in (0..data[i].size()-1) #Cut out the leadi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def terpene; end", "def identify; end", "def schubert; end", "def berlioz; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def stderrs; end", "def file_utils; end", "def ext; end", "def ext; end", "def user_os_co...
[ "0.70895207", "0.62597376", "0.6052395", "0.6040207", "0.6025503", "0.60178304", "0.60101193", "0.60101193", "0.60101193", "0.60101193", "0.59581006", "0.5953613", "0.58436555", "0.58436555", "0.5843478", "0.5769222", "0.576221", "0.5702617", "0.5702617", "0.566291", "0.56303...
0.0
-1
============ Main Routine ============
def main() if ARGV.size < 2 print "ERROR, not enough arguments" end #Alright, first, let's load up some files prefix = ARGV[0] value = ARGV[1] value = value.to_f # print "Value is: " << value.to_s << "\n" data = [] files = [] #Move into the prefix directory Dir....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\n end", "def main; end", "def main\n 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 run; end", "def main\n\nend", "def run() end", "def run_main\n end", "def run\n end", "def ...
[ "0.76846886", "0.76218987", "0.7470045", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.7178325", "0.6911838", "0.68353117", "0.6815786", "0.6794003", "0.67154944", "0.67154944", "0.67154944", "0.67154944", "0.671549...
0.0
-1
Lists all the solutions to a given to the solution's problem in the database GET /solutions GET /solutions.json
def index if params[:problem_id] @problem = Problem.find_by_shortname(params[:problem_id]) @solutions = @problem.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC') add_breadcrumb(@problem.name, problem_path(@problem)) else @solutions = Solution.paginate(page:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @solutions = Solution.all\n end", "def index\n @solutions = Solution.all\n end", "def index\n @solutions = Solution.all\n end", "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutio...
[ "0.77696353", "0.77696353", "0.77696353", "0.76266474", "0.7260292", "0.7201109", "0.7167172", "0.71484655", "0.7014493", "0.66513616", "0.66107064", "0.65932375", "0.65858835", "0.6583213", "0.6575315", "0.6570891", "0.6528184", "0.6434632", "0.6426727", "0.6415039", "0.6415...
0.675032
9
Shows the page for the solution. GET /solutions/1 GET /solutions/1.json
def show @problem = Problem.find_by_shortname(params[:problem_id]) breadcrumbs add_breadcrumb @solution.profile.user.username, problem_solution_path(@problem, @solution) respond_with @solution end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end", "def show\n @solutions = @profile.solutions.paginate(page: params[:page], per_page: 10 ).order('created_at DESC')\n re...
[ "0.7863956", "0.75881463", "0.75746787", "0.7480431", "0.7415202", "0.7322715", "0.72486115", "0.7228767", "0.718086", "0.718086", "0.718086", "0.7065347", "0.7021684", "0.6947204", "0.68998027", "0.6784996", "0.6689526", "0.66767746", "0.664554", "0.65967935", "0.65604", "...
0.6304482
26
Renders a new solution JSON. GET /solutions/new GET /solutions/new.json
def new @solution = Solution.new @problem = Problem.find_by_shortname(params[:problem_id]) breadcrumbs add_breadcrumb "New Solution" respond_with @solution end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end", "def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @so...
[ "0.8326608", "0.81872195", "0.7246181", "0.7200398", "0.7099739", "0.7099739", "0.7092185", "0.7084377", "0.7041991", "0.6978608", "0.6958164", "0.69516236", "0.6916159", "0.6915102", "0.6915102", "0.6915102", "0.6915102", "0.6897387", "0.68855953", "0.6871778", "0.6871642", ...
0.7187639
4
Edits the values of a solution. GET /solutions/1/edit
def edit @problem = @solution.problem @languages = Language.all breadcrumbs add_breadcrumb "Edit Solution" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n if @solution.update_attributes(params[:solution])\n format.html { redirect_to @solution, notice: 'Solution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren...
[ "0.7521842", "0.75204825", "0.74081594", "0.7347696", "0.730194", "0.726303", "0.7162043", "0.7112908", "0.6928689", "0.6855648", "0.6769445", "0.67407256", "0.6710302", "0.6623091", "0.66055256", "0.66055256", "0.66055256", "0.66055256", "0.66055256", "0.6533018", "0.6530432...
0.76563203
0
Creates and saves a new solution. POST /solutions POST /solutions.json
def create @problem = Problem.find_by_shortname(params[:problem_id]) @solution = @problem.solutions.create(solution_params) do |solution| solution.profile = current_user.profile end respond_to do |format| if @solution.save format.html { redirect_to problem_solution_path(@problem, @so...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @solution = Solution.new(params[:solution])\n\n respond_to do |format|\n if @solution.save\n format.html { redirect_to @solution, notice: 'Solution was successfully created.' }\n format.json { render json: @solution, status: :created, location: @solution }\n else\n ...
[ "0.7951547", "0.7757717", "0.7687291", "0.7472558", "0.7239505", "0.7176532", "0.7159066", "0.71504164", "0.7119069", "0.71184605", "0.70484334", "0.6867658", "0.6861515", "0.68233526", "0.6769764", "0.6538166", "0.650223", "0.64332974", "0.64178365", "0.63927275", "0.6347418...
0.717679
5
Updates the values of a solution. PUT /solutions/1 PUT /solutions/1.json
def update @problem = @solution.problem respond_to do |format| if @solution.update_attributes(solution_params) format.html { redirect_to problem_solution_path(@problem, @solution), notice: 'Solution was successfully updated.' } format.json { head :no_content } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n if @solution.update_attributes(update_solution_params)\n alert_j...
[ "0.8115978", "0.79059815", "0.7706205", "0.76714003", "0.739726", "0.7351319", "0.7310125", "0.7215383", "0.7178717", "0.70466346", "0.70165557", "0.6967814", "0.6878092", "0.6866501", "0.6811693", "0.6789116", "0.6789116", "0.6789116", "0.6789116", "0.6789116", "0.674499", ...
0.7327791
6
Deletes a solution from the database. DELETE /solutions/1 DELETE /solutions/1.json
def destroy @problem = @solution.problem @solution.destroy respond_to do |format| format.html { redirect_to problem_solutions_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end", "def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { hea...
[ "0.79201216", "0.7857783", "0.77873176", "0.77317", "0.76798415", "0.76036704", "0.76036704", "0.7485993", "0.74454343", "0.7428204", "0.72674125", "0.719691", "0.71958345", "0.71449274", "0.7002451", "0.69453126", "0.69063574", "0.6901829", "0.68937856", "0.68937856", "0.682...
0.74460816
8
Adds a down vote
def downvote @solution = Solution.find(params[:id]) if @solution.profiles_voted.include?(current_user.profile) @solution.profiles_voted.delete(current_user.profile) @solution.save @solution.up_votes -= 1 @solution.save else flash[:error] = "You have already voted on this soluti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote_down\n update_votes(-1)\n end", "def vote_up\n update_votes(1)\n end", "def vote up\n end", "def downvote\n @post = Post.find_by(id: params[:id])\n # Vote.find_or_create_by(downvote: 1, post: @post, user: @current_user)\n Vote.create(downvote: 1, post: @post, ...
[ "0.7636024", "0.75075155", "0.74443686", "0.7306794", "0.72749805", "0.71078146", "0.70067805", "0.69886976", "0.69850355", "0.6984087", "0.6874951", "0.682328", "0.6812163", "0.6793657", "0.67699474", "0.67533416", "0.67152035", "0.6696447", "0.66682047", "0.6646446", "0.662...
0.6285473
60
finds the solution based on params[:id] before_filter method for show edit update and destroy
def find_solution @solution = Solution.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_solution\n @solution = Solution.find(params[:id])\n end", "def set_solution\n @solution = Solution.find(params[:id])\n end", "def set_solution\n @solution = Solution.find(params[:id])\n end", "def set_solution\n @solution = Solution.find(params[:id])\n end", "def set...
[ "0.5863112", "0.5863112", "0.5863112", "0.5863112", "0.5863112", "0.5858152", "0.58267", "0.58165973", "0.5800167", "0.5749785", "0.5732143", "0.5732143", "0.57079065", "0.56901705", "0.56568515", "0.5651967", "0.5641255", "0.5632377", "0.5626337", "0.56236625", "0.55918944",...
0.67418325
0
adds the problem name breadcrumb and the problem's solutions breadcrumb
def breadcrumbs add_breadcrumb(@problem.name, problem_path(@problem)) add_breadcrumb "Solutions", problem_solutions_path(@problem) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_breadcrumb_modulo\n add_breadcrumb breadcrumb('administracao.avaliacao.base')\n add_breadcrumb pluralize_model(TbPergunta), administracao_tb_perguntas_path\n end", "def add_breadcrumb_modulo\n add_breadcrumb pluralize_model(TbAvaliacao), gerente_tb_avaliacoes_path\n end", "def add_breadcrumb...
[ "0.660099", "0.6253203", "0.6242928", "0.62065196", "0.61853856", "0.6086648", "0.5981815", "0.59683055", "0.5951522", "0.59202033", "0.5912598", "0.58730346", "0.58579165", "0.58424336", "0.5811792", "0.5747555", "0.5723171", "0.57200855", "0.5682621", "0.5675031", "0.566813...
0.841081
0
Helper method for voting
def vote up end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote\n\tend", "def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend", "def vote\n return unless logged_in?\n @snippet = Snippet.find(params[:id])\n unless @snippet.voted_by_user?(current_user)\n ...
[ "0.7718672", "0.7088911", "0.7072055", "0.70287937", "0.6965775", "0.6958787", "0.6948192", "0.6926842", "0.6909868", "0.69060385", "0.69060385", "0.69060385", "0.6873102", "0.686669", "0.67604697", "0.6756762", "0.67303157", "0.67221016", "0.670675", "0.6696494", "0.66842073...
0.72120357
1
Returns a hash with the message and status (one of :pending, :success, :failure or :forced_failure)
def current_state if !self.failure_message.nil? { message: self.failure_message, status: :forced_failure } elsif temporary { message: 'Running Visual Tests', status: :pending } else unapproved_count = self.unapproved_diffs.count approved_count = self.approved_diffs.count new_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n { 'status' => success ? 'sent' : 'failed' }\n end", "def to_hash\n {\n message: message,\n status: status\n }.compact\n end", "def status_hash\n return_val = { status: status ,\n post: true, # settable\n disable: @disab...
[ "0.8162462", "0.7672805", "0.7572004", "0.75207734", "0.71260303", "0.70984626", "0.6897144", "0.68761265", "0.68365663", "0.67801356", "0.672595", "0.67253685", "0.670322", "0.67011523", "0.6668506", "0.66305", "0.6548655", "0.6532439", "0.6514161", "0.65089715", "0.64827645...
0.675852
10
Queries github for metadata about the build, and stores it in the build object
def fetch_github_information self.associated_commit_shas = [] self.branch_name = nil self.username = nil return if self.dev_build GithubService.run(self.project.github_root_url, self.project.github_repo) do |service| if self.is_branch_build self.associated_commit_shas = service.githu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_github_data\n self.info = GithubInfoFetcher.new.call(github_path).to_h\n end", "def add_build_information(build_host)\n parse\n\n # add buildhost\n @structure['buildhost'] = build_host\n # add builddate\n @structure['builddate'] = Time.zone.now\n\n store\n end", "...
[ "0.6676112", "0.6228378", "0.6106342", "0.58816046", "0.5874311", "0.58546877", "0.5842842", "0.58100754", "0.575716", "0.57565826", "0.57403475", "0.57230705", "0.5706016", "0.5692938", "0.56485033", "0.56410736", "0.56106216", "0.5564234", "0.55620843", "0.55456483", "0.552...
0.65149206
1
Git shas are stored with an image when it is approved in a pull request. This function finds the list all shas associated with a build and returns all the preapproved images This is the case when two developers made changes regarding the same test image, and both made the same build after being merged into develop
def preapproved_images_for_branch preapproved_images = {} if self.is_branch_build self.associated_commit_shas.each do |sha| TestImage.where(image_pull_request_sha: sha, approved: false).select { |image| image.build.project.id == self.project.id }.each do |image| if preapproved_images.key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_preapprovals_for_pull_request\n previous_preapproved_images = {}\n self.project.pull_requests(self.pull_request_number).each do |build|\n next if build == self\n\n build.test_images.where(image_pull_request_number: self.pull_request_number).where.not(image_pull_request_sha: nil).each d...
[ "0.63665056", "0.6093618", "0.5970854", "0.5484889", "0.5405246", "0.53921777", "0.5368084", "0.53144735", "0.5197754", "0.5185899", "0.51347715", "0.5132421", "0.51204145", "0.5109678", "0.5100155", "0.50852966", "0.50653744", "0.5064537", "0.5015392", "0.49960488", "0.49920...
0.7573376
0
Git shas and PR numbers are stored with an image when it is approved in a pull request. This function searches previous builds for matching PR number and returns the last image that got preapproved
def previous_preapprovals_for_pull_request previous_preapproved_images = {} self.project.pull_requests(self.pull_request_number).each do |build| next if build == self build.test_images.where(image_pull_request_number: self.pull_request_number).where.not(image_pull_request_sha: nil).each do |image| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preapproved_images_for_branch\n preapproved_images = {}\n if self.is_branch_build\n self.associated_commit_shas.each do |sha|\n TestImage.where(image_pull_request_sha: sha, approved: false).select { |image| image.build.project.id == self.project.id }.each do |image|\n if preapproved_...
[ "0.7318447", "0.61507756", "0.5988535", "0.59307134", "0.5916995", "0.5735134", "0.5728526", "0.57255113", "0.56145406", "0.5593196", "0.5568748", "0.54974836", "0.54184496", "0.5365312", "0.5337029", "0.5308894", "0.53025675", "0.52983665", "0.52911735", "0.5283577", "0.5281...
0.76774704
0
Pull Request Number is a string
def is_branch_build self.pull_request_number == '-1' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pull_number(payload)\n if payload[:pull_request]\n return payload[:pull_request][:number]\n elsif payload[:issue]\n return payload[:issue][:number]\n elsif payload[:comment][:pull_request_url]\n return payload[:comment][:pull_request_url].split('/')[-1]\n else\n ...
[ "0.68687695", "0.6479396", "0.632144", "0.6184376", "0.6076052", "0.6070272", "0.5900074", "0.5867162", "0.5821415", "0.5772031", "0.57593095", "0.57306", "0.5722287", "0.5696311", "0.56741583", "0.56467575", "0.55996907", "0.5567406", "0.5537187", "0.5529709", "0.5461335", ...
0.56435686
16
Listing out the Messages of loggedin user
def index collect_messages @message = Message.new #Stalker.enqueue('email.send', :to => 'joe@example.com') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @messages = current_user.all_messages.not_deleted\n session[:messaging_context] = :index\n end", "def outbox\n cur_emp = get_logged_employee\n @messages = Message.where(\"sent_by = ?\", cur_emp).where(:is_deleted => nil) \n render \"resumes/message_show\"\n end", "def unseen\...
[ "0.7501016", "0.72841877", "0.7271454", "0.72481006", "0.71318686", "0.6990979", "0.6978621", "0.69687074", "0.6940487", "0.6906623", "0.69032836", "0.68773687", "0.6851457", "0.67997915", "0.6781414", "0.67450356", "0.6737338", "0.6736516", "0.67196363", "0.6708503", "0.6686...
0.0
-1
Creating a New Message Instance
def new @message = Message.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \t@message = Message.new\n end", "def newMessage\n @message = Message.new\n end", "def create_message(data); end", "def create_message(data); end", "def create\n create_message(params)\n end", "def create\n @message = Message.new(message_params)\n create_q(@message)\n ...
[ "0.8043833", "0.7874997", "0.75623274", "0.75623274", "0.7514646", "0.74457365", "0.73981845", "0.7320694", "0.73139477", "0.72745085", "0.7192767", "0.70936894", "0.70554745", "0.7018025", "0.6997952", "0.69821453", "0.697852", "0.6954714", "0.68658864", "0.6843722", "0.6822...
0.80022097
8
Creating a New Message
def create message = Message.new(params[:message]) if message.valid? create_messages(params[:message_user_select],message) message.attachment = params[:file] if params[:file] redirect_to messages_path else render :action => 'index' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_message(data); end", "def create_message(data); end", "def create\n create_message(params)\n end", "def create\n @message = Message.new(message_params)\n create_q(@message)\n end", "def newMessage\n @message = Message.new\n end", "def new\n \t@message = Message.new\n ...
[ "0.82190454", "0.82190454", "0.8114895", "0.791618", "0.77897286", "0.7763425", "0.77059203", "0.76904285", "0.76904285", "0.76904285", "0.76904285", "0.76904285", "0.76904285", "0.76904285", "0.76904285", "0.7682502", "0.7573885", "0.74724007", "0.74719507", "0.74241495", "0...
0.0
-1
For Retrieving Agency List
def get_agencies @type = params[:value] agencies= Agency.where(:deleted => false) render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @agencies = Agency.all\n end", "def index\n @agencies = current_user.agencies.all\n end", "def agencies\n Agency.where(id: transportation_agencies.pluck(:id) + oversight_agencies.pluck(:id))\n end", "def getAdvocacy\n\t\t\n\tend", "def agency\n\t\treturn @agency if @agency_loaded\n\...
[ "0.7347078", "0.6745819", "0.6710875", "0.66035646", "0.6455755", "0.6451128", "0.6397488", "0.6256973", "0.6202128", "0.6164326", "0.6143064", "0.61315197", "0.6083294", "0.58505034", "0.5843183", "0.5739416", "0.5698773", "0.5650518", "0.562081", "0.55841416", "0.5579355", ...
0.5647936
18
For Retrieving Department List
def get_departments @type = params[:value] render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department_names; end", "def department\n response = create_request(API_ENDPOINT, DEPARTMENTS_URI)\n arrange_response(response)\n end", "def department\n fetch('company.department')\n end", "def query_depts\n { 'respDepartment' => Newspilot.configuration.departments }\n ...
[ "0.7693506", "0.7415049", "0.7389801", "0.723497", "0.70802635", "0.703874", "0.6971752", "0.6966716", "0.69075006", "0.6903321", "0.6862852", "0.6862852", "0.6862852", "0.68499625", "0.6832326", "0.6830638", "0.6830638", "0.6830638", "0.6826689", "0.67913765", "0.67731607", ...
0.0
-1
For Retrieving Unit List
def get_units @agency, @depts = params[:agency], params[:dept] render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def units\n self.ListUnits.first.map { |u| map_unit(u) }\n end", "def units\n\t\tret = []\n\t\t@db.smembers('sgt-structure:' + @id + ':units').each do |uid|\n\t\t\tret.push(getUnit(@db, uid))\n\t\tend\n\t\tret\n\tend", "def unit\n return @units[@index]\n end", "def unit\n return @units[@in...
[ "0.7906972", "0.7586435", "0.7313814", "0.7313814", "0.6931396", "0.677874", "0.67722297", "0.67608184", "0.67250925", "0.6622793", "0.6525039", "0.6465827", "0.6451486", "0.6451486", "0.6451486", "0.6451486", "0.6451486", "0.6451486", "0.6417611", "0.64105713", "0.63807565",...
0.0
-1
For Retrieving Particular Department Admin
def get_department_admin @agency,@dept = Agency.find(params[:agency]), Department.find(params[:dept]) role = @dept.role_memberships.where(:role_id=>2) @dept_admin = User.find(role[0].user_id) if !role.blank? render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department\n fetch('company.department')\n end", "def get_department\n begin\n @company = Company.find(params[:company_id])\n @department = @company.departments.find(params[:id])\n rescue\n redirect_to departments_path\n end\n end", "def for_department(department_name);...
[ "0.720408", "0.69457", "0.6817349", "0.6792256", "0.6792256", "0.6792256", "0.67880833", "0.67580557", "0.67428637", "0.6733231", "0.67318195", "0.6693612", "0.6663666", "0.66210216", "0.66144276", "0.65521413", "0.65352374", "0.6461331", "0.64511055", "0.6451066", "0.6438181...
0.7765424
0
For Retrieving Particular Unit Admin
def get_unit_admin @agency, @depts, @unit = params[:agency], params[:dept], Unit.find(params[:unit]) role = @unit.role_memberships.where(:role_id=>4) @unit_admin = User.find(role[0].user_id) if !role.blank? render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_name\n @production_menu.unit_name\n end", "def unit_name\n @production_menu.unit_name\n end", "def get_admin(*params); raise('Stub or mock required.') end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render act...
[ "0.65675354", "0.65675354", "0.65273833", "0.64448273", "0.6417452", "0.6396682", "0.63808864", "0.6343", "0.63123095", "0.6303666", "0.62878424", "0.62792397", "0.6211878", "0.62019134", "0.6188333", "0.6155443", "0.6153535", "0.6133851", "0.61316806", "0.6113799", "0.609841...
0.78861386
0
Define input_to_index method here
def input_to_index(user_input) index = user_input.to_i - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_to_index(user_input)\n index=(user_input .to_i) -1\nend", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(user_input)\n index = u...
[ "0.79006207", "0.7750525", "0.7750525", "0.7750525", "0.7651268", "0.7651268", "0.76344913", "0.76146704", "0.75977075", "0.7564455", "0.75323373", "0.75157034", "0.75120175", "0.7466237", "0.7461767", "0.7446392", "0.7428585", "0.7422843", "0.7422843", "0.7408909", "0.740693...
0.7493927
16
Define valid_move? method here (NEED TO GET TO PASS!!!)
def valid_move?(board, index) if !position_taken?(board, index) && index.between?(0, 8) true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(new_x, new_y)\n true\n end", "def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end...
[ "0.81707877", "0.80959886", "0.80515075", "0.7995404", "0.79632366", "0.79396963", "0.7933418", "0.79193026", "0.79152507", "0.7894048", "0.78925604", "0.7892297", "0.789188", "0.7886675", "0.78509444", "0.78496855", "0.7833221", "0.783067", "0.78257096", "0.7823671", "0.7797...
0.0
-1
Redefine your position_taken? method here, so that you can use it in the valid_move?
def position_taken?(board, index) board[index] != " " && board[index] != "" && board[index] != nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend", "def position_taken?\nend", "def valid_move?(board, index)\n if index.between?(0, 8)\n # re-define your #position_taken? method here, so that you can use it in the #v...
[ "0.8240442", "0.8239552", "0.78712237", "0.78354955", "0.7753824", "0.7715361", "0.7687024", "0.76818377", "0.76561576", "0.7650391", "0.764258", "0.76389986", "0.7636525", "0.76078165", "0.76037806", "0.7601765", "0.75966203", "0.75939566", "0.7593776", "0.7580084", "0.75773...
0.0
-1
Define move method here
def move(board, index, value = "X") # Defines move method accepting 3 arguments (1 default) board[index] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move; end", "def move; end", "def move\n\n end", "def move\n \n end", "def move\n \n end", "def move(direction)\n \n end", "def move\n\t\t'moved passed'\n\tend", "def moving!\n end", "def move\n move_by a, m\n end", "def move(src, dst)\n not_implemented('move')\n ...
[ "0.8951901", "0.8951901", "0.8587855", "0.8493873", "0.8493873", "0.8211394", "0.7903394", "0.78432107", "0.76726955", "0.76229036", "0.7602262", "0.75462925", "0.7534796", "0.75209546", "0.7516886", "0.74692047", "0.7435364", "0.7411991", "0.74076", "0.7398248", "0.73924816"...
0.0
-1
Define turn method here
def turn(board) puts "Please enter 1-9:" user_input = gets.strip # Gets user input index = input_to_index(user_input) # Passes user input to input_to_index method as argument if valid_move?(board, index) == true # Test Code not valid then turn(board) to run again move(board, index, value = "X") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_turn(board)\n raise \"Base turn class doesn't know what turn to run!\"\n end", "def turn(t)\n\t\tcardinal = [\"N\", \"E\", \"S\", \"W\"]\n\t\tpos = cardinal.index(@direction)\n\t\tif t == \"L\"\n\t\t\tpos -= 1\n\t\telsif t == \"R\"\n\t\t\tpos += 1\n\t\tend\n\t\t@direction = cardinal[pos % 4]\n\tend...
[ "0.7415765", "0.7305733", "0.7251491", "0.7201485", "0.71877694", "0.71074164", "0.7086392", "0.7080224", "0.7055882", "0.6912613", "0.68785083", "0.6874026", "0.6854915", "0.6849873", "0.6848105", "0.6826346", "0.68234676", "0.6817249", "0.68111277", "0.6810766", "0.6806603"...
0.0
-1
Because of the form structure, our params for OAI settings are coming into params in separate hashes. This method updates the params hash to pull the data from the right places and serializes them for the DB update. The params hash is a complicated data structure, sorry about the confusing hash references! params["repo...
def handle_oai_config_params(params) repo_set_codes_hash = params["repo_set_codes"] oai_config_hash = params["oai_config"] if repo_set_codes_hash oai_config_hash['repo_set_codes'] = params["repo_set_codes"].keys.to_json else oai_config_hash['repo_set_codes'] = "[]" end # The sponso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_repository_oai_params(params)\n repo_params_hash = params[\"repository\"][\"repository\"]\n form_oai_enabled_hash = params[\"repository\"][\"repository_oai\"]\n form_oai_sets_hash = params[\"sets\"]\n\n # handle set id checkboxes\n if form_oai_sets_hash\n repo_params_hash[\"o...
[ "0.78919643", "0.62916285", "0.594795", "0.57855153", "0.57007897", "0.55536246", "0.55403066", "0.5533747", "0.55220246", "0.5428516", "0.54275036", "0.5394508", "0.5360888", "0.534599", "0.5301827", "0.5293921", "0.5270541", "0.5261683", "0.52561295", "0.5252505", "0.525176...
0.71510154
1
This makes :create abilities pass where obj_roles haven't beeen created yet
def performer_is_in_owner_performers?(owner) owner.performers.include? @performer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_create\n super\n check_roles\n end", "def create_roles\n Role.create_roles(self)\n end", "def roles_permit?(obj)\n roles.blank? || roles_overlap?(obj)\n end", "def create_user_role\n if self.role.blank?\n id = Role.select{|role| role.role_type == $roles[:user]}.map(&:id...
[ "0.70096725", "0.68769795", "0.65792084", "0.637908", "0.636714", "0.635612", "0.6303178", "0.6213414", "0.6172802", "0.6172802", "0.6157201", "0.61523455", "0.6152211", "0.6150894", "0.61333835", "0.6129269", "0.6129269", "0.6129269", "0.612812", "0.61167735", "0.6083295", ...
0.0
-1
Excerpted from "Programming Ruby", published by The Pragmatic Bookshelf. Copyrights apply to this code. It may not be used to create training material, courses, books, articles, and the like. Contact us if you are in doubt. We make no guarantees that this code is fit for any purpose. Visit for more book information.
def require_relative(relative_feature) c = caller.first e = c.rindex(/:\d+:in /) file = $` if /\A\((.*)\)/ =~ file # eval, etc. raise LoadError, "require_relative is called in #{$1}" end absolute_path = File.expand_path(File.join(File.dirname(file), relative_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def herald; end", "def jack_handey; end", "def p15\n\t\nend", "def how_it_works\r\n end", "def king_richard_iii; end", "def probers; end", "def who_we_are\r\n end", "def r; end", "def r; end", "def hello_world # \"def\" is short for \"defining a method\" and we are\n ...
[ "0.66293347", "0.6487746", "0.62028325", "0.61841357", "0.61679405", "0.6148557", "0.6118749", "0.6084315", "0.6084315", "0.59938556", "0.5986316", "0.5986316", "0.5919499", "0.5877361", "0.58678204", "0.58254075", "0.5822708", "0.5811035", "0.5795245", "0.5790604", "0.578965...
0.0
-1
GET /others/1 returns an array of users that the current user hasn't swiped right (liked) yet
def other_users @remaining_users = User.all - @user.likes render json: @remaining_users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_praying_list_of_others\n @content_prayers = current_user.content_prayers.accepted.no_answered.exclude_owner.page(params[:page]).per(3)\n render partial: true, locals: { content_prayers: @content_prayers }\n end", "def engaged_users\n self.users.select { |u| u.ideas.count > 0 || u.comments....
[ "0.6618986", "0.65218353", "0.6481884", "0.64719015", "0.63031363", "0.6136203", "0.6068524", "0.60595536", "0.60278434", "0.60077953", "0.600403", "0.6001053", "0.5984464", "0.5968464", "0.59358734", "0.5929009", "0.59109104", "0.58987004", "0.58964723", "0.5884932", "0.5881...
0.6858074
0
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def user_params params.require(:user).permit(:email, :password, :gender, :preference, :username, :age, :character_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7120904", "0.70538116", "0.69469863", "0.6901261", "0.67348766", "0.6717708", "0.66874576", "0.6676195", "0.66601187", "0.65563625", "0.6525127", "0.64565873", "0.64494514", "0.644928", "0.64452374", "0.6433947", "0.6412815", "0.6412815", "0.6391939", "0.63792473", "0.6379...
0.0
-1
Use callbacks to share common setup or constraints between actions. Never trust parameters from the scary internet, only allow the white list through.
def profile_params params.require(:employee).permit( :current_address, :marital_status, :contact_no, :emergency_contact_no, :emergency_name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_hook; end", "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def before_action \n end", "def before_setup; end", "def my_action_params\n params.require(:my_action).permit(:name, :url, :active, :provider_id)\n end", "def define_a...
[ "0.60898715", "0.6080416", "0.60111266", "0.5874335", "0.5798924", "0.5752487", "0.55931157", "0.5513508", "0.5513508", "0.5513508", "0.54071677", "0.54015255", "0.53852475", "0.536713", "0.53501946", "0.5348372", "0.5346325", "0.533946", "0.533591", "0.5316514", "0.5303312",...
0.0
-1
I spent [] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? integer What is the output? (i.e. What should the code return?) string What are the steps n...
def separate_comma(number) number_string = number.to_s size = number_string.length if size < 4 number_string else array = number_string.split(//).reverse! counter = 0 new_array = [] array.each do |element| new_array << element counter += 1 new_array << "," if counter % 3 == 0 && counter < size ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_comma(number)\n array = number.to_s.split('') #creates an array from number w/ digits\n number_commas = array.size/3.0 #how many commas\n if array.size < 4 #this is a 3 digit number\n return number.to_s #return number no comma needed\n elsif array.size%3 == 0\n n = -4\n (number_commas.to_...
[ "0.8322544", "0.8289919", "0.82807696", "0.82631195", "0.8198314", "0.819428", "0.8157133", "0.8153329", "0.8113253", "0.80920786", "0.8067098", "0.80362445", "0.802264", "0.80190474", "0.80022764", "0.79932994", "0.7967842", "0.7930868", "0.7912236", "0.79114485", "0.7906560...
0.7943115
17
Rebuild the feature dictionary from the document cache associated with this instance's domain, and then rebuild all feature vectors for documents in this domain
def rebuild_feature_dictionary if current_domain.locked? warn "[HERCULE] attempt to rebuild feature dictionary for locked domain '#{@domain}'" return end # Extract the document instances from the cache hash values docs = current_domain.cache.values # Compile a list of uni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild_document_collection()\n end", "def calculate_feature_vector\n fd = current_domain.dictionary\n fd_ids = fd.keys.sort\n\n @feature_vector = fd_ids.map do |fd_id|\n feature = fd[fd_id]\n @feature_set.member?( feature ) ? 1 : 0 # TODO: TF-IDF here -- Thu Mar 1 ...
[ "0.6312449", "0.5818435", "0.5782069", "0.54644674", "0.54263955", "0.53687805", "0.5349768", "0.5349768", "0.5336563", "0.5329898", "0.53224885", "0.53151447", "0.5308573", "0.52894557", "0.5280459", "0.5256468", "0.5229463", "0.5225368", "0.52183914", "0.5194916", "0.519152...
0.885565
0
Calculate the feature vector for the document's features using a TFIDF approach NOTE: Consider using a BNS feature scaling approach See paper by G. Forman,
def calculate_feature_vector fd = current_domain.dictionary fd_ids = fd.keys.sort @feature_vector = fd_ids.map do |fd_id| feature = fd[fd_id] @feature_set.member?( feature ) ? 1 : 0 # TODO: TF-IDF here -- Thu Mar 1 19:25:21 2012 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tf_idf\n tf.each do |tf_k, tf_v|\n idf_v = idf[tf_k]\n tfidf[tf_k] = bigdecimal(tf_v * idf_v)\n end\n tfidf\n end", "def tf_idf\n tf_idf = tf.clone\n \n tf.each_with_index do |document, index|\n document.each_pair do |term, tf_score|\n tf_idf[index][term] = tf_score *...
[ "0.673698", "0.6693002", "0.6584488", "0.64253646", "0.6359043", "0.6321399", "0.6289191", "0.6236171", "0.6182471", "0.5946528", "0.5893461", "0.58918023", "0.58768964", "0.58128494", "0.5577189", "0.55727726", "0.5532084", "0.5491706", "0.5475365", "0.53688633", "0.53242934...
0.74232227
0
Create an AWS integration.
def create_aws_account(body, opts = {}) data, _status_code, _headers = create_aws_account_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_aws_connection\n Ankus::Aws.new @credentials[:aws_access_id], @credentials[:aws_secret_key], @credentials[:aws_region], @log, @mock\n end", "def create_new_aws_external_id_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling...
[ "0.66766846", "0.6094109", "0.5984254", "0.5940147", "0.5810812", "0.5749007", "0.5710529", "0.5692695", "0.56391233", "0.5577577", "0.55743855", "0.55580944", "0.55131483", "0.55056804", "0.5471825", "0.5467139", "0.5464697", "0.5397217", "0.53925174", "0.53343046", "0.53340...
0.0
-1
Create an AWS integration. Create a DatadogAmazon Web Services integration. Using the `POST` method updates your integration configuration by adding your new configuration to the existing one in your Datadog organization. A unique AWS Account ID for role based authentication.
def create_aws_account_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.create_aws_account ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_aws_connection\n Ankus::Aws.new @credentials[:aws_access_id], @credentials[:aws_secret_key], @credentials[:aws_region], @log, @mock\n end", "def create_new_aws_external_id_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling...
[ "0.59522766", "0.5878032", "0.56185126", "0.54526883", "0.53255993", "0.53231186", "0.5270491", "0.52519035", "0.51991963", "0.51866084", "0.5157821", "0.5136173", "0.5097077", "0.50958854", "0.50264174", "0.50035614", "0.5001295", "0.49960095", "0.49936852", "0.49816495", "0...
0.5730003
2
Set an AWS tag filter.
def create_aws_tag_filter(body, opts = {}) data, _status_code, _headers = create_aws_tag_filter_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_tags=(filtered_tags)\n assert_unloaded\n @filtered_tags = names_to_tags(filtered_tags)\n end", "def set_tag_for_search(tag)\n @page.all(input_elements[:entries])\n @page.find(input_elements[:tag_filter_field]).set(tag)\n @page.find(input_elements[:tag_selected]).click\n @use...
[ "0.6573462", "0.6522912", "0.63302636", "0.60031134", "0.5994603", "0.5972987", "0.59630126", "0.5951772", "0.5951772", "0.5951772", "0.59294236", "0.5897076", "0.5875897", "0.5834874", "0.5834874", "0.5834874", "0.5834874", "0.5834874", "0.5834874", "0.5834874", "0.5781554",...
0.6222746
3
Set an AWS tag filter. Set an AWS tag filter.
def create_aws_tag_filter_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.create_aws_tag_filter ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_tags=(filtered_tags)\n assert_unloaded\n @filtered_tags = names_to_tags(filtered_tags)\n end", "def set_tag_for_search(tag)\n @page.all(input_elements[:entries])\n @page.find(input_elements[:tag_filter_field]).set(tag)\n @page.find(input_elements[:tag_selected]).click\n @use...
[ "0.6478325", "0.64633566", "0.6399684", "0.6133479", "0.6133479", "0.6133479", "0.6067741", "0.6064445", "0.60584867", "0.60343605", "0.60342544", "0.5936873", "0.59143436", "0.5903662", "0.5857352", "0.57858574", "0.5754754", "0.571585", "0.5710233", "0.565061", "0.5637981",...
0.0
-1
Generate a new external ID.
def create_new_aws_external_id(body, opts = {}) data, _status_code, _headers = create_new_aws_external_id_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_new_id\n Util::UUID.generate\n end", "def basic_generate_id(str); end", "def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end", "def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].for...
[ "0.79010344", "0.7694954", "0.76210207", "0.75807923", "0.75127155", "0.75120884", "0.75051445", "0.7456604", "0.74504244", "0.7428319", "0.740714", "0.7374545", "0.7348282", "0.7279466", "0.72494847", "0.7247113", "0.72240305", "0.72236335", "0.72135615", "0.72083545", "0.71...
0.0
-1
Generate a new external ID. Generate a new AWS external ID for a given AWS account ID and role name pair.
def create_new_aws_external_id_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.create_new_aws_external_id ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation &...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_aws_external_id(body, opts = {})\n data, _status_code, _headers = create_new_aws_external_id_with_http_info(body, opts)\n data\n end", "def generate_new_id\n Util::UUID.generate\n end", "def generate_record_id\n @client_id + '-' + SecureRandom.uuid\n end", "def...
[ "0.6492088", "0.63487005", "0.615638", "0.60401064", "0.6023234", "0.598518", "0.59395164", "0.58617055", "0.5833322", "0.5774857", "0.5761201", "0.57535046", "0.5704417", "0.5697752", "0.5688426", "0.56661683", "0.5664556", "0.56594694", "0.564988", "0.55924433", "0.5576125"...
0.53656167
46
Delete an AWS integration.
def delete_aws_account(body, opts = {}) data, _status_code, _headers = delete_aws_account_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @integration.destroy\n respond_to do |format|\n format.html { redirect_to integrations_url, notice: 'Integration was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @integration = Integration.find(params[:id])\n @integration.destr...
[ "0.6755164", "0.67107785", "0.6615344", "0.658639", "0.65663004", "0.6299693", "0.6282176", "0.62735546", "0.61993426", "0.608916", "0.6035659", "0.60250515", "0.60169744", "0.5975238", "0.59706354", "0.59435874", "0.5933744", "0.5926696", "0.5920246", "0.59172654", "0.591188...
0.0
-1
Delete an AWS integration. Delete a DatadogAWS integration matching the specified `account_id` and `role_name parameters`.
def delete_aws_account_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.delete_aws_account ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end", "def aws_delete(location, name)\n return Rubyprot::Storage.aws_delete(location, name)\n end", "def delete_account\n @connection.request({\n :method => 'DELETE'\n ...
[ "0.59308857", "0.5892611", "0.58831275", "0.57932127", "0.5784373", "0.5778162", "0.56321305", "0.56297183", "0.56248665", "0.5589259", "0.553677", "0.553342", "0.5531796", "0.5522759", "0.55197334", "0.5509208", "0.54811823", "0.54740644", "0.545485", "0.54435337", "0.543946...
0.60335743
0
Delete a tag filtering entry.
def delete_aws_tag_filter(body, opts = {}) data, _status_code, _headers = delete_aws_tag_filter_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(tag)\n update_tag_file do |tag_array|\n tag_array.delete(tag)\n end\n end", "def delete_tag tag\n delete \"tag/#{tag}\"\n end", "def tag_delete(id, tag)\n wf_event_id?(id)\n wf_string?(tag)\n api.delete([id, 'tag', tag].uri_concat)\n end", "def delete\n ...
[ "0.70068693", "0.68117815", "0.6796048", "0.6678225", "0.6563171", "0.6539221", "0.64891255", "0.6472176", "0.6442226", "0.6336368", "0.63153386", "0.62775636", "0.6262468", "0.6228064", "0.6197479", "0.61576277", "0.6137286", "0.61052", "0.60944116", "0.60693043", "0.6062692...
0.6584082
4
Delete a tag filtering entry. Delete a tag filtering entry.
def delete_aws_tag_filter_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.delete_aws_tag_filter ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aws_tag_filter(body, opts = {})\n data, _status_code, _headers = delete_aws_tag_filter_with_http_info(body, opts)\n data\n end", "def destroy\n if params[:id] != '-1'\n @filter = Filter.find(params[:id])\n else\n @filter = Filter.where( :name => params[:filter][:name], :gr...
[ "0.6234074", "0.6202178", "0.6086482", "0.6078468", "0.6063773", "0.60467243", "0.6046007", "0.6027199", "0.5902681", "0.5873808", "0.5872209", "0.58236724", "0.5766554", "0.57477736", "0.57154316", "0.5708562", "0.5702653", "0.5695504", "0.5666674", "0.5662016", "0.5647058",...
0.5286824
57
List namespace rules. List all namespace rules for a given DatadogAWS integration. This endpoint takes no arguments.
def list_available_aws_namespaces_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.list_available_aws_namespaces ...' end # resource path local_var_path = '/api/v1/integration/aws/available_namespace_rules' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_namespace(regex = '.*')\n pattern = java.util.regex.Pattern.compile(regex)\n list = @admin.listNamespaces\n list.select { |s| pattern.match(s) }\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def list_namespaces request_pb, options = nil\n raise...
[ "0.5652215", "0.5491697", "0.54885113", "0.5424295", "0.5424295", "0.5398871", "0.5214044", "0.5200334", "0.50753504", "0.50517803", "0.4991411", "0.49568725", "0.49560618", "0.48790115", "0.4877557", "0.48734337", "0.48522097", "0.48522097", "0.4851547", "0.4850628", "0.4844...
0.6076401
0
List all AWS integrations.
def list_aws_accounts(opts = {}) data, _status_code, _headers = list_aws_accounts_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_aws_logs_integrations(opts = {})\n data, _status_code, _headers = list_aws_logs_integrations_with_http_info(opts)\n data\n end", "def index\n @cargapp_integrations = CargappIntegration.all\n end", "def gcp_integration_list\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/integra...
[ "0.6939778", "0.6429717", "0.6269341", "0.6227955", "0.6222691", "0.607318", "0.60296285", "0.6017588", "0.5938678", "0.5877256", "0.57682204", "0.56680983", "0.56371486", "0.55936515", "0.55587727", "0.5466361", "0.54657644", "0.54657644", "0.54266", "0.5408848", "0.5407419"...
0.5040626
55
List all AWS integrations. List all DatadogAWS integrations available in your Datadog organization.
def list_aws_accounts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.list_aws_accounts ...' end # resource path local_var_path = '/api/v1/integration/aws' # query parameters query_params = opts[:quer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_aws_logs_integrations(opts = {})\n data, _status_code, _headers = list_aws_logs_integrations_with_http_info(opts)\n data\n end", "def list_aws_logs_integrations_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AWSLogsI...
[ "0.7038211", "0.5964002", "0.56734586", "0.56395674", "0.5489514", "0.5466851", "0.5443757", "0.5392968", "0.5361009", "0.5340299", "0.5163418", "0.5125616", "0.5096511", "0.5070518", "0.49669725", "0.4960771", "0.4956478", "0.49544102", "0.4950043", "0.49484634", "0.49186584...
0.5364879
8
Get all AWS tag filters.
def list_aws_tag_filters(account_id, opts = {}) data, _status_code, _headers = list_aws_tag_filters_with_http_info(account_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters\n mentos(:get_all_filters)\n end", "def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end", "def all\n @filters\n end", "def list_filters\n if @filters.empty?\n fetch_configuration()\n ...
[ "0.7221898", "0.6884524", "0.6883164", "0.68503547", "0.67336226", "0.67336226", "0.6674819", "0.6461367", "0.64597875", "0.64584684", "0.63672096", "0.62880117", "0.628723", "0.6116937", "0.60878843", "0.5988809", "0.59540755", "0.5952507", "0.5952507", "0.5951102", "0.59428...
0.6807209
4
Get all AWS tag filters. Get all AWS tag filters.
def list_aws_tag_filters_with_http_info(account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.list_aws_tag_filters ...' end # verify the required parameter 'account_id' is set if @api_client.config.client_side_validation &...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters\n mentos(:get_all_filters)\n end", "def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end", "def all\n @filters\n end", "def list_filters\n if @filters.empty?\n fetch_configuration()\n ...
[ "0.7104224", "0.68082625", "0.67846143", "0.66911185", "0.66795397", "0.6671004", "0.661037", "0.661037", "0.6347923", "0.6328083", "0.62889034", "0.6282159", "0.6243326", "0.6067481", "0.5903135", "0.58900714", "0.58827955", "0.5866743", "0.5844565", "0.58169264", "0.5807712...
0.50810933
89
Update an AWS integration.
def update_aws_account(body, opts = {}) data, _status_code, _headers = update_aws_account_with_http_info(body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_aws_config\n Aws.config.update({\n access_key_id: @aws_access_key_id,\n secret_access_key: @aws_secret_access_key\n })\n end", "def update\n respond_to do |format|\n if @integration.update(integration_params)\n format.html { redirect_to @integration, notice: 'Integratio...
[ "0.6388482", "0.6382575", "0.626895", "0.62392455", "0.61800814", "0.5943456", "0.5889945", "0.5883807", "0.5862511", "0.5858307", "0.5836641", "0.58077085", "0.5736051", "0.5684885", "0.5684885", "0.5651175", "0.5597441", "0.5588523", "0.5576287", "0.5576287", "0.5554945", ...
0.0
-1
Update an AWS integration. Update a DatadogAmazon Web Services integration.
def update_aws_account_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AWSIntegrationAPI.update_aws_account ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_aws_config\n Aws.config.update({\n access_key_id: @aws_access_key_id,\n secret_access_key: @aws_secret_access_key\n })\n end", "def update\n rid = params['id']\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_t...
[ "0.64414775", "0.57462454", "0.5474182", "0.5351437", "0.53387797", "0.52879167", "0.5258699", "0.5245074", "0.5244667", "0.5235784", "0.5232699", "0.52256554", "0.5178755", "0.5155837", "0.51484495", "0.5140212", "0.5135603", "0.51334864", "0.5115937", "0.5095202", "0.506092...
0.5330255
5
Mounts the document folder of the app with the specified bundle id, otherwise mounts the media folder of a device. Returns the mount point folder.
def mount(bundle_id=nil) app_arg = bundle_id ? "--documents '#{bundle_id}'" : "" mount_point = Dir.mktmpdir("mount-#{self.id}") %x{ifuse #{app_arg} -u #{self.id} #{mount_point}} fail("can't mount ios device #{self.id} at #{mount_point}") unless $?.success? mount_point end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mount(dir, app)\n dir.gsub!(/\\/{2,}/, '/')\n dir.gsub!(/\\/+$/, '')\n @mounts[dir] = app\n end", "def mount_path\n path = settings.mount_path\n path += '/' unless path.end_with?('/')\n path\n end", "def folder(id)\n Box::Folder.new(@api, nil, :id => id)\n ...
[ "0.59376854", "0.5133684", "0.510826", "0.5028326", "0.49024174", "0.4886492", "0.46780816", "0.4653445", "0.46363208", "0.46017775", "0.45806465", "0.457062", "0.4567207", "0.455602", "0.45528674", "0.45475984", "0.45387256", "0.45354748", "0.45323586", "0.4523892", "0.45216...
0.72289306
0
POST /ca_applications POST /ca_applications.json
def create @ca_application = CaApplication.new(application_params) respond_to do |format| if verify_recaptcha(model: @ca_application) && @ca_application.save format.html { redirect_to ca_thanks_path, notice: 'Your Application was successfully submitted.' } format.json { render :show, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @application = Application.new(application_params)\n\n if @application.save\n render json: @application, status: :created, location: api_application_path(@application)\n else\n render json: @application.errors.full_messages.join(', '), status: :unprocessable_entity\n end\n end",...
[ "0.69129014", "0.68301004", "0.678869", "0.67638844", "0.66255933", "0.6589931", "0.65188277", "0.64978105", "0.6479944", "0.64486474", "0.6443399", "0.643857", "0.63967264", "0.63920486", "0.6386825", "0.63832843", "0.63789743", "0.6337044", "0.6333578", "0.6322164", "0.6313...
0.6394671
13
append :remote_ip, :user_agent, :session attributes :name, :email, :created_at
def full_name self.first_name + " " + self.last_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_with_session(params, session)\n super.tap do |user|\n if data = session[\"devise.twitter_data\"] && session[\"devise.twitter_data\"][\"extra\"][\"raw_info\"]\n user.email = data[\"email\"] if user.email.blank?\n elsif data = session[\"devise.google_data\"] && session[\"devise.go...
[ "0.6360995", "0.6266643", "0.61912477", "0.6158958", "0.61372495", "0.6129838", "0.60869485", "0.6082779", "0.60695124", "0.605469", "0.6054528", "0.60498685", "0.60118014", "0.60005534", "0.60005534", "0.60005534", "0.59703946", "0.59663874", "0.596182", "0.59601945", "0.592...
0.0
-1
Store where we are
def store_locations session['prevpage'] = session['thispage'] session['thispage'] = request.request_uri #if session['prevpage'] != nil && session['thispage'] != nil && # session['prevpage'] && session['thispage'] != request.request_uri #session['prevpage'] = session['thispage'] || '' #se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_current_location\n store_location_for(:member, request.url)\n end", "def store_location\n\n\t\t# Stores the requested page in a session symbol return_to\n\t\tsession[:return_to] = request.url\n\tend", "def store_current_location\n store_location_for(:member, request.url)\n end", "def st...
[ "0.6827593", "0.6757026", "0.6730757", "0.66244966", "0.6558801", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.6558158", "0.64982754", "0.64930207", "0.6488572", "0.64759344", "0.64495945", "0.64468193...
0.60884595
80
I N S T A N C E M E T H O D S Create a new instance of the handler with the specified +app_id+, +send_spec+, and +recv_spec+.
def initialize( app_id, send_spec, recv_spec ) # :notnew: super() # To the signal handler mixin @app_id = app_id @conn = Mongrel2::Connection.new( app_id, send_spec, recv_spec ) @reactor = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(app_id = @@DEFAULT_APP_ID, polling_interval = @@DEFAULT_POLLING_TIME, dissemination_type = @@DEFAULT_DISSEMINATOR,\n disseminator_address = @@DEFAULT_DISSEMINATOR_ADDRESS, disseminator_port = @@DEFAULT_DISSEMINATOR_PORT)\n @dissemination_type = dissemination_type\n i...
[ "0.5327776", "0.51155037", "0.5009324", "0.4995052", "0.49575958", "0.4924473", "0.48967725", "0.48282385", "0.48024717", "0.4754855", "0.4728922", "0.4696113", "0.4660949", "0.46515793", "0.4649104", "0.46234214", "0.46234214", "0.4622879", "0.46197668", "0.4611896", "0.4608...
0.6527711
0
Return the Mongrel2::Config::Handler that corresponds to this app's appid, and its connection's send_spec and recv_spec.
def handler_config return self.configured_handlers.where( send_spec: self.conn.sub_addr, recv_spec: self.conn.pub_addr ).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configured_handlers\n\t\treturn Mongrel2::Config::Handler.by_send_ident( self.app_id )\n\tend", "def configured_routes\n\t\thandlers = self.configured_handlers\n\t\treturn Mongrel2::Config::Route.where( target_id: handlers.select(:id) )\n\tend", "def configs\n # Caching here is not necessary or prefer...
[ "0.7689527", "0.57199776", "0.5630106", "0.51662856", "0.5138769", "0.5063547", "0.5005533", "0.50016797", "0.49237946", "0.49216023", "0.4917946", "0.48962998", "0.48499852", "0.48499852", "0.48499852", "0.48453122", "0.48116878", "0.4808378", "0.4800218", "0.4785731", "0.47...
0.782372
0
Return the Mongrel2::Config::Handlers that corresponds to this app's appid.
def configured_handlers return Mongrel2::Config::Handler.by_send_ident( self.app_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler_config\n\t\treturn self.configured_handlers.where(\n\t\t\tsend_spec: self.conn.sub_addr,\n\t\t\trecv_spec: self.conn.pub_addr\n\t\t).first\n\tend", "def configured_routes\n\t\thandlers = self.configured_handlers\n\t\treturn Mongrel2::Config::Route.where( target_id: handlers.select(:id) )\n\tend", "...
[ "0.713591", "0.66115224", "0.64128226", "0.62929535", "0.6087947", "0.60210913", "0.598247", "0.59627414", "0.5958756", "0.58719206", "0.5790904", "0.572151", "0.5716356", "0.5673297", "0.56720376", "0.56381077", "0.56261545", "0.56149656", "0.55576414", "0.5466229", "0.54267...
0.8528256
0
Return the Mongre2::Config::Routes for this Handler.
def configured_routes handlers = self.configured_handlers return Mongrel2::Config::Route.where( target_id: handlers.select(:id) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes\n app_obj.routes\n end", "def routes\n @routes ||= load_routes\n end", "def routes\n Resources::Routes.new(self)\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", "def routes\n @routes ||= []\n end", ...
[ "0.72309345", "0.7107681", "0.7087109", "0.7045328", "0.7045328", "0.68859017", "0.6798424", "0.67468613", "0.6630897", "0.6523135", "0.6354763", "0.6291998", "0.6269215", "0.6240353", "0.62294036", "0.6178062", "0.61115825", "0.605735", "0.59764403", "0.5896329", "0.5893194"...
0.7980679
0
Return the Mongrel2::Config::Hosts that have routes that point to this Handler.
def configured_hosts routes = self.configured_routes return Mongrel2::Config::Host.where( id: routes.select(:host_id) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configured_routes\n\t\thandlers = self.configured_handlers\n\t\treturn Mongrel2::Config::Route.where( target_id: handlers.select(:id) )\n\tend", "def hosts\n @hosts ||= begin\n r, h, u = [], (config[:hosts] rescue nil), (config[:user] rescue nil)\n h.each {|host| r << Host.new(host, u) } i...
[ "0.73438364", "0.67921984", "0.6764092", "0.6673525", "0.66322404", "0.65466756", "0.6441667", "0.6376339", "0.6233982", "0.6227033", "0.6227033", "0.61914665", "0.61851364", "0.61799383", "0.61249614", "0.6103238", "0.6086077", "0.6072789", "0.6051868", "0.60367835", "0.6019...
0.8232725
0
Return the Mongrel2::Config::Servers that have hosts that have routes that point to this Handler.
def configured_servers hosts = self.configured_hosts return Mongrel2::Config::Server.where( id: hosts.select(:server_id) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configured_hosts\n\t\troutes = self.configured_routes\n\t\treturn Mongrel2::Config::Host.where( id: routes.select(:host_id) )\n\tend", "def servers\n configuration.servers\n end", "def configured_routes\n\t\thandlers = self.configured_handlers\n\t\treturn Mongrel2::Config::Route.where( target_id: h...
[ "0.8054214", "0.7076969", "0.70734197", "0.6710074", "0.6709022", "0.6693126", "0.6680049", "0.6525199", "0.65203226", "0.64947575", "0.6466245", "0.6456708", "0.64552194", "0.6442002", "0.64412147", "0.6404529", "0.6380357", "0.6363063", "0.6336509", "0.63268435", "0.6320804...
0.7716611
1
Shut down the handler.
def shutdown self.log.info "Shutting down." self.reactor.stop_polling @conn.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_handler\n # we're just pretending to be a handler\n end", "def cleanup_handler\n end", "def close\n @handler.close if @handler\n @handler = nil\n end", "def shutdown_handler\n self.close unless self.closed?\n @sockets = []\n end", "def off\n @handler.off\n deactiv...
[ "0.71544904", "0.7107713", "0.7066576", "0.7047089", "0.70363796", "0.7020526", "0.6979284", "0.6952278", "0.6931071", "0.6914058", "0.6862466", "0.6850076", "0.680635", "0.67988956", "0.6780739", "0.67624503", "0.6752545", "0.6744693", "0.6737823", "0.67273986", "0.6718087",...
0.63001776
71
Restart the handler. You should override this if you want to reestablish database connections, flush caches, or other restartey stuff.
def restart raise "can't restart: not running" unless self.reactor self.log.info "Restarting" if (( old_conn = @conn )) self.reactor.unregister( old_conn.request_sock ) @conn = @conn.dup self.reactor.register( @conn.request_sock, :read, &self.method(:on_socket_event) ) self.log.debug " conn %p -> %...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart # :nodoc:\n put :restart\n end", "def restart\n client.restart\n end", "def restart\n request('restart')\n end", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def restart!\n start!\n end", "def restart_soon\n...
[ "0.72890586", "0.68365914", "0.6813451", "0.6670073", "0.6569366", "0.64963514", "0.64629215", "0.6454327", "0.64502996", "0.6443261", "0.6400357", "0.63937265", "0.63642544", "0.63049215", "0.62996924", "0.6265286", "0.622938", "0.62258315", "0.6206347", "0.62052095", "0.617...
0.69481504
1
Start a loop, accepting a request and handling it.
def start_accepting_requests self.log.info "Starting the request loop." self.reactor.start_polling( ignore_interrupts: true ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end", "def run!\n start_server!\n loop do\n Thread.start(@proxy_server.accept) do |socket|\n begin\n handle_req...
[ "0.74819785", "0.72117054", "0.7138178", "0.6998388", "0.6919759", "0.69167054", "0.6904854", "0.68307686", "0.6829174", "0.6829157", "0.68138444", "0.68138444", "0.67762417", "0.67699164", "0.6736515", "0.6731819", "0.67202884", "0.6708794", "0.66935724", "0.66486716", "0.66...
0.714658
2
Reactor callback handle an IO event.
def on_socket_event( event ) if event.readable? req = self.conn.receive self.accept_request( req ) elsif event.writable? raise "Request socket became writable?!" else raise "Socket event was neither readable nor writable! (%s)" % [ event ] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_io_event( io, event )\n\t\tcase event\n\n\t\twhen :error\n\t\t\t@server.disconnect_user( self )\n\n\t\twhen :read\n\t\t\tinput = self.read_input\n\t\t\t@server.process_input( self, *input ) unless input.empty?\n\n\t\twhen :write\n\t\t\tbytes_left = self.write_output\n\t\t\t@server.reactor.disable_events...
[ "0.678179", "0.67672026", "0.6756598", "0.62721497", "0.6111452", "0.6104069", "0.60526544", "0.59549487", "0.5779946", "0.5764426", "0.57538646", "0.57457393", "0.57292575", "0.5634582", "0.5628732", "0.5601525", "0.55675054", "0.5481516", "0.54444903", "0.5432098", "0.54087...
0.5208904
38
Read a request from the connection and dispatch it.
def accept_request( req ) self.log.info( req.inspect ) res = self.dispatch_request( req ) if res self.log.info( res.inspect ) @conn.reply( res ) unless @conn.closed? end ensure # Remove any temporarily spooled Mongrel2 files. begin if req && req.body && req.body.respond_to?( :path ) && req.body.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_request( request )\n\t\tif request.is_disconnect?\n\t\t\tself.log.debug \"disconnect!\"\n\t\t\tself.handle_disconnect( request )\n\t\t\treturn nil\n\n\t\telsif request.upload_started?\n\t\t\tself.log.debug \"async upload start!\"\n\t\t\treturn self.handle_async_upload_start( request )\n\n\t\telse\n\t\...
[ "0.7133499", "0.67037374", "0.6407436", "0.6177324", "0.6165483", "0.6097939", "0.60789984", "0.6064566", "0.5983969", "0.5965516", "0.59502494", "0.590128", "0.5896007", "0.58915883", "0.5888695", "0.5880712", "0.5835951", "0.583135", "0.5819939", "0.5819417", "0.57991177", ...
0.0
-1
Invoke a handler method appropriate for the given +request+.
def dispatch_request( request ) if request.is_disconnect? self.log.debug "disconnect!" self.handle_disconnect( request ) return nil elsif request.upload_started? self.log.debug "async upload start!" return self.handle_async_upload_start( request ) else self.log.debug "%s request." % [ request....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(request)\n handler.call(request)\n end", "def handle_request(request)\n if request =~ /^(\\w+)\\s+(.*)\\s+HTTP/ then\n r_type = $1.downcase.to_sym\n path = $2\n log(\"Request: [#{r_type}] '#{path}'\")\n found = false\n value = nil\n @handlers.each do |handler...
[ "0.8067023", "0.7113726", "0.6717124", "0.6626564", "0.6624285", "0.6615018", "0.6548319", "0.64390993", "0.6396771", "0.63277674", "0.6317774", "0.6309415", "0.6302218", "0.6238955", "0.62326163", "0.6229188", "0.6196728", "0.61764765", "0.61624587", "0.6137692", "0.6134959"...
0.6200497
16
Returns a string containing a humanreadable representation of the Handler suitable for debugging.
def inspect return "#<%p:0x%016x conn: %p>" % [ self.class, self.object_id * 2, self.conn, ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler_name\n module_info['HandlerName']\n end", "def inspect\n \"#<#{self.class.name}:##{self.path_name}>\"\n end", "def inspect\n return sprintf(\n \"#<%s:%#0x URI:%s>\",\n self.class.to_s, self.object_id, self.uri.to_s\n )\n end", "def inspect\n sprintf(\"#...
[ "0.6317493", "0.5939254", "0.59356356", "0.5910351", "0.5910351", "0.587406", "0.57954603", "0.57954603", "0.5772351", "0.5757809", "0.57187843", "0.56874186", "0.56874186", "0.5609609", "0.5601561", "0.55829746", "0.5579696", "0.55741835", "0.55734795", "0.5569653", "0.55453...
0.0
-1
:section: Handler Methods These methods are the principle mechanism for defining the functionality of your handler. The logic that dispatches to these methods is all contained in the dispatch_request method, so if you want to do something completely different, you should override that instead. The main handler function...
def handle( request ) self.log.warn "No default handler; responding with '204 No Content'" response = request.response response.status = HTTP::NO_CONTENT return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch_request( request )\n\t\tif request.is_disconnect?\n\t\t\tself.log.debug \"disconnect!\"\n\t\t\tself.handle_disconnect( request )\n\t\t\treturn nil\n\n\t\telsif request.upload_started?\n\t\t\tself.log.debug \"async upload start!\"\n\t\t\treturn self.handle_async_upload_start( request )\n\n\t\telse\n\t\...
[ "0.6762803", "0.6302559", "0.6276549", "0.6264804", "0.6255914", "0.609879", "0.60672486", "0.6018429", "0.599614", "0.59534514", "0.5908573", "0.5858909", "0.58156496", "0.58156496", "0.57905126", "0.57905126", "0.57905126", "0.5765602", "0.5752227", "0.56938255", "0.5645773...
0.7135593
0
Handle an XML message +request+. If not overridden, XML message ('<route') requests are ignored.
def handle_xml( request ) self.log.warn "Unhandled XML message request (%p)" % [ request.headers.pack ] return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_xml(xml)\n doc = REXML::Document.new xml\n @message_identifier = doc.text(\"//imsx_POXRequestHeaderInfo/imsx_messageIdentifier\")\n @lis_result_sourcedid = doc.text(\"//resultRecord/sourcedGUID/sourcedId\")\n\n if REXML::XPath.first(doc, \"//deleteResultRequest\")\n @operatio...
[ "0.53228265", "0.5300478", "0.52255785", "0.51823086", "0.49847826", "0.49515063", "0.494336", "0.48686245", "0.48506767", "0.48483866", "0.48375437", "0.4829615", "0.48221752", "0.48170552", "0.4772857", "0.47653684", "0.47562844", "0.47336653", "0.47020695", "0.46805924", "...
0.7227701
0
Handle a WebSocket frame in +request+. If not overridden, WebSocket connections are closed with a policy error status.
def handle_websocket( request ) self.log.warn "Unhandled WEBSOCKET frame (%p)" % [ request.headers.path ] res = request.response res.make_close_frame( Mongrel2::WebSocket::CLOSE_POLICY_VIOLATION ) self.conn.reply( res ) self.conn.reply_close( request ) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_close(request, event)\n SockJS.debug \"WebSocket#handle_close\"\n # SockJS.debug \"Closing WS connection.\"\n #\n # # If it's the user app who closed\n # # the response, we won't ever get\n # # to pass this point as we'll get\n # # SessionUnavailableError.\...
[ "0.6738894", "0.5890922", "0.5769586", "0.55420303", "0.55187637", "0.54639864", "0.51675546", "0.511652", "0.5110395", "0.5072407", "0.5055357", "0.5031455", "0.49724", "0.49326846", "0.48796186", "0.48753402", "0.4834987", "0.4819851", "0.480637", "0.47505748", "0.47362965"...
0.78438514
0
Handle a WebSocket handshake HTTP +request+. If not overridden, this method drops the connection.
def handle_websocket_handshake( handshake ) self.log.warn "Unhandled WEBSOCKET_HANDSHAKE request (%p)" % [ handshake.headers.path ] self.conn.reply_close( handshake ) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_websocket( request )\n\t\tself.log.warn \"Unhandled WEBSOCKET frame (%p)\" % [ request.headers.path ]\n\t\tres = request.response\n\t\tres.make_close_frame( Mongrel2::WebSocket::CLOSE_POLICY_VIOLATION )\n\n\t\tself.conn.reply( res )\n\t\tself.conn.reply_close( request )\n\n\t\treturn nil\n\tend", "def...
[ "0.7879569", "0.7382293", "0.6514655", "0.62699693", "0.616007", "0.59759015", "0.5929793", "0.56858474", "0.5451998", "0.5283425", "0.5266464", "0.5245252", "0.5197201", "0.5107117", "0.50907034", "0.5077021", "0.50725675", "0.5043511", "0.49874187", "0.49856538", "0.4973124...
0.7240931
2
Handle a disconnect notice from Mongrel2 via the given +request+. Its return value is ignored.
def handle_disconnect( request ) self.log.info "Connection %p closed." % [ request.conn_id ] return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_disconnect *args\n args.each do |c|\n host, port = *c.split(\":\")\n conn = @node.connections.select{|c| c.host == host && c.port == port.to_i}.first\n conn.close_connection if conn\n end\n {:state => \"Disconnected\"}\n end", "def on_disconnect_event(ctx)\n carterdte_lo...
[ "0.62822723", "0.61070174", "0.6085644", "0.6022475", "0.5902436", "0.5733757", "0.57206583", "0.57040334", "0.56356186", "0.56172097", "0.5608463", "0.55727506", "0.5563647", "0.5562641", "0.5556709", "0.55369484", "0.55294675", "0.5529306", "0.5501561", "0.5499576", "0.5495...
0.8139022
0
Handle an asynchronous upload start notification. These are sent to notify the handler that a request that exceeds the server's limits.content_length has been received. The default implementation cancels any such uploads by replying with an empty string. If the request should be accepted, your handler should override t...
def handle_async_upload_start( request ) explanation = <<~END_MESSAGE % [ request.content_length ] If you wish to handle requests like this, either set your server's 'limits.content_length' setting to a higher value than %d, or override #handle_async_upload_start. END_MESSAGE self.log.warn "Async upload fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_async_upload_start( request )\n\t\tstatus_info = { :status => HTTP::REQUEST_ENTITY_TOO_LARGE, :message => 'Request too large.' }\n\t\tresponse = self.prepare_status_response( request, status_info )\n\t\tresponse.headers.connection = 'close'\n\t\tself.conn.reply( response )\n\n\t\texplanation = <<~END_OF...
[ "0.7961751", "0.7149755", "0.60906756", "0.59206045", "0.5908507", "0.59077454", "0.58849883", "0.5611974", "0.5444265", "0.5437198", "0.5427677", "0.5380684", "0.5376082", "0.53092426", "0.5300494", "0.527331", "0.524742", "0.5221227", "0.5187812", "0.51541", "0.51482576", ...
0.8127947
0
:section: Signal Handling These methods set up some behavior for starting, restarting, and stopping your application when a signal is received. If you don't want signals to be handled, override handle_signal with an empty method. Handle signals.
def handle_signal( sig ) self.log.debug "Handling signal %s" % [ sig ] case sig when :INT, :TERM self.on_termination_signal( sig ) when :HUP self.on_hangup_signal( sig ) when :USR1 self.on_user1_signal( sig ) else self.log.warn "Unhandled signal %s" % [ sig ] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_signal( signal )\n\t\tself.log.info \"Handling %p signal.\" % [ signal ]\n\t\tcase signal\n\t\twhen :INT, :TERM, :HUP\n\t\t\tself.stop\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def handle_signal(sig)\n case sig\n when :TERM\n handle_term_signal\n when :INT\n handle_interrupt\n wh...
[ "0.7768665", "0.70107794", "0.6939109", "0.6935331", "0.67405945", "0.6642953", "0.6617715", "0.6574924", "0.65207344", "0.6509606", "0.6509606", "0.64770085", "0.6455471", "0.64466625", "0.64384305", "0.6428185", "0.642071", "0.64178866", "0.63813245", "0.6377409", "0.636909...
0.7039044
1
Handle a TERM signal. Shuts the handler down after handling any current request/s. Also aliased to on_interrupt_signal.
def on_termination_signal( signo ) self.log.warn "Terminated (%p)" % [ signo ] self.shutdown end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end", "def term_process_request(cgi)\n install_signal_handler('TERM',method(:busy_exit_handler).to_proc)\n Dispatcher.dispatch(cgi)\n rescue Exception => e # errors from CGI dispatch\n raise if SignalExceptio...
[ "0.7234045", "0.70624846", "0.69319946", "0.6912255", "0.68541193", "0.6827756", "0.67630816", "0.66949767", "0.6665994", "0.6662437", "0.6660055", "0.66540384", "0.66540384", "0.6564434", "0.65386605", "0.65150934", "0.6510807", "0.64757615", "0.6472532", "0.6469282", "0.642...
0.5565613
59
Handle a HUP signal. The default is to restart the handler.
def on_hangup_signal( signo ) self.log.warn "Hangup (%p)" % [ signo ] self.restart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_hangup\n system \"SIGHUP received, starting shutdown\"\n @shutdown = true\n end", "def processSignals\n if $hupped\n configuration = GlobalConfiguration::GlobalConfig.instance\n Logging.logger.info 'HUP receieved; refreshing configuration'\n configuration.refresh\n Loggin...
[ "0.7694347", "0.68502146", "0.64890456", "0.6224513", "0.6135551", "0.6075427", "0.60176295", "0.5957967", "0.59469676", "0.5903438", "0.5890039", "0.58843285", "0.5854295", "0.5833954", "0.57748705", "0.57581395", "0.5757861", "0.5561389", "0.5553313", "0.553575", "0.5443277...
0.65977424
2
Handle a USR1 signal. Writes a message to the log by default.
def on_user1_signal( signo ) self.log.info "Checkpoint: User signal." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_signal(signal_name)\n if signal_name == 'TERM'\n if @shutdown\n logger.info \"TERM received again, exiting immediately\"\n Process.exit(1)\n else\n logger.info \"TERM received, starting graceful shutdown\"\n graceful_shutdown\n end\n el...
[ "0.6067294", "0.60455006", "0.5881541", "0.57357657", "0.5729551", "0.5483523", "0.5460171", "0.5402663", "0.5373171", "0.5373171", "0.53370976", "0.5263559", "0.52017236", "0.5168034", "0.5163502", "0.5144774", "0.50673586", "0.5065847", "0.50467896", "0.50274295", "0.502687...
0.595787
2