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
Finds the proper spec command to use. Precendence is set in the lazilyevaluated method spec_commands. Alias + Override that in ~/.autotest to provide a different spec command then the default paths provided.
def spec_command(separator=File::ALT_SEPARATOR) unless defined? @spec_command then @spec_command = spec_commands.find { |cmd| File.exists? cmd } raise RspecCommandError, "No spec command could be found!" unless @spec_command @spec_command.gsub! File::SEPARATOR, separator if separator end @spec_command end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [\n File.expand_path...
[ "0.7567217", "0.7567217", "0.7567217", "0.7554606", "0.6723829", "0.6723829", "0.6723829", "0.59270173", "0.57842547", "0.57092667", "0.5638387", "0.5584095", "0.55048895", "0.54625285", "0.53773063", "0.5363766", "0.53505045", "0.53505045", "0.53505045", "0.53239864", "0.530...
0.6712126
7
Autotest will look for spec commands in the following locations, in this order: bin/spec default spec bin/loader installed in Rubygems
def spec_commands [ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), File.join(Config::CONFIG['bindir'], 'spec') ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def setup_auto_test\n ENV['RSPEC'] = 'true' ...
[ "0.7678369", "0.7678369", "0.7678369", "0.68583155", "0.65796", "0.6557628", "0.6321307", "0.62469125", "0.621284", "0.61861", "0.61861", "0.6170495", "0.61602753", "0.60869324", "0.6081475", "0.6057148", "0.60191387", "0.6014289", "0.6014236", "0.6011074", "0.60078967", "0...
0.78004867
0
Multiply times conversion factor to get metric version of height and weight
def convert_inches_to_cm length in_to_cm = 2.54 length * in_to_cm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend", "def convert_to_metric(measurement, conversion_factor)\n measurement * conversion_factor\nend", "def calculate_bmi weight, height\n (weight.to_f / (height.to_f * height.to_f)) * 703\nend", "def convert_to_meas...
[ "0.6600409", "0.6600409", "0.6567237", "0.6251231", "0.62279135", "0.620538", "0.6165563", "0.61167747", "0.6103922", "0.60933155", "0.60524374", "0.5947633", "0.5933576", "0.587633", "0.5843534", "0.5796541", "0.57235616", "0.5709218", "0.5694761", "0.5650069", "0.5641966", ...
0.5396153
49
FIXME remove this dependency
def card_deck CardDeck.new(card: @subject) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def wrapper; end", "def probers; end", "def internal; end", "def schubert; end", "def custom; end", "def custom; ...
[ "0.8048372", "0.6577844", "0.6577844", "0.6577844", "0.6577844", "0.6575336", "0.6575336", "0.646177", "0.6450023", "0.64455163", "0.6367529", "0.6237018", "0.61316365", "0.61316365", "0.6027642", "0.60081863", "0.6000104", "0.6000104", "0.59816575", "0.59816575", "0.59816575...
0.0
-1
FIXME remove this dependency
def avaiable_decks Deck.all.map { |d| [d.name, d.id] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def refutal()\n end", "def wrapper; end", "def probers; end", "def internal; end", "def schubert; end", "def custom; end", "def custom; ...
[ "0.8048372", "0.6577844", "0.6577844", "0.6577844", "0.6577844", "0.6575336", "0.6575336", "0.646177", "0.6450023", "0.64455163", "0.6367529", "0.6237018", "0.61316365", "0.61316365", "0.6027642", "0.60081863", "0.6000104", "0.6000104", "0.59816575", "0.59816575", "0.59816575...
0.0
-1
TODO: move this to an observer on KillEvent instead?
def send_death_notice(event) player = event.target_player if player.user.notify_death? notice = if (event.period.phase == :night) build_message(:death_villager_am) else # game.night? build_message("death_#{player.type}_pm") end GameBot.messages.dm(player.user.login, notice) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill() end", "def kill!() end", "def kill\n sig :KILL\n end", "def kill\n send(:kill)\n end", "def stopKill\n self.stop_d\n return\n end", "def kill\n shutdown\n end", "def kill\n process_event_death\n super\n refresh\n puts \"#{event.id} #{event.nam...
[ "0.7696609", "0.7421442", "0.69308096", "0.6895599", "0.68940264", "0.68204695", "0.679312", "0.6786746", "0.6726199", "0.665944", "0.656929", "0.65375704", "0.6498201", "0.6442205", "0.6391672", "0.6369363", "0.63597107", "0.63446933", "0.63386184", "0.6292023", "0.61830896"...
0.0
-1
friends name in it. If a name has exactly 4 letters in it, you can be sure that it has to be a friend of yours! Otherwise, you can be sure he's not... Ex: Input = ["Ryan", "Kieran", "Jason", "Yous"], Output = ["Ryan", "Yous"] Note: keep the original order of the names in the output. def friend(array) b = [] n = array.size for i in (0..n1) do if array[i].size == 4 b << array[i] end end p b end
def friend(array) array.select { |e| e if e.size == 4 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend(friends)\r\n friends_name = []\r\n friends.each {|friend| friends_name.push(friend) if friend.length == 4}\r\n return friends_name\r\nend", "def friend(friends)\n \n friend_array = []\n friends.each { |x| if x.length == 4 then friend_array.push(x) end}\n \nreturn friend_array \n \nend", "def...
[ "0.7997624", "0.7544937", "0.74139065", "0.7140822", "0.7140568", "0.7043561", "0.68281835", "0.6640537", "0.6465815", "0.63131136", "0.61951905", "0.6140563", "0.59827524", "0.5890489", "0.57365006", "0.572553", "0.57194", "0.5707065", "0.5669916", "0.56415075", "0.56397325"...
0.71009034
5
before_filter :authorize_controller!, :only => %w(search index show new create edit update destroy)
def autocomplete render :json => end_of_association_chain.ordered.search(params[:term]).limit(params[:limit] || 10).to_autocomplete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end", "def authorize_controller!\n authorize! action_name.t...
[ "0.76493895", "0.73639953", "0.7130113", "0.7113632", "0.7071047", "0.7005025", "0.6993887", "0.6993887", "0.69899756", "0.6982364", "0.6921472", "0.691582", "0.69006926", "0.68857956", "0.68557215", "0.68487024", "0.6815257", "0.68129027", "0.68066067", "0.6778177", "0.67781...
0.0
-1
this code will only ever by executed if the word starts with a consonant
def front_to_back(word, index, how_far) word = string_to_char_array(word) word.rotate(how_far) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starts_with_consonant?(s)\n return false if s.empty?\n %Q{b c d f g h j k l m q r s t v w x y z}.include? s[0].downcase\nend", "def starts_with_consonant? s\n if s.empty?\n return false\n else\n stopwords = 'AEIOUaeiou0123456789$*~&!@#$%^()-=+/\\?,.'\n stopwords.each_char{|c|\n return false...
[ "0.8215397", "0.818642", "0.8042217", "0.7927891", "0.7877118", "0.7868221", "0.78401625", "0.7828041", "0.78177667", "0.7807915", "0.7782248", "0.7780567", "0.7773701", "0.7747902", "0.774192", "0.7734011", "0.7734011", "0.7730482", "0.77289766", "0.7693774", "0.76930624", ...
0.0
-1
begin main translate method
def translate(words) split_words = words.split split_words.each_with_index do |word, i| # check if first letter is a vowel if word[0].include? VOWELS.join word = add_ay(word) # add ay to the back of the word split_words[i] = word elsif word[0].include? CONSONANTS find_phoneme(word) elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) find_phoneme(word) elsif (word[0].include? CONSONANTS) && (word[1].include? CONSONANTS) && (word[2].include? CONSONANTS) # the word has a consonant at the beginning with # no special conditions else word = one_cons_at_beginning(word) word = add_ay(word) split_words[i] = word end end split_words.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate(*args, **opts); end", "def translate(settings); end", "def translate(text...
[ "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.72906065", "0.7136828", "0.69542295", "0.68306696", "0.6810086", "0.6702626", "0.6689552", "0.64810085", "0.6422103", "0.632119", "0.62911314", "0.62776816", "0.6265369", "0.6...
0.56910837
76
Called to perform modifications on the packet before writing the data
def write_data(data) # read the APID from the packet apid = BinaryAccessor.read(@apid_bit_offset, @apid_bit_size, :UINT, data, @endianness) # if the key does not yet exist in the hash (ie, this is the first time # this packet has been sent), add an entry to the hash if(!@sent_seqcnts.key?(apid)) @sent_seqcnts[apid] = 0 # otherwise, increment the key that already exists else @sent_seqcnts[apid] += 1; end # use the value from the hash seqcnt = @sent_seqcnts[apid] # make sure the value will fit in the bits allocated for it # wraps value if too large seqcnt = @sent_seqcnts[apid] % ( 2 ** @seqcnt_bit_size -1) # write the APID into the packet BinaryAccessor.write(seqcnt, @seqcnt_bit_offset, @seqcnt_bit_size, :UINT, data, @endianness, :ERROR) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(raw_data)\n if @policy_type == :buffer\n if @buffer.size != @buffer_size\n @buffer << raw_data\n end\n elsif @policy_type == :data\n @buffer = [raw_data]\n else\n ...
[ "0.619774", "0.6054573", "0.6039514", "0.59551907", "0.5947687", "0.5823226", "0.5686183", "0.5646165", "0.5637054", "0.5637054", "0.5637054", "0.5637054", "0.5636197", "0.5576441", "0.5562384", "0.5519975", "0.55039036", "0.54982615", "0.5491344", "0.5489904", "0.548493", ...
0.49908224
90
GET /Embeddable/open_responses/1 GET /Embeddable/open_responses/1.xml
def show @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? render :partial => 'show', :locals => { :open_response => @open_response } else respond_to do |format| format.html # show.html.haml format.jnlp { render :partial => 'shared/installer', :locals => { :runnable => @open_response } } format.config { render :partial => 'shared/show', :locals => { :runnable => @open_response, :session_id => (params[:session] || request.env["rack.session.options"][:id]) } } format.xml { render :xml => @open_response } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_openids = UserOpenid.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user_openids }\n end\n end", "def show\n @response = Response.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.608897", "0.6075171", "0.5915318", "0.5871443", "0.5867999", "0.5866636", "0.5804312", "0.5762687", "0.5761617", "0.5742818", "0.5735696", "0.5703224", "0.56950384", "0.5685316", "0.56615794", "0.5660818", "0.56452525", "0.5633318", "0.56174076", "0.5613713", "0.560558", ...
0.6319006
0
GET /Embeddable/open_responses/new GET /Embeddable/open_responses/new.xml
def new @open_response = Embeddable::OpenResponse.new if request.xhr? render :partial => 'remote_form', :locals => { :open_response => @open_response } else respond_to do |format| format.html { render :partial=>'open_response', :locals => { :open_response => @open_response }, :layout=>false } format.xml { render :xml => @open_response } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end", "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @response }\n ...
[ "0.69099444", "0.6806349", "0.67905694", "0.6755162", "0.6711176", "0.6635485", "0.6586161", "0.65834004", "0.6541293", "0.65114963", "0.6486276", "0.6478211", "0.64716774", "0.646312", "0.644731", "0.6441864", "0.6438742", "0.6414927", "0.6414438", "0.6409791", "0.6392238", ...
0.634024
28
POST /Embeddable/open_responses POST /Embeddable/open_responses.xml
def create @open_response = Embeddable::OpenResponse.new(params[:open_response]) cancel = params[:commit] == "Cancel" if request.xhr? if cancel redirect_to :index elsif @open_response.save render :partial => 'new', :locals => { :open_response => @open_response } else render :xml => @open_response.errors, :status => :unprocessable_entity end else respond_to do |format| if @open_response.save flash[:notice] = 'Embeddable::OpenResponse.was successfully created.' format.html { redirect_to(@open_response) } format.xml { render :xml => @open_response, :status => :created, :location => @open_response } else format.html { render :action => "new" } format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @open_response = Embeddable::OpenResponse.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(open_responses_url) }\n format.xml { head :ok }\n format.js\n end\n # TODO: We should move this logic into the model!\n @open_response.page_elements.each do...
[ "0.567167", "0.56690717", "0.5621848", "0.56049716", "0.551115", "0.5444393", "0.5381834", "0.5281441", "0.527088", "0.523555", "0.52156264", "0.5182548", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0.5177007", "0...
0.65215564
0
PUT /Embeddable/open_responses/1 PUT /Embeddable/open_responses/1.xml
def update cancel = params[:commit] == "Cancel" @open_response = Embeddable::OpenResponse.find(params[:id]) if request.xhr? if cancel || @open_response.update_attributes(params[:embeddable_open_response]) render :partial => 'show', :locals => { :open_response => @open_response } else render :xml => @open_response.errors, :status => :unprocessable_entity end else respond_to do |format| if @open_response.update_attributes(params[:embeddable_open_response]) flash[:notice] = 'Embeddable::OpenResponse.was successfully updated.' format.html { redirect_to(@open_response) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @open_response.errors, :status => :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @open_response = Embeddable::OpenResponse.new(params[:open_response])\n cancel = params[:commit] == \"Cancel\"\n if request.xhr?\n if cancel\n redirect_to :index\n elsif @open_response.save\n render :partial => 'new', :locals => { :open_response => @open_response }\n ...
[ "0.57641286", "0.5665278", "0.55735976", "0.55076814", "0.5501253", "0.54921687", "0.5480575", "0.54805607", "0.5436062", "0.53067553", "0.5296444", "0.52292", "0.52272546", "0.5188145", "0.5163034", "0.5149911", "0.5143354", "0.5141434", "0.5137631", "0.5130713", "0.51269764...
0.65986556
0
DELETE /Embeddable/open_responses/1 DELETE /Embeddable/open_responses/1.xml
def destroy @open_response = Embeddable::OpenResponse.find(params[:id]) respond_to do |format| format.html { redirect_to(open_responses_url) } format.xml { head :ok } format.js end # TODO: We should move this logic into the model! @open_response.page_elements.each do |pe| pe.destroy end @open_response.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @response = Response.find(params[:id...
[ "0.7012579", "0.6651561", "0.65560836", "0.65465456", "0.65258634", "0.65165734", "0.6482845", "0.6429739", "0.6411512", "0.63764036", "0.6356658", "0.63456875", "0.6345088", "0.6328726", "0.63209045", "0.63144433", "0.62959623", "0.62645596", "0.6258221", "0.6238944", "0.623...
0.7056803
0
This method is not available in has_secure_token
def invalidate_token update_columns(token: '') touch(:token_created_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token_secret; end", "def token_secret; end", "def token_secret; end", "def verify_authenticity_token; end", "def assign_secure_token\n self.secure_token = SecureRandom.hex\n end", "def request_authenticity_tokens; end", "def any_authenticity_token_valid?; end", "def secure_token token=nil\n ...
[ "0.71224666", "0.71224666", "0.71224666", "0.7050125", "0.70109504", "0.69412667", "0.68999", "0.67537653", "0.6724007", "0.66240644", "0.65942496", "0.6579124", "0.6573008", "0.65630305", "0.6540127", "0.6498106", "0.6498106", "0.6498106", "0.649739", "0.6485234", "0.6474157...
0.0
-1
The same code from part 1, slightly modified to return more. We have to return a more complex result than in part 1 in order to add the value of each node.
def size_of_children(arr) children_count = arr[0] metadata_count = arr[1] if children_count == 0 # the value is simply the sum of child nodes value = arr[2..(metadata_count+1)].sum $metadata_total += value return {size: (2 + metadata_count), value: value} elsif children_count >= 1 total_children_size = 0 child_nodes_values = [ nil ] # we need a dummy item at index 0 children_count.times do |index| kiddo_report = size_of_children(arr[2+total_children_size..-1]) total_children_size += kiddo_report[:size] child_nodes_values << kiddo_report[:value] end metadata_nodes = arr[(2 + total_children_size)..(1 + total_children_size + metadata_count)] $metadata_total += metadata_nodes.sum # Value is more complicated when the node has child nodes. Value is the sum # of the values of child nodes referred to, but we have to be careful since # arrays are 0-indexed and references to child nodes are 1-indexed. If the # child node doesn't actually exist, the value is 0. total_value = 0 metadata_nodes.each do |node| total_value += child_nodes_values.fetch(node, 0) end return {size: (2 + total_children_size + metadata_count), value: total_value} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reduce_40(val, _values, result)\n case val[0]\n when 'even'\n result = Node.new(:NTH, ['2','n','+','0'])\n when 'odd'\n result = Node.new(:NTH, ['2','n','+','1'])\n when 'n'\n result = Node.new(:NTH, ['1','n','+','0'])\n else\n # non-stand...
[ "0.6624061", "0.6392328", "0.6392328", "0.6392328", "0.6392328", "0.6392328", "0.63158906", "0.6291644", "0.6291644", "0.6284407", "0.627129", "0.6266496", "0.61419046", "0.612403", "0.6108381", "0.61068374", "0.60629153", "0.6048005", "0.6033568", "0.60155606", "0.59733504",...
0.59450746
24
This is a form to save a summary of attendances for several contracts filtered by month and provider
def attendances # nothing here, everything is asked to JSON API # this action should render initial template only. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary_attendance_params\n params.require(:summary_attendance).permit(:attendace_date, :check_in_at, :check_out_at, :worked_hours, :contracted_hours, :difference, :delay, :permission, :medical_licence, :employee_id, :branch_office_id)\n end", "def new\n @attendance = Attendance.new\n @payheads...
[ "0.60042334", "0.5828292", "0.5772841", "0.55618495", "0.55509925", "0.5535964", "0.5531104", "0.5491961", "0.5491161", "0.5480118", "0.5479395", "0.5452949", "0.5445107", "0.5437388", "0.53795683", "0.53760535", "0.5372274", "0.537032", "0.53569835", "0.5349649", "0.53265053...
0.0
-1
Did not know that ActiveRecord .where could accept a symbol
def all_tags=(names) self.tags = names.split(",").map do |name| Tag.where(name: name.strip).first_or_create! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def special_character_records column_name\n @model_name.where(column_name.to_sym => SPECIAL_CHARACTER_LISTS)\n end", "def where_exp(input, variable, expression); end", "def where(*args, &b)\n set_parameters(args, false, &b)\n end", "def where!(args={})\n scope.where!(args)\n self\n ...
[ "0.6449637", "0.63082874", "0.5940474", "0.58660173", "0.58439094", "0.57750857", "0.5693066", "0.5693066", "0.5661023", "0.5628119", "0.5607416", "0.5607045", "0.5603239", "0.55822563", "0.55734974", "0.5572078", "0.5568918", "0.55394703", "0.55359226", "0.55224687", "0.5508...
0.0
-1
return the number of matches in the file. Don't read the entire file into memory; read it only (num_lines_per_batch) lines at a time
def num_matches_in_file(fname, match_regexp) num_lines_per_batch = 5000 num_matched = 0 if File.exist? fname File.open(fname, "r") do |f| # use an enumerator to read just (num_lines_per_batch) lines at a time f.lazy.each_slice(num_lines_per_batch) do |lines| num_matched += lines.select { |line| line.match(match_regexp) }.count end end else num_matched = 0 end num_matched end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_lines(all_lines_from_file)\n all_lines_from_file.lines.count\nend", "def n_lines(filename)\n File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 }\n end", "def n_lines(filename); end", "def count_lines()\n start_time = Time.now\n @file_lines = 0 \n last_block_po...
[ "0.68329793", "0.6793775", "0.6727576", "0.6684314", "0.66674596", "0.665338", "0.66107076", "0.6572488", "0.649866", "0.649313", "0.6434707", "0.64026797", "0.6375943", "0.6369467", "0.63271815", "0.62666637", "0.6243256", "0.6243017", "0.61899006", "0.61893433", "0.618073",...
0.82626873
0
The session_key is returned by auth.session.key
def love(session_key) doc = Hpricot::XML(self.class.connection.post("track.love", true, {:track => @name, :artist => @artist, :sk => session_key})) doc.at("lfm")["status"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_key\n @session_key\n end", "def session_id_key\n @session_id_key\n end", "def session_key\n if self.new_record?\n @session_key\n else\n ActiveRecord::Base.session_keys[session_key_id]\n end\n end", "def session_key=(key)\n @sessio...
[ "0.8800732", "0.8371106", "0.80399156", "0.7695349", "0.7604878", "0.7512027", "0.7436687", "0.73977613", "0.7364958", "0.73039484", "0.7211072", "0.7211072", "0.7211072", "0.71681225", "0.715959", "0.7113635", "0.70376873", "0.7009792", "0.7009212", "0.6986573", "0.69512033"...
0.0
-1
| F M T + F | F F F M | F M M T | F M T
def test_and assert_false F & F, 'F & F' assert_false F & M, 'F & M' assert_false F & T, 'F & T' assert_false M & F, 'M & F' assert_maybe M & M, 'M & M' assert_maybe M & T, 'M & T' assert_false T & F, 'T & F' assert_maybe T & M, 'T & M' assert_true T & T, 'T & T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def factions\n \n end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end", "def fml (m)\n\tend", "def termsig(*) end", "def f\n end", "d...
[ "0.5592755", "0.5502622", "0.51993346", "0.51813745", "0.51637113", "0.5139257", "0.51377285", "0.5120009", "0.5109711", "0.50951487", "0.5081847", "0.5056017", "0.50472075", "0.5005441", "0.49969888", "0.49959838", "0.49908784", "0.4988285", "0.49774465", "0.49756435", "0.49...
0.49495316
22
| F M T + F | F M T M | M M T T | T T T
def test_or assert_false F | F, 'F | F' assert_maybe F | M, 'F | M' assert_true F | T, 'F | T' assert_maybe M | F, 'M | F' assert_maybe M | M, 'M | M' assert_true M | T, 'M | T' assert_true T | F, 'T | F' assert_true T | M, 'T | M' assert_true T | T, 'T | T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fml (m)\n\tend", "def f\n end", "def termsig(*) end", "def op; end", "def m(x) x end", "def m3; 3 end", "def f\n g\n end", "def test_and\n assert_false F & F, 'F...
[ "0.5603548", "0.5327163", "0.51566607", "0.5147912", "0.5144576", "0.51122254", "0.51009554", "0.50868076", "0.50845224", "0.5070233", "0.50523746", "0.5048417", "0.5045751", "0.50297564", "0.5025227", "0.5009734", "0.49996307", "0.4990968", "0.49835384", "0.49809727", "0.497...
0.45496485
97
| F M T + F | F M T M | M M M T | T M F
def test_xor assert_false F ^ F, 'F ^ F' assert_maybe F ^ M, 'F ^ M' assert_true F ^ T, 'F ^ T' assert_maybe M ^ F, 'M ^ F' assert_maybe M ^ M, 'M ^ M' assert_maybe M ^ T, 'M ^ T' assert_true T ^ F, 'T ^ F' assert_maybe T ^ M, 'T ^ M' assert_false T ^ T, 'T ^ T' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n self.g + self.h\n end", "def reducer; end", "def field_m(op)\n (op & 0xfc000000) >> 26\nend", "def fml (m)\n\tend", "def m3; 3 end", "def fours\r\n left, right = self.pops self.size/3\r\n left.twos + right.twos\r\n end", "def f\n end", "def factions\n \n end", "def m(...
[ "0.5541351", "0.54421735", "0.52573425", "0.5251038", "0.51902086", "0.5183739", "0.5097668", "0.5096984", "0.505781", "0.50424546", "0.50211966", "0.50094885", "0.5009476", "0.50056964", "0.5005122", "0.5001263", "0.49776042", "0.4974213", "0.49547005", "0.49363297", "0.4929...
0.0
-1
Creates a new DB models: the list of Welo::Resource models to use (i.e., classes)
def initialize(models, params={}) @models = models @extensions = params[:extensions] || ['.json'] @identifying_sym = params[:identifying_sym] || :flat_db build! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_models\n @name = name.singularize.downcase\n @name_plural = @name.pluralize\n @attributes = attributes\n template(\"./templates/model.erb\", \"./models/#{@name}.rb\")\n end", "def load_models\n url = Configuration::PROPERTIES.get_property :url\n url_get_r...
[ "0.67588514", "0.6662535", "0.65796", "0.64164066", "0.6340818", "0.6177394", "0.61436856", "0.6109524", "0.608631", "0.6058302", "0.6039142", "0.602916", "0.60204", "0.6007532", "0.59676856", "0.59626514", "0.5953869", "0.594368", "0.5905357", "0.5887946", "0.58519286", "0...
0.56265414
45
creates the tree to map the DB structure to classes paths does not register the model because it uses existing one
def build! models.each do |model| build_route_for_model(model) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tree(father,tree)\n tree.each do |name|\n n = Meta::create_class(father, name[0], name[1])\n create_tree(n, name[2])\n end\nend", "def build_tree(model)\n # inflate the node id to test id wrap around edge cases\n ENV[\"NODES\"].to_i.times { model.create!.destroy } if ENV[\"NODES\"]\n\n ...
[ "0.646908", "0.64071745", "0.6404166", "0.63962555", "0.63305557", "0.6310598", "0.6305534", "0.6231644", "0.6229337", "0.6229337", "0.61901736", "0.6111154", "0.6086127", "0.6011625", "0.60019916", "0.5940184", "0.58853716", "0.58023334", "0.57760537", "0.5752064", "0.571969...
0.0
-1
Registers a model on a derailleur node at its path_model Does not modify self.models
def build_route_for_model(model) path = File.join(model.path_model(identifying_sym), ':filename') node = build_route(path) node.content = model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_model(model)\n raise ArgumentError, \"already know this model\" if models.include?(model)\n models << model\n build_route_for_model(model)\n end", "def model_path=(path)\n @model_path = path\n end", "def save\n @model = register_model\n end", "def register_model(nam...
[ "0.6628567", "0.6483159", "0.64712816", "0.61988133", "0.60350406", "0.5896773", "0.58530676", "0.5813492", "0.5723738", "0.5708985", "0.5706797", "0.57045555", "0.56941134", "0.5689497", "0.5678482", "0.5678482", "0.5606499", "0.55813754", "0.5565822", "0.5548728", "0.55302"...
0.5129606
49
Updates self.models and build a route for the model raise an error if the model is already known
def register_model(model) raise ArgumentError, "already know this model" if models.include?(model) models << model build_route_for_model(model) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build!\n models.each do |model|\n build_route_for_model(model)\n end\n end", "def setup_routes\n if prefix\n pre = prefix.to_s[1..-1] + '/'\n end\n model_regexp = Regexp.union(models.keys.map{|m| Regexp.escape(m)})\n controller = @controller.name.sub(/...
[ "0.66855085", "0.58033574", "0.553516", "0.548542", "0.5375248", "0.5286758", "0.5268972", "0.51702493", "0.515043", "0.5144157", "0.5143855", "0.50868946", "0.50835633", "0.5081802", "0.5057851", "0.504427", "0.49987757", "0.4946716", "0.49271715", "0.49091372", "0.48773256"...
0.6183743
1
Loads the file at path and turn it to a ruby object based on the file extension. If the file extension is not supported, will raise an error. uses JSON.parse(File.read(path)) and YAML.load_file(path) for '.json' and '.yaml' otherwise, will forward the handling such that '.foobaar' maps to :read_foobar(path)
def read_file(path) raise ArgumentError, "don't know extension #{ext}, use from [#{extensions.join(', ')}]" unless understands_ext?(path) ext = File.extname(path) case ext when '.json' JSON.parse(File.read(path)) when '.yaml' YAML.load_file(path) else self.send "read_#{ext.tr('.','')}", path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config_file config_path\n File.open(config_path, \"r\") do |file|\n case File.extname(file).delete(\".\")\n when \"json\" then JSON.parse(file.read)\n when \"yml\" then YAML.load_file(file)\n else\n file.close\n raise LoadError, \"Type of file is not sup...
[ "0.67945975", "0.6717681", "0.6596083", "0.6596083", "0.65618277", "0.65604895", "0.6492246", "0.63893735", "0.63614494", "0.6229783", "0.6198518", "0.61499316", "0.6127462", "0.61159956", "0.6115513", "0.6110049", "0.60965884", "0.6092773", "0.6075345", "0.6067231", "0.60632...
0.8175572
0
Wether or not this DB understands the extension of the file at path.
def understands_ext?(path) extensions.find{|ext| ext == File.extname(path)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proper_ext?(raw_path)\n path = raw_path.is_a?(Pathname) ? raw_path : Pathname.new(raw_path)\n LokaliseRails.file_ext_regexp.match? path.extname\n end", "def uses_extension?\n @format =~ /\\.[^\\.]+$/\n end", "def supported_file?(path)\n ext = File.extname(path)\n ...
[ "0.7515566", "0.7483509", "0.7469188", "0.7319592", "0.7267296", "0.7261778", "0.72025883", "0.70653576", "0.7035526", "0.6792193", "0.67615813", "0.6758422", "0.67477065", "0.6728807", "0.6724527", "0.67084503", "0.6705728", "0.6670553", "0.6629256", "0.6621808", "0.65945596...
0.7767626
0
Returns the main name of a path, i.e., the basename without the extension main_name('/a/b/c/foo.bar') => 'foo'
def main_name(path) File.basename(path).sub(/\.[^\.]+$/,'') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && parts.last =~ /^\\w+$/\n parts.pop if parts.last =~ /^\\d+$/\n parts.join('.')\n end", "def file_name_from_path(path)\n path.split(\"/\")[-1]\n end", "def basename\n ...
[ "0.77965236", "0.73246247", "0.72832626", "0.7261556", "0.7219874", "0.71804863", "0.71052563", "0.7101444", "0.7081108", "0.70793754", "0.7016282", "0.6999164", "0.6997734", "0.6960618", "0.69556105", "0.69405204", "0.6929045", "0.68773997", "0.68773997", "0.68622255", "0.68...
0.8626803
0
Returns the perspective name and extension name (a 2 items array) for the given path. By default the blobs for resources content are stored in files named 'resource' with ext starting with a dot
def persp_and_ext_for_basename(path) [main_name(path).sub('resource-epo-',''), File.extname(path)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n name + extension\n end", "def file_title(path)\n filename_from_path(path).split(\".\")[0]\n end", "def split_path(path)\n m = CHEF_OBJECT_RE.match(path)\n unless m\n warn \"Skipping '#{path}' -- it doesn't look like '*cookbooks/**/*', '*roles/*.{rb,json}', '*environments...
[ "0.6222756", "0.61076194", "0.5940214", "0.59223026", "0.5907372", "0.5900902", "0.57627887", "0.57480156", "0.574314", "0.5740957", "0.5726824", "0.5703643", "0.56914824", "0.56693316", "0.5634907", "0.561513", "0.5581304", "0.55733824", "0.55678064", "0.55049616", "0.545777...
0.68448985
0
Returns the basename of a resource blob for a perspective named persp and in a format with extension ext (including the leading dot). see also persp_and_ext_for_basename
def basename_for_persp_and_ext(persp, ext) "resource-epo-#{persp}#{ext}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persp_and_ext_for_basename(path)\n [main_name(path).sub('resource-epo-',''), File.extname(path)]\n end", "def basename\n File.basename( fullpath, ext )\n end", "def path_name\n return unless @basename\n\n parts = @basename.split('.')\n parts.pop if parts.length > 1 && par...
[ "0.71994376", "0.6951703", "0.6906279", "0.68681073", "0.6795129", "0.6772939", "0.6714076", "0.67106754", "0.66917956", "0.6681591", "0.6680807", "0.66445214", "0.66301304", "0.66248095", "0.66248095", "0.6601679", "0.65960187", "0.6552587", "0.65388006", "0.65322244", "0.65...
0.799141
0
Deletes a resource by removing its identifying directory. Beware because this method doesn't care about other files which may coexist in the same filesystem branch.
def delete_completely(root, resource) path = File.join(root, resource.path(identifying_sym)) FileUtils.rm_rf(path) # removes the empty directories upward (resource.identifiers(identifying_sym).size - 1).times do |t| path = File.split(path).first begin FileUtils.rmdir(path) rescue Errno::ENOTEMPTY break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_resource(resource, version)\n log.debug \"deleting resource #{resource} #{version}\"\n data_file = %W(#{@datadir} #{resource} #{version} #{resource.split('/')[-1]}).join('/')\n # delete either the file or directory from data dir\n File.delete data_file if File.file? data_file\n ...
[ "0.7220338", "0.7194757", "0.7046599", "0.6910714", "0.68933547", "0.6866147", "0.6803142", "0.6783311", "0.67278063", "0.6675271", "0.66724575", "0.6649787", "0.6591593", "0.6583341", "0.65817636", "0.6566799", "0.65550286", "0.65275675", "0.6526787", "0.65231776", "0.647571...
0.6826526
6
Saves one or more resource at the filesystem path given at root This method is mainly an handy helper around batch_save, look at the source and at batch_save's doc
def save(root, resource, perspective=:default, exts=nil) exts ||= extensions batch_save(root, [resource].flatten, [perspective].flatten, [exts].flatten) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save(root, resources, persps, exts)\n batch_save_actions(root, resources, persps, exts) do |action|\n action.perform\n end\n end", "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root,...
[ "0.7635338", "0.66243577", "0.6067034", "0.5931464", "0.5767577", "0.56464463", "0.55878687", "0.55527407", "0.55380166", "0.5491703", "0.5483698", "0.54705024", "0.5463142", "0.54473186", "0.5441242", "0.5434289", "0.54005474", "0.5372312", "0.5358823", "0.5355736", "0.53519...
0.6817243
1
Saves all the resources, under all the perspectives persps, and all format given by extensions exts at the filesystem path root. resources, perps, exts, must respond to :each, like for Enumerable
def batch_save(root, resources, persps, exts) batch_save_actions(root, resources, persps, exts) do |action| action.perform end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_save_actions(root, resources, persps, exts)\n if block_given?\n resources.each do |resource|\n db_path = File.join(root, resource.path(identifying_sym))\n yield PrepareDirAction.new(db_path)\n exts.each do |ext|\n persps.each do |persp|\n bas...
[ "0.7092153", "0.68857044", "0.612171", "0.5859371", "0.575992", "0.5634296", "0.55421543", "0.5347554", "0.53025943", "0.5282195", "0.5123961", "0.51138026", "0.5113333", "0.50949955", "0.509466", "0.50825787", "0.5018392", "0.50049037", "0.49954116", "0.49954116", "0.4987611...
0.732681
0
Yields all the action needed to store all the resources at perspectives persps and with formats exts. All actions respond to :perform (it is when they're executed). If no block given, returns an Enumerator with these actions.
def batch_save_actions(root, resources, persps, exts) if block_given? resources.each do |resource| db_path = File.join(root, resource.path(identifying_sym)) yield PrepareDirAction.new(db_path) exts.each do |ext| persps.each do |persp| basename = basename_for_persp_and_ext(persp, ext) resource_path = File.join(db_path, basename) yield StoreResourceAction.new(resource_path, resource, persp, ext) end end end else Enumerator.new(self, :batch_save_actions, root, resources, persps, exts) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_actions\n catch_exceptions do\n @success = if block_given?\n result = yield\n actions.each { |action| results[action] = result }\n !!result\n else\n actions.compact.each { |action| !skip_actions && (results[action] = object.send(action)) }\n r...
[ "0.58765167", "0.587392", "0.5661069", "0.5458024", "0.52771187", "0.5229261", "0.5206296", "0.52009153", "0.5187542", "0.5149291", "0.5110233", "0.50481886", "0.50359124", "0.49605536", "0.4944478", "0.49286473", "0.4918648", "0.4882591", "0.48800528", "0.4869334", "0.482979...
0.70245516
0
Returns a new EPO::Observer for itself
def observer Observer.for_db(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_observer\n MockObserver.new self\n end", "def new_observer(model, &block)\n observer = Class.new(Mongoid::Observer) do\n attr_accessor :notifications\n\n def initialize\n super\n @notifications = []\n end\n end\n\n (class << observer; self;...
[ "0.7416641", "0.6902502", "0.6742458", "0.6701422", "0.65298146", "0.62121093", "0.6184156", "0.6184156", "0.6126644", "0.6088997", "0.5980146", "0.5919738", "0.5909515", "0.5871655", "0.58587646", "0.57926106", "0.5790771", "0.57283914", "0.5713082", "0.5569282", "0.554742",...
0.6469814
5
Iterates on every resource found and understood in the filesystem directory root. If no block is given, returns an iterator.
def each_resource_observation(root) if block_given? xp = observer models.each do |model| xp.on(model) do |obs| yield obs end end xp.read_tree(root) else Enumerator.new(self, :each_resource_observation, root) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n\t\t\t\treturn to_enum unless block_given?\n\t\t\t\t\n\t\t\t\t::Dir.glob(full_pattern, ::File::FNM_DOTMATCH) do |path|\n\t\t\t\t\t# Ignore `.` and `..` entries.\n\t\t\t\t\tnext if path =~ /\\/..?$/\n\t\t\t\t\t\n\t\t\t\t\tyield Path.new(path, @root)\n\t\t\t\tend\n\t\t\tend", "def each(&block)\n ...
[ "0.70037407", "0.6722634", "0.67042804", "0.6681511", "0.6579728", "0.6531829", "0.64882153", "0.6474995", "0.6434192", "0.6372756", "0.63610375", "0.6266384", "0.6210932", "0.61989033", "0.6183553", "0.61811864", "0.6175031", "0.61565804", "0.6146548", "0.6128862", "0.612854...
0.55679625
77
Use callbacks to share common setup or constraints between actions.
def set_profile @user = User.find(params[:id]) @profile = @user.profile 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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def profile_params params.require(:profile).permit(:name, :bio, :birthday, :twitter) 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
Use callbacks to share common setup or constraints between actions.
def set_point_guard_stat @point_guard_stat = PointGuardStat.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def point_guard_stat_params params.require(:point_guard_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :games_started, :games_played, :win, :loss, :wins, :losses, :minutes_played, :fieldgoals_made, :fieldgoal_attemps, :threepoints_made, :threepoint_attemps, :freethrows_made, :freethrow_attemps, :rebounds, :assists, :steals, :blocks, :points, :score, :opponent_score, :user_id, :stat_id, :sport_id, :position_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Private: Initialize Asset wrapper from attributes Hash. Asset wrappers should not be initialized directly, only Environmentfind_asset should vend them. attributes Hash of ivars Returns Asset.
def initialize(attributes = {}) @attributes = attributes @content_type = attributes[:content_type] @filename = attributes[:filename] @id = attributes[:id] @load_path = attributes[:load_path] @logical_path = attributes[:logical_path] @metadata = attributes[:metadata] @name = attributes[:name] @source = attributes[:source] @uri = attributes[:uri] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes_for(path)\n AssetAttributes.new(self, path)\n end", "def initialize(asset)\n @asset = asset\n end", "def asset_attributes=(attributes)\n unless asset.new_record?\n asset.attributes = attributes\n end\n end", "def assets\n EnvironmentAssetMethodsFactor...
[ "0.6384016", "0.6257911", "0.61876416", "0.5885055", "0.58094347", "0.58029765", "0.5754426", "0.57473016", "0.5737468", "0.5737468", "0.57296664", "0.57199156", "0.5710735", "0.5685801", "0.56841433", "0.56767154", "0.56767154", "0.56721556", "0.5653311", "0.5601549", "0.558...
0.5421494
60
Internal: Return all internal instance variables as a hash. Returns a Hash.
def to_hash @attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_variables_hash\n {}\n end", "def instance_variables_hash\n instance_variables.inject({}) do |acc, iv|\n acc[iv.to_s[1..-1]] = instance_variable_get(iv) unless [:@env, :@top].include?(iv.to_sym)\n acc\n end\n end", "def instance_variables_hash\n ...
[ "0.8479646", "0.8004027", "0.7989437", "0.79000324", "0.7868705", "0.7801212", "0.77961147", "0.7792911", "0.7782127", "0.77738845", "0.77610475", "0.77347285", "0.77235603", "0.7702196", "0.76905787", "0.7656854", "0.7640762", "0.76116914", "0.7572021", "0.7463685", "0.74462...
0.63113993
90
Public: Return logical path with digest spliced in. "foo/bar37b51d194a7513e45b56f6524f2d51f2.js" Returns String.
def digest_path if DigestUtils.already_digested?(@name) logical_path else logical_path.sub(/\.(\w+)$/) { |ext| "-#{etag}#{ext}" } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def path_with_fingerprint(digest)\n if Rails.env.development?\n pathname.to_s\n else\n sprockets_path_with_fingerprint(digest)\n end\n end...
[ "0.83635634", "0.7270988", "0.7147128", "0.69809395", "0.6870992", "0.6701046", "0.66437596", "0.66437596", "0.65050864", "0.64633024", "0.6454508", "0.6380829", "0.635202", "0.63293433", "0.6320092", "0.63150233", "0.6289059", "0.6266777", "0.6266221", "0.6236545", "0.623500...
0.78965664
1
Public: Return load path + logical path with digest spliced in. Returns String.
def full_digest_path File.join(@load_path, digest_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end", "def logical_path\n digest_path\n end", "def digest_path\n if DigestUtils.already_digested?(@name)\n logical_path\n else\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{etag}#{e...
[ "0.71245205", "0.6553707", "0.65431976", "0.64675695", "0.64177436", "0.63957435", "0.6304689", "0.60836434", "0.60177493", "0.59440017", "0.59432095", "0.59061414", "0.5889158", "0.58734107", "0.585569", "0.585569", "0.5831985", "0.5831985", "0.57912415", "0.57864416", "0.57...
0.7469544
0
Public: Get all externally linked asset filenames from asset. All linked assets should be compiled anytime this asset is. Returns Set of String asset URIs.
def links metadata[:links] || Set.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_paths\n search_path.children.select { |n| Cnfs::Core.asset_names.include?(base_name(n)) }.sort\n end", "def all_urls_external\n ngurls = NG_URL.all(:a_hrefs_external => { :$not => { :$size => 0}})\n urls_external = []\n ngurls.each {|n| urls_external += n.a_hrefs_external }\n urls_exter...
[ "0.65789104", "0.6529746", "0.6507517", "0.63165164", "0.62608844", "0.6236724", "0.61528", "0.61167866", "0.6068386", "0.6046189", "0.6037346", "0.603708", "0.60247153", "0.5964529", "0.5951236", "0.5940672", "0.59215367", "0.58697313", "0.5868775", "0.5868775", "0.5868775",...
0.5285678
79
Public: Return `String` of concatenated source. Returns String.
def source if @source @source else # File is read everytime to avoid memory bloat of large binary files File.binread(filename) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @source_string || format\n end", "def to_s\n source\n end", "def to_s\n source\n end", "def to_s\n @source\n end", "def to_s\n \"(#{source}-#{target})\"\n end", "def compile_script_string\n @sources.string\n end", "def concat(string); end", "def plai...
[ "0.6919735", "0.6726291", "0.6726291", "0.66409", "0.64276826", "0.6298255", "0.6271127", "0.6219377", "0.61574656", "0.61185443", "0.6115029", "0.6115029", "0.6115029", "0.6103059", "0.60930705", "0.6088341", "0.60883355", "0.60883355", "0.6050377", "0.60121024", "0.59944403...
0.0
-1
Public: Alias for source. Returns String.
def to_s source end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_name\n return @source_name\n end", "def name\n source.longname\n end", "def to_source; @name.to_s; end", "def name\n @name ||= source.name\n end", "def source(arg = nil)\n set_or_return(:source, arg, kind_of: [String])\n end", "def source_name\...
[ "0.72151077", "0.71125656", "0.6881194", "0.68185216", "0.6798246", "0.6792208", "0.6790796", "0.67412484", "0.67238414", "0.6605721", "0.65686023", "0.6553067", "0.6553067", "0.6519701", "0.64726955", "0.6406953", "0.64023256", "0.64023256", "0.63935184", "0.6375039", "0.637...
0.634191
27
Public: Get charset of source. Returns a String charset name or nil if binary.
def charset metadata[:charset] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charset\n match_data = headers['Content-Type']&.match(/charset=(.*);?/)\n return unless match_data\n\n Encoding.find(match_data[1])\n end", "def charset\n if @header\n has_content_type? ? content_type_parameters['charset'] : @charset\n else\n @charset\n end\n ...
[ "0.659046", "0.6367566", "0.6229204", "0.61779934", "0.6177169", "0.61548465", "0.6091332", "0.60854757", "0.59697956", "0.594551", "0.5923558", "0.5916024", "0.59149176", "0.58618385", "0.58477885", "0.5847129", "0.5847129", "0.5847129", "0.5831569", "0.58224195", "0.5801194...
0.6480153
1
Public: Returns Integer length of source.
def length metadata[:length] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n @source_data && @source_data.size || 0\n end", "def length() end", "def length() end", "def length() end", "def length() end", "def length\n length = 0\n each{|s| length += s.bytesize}\n length\n end", "def length\n do_num_bytes\n ...
[ "0.7498725", "0.72287357", "0.72287357", "0.72287357", "0.72287357", "0.7199743", "0.71793574", "0.71793574", "0.7176055", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71589386", "0.71346253", "0.7075841", "0.7055878", "0.7055878", "0...
0.6706688
52
Public: Returns String byte digest of source.
def digest metadata[:digest] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum\n source[digest_type]\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def to_str\n digest.to_str\n end", "d...
[ "0.7242832", "0.7078252", "0.70708394", "0.6899616", "0.6899616", "0.67935205", "0.66735333", "0.65877694", "0.6564932", "0.6516899", "0.6494263", "0.63890237", "0.6375513", "0.6354917", "0.6331262", "0.626284", "0.6195013", "0.6186284", "0.61346096", "0.6107745", "0.60934585...
0.6059115
23
Private: Return the version of the environment where the asset was generated.
def environment_version metadata[:environment_version] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version\n\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = self.dev_stage + \" \"\n\t\treturn dev_stage_string + self.maj_version.to_s + \".\" + self.min_version.to_s\n\tend", "def current_version\n @version\n end", "def version\n @context[:version]\n end"...
[ "0.69615805", "0.68095315", "0.67515105", "0.6736874", "0.6731159", "0.66549534", "0.66549534", "0.664992", "0.66052073", "0.65853703", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6568541", "0.6560332", "0.6560332...
0.8182466
0
Public: Returns String hexdigest of source.
def hexdigest DigestUtils.pack_hexdigest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hexdigest\n @digest.unpack('H*'.freeze).first\n end", "def sha\n Digest::SHA2.new.update(self.source).to_s\n end", "def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n ...
[ "0.7024892", "0.69064796", "0.679805", "0.67686576", "0.67412823", "0.66941434", "0.6669235", "0.6544983", "0.6532558", "0.64899343", "0.6483101", "0.64821243", "0.6461859", "0.64482766", "0.6448199", "0.64390695", "0.64390695", "0.64012575", "0.633038", "0.62840676", "0.6273...
0.75798994
0
Pubic: ETag String of Asset.
def etag version = environment_version if version && version != "" DigestUtils.hexdigest(version + digest) else DigestUtils.pack_hexdigest(digest) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n quote @etag\n end", "def etag\n headers[Merb::Const::ETAG]\n end", "def etag\n headers[Merb::Const::ETAG]\n end", "def etag\n '\"' + Digest::SHA1.hexdigest(@contents) + '\"'\n end", "def etag\n [@updated_at.to_i, @stats[:inode], @stats[:size]].join('-').to_s\n ...
[ "0.7164701", "0.7039365", "0.7039365", "0.7032124", "0.6977466", "0.69328827", "0.6925472", "0.6884995", "0.68725806", "0.6861124", "0.6757784", "0.6729066", "0.66988105", "0.663658", "0.65987927", "0.6598492", "0.6598492", "0.658027", "0.6167847", "0.61301166", "0.6113725", ...
0.6825404
10
Public: Returns String base64 digest of source.
def base64digest DigestUtils.pack_base64digest(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @str ||= Base64.encode64(get_digest).gsub(/\\s/, '')\n end", "def digest\n ''\n end", "def digest\n ''\n end", "def to_str\n digest.to_str\n end", "def asset_digest(source)\n asset_paths.digest_for(source)\n end", "def digest(string, algorithm)\n Base...
[ "0.69453037", "0.6894197", "0.6894197", "0.6651485", "0.6564605", "0.65619093", "0.63819534", "0.63583064", "0.6333095", "0.6247995", "0.61536855", "0.6151128", "0.60855085", "0.60849744", "0.59491485", "0.59455854", "0.5943745", "0.5929269", "0.5894392", "0.5887646", "0.5875...
0.7498065
0
Public: A "named information" URL for subresource integrity.
def integrity DigestUtils.integrity_uri(digest) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detail_url(resource_id)\n \"#{@path}#{resource_id}/\"\n end", "def resource_info\n\n \"content_#{id}\"\n\n end", "def _info_uri\n InfoURI + _uri_path\n end", "def resource_uri\n \"#{resource_name}/#{uid}\"\n end", "def url(name)\n compliance_data.dig(:information_urls, na...
[ "0.67207766", "0.6291825", "0.6152676", "0.60789734", "0.5912212", "0.57891583", "0.57761484", "0.5750071", "0.5731362", "0.57246226", "0.57246226", "0.5714385", "0.5600739", "0.55656147", "0.5557016", "0.55538565", "0.55530035", "0.55464685", "0.55451834", "0.55344087", "0.5...
0.0
-1
Public: Add enumerator to allow `Asset` instances to be used as Rack compatible body objects. block part String body chunk Returns nothing.
def each yield to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n body_parts = self.body.respond_to?(:each) ? self.body : [self.body]\n return body_parts.to_enum unless block_given?\n body_parts.each { |part| yield(part) }\n end", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "def each_body\n return enum_for(__method__) unles...
[ "0.5990316", "0.5804937", "0.5588729", "0.5574627", "0.52904314", "0.52704626", "0.5260081", "0.52489793", "0.52157116", "0.52052265", "0.51670265", "0.5096708", "0.5043923", "0.50391364", "0.5013054", "0.5008791", "0.50025827", "0.49947733", "0.49847922", "0.49540085", "0.49...
0.0
-1
Deprecated: Save asset to disk. filename String target Returns nothing.
def write_to(filename) FileUtils.mkdir_p File.dirname(filename) PathUtils.atomic_write(filename) do |f| f.write source end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save! target=\"./Videos of me\"\n filename = File.join(target, \"#{@name}#{File.extname(@url)}\")\n\n data = Faceoff.download(@url)\n\n Faceoff.safe_save(filename) do |file|\n file.write data\n end\n end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T...
[ "0.6649109", "0.6575976", "0.6575976", "0.6575976", "0.64619476", "0.64619476", "0.6323391", "0.6323391", "0.63100094", "0.6243263", "0.6023157", "0.59358555", "0.5926779", "0.5908261", "0.569015", "0.56778485", "0.5574059", "0.5555435", "0.5550762", "0.5545969", "0.5520001",...
0.55236053
20
Public: Pretty inspect Returns String.
def inspect "#<#{self.class}:#{object_id.to_s(16)} #{uri.inspect}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s()\n prettify()\n end", "def to_s\r\n pretty_output\r\n end", "def to_pretty\n to_s(:prettyprint => true)\n end", "def pretty_inspect\n self.inspect\n end", "def to_s\n PrettyPrinter.new.process(to_sexp)\n end", "def inspect\n pretty.uncolor\n end", "def pretty\n...
[ "0.77813023", "0.77532774", "0.75087094", "0.74502194", "0.73312813", "0.72572625", "0.72209173", "0.71229047", "0.7116847", "0.7116847", "0.7082408", "0.69985265", "0.68822056", "0.68822056", "0.68822056", "0.68822056", "0.68822056", "0.68254036", "0.6813857", "0.67518497", ...
0.0
-1
Public: Implements Objecthash so Assets can be used as a Hash key or in a Set. Returns Integer hash of the id.
def hash id.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n type.hash ^ (id.hash >> 1)\n end", "def hash\n @id.hash\n end", "def hash\r\n id.hash\r\n end", "def hash\n object_id\n end", "def hash\n id.hash\n end", ...
[ "0.6906005", "0.677124", "0.6748651", "0.6680012", "0.66352403", "0.6562436", "0.6552862", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65384024", "0.65361553", "0.6532537", "0.65229267", "0.6515815", "0.6515815", "0.6473561", "0.6446...
0.6594913
13
Public: Compare assets. Assets are equal if they share the same path and digest. Returns true or false.
def eql?(other) self.class == other.class && self.id == other.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(asset)\n path == asset.path\n end", "def should_compile_assets?\n diff.has_asset_changes? || !File.exist?('public/assets')\n end", "def same_files?(*files)\n images = files.map { |fname| Digest::MD5.digest(File.binread(fname)) }\n images.all? { |img| img == images[0] }\nend", "def di...
[ "0.6918989", "0.6430001", "0.64132154", "0.6225739", "0.6220296", "0.6181067", "0.6047955", "0.602548", "0.5981091", "0.59768564", "0.59706473", "0.5966043", "0.59490156", "0.5935902", "0.5930805", "0.5929558", "0.5919885", "0.5903177", "0.5903177", "0.5898984", "0.5888315", ...
0.0
-1
GET /administration/characters GET /administration/characters.xml
def index @characters = Character.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @characters } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def show\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n format.html # show....
[ "0.7364486", "0.6606827", "0.6486396", "0.64427096", "0.6426193", "0.6344041", "0.63225186", "0.6296009", "0.61372197", "0.61120534", "0.6110572", "0.61103415", "0.6105569", "0.60874784", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488", "0.6076488...
0.6786612
1
GET /administration/characters/1 GET /administration/characters/1.xml
def show @character = Character.get(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @character } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end", "def index\n @characters = Character.all\n\n respond_to do |format|\n format.html # index.html.erb\n format...
[ "0.7117075", "0.6543967", "0.64519495", "0.6266482", "0.626439", "0.615174", "0.60918856", "0.6071936", "0.59976935", "0.59520817", "0.5935417", "0.59254724", "0.59215343", "0.5911083", "0.58731705", "0.58684367", "0.58682317", "0.5842294", "0.583959", "0.5829219", "0.5797338...
0.64888686
2
GET /administration/characters/new GET /administration/characters/new.xml
def new @character = Character.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @character } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end", "def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xm...
[ "0.7137016", "0.6925831", "0.6724865", "0.66399926", "0.65627956", "0.65136784", "0.64825016", "0.64626825", "0.6402074", "0.6339901", "0.6266646", "0.6252525", "0.6251108", "0.624846", "0.62344414", "0.622349", "0.6184354", "0.61517066", "0.6136809", "0.6133991", "0.6126514"...
0.7145752
1
POST /administration/characters POST /administration/characters.xml
def create @character = Character.new(params[:character]) respond_to do |format| if @character.save format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') } format.xml { render :xml => @character, :status => :created, :location => @character } else format.html { render :action => "new" } format.xml { render :xml => @character.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @character = @user.build_character(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :loc...
[ "0.6119401", "0.60532725", "0.59966314", "0.59722495", "0.5949715", "0.5833275", "0.583012", "0.58243775", "0.5779657", "0.57792294", "0.57703334", "0.5741661", "0.57349503", "0.57203096", "0.57203096", "0.57126504", "0.5687078", "0.56835383", "0.56731176", "0.56637275", "0.5...
0.65709054
0
PUT /administration/characters/1 PUT /administration/characters/1.xml
def update @character = Character.get(params[:id]) params[:character] = params[:character].map { |x,y| [x, y.empty? ? nil : y ] }.to_hash respond_to do |format| if @character.update(params[:character]) format.html { redirect_to([:administration, @character], :notice => 'Character was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @character.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @character = current_user.characters.find(params[:id])\n\n # This has issues with case, resulting in dupes of the same tag\n #@character.tag_list = params[:character][:property] + \", \" + params[:tag_list]\n @character.tag_list = params[:tag_list]\n\n respond_to do |format|\n if @...
[ "0.6163145", "0.61080426", "0.60253054", "0.58980256", "0.58952814", "0.5878409", "0.5767526", "0.5690664", "0.5677809", "0.56575507", "0.56550324", "0.5623743", "0.561075", "0.5587094", "0.55801", "0.55734795", "0.5563027", "0.55590004", "0.55161834", "0.54790753", "0.547907...
0.6144497
1
DELETE /administration/characters/1 DELETE /administration/characters/1.xml
def destroy @character = Character.get(params[:id]) @character.destroy respond_to do |format| format.html { redirect_to(administration_characters_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html ...
[ "0.6568869", "0.6527403", "0.64687365", "0.64465743", "0.64369845", "0.64369845", "0.6379042", "0.6340527", "0.62999654", "0.6275097", "0.6264484", "0.62528837", "0.62353474", "0.6120227", "0.61194664", "0.60967565", "0.60912496", "0.60853964", "0.608458", "0.60781497", "0.60...
0.67580277
0
GET /formatings GET /formatings.json
def index @formatings = Formating.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats\n format\n end", "def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end", "def show\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @format_lookup }\n ...
[ "0.656752", "0.6453584", "0.6375833", "0.6352654", "0.6352654", "0.62484217", "0.6132412", "0.60642856", "0.603619", "0.6035052", "0.6019027", "0.60008866", "0.5933324", "0.5930376", "0.585235", "0.58520377", "0.58435005", "0.58376604", "0.5830927", "0.58206546", "0.58206546"...
0.67075765
0
GET /formatings/1 GET /formatings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @format_lookup = FormatLookup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @format_lookup }\n end\n end", "def show\n @format = Format.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.68791914", "0.6844439", "0.6668331", "0.65377665", "0.64687896", "0.64218235", "0.64218235", "0.63440186", "0.6338604", "0.6338604", "0.6293653", "0.6287987", "0.6249572", "0.62374616", "0.6180192", "0.60911155", "0.6088507", "0.60562027", "0.60402924", "0.5995865", "0.597...
0.0
-1
POST /formatings POST /formatings.json
def create @formating = Formating.new(formating_params) respond_to do |format| if @formating.save format.html { redirect_to @formating, notice: 'Formating was successfully created.' } format.json { render :show, status: :created, location: @formating } else format.html { render :new } format.json { render json: @formating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @format = Format.new(params[:format])\n\n respond_to do |format|\n if @format.save\n format.html { redirect_to @format, notice: 'Format was successfully created.' }\n format.json { render json: @format, status: :created, location: @format }\n else\n format.html { r...
[ "0.6418125", "0.62965673", "0.62727493", "0.6196958", "0.61826956", "0.61495453", "0.60170305", "0.5974338", "0.59592396", "0.59141797", "0.5867909", "0.5843478", "0.58393484", "0.5827798", "0.5826603", "0.57820547", "0.57538116", "0.5731132", "0.57188994", "0.57188994", "0.5...
0.6536987
0
PATCH/PUT /formatings/1 PATCH/PUT /formatings/1.json
def update respond_to do |format| if @formating.update(formating_params) format.html { redirect_to @formating, notice: 'Formating was successfully updated.' } format.json { render :show, status: :ok, location: @formating } else format.html { render :edit } format.json { render json: @formating.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @format = Format.find(params[:id])\n\n respond_to do |format|\n if @format.update_attributes(params[:format])\n format.html { redirect_to @format, notice: 'Format was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.7030892", "0.68600416", "0.66184556", "0.6616267", "0.66029674", "0.6584635", "0.65763205", "0.6568493", "0.65168923", "0.65038246", "0.64924484", "0.64761287", "0.6347763", "0.62703013", "0.6229367", "0.6106919", "0.60405225", "0.59873754", "0.59060967", "0.58870274", "0....
0.6964785
1
DELETE /formatings/1 DELETE /formatings/1.json
def destroy @formating.destroy respond_to do |format| format.html { redirect_to formatings_url, notice: 'Formating was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n format.html { redirect_to formats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @format = Format.find(params[:id])\n @format.destroy\n\n respond_to do |format|\n...
[ "0.7777993", "0.7578849", "0.7578849", "0.74083096", "0.7376506", "0.72876847", "0.72776294", "0.72439045", "0.7227275", "0.72269297", "0.7208472", "0.7171798", "0.7170333", "0.7134721", "0.7060468", "0.69911176", "0.6952951", "0.6952951", "0.6931997", "0.6925111", "0.6873674...
0.78304654
0
Use callbacks to share common setup or constraints between actions.
def set_formating @formating = Formating.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 formating_params params.require(:formating).permit(:article_format_id, :article_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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
helper method to fill the train full of passengers
def fill_train(train) 120.times { train.board(active_passenger, station) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(station)\r\n @station = station\r\n @train = nil\r\n @passengers = Array.new\r\n end", "def set_training\n @training = student.trainings.build\n end", "def set_train(train)\r\n @train = train\r\n end", "def train\n @badasspoints += 1\n end", "def initialize\n\t\t@tr...
[ "0.6616624", "0.63414437", "0.6041372", "0.5841471", "0.57378674", "0.56624705", "0.5657433", "0.55865383", "0.5515508", "0.54803216", "0.54798114", "0.54727316", "0.54563093", "0.5406053", "0.5376174", "0.5372072", "0.53648776", "0.5353674", "0.53228724", "0.5312346", "0.530...
0.7667284
0
GET /sms/1 GET /sms/1.json
def show @sm = Sm.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @sm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def retrieve_sms(message_id)\n Response.new self.class.get(\"/messages/#{message_id}\", :basic_auth => @auth, :headers => SMSIFIED_HTTP_HEADERS)\n end", "def show\...
[ "0.73304296", "0.69692653", "0.6927522", "0.6927392", "0.6884283", "0.67309207", "0.6712092", "0.66462827", "0.6631604", "0.65856844", "0.65630996", "0.6515046", "0.6481532", "0.646688", "0.6447078", "0.64457965", "0.6396502", "0.6386514", "0.63723654", "0.6368979", "0.635087...
0.6144414
31
GET /sms/new GET /sms/new.json
def new @sm = Sm.new respond_to do |format| format.html # new.html.erb format.json { render json: @sm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sms_tmp = SmsTmp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sms_tmp }\n end\n end", "def new\n @sms = Sms.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sms }\n end\n end...
[ "0.78628653", "0.7476829", "0.71100944", "0.7042367", "0.7042367", "0.70232785", "0.6992452", "0.69913846", "0.6988504", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969", "0.6969969",...
0.7467154
2
POST /sms POST /sms.json
def create @sm = Sm.new(params[:sm]) respond_to do |format| if @sm.save SmsMailer.send_sms(@sm).deliver format.html { redirect_to @sm, notice: "SMS Sent successfully to #{@sm.number}." } format.json { render json: @sm, status: :created, location: @sm } else format.html { render action: "new" } format.json { render json: @sm.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms\n send_sms(params)\n respond_to do |format|\n format.json {render :json => {:status => :success }}\n end\n end", "def sms\n account_sid = <your account sid>\n auth_token = <your auth token>\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n client.messages.create(\n from...
[ "0.7538926", "0.730763", "0.7238409", "0.71811897", "0.71362805", "0.7079376", "0.70778906", "0.70557135", "0.6993908", "0.6966665", "0.6960962", "0.6908357", "0.68156964", "0.6805102", "0.6770918", "0.6744358", "0.6731432", "0.6709422", "0.66859263", "0.6661228", "0.6644273"...
0.6883064
12
DELETE /sms/1 DELETE /sms/1.json
def destroy @sm = Sm.find(params[:id]) @sm.destroy respond_to do |format| format.html { redirect_to sms_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n for...
[ "0.763914", "0.753193", "0.7351058", "0.73134625", "0.73062015", "0.72668487", "0.72561693", "0.7167998", "0.7055462", "0.70198476", "0.6975877", "0.6897508", "0.6858554", "0.67807156", "0.673323", "0.6692594", "0.66611314", "0.6652349", "0.6615884", "0.6610818", "0.6606579",...
0.75781196
1
Define if there is a win on the board
def won?(board) WIN_COMBINATIONS.detect do |win| if (board[win[0]]) == "X" && (board[win[1]]) == "X" && (board[win[2]]) == "X" return win elsif (board[win[0]]) == "O" && (board[win[1]]) == "O" && (board[win[2]]) == "O" return win end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def win_check\r\n if $board == $boardwin\r\n true\r\n else\r\n false\r\n end\r\nend", "def win?\n true if @board.maker.code == @board.breaker.guess\n end", "def board_won?\n\t\twon = false\n\t\t\n\t\tWINNING_POSITIONS.each do |positions|\n\t\t\tn = 0\n\t\t\tfor i in 0..8\n\t\t\t n += 1 if (posit...
[ "0.8551473", "0.8211384", "0.8101445", "0.8089133", "0.8060109", "0.80387443", "0.80187297", "0.80120677", "0.80064267", "0.80064267", "0.80026704", "0.80026704", "0.79959", "0.79939336", "0.7985142", "0.7984486", "0.7980891", "0.7980594", "0.79798687", "0.79798687", "0.79717...
0.0
-1
Define if the board is full
def full?(board) board.none?{ |space| space == " "} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full?\n @board.all?{|occupied| occupied != \" \"}\n end", "def board_full?\r\n @game_board.count(\"\") == 0\r\n end", "def isBoardFull()\n #\n # TO DO: add your code below\n #\n for i in 0...@size\n for j in 0...@size\n if (@board[i][j]==EMPTY)\n ...
[ "0.8595504", "0.85309416", "0.8488368", "0.845583", "0.84209156", "0.8376601", "0.8312903", "0.8291548", "0.8272542", "0.8268285", "0.82621676", "0.82621676", "0.81839144", "0.8182286", "0.817136", "0.81712055", "0.81712055", "0.8168231", "0.8168231", "0.807645", "0.8050946",...
0.0
-1
Define if the game is over if the board has been won, is a draw, or is full
def over?(board) draw?(board) || full?(board) || won?(board) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def over?\n won? || board.full? || draw?\n end", "def over?(board)\n if draw?(board)\n true\n elsif won?(board) != nil && full?(board) == true\n true\n elsif won?(board) != nil && full?(board) == false\n true\n else\n false\n end\nend", "def over?(board)\n if draw?(board)\n true\n els...
[ "0.8975845", "0.86471444", "0.8646396", "0.86273646", "0.8588229", "0.85804623", "0.8498608", "0.8478309", "0.8478309", "0.8478309", "0.8467399", "0.8467399", "0.84590006", "0.84546274", "0.84486294", "0.8445636", "0.84451395", "0.8444978", "0.84447014", "0.8437174", "0.84211...
0.83821046
25
KairosDB message format: put
def metrics_line(name, value, timestamp) "put #{name} #{timestamp} #{value}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_msg(action, options)\n\n msg = prepare_msg_doc(action, options)\n msg['put_at'] = Ruote.now_to_utc_s\n\n msg['_rev'] = 0\n # in case of msg replay\n\n collection(msg).insert(to_mongo(msg))\n end", "def put(data)\n end", "def put *args, &block\n handle @conn.put *...
[ "0.6647159", "0.6628743", "0.6471865", "0.6426028", "0.6417919", "0.63964677", "0.62966514", "0.62548083", "0.6231688", "0.62138885", "0.6212708", "0.61596", "0.6158979", "0.6150119", "0.6097271", "0.60462946", "0.6043436", "0.603539", "0.602856", "0.5995085", "0.5976601", ...
0.0
-1
returns the worker method name, given the routing string.
def method_name(queue) queue.split("__").last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end", "def route_name; end", "def route_name; end", "def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end", "def route_name\n @route_name || default_route_name\n ...
[ "0.66431427", "0.6123058", "0.6123058", "0.60569453", "0.6002618", "0.5943787", "0.58222353", "0.58222353", "0.58106875", "0.5762752", "0.5702368", "0.5665815", "0.5648369", "0.56248045", "0.561237", "0.5606944", "0.56054085", "0.55966467", "0.55616003", "0.55559224", "0.5524...
0.6728938
0
returns the routing string, given a class and method. delegating.
def queue_for(clazz, method) ClassAndMethodRouting.queue_for(clazz, method) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inspect\n route.to_s\n end", "def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end", "def route_name; end", "def route_name; end", "def short_route\n @short_route ||= begin\n sr = \"#{objet}\" # sinon, passage par référence...
[ "0.6633795", "0.65750563", "0.6348266", "0.6348266", "0.6283413", "0.6215157", "0.6192929", "0.61612934", "0.6132842", "0.61017174", "0.60935205", "0.60742", "0.6066628", "0.60005456", "0.5990586", "0.5969153", "0.5950429", "0.5949694", "0.5926372", "0.58785015", "0.58704543"...
0.5569902
51
dare you to remove this! go on!
def queue_names_routing_class(clazz) self.select { |x, y| y.is_a?(clazz) }.map { |x, y| x } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def remove!; end", "def delelte\n\n end", "def celebration; end", "def remove_item\n\n end", "def suivre; end", "def deletedaysedit\n end", "def discard; end", "def discard; end", "def remove plataform\n end",...
[ "0.7453268", "0.7453268", "0.7453268", "0.7453268", "0.7099227", "0.68133885", "0.6527664", "0.6414961", "0.63682884", "0.6344492", "0.6326869", "0.6326869", "0.63231903", "0.6297889", "0.6297889", "0.6297889", "0.6297889", "0.6288105", "0.62163365", "0.62163365", "0.6189422"...
0.0
-1
Returns specific JSON based on occurrence
def as_json(options = {}) super(only: occurrence_fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filterKegg(json, datum)\n json.filter do |j|\n next if j[\"id\"][\"kegg\"].nil?\n j[\"id\"][\"kegg\"].any?(datum[\"KEGG\"])\n end\nend", "def search_monster_by_name_json(name)\n\tmonsters = Rails.cache.fetch(\"monster\")\n\tresult = Array.new\n\tmonsters.each do |m|\n\t\tif m[\"name\"].upcase.include...
[ "0.5774689", "0.56394416", "0.56175494", "0.54995936", "0.5499529", "0.5493445", "0.543209", "0.54216504", "0.5410042", "0.5398325", "0.53955185", "0.5324582", "0.5265653", "0.525732", "0.52540404", "0.5251907", "0.5248069", "0.5238134", "0.5233623", "0.5222793", "0.52203625"...
0.5263997
13
TODO: add validation on create Update fields based on occurence
def update_attributes(params = {}) super validate_attributes(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_create; end", "def validate_on_create #:doc:\n end", "def find_or_create_custom_fields\n @error_class_field = IssueCustomField.find_or_initialize_by_name('Error class')\n if @error_class_field.new_record?\n @error_class_field.attributes = {:field_format => 'string', :searchable ...
[ "0.6463926", "0.6358563", "0.63057", "0.6271207", "0.6264372", "0.61820704", "0.61815804", "0.6150351", "0.61167705", "0.6085915", "0.6068313", "0.6009253", "0.6007746", "0.59037304", "0.5902707", "0.5783897", "0.5768001", "0.574802", "0.5648668", "0.5648516", "0.5643096", ...
0.0
-1
Connery, Sean becomes Sean Connery
def natural_name last, rest = name.split(', ') [rest, last].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transact; end", "def leeway; end", "def leeway; end", "def internship_passed; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def schubert; end", "def anchored; end", "def tongue_twister; end", "def strain; end", "def villian; end", "def celebration; end", "de...
[ "0.5975429", "0.5778046", "0.5778046", "0.5770252", "0.57647854", "0.574683", "0.5723522", "0.5585905", "0.55423594", "0.5528035", "0.5520705", "0.54811794", "0.5461023", "0.54106325", "0.54020834", "0.5387564", "0.5382835", "0.53802276", "0.53576976", "0.535065", "0.53304875...
0.0
-1
casual a method that takes an array of integers, and returns a new array with every other element
def arr arr.gets.chomp arr.every other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_other(arr)\n new_array = []\n arr.each_with_index do |int, index|\n new_array << int if index.even?\n end\n new_array\nend", "def oddities(array)\n new_array = []\n array.each_with_index { |val, idx| new_array << val if idx.even? }\n new_array\nend", "def oddities(array)\n new_array = []\n...
[ "0.7765063", "0.74925214", "0.74800783", "0.7372222", "0.7367108", "0.7341767", "0.732569", "0.7305429", "0.7295646", "0.7295107", "0.72870183", "0.7281987", "0.7279082", "0.7265809", "0.7237457", "0.72363925", "0.7225795", "0.72242457", "0.7209263", "0.7202445", "0.7191781",...
0.0
-1
GET /setup_images GET /setup_images.json
def index @setup_images = SetupImage.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def get_images\n {}\n end", "def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end", "def images\n ...
[ "0.69578403", "0.68105143", "0.6670254", "0.66640836", "0.6536526", "0.64318055", "0.6386804", "0.63743997", "0.6367532", "0.6338391", "0.6328266", "0.6309938", "0.6290463", "0.6265324", "0.62472177", "0.6235345", "0.61736834", "0.6173317", "0.61668336", "0.61644685", "0.6147...
0.709687
0
GET /setup_images/1 GET /setup_images/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @setup_images = SetupImage.all\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def images\n ...
[ "0.71026933", "0.6834008", "0.6741748", "0.66412127", "0.66015875", "0.65720665", "0.65720665", "0.64957744", "0.6485875", "0.6459928", "0.6449575", "0.64161915", "0.63928956", "0.63881624", "0.6361356", "0.63168263", "0.6316786", "0.63126636", "0.63058704", "0.6297701", "0.6...
0.0
-1
POST /setup_images POST /setup_images.json
def create @setup_image = SetupImage.new(setup_image_params) respond_to do |format| if @setup_image.save format.html { redirect_to setup_path(@setup_image.setup_id), notice: 'Setup was successfully updated.' } format.json { render :show, status: :created, location: @setup_image } else format.html { render :new } format.json { render json: @setup_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_image_params\n params.require(:setup_image).permit(:setup_id, :image)\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def create\n @apartment = current_user.apartments.new(apartment_pa...
[ "0.681784", "0.65543956", "0.6303831", "0.62635", "0.62337154", "0.6214965", "0.61802816", "0.6173078", "0.6137321", "0.6121409", "0.6116104", "0.61096835", "0.61003244", "0.60777843", "0.60739785", "0.6028981", "0.6002002", "0.59794337", "0.59699404", "0.5964449", "0.593832"...
0.69055104
0
PATCH/PUT /setup_images/1 PATCH/PUT /setup_images/1.json
def update respond_to do |format| if @setup_image.update(setup_image_params) format.html { redirect_to @setup_image.setup, notice: 'Setup image was successfully updated.' } format.json { render :show, status: :ok, location: @setup_image } else format.html { render :edit } format.json { render json: @setup_image.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content...
[ "0.6779511", "0.6640825", "0.63569057", "0.6243799", "0.6202941", "0.61961436", "0.6196014", "0.6186075", "0.6179634", "0.614356", "0.61386883", "0.6095758", "0.6090155", "0.60816914", "0.6075981", "0.6075981", "0.6075981", "0.6075981", "0.60644954", "0.6059828", "0.60595286"...
0.6892546
0
DELETE /setup_images/1 DELETE /setup_images/1.json
def destroy @setup_image.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json {...
[ "0.71614194", "0.7121775", "0.70840627", "0.7064575", "0.70218575", "0.7020135", "0.7004635", "0.69549704", "0.69496924", "0.6917747", "0.6913477", "0.69103336", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.68787515", "0.6859757", "0.6859757", "0.6...
0.7487771
0
Use callbacks to share common setup or constraints between actions.
def set_setup_image @setup_image = SetupImage.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 setup_image_params params.require(:setup_image).permit(:setup_id, :image) 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