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
DELETE /usages/1 DELETE /usages/1.json
def destroy @usage.destroy respond_to do |format| format.html { redirect_to usages_url, notice: 'Usage was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @usage.destroy\n respond_to do |format|\n format.html { redirect_to usages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usage = Usage.find(params[:id])\n @usage.destroy\n\n respond_to do |format|\n format.html { redirect_to usages_url }\n ...
[ "0.7970998", "0.7929772", "0.73764634", "0.7360863", "0.7264963", "0.7119808", "0.70147043", "0.6859887", "0.6791584", "0.67372495", "0.6722999", "0.66610706", "0.66048616", "0.65949905", "0.6581952", "0.65541124", "0.65432405", "0.65337414", "0.6525769", "0.6503461", "0.6479...
0.78209084
2
Use callbacks to share common setup or constraints between actions.
def set_usage # byebug @usage = Usage.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 usage_params params.require(:usage).permit(:user_id, :cart_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
A has_many assocation with Containment via the item
def containments item.containments end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items\n associations[:items] ||= Resource::DataBagItemCollectionProxy.new(self)\n end", "def related_items\n related_items = { :coffee_pods => related_coffee_pods }\n related_items\n end", "def add_item(item)\r\n items.push(item)\r\n item.owner = self\r\n end", "def children\n...
[ "0.6398042", "0.61408854", "0.60172623", "0.5969578", "0.5949247", "0.59242374", "0.5849789", "0.5801775", "0.57642764", "0.57453084", "0.56835926", "0.5645318", "0.56261486", "0.56202567", "0.55826217", "0.55762964", "0.55646366", "0.55315757", "0.5529302", "0.5524875", "0.5...
0.61794937
1
A has_many assocation with Nesting via the item
def nestings item.nestings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def related_items\n related_items = { :coffee_pods => related_coffee_pods }\n related_items\n end", "def brief_vendor_add_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n brief_vendor.items << Item.new{|r| r.parent_id = params[...
[ "0.6010238", "0.59929335", "0.593291", "0.59231824", "0.5857509", "0.5713346", "0.5696438", "0.56963104", "0.56903964", "0.5688076", "0.5685401", "0.5649916", "0.5625754", "0.5586984", "0.5571661", "0.5571044", "0.5541844", "0.5526945", "0.55251664", "0.55166787", "0.55166465...
0.5610361
13
hiding this function because we don't necessary want the public to know our funding rounds
def funding_rounds # helper func that returns all the funding round instances that the startup has gotten FundingRound.all.select { |funding_round| funding_round.startup == self } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def funding_rounds\n FundingRound.all().select do |funding|\n if funding.venture_capitalist == self\n funding\n end\n end\n end", "def total_funds\n sum_funds = 0\n self.funding_rounds.each do |funding_round|\n sum_funds += funding_round.investme...
[ "0.6853106", "0.6851569", "0.6793366", "0.67756593", "0.6769105", "0.67617697", "0.6736483", "0.6733118", "0.668818", "0.6651152", "0.66454434", "0.6609469", "0.66054326", "0.6601386", "0.65987825", "0.6590659", "0.65822655", "0.6543924", "0.6539685", "0.6502529", "0.6433961"...
0.64566404
20
GET /template_options (AJAX) Collect all of the templates available for the org+funder combination rubocop:disable Metrics/AbcSize, Metrics/MethodLength rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def index authorize Plan research_org = process_org!(user: current_user) funder_org = process_org!(user: current_user, namespace: 'funder') templates = [] if research_org.present? || funder_org.present? if funder_org.present? # Load the funder's template(s) minus the default template...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSi...
[ "0.73493844", "0.6946683", "0.69461197", "0.69279206", "0.6704445", "0.6690995", "0.6685804", "0.66850656", "0.66762763", "0.6671692", "0.6653982", "0.6629334", "0.6585589", "0.6514897", "0.6500345", "0.6495357", "0.64678735", "0.6395136", "0.63872653", "0.634433", "0.6314712...
0.61915827
35
p fuel_calc(12 2 p fuel_calc(14) 2 p fuel_calc(1969) 654 p fuel_calc(100756) 33583
def fuel_counter (arr) fuel = 0 arr.each { |num| fuel = fuel_calc(num) + fuel} fuel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_with_fuel\n s = 0\n res = calculate\n until res.zero?\n s += res\n @mass = res\n res = calculate\n end\n s\n end", "def fuel_needed(mass)\n return (mass / 3) - 2\nend", "def fuel_efficiency\n ((mileage - predecessor.mileage) / liter).round(1) if predecessor\n ...
[ "0.6945883", "0.66324496", "0.6533104", "0.6495911", "0.6468186", "0.6446515", "0.63040936", "0.62612635", "0.6254052", "0.6222496", "0.60700464", "0.60391855", "0.60261965", "0.60207987", "0.6015412", "0.6008479", "0.60050005", "0.60050005", "0.6000764", "0.60006696", "0.598...
0.6089528
10
FedEx requires a valid origin and destination postal code
def test_rates_for_locations_with_only_zip_and_country response = @carrier.find_rates( @locations[:bare_beverly_hills], @locations[:bare_ottawa], @packages.values_at(:wii) ) assert response.rates.size > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postal; end", "def has_valid_postal_code_pattern\n return unless format.is_a?(LocalPostal::Format)\n\n matches = Regexp.new(format.postal_code_pattern).match(postal_code)\n\n errors.add(:postal_code, 'is invalid') unless matches.to_a.length > 0\n end", "def zipvalidate(postcode)\n !!postcode.mat...
[ "0.62027544", "0.605358", "0.6010541", "0.59003025", "0.5845247", "0.5771444", "0.5748857", "0.5737123", "0.57286817", "0.5661782", "0.56276476", "0.56275773", "0.56099904", "0.55997187", "0.5569404", "0.55480987", "0.5527279", "0.5507415", "0.55012363", "0.55000407", "0.5484...
0.0
-1
fedex does not have address validation test service
def test_address_validation response = nil assert_nothing_raised do #response = @carrier_prod.validate_addresses({'address_from' => @locations[:ottawa], 'address_to' => @locations[:beverly_hills]}, :test=>false) @carrier_prod.validate_addresses({'address_from' => Location.new( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n ...
[ "0.6613365", "0.6610774", "0.6472669", "0.63607043", "0.6359073", "0.6317299", "0.6281584", "0.6226587", "0.6132301", "0.6061887", "0.6058762", "0.6058166", "0.5964738", "0.5957239", "0.5935526", "0.59220755", "0.59159863", "0.59139234", "0.59065586", "0.58189195", "0.578026"...
0.6689531
0
Most of the class omitted...
def each words.each { |word| yield( word ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def internal; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def custom; end", "def custom; end", "def weber; end", "def schubert; end", "def extra; end", "d...
[ "0.8528213", "0.73375493", "0.71811134", "0.71811134", "0.70860136", "0.69591403", "0.69591403", "0.69591403", "0.69591403", "0.6844172", "0.6844172", "0.67927", "0.67631465", "0.66532886", "0.6564587", "0.6557106", "0.645522", "0.645522", "0.645522", "0.645522", "0.6452458",...
0.0
-1
GET /locations/cities/1 GET /locations/cities/1.json
def show @locations_city = Locations::City.find(params[:id]) respond_to do |format| format.js # show.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cities\n\n @cities = City.where(\"country_id = ?\", params[:country_id])\n\n render json: @cities\n \n end", "def index\n @cities = City.where(state_id: params[:id])\n respond_to do |format|\n format.json { render :json => @cities.to_json }\n end\n end", "def index\n @citi...
[ "0.71308917", "0.71168804", "0.70772487", "0.6943086", "0.68744344", "0.6853033", "0.67012167", "0.67011476", "0.6652404", "0.6641932", "0.66290975", "0.6621562", "0.66146946", "0.65548", "0.6533142", "0.65134895", "0.64398783", "0.64326924", "0.6424744", "0.6418016", "0.6409...
0.61206496
45
GET /locations/cities/new GET /locations/cities/new.json
def new @locations_city = Locations::City.new respond_to do |format| format.js # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @city = City.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @city }\n end\n end", "def new\n @sitecity = Sitecity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sitecity }\n end\n...
[ "0.746036", "0.723099", "0.71423405", "0.7115102", "0.69758797", "0.695627", "0.6944574", "0.68873876", "0.68421423", "0.68401617", "0.6823004", "0.6823004", "0.6823004", "0.6823004", "0.6823004", "0.681698", "0.6816915", "0.6815319", "0.6811128", "0.67550987", "0.6752403", ...
0.7120926
3
POST /locations/cities POST /locations/cities.json
def create @locations_city = Locations::City.new(params[:locations_city]) index respond_to do |format| if @locations_city.save format.js { @notice = 'Registro guardado correctamente.' render 'index' } else format.js { @notice = 'Error al guardar el registro.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @city = City.new(city_params)\n\n if @city.save\n render json: @city, status: :created, location: @city\n # 'city model was successfully created.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end", "def create\n neo = Neography::Rest.new\n ...
[ "0.6613466", "0.6588333", "0.6574736", "0.6570435", "0.65188086", "0.64573556", "0.6452998", "0.64400405", "0.64400405", "0.64400405", "0.64307725", "0.6411886", "0.637223", "0.62832165", "0.6266202", "0.6251853", "0.621673", "0.6208332", "0.61931324", "0.6180176", "0.6100972...
0.62979555
13
PUT /locations/cities/1 PUT /locations/cities/1.json
def update @locations_city = Locations::City.find(params[:id]) index respond_to do |format| if @locations_city.update_attributes(params[:locations_city]) format.js { @notice = 'Registro actualizado correctamente.' render 'index' } else format.js { @notic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @city.update(city_params)\n render json: @city\n # 'city was successfully updated.'\n else\n render json: @city.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n \n if @city.update(:name => city_params[:name].strip, :s...
[ "0.66875726", "0.6407358", "0.63955", "0.6368466", "0.63652194", "0.6357132", "0.6346462", "0.63112587", "0.625716", "0.62462085", "0.6240592", "0.6218746", "0.62062395", "0.6191155", "0.6191155", "0.6191155", "0.6191155", "0.6191155", "0.61904365", "0.61741877", "0.61687595"...
0.6323201
7
DELETE /locations/cities/1 DELETE /locations/cities/1.json
def destroy @locations_city = Locations::City.find(params[:id]) @locations_city.destroy respond_to do |format| format.js { index render 'index' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to cities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @city.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_cont...
[ "0.72105867", "0.71198815", "0.7095405", "0.7059494", "0.69887304", "0.6979095", "0.68748415", "0.68698776", "0.68698776", "0.68698776", "0.68698776", "0.68698776", "0.6851813", "0.68445647", "0.68057436", "0.67589134", "0.67573977", "0.674716", "0.67397344", "0.67331123", "0...
0.66430867
27
Click the link for more information about the Kata problem.
def first_non_repeating_letter(s) return s if s.empty? puts s str = s.split("").each_with_object(Hash.new(0)) do | word, count | count[word] += 1 end str.each do |k, v| if k != ',' && k.match(/\W+/) str.delete(k) end if k.match( /^[[:lower:]]+$/ ) if str[k.upcase] > 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_on_predict_main_link\n\n click_on PREDICT_MAIN_LINK\n sleep(THREAD_SLEEP_2)\n\n end", "def help\n self.helplink.click\n end", "def click_approach_link\n click APPROACH_LINK\n end", "def link_to_enter_kase(kase=@kase)\n link_to_function(\"» \" + \"Start your case now!\".t, \"Lu...
[ "0.6320423", "0.6114715", "0.609328", "0.60154426", "0.60128146", "0.5993119", "0.59367585", "0.59289885", "0.5915391", "0.587307", "0.57757807", "0.5767105", "0.572663", "0.56425756", "0.5608541", "0.5607762", "0.5605597", "0.5501318", "0.549651", "0.5487682", "0.54764", "...
0.0
-1
Part 1 completed in class with Aditya Tilyalkar, later modified by me alone to improve code
def sum arr #this is slightly too easy... arr.sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def suivre; end", "def schubert; end", "def anchored; end", "def terpene; end", "def formation; end", "def villian; end", "def berlioz; end", "def king_richard_iii; end", "def jack_handey; end", "def schumann; end", "def stderrs; end", "def intensif...
[ "0.6261831", "0.6037034", "0.5908213", "0.5854167", "0.58265805", "0.5820431", "0.57610476", "0.5722176", "0.56131935", "0.56016624", "0.5584801", "0.55759585", "0.55347997", "0.55277216", "0.54997605", "0.549364", "0.54679054", "0.54679054", "0.54679054", "0.5452491", "0.545...
0.0
-1
Vault supports multiple instances of the 'approle' backend mounted concurrently. The mapreducey method repo_files gets the list of approle mounts, calls role_files() once for each of the mounts, then concatenates all those filenames into one big flat array
def repo_files @vault.sys.auths.select { |_,v| v.type == 'approle' } .keys .inject([]) { |acc, elem| acc + role_files(elem) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'ldap' }\n .keys\n .inject([]) { |acc, elem| acc + group_files(elem) }\n end", "def deployable_services\n Dir.glob(\"#{@repository_path}/policyfiles/*.rb\").map { |file| File.basename(file, '.rb') }\n end", "def fi...
[ "0.62699974", "0.5728378", "0.5502343", "0.54049355", "0.53961533", "0.5320347", "0.52636683", "0.5233455", "0.52296376", "0.5227457", "0.52180773", "0.5191952", "0.51902014", "0.51759577", "0.5170995", "0.5153903", "0.5123165", "0.51207113", "0.5098829", "0.5082487", "0.5061...
0.76089036
0
ask the user for an operation to perform perform the operation on two numbers output the result answer = Kernal.gets() puts Kernel.answer()
def prompt(message) Kernel.puts("=> #{message}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 /...
[ "0.78088427", "0.71433413", "0.7112343", "0.7089839", "0.7021694", "0.7012136", "0.6983766", "0.6943216", "0.6937945", "0.6913465", "0.68960494", "0.68774664", "0.6857037", "0.6834497", "0.6821023", "0.6818474", "0.68101007", "0.67927784", "0.6781348", "0.67574877", "0.675255...
0.0
-1
return a wining move if one is available, random otherwise
def get_move if(row_winning_move) return row_winning_move end if(column_winning_move) return column_winning_move end if(left_diag_winning_move) return left_diag_winning_move end if(right_diag_winning_move) return right_diag_winning_move end [rand(3), rand(3)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_move(board)\n empty_spot = winning_move(board)\n empty_spot ||= board.empty_position.sample\n end", "def winning_move\n simulate_move(@player_num)\n end", "def winning_move\n win_combo = WIN_COMBINATIONS.find do |combo|\n (@board.cells[combo[0]] == @token && @board.cells[c...
[ "0.78465176", "0.7747058", "0.74097705", "0.7394656", "0.7392576", "0.7384346", "0.73790413", "0.7309388", "0.7293863", "0.72273636", "0.7216927", "0.7214395", "0.71964645", "0.71954703", "0.7170285", "0.716967", "0.7167088", "0.7162015", "0.7138586", "0.7137035", "0.7098924"...
0.7170389
14
check the rows of the grid If the row has 2 of one mark (X or Y), and one nil value, retun the index of the nil value
def row_winning_move @board.grid.each_with_index do |row, r| other_nil_index = contains_two_marks(row) if(other_nil_index) return [r, other_nil_index] end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_empty_cell()\n\t$value_grid.each_with_index do |row, index_r|\n\t\trow.each_with_index do |col, index_c|\n\t\t\tif col.to_i == 0\n\t\t\t\treturn [index_r,index_c]\n\t\t\tend\n\t\tend\n\tend\n\treturn [$N,$N]\nend", "def contains_two_marks(values)\n\t\tif( (values.count(:X) == 2) || (values.count(:O) == ...
[ "0.7264211", "0.6740813", "0.67221236", "0.66683745", "0.6653137", "0.66522086", "0.6612824", "0.65868014", "0.65542406", "0.65411353", "0.6524983", "0.6515335", "0.6479274", "0.6479274", "0.64655703", "0.6410704", "0.6396278", "0.6378867", "0.637229", "0.635623", "0.6346326"...
0.723647
1
Take in array, see if the array contains 2 X or 2 Os If so, return the position of the other value if nil
def contains_two_marks(values) if( (values.count(:X) == 2) || (values.count(:O) == 2) ) if(values.include?(nil)) return values.index(nil) end end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ifind_magic(arr)\n return false if arr.size == 0\n s = arr[0]\n e = arr[-1]\n magic_arr = []\n i = 0\n while s < e\n return magic_arr if arr[i] != i\n if arr[i] == i\n magic_arr[i] = i\n end\n i += 1\n end\nend", "def position_taken?(arr, ind)\n\n if(arr[ind]==\"X\"||arr[ind]==\"O\")...
[ "0.6705727", "0.6552628", "0.646751", "0.6433225", "0.6346509", "0.6342042", "0.6329067", "0.6297444", "0.62876785", "0.6275044", "0.62568295", "0.62553614", "0.62394255", "0.6226622", "0.6214688", "0.62107074", "0.61993957", "0.61953676", "0.61720157", "0.61649", "0.61603224...
0.5875217
53
GET /products GET /products.json
def index @category = Category.find_by_id(params[:nodeid]) @products = Product.includes(:images).joins(:images).order("products.#{sort_column} #{sort_direction}"). paginate(:per_page => params[:rows] || 10, :page => params[:page]). where("products.path LIKE ?", "#{@category.nil? ? nil : @category.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def products\n request :public, :get, :products\n end", "def index\n @products = Product.all\n render json: @products\n end", "def index\n begin\n ...
[ "0.79500145", "0.7929853", "0.79054135", "0.77477723", "0.76619905", "0.7622153", "0.762195", "0.762195", "0.762195", "0.76070404", "0.75873625", "0.75828224", "0.7578298", "0.75750685", "0.7565435", "0.7565435", "0.7565435", "0.7565435", "0.7530454", "0.7523024", "0.75097287...
0.0
-1
GET /products/1 GET /products/1.json
def show @product = Product.includes(:images).find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @product } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n jso...
[ "0.77224106", "0.76329553", "0.76313764", "0.7607208", "0.75760156", "0.7552171", "0.7506385", "0.7484625", "0.745622", "0.74501616", "0.74376804", "0.7421124", "0.7362056", "0.7318765", "0.73185545", "0.73185545", "0.73185545", "0.7316062", "0.7311976", "0.73088664", "0.7294...
0.0
-1
Gets all the comments of a place ordered by date
def comments_of_place(place_id) where(:place_id => place_id).sort_by(&:date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n Comment.query({item_id: _id}, {sort: [[:created_at, -1]]})\n end", "def get_comments\n return Comment.where(design_problem_id: self.id).sort_by! { |x| x.created_at }.sort! { |a,b| b.created_at <=> a.created_at }\n end", "def comments\n pull_comments\n @comments_list\n end", ...
[ "0.73552245", "0.7111392", "0.7026029", "0.69416183", "0.6879495", "0.67948896", "0.6738119", "0.6738119", "0.6643391", "0.6640965", "0.65949774", "0.6547725", "0.6541289", "0.6524563", "0.65101725", "0.6484294", "0.6482851", "0.64806515", "0.6465134", "0.6445199", "0.6395069...
0.83053666
0
Returns false if the comment is an empty string or contains only whitespace characters
def validate_comment(comment) /^\s*$/.match(comment).nil? ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def è_un_commento?\n @contenuto.start_with? \"#\"\n end", "def is_comment?(line)\n line =~ /^\\s*#/\n end", "def comment?\n @contents[0] == :comment\n end", "def comment?\n return @assigned_paragraph_type == :comment if @assigned_paragraph_type\n return block...
[ "0.7442249", "0.73730904", "0.7205263", "0.7076494", "0.70063144", "0.6996858", "0.6882967", "0.68700516", "0.686438", "0.68244934", "0.67748815", "0.6756946", "0.67338943", "0.6712815", "0.6707407", "0.6670657", "0.666975", "0.6659381", "0.6616288", "0.661116", "0.65270144",...
0.84922206
0
Constructor, where we load up what we'll need
def initialize(args) # Remember our args reference @args = args # Set the start tick to something vaguely plausible @start_tick = @args.tick_count # Set our dimensions to contain ourselves @w = 202 @h = 64 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n \n end", "def initialize() end", "def initialize\n end", "def initialize\r\n\r\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", ...
[ "0.81010085", "0.7874493", "0.7838752", "0.7835977", "0.7832463", "0.7832463", "0.7832463", "0.7832463", "0.7832463", "0.7832463", "0.7768082", "0.7740493", "0.7656546", "0.76310945", "0.76310945", "0.76310945", "0.76310945", "0.76310945", "0.76310945", "0.76310945", "0.75570...
0.0
-1
Renderer, which outputs our 7segment display based on the time passing since the start_tick
def draw_override(ffi_draw) # So, work out how many seconds have passed since we started; there are # 60 ticks per second seconds = (@args.tick_count - @start_tick) / 60 hundreds = ((@args.tick_count - @start_tick) % 60) * 100 / 60 # Extract the four digits individually first, seco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_tick_debug_labels\n color = {r: 255, g: 255, b: 255, a: 255}\n active_color = {r: 255, g: 0, b: 0, a: 255}\n $gtk.args.outputs.labels << { x: 8, y: 720 - 48, text: \"Render mode (press X to change, Z for off): #{@rendering ? (@full_render ? 'Full re-render' : 'Double buffer re-render') :...
[ "0.61826545", "0.6126968", "0.59801745", "0.58993155", "0.58854467", "0.58221775", "0.5820509", "0.57372415", "0.57250774", "0.56393945", "0.56266606", "0.5624942", "0.56196624", "0.5606468", "0.5599647", "0.55882716", "0.5588251", "0.5582494", "0.5582494", "0.5582494", "0.55...
0.55985326
15
Initializes the service with the parameters needed and the micro services Params: therm:: therm used for the search location:: location for the search
def initialize(therms, location) @github = Github::Service.new(therms, location) @stackoverflow = Stackoverflow::Service.new(therms, location) @acuk = AcUk::Service.new('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize()\n\t\tsuper\n\t\tself.servicekinds = []\n\t\tself.status = ''\n\t\tsetup_known_services\n\t\tload_rc\n\t\tself\n\tend", "def search_service\n Blacklight::SearchService.new(config: blacklight_config, user_params: {})\n end", "def initialize\n @ewallet_services = {}\n build_service...
[ "0.64773506", "0.6177798", "0.6160197", "0.60930675", "0.6047207", "0.5986605", "0.59801847", "0.59653497", "0.59588313", "0.5956914", "0.5952482", "0.59287053", "0.5904621", "0.59006435", "0.58757305", "0.5873558", "0.58615196", "0.5823972", "0.5823972", "0.5816348", "0.5813...
0.70733005
0
Invokes the micro services to operate and stores all the retrieved data
def fetch @github.fetch @stackoverflow.fetch @acuk.fetch @jobs = data.shuffle end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n handle_options()\n execute_operation()\n end", "def perform\n # used to make request to get data from AWS API\n response = CurlRequest.new(URL).post\n Rails.logger.info \"==============#{response}============\"\n body = JSON.parse(response.body)\n\n # Calling Service to crea...
[ "0.6774531", "0.6703294", "0.6673478", "0.621402", "0.6184513", "0.61155015", "0.60983557", "0.60969687", "0.6080446", "0.6080446", "0.60630506", "0.60511655", "0.6043912", "0.6035963", "0.6035502", "0.5993867", "0.59766257", "0.59591144", "0.58920074", "0.58525604", "0.58277...
0.0
-1
Selects only a part of the results
def data @github.jobs[0..3] + @stackoverflow.jobs[0..3] + @acuk.jobs[0..3] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_by(how, what); end", "def select; end", "def select; end", "def select(*) end", "def select(*rest) end", "def select(*rest) end", "def select( &block )\r\n\t\t\treturn @contents.select( &block )\r\n\t\tend", "def select_all; end", "def select\n execute_only(:select)\n end", "de...
[ "0.6777757", "0.66606474", "0.66606474", "0.64751464", "0.6395256", "0.6395256", "0.6299806", "0.6238203", "0.6093436", "0.5969434", "0.58652323", "0.5844014", "0.5841386", "0.58052355", "0.57977116", "0.57801753", "0.57801753", "0.5704045", "0.5654114", "0.5647039", "0.55993...
0.0
-1
the maximum number of iterations needed to sort an an array by bubble method is n1 where n is the length of the array After each i pass, the last i items in the array are already sorted and therefore are ignored in the bubble sort algorithm
def bubble_sort (unsorted_array) iterations_count = 0 while iterations_count < unsorted_array.length i = 0 changes = false unsorted_array.each do break if i > (unsorted_array.length - 2 - iterations_count) if unsorted_array[i] > unsorted_array[i+1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bubble_sort!(array)\n iterations = 0\n last = 1\n loop do\n swapped = false\n 1.upto(array.size - last) do |index|\n iterations += 1\n next if array[index - 1] <= array[index]\n array[index - 1], array[index] = array[index], array[index - 1]\n swapped = true\n end\n last += 1...
[ "0.82457584", "0.8239507", "0.82354224", "0.8211297", "0.82099086", "0.8194417", "0.8185685", "0.81816494", "0.81738484", "0.81720984", "0.8153086", "0.81529224", "0.81435263", "0.81428236", "0.81400204", "0.8129168", "0.81273323", "0.8126289", "0.81189567", "0.81158125", "0....
0.79929775
55
0 for undo, 1 for redo
def do_history_action(index) if (@editor_history_index > -1) actions = @editor_history[@editor_history_index] i = actions.size - 1 while (i >= 0) type = actions[i][0] case type when "tile" tile = actions[i][index + 1] if (tile.image_index < 0) remove_tile(til...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undo\n\t\t\n\tend", "def undo\n\t\t\n\tend", "def can_undo?; @last_done >= 0; end", "def undo\n\t\t\t\t\n\t\t\tend", "def dont_undo\n @should_undo = false\n return nil\n end", "def undo\n $log.debug \" got UNDO call #{@pointer}, sz:#{@actions.size} \"\n return if @pointe...
[ "0.79664856", "0.79664856", "0.77372956", "0.77254516", "0.71512574", "0.7097761", "0.7076087", "0.7015652", "0.69813573", "0.6960708", "0.6939586", "0.69374216", "0.6921284", "0.68475395", "0.6838668", "0.680975", "0.6780231", "0.6772653", "0.6729433", "0.67286444", "0.67052...
0.0
-1
Draws background tiles to a singular image which only needs to be drawn once for the entire background
def load_editor_background x_extra = (self.width / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil y_extra = (self.height / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil @editor_background = Gosu.record(1, 1) do x = -x_extra while (x < EDITOR_WIDTH + x_extra) y = -y_extra while (y < EDI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_background_image\n split_tile_set_into_tiles\n create_image_list\n\n montage_cmd = \"montage #{@image_list.join(' ')} \"\n montage_cmd += \"-tile #{@maps[:background][0].size}x \"\n montage_cmd += \"-geometry 32x32+0+0 media/grid_one/full_map_image.png\"\n\n system(\"#{mont...
[ "0.76118433", "0.69612867", "0.6878659", "0.6805835", "0.67550576", "0.66796106", "0.6642839", "0.662567", "0.66237426", "0.6613319", "0.65783715", "0.6572422", "0.6563321", "0.6558359", "0.6541279", "0.6499699", "0.64818907", "0.6420625", "0.63632256", "0.6362937", "0.635488...
0.6747185
5
method definition with named arguments/parameters as default values
def greeting(name: "programmer", language: "ruby") puts "hello #{name}! We heard you love the #{language} program." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method (number, default1 = 1, default2 = 2)\nend", "def method (a=3, b=4)\r\nend", "def method (a=3, b)\r\nend", "def a_method(arg1, arg2='default value')\n do_stuff\n end", "def method (a=3,\r\n\tb)\r\nend", "def initialize_defaults(method_name)\n end", "def method_missing(*args)\n ...
[ "0.7535548", "0.74616086", "0.74255383", "0.734012", "0.7268366", "0.7193485", "0.7186397", "0.71149504", "0.7084653", "0.70821744", "0.70716614", "0.70208776", "0.70176667", "0.69430834", "0.6912063", "0.69111955", "0.6820999", "0.6786196", "0.67778015", "0.67778015", "0.677...
0.0
-1
GET /ftypes GET /ftypes.json
def index @ftypes = Ftype.all respond_to do |format| format.html # index.html.erb format.json { render json: @ftypes } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end", "def show\n @ftype = Ftype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { ...
[ "0.69075596", "0.6785976", "0.6739994", "0.65795505", "0.6459338", "0.63876337", "0.6358818", "0.6351437", "0.6304251", "0.6264733", "0.6252816", "0.6230413", "0.620264", "0.62024146", "0.6199442", "0.61983067", "0.6162289", "0.616116", "0.61085373", "0.6096494", "0.6092915",...
0.769376
0
GET /ftypes/1 GET /ftypes/1.json
def show @ftype = Ftype.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @ftype } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end", "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(pa...
[ "0.7634097", "0.68594265", "0.6793614", "0.655919", "0.65191895", "0.64989924", "0.6462401", "0.6461636", "0.6453656", "0.6335718", "0.6333663", "0.6313924", "0.6301521", "0.6301452", "0.62994766", "0.6295256", "0.6278086", "0.62700725", "0.6261212", "0.6234488", "0.61744255"...
0.7199391
1
GET /ftypes/new GET /ftypes/new.json
def new @ftype = Ftype.new respond_to do |format| format.html # new.html.erb format.json { render json: @ftype } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @fieldtype = Fieldtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fieldtype }\n en...
[ "0.77037483", "0.75072354", "0.74940497", "0.73838115", "0.73531103", "0.7254349", "0.7185765", "0.7176944", "0.7159241", "0.71556324", "0.71361685", "0.71343625", "0.7084399", "0.70702404", "0.69919777", "0.6960919", "0.69587857", "0.6950365", "0.6937226", "0.6933302", "0.69...
0.8032742
0
POST /ftypes POST /ftypes.json
def create @ftype = Ftype.create_ftype(params[:ftype], @user) if @ftype.save render json: {:code => 0} else render json: {:code => -1, :msg => "params invalid"} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def create\n @fender_type = FenderType.new(fender_type_params)\n\n respond_to do |format|\n if @fender_type.save\n format.html { redirect_to fender_types_path, notice: 'Fender type was successfully created.' }\n ...
[ "0.63062376", "0.62225705", "0.60885924", "0.6022539", "0.59225225", "0.59188515", "0.5900915", "0.58784395", "0.5876033", "0.5839085", "0.5834104", "0.5834104", "0.5831197", "0.5831197", "0.5814162", "0.5800862", "0.57829475", "0.57534903", "0.57505804", "0.5733769", "0.5730...
0.66842043
0
PUT /ftypes/1 PUT /ftypes/1.json
def update @ftype = Ftype.find(params[:id]) respond_to do |format| if @ftype.update_attributes(params[:ftype]) format.html { redirect_to @ftype, notice: 'Ftype was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @type.update(type_params)\n end", "def update\n respond_to do |format|\n if @fender_type.update(fender_type_params)\n format.html { redirect_to fender_types_path, notice: 'Fender type was successfully updated.' }\n format.json { render :show, status: :ok, location: @fender_...
[ "0.6558559", "0.6381545", "0.63745105", "0.6344485", "0.63071054", "0.62665415", "0.61895597", "0.61754966", "0.61399996", "0.61346525", "0.61281806", "0.6125522", "0.6115502", "0.61032116", "0.6096095", "0.6094785", "0.60865325", "0.60793364", "0.6074342", "0.607344", "0.605...
0.6805588
0
DELETE /ftypes/1 DELETE /ftypes/1.json
def destroy @ftype = Ftype.find(params[:id]) @ftype.destroy respond_to do |format| format.html { redirect_to ftypes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fish_type = FishType.find(params[:id])\n @fish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to fish_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foiltype = Foiltype.find(params[:id])\n @foiltype.destroy\n\n respond...
[ "0.7120561", "0.706571", "0.7049228", "0.70428574", "0.7034008", "0.6951386", "0.6949191", "0.6881581", "0.6875702", "0.68398815", "0.6838249", "0.68263257", "0.6817718", "0.6789326", "0.6764183", "0.67473865", "0.67435443", "0.67147017", "0.6708526", "0.67023146", "0.6696996...
0.7540244
0
so slow, but brings home the point
def is_prime?(num) ('1' * num) !~ /^1?$|^(11+?)\1+$/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leeway; end", "def leeway; end", "def anchored; end", "def ravel; end", "def surge; end", "def villian; end", "def pos() end", "def pos() end", "def pos() end", "def pos() end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def ...
[ "0.6184265", "0.6184265", "0.6156361", "0.60841143", "0.6075343", "0.5987004", "0.5907342", "0.5907342", "0.5907342", "0.5907342", "0.5885513", "0.5885513", "0.5885513", "0.5885513", "0.5885513", "0.5885513", "0.579104", "0.57780373", "0.5775286", "0.57297665", "0.57152075", ...
0.0
-1
Documentation URL returned by the API for some errors
def documentation_url data[:documentation_url] if data.is_a? Hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def documentation_url\n @error['documentation_url']\n end", "def documentation_url; end", "def link_documentation; end", "def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end", "def url\n raise\n end", "def valida...
[ "0.82958806", "0.76498604", "0.6773319", "0.6632166", "0.6570141", "0.6514394", "0.64489055", "0.6435607", "0.6411747", "0.63759625", "0.63051397", "0.623796", "0.6212155", "0.61976093", "0.6194338", "0.61762947", "0.61530983", "0.6139037", "0.6109946", "0.6065006", "0.606320...
0.670901
3
Status code returned by the GitHub server.
def response_status @response[:status] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_code\n response_value(:code)\n end", "def status_code\n STATUS_CODE\n end", "def status_code\n @response.status\n end", "def status_code\n @parser.status_code\n end", "def getStatusCode\n @_statusCode\n end", "def status_code\n data.status_code\n ...
[ "0.75552666", "0.7532894", "0.7387912", "0.73706937", "0.72696173", "0.7262525", "0.7239921", "0.7239921", "0.7170487", "0.70606476", "0.70434254", "0.70434254", "0.701736", "0.7016323", "0.69609284", "0.6958061", "0.6929303", "0.686829", "0.6809726", "0.6781646", "0.6774696"...
0.6451904
38
Headers returned by the GitHub server.
def response_headers @response[:response_headers] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headers\n response.headers\n end", "def response_headers\n @headers\n end", "def headers\n cfg_get(:headers)\n end", "def headers\n @headers ||= self.class.beautify_headers(@net_http_res.to_hash)\n end", "def getHeaders\n @headers\n end", "def g...
[ "0.7680376", "0.73753047", "0.73568135", "0.7325888", "0.72716844", "0.7242811", "0.7239361", "0.72235477", "0.7217944", "0.7212441", "0.72029424", "0.7188074", "0.7170943", "0.71222854", "0.71222854", "0.71080226", "0.7057032", "0.7057032", "0.7057032", "0.7057032", "0.70570...
0.7159288
13
Body returned by the GitHub server.
def response_body @response[:body] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body\n data[:body]\n end", "def body\n response.body\n end", "def body\n fetch\n @body\n end", "def body\n response&.body.to_s\n end", "def body\n response.body || ''\n end", "def body\n @http_response.body\n end", "def body\n resp...
[ "0.7350448", "0.7257199", "0.72205514", "0.7189442", "0.7177091", "0.7157086", "0.7104355", "0.7092582", "0.7092582", "0.7046664", "0.6984768", "0.69527054", "0.6880886", "0.6869778", "0.68633527", "0.6851398", "0.6851398", "0.684362", "0.68249667", "0.67743164", "0.67477", ...
0.691111
12
Delivery method for the user's OTP
def password_delivery @password_delivery ||= delivery_method_from_header end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_otp\n end", "def sms_otp\n end", "def deliver_otp\n return unless persisted?\n sms_otp || email_otp || raise(NotImplementedError, self)\n end", "def buy_now\n respond_to do |format|\n puts(\"testing .............\")\n otp = rand(10 ** 9...10 ** 10).to_s\n # User...
[ "0.78169423", "0.774644", "0.7584211", "0.7141579", "0.71011174", "0.6612043", "0.65018433", "0.6443368", "0.61989176", "0.6144319", "0.61213773", "0.60948795", "0.6022239", "0.60168266", "0.6000237", "0.59807444", "0.594206", "0.5931065", "0.59214216", "0.5915132", "0.590561...
0.64311904
8
Listing of all volunteering positions.
def index flash[:notice] = 'Due to an overwhelming response, we are running out of positions to fill. You may still apply, but doing so will add you to our waiting list. You will only be contacted if a position opens up and you are its next candidate.' if @user and @user.is_elevated? @volunteer_positions ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @positions = current_user.positions.all\n end", "def index\n @committee_positions = CommitteePosition.all\n end", "def index\n @entried_positions = EntriedPosition.all\n end", "def volunteers\n @users = User.valid_users.volunteers.page(params[:page])\n end", "def index\n ...
[ "0.67555577", "0.66268384", "0.62909997", "0.62229556", "0.617347", "0.60189325", "0.59872925", "0.58725244", "0.58686495", "0.57955444", "0.57790494", "0.5759777", "0.5741048", "0.57317775", "0.57083356", "0.56936157", "0.5668213", "0.5648845", "0.56286776", "0.56235343", "0...
0.6831575
0
Show a specific volunteer position.
def show authorize @volunteer_position respond_with(@volunteer_position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_position(position, wearer = \"You\")\n\n if wearer == \"You\"\n eq = @equipment[position]\n eq = eq.compact if eq\n if eq and not eq.empty?\n eq = eq.collect {|o| @inventory[o].name }.simple_list\n \"\\t#{eq} on your #{nice(position)}.\"\n else\n nil\n end\...
[ "0.6386042", "0.61500126", "0.6108361", "0.6093253", "0.5982997", "0.5982997", "0.5982997", "0.591068", "0.5905093", "0.5882297", "0.5874419", "0.58609486", "0.58218175", "0.5796411", "0.57951665", "0.5768305", "0.5754638", "0.5745799", "0.57291365", "0.57228047", "0.5694759"...
0.75341123
0
Open page to create a new volunteer position.
def new @volunteer_position = VolunteerPosition.new authorize @volunteer_position respond_with(@volunteer_position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @position = Position.new\n @position.layout_template_id = params[\"layout_template_id\"]\n\n render :update do |page|\n page.insert_html :top, \"dialog_here\", :partial => \"positions/new\",\n :locals => { :position => @position }\n end\n end", "def create\n @...
[ "0.6491136", "0.64908725", "0.6147612", "0.60355806", "0.6007081", "0.5994236", "0.5960289", "0.59348583", "0.59183466", "0.58977276", "0.58796567", "0.5867238", "0.5843833", "0.5823314", "0.5822718", "0.5817307", "0.58090925", "0.5772531", "0.5767021", "0.5756496", "0.575349...
0.6822244
0
Open page to edit a volunteer position.
def edit authorize @volunteer_position end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\t@page_name = \" - Edit Show\"\n\tend", "def show\n authorize @volunteer_position\n respond_with(@volunteer_position)\n end", "def edit\n\t\t# must have admin access or be in the course\n\tend", "def edit\r\n \r\n end", "def edit\n \n end", "def edit\r\n end", "def ed...
[ "0.66041934", "0.63549185", "0.6354877", "0.63526994", "0.6349213", "0.6332835", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", "0.6312588", ...
0.6987812
0
Create the volunteer position and insert it into the database.
def create @volunteer_position = VolunteerPosition.new(volunteer_position_params) authorize @volunteer_position @volunteer_position.save respond_with(@volunteer_position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_positions\n create_player_position\n create_target_position\n create_select_position\n create_object_position\n end", "def create\n @type= params[:type]\n @student= current_user\n @position = Position.where(position_type: @type)\n @position.each do |pos|\n if !params[pos....
[ "0.6141606", "0.6001139", "0.5981267", "0.59535825", "0.5905079", "0.5895652", "0.5882113", "0.58751214", "0.58477163", "0.58442926", "0.5819638", "0.58021444", "0.5800629", "0.5792324", "0.57756823", "0.5736498", "0.57150704", "0.5711477", "0.5691959", "0.5687382", "0.567267...
0.70893073
0
Update an existing volunteer position record in the database.
def update authorize @volunteer_position @volunteer_position.update(volunteer_position_params) respond_with(@volunteer_position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n update_helper(@position, position_params)\n end", "def update\n @position = Position.find(params[:id])\n\n respond_to do |format|\n if @position.update_attributes(params[:position])\n format.html { redirect_to(admin_position_path, :notice => 'Position was successfully updated.'...
[ "0.6734338", "0.63759726", "0.6320697", "0.6275042", "0.62598", "0.62351733", "0.61647785", "0.6146654", "0.610208", "0.6050268", "0.60497785", "0.6018555", "0.6010296", "0.6000092", "0.5995043", "0.595703", "0.5933943", "0.5928015", "0.5920077", "0.5917851", "0.58973414", ...
0.76326525
0
Destroy an existing volunteer position record in the database.
def destroy authorize @volunteer_position @volunteer_position.destroy respond_with(@volunteer_position) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n destroy_helper(@position)\n end", "def destroy\n @executive_position = ExecutivePosition.find(params[:id])\n @executive_position.destroy\n\n respond_to do |format|\n format.html { redirect_to(executive_positions_url) }\n format.xml { head :ok }\n end\n end", "def destr...
[ "0.7234255", "0.6934174", "0.69128615", "0.68307763", "0.67263657", "0.6724775", "0.6717237", "0.6702437", "0.6686989", "0.6674457", "0.6664121", "0.6611401", "0.65854824", "0.6564455", "0.65444314", "0.6526891", "0.6524157", "0.65217996", "0.65186435", "0.65079564", "0.65079...
0.7637476
0
Define the paramaters permitted when submitting a request to this resource.
def volunteer_position_params params.require(:volunteer_position).permit(:name, :description, :objective, :duties, :requirements, :contact, :contact_email, :visible) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_params\n params.require(resource_name).permit(*permitted_params)\n end", "def request_params; end", "def request_params\n params.fetch(:request, {}).permit(:title, :description, :value)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", ...
[ "0.7187461", "0.7155262", "0.71369624", "0.7056069", "0.7056069", "0.700785", "0.7003891", "0.69905573", "0.6982503", "0.6955095", "0.6949072", "0.6942196", "0.6908963", "0.68804294", "0.6871497", "0.68540984", "0.6847689", "0.6831834", "0.6823913", "0.6817071", "0.67820776",...
0.0
-1
When a user is not authorized to do something in the context of volunteer positions, redirect them to the index & notify them why they're being redirected to the index.
def not_authorized redirect_to volunteer_positions_url, alert: "You are not authorized to perform the requested action!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_permissions\n redirect_to index_path, alert: lack_permission_msg unless admin_or_organizer?\n end", "def user_not_authorized\n #flash[:alert] = \"You are not cool enough to do this - go back from whence you came.\"\n redirect_to root_path\n end", "def user_not_authori...
[ "0.71390384", "0.7132217", "0.7047744", "0.70316374", "0.7031517", "0.7020649", "0.6988739", "0.6954298", "0.6927649", "0.6927419", "0.69021195", "0.68963563", "0.68640333", "0.68589324", "0.6852843", "0.6846773", "0.68192863", "0.6813877", "0.68003535", "0.6753168", "0.67502...
0.79055953
0
initial effect to be used: flips: flip01, flip02, flip03, flip04 rotations: rotation01, rotation02, rotation03, rotation04, rotation05 multiflips: multiflip01, multiflip02, multiflip03 cubes: cube01, cube02, cube03, cube04 unfolds: unfold01, unfold02 others: other01, other02, other03 ,other04 ,other05 ,other06 ,other07...
def initialize(parameters = {}) @id = parameters.fetch(:id, 'demo') @images_urls = parameters.fetch(:images_urls, DEMO_IMAGES) @effect = parameters.fetch(:effect, 'flip01') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_flip\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n if @acts[1] == :toggle\n @flip = !@flip \n elsif @acts[1] == :ori\n @flip = default_flip\n else\n @flip = @acts[1]\n end\n end", "def setup_flip\n return unless PONY::ERRNO::check_sequence(curren...
[ "0.61270976", "0.609875", "0.59918445", "0.5598198", "0.5567312", "0.5467847", "0.53565776", "0.5297529", "0.5267609", "0.5238928", "0.5209945", "0.5167233", "0.51541233", "0.51101846", "0.5087378", "0.49987063", "0.49698266", "0.49696618", "0.4969011", "0.49673927", "0.49552...
0.5339781
7
rendering images without rails slider effects
def to_s @result_html = '' @images_urls.each do |url| @result_html += "<img src=\"#{url}\"/>" end @result_html.html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images; end", "def render_image\n render_image_iterm2\n end", "def images\n end", "def image; end", "def imagefiltereffect\n\t\trender :imagefiltereffect\n\tend", "def to_erb\n url = @img['src']\n url.sub!(\"/images/\", \"\")\n data_pixel = ''\n\n # resolve special data-pixel-den...
[ "0.71274054", "0.70919245", "0.6893264", "0.650763", "0.646668", "0.64464164", "0.64294815", "0.6406973", "0.63614416", "0.63614416", "0.6290726", "0.62396", "0.6225523", "0.61896515", "0.61715794", "0.61715466", "0.6165895", "0.6165895", "0.6162341", "0.6140082", "0.61234844...
0.0
-1
rendering images with rails slider effects
def render @result_html = '' @result_html += "<div class=\"rs-container #{self.class.name}\" id=\"#{@id}\">" @result_html += render_controls.gsub("<option value=\"rs-#{@effect}\">", "<option value=\"rs-#{@effect}\" selected=\"selected\">") @result...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slider(count, options = {})\n return if options[:visibility] == :hide\n case count\n when :one\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"\n items =\n (content_tag :li, image_1)\n when :two\n image_1 = content_tag :img, nil, :src => \"assets/slide-1.png\"...
[ "0.68591946", "0.67833", "0.67618203", "0.67485565", "0.6579519", "0.6423235", "0.63803834", "0.63642544", "0.628265", "0.6281103", "0.6281103", "0.622841", "0.61614347", "0.6145651", "0.6126256", "0.6082434", "0.59879166", "0.59821975", "0.5950535", "0.5917473", "0.5915801",...
0.6327036
8
Indexer self.indexer = DogBiscuits::DigitalArchivalObjectIndexer Metadata include DogBiscuits::DigitalArchivalObjectMetadata
def photograph? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_elasticsearch\n elasticsearch_doc = super\n [:mime_type,:content_type,:file_type,:storage_location_id,:file_size,:file_entity_type,:file_name].each do |method|\n elasticsearch_doc[method.to_s] = self.send(method)\n end\n elasticsearch_doc\n end", "def indexed\n meta(index: true)\n...
[ "0.6539415", "0.642738", "0.6359456", "0.6359456", "0.6037933", "0.58675665", "0.57698935", "0.57448137", "0.573372", "0.56895816", "0.56895816", "0.56895816", "0.56895816", "0.56895816", "0.56895816", "0.56895816", "0.5651362", "0.5643048", "0.56036854", "0.5599362", "0.5561...
0.0
-1
Virtually makes this publicly global for the app.
def add_restriction(name, condition, &default_block) @ACL ||= AccessControlList.new @ACL.add_restriction(name, condition, default_block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global\n raise NotImplementedError\n end", "def global; end", "def global?; true end", "def public; end", "def public; end", "def self\n @define_self = true", "def global?; end", "def public!\n self.status = Status::PUBLIC\n end", "def internal; end", "def main\n s...
[ "0.760188", "0.72612417", "0.6910067", "0.67320967", "0.67320967", "0.66866344", "0.6619798", "0.64091974", "0.6304256", "0.6293452", "0.62629205", "0.62477946", "0.6242847", "0.6219604", "0.6219604", "0.6219604", "0.61851627", "0.61602694", "0.61443067", "0.60969186", "0.609...
0.0
-1
If logged in, teleport to own store, If not logged in, teleport to accessed_store's login page
def go_to_where_you_belong end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in_personnel\n unless logged_in?\n store_location\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_location\n redirect_to root_url\n end\n end", "def logged_in_user\n unless logged_in?\n store_loca...
[ "0.7205233", "0.71824104", "0.71818906", "0.71818906", "0.705815", "0.70288336", "0.69962794", "0.6896624", "0.68825173", "0.6786944", "0.67853147", "0.67681766", "0.67569834", "0.67542624", "0.6743371", "0.6742726", "0.6730687", "0.6730237", "0.672851", "0.6724384", "0.67228...
0.0
-1
=begin rdoc Get the full paths for the included asset files =end
def paths_for(controller=:_all,action=:_all) return files_for(:paths,controller,action) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end", "def asset_paths\n @asset_paths ||= [prefix] \n end", "def asset_paths\n search_path.children.select { |n| C...
[ "0.7600673", "0.7409874", "0.72679096", "0.7160492", "0.709765", "0.70918506", "0.7080552", "0.7066345", "0.6980002", "0.6940116", "0.69261426", "0.69261426", "0.67932", "0.6780415", "0.6764529", "0.67476285", "0.6724168", "0.66479903", "0.66108185", "0.6587922", "0.6556807",...
0.0
-1
=begin rdoc Create all cache files =end
def create_cache_files @cache_path_names = {} each_file_set(:create_cache_file) write_cache_path_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_dir; end", "def cache_dir; end", "def create_cache(dir, hostname, cache)\n # Let's create the cache directory if it does exists.\n Dir.mkdir(dir) unless File.exist?(dir)\n\n # Create the file and fill it with the cache\n cachefilename = File.join(dir, \"#{hostname}.yml\")\n cachefile = File.new(...
[ "0.6995876", "0.6995876", "0.696928", "0.69262916", "0.6806574", "0.6758684", "0.6758684", "0.6758684", "0.6758684", "0.6758684", "0.6758684", "0.6758684", "0.6663119", "0.66596663", "0.66596663", "0.6644634", "0.66338384", "0.6608681", "0.66023034", "0.6451106", "0.6419432",...
0.8297273
0
=begin rdoc Simply calling cache_path_name for each controller/action will cache the resulting path to the file. We do this on startup so that there is no performance hit the when this path needs to be generated =end
def get_cache_path_names if File.exists?(CachedAssetPackager::Config.send("#{self.asset_type}_cache_path_config")) @cache_path_names = YAML::load(File.read(CachedAssetPackager::Config.send("#{self.asset_type}_cache_path_config"))) else @cache_path_names = {} each_file_set(:cache_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_path_name(controller=:_all,action=:_all)\n controller, action = normalize_request_params(controller,action)\n \n # if we have cached the \n return @cache_path_names[\"#{controller}_#{action}\"] if @cache_path_names[\"#{controller}_#{action}\"]\n \n # let's get the latest rev...
[ "0.76237994", "0.7499077", "0.7258381", "0.7003687", "0.6989925", "0.6989925", "0.690846", "0.6896268", "0.6859765", "0.6769589", "0.6741648", "0.6690543", "0.667101", "0.66615266", "0.6649274", "0.6536243", "0.65270853", "0.6499382", "0.64959586", "0.6493903", "0.64844465", ...
0.6627994
15
=begin rdoc Generate the unique path for a cache file =end
def cache_path_name(controller=:_all,action=:_all) controller, action = normalize_request_params(controller,action) # if we have cached the return @cache_path_names["#{controller}_#{action}"] if @cache_path_names["#{controller}_#{action}"] # let's get the latest revision number of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_path\n File.join @path, 'cache.ri'\n end", "def cache_dir; end", "def cache_dir; end", "def cache_file_path\n raise IOError.new 'Write permission is required for cache directory' unless File.writable?(@args[:cache_directory])\n \"#{@args[:cache_directory]}/#{Digest::SHA1.hexdigest((@a...
[ "0.79336447", "0.7566668", "0.7566668", "0.7551651", "0.75212216", "0.7477417", "0.7400813", "0.73773074", "0.72875834", "0.7259907", "0.7246281", "0.7189557", "0.7162376", "0.70612556", "0.7059373", "0.6967362", "0.6965273", "0.6932679", "0.69202614", "0.69020486", "0.687685...
0.6315122
65
=begin rdoc Expand the paths for a set of files == Options :files (required) a list of files to expand paths for
def create_cache_file(controller=:_all,action=:_all) files = paths_for(controller,action).uniq path_name = cache_path_name(controller,action) # if we already have the file, we can just skip this step if File.exists?(path_name) puts "Skipped creating/updating #{controller}::#{actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(dir, files)\n files.map{|f| File.join(dir,f)}\nend", "def expand(*args)\r\n File.expand_path(*args)\r\n end", "def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n ...
[ "0.787215", "0.6892833", "0.68527025", "0.6765619", "0.6376877", "0.63350844", "0.6289904", "0.62582743", "0.616852", "0.6135447", "0.609556", "0.6024375", "0.6008082", "0.59846514", "0.59465206", "0.59465206", "0.5920352", "0.5896252", "0.58895874", "0.58274806", "0.5794259"...
0.0
-1
=begin Extracts the name of the asset type from the classname E.g. CachedAssetPackager::JavascriptAssetSet.new(files).asset_type => :javascript =end
def asset_type return self.class.to_s.gsub(/^.*::/,'').gsub(/AssetSet/,'').gsub(/([^^])([A-Z])/,'$1_$2').downcase.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_class_lookup\n return ASSET_CLASS_LOOKUP\n end", "def type_img\n \"/assets/file-types/#{self.asset_type}.png\"\n end", "def type_name\n File.basename(@path, '.rb').to_sym\n end", "def asset_type\n \n if asset_content_type==\"application/pdf\"\n return :pdf\n el...
[ "0.66709334", "0.66301465", "0.6602187", "0.65041757", "0.6478454", "0.6452104", "0.63858116", "0.6354996", "0.63478136", "0.6325418", "0.62578815", "0.6223374", "0.6193614", "0.61886376", "0.6176042", "0.6173859", "0.6173827", "0.6164726", "0.613957", "0.61342007", "0.611766...
0.8008738
0
=begin rdoc Apply a method to each file =end
def each_file_set(method) # default cache file self.send(method) @files.keys.each do |controller_name| #skip default next if controller_name == :defaults # each controller's default self.send(method,controller_name) @files[controller_name].key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def all_files; end", "def all_files; end", "def files_for(klass); end", "def new_files; end", "def each_filename; end", "def file_list\n end", "def modified_files; end", "def files...
[ "0.74064344", "0.74064344", "0.74064344", "0.74064344", "0.74064344", "0.74064344", "0.71585447", "0.71585447", "0.6911625", "0.68602425", "0.68054587", "0.6704984", "0.6679863", "0.66346604", "0.6614867", "0.6537317", "0.6537317", "0.647732", "0.647732", "0.64193094", "0.638...
0.5978372
61
=begin rdoc Normalize a controller/action combination so that we do not need to store separate info for each controller/action combination, just for ones that have a unique file set =end
def normalize_request_params(controller_name,action_name) return :_all, :_all unless @files[controller_name.to_sym] return controller_name.to_sym, :_all unless @files[controller_name.to_sym][action_name.to_sym] return controller_name.to_sym, action_name.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_controller_action_attributes\n return if controller_action.blank?\n route = controller_action.split('#')\n self.controller, self.action = route.first, route.last\n end", "def normalize_controller!; end", "def normalize_controller_action_id!\n use_recall_for(:controller) || return\n ...
[ "0.6722025", "0.6609406", "0.6235672", "0.6192032", "0.60591745", "0.5995101", "0.5963814", "0.59023476", "0.5805986", "0.57260245", "0.5719504", "0.5697607", "0.56811225", "0.5657367", "0.56550187", "0.56484866", "0.5630728", "0.56004006", "0.56004006", "0.56004006", "0.5526...
0.69963473
0
Expires the cache fragments in the show method
def expire if params[:id].blank? expire_index else @place = Place.find(params[:id]) expire_fragment(:action => "photos", :part => "photos_#{@place.id}") expire_fragment(:action => "show", :part => "photos_#{@place.id}") expire_fragment(:action => "photos", :part => "other_photos_#{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire\n if params[:id].blank?\n expire_index\n else\n @album = Album.find(params[:id])\n expire_fragment(:action => \"show\", :part => \"description_#{@album.id}\")\n expire_fragment(:action => \"show\", :part => \"photos_#{@album.id}\")\n expire_fragment(:action => \"photos\", ...
[ "0.7392443", "0.7377926", "0.7256958", "0.7168618", "0.7162888", "0.7050141", "0.6779251", "0.6773152", "0.6749805", "0.6721819", "0.66486573", "0.6647293", "0.6617852", "0.6594211", "0.6583893", "0.65714055", "0.6570908", "0.6565191", "0.6531043", "0.6499371", "0.64938384", ...
0.6829041
6
Expires the description fragment in the show method
def expire_desc @place = Place.find(params[:id]) expire_fragment(:action => "show", :part => "description_#{@place.id}") expire_fragment(:action => :show, :part => "nearby_places_#{@place.id}") respond_to do |format| format.html { redirect_to(@place, :notice => 'Place description was cleared.') } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expire_desc\n @trip_report = TripReport.find(params[:id])\n expire_fragment(:action => :show, :part => \"description_#{@trip_report.id}\")\n respond_to do |format|\n format.html { redirect_to(@trip_report, :notice => 'Trip cache was cleared.') }\n format.xml { head :ok }\n end\n end", ...
[ "0.73444974", "0.64178497", "0.63370943", "0.6318137", "0.6289942", "0.62625533", "0.62594944", "0.62594944", "0.62458956", "0.62032014", "0.6189239", "0.61284596", "0.61200386", "0.60512", "0.60336316", "0.60336316", "0.6028692", "0.6024547", "0.60023177", "0.59983003", "0.5...
0.76191396
0
Returns partial html with photo thumbs. Requested by jquery after page scroll
def photos @place = Place.find(params[:id]) unless read_fragment(:part => "photos_#{@place.id}") @photos = @place.title_photos.includes(:user).includes(:title_places) @has_photos = @photos.length != 0 @photo_appearances = @place.photo_appearances.includes(:user).includes(:title_places) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n session[:flickr_page] ||= 1\n session[:flickr_per_page] ||= 5\n \n get_photos \n session[:flickr_page_total] ||= @photoset.pages\n \n if params[:scroll]\n @scroll = params[:scroll].to_s\n if @scroll == \"left\"\n scroll_left\n elsif @scroll == \"right\"\n ...
[ "0.6134342", "0.602204", "0.5973519", "0.59609705", "0.5901039", "0.5895762", "0.58929527", "0.57380664", "0.5734262", "0.57304674", "0.5705753", "0.5636891", "0.56301224", "0.5607886", "0.5593756", "0.5575353", "0.55690014", "0.55670863", "0.55669904", "0.5551958", "0.555142...
0.5260406
84
Search for places within this place if it has an area
def place_search @places = [] area = params[:area_id].blank? ? nil : Place.find(params[:area_id]) if area.present? && area.area > 0 search_text = Riddle::Query.escape(help.strip_links(params[:search])) results = Place.search(search_text, :field_weights => { :name => 10 }) results.each do ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containing(place_id, start = 0, limit = 25)\n place_id = clean_for_search(as_id(place_id))\n results = PublicEarth::Db::Collection.search_for(\"place_id:#{place_id}\", :qt => 'standard', \n :start => start && start.to_i, :rows => limit && limit.to_i > 0 && limit.to_i || 25)\n ...
[ "0.648981", "0.64833546", "0.64175326", "0.6331954", "0.63228315", "0.62848616", "0.62826324", "0.61853373", "0.6069768", "0.606194", "0.6041283", "0.6028123", "0.6028123", "0.59986454", "0.5983806", "0.59689987", "0.59634733", "0.5949097", "0.59474033", "0.5915817", "0.58616...
0.7296446
0
If we create a new place, the public list of place must be regenerated
def after_create (@place.class::SORT_OPTIONS.keys+[nil]).each do |sort| expire_fragment(send("#{@place.class.to_s.tableize}_url", :sort => sort).gsub("http://", "")) (@place.area_ids + [nil]).each do |area_id| expire_fragment(:controller=>"places", :action=>"index", :sort => sort, :area_id => ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_place(place)\n if place.validate && !@places.include?(place.name) \n @places[place.name] = place.id\n @objects[place.id] = place\n place.net = self\n return place.id\n end\n changed_structure\n return false\n end", "def new_place\...
[ "0.6860353", "0.6478752", "0.63932353", "0.6370171", "0.6306676", "0.6242144", "0.61839217", "0.6157495", "0.6141874", "0.6112607", "0.6076177", "0.6054836", "0.60463864", "0.6002839", "0.5990456", "0.5988438", "0.5983715", "0.5983715", "0.5979938", "0.5979774", "0.59768736",...
0.61799175
7
If we update an existing place, the public list of updated places must be regenerated
def after_update expire_fragment(:controller => 'main', :action => 'updated', :part => 'places') expire_fragment(:controller=>"places", :action=>"show", :id => @place, :part => "google_map_#{@place.id}") expire_fragment(:controller=>"places", :action=>"show", :id => @place, :part => "description_#{@place.id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @places = args[:places] if args.key?(:places)\n end", "def update_places(place)\n @places_ref ||= get_places(place)\n Rails.logger.debug \"in update_place: ref: #{@places_ref.inspect}\"\n @places_ref.each_with_index do |place, index|\n if place[:id] ...
[ "0.70831776", "0.70439875", "0.6995159", "0.6803346", "0.67748505", "0.67748505", "0.67748505", "0.67748505", "0.6763105", "0.6739277", "0.65592176", "0.6541453", "0.6532242", "0.6514445", "0.6475424", "0.6475424", "0.6475424", "0.6453579", "0.6446837", "0.64059067", "0.64016...
0.59597397
80
Test an ldap connexion
def ldap?(auth, username, password) require 'net/ldap' raise 'Missing ldap base' unless auth[:base] @ldap = Net::LDAP.new auth raise format('Ldap connexion fail %s', ldap.inspect) unless ldap.bind dn = ldap_search(auth[:base], filer_strip(auth[:filter], username)) ldap.authenticate(dn, passw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_connection\n ldap_con = initialize_ldap_con(self.account, self.account_password)\n ldap_con.open { }\n rescue Net::LDAP::LdapError => text\n raise \"LdapError: %s\" % text\n end", "def test_connection\n\t\tldap_con = initialize_ldap_con(self.account, self.encrypted_password)\n\t\tldap_con.ope...
[ "0.83403397", "0.81620854", "0.7503035", "0.7114964", "0.67675793", "0.6716648", "0.66441625", "0.6601597", "0.65037066", "0.6482165", "0.64381534", "0.63821197", "0.63656807", "0.6334457", "0.62047064", "0.62009877", "0.6187543", "0.6176636", "0.61408985", "0.6135606", "0.61...
0.63624716
13
request:: Rack::Request response:: Rack::Response options:: Options hash Create a new Controller. NOTE: options will be passed to Resource
def initialize(request, response, options={}) raise Forbidden if request.path_info.include?('..') @request = request @response = response @options = options @dav_extensions = options.delete(:dav_extensions) || [] @always_include_dav_header = options.delete(:always_include_dav_head...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform(request, options); end", "def new\n @request = Request.new\n respond_with(@request)\n end", "def new(options = {}, &block)\n respond_with(build_resource, options, &block)\n end", "def initialize(options, controller, action)\n self.options = options\n self.controller = con...
[ "0.62731785", "0.61493045", "0.60827", "0.59852874", "0.5966655", "0.59125096", "0.59020925", "0.58914304", "0.58739626", "0.58598906", "0.5792691", "0.57338583", "0.57136106", "0.5694946", "0.5692919", "0.5687801", "0.56831086", "0.5682345", "0.56651574", "0.5651801", "0.562...
0.0
-1
s:: string Escape URL string
def url_format(resource) ret = URI.escape(resource.public_path) #Added this to make cadaver work. This fix works with Cadaver and the windows and mac clients. ret = ret.gsub("(", "%28").gsub(")","%29") if resource.collection? and ret[-1,1] != '/' ret += '/' end ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(s)\n URI.encode_www_form_component(s)\n end", "def escape_uri(s); Rack::Utils.escape(s); end", "def url_escape(string)\n return '' if string.blank?\n\n string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '+')\n end", "d...
[ "0.79828304", "0.78429884", "0.7712221", "0.7694829", "0.7639562", "0.7609975", "0.7569485", "0.74607724", "0.7389017", "0.7335048", "0.7264457", "0.72609466", "0.7241511", "0.72223496", "0.71865636", "0.717827", "0.71648073", "0.7163761", "0.71237737", "0.71014833", "0.70468...
0.0
-1
s:: string Unescape URL string
def url_unescape(s) #Added this to make cadaver work s = s.gsub("%28", "(").gsub("%29", ")") URI.unescape(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unescape_uri(uri); end", "def unescape_url(url)\n Addressable::URI.unescape(url)\n end", "def sanitize_url(str); end", "def unescape_url(url)\n Addressable::URI.unescape(url)\n end", "def url_safe\n URI.parse(url).to_s\n rescue URI::InvalidURIError\n URI.escape url\n ...
[ "0.73470753", "0.7345408", "0.7270012", "0.7255883", "0.6865064", "0.68267363", "0.68171304", "0.68018913", "0.6777852", "0.6753298", "0.67241913", "0.67143846", "0.6705263", "0.6695924", "0.66814226", "0.6669629", "0.66627353", "0.6646132", "0.6645937", "0.66136575", "0.6597...
0.8050523
0
Return response to OPTIONS
def options add_dav_header response['Allow'] = 'OPTIONS,HEAD,GET,PUT,POST,DELETE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK' response['Ms-Author-Via'] = 'DAV' OK end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_options\n head(:ok) if request.request_method == \"OPTIONS\"\n end", "def do_OPTIONS(request, response)\n super\n\n response.header['Access-Control-Allow-Methods'] = 'POST, OPTIONS'\n response.status = Server.status_code('OPTIONS')\n end", "def do_OPTIONS(_req, res)\r\n...
[ "0.836495", "0.81620973", "0.7799991", "0.7762802", "0.76744664", "0.75063676", "0.7479025", "0.7474704", "0.71313584", "0.703685", "0.692547", "0.691297", "0.68870956", "0.6862358", "0.68450564", "0.6811236", "0.6772375", "0.6760474", "0.6725971", "0.6716205", "0.66986006", ...
0.66951007
22
Return response to HEAD
def head if(resource.exist?) response['Etag'] = resource.etag response['Content-Type'] = resource.content_type response['Last-Modified'] = resource.last_modified.httpdate OK else NotFound end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def head(request, response)\n OK\n end", "def head(path)\n request 'HEAD', path\n end", "def http_head\n return @head if defined?(@head)\n begin\n @head = conn.request(http_request(:head, resource[:source]))\n fail \"#{resource[:http_verb].to_s.upcase} #{resource[:source]} \" +\...
[ "0.789715", "0.76366186", "0.758421", "0.7457242", "0.7379789", "0.72910887", "0.72813356", "0.7164428", "0.71323353", "0.70892346", "0.70892346", "0.7055894", "0.7006637", "0.69540733", "0.69311553", "0.6926505", "0.6923911", "0.68871975", "0.68717897", "0.68684036", "0.6802...
0.73530465
5
Return response to GET
def get if(resource.exist?) #print_range(request) res = resource.get(request, response) if(res == OK && !resource.collection?) response['Etag'] = resource.etag response['Content-Type'] = resource.content_type response['Content-Length'] = resource.content_lengt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get...
[ "0.75941765", "0.75941765", "0.75320095", "0.75320095", "0.7376757", "0.7359927", "0.72627705", "0.70640665", "0.70110303", "0.69944274", "0.69871503", "0.69841874", "0.6959774", "0.6940612", "0.6911683", "0.68457824", "0.6823265", "0.68056726", "0.67846864", "0.6766999", "0....
0.0
-1
Return response to PUT
def put if(resource.collection?) Forbidden elsif(!resource.parent_exists? || !resource.parent_collection?) Conflict else resource.lock_check if resource.supports_locking? status = resource.put(request, response) response['Location'] = "#{scheme}://#{host}:#{port...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put options={}, &block\n handle_exceptions do\n Chimps.log.info(\"PUT #{url}\")\n Response.new(super(encoded_body, options, &block))\n end\n end", "def put!\n request! :put\n end", "def put(request, response)\n NotImplemented\n end", "def put(request, response)\n ...
[ "0.7408257", "0.7219455", "0.708031", "0.708031", "0.70773065", "0.7045847", "0.7045847", "0.69724363", "0.6802465", "0.6769631", "0.6754226", "0.674857", "0.6720881", "0.6720881", "0.6674635", "0.66739655", "0.6653774", "0.66527504", "0.66350454", "0.66243476", "0.660531", ...
0.63552237
38
Return response to POST
def post resource.post(request, response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def POST; end", "def post()\n return @http.request(@req)\n end", "def exec_post(req, data, exit_on_fail = false)\n response_hash = exec_api_call('POST', req, data, exit_on_fail)\n response_hash[:response]\n end", "def post(request)\n # sure thing!\n json_response(200, { message...
[ "0.7269868", "0.72497964", "0.7031742", "0.693446", "0.691902", "0.6870056", "0.68624884", "0.68573236", "0.6720242", "0.66995186", "0.6677829", "0.6644105", "0.6615131", "0.6612886", "0.6612886", "0.66103786", "0.6594553", "0.65832746", "0.6518715", "0.6451216", "0.6432448",...
0.747301
0
Return response to DELETE
def delete if(resource.exist?) resource.lock_check if resource.supports_locking? resource.delete else NotFound end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(ur...
[ "0.8405755", "0.8405755", "0.84024185", "0.84024185", "0.8169939", "0.78802526", "0.76361006", "0.74588007", "0.74537796", "0.7403016", "0.73938", "0.7382691", "0.7373832", "0.7370974", "0.7355259", "0.73425674", "0.732161", "0.7304904", "0.7303116", "0.7289287", "0.7289287",...
0.0
-1
Return response to MKCOL
def mkcol resource.lock_check if resource.supports_locking? status = resource.make_collection gen_url = "#{scheme}://#{host}:#{port}#{url_format(resource)}" if status == Created if(resource.use_compat_mkcol_response?) multistatus do |xml| xml.response do xml.href ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_mkcol(request, response)\n request_body = request.body_as_string\n path = request.path\n\n if !request_body.blank?\n content_type = request.header('Content-Type') || ''\n if content_type.index('application/xml') != 0 && content_type.index('text/xml') != 0\n ...
[ "0.65291023", "0.5724438", "0.5563856", "0.5492379", "0.5446146", "0.54443175", "0.5429899", "0.53479505", "0.53105474", "0.51679146", "0.51670665", "0.506911", "0.5049302", "0.5029337", "0.5009637", "0.50051427", "0.49844766", "0.49571154", "0.49522847", "0.4937474", "0.4931...
0.5781403
1
Return response to COPY
def copy move(:copy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n response = {}\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.copy_to(dest_file)\n response[:msg] = \"Success\"\n rend...
[ "0.71882594", "0.71775466", "0.6505576", "0.6282064", "0.6170336", "0.61493146", "0.6094137", "0.5997227", "0.59643894", "0.5944116", "0.5892408", "0.5802889", "0.57726604", "0.572981", "0.57108414", "0.5710246", "0.5709178", "0.57091594", "0.5662984", "0.56062096", "0.559515...
0.5451229
29
args:: Only argument used: :copy Move Resource to new location. If :copy is provided, Resource will be copied (implementation ease)
def move(*args) unless(resource.exist?) NotFound else resource.lock_check if resource.supports_locking? && !args.include?(:copy) destination = url_unescape(env['HTTP_DESTINATION'].sub(%r{https?://([^/]+)}, '')) dest_host = $1 if(dest_host && dest_host.gsub(/:\d{2,5}$/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def move(dest, overwrite=false)\n @resource.copy(dest, overwrite)\n end", "def move(*args)\n result = copy(*args)\n delete if [Created, NoContent].include?(result)\n result\n end", "def cp(*args, **kw...
[ "0.67189467", "0.6683427", "0.65937495", "0.6547795", "0.6477778", "0.6476256", "0.6407494", "0.6350176", "0.6344797", "0.62202", "0.6168947", "0.6141794", "0.61250556", "0.61250556", "0.6051228", "0.60445195", "0.60207665", "0.60207665", "0.60139775", "0.60008776", "0.598148...
0.70745516
0
Return response to PROPFIND
def propfind unless(resource.exist?) NotFound else unless(request_document.xpath("//#{ns}propfind/#{ns}allprop").empty?) properties = resource.properties else check = request_document.xpath("//#{ns}propfind") if(check && !check.empty?) proper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response\n @response ||= search.execute!\n end", "def response\n\t\t@response\n\tend", "def response; return @response end", "def search\n send_request\n parse_response\n end", "def response\n @response\n end", "def response\n @response\n end", "def response\r\n @r...
[ "0.6020722", "0.57684714", "0.5696556", "0.5672686", "0.5631446", "0.5631446", "0.56246835", "0.5617163", "0.5584872", "0.5514527", "0.55062187", "0.55038553", "0.5468098", "0.54672843", "0.5463784", "0.54561293", "0.54437786", "0.5429573", "0.53910714", "0.53910714", "0.5391...
0.0
-1
Return response to PROPPATCH
def proppatch unless(resource.exist?) NotFound else resource.lock_check if resource.supports_locking? prop_actions = [] request_document.xpath("/#{ns}propertyupdate").children.each do |element| case element.name when 'set', 'remove' prp = eleme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end", "def response(env)\n PimImpressionsJSON.call(params['pim_id'], env['rack.input'])\n end", "de...
[ "0.60480547", "0.59388554", "0.58048326", "0.5741854", "0.5729979", "0.56503403", "0.56503403", "0.56503403", "0.56503403", "0.56503403", "0.56502795", "0.56502795", "0.56502795", "0.56502795", "0.56502795", "0.56502795", "0.56502795", "0.56502795", "0.564948", "0.5648814", "...
0.0
-1
Lock current resource NOTE: This will pass an argument hash to Resourcelock and wait for a success/failure response.
def lock lockinfo = request_document.xpath("//#{ns}lockinfo") asked = {} asked[:timeout] = request.env['Timeout'].split(',').map{|x|x.strip} if request.env['Timeout'] asked[:depth] = depth unless([0, :infinity].include?(asked[:depth])) BadRequest else asked[:scope] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n if refresh_lock?\n lock_properties = @resource.refresh_lock\n elsif resource_locked?\n return :locked\n else\n # The `lockinfo` tag is used to specify the type of lock the client\n # wishes to have created.\n xml = xml_for body: body, node: 'lockinfo'...
[ "0.7287968", "0.7259221", "0.70696306", "0.67381185", "0.6702598", "0.67005134", "0.6659605", "0.6652514", "0.6626351", "0.6581371", "0.64836586", "0.6458311", "0.6442292", "0.63640136", "0.6342341", "0.63390625", "0.63180345", "0.62939197", "0.6284118", "0.6282718", "0.62739...
0.6532443
10
Perform authentication NOTE: Authentication will only be performed if the Resource has defined an authenticate method
def authenticate authed = true if(resource.respond_to?(:authenticate, true)) authed = false uname = nil password = nil if(request.env['HTTP_AUTHORIZATION']) auth = Rack::Auth::Basic::Request.new(request.env) if(auth.basic? && auth.credentials) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate\n auth.call(:authenticate)\n end", "def authenticate\n end", "def authenticate!\n raise AuthenticationFailed if authentication.failed?\n raise AuthenticationRequired unless authentication.authenticated?\n end", "def authenticate!\n # Do nothing yet\n ...
[ "0.7822289", "0.7744395", "0.7612624", "0.7450246", "0.72584873", "0.72440225", "0.7242183", "0.7236564", "0.71759623", "0.71523064", "0.71258366", "0.7077698", "0.7076973", "0.70764065", "0.7005033", "0.6983438", "0.6966228", "0.6956763", "0.69510543", "0.69476014", "0.69206...
0.7792041
1
Current request scheme (http/https)
def scheme request.scheme end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scheme\n\t\treturn self.headers.url_scheme || 'http'\n\tend", "def scheme\n @scheme ||= headers[SCHEME_KEY]\n end", "def scheme( env )\n if env['HTTPS'] == 'on'\n 'https'\n elsif env['HTTP_X_FORWARDED_PROTO']\n env['HTTP_X_FORWARDED_PROTO'].split(',')[0]\n else\...
[ "0.8226069", "0.7768387", "0.77223974", "0.77074474", "0.761463", "0.75351685", "0.7354627", "0.7249929", "0.70690256", "0.70506", "0.70024014", "0.69598097", "0.69387275", "0.6936415", "0.6905698", "0.68686956", "0.6808004", "0.6808004", "0.6808004", "0.6789885", "0.67784065...
0.8689661
1
Class of the resource in use
def resource_class @options[:resource_class] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class\n @resource_class ||= self.class.to_s.split(\":\").last\n end", "def resource_class\n\t\t\t\t@resource_class ||= resource_name.classify.constantize\n\t\t\tend", "def class_of_resource\n @class_of_resource ||= resource_name.classify.constantize\n end", "def resource_clas...
[ "0.796695", "0.78275293", "0.7770484", "0.7720845", "0.7696504", "0.76940787", "0.7671368", "0.76451325", "0.76451325", "0.76451325", "0.76370126", "0.76298505", "0.76272285", "0.7588797", "0.7527858", "0.7527858", "0.7527858", "0.7519143", "0.7501125", "0.74393535", "0.73844...
0.7392519
20
Root URI path for the resource
def root_uri_path @options[:root_uri_path] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def root; resource :path => '/'; end", "def path_root\n base_uri ? base_uri : path_to( '/' )\n end", "def root_path; end", "def root_path; end", "def root_path; end", "def root_path \n @root_path\n end", "def root_uri\n attributes.fetch(:rootUri)\n end", "def path\n ...
[ "0.81913894", "0.77038103", "0.7588933", "0.7588933", "0.7588933", "0.7320482", "0.72942114", "0.7293878", "0.72851324", "0.72239524", "0.7215708", "0.71845496", "0.7059771", "0.70597374", "0.7010727", "0.7006242", "0.6990589", "0.6986357", "0.69855535", "0.69639874", "0.6952...
0.777971
1
Returns Resource path with root URI removed
def implied_path clean_path(@request.path.dup) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end", "def root_url_path\r\n root_url.to_s.gsub(/^:.+:\\d*/, '')\r\n end", "def root; resource :path => '/'; end", "def path_root\n base_uri ? base_uri : path_to( '/' )\n ...
[ "0.7338632", "0.69817626", "0.69620055", "0.6942514", "0.692117", "0.68471533", "0.6763284", "0.67312664", "0.67261994", "0.6712556", "0.6697296", "0.66797704", "0.6672679", "0.6666177", "0.666557", "0.6643554", "0.6640606", "0.6606229", "0.6606229", "0.6606229", "0.65773064"...
0.0
-1
x:: request path Unescapes path and removes root URI if applicable
def clean_path(x) ip = url_unescape(x) ip.gsub!(/^#{Regexp.escape(root_uri_path)}/, '') if root_uri_path ip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized_request_path(path)\n if path == \"/\"\n path\n else\n path.chomp(\"/\")\n end\n end", "def normalize_req_path(req_path)\n # 1) Decode the req_path with URI::decode\n req_path = URI::decode(req_path)\n # 2) Strip first\n req_path = req_pat...
[ "0.74809223", "0.72835296", "0.7223021", "0.7194842", "0.70927083", "0.6916348", "0.6854571", "0.68507975", "0.68475", "0.68219", "0.68070495", "0.68038946", "0.67926776", "0.67926776", "0.6775767", "0.67342454", "0.6707753", "0.67018944", "0.6681311", "0.666539", "0.66580915...
0.74866056
0
Lock token if provided by client
def lock_token env['HTTP_LOCK_TOKEN'] || nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(&block)\n # TODO: only use replace strategy when server is executing the lock\n return call_strategy unless (locked_token = locksmith.lock(&block))\n\n locked_token\n end", "def lock_token\n return nil if object[:lock_version].blank?\n @lock_token ||=\n Valkyri...
[ "0.73148435", "0.7166762", "0.7027379", "0.6875165", "0.6844757", "0.6792922", "0.67214954", "0.66907084", "0.668166", "0.65978616", "0.6511363", "0.6504826", "0.6487974", "0.64561653", "0.6438843", "0.64055085", "0.6372298", "0.6340562", "0.62894636", "0.6255228", "0.6250081...
0.7512367
0