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
GET /volunteer_jobs/1 GET /volunteer_jobs/1.json
def show @volunteer_job = VolunteerJob.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @volunteer_job } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @volunteer_jobs = VolunteerJob.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @volunteer_jobs }\n end\n end", "def new\n @volunteer_job = VolunteerJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.j...
[ "0.76611525", "0.69956744", "0.6941505", "0.68474334", "0.68314624", "0.66359216", "0.66268396", "0.6617462", "0.6593418", "0.65677124", "0.65677124", "0.65474856", "0.6513014", "0.6513014", "0.6513014", "0.6513014", "0.6513014", "0.6486095", "0.6486095", "0.64708775", "0.644...
0.7560687
1
GET /volunteer_jobs/new GET /volunteer_jobs/new.json
def new @volunteer_job = VolunteerJob.new respond_to do |format| format.html # new.html.erb format.json { render json: @volunteer_job } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n end", "def new\n @job = @user.jobs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @job }\n end\n en...
[ "0.7913525", "0.7913525", "0.7703204", "0.7570831", "0.7570831", "0.7570831", "0.7570831", "0.7556856", "0.72684777", "0.7255133", "0.7225403", "0.71859294", "0.7168041", "0.71634156", "0.7136533", "0.7133316", "0.7110318", "0.70895237", "0.7084016", "0.7082202", "0.70697623"...
0.815024
0
POST /volunteer_jobs POST /volunteer_jobs.json
def create @volunteer_job = VolunteerJob.new(params[:volunteer_job]) respond_to do |format| if @volunteer_job.save format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully created.' } format.json { render json: @volunteer_job, status: :created, location: @voluntee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job = Job.new(job_params)\n @job.user = current_user\n if @job.save\n render json: { redirect_url: job_url(@job), notice: \"Thanks for posting! Your job is now pending review.\" }\n else\n render json: @job.errors\n end\n end", "def create\n @job = current_user.posted_j...
[ "0.6663876", "0.66525453", "0.66429484", "0.64768344", "0.62916523", "0.6247854", "0.6214603", "0.6212004", "0.619421", "0.6176091", "0.61703014", "0.61641085", "0.6156818", "0.61516213", "0.61468", "0.61285746", "0.61042786", "0.6103418", "0.60971755", "0.6088171", "0.607151...
0.7408671
0
PUT /volunteer_jobs/1 PUT /volunteer_jobs/1.json
def update @volunteer_job = VolunteerJob.find(params[:id]) respond_to do |format| if @volunteer_job.update_attributes(params[:volunteer_job]) format.html { redirect_to @volunteer_job, notice: 'Volunteer job was successfully updated.' } format.json { head :ok } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n @job = current_member.jobs.find(params[:id])\n\n respond_to do |format|\n if @job.update_attributes(job_params)\n format.html { redirect_to @job, notice: 'The stuff you want done was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.6560337", "0.64914775", "0.6477605", "0.6461418", "0.64592385", "0.6419217", "0.64160067", "0.63072014", "0.6305497", "0.6254279", "0.6240452", "0.6240452", "0.6240452", "0.6229798", "0.62066555", "0.6196746", "0.6191166", "0.61800814", "0.61780137", "0.61745924", "0.61714...
0.73060834
0
DELETE /volunteer_jobs/1 DELETE /volunteer_jobs/1.json
def destroy @volunteer_job = VolunteerJob.find(params[:id]) @volunteer_job.destroy respond_to do |format| format.html { redirect_to volunteer_jobs_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @job = current_member.jobs.find(params[:id])\n @job.destroy\n\n respond_to do |format|\n format.html { redirect_to jobs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @launched_job.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.73790056", "0.731788", "0.72712225", "0.7236911", "0.723433", "0.7217059", "0.7217059", "0.7217059", "0.7217059", "0.7216241", "0.7206061", "0.72037226", "0.71646094", "0.7151036", "0.7148282", "0.71481603", "0.71276057", "0.71104103", "0.7098183", "0.7084551", "0.7064156"...
0.7925121
0
Operation sperformed in FleetServiceRequest_FromDashboard script 1. User Login to application with valid credentials 2. User searches for a vehicle with unit and verifies the search results 3. Searches for a service location and verifies that the search results were displayed correctly 4. Creates service request for th...
def test_FleetRequest_FromSearchPage # Navigate to the volvo demo site @driver.get $env #1. Login to the application Login($uname, $pwd, "1.0") #2. Perform vehicle search with unit# and verify the search results VehicleSearchWithUnit_No("222", "2") #3. Perform service locat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Create_Service_Request(vehicle_no, complaint, note, contact_no, driver_name, driver_no, breakdown_location, breakdown_city, breakdown_state, testcase_no)\n service_location = @driver.find_element(:xpath, ServiceRequestFirstServiceLocationName_ID).text\n @driver.find_element(:link, ServiceRequest_Link).cl...
[ "0.61050284", "0.5806033", "0.56173456", "0.56028545", "0.55190384", "0.5496412", "0.549361", "0.54885507", "0.5469782", "0.54364914", "0.5392818", "0.53517014", "0.5344022", "0.5341496", "0.5334074", "0.5325288", "0.5321312", "0.53206015", "0.52957875", "0.5285835", "0.52793...
0.7215682
0
Add an array of directories to be filtered
def add_dir_filter(filter) @filter_dir = filter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_directories(modified_files); end", "def search(*dirs)\n Options[:custom_dir] += dirs\n nil\n end", "def search_external(dirs)\n Options[:external_dir] += dirs\n nil\n end", "def in_dirs(dirs_a)\n @dirs += dirs_a\n self\n end", "def appendGlobs(arr, patterns...
[ "0.73130506", "0.6819871", "0.6714459", "0.6669661", "0.66258055", "0.65835506", "0.65315974", "0.64896685", "0.64550304", "0.6369237", "0.6250286", "0.6219849", "0.6190459", "0.61829334", "0.6176399", "0.6150504", "0.6135181", "0.61058706", "0.60512465", "0.60487396", "0.604...
0.66336024
5
Add an array of file that don't belong to the list
def add_file_filter(file_filter) @filter_file = file_filter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_files filearray, config={}\n filearray.each do |e| add_content(e, config.dup); end\n end", "def excluded_files() = []", "def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end", "def add_datafiles(datafiles)\n...
[ "0.6505878", "0.64405656", "0.63403255", "0.6202675", "0.6177072", "0.617306", "0.61687225", "0.6141138", "0.6095605", "0.60881835", "0.60870177", "0.6063705", "0.6063705", "0.6024314", "0.60200024", "0.60032105", "0.5999055", "0.59978247", "0.59972477", "0.5987395", "0.59625...
0.0
-1
Scan a root dir and list all files. Exclude filtered directory
def scan_dir (dirname) log "*** Inspect: " + dirname Dir.foreach(dirname) do |filename| path_cand = File.join(dirname , filename) if File.directory?(path_cand) #exams directories if (filename != "." && filename != "..") unless @filter_dir.index(filename) #direct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_files_in_directory dir\n files = Dir.glob File.join(dir, \"*\")\n\n normalized_file_list files, false, @options.exclude\n end", "def get_filelist(root_path)\n array = Dir[root_path+'**/*'].reject {|fn| File.directory?(fn) }\nend", "def scan\n results = []\n dirs.each do |dir|\n file...
[ "0.74646044", "0.7428158", "0.7200932", "0.71115106", "0.7060374", "0.70054036", "0.6957089", "0.6934524", "0.69087696", "0.69009435", "0.67964023", "0.6771534", "0.6763491", "0.67522866", "0.674859", "0.6719598", "0.6716525", "0.6701915", "0.6701915", "0.669391", "0.66651946...
0.7056008
5
Check if a file belongs to a filtered list
def file_is_filtered?(path_cand) filename = File.basename(path_cand) ix = @filter_file.index(filename) if ix log "FILTER: #{path_cand}" return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_a_list?(file)\n !!(file =~ /list$/)\n end", "def include?(file)\n @file_list.include?(file.basename)\n end", "def contain?(*files)\n files.all? { |file| entries.detect { |entry| File.fnmatch(file, entry.to_s) } }\n end", "def contain?(filename); end", "def file_is_fil...
[ "0.6734807", "0.6655667", "0.6525753", "0.6483904", "0.64350283", "0.6399568", "0.63880754", "0.62969625", "0.62524265", "0.621504", "0.61851245", "0.6160544", "0.61192656", "0.61191905", "0.6102729", "0.6097756", "0.60534346", "0.6006311", "0.59216404", "0.59093404", "0.5908...
0.67684704
0
Write the list into a file
def write_filelist(out_file_list) result_list.each{|f| log f} File.open(out_file_list, "w") do |file| result_list.each do |item| file << item file << "\n" end log "File list created #{out_file_list}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_list_to_file(filename, data)\n file = File.open(filename, \"w\")\n data.each do |d|\n file.write(d.to_s + \"\\n\")\n end\n file.close unless file.nil?\nend", "def write_out_list list, list_path\n output = File.new list_path, \"w\"\n if list.class == Array\n list.each do\n |app|\n ...
[ "0.8281509", "0.79498315", "0.79219097", "0.76788014", "0.75117344", "0.7129831", "0.69405466", "0.69066125", "0.6899505", "0.6882944", "0.67773116", "0.67561984", "0.67543817", "0.6713939", "0.6713939", "0.670313", "0.6697622", "0.6607773", "0.65932256", "0.6590207", "0.6575...
0.7883456
4
Use callbacks to share common setup or constraints between actions.
def set_game_record @game_record = GameRecord.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def game_record_params params.require(:game_record).permit(:json_state) 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
Add the parameters in hash +new+ to already existing parameters. If +new+ contains a parameter with an already existing name, the old definition is clobbered.
def add_params(new) # We do not check for duplication on purpose: multiple calls # to add_params should be cumulative new.each { |p| @params[p.name] = p } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def additional_parameters= new_additional_parameters\n if new_additional_parameters.respond_to? :to_hash\n @additional_parameters = new_additional_parameters.to_hash\n else\n raise TypeError,\n \"Expected Hash, got #{new_additional_parameters.class}.\"\n end\n ...
[ "0.6497428", "0.6486421", "0.62861806", "0.6204003", "0.61893255", "0.6016598", "0.5961347", "0.59476674", "0.5939137", "0.59138423", "0.5851895", "0.5793666", "0.5731276", "0.57029235", "0.5689811", "0.56885016", "0.56885016", "0.56833327", "0.56726336", "0.5662137", "0.5584...
0.81937987
0
the MIPS program allows for Pick Your Pace (PYP) reporting periods, where the length can be anywhere between 1 day and a year of data
def validate_pyp_measurement_period rp_start_date, rp_end_date = formatted_start_and_end(@rp_start, @rp_end) mp_start_date, mp_end_date = formatted_start_and_end(@program_year + '0101', @program_year + '1231') unless rp_end_date >= rp_start_date msg = 'Reported Measurement Period shoul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def period; end", "def period; end", "def period; end", "def nb_year(p0, percent, aug, p)\n year_count = 0\n until p0 >= p do\n p0 += (p0 * (percent/100.to_f)) + aug\n year_count += 1\n # binding.pry\n end\n year_count\n # binding.pry\nend", "def create_time_periods(time_period_length = MSecP...
[ "0.62908304", "0.62908304", "0.62908304", "0.57485765", "0.57187915", "0.5684704", "0.56326306", "0.55131984", "0.5511566", "0.54998416", "0.5480591", "0.54379624", "0.54090905", "0.529574", "0.52821976", "0.5277444", "0.5227684", "0.5225939", "0.5225685", "0.5224434", "0.520...
0.56660116
6
The last relevant timestamp for this execution
def last_status_at finished_at || performed_at || scheduled_at || created_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_time\n @last_time\n end", "def last_update\n Time.parse(@record.SystemModstamp)\n end", "def last_entry_time\n last_entry = db.last_entry_temp.flatten.first\n last_entry ? Time.at(last_entry) : nil\n end", "def last_updated_time\n data[:last_updated_time]\n e...
[ "0.7631196", "0.76182085", "0.7371142", "0.7368897", "0.73407173", "0.73407173", "0.73407173", "0.73407173", "0.73382807", "0.73382807", "0.73382807", "0.73382807", "0.7310912", "0.72876424", "0.7286505", "0.72355133", "0.72127116", "0.71549094", "0.71409637", "0.71202177", "...
0.0
-1
This method protected by webauth as configured in apache We should only get here after a user has succesfully authenticated
def webauth user = EemsUser.load_from_session(session) Rails.logger.info("Session user_id is: " << user.sunetid) redirect_to params[:referrer] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_custom_authentication; end", "def auth\n end", "def auth\n end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end", "def ensure_authenticated_user\r\n head :unauthorized unless ...
[ "0.7236334", "0.7130012", "0.7130012", "0.7083641", "0.7081848", "0.6957926", "0.6937513", "0.6937438", "0.6927555", "0.6908858", "0.68438727", "0.68430203", "0.68402255", "0.68375343", "0.68286216", "0.68250597", "0.6818265", "0.6799846", "0.6799846", "0.6795586", "0.6763823...
0.0
-1
Get the latest version of a pass.
def show @pass = Passbook::Pass.where(pass_type_identifier: params[:pass_type_identifier], serial_number: params[:serial_number]).first head :not_found and return if @pass.nil? head :unauthorized and return if request.env['HTTP_AUTHORIZATION'] != "ApplePass #{@pass.authentication_token}" # suck in exa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_latest_version(opts)\n raise NotImplementedError\n end", "def latest_version\n self.versions.order(\"revision_date DESC\").first\n end", "def latest_version\n\t\treturn versions.order(\"number DESC\").last\n\tend", "def latest_version\n @latest_version ||= with_cache(file_name) { n...
[ "0.671764", "0.650528", "0.64959425", "0.6470868", "0.6443513", "0.6377232", "0.6360806", "0.63570404", "0.63047355", "0.6294612", "0.62778306", "0.6262437", "0.6201792", "0.6187061", "0.61865026", "0.6173284", "0.61623853", "0.613487", "0.61127985", "0.6087318", "0.60806066"...
0.0
-1
Cybersource can change the fields it sends back at any time. It will always sign some fields, but may elect to sign all of them, in which case unsigned_field_names will be nil.
def initialize(fields) @fields = fields @signed_fields = fields['signed_field_names'].split(',') @unsigned_fields = fields['unsigned_field_names']&.split(',') || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsigned_field_names\n @unsigned_fields.join(',')\n end", "def signed_field_names\n @signed_fields.join(',')\n end", "def unsigned_data\n @unsigned_data ||= @unsigned_fields.index_with { |field| send(field) }\n end", "def signed_data\n @signed_data = @signed_fields.index_with...
[ "0.7018839", "0.6796034", "0.64417994", "0.5854818", "0.56923896", "0.56748366", "0.56486195", "0.56321037", "0.5581592", "0.5436769", "0.5436769", "0.54333484", "0.5428445", "0.5428445", "0.5427422", "0.535377", "0.53443146", "0.53436655", "0.5317817", "0.5317817", "0.524723...
0.6581715
2
If the payment was successful, Cybersource will send us back a decision of 'ACCEPT'
def payment_success? @fields['decision'] == 'ACCEPT' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_payment\n\n raise 'invalid credit card' unless @credit_card && @credit_card.valid?\n \n gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(\n :login => LOGIN_ID,\n :password => TRANSACTION_KEY\n )\n\n description = \"Concerts in the Clearing\"\n if reservation\n ...
[ "0.74086607", "0.72222143", "0.7098679", "0.7033425", "0.7023301", "0.69044137", "0.6863167", "0.6825858", "0.68253314", "0.67931986", "0.67634225", "0.67404664", "0.67167795", "0.6715788", "0.6700185", "0.6697306", "0.669595", "0.66837645", "0.6673283", "0.6665256", "0.66596...
0.79905957
0
Raise an error if the payment failed or if the signature is invalid
def validate! Cybersource::Security.validate_signature!(@fields['signature'], signed_data) raise PaymentFailed unless payment_success? self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_signature!(signature, data)\n raise InvalidSignature unless valid_signature?(signature, data)\n end", "def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, p...
[ "0.6430708", "0.6408499", "0.63765335", "0.63765335", "0.6338833", "0.6285269", "0.62163", "0.6173898", "0.6156996", "0.6156", "0.6154337", "0.6149765", "0.6119123", "0.60408264", "0.6018457", "0.6007543", "0.59854454", "0.5972589", "0.5922325", "0.59147686", "0.58895326", ...
0.75968474
0
Hash of signed fields and their values
def signed_data @signed_data = @signed_fields.index_with { |field| @fields[field] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_h\n signed_data.merge(unsigned_data).merge(signature: @signature)\n end", "def hash\n [anchor, cv, nullifier, proof, rk, spend_auth_sig].hash\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def signed_field_names\n @signed_fields.join(',')\n en...
[ "0.67283434", "0.67041343", "0.6450154", "0.6276829", "0.61109936", "0.6097372", "0.60829777", "0.60829777", "0.60829777", "0.605123", "0.605123", "0.605123", "0.605123", "0.605123", "0.605123", "0.605123", "0.6038538", "0.59944695", "0.59941167", "0.598233", "0.597803", "0...
0.62704587
4
apply_math = lambda do |auth, , nom| a.send(fn, b) end add = apply_math.curry.(:+) subtract = apply_math.curry.(:) multiply = apply_math.curry.(:) divide = apply_math.curry.(:/)
def set_dep(requested_version, whitelisted_repo_key, sha) if requested_version.include?("git+ssh") # Preserve URL return "#{ requested_version.split("#").first }##{ sha }" else return "#{ whitelisted_repo_key }##{ sha }" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_math(fn, a, b)\n a.send(fn, b)\nend", "def do_math(a, b, &operation)\n math(a, b, &operation)\nend", "def do_math(a, b, &operation)\n math(a, b, &operation)\nend", "def reformat_math_functions\n funcs = %w(min max sum avg count round rounddown roundup sin cos tan)\n regex = /\\b(?<func>#{f...
[ "0.8413004", "0.7475554", "0.7475554", "0.7047362", "0.704581", "0.70108545", "0.68217874", "0.68217874", "0.6734189", "0.6552945", "0.6542543", "0.65246713", "0.65212643", "0.65212643", "0.64313614", "0.6421027", "0.64134765", "0.6411408", "0.64088756", "0.6345428", "0.63273...
0.0
-1
Find first name of season winner based on input season
def get_first_name_of_season_winner(data, season) data[season].each do |person| return person["name"].split.first if person["status"] == "Winner" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_name_of_season_winner(data, season)\n winner = match_contestant(data[season], 'status', 'Winner')\n winner['name'].split[0]\nend", "def get_first_name_of_season_winner(data, season)\n data.each do |season_iteration, stats|\n if season_iteration == season\n stats.find do |winner|\n ...
[ "0.8681817", "0.84333616", "0.81460685", "0.7613619", "0.7498108", "0.7057714", "0.6980325", "0.680163", "0.6795181", "0.6747833", "0.66798264", "0.6675403", "0.6652819", "0.6644478", "0.6624598", "0.66100943", "0.6584078", "0.6581036", "0.657249", "0.6526452", "0.6497361", ...
0.8102584
3
Find contestant name based on input occupation
def get_contestant_name(data, occupation) data.each do |season, person| person.each do |person_data| return person_data["name"] if person_data["occupation"] == occupation end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_contestant_name(data, occupation)\n name = ''\n data.each do |season, contestants|\n name = contestants.find{|contestant| contestant['occupation'] == occupation}\n break if name != nil\n end\n name['name']\nend", "def get_contestant_name(data, occupation)\n data.values.each do |info_hash|\n \...
[ "0.7461412", "0.738937", "0.7361984", "0.7361621", "0.7356785", "0.7306048", "0.7176409", "0.7115286", "0.6723948", "0.66518277", "0.6419855", "0.62739056", "0.6238787", "0.6221232", "0.61621815", "0.61202973", "0.60693085", "0.59959817", "0.5975323", "0.59506005", "0.5942683...
0.7050208
8
Count how many contestants are from input hometown
def count_contestants_by_hometown(data, hometown) counter = 0 data.each do |season, person| person.each do |person_data| if person_data["hometown"] == hometown counter += 1 end end end counter end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_contestants_by_hometown(data, hometown)\n home_town = 0\n data.each do |season_iteration, stats|\n stats.each do |town|\n if town[\"hometown\"] == hometown\n home_town = home_town + 1\n end\n end\n end\n return home_town\nend", "def count_contestants_by_hometown(data, hometow...
[ "0.8026931", "0.77691", "0.7758352", "0.7691321", "0.76443857", "0.7280335", "0.69500345", "0.6517222", "0.6447328", "0.6411697", "0.6328612", "0.6262608", "0.62113726", "0.6187981", "0.61532813", "0.608977", "0.6070199", "0.6069902", "0.6063244", "0.60341066", "0.6023619", ...
0.7660978
4
Return occupation of first contestant from input hometown
def get_occupation(data, hometown) data.each do |season, person| person.each do |person_data| return person_data["occupation"] if person_data["hometown"] == hometown end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_occupation(data, hometown)\n data.each do |season_iteration, stats|\n stats.find do |town|\n if town[\"hometown\"] == hometown\n return town[\"occupation\"]\n end\n end\n end\nend", "def get_occupation(data, hometown)\n answer_occupation = \"\"\n data.each do |season_key, seaso...
[ "0.7019546", "0.69879013", "0.69306415", "0.68491197", "0.6650426", "0.64281327", "0.6312058", "0.61251324", "0.6032048", "0.6011277", "0.6010173", "0.5993094", "0.5894584", "0.5874441", "0.5833567", "0.58040065", "0.5801466", "0.5792839", "0.5789694", "0.57693154", "0.576856...
0.6608789
5
Calculate average age of contestants for input season
def get_average_age_for_season(data, season) age_array = [] average = 0 # Get ages data[season].each do |person| age_array << person["age"].to_f end # Average and round ages average = (age_array.sum / age_array.length).round end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_age_for_season(data, season)\n age_total = 0\n num_of_contestants = 0\n data[season].each do |contestant_hash|\n age_total += (contestant_hash[\"age\"]).to_i\n num_of_contestants += 1\n end\n (age_total / num_of_contestants.to_f).round(0)\nend", "def get_average_age_for_season(data, se...
[ "0.8263068", "0.8200316", "0.8085558", "0.79431593", "0.79250884", "0.78881764", "0.78426534", "0.7832749", "0.664634", "0.6447128", "0.62634516", "0.6200202", "0.6125933", "0.60973257", "0.60751", "0.59637153", "0.59472746", "0.5899647", "0.58985466", "0.5864248", "0.5836199...
0.77777225
8
Add server name and server aliases to trusted_domains config option.
def calculate_trusted_domains unless owncloud_cookbook_config.key?('trusted_domains') owncloud_cookbook_config['trusted_domains'] = [] end owncloud_trusted_domains.each do |domain| next if owncloud_cookbook_config['trusted_domains'].include?(domain) owncloud_cookbook_config['tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owncloud_trusted_domains\n [\n node['owncloud']['server_name'], node['owncloud']['server_aliases']\n ].flatten\n end", "def site_domain_aliases\n options[:aliases]\n end", "def config_domain(domain, *_args)\n domain ||= ''\n domain.downcase!\n config[:domain]....
[ "0.6924529", "0.6471918", "0.63489705", "0.62475896", "0.6213212", "0.61195713", "0.6104124", "0.60031664", "0.594991", "0.59282786", "0.585587", "0.57841706", "0.574766", "0.5729557", "0.57262725", "0.56988525", "0.5694284", "0.5689086", "0.5687022", "0.5672427", "0.56654143...
0.63033116
4
Store important options that where generated automatically by the setup.
def save_owncloud_node_configuration return if Chef::Config[:solo] %w(passwordsalt instanceid).each do |value| node.set_unless['owncloud']['config'][value] = owncloud_config[value] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def option_set\n @options ||= {}\n end", "def options\n @_options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def optio...
[ "0.7412177", "0.73908347", "0.73651415", "0.73651415", "0.73651415", "0.7287272", "0.7287272", "0.7287272", "0.7284486", "0.7274737", "0.7274737", "0.7233832", "0.71399313", "0.7066131", "0.7060623", "0.70542496", "0.70331264", "0.6980039", "0.69444305", "0.6943425", "0.69228...
0.0
-1
buscar un elemento del arreglo
def buscar(elem) @v.each_with_index do |elemento,index| if elemento == elem puts "el elemento buscado es[#{index}]: #{elemento}" return index elsif(elemento != elem) && (index+1 ==@v.length) puts "el elemento no existe" ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtrarObstaculos(cad)\n aux=[]\n cad.each do |elemento|\n if (elemento[0] == \"O\")\n aux.push(stringObstaculos(elemento))\n end\n end\n return aux #[[\"O\",3,2],......]\nend", "def elemento\n \n @elemento\n end", "def index elemento\n end", "def ...
[ "0.58750224", "0.5745054", "0.57344645", "0.57216746", "0.56736904", "0.56736904", "0.56736904", "0.56204593", "0.55560976", "0.5454719", "0.541998", "0.5394053", "0.5387245", "0.5375371", "0.5352945", "0.5330655", "0.5330292", "0.53233975", "0.52790415", "0.52496713", "0.524...
0.47850877
58
GET /friends GET /friends.json
def index @friends = Friend.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(options={})\n get('/friends', options)\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end", "def index\n @user = current_user\n render json: @user....
[ "0.8286829", "0.8281937", "0.7791277", "0.76856893", "0.761735", "0.755928", "0.7552669", "0.7451954", "0.7444342", "0.74003625", "0.7363718", "0.7330685", "0.7292527", "0.7291051", "0.72801137", "0.7239079", "0.7212772", "0.71365535", "0.7106033", "0.7088684", "0.7051569", ...
0.6578425
64
GET /friends/1 GET /friends/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(options={})\n get('/friends', options)\n end", "def index\n @user = current_user\n render json: @user.friends\n end", "def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list')....
[ "0.76709884", "0.7604071", "0.7600863", "0.74548936", "0.7365434", "0.73384774", "0.73283494", "0.73141056", "0.73036456", "0.7235156", "0.7219719", "0.7216787", "0.7163809", "0.7131452", "0.70871836", "0.70085126", "0.69397676", "0.6919202", "0.6908836", "0.69050354", "0.690...
0.0
-1
POST /friends POST /friends.json
def create @friend = Friend.new(friend_params) respond_to do |format| if @friend.save format.html { redirect_to @friend, notice: 'Friend was successfully created.' } format.json { render :show, status: :created, location: @friend } else format.html { render :new } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend\n @user.friendships.build(friend_id: @friend.id)\n if @user.save\n render json: { success: true }\n else\n render json: {message: @user.errors&.messages || 'Unable add as friend, please try again'}, status: 202\n end\n end", "def add_friend\n\n current_user.friends_list.push...
[ "0.6929615", "0.68731165", "0.6859937", "0.6829343", "0.6796485", "0.67732674", "0.67154217", "0.6699764", "0.6698836", "0.66881865", "0.66756314", "0.6651872", "0.6623602", "0.65965533", "0.659456", "0.65587676", "0.6517505", "0.64976156", "0.64935964", "0.6487597", "0.64424...
0.6607566
14
PATCH/PUT /friends/1 PATCH/PUT /friends/1.json
def update respond_to do |format| if @friend.update(friend_params) format.html { redirect_to @friend, notice: 'Friend was successfully updated.' } format.json { render :show, status: :ok, location: @friend } else format.html { render :edit } format.json { render json: @fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @friend = Friend.find(params[:id])\n @friend.update_attributes(params[:friend])\n respond_with(@friend)\n end", "def update\n respond_to do |format|\n if @friends1.update(friends1_params)\n format.html { redirect_to @friends1, notice: \"Friend was successfully updated.\" }\n...
[ "0.70481896", "0.6986432", "0.6935317", "0.6902273", "0.6822468", "0.6814806", "0.6807529", "0.67891", "0.67784184", "0.67784184", "0.6747414", "0.6687124", "0.6604577", "0.65962934", "0.65909934", "0.656802", "0.65586656", "0.65549", "0.6541707", "0.6504213", "0.6491169", ...
0.68051034
11
DELETE /friends/1 DELETE /friends/1.json
def destroy @friend.destroy respond_to do |format| format.html { redirect_to friends_url, notice: 'Friend was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @friend.destroy\n render json: {}\n end", "def destroy\n @friends1.destroy\n respond_to do |format|\n format.html { redirect_to friends1s_url, notice: \"Friend was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_friend\n \t#frie...
[ "0.7691599", "0.75931704", "0.75873077", "0.7571173", "0.7550969", "0.7543615", "0.7465354", "0.7443408", "0.74411154", "0.7433912", "0.7416204", "0.740303", "0.73697317", "0.73512363", "0.7309405", "0.7300287", "0.72991866", "0.7290266", "0.7290266", "0.7278264", "0.7260282"...
0.7291574
18
Use callbacks to share common setup or constraints between actions.
def set_friend @friend = Friend.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 friend_params params[:friend] 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
wrap the get input
def get_input(variable_symbol, question=nil) present(question, newline: false) if question # creating this method allows us to test it easily # without requiring terminal input set_input_variable(variable_symbol, gets.chomp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input;\t@input \t\tend", "def gets(*rest) end", "def gets(*rest) end", "def get\n\t\t\tpush gets\n\t\tend", "def get_input\n #Get input from the user\nend", "def input; @input; end", "def input; @input; end", "def gets\n @input.gets\n end", "def gets\n fail NotImplementedError, \"...
[ "0.719325", "0.6520991", "0.6520991", "0.62766844", "0.6208153", "0.6188949", "0.6188949", "0.61641103", "0.6022693", "0.6009073", "0.59837735", "0.59837735", "0.59837735", "0.59228987", "0.59115124", "0.58717525", "0.5838687", "0.5834666", "0.5828931", "0.58174425", "0.58081...
0.0
-1
If you aren't using a framework that gives you logging out of the box, its usually a good idea to implement a centralized logging method at the base class so you get consistent logging and do things like avoid logging output during tests
def log(msg) puts msg unless ENV['TEST'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def...
[ "0.724748", "0.724748", "0.724748", "0.724748", "0.724748", "0.724748", "0.724748", "0.724748", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.7208501", "0.720850...
0.0
-1
For the same reason as logging, we want to have a central method that is responsible for showing output to the user This way if we want to customize it, we can do it in one place
def present(output, newline: true) # ternary operator FTW newline ? puts(output) : print(output) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger_output; end", "def display(text)\n @log ||= Logger.new(STDERR)\n @log.info text\n end", "def display(text)\n @log ||= Logger.new(STDERR)\n @log.info text\n end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end", "def stdout; end"...
[ "0.7555184", "0.6904446", "0.6904446", "0.6882929", "0.6882929", "0.6882929", "0.6882929", "0.6882929", "0.6882929", "0.6841408", "0.68023986", "0.67183137", "0.670368", "0.6657372", "0.6640824", "0.66271496", "0.65893966", "0.65893966", "0.65893966", "0.65893966", "0.6589396...
0.0
-1
3112 Administrators cannot see other users
def index @page_title = "CBCL - Liste af Brugere" @sort = params[:sort] || 'users.created_at' @order = params[:order] || "asc" @users = current_user.get_users(:page => params[:page], :per_page => Journal.per_page, :sort => params[:sort], :order => params[:order]) if !params[:partial] render ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrato...
[ "0.7263266", "0.7263266", "0.71552145", "0.7129115", "0.7110014", "0.7067813", "0.70627415", "0.7060988", "0.70269096", "0.7023807", "0.7023807", "0.7023807", "0.7023807", "0.698633", "0.698633", "0.6981181", "0.69801354", "0.6972101", "0.69588864", "0.6911965", "0.691089", ...
0.0
-1
Show a user identified by the +:id+ path fragment in the URL. Before_filter find_user
def show @page_title = "CBCL - Detaljer om bruger " + (@user && @user.login || "") @groups = @user.center_and_teams group_ids = @groups.map {|g| g.id }.join(',') query = "select center_id, count(*) as count from journals where center_id IN (#{group_ids}) group by center_id" # puts query @groups...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend", "def show\n @user = User.find_by(id: params[:id])\n render_404 unless @user\n end", "def show\n # find the user by the user id in the route params\n # (this will likely be moved to its own before met...
[ "0.7555533", "0.7408054", "0.73857564", "0.7347955", "0.729226", "0.72882116", "0.7271526", "0.72239494", "0.7171442", "0.7153677", "0.712616", "0.7118207", "0.70752585", "0.7073682", "0.7067555", "0.7033212", "0.7015203", "0.7006191", "0.6985289", "0.69457144", "0.69437253",...
0.0
-1
Displays a form to create a new user. Posts to the create action.
def new @roles = current_user.pass_on_roles.to_a || [] # logged-in user can give his own roles to new user @user = User.new params[:id] = current_user.center if params[:id] == "0" if !params[:id].nil? # create new user for specific center/team @groups = Group.this_or_parent(params[:id]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path, notice: t('users.update.updated')\n else\n @page_title = t(\"actions.new_user\")\n render action: 'new'\n end\n end", "def create\n\t\t@user = User.new(params[:user])\n\t\tif @user.save\n\t\t\tredir...
[ "0.8175505", "0.8122388", "0.81217426", "0.79427093", "0.7926398", "0.7888639", "0.7879819", "0.7876006", "0.78714365", "0.786993", "0.7857081", "0.784437", "0.7765822", "0.77644235", "0.7759707", "0.77514", "0.77372617", "0.7732122", "0.7727777", "0.7706785", "0.7700843", ...
0.0
-1
Display a confirmation form (which asks "do you really want to delete this user?") on GET. Handle the form submission on POST.
def delete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_confirm\n return appctrl_not_permitted() unless ( @current_user.admin? )\n\n # Nobody can delete admin accounts. You must assign the admin\n # privilege to someone else, then, since you can't revoke your\n # own admin privileges either, have the new admin change your\n # account type and ...
[ "0.7108232", "0.6958075", "0.66438794", "0.654843", "0.6535866", "0.6530181", "0.65003717", "0.649101", "0.64856106", "0.6476238", "0.6467055", "0.64453226", "0.64126545", "0.6412593", "0.64086443", "0.6407472", "0.63863456", "0.6372831", "0.63692236", "0.6352811", "0.6339783...
0.0
-1
require 'pry' inding .pry
def game (a,b) if a == b puts"<><><><><>> 平手 <<><><><><>" elsif a==0 && b==1 puts"<><>LOSE<>> (輸) <><>WIN><>>" elsif a==1 && b==2 puts"<><>LOSE<>> (輸) <><>WIN><>>" elsif a==2 && b==0 puts"<><>LOSE<>> (輸) <><>WIN><>>" else puts"<><>WIN><>> (贏) <><>LOSE<>>" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n # require \"pry\"; binding.pry\n end", "def pry\n # rubocop:disable Lint/Debugger\n binding.pry\n # rubocop:enable Lint/Debugger\n end", "def cmd_pry(*args)\n if args.include?('-h')\n cmd_pry_help\n return\n end\n\n begin\n require 'pry'\n rescue LoadError\n ...
[ "0.8045366", "0.7839913", "0.7522832", "0.74865687", "0.7461366", "0.7424767", "0.73221517", "0.7095784", "0.70662886", "0.7030946", "0.6878877", "0.686908", "0.68417925", "0.6618936", "0.6460227", "0.6349161", "0.63235784", "0.63175064", "0.6292557", "0.61656946", "0.6033699...
0.0
-1
Called when a new network interface is added to a container
def add_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface_add(network_interfaces, node_uid, interfaces)\n num1 = node_uid.split('-')[1].to_i\n if network_interfaces.has_value?(interfaces) == false\n network_interfaces[[num1]] = interfaces\n else\n num2 = network_interfaces.key(interfaces)\n network_interfaces.delete(num2)\n netw...
[ "0.6496687", "0.62408465", "0.6235805", "0.61087906", "0.6048017", "0.59024006", "0.5892403", "0.58323103", "0.57755405", "0.57314783", "0.57312155", "0.56061983", "0.55266076", "0.5512832", "0.55091804", "0.54999554", "0.54960656", "0.54461163", "0.5363856", "0.53628165", "0...
0.51835376
32
Called when a network interface is removed from a container
def remove_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(interface)\n @pool.drop\n end", "def disconnected(interface)\n\t\t@status_lock.synchronize {\n\t\t\tstatus_array = @connected_interfaces.delete(interface)\n\t\t\tstatus_array.each do |status_hash|\n\t\t\t\tstatus_hash.delete(interface)\n\t\t\tend\n\t\t\t#\n\t\t\t# TODO::Refactor required\n\t\t\t...
[ "0.64137655", "0.6342896", "0.6318521", "0.62706137", "0.6184792", "0.6056597", "0.6035737", "0.59510005", "0.58854514", "0.58816785", "0.58694553", "0.5846944", "0.5814843", "0.5814843", "0.58148336", "0.5783921", "0.5779698", "0.57446444", "0.56855255", "0.56731385", "0.558...
0.5668517
21
Called when an existing network interface is renamed
def rename_netif(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_netif(netifs, netif, old_name)\n end", "def rename_netif(netifs, netif, old_name)\n # Remove old network interface\n do_remove_netif(old_name)\n\n # Create the new interface\n do_create_netif(netif)\n end", "def onRenamed(item, oldName, newName)\n @object.renamed(impor...
[ "0.7386079", "0.7318025", "0.6469028", "0.6151278", "0.59545046", "0.5888089", "0.5760561", "0.5647251", "0.5647251", "0.5585602", "0.557492", "0.54986477", "0.5437905", "0.5394161", "0.53864264", "0.5385541", "0.53659827", "0.5354233", "0.53206354", "0.53186214", "0.53125674...
0.64375025
5
Return path to `/bin` or an alternative, where a shell is looked up
def bin_path(_opts) '/bin' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bin_path\n '/usr/local/bin'.p\n end", "def shell_path\n value = shell_name.to_s\n\n if value.match(/^\\//)\n # Absolute path already provided (starts with \"/\")\n value.p\n else\n # Shell name provided, use \"which\" to find the executable\n which(value).p\n end\n end", ...
[ "0.77079326", "0.7471957", "0.74108934", "0.7407706", "0.7277174", "0.72635853", "0.72635853", "0.7260902", "0.7249095", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "0.72404087", "...
0.7370659
5
Update hostname in /etc/hosts, optionally removing configuration of old hostname.
def update_etc_hosts(old_hostname = nil) hosts = File.join(ct.rootfs, 'etc', 'hosts') return unless writable?(hosts) regenerate_file(hosts, 0644) do |new, old| old.each_line do |line| if (/^127\.0\.0\.1\s/ =~ line || /^::1\s/ =~ line) \ && !includes_hostname?(line, ct.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_etc_hosts(old_hostname = nil)\n regenerate_file(File.join(ct.rootfs, 'etc', 'hosts'), 0644) do |new, old|\n old.each_line do |line|\n if (/^127\\.0\\.0\\.1\\s/ =~ line || /^::1\\s/ =~ line) \\\n && !includes_hostname?(line, ct.hostname)\n\n if old_hostname && ...
[ "0.7933892", "0.7650799", "0.75973976", "0.7427423", "0.73834133", "0.7361063", "0.7143645", "0.70696884", "0.7037517", "0.69144684", "0.6911625", "0.6863145", "0.683476", "0.6830129", "0.6818101", "0.68174195", "0.67421854", "0.6723371", "0.66878927", "0.66419506", "0.661067...
0.7616269
2
Check if a line of string contains specific hostname
def includes_hostname?(line, hostname) /\s#{Regexp.escape(hostname.fqdn)}(\s|$)/ =~ line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includes_hostname?(line, hostname)\n /\\s#{Regexp.escape(hostname)}(\\s|$)/ =~ line\n end", "def validate_hostname(hostname)\n hostname_regex = /(hostname)$/\n if hostname_regex =~ hostname\n $evm.log(\"info\",\"Hostname:<#{hostname}> found\") if @debug\n return true\n else\n ...
[ "0.8604411", "0.704599", "0.69021696", "0.688287", "0.6793343", "0.6696327", "0.66661876", "0.6400066", "0.6380634", "0.63708377", "0.6271574", "0.62470645", "0.62233603", "0.6118068", "0.61108977", "0.6087012", "0.6068708", "0.6038921", "0.602795", "0.6027074", "0.6002057", ...
0.8479698
1
Add `hostname` to `line` from `/etc/hosts` The hostname is put into the first position.
def add_host(line, hostname) return if line !~ /^([^\s]+)(\s+)/ i = $~.end(2) "#{$1}#{$2}#{hostname.fqdn} #{line[i..-1]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_host(line, old_hostname, new_hostname)\n line.sub(\n /(\\s)#{Regexp.escape(old_hostname.fqdn)}(\\s|$)/,\n \"\\\\1#{new_hostname.fqdn}\\\\2\"\n )\n end", "def rebuild_host_file(hostname_, fqdn_)\n\n # Get the old hosts file\n hosts_content = ssh.exec! \"cat /et...
[ "0.6946419", "0.66520256", "0.6427342", "0.63516855", "0.6333866", "0.63029236", "0.62920105", "0.6242204", "0.6224655", "0.61852443", "0.6142972", "0.6113607", "0.6006069", "0.59538376", "0.5926475", "0.5910505", "0.58857375", "0.5871729", "0.58388555", "0.57949454", "0.5765...
0.8507192
0
Remove `hostname` from `line` read from `/etc/hosts`
def replace_host(line, old_hostname, new_hostname) line.sub( /(\s)#{Regexp.escape(old_hostname.fqdn)}(\s|$)/, "\\1#{new_hostname.fqdn}\\2" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_line\n el = @l.split(\" \")\n\n u = URI(el[1])\n\n disable = false\n\n case u.host\n when \"releases.ubuntu.com\"\n c = u.host\n u.host = \"archive.ubuntu.com\"\n if self.uri_exists(self.get_url(u.to_s)) == false\n u.host = c\n ...
[ "0.6867215", "0.66918683", "0.66733414", "0.6657802", "0.6633702", "0.66149694", "0.66008675", "0.64658237", "0.62012243", "0.6187825", "0.61033654", "0.60580856", "0.6046851", "0.5959034", "0.5903639", "0.58907056", "0.58279264", "0.5779136", "0.57771736", "0.5760028", "0.57...
0.70167303
0
Check if the file at `path` si writable by its user If the file doesn't exist, we take it as writable. If a block is given, it is called if `path` is writable.
def writable?(path) begin return if (File.stat(path).mode & 0200) != 0200 rescue Errno::ENOENT # pass end yield(path) if block_given? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_writable(path)\n raise Error, \"The path '#{path}' is not writable\" if (path.exist? && !path.writable?) || !path.parent.writable?\n end", "def writable?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)\n GLib.g_file_info_get_attribute_boolean(info, GLib::G_...
[ "0.7443799", "0.7016081", "0.6727093", "0.64556354", "0.6385518", "0.6381238", "0.60249645", "0.5928891", "0.5914708", "0.58233756", "0.5812836", "0.580924", "0.5802117", "0.5715689", "0.56821775", "0.56651014", "0.55578613", "0.5510112", "0.5507942", "0.54917246", "0.5483227...
0.8143976
1
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to s...
[ "0.7506257", "0.7365645", "0.73327494", "0.7332001", "0.7304018", "0.72987556", "0.7277565", "0.7277565", "0.7277565", "0.7269057", "0.7245158", "0.7228631", "0.72257257", "0.72016567", "0.7186694", "0.71786916", "0.71648866", "0.71503496", "0.71503496", "0.71503496", "0.7150...
0.0
-1
to set where we save our image to Image folder
def public_id # return "Image/" + Cloudinary::Utils.random_public_id "Image/#{model.food_key}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_save_path\n @image_save_path\n end", "def save_path\n @save_path ||= self.class.image_save_path.dup\n end", "def store_dir\n \"hero_images/#{model.id}\"\n end", "def store_dir\n \"uploads/screenshots/2014/04/#{model.id}\"\n end", "def store_dir\r\n \"ass...
[ "0.7597642", "0.75368065", "0.68556976", "0.6808064", "0.6795669", "0.6787359", "0.67507637", "0.6731905", "0.6723938", "0.66670406", "0.6665487", "0.6648883", "0.66332453", "0.66054326", "0.65716934", "0.65621156", "0.65356296", "0.6524647", "0.65201", "0.6512147", "0.646966...
0.0
-1
remember that with noninteger division that you would need to check two tests, one for integer and one for noninteger
def divide(number_1, number_2) return number_1 / number_2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_divisor?(number, i) \n number % i == 0\nend", "def can_divide_by?(number)\r\n\treturn false if number.zero?\r\n\treturn true\r\nend", "def accurate_division(int, int_two)\n int = int.to_f\n int_two = int_two\n q = int / int_two\n return q.round(3)\nend", "def can_divide_by?(number)\n\treturn...
[ "0.7242066", "0.71676123", "0.71583635", "0.7144524", "0.7112887", "0.7089158", "0.7089158", "0.7000695", "0.6980038", "0.6973237", "0.68796104", "0.68741715", "0.6869029", "0.68501174", "0.6795166", "0.67735255", "0.6772631", "0.67616177", "0.6757536", "0.67166775", "0.66641...
0.62290597
71
Here we could have done a very similar piece of code to above, but we don't want to repeat ourselves to this is better.
def number_to_short_month_name(month) return number_to_full_month_name(month)[0..2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def schubert; end", "def offences_by; end", "def suivre; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def custom; end", "def custom; end", "def offences_by=(_arg0); end", "def terpene; end",...
[ "0.6535553", "0.59476185", "0.5719327", "0.5624982", "0.5417924", "0.5412512", "0.5358555", "0.5358555", "0.5358555", "0.5358555", "0.5337016", "0.5337016", "0.5291002", "0.52545106", "0.5253086", "0.5229857", "0.51901096", "0.51796377", "0.5133155", "0.5125675", "0.51240486"...
0.0
-1
indexing to access specific array elements
def array_with_two_elements ary = Array.new Array.new(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](indx)\n elements[indx]\n end", "def []( index )\r\n @ary.at(index + @offset)\r\n end", "def at(array, i)\n array[i]\nend", "def at(index)\n \t@array[index]\n end", "def index(element); end", "def by_index(index)\n @arr[index]\n end", "def [](i); @x[i]; end", "def []...
[ "0.74449104", "0.7210455", "0.7142888", "0.71170944", "0.6976025", "0.69086105", "0.68387663", "0.679267", "0.67884713", "0.67884713", "0.67797863", "0.6721372", "0.67039484", "0.6660641", "0.6660641", "0.6626267", "0.6614239", "0.6572086", "0.6570697", "0.6512165", "0.650721...
0.0
-1
retrieving the first element from the Array
def first_element(array) taylor_swift = ["Welcome to New York", "Blank Space", "Style", "Out of The Woods"] taylor_swift[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_first_element_from_array(array)\n array[0]\nend", "def retrieve_first_element_from_array(array)\n return array[0]\nend", "def retrieve_first_element_from_array(array)\n array.first\nend", "def using_first(array)\n first_element=array.first\nend", "def first_element(array)\n array[0]\nen...
[ "0.8887926", "0.88523483", "0.87731326", "0.86561817", "0.8653266", "0.86523336", "0.86272603", "0.8617308", "0.8531432", "0.8521316", "0.8521316", "0.8482365", "0.8458378", "0.8366077", "0.8366077", "0.8366077", "0.8366077", "0.830389", "0.830389", "0.830389", "0.80046654", ...
0.78506386
24
retrieving the third element from the array, using a positive index
def third_element(array) taylor_swift = ["Welcome to New York", "Blank Space", "Style", "Out of The Woods"] taylor_swift[2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def third_element(array)\n array[2]\nend", "def third_element(array)\n array[2]\nend", "def third_element(my_third_element)\n my_third_element = @taylor_swift[3-1]\nend", "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def retrieve_element_from_index(array, ...
[ "0.8191679", "0.8191679", "0.74076474", "0.71739304", "0.7130169", "0.7130169", "0.7129903", "0.68370366", "0.6692258", "0.6653406", "0.6650568", "0.6565498", "0.656183", "0.6558826", "0.65417784", "0.65415776", "0.65084416", "0.64786696", "0.6467208", "0.6461499", "0.6461392...
0.7180012
3
retrieving the last element from the array, using a negative index
def last_element(array) taylor_swift = ["Welcome to New York", "Blank Space", "Style", "Out of The Woods"] taylor_swift[-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_of(arr)\n index = arr.length\n return arr[index -1]\nend", "def last_of(array)\n return array[-1]\nend", "def retrieve_last_element_from_array(array)\n return array[-1]\nend", "def last_of(arr)\n output = arr[-1]\n return output\nend", "def get_last_item(arr)\n\treturn arr[-1]\nend...
[ "0.8701589", "0.8603096", "0.85548013", "0.8546728", "0.8479077", "0.84609705", "0.84609705", "0.84331214", "0.84303933", "0.84109396", "0.8396854", "0.8367534", "0.8350651", "0.83101326", "0.823484", "0.8061708", "0.80611384", "0.8052332", "0.79958844", "0.7982199", "0.79407...
0.7722881
26
element returned from array without referencing the index number of element
def first_element_with_array_methods(array) south_east_asia = ["Thailand", "Cambodia", "Singapore", "Myanmar"] south_east_asia.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def element_at(arr, index)\n arr[index]\nend"...
[ "0.76461035", "0.75070083", "0.75070083", "0.74518067", "0.7345736", "0.7332213", "0.73040915", "0.7272523", "0.7241433", "0.7241433", "0.71426046", "0.70967346", "0.70648426", "0.705631", "0.7038391", "0.7021866", "0.7018362", "0.70133024", "0.6966508", "0.6959439", "0.69394...
0.0
-1
element returned from array without referencing the index number of element
def last_element_with_array_methods(array) south_east_asia = ["Thailand", "Cambodia", "Singapore", "Myanmar"] south_east_asia.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def retrieve_element_from_index(array, index_number)\n array[index_number]\nend", "def element_at(arr, index)\n arr[index]\nend"...
[ "0.7648058", "0.7508987", "0.7508987", "0.74526906", "0.73454624", "0.7331987", "0.73044616", "0.7272575", "0.72411734", "0.72411734", "0.7142943", "0.7097204", "0.70658344", "0.7056832", "0.7038842", "0.7021442", "0.701853", "0.7012795", "0.69662035", "0.6960363", "0.6939334...
0.0
-1
Using length to query about the number of elements in an array, not counting from zero
def length_of_array(array) programming_languages = ["Ruby", "Javascript", "Python", "C++", "Java", "Lisp", "PHP", "Clojure"] programming_languages.length # => 8 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_length(array)\n\treturn array.length\nend", "def length_of_array(array)\n return array.length\nend", "def length_of_array (array)\n array.size\nend", "def length(array)\n length = 0\n while !(array[length].nil?)\n length += 1\n end\n return length\n # raise NotImplementedError\nend", ...
[ "0.82305527", "0.8206172", "0.8200662", "0.8162408", "0.81352437", "0.8123398", "0.81232095", "0.80976796", "0.78641665", "0.7861858", "0.7812499", "0.7812499", "0.7811178", "0.7788945", "0.77585524", "0.77318406", "0.7711827", "0.768749", "0.7657025", "0.76563305", "0.765310...
0.7496289
30
Upload copy of latest run
def upload_latest_copy upload_to_s3(report_files, prefix) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy!\n write_previous_revision\n update_repository\n write_revision\n end", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n...
[ "0.6425221", "0.6113231", "0.6099149", "0.606806", "0.6066456", "0.59865075", "0.59865075", "0.5911053", "0.5908292", "0.5902462", "0.5878168", "0.58709186", "0.58362496", "0.5810192", "0.57839453", "0.57568693", "0.57274264", "0.57055444", "0.5699966", "0.5679725", "0.564096...
0.71798426
0
Upload files to s3
def upload_to_s3(files, key_prefix) args = files.map do |file| { body: File.new(file), bucket: bucket_name, key: key(key_prefix, file.relative_path_from(report_path)) } end Parallel.each(args, in_threads: 8) { |obj| client.put_object(obj) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o...
[ "0.7936572", "0.78790015", "0.77684045", "0.7756051", "0.76901543", "0.76782143", "0.766342", "0.7621945", "0.7612313", "0.7567263", "0.74612737", "0.7444629", "0.7402972", "0.7394519", "0.73923206", "0.73803467", "0.7333729", "0.7291081", "0.7291081", "0.72435814", "0.723223...
0.76308334
7
Fabricate key for s3 object
def key(*args) args.compact.join("/") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_s3_key\n \"code_s3_key_placeholder\"\n end", "def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n ...
[ "0.73735726", "0.7334049", "0.7272964", "0.7135666", "0.7088733", "0.6987826", "0.6987562", "0.6833704", "0.67554426", "0.66738737", "0.6665293", "0.6617219", "0.6606177", "0.65811896", "0.6526394", "0.6510484", "0.6467586", "0.64460814", "0.64312077", "0.641661", "0.641661",...
0.0
-1
GET /bairro_micros/1 GET /bairro_micros/1.xml
def show @bairro_micro = BairroMicro.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @bairro_micro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request....
[ "0.58073443", "0.55912304", "0.5522448", "0.5486908", "0.5483598", "0.5438869", "0.54351896", "0.54262406", "0.54131114", "0.52845937", "0.5250047", "0.5249597", "0.5241533", "0.5202264", "0.51990217", "0.51861954", "0.51850027", "0.5170066", "0.51646066", "0.5152907", "0.513...
0.6093064
0
GET /bairro_micros/new GET /bairro_micros/new.xml
def new @bairro_micro = BairroMicro.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @bairro_micro } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bairro_micro = BairroMicro.new(params[:bairro_micro])\n\n respond_to do |format|\n if @bairro_micro.save\n flash[:notice] = 'BairroMicro was successfully created.'\n format.html { redirect_to(@bairro_micro) }\n format.xml { render :xml => @bairro_micro, :status => :cr...
[ "0.64610016", "0.6444188", "0.6312678", "0.6296427", "0.62716764", "0.6256792", "0.6246808", "0.6239247", "0.6228101", "0.6214822", "0.62104243", "0.6202235", "0.6199871", "0.6198923", "0.6196262", "0.6142587", "0.6141799", "0.6134468", "0.6132148", "0.6132148", "0.6129697", ...
0.68609923
0
POST /bairro_micros POST /bairro_micros.xml
def create @bairro_micro = BairroMicro.new(params[:bairro_micro]) respond_to do |format| if @bairro_micro.save flash[:notice] = 'BairroMicro was successfully created.' format.html { redirect_to(@bairro_micro) } format.xml { render :xml => @bairro_micro, :status => :created, :loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(bin_params)\n @rest.post('save', bin_params)\n end", "def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end", "def request_body(xml); xml; end", "def request(path, parameters = {})\n response = Basecamp.con...
[ "0.5432998", "0.5312817", "0.5043077", "0.5004182", "0.49646065", "0.49444047", "0.49055824", "0.49004248", "0.48742113", "0.4802006", "0.4799636", "0.47852984", "0.47813207", "0.47717053", "0.47582325", "0.47353584", "0.473396", "0.47171095", "0.4712434", "0.470688", "0.4695...
0.5712857
0
PUT /bairro_micros/1 PUT /bairro_micros/1.xml
def update @bairro_micro = BairroMicro.find(params[:id]) respond_to do |format| if @bairro_micro.update_attributes(params[:bairro_micro]) flash[:notice] = 'BairroMicro was successfully updated.' format.html { redirect_to(@bairro_micro) } format.xml { head :ok } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def pos...
[ "0.5635677", "0.54242337", "0.5412096", "0.5296947", "0.525578", "0.5215971", "0.5215148", "0.52002347", "0.516033", "0.5117836", "0.5117836", "0.50986224", "0.5068332", "0.5057284", "0.5057284", "0.50561494", "0.5006227", "0.49837646", "0.4969781", "0.49559313", "0.49379244"...
0.5889715
0
DELETE /bairro_micros/1 DELETE /bairro_micros/1.xml
def destroy @bairro_micro = BairroMicro.find(params[:id]) @bairro_micro.destroy respond_to do |format| format.html { redirect_to(bairro_micros_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\...
[ "0.672824", "0.6293559", "0.62897664", "0.628875", "0.62621874", "0.6260807", "0.6259034", "0.623915", "0.62059665", "0.61969817", "0.61398375", "0.6123344", "0.6105961", "0.60728836", "0.60541666", "0.6037351", "0.60188174", "0.6011678", "0.5981924", "0.5977341", "0.596784",...
0.693732
0
Returns true or false if the user is logged in.
def logged_in? !!current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def logged_in?\n user._logged_in?\n end", "def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r...
[ "0.8973362", "0.8775968", "0.8709158", "0.8675256", "0.8641435", "0.8633322", "0.86329544", "0.8615168", "0.86115885", "0.86115885", "0.86064714", "0.8586828", "0.858408", "0.8578593", "0.8565856", "0.8565856", "0.85308635", "0.8526328", "0.8526328", "0.85232234", "0.851801",...
0.0
-1
Accesses the current user from the session. Future calls avoid the database because nil is not equal to false.
def current_user @current_user ||= (login_from_mindpin_app_auth) unless @current_user == false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end", "def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end", "def user\n return nil if !session[:user]\n @user ||= fetch_user(session[:user])\n end", "def...
[ "0.7964959", "0.7964959", "0.7964959", "0.7927239", "0.7927096", "0.79119253", "0.7894414", "0.78897446", "0.78864443", "0.7876071", "0.7872462", "0.7864673", "0.7859413", "0.78526485", "0.7850535", "0.78418994", "0.78408915", "0.78336805", "0.7831726", "0.7827619", "0.782049...
0.0
-1
Check if the user is authorized Override this method in your controllers if you want to restrict access to only a few actions or if you want to check if the user has the correct rights. Example: only allow nonbobs def authorized? current_user.login != "bob" end
def authorized? logged_in? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorized?\n\n return false unless current_user\n\n %w{ show index }.include?(action_name) || current_user.is_admin?\n end", "def authorized?\n @authorized ||= current_user.present? # TODO: Check for authorization\n end", "def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\t...
[ "0.83697116", "0.82996666", "0.8289906", "0.8272799", "0.8270042", "0.82172114", "0.8214159", "0.8209202", "0.8105001", "0.8089966", "0.8089966", "0.80848414", "0.80446553", "0.8013533", "0.80072534", "0.80072534", "0.7991215", "0.7987681", "0.7984398", "0.79811186", "0.79714...
0.7953632
22
Formats song information to send tweet
def format(song) artist_name = format_artist_name(song["artist"]["content"]) song_name = format_song_name(song["name"]) hashtag = format_hashtag(song["nowplaying"]) return "#{song_name} - #{artist_name} ##{hashtag}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSongInfo(tweet)\n\tthe_artist_name = tweet[/by[\\w\\W]+(((http\\:\\/\\/){1}))/i]\n\tif the_artist_name != nil\n\t\t@artist_name = the_artist_name[/(?<=^|(?<=[^a-zA-Z0-9\\_\\.]))@([A-Za-z0-9\\_]+)/i]\n\t\tif @artist_name != nil\n\t\t\t@artist_name = @artist_name[1..@artist_name.length]\n\n\t\t\t# Catch the e...
[ "0.66666615", "0.6524269", "0.6464781", "0.6360947", "0.62788695", "0.61502916", "0.6145508", "0.61449444", "0.6078103", "0.6070553", "0.6068057", "0.59727097", "0.5908821", "0.5827892", "0.58265084", "0.58231413", "0.58231413", "0.58091754", "0.5795549", "0.5793214", "0.5770...
0.6961494
0
Formats artist name for tweet
def format_artist_name(artist_name) if(artist_name.length > 52) return artist_name[0 .. 48] + "..." else return artist_name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n\t\ts = title\n\t\ts = \"#{artist.name} - #{s}\" if artist\n\t\treturn s\n\tend", "def artist_name\n if artist_name_from_url.present?\n artist_name_from_url\n elsif api_metadata.present?\n api_metadata.dig(:author, :username)\n else\n nil\n en...
[ "0.7079218", "0.701164", "0.68315125", "0.677011", "0.67620605", "0.6737886", "0.66794777", "0.6653416", "0.66443837", "0.6617785", "0.6564145", "0.6548926", "0.64781696", "0.6475851", "0.6443876", "0.63734734", "0.6373027", "0.6365349", "0.63160753", "0.63160753", "0.6316075...
0.70677274
1
Formats song name for tweet
def format_song_name(song_name) if(song_name.length > 48) return "\"" + song_name[0 .. 44] + "...\"" else return "\"" + song_name + "\"" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(song)\n artist_name = format_artist_name(song[\"artist\"][\"content\"])\n song_name = format_song_name(song[\"name\"])\n hashtag = format_hashtag(song[\"nowplaying\"])\n return \"#{song_name} - #{artist_name} ##{hashtag}\"\n end", "def format\n self.songs.size > 1 ? s = \"son...
[ "0.72361076", "0.70344216", "0.66230726", "0.6583418", "0.64850616", "0.64805037", "0.6437315", "0.62904483", "0.6266967", "0.6243978", "0.61862695", "0.6076482", "0.6043728", "0.60052985", "0.600385", "0.5974153", "0.5941831", "0.5877113", "0.58407515", "0.58324254", "0.5814...
0.6998749
2
Determines hashtag for tweet
def format_hashtag(nowplaying) if nowplaying return "nowplaying" else return "tweetsong" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashtag?(word)\n return false if config.include_hashtags\n !(word =~ /#(\\w+)/).nil?\n end", "def generateHashtag(string)\n hashtag = string.split.map(&:capitalize).join\n return false if hashtag.size > 139 || hashtag.size == 0\n hashtag.insert(0, \"#\")\nend", "def get_hashtags2(post...
[ "0.7069516", "0.69958436", "0.6920261", "0.6802613", "0.6779137", "0.67112666", "0.6662975", "0.6647694", "0.66186816", "0.65907896", "0.65764135", "0.6560696", "0.6508572", "0.64373904", "0.64076805", "0.63967055", "0.6378412", "0.63530314", "0.63244104", "0.6298788", "0.629...
0.64037347
15
Converts the attachment into a hash, suitable for being sent to the Slack API.
def to_hash options.merge({ fallback: options[:fallback] || text, text: text, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [attachments, billing, body, body_html, body_rtf, body_type, categories, companies, item_id, message_class, mileage, recipients, sensitivity, subject, subject_prefix, properties, discriminator, electronic_addresses, events, name_info, other_fields, personal_info, photo, physical_addresses, professi...
[ "0.631076", "0.62681615", "0.6198012", "0.6190606", "0.61087745", "0.6028359", "0.60173094", "0.6002963", "0.600036", "0.59778297", "0.59339744", "0.59317255", "0.5915541", "0.58895826", "0.58482975", "0.5819376", "0.5765067", "0.57546055", "0.57471746", "0.57368433", "0.5723...
0.0
-1
validates :slack_name, presence: true
def send_iizo_to(target, **args) send_iizos.create(args.merge(to_user: target)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_name\n if third_party && name.blank?\n errors.add(\n :name,\n :blank,\n )\n end\n end", "def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end", "def validate_name?\n # if you create...
[ "0.6440327", "0.6289542", "0.62171054", "0.6183409", "0.61696327", "0.61258906", "0.6123618", "0.60573703", "0.59965754", "0.59483266", "0.5894323", "0.58750015", "0.5870618", "0.5869467", "0.5803889", "0.5799437", "0.5751212", "0.57394797", "0.57197756", "0.56794673", "0.565...
0.0
-1
GET /api/posts GET /api/posts.json
def index @posts = Post.all render json: @posts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "def index\n @posts = Post.all\n render json: @posts\n end", "def index\n @posts = Post.all\n render json: @posts\n end"...
[ "0.78489983", "0.75772315", "0.75656694", "0.75558054", "0.7445508", "0.7445508", "0.7445508", "0.7441924", "0.7441405", "0.7409756", "0.7398838", "0.7397903", "0.7392969", "0.738795", "0.7345242", "0.7331166", "0.73056656", "0.7279897", "0.7272122", "0.726539", "0.72541493",...
0.75579596
3
GET /api/posts/1 GET /api/posts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def index\n @api_v1_posts = Api::V1::Post.all\n end", "def show\n render json: @post, serializer: Api::V1::PostSerializer\n end", "def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end", "de...
[ "0.7685318", "0.75155765", "0.74404126", "0.73778766", "0.7356082", "0.7335217", "0.73266953", "0.73266953", "0.731053", "0.73074853", "0.7291122", "0.72823393", "0.72704464", "0.7255951", "0.7251608", "0.7238682", "0.7238682", "0.7238682", "0.72384226", "0.72211057", "0.7219...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_post @post = Post.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def post_params params.fetch(:post, {}) 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
private 1. win : if player can win, play win move
def win(board, sym = @symbol) POSSIBLE_WINS.each do |win| marks = board.each_index.select { |i| board[i] == sym.to_s } matches = win & marks if matches.size == 2 missing = win - matches missing = missing[0] return missing unless board[missing] != " " end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play()\n \twinner = false\n \twhile not winner\n\t # player 1 moves\n\t @board.show()\n\t location = @player1.play()\n\t @board.changeLocation(location, @player1.marker)\n\n\t # did he win?\n\t winner = @board.checkWinner(@player1.marker)\n\t break if winner\n\n\t # player 2 plays\n\t @board.show()\...
[ "0.7757622", "0.7658624", "0.76118976", "0.75956666", "0.74922377", "0.7441926", "0.74201065", "0.7400053", "0.73219293", "0.72918755", "0.7280651", "0.7256046", "0.7250717", "0.72389", "0.7238165", "0.722224", "0.7218005", "0.72001284", "0.7194825", "0.7194825", "0.7192151",...
0.0
-1
2. block : if opponent can win, play block move
def block(board) POSSIBLE_WINS.each do |win| marks = board.each_index.select { |i| board[i] == opponent_symbol(@symbol).to_s } matches = win & marks if matches.size == 2 missing = win - matches missing = missing[0] return missing unless board[missing] != " " end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block\n winning_move(@opponent_mark) \n end", "def ai_block_win(board)\n\t\tvalid_moves = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n\t\tnew_hash = {} # Holds the winning combination positions the other player is occupying\n\t\tfinal_hash= {} # Holds the winning combinati...
[ "0.80987406", "0.79132843", "0.77001", "0.7402945", "0.7401885", "0.7269323", "0.7133052", "0.7080874", "0.7063334", "0.70426524", "0.69291145", "0.6916656", "0.6846598", "0.68315554", "0.67710876", "0.6765523", "0.6734914", "0.6700109", "0.66842717", "0.66683465", "0.6668346...
0.0
-1
3. fork : if player can create 2 win threats, play fork
def fork(board, sym = @symbol) fake_board = board (0..2).each do |i| row = [fake_board[i * 3], fake_board[(i * 3) + 1], fake_board[(i * 3) + 2]] if only_one_mark?(sym, row) # delete mark from board so that it doesn't get counted again in columns k = row.find_index(sym.to_s) del = board_pos(i, k) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win?\n if @player1.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player2.name} wins!\"\n sleep(1)\n elsif @player2.life == 0\n sleep(1)\n puts \"-- GAME OVER --\"\n sleep(1)\n puts \"#{@player1.name} w...
[ "0.6900561", "0.6802724", "0.67784095", "0.66970164", "0.66527414", "0.6644474", "0.6642027", "0.6641353", "0.6629515", "0.6629229", "0.66163397", "0.6612759", "0.6553117", "0.65431184", "0.6527262", "0.65100896", "0.650837", "0.65012896", "0.64965135", "0.6491983", "0.647924...
0.0
-1
4. block_fork : if opponent can create 2 win threats, play block_fork
def block_fork(board) return fork(board, opponent_symbol(@symbol)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fork_check(wins, player, opponent)\n block_fork = find_fork(wins, opponent, player)\n get_fork = find_fork(wins, player, opponent)\n if get_fork.size > 0 # if possible to create fork, do it\n move = get_fork.sample\n elsif block_fork.size > 1 # if opponent can create multiple forks, force bl...
[ "0.74359304", "0.71108514", "0.7052763", "0.6503178", "0.6458734", "0.64020795", "0.63444376", "0.63335246", "0.6279534", "0.62686825", "0.6210135", "0.6180599", "0.6060795", "0.60578907", "0.6026725", "0.59933126", "0.59559053", "0.5941965", "0.5941581", "0.59263384", "0.592...
0.74767643
0
5. center : if the center piece is empty, play it unless it's the first move if it's the first move (all marks are empty) play a corner
def center(board) if board[4] == " " return 4 else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corner_play\n return unless UNBEATABLE\n board_values = board.squares.map { |k, v| [k, v.marker] }.to_h\n if board_values.values_at(1, 9).all?(@human.mark) ||\n board_values.values_at(3, 7).all?(@human.mark)\n board_values.slice(2, 4, 6, 8).key(INITIAL_MARKER)\n else\n board_values....
[ "0.70012105", "0.6522169", "0.63387966", "0.63328743", "0.62405574", "0.61369604", "0.6131496", "0.605904", "0.6040189", "0.6031751", "0.6017023", "0.5970853", "0.5953036", "0.59415215", "0.5940223", "0.59199506", "0.59195024", "0.5918493", "0.5902305", "0.5878847", "0.586615...
0.55140746
91
6. opposite_corner : if the opponent is on a corner, play the opposite corner
def opposite_corner(board) CORNERS.each do |corner| if board[corner] == opponent_symbol(@symbol) move = opposite(corner) return move if board[move] == " " end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opposite_corner(board)\n #NOTE this could be cleaned up further with a function that accepts two arguments ie opposite_corner_play(0,9) and then iterating over an array of corners with it...but I'm not going to do that right now.\n # NOTE opponent_in_cell opperates on indexes, board.open? operates on i...
[ "0.7943329", "0.76230633", "0.7606113", "0.7508064", "0.7074578", "0.70698017", "0.70516324", "0.63384664", "0.63301635", "0.63015914", "0.62888396", "0.6265764", "0.6227639", "0.6227639", "0.62265015", "0.621913", "0.6178366", "0.61719054", "0.6161276", "0.6077543", "0.60710...
0.78314024
1
7. empty_corner : if there is an empty corner, play it
def empty_corner(board) CORNERS.each do |corner| if board[corner] == " " return corner end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_corner\n corners = [1,3,7,9]\n corners.select! {|corner| @game.game.free_position?(corner) }\n return corners.shuffle.first if !corners.empty?\n false\n end", "def corner_play\n return unless UNBEATABLE\n board_values = board.squares.map { |k, v| [k, v.marker] }.to_h\n if board_va...
[ "0.7828409", "0.7417383", "0.72394097", "0.66501397", "0.6597562", "0.6578648", "0.65541303", "0.6433353", "0.6431356", "0.6418361", "0.6406683", "0.64052427", "0.63595355", "0.6310268", "0.621503", "0.6190822", "0.6159121", "0.6137976", "0.61362696", "0.613363", "0.61327153"...
0.7164664
3
8. empty_side : if there is an empty side, play it
def empty_side(board) SIDES.each do |side| if board[side] == " " return side end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty_side\n sides = [2,4,6,8]\n sides.each do |side|\n return side if @game.game.free_position?(side)\n end\n end", "def play_empty_side(spaces)\n avail = []\n avail << 1 if spaces[1] == \" \"\n avail << 3 if spaces[3] == \" \"\n avail << 5 if spaces[5] == \" \"\n avail << 7 if spaces[7]...
[ "0.69561434", "0.69528574", "0.6400009", "0.61066055", "0.60907376", "0.6036156", "0.59701604", "0.58565116", "0.5854479", "0.57449645", "0.5694544", "0.56689966", "0.56623507", "0.5652273", "0.5652273", "0.5652273", "0.5652273", "0.56250805", "0.56244415", "0.56094605", "0.5...
0.603944
5
Set methods to be explicitly included in PHI access logging.
def include_in_phi(*methods) self.__phi_include_methods = methods.map(&:to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_phi_access(*methods)\n self.__phi_extend_methods = methods.map(&:to_s)\n end", "def temporary_access_pass_methods=(value)\n @temporary_access_pass_methods = value\n end", "def methods\n super + property.keys.map { |v| [\"configure_#{v}\".to_sym, \"request_#{v...
[ "0.63509685", "0.58697295", "0.58480984", "0.57343465", "0.57175165", "0.56587446", "0.5622327", "0.5601767", "0.557728", "0.55037534", "0.54979783", "0.5462688", "0.5439841", "0.5405657", "0.5394823", "0.5386332", "0.5371919", "0.53650427", "0.53255963", "0.5307336", "0.5304...
0.5869706
2
Set of methods which should be implicitly allowed if this object is allowed. The methods that are extended should return ActiveRecord models that also extend PhiAttrs.
def extend_phi_access(*methods) self.__phi_extend_methods = methods.map(&:to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_methods\n SafeClass.safe_methods_for(self)\n end", "def allowed_to_save\n method_list = self.class.authenticates_saves_method_list\n if method_list.nil?\n # No method list, so it's allowed\n true\n elsif method_list.check :accessor => accessor, :model => self\n ...
[ "0.6714027", "0.6531265", "0.64482296", "0.6392574", "0.636174", "0.63357556", "0.63107985", "0.61518043", "0.6082694", "0.60762614", "0.6074336", "0.6058777", "0.6048717", "0.6031552", "0.5993624", "0.5960358", "0.5921927", "0.58972996", "0.5878276", "0.58099854", "0.5779241...
0.52456874
88
Enable PHI access for any instance of this class.
def allow_phi!(user_id = nil, reason = nil) raise ArgumentError, 'block not allowed. use allow_phi with block' if block_given? user_id ||= current_user reason ||= i18n_reason raise ArgumentError, 'user_id and reason cannot be blank' if user_id.blank? || reason.blank? __phi_stac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wrap_phi\n # Disable PHI access by default\n @__phi_access_stack = []\n @__phi_methods_extended = Set.new\n @__phi_relations_extended = Set.new\n\n # Wrap attributes with PHI Logger and Access Control\n __phi_wrapped_methods.each { |m| phi_wrap_method(m) }\n __phi_extended_me...
[ "0.7059626", "0.66665703", "0.6350187", "0.6343351", "0.585181", "0.5555523", "0.55301267", "0.5483396", "0.54405427", "0.53088737", "0.52103704", "0.50905037", "0.50786835", "0.4952914", "0.49471173", "0.48807272", "0.48795852", "0.48789966", "0.48156694", "0.475089", "0.473...
0.54841894
7
Enable PHI access for any instance of this class in the block given only.
def allow_phi(user_id = nil, reason = nil, allow_only: nil, &block) get_phi(user_id, reason, allow_only: allow_only, &block) return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n message = __phi_stack.present? ? \"PHI access disabled for #{__user_id_string(__phi_stack)}\" : 'PHI access disabled. No class level access was granted.'\n\n __reset_phi_stack\n\n ...
[ "0.73569703", "0.7074471", "0.67473006", "0.65444994", "0.63490045", "0.6329767", "0.6278575", "0.6177435", "0.5773176", "0.5754046", "0.5637075", "0.55614996", "0.53313303", "0.53298676", "0.50255966", "0.49388066", "0.489753", "0.4884154", "0.48369688", "0.4806164", "0.4795...
0.5735688
10
Enable PHI access for any instance of this class in the block given only returning whatever the block returns.
def get_phi(user_id = nil, reason = nil, allow_only: nil) raise ArgumentError, 'block required' unless block_given? if allow_only.present? raise ArgumentError, 'allow_only must be iterable with each' unless allow_only.respond_to?(:each) raise ArgumentError, "allow_only must all be `...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disallow_phi!\n raise ArgumentError, 'block not allowed. use disallow_phi with block' if block_given?\n\n message = __phi_stack.present? ? \"PHI access disabled for #{__user_id_string(__phi_stack)}\" : 'PHI access disabled. No class level access was granted.'\n\n __reset_phi_stack\n\n ...
[ "0.67867744", "0.6718057", "0.6524316", "0.64574295", "0.61124426", "0.61120194", "0.5871452", "0.5834458", "0.57694376", "0.5653397", "0.54263717", "0.5338002", "0.52323973", "0.5126339", "0.51163495", "0.5095881", "0.50295395", "0.4966427", "0.4952948", "0.49106827", "0.488...
0.58039486
8