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
Configure after which time of inactivity the Gricer::Session should expire Default is 15 minutes
def max_session_duration @max_session_duration ||= 15.minutes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session_reset_timeout! \n session[:expire_at] = Time.now + MAX_SESSION_TIME.seconds\n end", "def extend_and_limit_session_time\n if Settler[:user_session_time_limit_enabled]\n request.session_options[:expire_after] = current_user && current_user.is_privileged? ? Settler[:user_session_privileged_t...
[ "0.77481914", "0.771725", "0.7694113", "0.7648574", "0.7581613", "0.7553446", "0.73877406", "0.73840487", "0.73796153", "0.72588545", "0.7245054", "0.72295284", "0.7206161", "0.71338445", "0.7128698", "0.71259284", "0.71138537", "0.70340675", "0.6969335", "0.69430596", "0.691...
0.7135031
13
Configure which type of models should be used in Gricer Set to :ActiveRecord or :Mongoid Default is :ActiveRecord
def model_type @model_type ||= :ActiveRecord end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_models_superclass\n ActiveRecord::VERSION::MAJOR >= 5 ? ApplicationRecord : ActiveRecord::Base\n end", "def base_class\n S::Model\n end", "def base_model\n BaseModel\n end", "def model_classes\n @opts[:models]\n end", "def model_type\n @model_type\n end",...
[ "0.65981615", "0.63934636", "0.6261931", "0.6251175", "0.6238638", "0.62376964", "0.61151105", "0.61151105", "0.60819024", "0.60818154", "0.5985013", "0.59392506", "0.5882688", "0.5876912", "0.58694124", "0.5867189", "0.585977", "0.58463323", "0.5793109", "0.5789722", "0.5782...
0.7693758
0
comes from product clinic create
def initialize(nfe_company) @nfe_company = nfe_company @company = nfe_company.company @clinic = nfe_company.clinic @social_contract = @clinic.clinic_social_contract @regime_parameter = @clinic.clinic_regime_parameter @tax_regime = Operations::Products::Clinics::RegimeParameterRepository::TAX_REG...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_full_product\n generate_product_name\n generate_product_code\n generate_product_manufacturer\n generate_product_description\n generate_product_price\n end", "def create\n @client = Client.find(params[:client_id])\n \n #verifica se selecionou o produto primeiro\n if prod_cli_par...
[ "0.6918684", "0.6526846", "0.6500416", "0.6422637", "0.63637114", "0.6342914", "0.632214", "0.63125354", "0.6296306", "0.6286903", "0.62825245", "0.6257117", "0.6256385", "0.6245922", "0.62238586", "0.62233686", "0.6215022", "0.6191002", "0.6187427", "0.6181685", "0.6173227",...
0.0
-1
Returns true if the current user is following the other user.
def following?(other_user) following.include?(other_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n ...
[ "0.8531212", "0.8511795", "0.8511795", "0.8511795", "0.84812903", "0.84812903", "0.84812903", "0.84812903", "0.84237736", "0.84133893", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", "0.83408505", ...
0.83136785
26
The spaceship () method can be used to compare two strings The method returns 0 if the strings are identical, 1 if the left hand string is less than the right hand string, and 1 if it is greater:
def sort_string(string) string.split(' ').sort {|x,y| x.length <=> y.length }.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spaceship_alphabetisch(other)\r\n return nil unless self.class == other.class\r\n if (@name <=> other.name) == 0\r\n if (@strasse <=> other.strasse) == 0\r\n if (@plz <=> other.plz) == 0\r\n return @ort <=> other.ort\r\n end\r\n return @plz <=> other.plz\r\n end\r\...
[ "0.68878996", "0.6797191", "0.6525676", "0.6445118", "0.64377344", "0.6418395", "0.63726914", "0.6332206", "0.6320324", "0.63152635", "0.63152635", "0.6258272", "0.6253967", "0.6234875", "0.6157862", "0.6130477", "0.6110547", "0.6100091", "0.60890555", "0.60740054", "0.607167...
0.0
-1
first attempt def random_select(array, n) random_array = Array.new (0...n).each do |x| random = rand(array.length) random_array.push(array[random]) end random_array end cleaner way; use times for regular loop
def random_select(array, n) random_arr = Array.new n.times do random_array << array[rand(array.length)] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_select(array, n)\n result = Array.new\n n.times do \n result << array[rand(array.length)]\n end\n return result\nend", "def random_select(array, n)\n result = []\n n.times do\n result << array[rand(array.size)]\n end\n return result\nend", "def random_select(array, n)\n randnumber = R...
[ "0.92346287", "0.91977596", "0.91868633", "0.9088155", "0.90599704", "0.90436065", "0.8990661", "0.8929543", "0.8791186", "0.86261004", "0.8615718", "0.7950946", "0.75404006", "0.7308215", "0.71857643", "0.7088622", "0.70809734", "0.7074773", "0.69833857", "0.69833857", "0.69...
0.9266677
0
Compute sum of cubes for given range 1st way def sum_of_cubes(a, b) sum = 0 ((ba)+ 1).times do sum += a3 a += 1 end sum end 2nd way
def sum_of_cubes(a, b) (a..b).inject(0) {|sum, x| sum + x*x*x} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_of_cubes(a, b)\n (a..b).inject(0) { |sum, x| sum += (x*x*x) }\nend", "def sum_of_cubes(a, b)\n=begin \n sum = 0\n (a..b).each do |n|\n s...
[ "0.8743639", "0.8743639", "0.8743639", "0.8667585", "0.8620539", "0.8599622", "0.8594734", "0.852518", "0.8462628", "0.84536195", "0.7721005", "0.771998", "0.702761", "0.7016779", "0.66479206", "0.6639092", "0.6466311", "0.6452739", "0.64363134", "0.6429046", "0.63592845", ...
0.86586934
4
Find nonduplicate values in an Array
def non_duplicated_values(values) values.each do |x| values.delete(x) if values.count(x) == 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend", "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_...
[ "0.80188566", "0.79064894", "0.7867911", "0.7749993", "0.7724181", "0.7645687", "0.76050824", "0.75328654", "0.75328654", "0.75164765", "0.75036246", "0.750335", "0.74955046", "0.74296325", "0.7418388", "0.7395216", "0.73831064", "0.73713964", "0.7348971", "0.7334989", "0.732...
0.6928575
56
def array_of_fixnums?(array) array.each do |x| if x.class != Fixnum return false else true end end
def array_of_fixnums?(array) array.all? { |x| x.is_a? Fixnum } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_of_fixnums?(array)\n for element in array\n unless element.is_a? Fixnum\n return false\n end\n end\n return true\nend", "def array_of_fixnums?(array)\n array.all? {|x| x.is_a? Fixnum}\nend", "def array_of_fixnums?(array)\n array.all? {|a| a.is_a?(Fixnum)}\nend", "def array_of_fixnum...
[ "0.95254916", "0.94756156", "0.9445352", "0.9402959", "0.9352962", "0.934739", "0.93329734", "0.8311976", "0.7538885", "0.73411024", "0.7298428", "0.7017786", "0.68463355", "0.66865623", "0.6672772", "0.6670515", "0.6625428", "0.6625228", "0.65938884", "0.6581714", "0.6521913...
0.94920653
2
Kaprekar's Number Kaprekar number k with ndigits, if you square it and add the right n digits to the left n or n1 digits, the resultant sum is k
def kaprekar?(k) # k was convert to string to use the array properties num_length = k.to_s.size square = (k ** 2).to_s second_half = square[-num_length..-1] #if number is even n-1; odd number n-2 first_half = square.size.even? ? square[0..no_of_digits-1] : square[0..no_of_digits-2] # must convert all nu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kaprekar?(k)\n=begin\n sqr = k**2\n digits = k.to_s.length\n right_n_digits = sqr.to_s[(0-digits)..-1].to_i\n left_digits = sqr.to_s[0..(1-digits)].to_i\n left_digits + right_n_digits == k\n=end\n n = Math.log10(k).to_i + 1\n value = k**2 \n k == value % (10**n) + value / (10**n) \nend", "def kapre...
[ "0.84663606", "0.80056477", "0.80056477", "0.79993695", "0.776261", "0.77559507", "0.7643294", "0.7625692", "0.7564662", "0.75314516", "0.7414264", "0.7399641", "0.73471594", "0.7341753", "0.73123586", "0.7309497", "0.7309497", "0.7278878", "0.72773224", "0.7277197", "0.72670...
0.7378485
12
Absolute difference in brighness indices
def brightness_difference(another_color) ##two object -- 2 colors (brightness_index - another_color.brightness_index).abs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bray_curtis(a, b)\n num = (0 .. (a.size - 1)).map { |i| (a[i] - b[i]).abs }.reduce(:+)\n den = (0 .. (a.size - 1)).map { |i| a[i] + b[i] }.reduce(:+)\n return num.to_f / den\n end", "def find_difference(a, b)\n # use inject to get volume of each array and take absolute of result\n # to account fo...
[ "0.57302475", "0.5714151", "0.56706434", "0.56706434", "0.56439096", "0.56378186", "0.56216455", "0.54519796", "0.54507715", "0.54418516", "0.54372716", "0.53593415", "0.53411806", "0.53296584", "0.532643", "0.53163415", "0.5312551", "0.53096086", "0.5303635", "0.53029287", "...
0.54706204
7
Brightness difference is more than 125 and the Hue difference is more than 500 then the colors have sufficient contrast
def enough_contrast?(another_color) brightness_difference(another_color) > 125 && hue_difference(another_color) > 500 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightness(red, green, blue)\n min, max = [red, green, blue].minmax\n\n (min + max) / (2.0 * 255)\n end", "def brightness(red, green, blue)\n Math.sqrt(0.299 * red**2 + 0.587 * green**2 + 0.114 * blue**2).round\n end", "def saturation(red, green, blue)\n # return 0 for ...
[ "0.7421092", "0.72615343", "0.7195956", "0.7146036", "0.6982036", "0.69148576", "0.6808095", "0.6728502", "0.6724866", "0.6672621", "0.6672621", "0.66408235", "0.6637057", "0.66333973", "0.66142714", "0.65777975", "0.65777975", "0.6522225", "0.64663213", "0.6423816", "0.64238...
0.7217475
2
Encrypts the current string using the current key and algorithm specified.
def encrypt(password) cipher = build_cipher(:encrypt, password) [cipher.update(self) + cipher.final].pack('m').chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(str)\n return str unless str.is_a?(String) && @derived_key\n return \"\" if str == \"\"\n\n cipher = OpenSSL::Cipher.new(CIPHER).encrypt\n\n # Technically, this is a \"bad\" way to do things since we could theoretically\n # get a repeat nonce, compromising the algorithm. That said, it sh...
[ "0.7200807", "0.7192047", "0.7142054", "0.7037206", "0.6985448", "0.6972262", "0.6830822", "0.679761", "0.67946005", "0.67684215", "0.67506164", "0.6743481", "0.67392296", "0.67372096", "0.67217237", "0.6683768", "0.6676924", "0.6575909", "0.65610725", "0.65414417", "0.651523...
0.0
-1
division operator to get the float the object needs to have a float number
def /(other) self.num / other.num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_f\n @val / @div.to_f\n end", "def divide(other)\n Rubinius.primitive :float_div\n redo_coerced :/, other\n end", "def Float(p0) end", "def /( value )\n\t\t\tcase value\n\t\t\twhen Float, Fixnum\n\t\t\t\tvalue = value.to_f\n\t\t\t\treturn self.class.new( @elem[0] / value,\n\t\t\t\t\t\t\t...
[ "0.74884844", "0.74277335", "0.72427195", "0.71221143", "0.7037643", "0.6983812", "0.68943596", "0.6864292", "0.6855232", "0.6838918", "0.6833559", "0.6826791", "0.6786557", "0.6766857", "0.67065436", "0.6674873", "0.6672952", "0.6670185", "0.66690874", "0.66601676", "0.66398...
0.0
-1
line method: shows everyone's current place in line
def line(katz_deli) line_position = [] if katz_deli == [] puts "The line is currently empty." else katz_deli != [] katz_deli.each_with_index { |name, index| line_position << "#{index+1}. #{name}" } ##make the array the way you want the texts to display* puts "The line is currently: #{line_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(people_in_line = [])\n if (people_in_line.size == 0)\n puts \"The line is currently empty.\"\n return\n end\n line_message = \"The line is currently:\"\n people_in_line.each_index do |current_spot|\n line_message << \" #{current_spot + 1}. #{people_in_line[current_spot]}\"\n end\n puts line...
[ "0.71588117", "0.709991", "0.709991", "0.709991", "0.70645654", "0.70645654", "0.69926244", "0.69035923", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", "0.6862059", ...
0.6663638
27
take a number: gives "name" a "number" in line
def take_a_number(katz_deli, name) katz_deli.push(name) # return the person's name along with their position in line by using the hashtag, swingly brackets to call every arguement's iteration puts "Welcome, #{name}. You are number #{katz_deli.length} in line." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num\n name\n end", "def take_a_number(katz_deli, name)\n # add person to end of line\n katz_deli << name\n # call out (`puts`) the person's name along with their position in line\n puts \"Welcome, #{name}. You are number #{katz_deli.size} in line.\"\nend", "def take_a_number(deli, name)\n de...
[ "0.65369946", "0.6476087", "0.6463769", "0.64471626", "0.6436044", "0.6374316", "0.635435", "0.63362217", "0.6275058", "0.6241268", "0.6181553", "0.6135443", "0.6135443", "0.61291915", "0.61232024", "0.61211044", "0.60701084", "0.6037744", "0.6003788", "0.5986359", "0.5936594...
0.6220793
10
needed here instead of inherit from article, because the parse method must be called before
def next self.class.where(:created_at.gt => created_at).order(created_at: :desc).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse( content, baseuri )\n\t\tsuper\n\tend", "def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author =...
[ "0.7153891", "0.7029631", "0.68988967", "0.68988967", "0.6876836", "0.6876836", "0.6876836", "0.68021965", "0.6754733", "0.6751747", "0.67384803", "0.67113364", "0.6569438", "0.6565853", "0.6565037", "0.65397525", "0.6392842", "0.6392842", "0.6392842", "0.6392842", "0.6389832...
0.0
-1
GET /cables/1 GET /cables/1.xml
def show @cable = Cable.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @cable } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cables = Cable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cables }\n end\n end", "def index\n @cables = Cable.all\n end", "def index\n @cables = Cable.all\n end", "def index\n @car = Car.find(params[:car_id])\n ...
[ "0.7325022", "0.6446389", "0.6446389", "0.5996179", "0.595698", "0.5954133", "0.5897114", "0.58847636", "0.58672696", "0.58557856", "0.582673", "0.5805414", "0.57881063", "0.578645", "0.5765688", "0.5763063", "0.57486135", "0.5723837", "0.57024527", "0.56970537", "0.56845695"...
0.660009
2
methods for hierarchical entities support
def get_hierarchy(entity_class) content_tag(:ul, entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root| get_subtree(root) }.join) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entities; end", "def child_relation; end", "def children_table; end", "def all_descendent_members\n raise TypeError.new(\"can only call on a persisted object\") unless persisted? && id.present?\n\n sql = <<~EOS\n id IN (WITH RECURSIVE tree AS (\n SELECT id, ARRAY[]::UUID[] AS ancestors\...
[ "0.70705235", "0.6310103", "0.62384015", "0.61602354", "0.6066421", "0.6034994", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5880592", "0.5874119", "0.5826839", "0.5816095", ...
0.65536934
1
save values from settings form
def save_settings rf = Plugins::CamaleonRobotsEditor::CamaleonRobotsEditor.new rf.write params[:robots_content] if params[:robots_content].present? redirect_to url_for(action: :settings), notice: 'Settings Saved Successfully' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_settings\n @plugin.set_options(params[:options]) if params[:options].present? # save option values\n @plugin.set_metas(params[:metas]) if params[:metas].present? # save meta values\n @plugin.set_field_values(params[:field_options]) if params[:field_options].present? # save custom field values\n ...
[ "0.75796866", "0.7119507", "0.707783", "0.70438087", "0.7009266", "0.68439806", "0.6789365", "0.66617924", "0.6620303", "0.6555984", "0.65220857", "0.64357007", "0.6424825", "0.6417836", "0.6332926", "0.63148123", "0.62041277", "0.61782444", "0.61673117", "0.6147378", "0.6081...
0.6566141
9
Returns a list of fragments that have mappings in a given URI
def fragments_for kb, uri root_fragments = kb.find(nil, Node('rdf:type'), Node('sc:Fragment')) - kb.find([], Node('sc:subfragment'), nil) selectors = [] fragments = {} root_fragments.each do |fragment| fragment.sc::selector.each do |selector| fragments[selector] = fragment ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_uris(uri, uri_content)\n # in our case, no new uri can be extracted from a web resource\n return Array.new()\n end", "def maps_for_range(range)\n last = (range.exclude_end?) ? range.last : range.last + 1\n maps.select { |m| m.start_addr >= range.first and m.max < last }\n end", ...
[ "0.55692106", "0.54057235", "0.5400141", "0.5357407", "0.5200326", "0.5195525", "0.51928824", "0.51216674", "0.51047796", "0.5091569", "0.5064321", "0.50425124", "0.50360334", "0.4855468", "0.4843792", "0.4804447", "0.4750077", "0.47344992", "0.47181505", "0.46973938", "0.467...
0.6319253
0
Extracts all mappings from a fragment and returns a graph
def extract_graph fragments, options output = RDF::Graph.new fragments.each { |fragment| fragment.extract(options).each { |result| output << result } } output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency_graph\n Hash[fragments.map { |f| [f.name, f.required_fragments] }]\n end", "def fragments_for kb, uri\n root_fragments = kb.find(nil, Node('rdf:type'), Node('sc:Fragment')) - kb.find([], Node('sc:subfragment'), nil)\n\n selectors = []\n fragments = {}\n root_fragmen...
[ "0.5595981", "0.5558629", "0.55356854", "0.54135716", "0.5250562", "0.51954955", "0.5123627", "0.51153016", "0.50633603", "0.5055055", "0.5023341", "0.49379015", "0.4934607", "0.4934243", "0.48742586", "0.48678163", "0.4865064", "0.48370224", "0.48250306", "0.47880933", "0.47...
0.6536998
0
Use callbacks to share common setup or constraints between actions.
def set_menu @menu = Menu.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 menu_params params.fetch(:menu, {}).permit(:name) 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
Added to override update without having to confirm password
def update # Override Devise to use update_attributes instead of update_with_password. # This is the only change we make. if resource.update_attributes(params[resource_name]) set_flash_message :notice, :updated # Line below required if using Devise >= 1.2.0 sign_in resource_name, resource,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_password; end", "def password_change_new\n\n end", "def change_password\r\n \r\n end", "def update_with_password(params, *options); end", "def send_password_change_notification; end", "def update_password(new_password)\n super(new_password).tap do |status|\n UserMailer.password_chan...
[ "0.7985025", "0.77284425", "0.765835", "0.7471535", "0.7461836", "0.73742896", "0.734335", "0.730354", "0.72659814", "0.7262013", "0.7261325", "0.72602606", "0.72335416", "0.72142", "0.72142", "0.72142", "0.72142", "0.72142", "0.72142", "0.72142", "0.72142", "0.72142", "0...
0.0
-1
this method increment the votes correspondit to the series the time is used to verify which series was last voted using that approach, all mandatory cases are satisfied moreover the app will use a coherent algorithm
def count_votes(series_id) @vote_counter[series_id.to_sym] = [@vote_counter[series_id.to_sym].first + 1, Time.new] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voted\n new_total = self.votes + 1\n return self.update(votes: new_total)\n end", "def increment_votes\n Article.increment_vote_cache(article_id)\n end", "def add_vote\n self.increment!(:votes, 1)\n end", "def update_votes(count)\n update votes: @data[:votes] + count do |d...
[ "0.6582601", "0.65737003", "0.6478799", "0.64723843", "0.64562166", "0.645233", "0.64263684", "0.6387146", "0.63408977", "0.62235105", "0.6198807", "0.6180159", "0.61025923", "0.6088319", "0.60389024", "0.602271", "0.6015976", "0.6004306", "0.5974252", "0.5915877", "0.590353"...
0.719105
0
methods for static pages spec
def should_have_correct_static_pages_links visit root_path click_link "About" page.should have_selector 'title', text: full_title('About Us') click_link "Help" page.should have_selector 'title', text: full_title('Help') click_link "Contact" page.should have_selector 'title', text: full_title('Contact') click_li...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def template_page(site); end", "def pages\n end", "def sample_...
[ "0.7244579", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.7085335", "0.6963922", "0.6951677", "0.6823776", "0.6786806", "0.6652557", "0.6624695", "0.661775", "0.6607957", "0...
0.63080394
35
methods for authentication pages spec
def sign_in(user) visit signin_path fill_in "Email", with: user.email fill_in "Password", with: user.password click_button "Sign in" # filling in the form doesn’t work when not using Capybara cookies[:remember_token] = user.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth\n end", "def auth\n end", "def login_page\n end", "def user_authentication\n end", "def auth_methods; end", "def loginpage\n end", "def authorization; end", "def http_auth_login\n # FIXME: Implement\n end", "def authenticate\n end", "def test_page_security\n ...
[ "0.7254451", "0.7254451", "0.718169", "0.71317005", "0.7073817", "0.7017671", "0.6944324", "0.6932204", "0.69296", "0.68551964", "0.682155", "0.6808367", "0.6648558", "0.66182745", "0.66182745", "0.66170645", "0.6616469", "0.6579112", "0.65778786", "0.6570269", "0.65608037", ...
0.0
-1
How we get from input to output. What happens, when none is necessary, and none is sufficient?
def output_on(input_statuses) input_statuses.each_with_index do |input_on, i| actual_input = inputs[i] if actual_input.sufficient && input_on return true elsif actual_input.necessary && !input_on return false end end return input_statuses.count{|i| i == true} >= 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input?; @input; end", "def input; end", "def input; end", "def input; end", "def empty\n @input.empty? && @output.empty?\n end", "def input; @input; end", "def input; @input; end", "def output? ; !!@output ; end", "def input=(_arg0); end", "def get_input(original_input, msg)\n if...
[ "0.67111003", "0.62797624", "0.62797624", "0.62797624", "0.6112867", "0.60698164", "0.60698164", "0.60108924", "0.5974531", "0.58662134", "0.5779402", "0.57674193", "0.56681174", "0.5633091", "0.5628972", "0.56008947", "0.5593714", "0.55638146", "0.5551925", "0.5551925", "0.5...
0.0
-1
This is the main command. It will build the ruby version requested suitable for crossplatform development.
def compile_ruby if $DEBUG puts "user_home: #{user_home}" puts "user_local: #{user_local}" puts "make_command: #{make_command}" puts "version: #{version}" puts "ruby_cc_version: #{ruby_cc_version}" puts "ruby_source: #{ruby_source}" puts "srcdir: #{srcdir}" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby\n \"ruby1.9.3 -S\"\n end", "def build_ruby\n bin = RbConfig::CONFIG[\"RUBY_INSTALL_NAME\"] || RbConfig::CONFIG[\"ruby_install_name\"]\n bin << (RbConfig::CONFIG['EXEEXT'] || RbConfig::CONFIG['exeext'] || '')\n File.join(RbConfig::CONFIG['bindir'], bin)\n end", "def pre_build\n puts \"...
[ "0.6849308", "0.67481226", "0.6366869", "0.63496333", "0.6333272", "0.62996745", "0.6184311", "0.61588484", "0.6146713", "0.61068434", "0.6099303", "0.6065598", "0.60192454", "0.60051334", "0.5999855", "0.59978116", "0.5990287", "0.5928072", "0.5924743", "0.592337", "0.590282...
0.6160805
7
Clean intermediate files and folders. TODO: What should be removed here?
def clean #rm_r(srcdir) rm_r(blddir) #rm_r(libdir) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n ...
[ "0.8124505", "0.8124505", "0.78446484", "0.7699047", "0.7622006", "0.7621687", "0.74319446", "0.7424447", "0.7351675", "0.7159202", "0.7159202", "0.7147675", "0.7081903", "0.70605654", "0.7058778", "0.702661", "0.70265806", "0.70005226", "0.69640493", "0.6943233", "0.69431156...
0.74664354
6
Remove the final products and sources
def clobber rm_r(srcdir) rm_r(blddir) rm_r(libdir) rm_r(config_file) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_dependent_entries\n product = self.product\n variants = (product.variants.present? ? product.variants : product.master)\n product.stock_products.where(:sellers_market_places_product_id=>self.id).destroy_all\n #product.title_managements.where(:market_place_id=>self.market_place_id).de...
[ "0.68019396", "0.6571545", "0.6364874", "0.6167079", "0.61312133", "0.6099436", "0.6070928", "0.6051605", "0.60363", "0.6008968", "0.60063595", "0.6000749", "0.5978007", "0.59562546", "0.594655", "0.5932206", "0.5928735", "0.5925636", "0.5892773", "0.5892773", "0.58768904", ...
0.0
-1
TODO: Better way to get the default? How to keep quiet?
def make_command @make_command ||= %w[gmake make].find{ |c| system("#{c} -v") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default\r\n @opts[:default]\r\n end", "def quiet?; run_options[:quiet]; end", "def default_value_noninteractive\n default_value\n end", "def quiet; end", "def quiet=(_arg0); end", "def default\n options[:default]\n end", "def quiet(which = T.unsafe(nil)); end", "...
[ "0.6945926", "0.6930017", "0.68317753", "0.6505117", "0.65020937", "0.6370035", "0.63406473", "0.63263553", "0.62643087", "0.62550527", "0.6236153", "0.6236153", "0.6206395", "0.6192477", "0.6188809", "0.61473835", "0.6137984", "0.61149114", "0.61137015", "0.60998285", "0.609...
0.0
-1
grab the major "1.8" or "1.9" part of the version number
def major @major ||= ruby_cc_version.match( /.*-(\d.\d).\d/ )[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def major_version\n version.match(/(\\d\\.\\d)/)[0] if name.is_a? String\n end", "def major(version)\n res = 0\n res = Regexp.last_match(1) if version =~ /^\\s*(\\d+)\\.\\d+\\.\\d+/\n res\n end", "def major_version(version = nil)\n version ||= installed_version?\n return \"0\" i...
[ "0.8596339", "0.8264705", "0.80492765", "0.8045939", "0.80334044", "0.80049914", "0.7782471", "0.7640726", "0.75294644", "0.75294644", "0.75294644", "0.7470927", "0.74079657", "0.73912466", "0.73891574", "0.735709", "0.7265331", "0.72627115", "0.7252245", "0.7224644", "0.7188...
0.75989604
8
TODO: Sure this isn't supposed to be "i586mingw32msvc" ?
def target @target ||= "i386-mingw32" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend", "def target_win32?\n return true if ENV['OS'] == 'Windows_NT'\n build.is_a?(MRuby::CrossBuild) && build.host_target.to_s =~ /mingw/\nen...
[ "0.7056626", "0.7009918", "0.69197226", "0.6898842", "0.6884986", "0.67687744", "0.67636997", "0.6675617", "0.66364354", "0.66241235", "0.66057646", "0.65001655", "0.6417663", "0.63975286", "0.6322688", "0.6312657", "0.63064545", "0.63064545", "0.62517625", "0.624038", "0.621...
0.6886042
4
Use MinGW helper to find the proper host.
def mingw_host @mingw_host ||= MinGW.mingw_host end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_least_used_compatible_host(_pool_name, _vm_name)\n #for v1 virtualbox support this is all local so the hostname will always be localhost\n return 'localhost'\n end", "def dev_host\n case Socket.gethostname\n when /romeo-foxtrot/i ; true\n else ; false\n end\nend", "def get...
[ "0.6517707", "0.6308874", "0.6190679", "0.60511994", "0.60511994", "0.59908736", "0.59669906", "0.5963524", "0.5963524", "0.5940772", "0.5937247", "0.5934251", "0.59335333", "0.59315854", "0.5881487", "0.5876331", "0.5875105", "0.5852504", "0.585225", "0.582584", "0.58219326"...
0.7777432
0
Update rakecompiler list of installed Ruby versions.
def update_config if File.exist?(config_file) then puts "updating #{config_file}" config = YAML.load_file(config_file) else puts "generating #{config_file}" config = {} end files = Dir.glob(File.join(libdir, '**', "rbconfig.rb")).sort files.each do |rbconf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development\n\n gem \"rake-compiler\", \"~> 1.0\"\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end", "def compile\n upgrade = []\n caskroom.enumerate do |cask|\n ...
[ "0.54368824", "0.5208393", "0.5203206", "0.5150904", "0.5133031", "0.5106958", "0.5101678", "0.5100428", "0.49945202", "0.49721715", "0.4970778", "0.49706176", "0.48760328", "0.4874213", "0.48451978", "0.47708514", "0.4758893", "0.47575694", "0.47552863", "0.47528568", "0.470...
0.0
-1
Cloud Credential Support retrieves the associated cloud credential to be used by the project for provisioning
def cloud_credential (self.cloud_credential_id.nil? ? nil : Account.find_cloud_credential(self.cloud_credential_id)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credential\n @path = \"/services/Cloud\"\n @credential ||= Nephophobia::Resource::Credential.new self\n end", "def cloud_credential(cloud_credential_id)\n cred = self.cloud_credentials.select { |ca| ca.id.to_s == cloud_credential_id.to_s }.first\n #If openstack, merge the cloud_acc...
[ "0.77189314", "0.7565788", "0.69053286", "0.6838504", "0.6764776", "0.67175436", "0.66694015", "0.66253114", "0.66253114", "0.661534", "0.661534", "0.65676343", "0.6555923", "0.64854556", "0.643419", "0.6420746", "0.63929725", "0.63300204", "0.62778246", "0.6250551", "0.62283...
0.75092816
2
stores the associated cloud credential to be used by the project for provisioning
def cloud_credential=(cloud_credential) self.cloud_credential_id = (cloud_credential.kind_of?(String) ? cloud_credential : cloud_credential.id.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credential\n @path = \"/services/Cloud\"\n @credential ||= Nephophobia::Resource::Credential.new self\n end", "def cloud_credential\n (self.cloud_credential_id.nil? ? nil : Account.find_cloud_credential(self.cloud_credential_id))\n end", "def credential; end", "def credential; en...
[ "0.7566146", "0.7015598", "0.6982942", "0.6982942", "0.6899552", "0.67362386", "0.66866034", "0.6523126", "0.6473993", "0.6473993", "0.6473993", "0.6473993", "0.6473993", "0.646366", "0.64372003", "0.64372003", "0.6435496", "0.64327526", "0.6219953", "0.62192184", "0.6216377"...
0.68007904
5
Construct a new FindIt::Asset::MapMarker instance. Parameters: [url] URL of the marker image. [params] Parameters for the marker. Returns: A FindIt::Asset::MapMarker instance. Parameters: [:height] Height of the image in pixels. (default: DEFAULT_MARKER_HEIGHT) [:width] Width of the image in pixels. (default: DEFAULT_M...
def initialize(url, params = {}) height = params[:height] || DEFAULT_MARKER_HEIGHT width = params[:width] || DEFAULT_MARKER_WIDTH @marker = FindIt::Asset::Image.new(url, :height => height, :width => width) @shadow = if params[:shadow] url_shadow = params[:shadow] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_image(lat, long, width=500, height=400)\n \"http://maps.google.com/maps/api/staticmap?zoom=16&size=#{width}x#{height}&markers=#{lat},#{long}&sensor=false\"\n end", "def new_map(url)\n Map.new(name: \"1866 Fred\",\n year: \"1866\",\n url: url)\n end", "def map_image locatio...
[ "0.5652082", "0.56132966", "0.55655444", "0.5291152", "0.52587086", "0.5238504", "0.516541", "0.5040643", "0.4991296", "0.49807638", "0.49322712", "0.49226624", "0.49220917", "0.4869536", "0.4828232", "0.48123968", "0.4798592", "0.4788409", "0.47632346", "0.47281936", "0.4700...
0.8191061
0
Returns whether or not there's a Ruby gem for this repo.
def gem? @gem end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby?\n exist? 'Gemfile'\n end", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def exist?\n ruby_gems_fetcher.started?\n end", "def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError...
[ "0.7817534", "0.7212215", "0.7212215", "0.7206547", "0.71149707", "0.70805866", "0.7075685", "0.7055315", "0.70462674", "0.7020846", "0.7019775", "0.70193464", "0.6976598", "0.69667304", "0.6928537", "0.69189376", "0.68800426", "0.6806543", "0.6750705", "0.66884184", "0.66809...
0.77315235
1
Returns the URL to the project page on GitHub.
def url "http://github.com/#{@account}/#{name}/tree/master" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_url(project)\n \"github.com/#{project.name}\"\n end", "def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end", "def url\n \"http://github.com/#{login}\"\n end", "def github_pages_url\n link = object.path.gsub(\"::\", \"/\")\n link....
[ "0.8288522", "0.8006524", "0.7946373", "0.7748727", "0.7494832", "0.74559915", "0.74242646", "0.74224067", "0.74087816", "0.7356947", "0.72958696", "0.7287225", "0.7197449", "0.7113546", "0.71017635", "0.7047466", "0.6994342", "0.69413805", "0.69096977", "0.6899371", "0.68993...
0.7554885
4
Returns the public clone URL.
def clone_url "git://github.com/#{@account}/#{name}.git" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_url\n raise \"not implemented\"\n end", "def public_url\n self.container.public? ? self.container.cdn_url + \"/#{URI.encode(@name)}\" : nil\n end", "def public_uri\n nil\n end", "def public_url\n @attributes[:public_url]\n end", "def public_path(options={})...
[ "0.7393258", "0.6822731", "0.67316437", "0.67127997", "0.65534914", "0.6503405", "0.646594", "0.64571977", "0.64521885", "0.64454603", "0.64415866", "0.6397232", "0.638895", "0.63539225", "0.6321673", "0.62822855", "0.6265136", "0.6261877", "0.6261877", "0.6261877", "0.624993...
0.746825
0
Returns the name of the gem file from GitHub, which is made up of the account name and the gem name.
def gem_name "#{@account}-#{@name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_name\n \"#{full_name}.gem\"\n end", "def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end", "def full_name repo\n \"#{repo.owner.login}/#{repo.name}\"\n end", "def git_repo_name\n path = File.expand_path(File.dirname(__FILE__))\n # the path looks like /repos/...
[ "0.7251065", "0.7003374", "0.69209373", "0.6797089", "0.6776216", "0.6652506", "0.6652506", "0.6652506", "0.6652506", "0.6582209", "0.6579646", "0.6572861", "0.64468306", "0.6388923", "0.63802147", "0.6377897", "0.63652855", "0.63444513", "0.6339751", "0.6316838", "0.63138974...
0.75097454
0
Returns the command to install the gem. This is a helper for your views.
def gem_install_command "sudo gem install #{gem_name} -s http://gems.github.com" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_gem\n Juwelier::Commands::InstallGem.build_for(self).run\n end", "def install_gem; end", "def install_command\n cmd = \"#{top.sudo} bash\"\n cmd += \" -s -- -v #{required_version}\" unless required_version.nil?\n cmd\n end", "def install_comma...
[ "0.6861518", "0.68399644", "0.6768813", "0.6654534", "0.66315854", "0.659586", "0.6516571", "0.64095694", "0.61507833", "0.6144295", "0.61219007", "0.6066087", "0.60521525", "0.59402615", "0.5911827", "0.59037507", "0.5875836", "0.5868783", "0.5796935", "0.5782394", "0.573874...
0.71156883
0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIE...
def play_melody(m) in_thread do set_volume! 5 if defined? mybpm use_bpm mybpm() end if defined? mysynth use_synth mysynth() end (0..m[0].length-1).each do |i| if m.length > 2 set_volume! m[2][i] end if m[0][i] != 0 play m[0][i] end s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sonic_play\n melody = melody()\n if melody.respond_to?(:key)\n melody.values().each do |m|\n play_melody(m)\n end\n elsif melody.respond_to?(:length)\n play_melody(melody)\n end\nend", "def play socket\n end", "def play\n beats = list.to_string\n `say -r #{rate} -v #{voice} #{beats...
[ "0.7455013", "0.6175193", "0.598994", "0.59144336", "0.5844878", "0.5827619", "0.5827619", "0.5827619", "0.5827619", "0.58159125", "0.5773548", "0.5751151", "0.57437176", "0.57419366", "0.56861556", "0.5680115", "0.56448275", "0.56348985", "0.55890816", "0.5532003", "0.550050...
0.6400435
1
Plays a melody in SonicPi, optionally supporting multiple submelodies in parallel.
def sonic_play melody = melody() if melody.respond_to?(:key) melody.values().each do |m| play_melody(m) end elsif melody.respond_to?(:length) play_melody(melody) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_melody(m)\n in_thread do\n set_volume! 5\n if defined? mybpm\n use_bpm mybpm()\n end\n if defined? mysynth\n use_synth mysynth()\n end\n \n (0..m[0].length-1).each do |i|\n if m.length > 2\n set_volume! m[2][i]\n end\n if m[0][i] != 0\n play m[0][...
[ "0.73486215", "0.58835167", "0.58520633", "0.5846627", "0.5833486", "0.58041066", "0.57679766", "0.57679766", "0.57679766", "0.57679766", "0.57640284", "0.57342076", "0.57112175", "0.57051843", "0.569761", "0.56953126", "0.569498", "0.5605341", "0.5604072", "0.5543896", "0.55...
0.7751391
0
Only used by assemble_dep
def task_find(task_class) tasks_active.to_a.find { |t| t.is_a?(task_class) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def direct_dependencies; end", "def dependencies; end", "def dependencies; end", "def dependencies; end", "def dependent; end", "def dependent; end", "def dependencies=(_arg0); end", "def enable_dependency_loading=(_arg0); end", "def enable_dependency_loading=(_arg0); end", "def build; end", "d...
[ "0.69541526", "0.6806072", "0.6806072", "0.6806072", "0.65679604", "0.65679604", "0.65596783", "0.608179", "0.608179", "0.5982217", "0.59082645", "0.58737665", "0.58737665", "0.5861036", "0.58199084", "0.57774675", "0.57752174", "0.5774605", "0.5768838", "0.5759449", "0.56972...
0.0
-1
Only used by _pending_tasks.haml
def task_find_inactive(task_class) task_class.find(:first, :order => 'id DESC', :conditions => ["#{task_class.reflections[:object].association_foreign_key} = ? AND active IS NULL", id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extra_pubish_tasks(p)\n \n end", "def index\n active_task\n completed_task\n end", "def task\n end", "def named_views_secretarys_task\n @task_assigned = UserTask.all(:conditions => [\"assigned_to_user_id = ? AND (status is null OR status != 'complete')\", @sp_session.assignment.user.id...
[ "0.6608454", "0.6350197", "0.62905383", "0.6262845", "0.6262412", "0.62310046", "0.6167018", "0.61576545", "0.6100395", "0.6096244", "0.6084258", "0.60726017", "0.60618806", "0.6060529", "0.605597", "0.6037948", "0.601361", "0.601361", "0.601361", "0.60123074", "0.6009927", ...
0.0
-1
if revokable = nil then revoke without considering dependancies
def task_revoke(tasks_revoke, data_inject = nil) tasks_revoke = [tasks_revoke].flatten.uniq task_object = tasks_context.find { |t| t.is_a?(tasks_revoke.first) } return nil unless task_object and task_object.active unless task_object.revokable?(tasks_revoke[1..-1]) raise "Task unrevoke: #{task_ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def revoke!(revoker)\n update(\n :ends_at => Time.now.getutc,\n :revoker_id => revoker.id,\n :needs_view => false\n )\n end", "def revoke\n raise \"Implement me!\"\n end", "def revoke\n @session.do_rpc_endpoint('/revoke')\n nil\n end", "def local_revoke(...
[ "0.7385168", "0.7106663", "0.67195964", "0.65713835", "0.65527725", "0.64652574", "0.63626283", "0.6310487", "0.62851363", "0.6176792", "0.5934758", "0.59198564", "0.58834076", "0.5873587", "0.5871717", "0.5864768", "0.5841064", "0.5826345", "0.5805521", "0.5800544", "0.57978...
0.56066155
34
All context objects have only one of type per object Target is task for object
def assemble_deps(context, object, target_class) if target_task = object.task_find_all(target_class) return [target_task, []] if target_task.depends_on else object.tasks_new << target_task = target_class.new(:object => object) end task_list = [target_task] # s = Benchmark....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n return @target if @target.is_a?(Module) && !@options[:class_methods]\n\n @target.singleton_class\n end", "def context_type\n self.class.name.to_s\n end", "def target_objects\n return @target_objects\n end", "def target_objects\n return @...
[ "0.5960116", "0.5704267", "0.5626931", "0.5626931", "0.55978155", "0.54831696", "0.54550827", "0.54303944", "0.54303944", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", "0.54028165", ...
0.5837721
1
Methods for status table
def set_cols(visible, list) @rows = 1 if visible @cols = (depends_on & list).find_all { |u| u.visible }.inject(0) { |s, v| s + (v.cols || 0) } @cols = 1 if @cols == 0 and visible end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses; end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def retrieve_status\n \n end", "def status(*) end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def sta...
[ "0.8153683", "0.7632659", "0.7632659", "0.7632659", "0.7632659", "0.7493229", "0.748942", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.73345214", "0.72585994", "0.72585994", "0.7140542", "0.70893127", "0.70...
0.0
-1
IMPORTANT NOTE: the problem with this solution is that the page offsets cannot be calculated until the parts can figure out how big they are
def write parts = [ ] parts << parquet_special_string # write the start file descriptor @csv.headers.each do |header| # write each data chunk and associated page header set_data_page_offset(header, current_offset) parts << page_header(header) par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_offset(page)\n if page && page != '1'\n (page.to_i - 1) * 20 - 1\n else\n 0\n end\nend", "def pos_page_body\n pos_fil_header + size_fil_header\n end", "def find_entry_rectangles(x_offset,y_offset,page_width,page_height) # take offset\n # how big is the header?\n header_hei...
[ "0.649222", "0.6392081", "0.6365796", "0.6329883", "0.62663496", "0.6147439", "0.6105003", "0.5989603", "0.5938879", "0.591731", "0.59073484", "0.58932066", "0.5881298", "0.5870264", "0.5869912", "0.5850206", "0.5846379", "0.5819279", "0.58121043", "0.58047384", "0.5792202", ...
0.0
-1
SchemaElement type:BYTE_ARRAY (6), repetition_type:OPTIONAL (1), name:"Sausage", converted_type:UTF8 (0), logicalType:>
def schema_meta_data schema = [] # not sure if there needs to be a header element with the number of columns in it # would look sort of like this # header = SchemaElement.new # header.name = @csv.rows.first.first # header.num_children = num_rows # schema << header...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema_array_type(db_type)\n :array\n end", "def test_array_shortform_invalid\n assert_raises Exceptions::InvalidSchemaError do\n Schema.new do\n type(:array, %i[array integer], min: 2)\n end\n end\n end", "def test_array_subtype_shortform\n ...
[ "0.5835069", "0.560739", "0.5290598", "0.5164654", "0.51441365", "0.5128852", "0.5117357", "0.51122004", "0.5071153", "0.50625813", "0.50480014", "0.49239486", "0.48337406", "0.47851783", "0.47730163", "0.4753169", "0.4750412", "0.47303948", "0.47093084", "0.46983564", "0.469...
0.43699956
97
GET /photos GET /photos.xml
def index # @photos = Photo.all @photos = Photo.find(:all, :select => 'id, name, thumbnail') respond_to do |format| format.html # index.html.erb format.xml { render :xml => @photos } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @phot...
[ "0.75760174", "0.745873", "0.7297208", "0.7274135", "0.7055517", "0.6877566", "0.6850252", "0.68484044", "0.6817765", "0.67486674", "0.67059433", "0.67059433", "0.6696266", "0.66890883", "0.6649084", "0.6649084", "0.6649084", "0.6619032", "0.6614242", "0.6611534", "0.6610377"...
0.67384833
10
GET /photos/1 GET /photos/1.xml
def show @photo = Photo.find_by_sql ["SELECT id, name FROM photos WHERE id = ?", params[:id]] # @photo = Photo.select("id, name").where(params[:id]) # @photo = Photo.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @photo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @phot...
[ "0.7409461", "0.7153235", "0.7101095", "0.7055421", "0.6890183", "0.686867", "0.6797611", "0.6797611", "0.6775918", "0.6745995", "0.673981", "0.673981", "0.673981", "0.6728704", "0.67011076", "0.66694826", "0.66438633", "0.66282463", "0.66230893", "0.6526909", "0.6517073", ...
0.0
-1
GET /photos/new GET /photos/new.xml
def new @photo = Photo.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @photo } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @phot = Phot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phot }\n end\n end"...
[ "0.7509106", "0.71043164", "0.7101968", "0.7081684", "0.69821554", "0.69697106", "0.69468844", "0.6941714", "0.6941641", "0.6931542", "0.6903855", "0.6900659", "0.6900659", "0.68480855", "0.6847501", "0.6847501", "0.6847501", "0.6847501", "0.6847501", "0.6847501", "0.6847501"...
0.7496229
4
POST /photos POST /photos.xml
def create paths = create_with_thumbnail(params['content']) @photo = Photo.create(:name => params['photo']['name'], :mimetype => params['content'].content_type, :path => paths[0], :thumbnail => paths[1]) @photo.save() respond_to do |format| if @photo.save format.html { redirect_to(@photo,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_photos\n end", "def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end", "def post_property_photos(photo...
[ "0.62619144", "0.6144806", "0.6118023", "0.5981446", "0.5937158", "0.59308094", "0.5923437", "0.5838247", "0.58147764", "0.5772149", "0.57698745", "0.57698745", "0.57671535", "0.57623386", "0.5760674", "0.57490003", "0.57480776", "0.5733596", "0.57262146", "0.5725567", "0.570...
0.59375304
4
PUT /photos/1 PUT /photos/1.xml
def update @photo = Photo.find(params[:id]) respond_to do |format| if @photo.update_attributes(params[:photo]) format.html { redirect_to(@photo, :notice => 'Photo was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def put(path = '/files/', params = {})\n request :put, path, params\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n ...
[ "0.6692325", "0.6215174", "0.6138174", "0.61363244", "0.60853744", "0.60853744", "0.60749066", "0.6062683", "0.6049315", "0.59671974", "0.5960105", "0.5958245", "0.5946733", "0.59446585", "0.592637", "0.5923012", "0.5813159", "0.5793432", "0.57905877", "0.57905877", "0.578662...
0.60860056
5
DELETE /photos/1 DELETE /photos/1.xml
def destroy @photo = Photo.find(params[:id]) @photo.destroy respond_to do |format| format.html { redirect_to(photos_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.ht...
[ "0.74238825", "0.7223648", "0.71450233", "0.7137822", "0.70752716", "0.7018242", "0.70178545", "0.70062774", "0.69953877", "0.69896066", "0.69797397", "0.6965117", "0.6965117", "0.6965117", "0.6965117", "0.6965117", "0.6965117", "0.6934496", "0.69299924", "0.69299924", "0.691...
0.7489141
3
Use callbacks to share common setup or constraints between actions.
def set_api_v1_meet_tean @api_v1_meet_tean = Api::V1::MeetTean.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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Only allow a list of trusted parameters through.
def api_v1_meet_tean_params params.fetch(:api_v1_meet_tean, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
The default :initialize method needed by a class that implements TracksAttributes during rehydration.
def initialize(attributes = {}, options = {}) self.all_attributes = attributes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preinitialize(attrs = nil)\n @attributes = {}\n end", "def pre_initialize; end", "def pre_initialize\n end", "def post_initialize\n # raise NotImplementedError\n end", "def before_initialize(&block); end", "def initialize_attributes(attributes); end", "def initialize\n @attr...
[ "0.71345115", "0.70789707", "0.7042702", "0.68647", "0.6709945", "0.66809237", "0.6650898", "0.662974", "0.66183", "0.6613367", "0.6512403", "0.6481107", "0.64611405", "0.6427561", "0.6421729", "0.6420355", "0.6383791", "0.6365091", "0.6322395", "0.629702", "0.6277319", "0....
0.5940246
85
2 Nothing is printed to the screen because the block is not activated using .call Returns a proc object 3 Exception handling is a way for your code to continue running when a error is encountered. It solves the problem of your program raising an exception. 4
def execute(&block) block.call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output...
[ "0.66274285", "0.65269965", "0.65256464", "0.6355897", "0.63295335", "0.63275325", "0.6318281", "0.6305822", "0.6292889", "0.623199", "0.62317556", "0.6216086", "0.6209302", "0.6209302", "0.6209302", "0.6209302", "0.6209302", "0.6191915", "0.6188677", "0.6183567", "0.61824304...
0.0
-1
What about different workflows? tags or commits for environments for example?
def update(env=:all) dbg "Puppet::Marshall::Mod::Git#update(#{env.inspect})" fetch case env when :all implied_environments.each { |e| update e } when *implied_environments do_update(env) else # should...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_local_tag tag_name\n run \"git tag -a #{tag_name} -m '#{tag_name}'\"\nend", "def create_standalone_remote_tag tag_name\n in_secondary_repository do\n run 'git checkout -b temp'\n run 'touch a.txt'\n run 'git add -A'\n run 'git commit -m \"temp\"'\n run \"git tag -a #{tag_name} -m '#{t...
[ "0.6323157", "0.6211462", "0.59845996", "0.5945808", "0.57710737", "0.5758031", "0.57422245", "0.5675175", "0.5637656", "0.5633449", "0.5601614", "0.5600458", "0.5595184", "0.55363953", "0.55159533", "0.549516", "0.5462258", "0.54464775", "0.5424091", "0.54087794", "0.5397202...
0.0
-1
Not part of the interface all interface methods in this class specify environments, not branches
def open_or_clone(source, loc, branch=nil) dbg "open_or_clone(#{source.inspect}, #{loc.inspect}, #{branch.inspect})" if File.exist? loc and ! @settings['force-clean'] dbg "open_or_clone: opening existing #{loc}" fetched = Puppet::Marshall::Git.open(loc) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environment(environment); end", "def environment; end", "def branch\n raise NotImplementedError\n end", "def environments; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def...
[ "0.65841556", "0.65758073", "0.6224989", "0.62220305", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", "0.5998828", ...
0.0
-1
Return value of return stack
def return_stack return @state[:fiber][:return_stack] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_value\n # return @stack_sigs[@returnValIdx][@stack_ptr-1]\n @returnValue\n end", "def sret\n <<-CODE\n t1 = stack_pop();\n cpu_simple_return(state, c, t1);\n CODE\n end", "def soft_return\n <<-CODE\n t1 = stack_pop();\n cpu_simple_return(state, c, t...
[ "0.84228355", "0.75281703", "0.714564", "0.7002724", "0.6948955", "0.67801875", "0.6759512", "0.6683812", "0.6675713", "0.66530687", "0.6599307", "0.65164137", "0.6496987", "0.6492214", "0.6480975", "0.64674497", "0.64674497", "0.6461863", "0.64561975", "0.6441601", "0.643322...
0.7596189
1
Return current instruction pointer
def instruction_pointer return @state[:fiber][:instruction_pointer] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def curr_ins\n if @memory[@ip]\n @memory[@ip]\n else\n raise RuntimeError, \"Instruction is nil\"\n end\n end", "def next\n ptr = C.LLVMGetNextInstruction(self)\n LLVM::Instruction.from_ptr(ptr) unless ptr.null?\n end", "def next_instruction\n inst = @program[@current_inst...
[ "0.729499", "0.70673496", "0.6979184", "0.6751399", "0.66649246", "0.64282423", "0.618271", "0.6036335", "0.57930654", "0.5759881", "0.5689577", "0.568284", "0.56680447", "0.56414694", "0.5637622", "0.56314206", "0.56163156", "0.5590033", "0.5581934", "0.5561914", "0.55576926...
0.8124185
0
Return level of fiber
def level return @state[:fiber][:level] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level\n @level\n end", "def level\n @level\n end", "def level\n @level\n end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def level; end", "def level\n return @level\n end", "def level\n ...
[ "0.68702304", "0.6869538", "0.6869538", "0.6739148", "0.6739148", "0.6739148", "0.6739148", "0.6739148", "0.6739148", "0.67389965", "0.67389965", "0.6675086", "0.65949297", "0.6518458", "0.6389719", "0.63662606", "0.6325425", "0.6238793", "0.6238793", "0.6202324", "0.6198115"...
0.87596923
0
Set level of fiber
def level=(level) @state[:fiber][:level] = level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level=(value)\n @level = value\n end", "def level=(value)\n @level = value\n end", "def level=( level )\n super(level || 0)\n end", "def level=(level)\n @level = level\n @implementation.level = @level if @implementation\n level\n ...
[ "0.6755353", "0.6755353", "0.6754908", "0.65319914", "0.64739865", "0.6428101", "0.62863964", "0.62858474", "0.6262172", "0.62222576", "0.62202615", "0.6122114", "0.6122114", "0.6050454", "0.6035958", "0.6024155", "0.6023258", "0.601789", "0.5993819", "0.5916795", "0.59044677...
0.8351513
0
"/testforblock 9950 124 0 122" "/testforblock 9950 125 0 122" "/testforblock 9950 125 0 122" "/testforblock 9950 124 0 122" "/testforblock 9950 125 0 122" "/testforblock 9950 124 0 122" "/testforblock 9950 125 0 122"
def ground(x, z, options = {}) max = 126 min = 0 mid = nil tries = 0 while max >= min && (tries += 1) < 256 mid = min + (max - min) / 2 air = not_land?(x, mid - @center[1], z, options) airDown = not_land?(x, mid - 1 - @center[1], z, options) if air && !airDown retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_good_block\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d']\n line_num = 1\n assert_output(nil) { @verify.check_block(line, line_num) }\n end", "def test_block_hash_match\n \tblock = \"1|1c12|SYSTEM>George(100)|1518892051.740967000|abb2\".split(\"|\")\n \tasser...
[ "0.64717716", "0.60649335", "0.601299", "0.58836734", "0.58666646", "0.58069175", "0.5701599", "0.56902766", "0.56710434", "0.56529695", "0.5644994", "0.56383526", "0.5583566", "0.5553605", "0.5549998", "0.55365676", "0.5481968", "0.54668033", "0.5453174", "0.5449368", "0.541...
0.0
-1
Overwriting the sign_out redirect path method
def after_sign_out_path_for(resource_or_scope) root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end", "def after_sign_out_path_for(_resource_or_scope)\n '/'\n end", "def after_sign_out_path_for(resource_or_scope); end", "def signout_url\n {:controller => 'auth', :action => 'signout'}\n end", "def after_sign_out_path_for(reso...
[ "0.8101773", "0.8007423", "0.7983717", "0.79319686", "0.7897884", "0.7889105", "0.78745323", "0.78685343", "0.78580767", "0.78434205", "0.78434205", "0.78434205", "0.78434205", "0.7841263", "0.78215253", "0.7788318", "0.7748518", "0.77370673", "0.77312046", "0.77290326", "0.7...
0.0
-1
Initialize a new record instance, assign attributes, and immediately save it.
def create(attributes = {}, &block) new(attributes, &block).tap { |record| record.save } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_with_record(record)\n inst = self.new\n inst.send(:_record=, record)\n inst.send(:_id=, record.id)\n inst\n end", "def build_new_record\n @record = record_class.new\n end", "def build_new_record\n @record = record_class.new\n end", "def ...
[ "0.71972275", "0.7121583", "0.7121583", "0.6974261", "0.6941678", "0.6934317", "0.6878552", "0.6869477", "0.6772894", "0.6742474", "0.6742083", "0.67161626", "0.6689117", "0.66698045", "0.6662716", "0.6654355", "0.66234964", "0.6619938", "0.6605799", "0.6592757", "0.65504795"...
0.6431157
32
Check if an unloaded record exists in the database
def exists? load! true rescue RecordNotFound false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end", "def reload_if_exists(record) # :nodoc:\n record && record.reload\n end", "def check_i...
[ "0.6526588", "0.64522094", "0.6406709", "0.637862", "0.63595766", "0.63197654", "0.6291649", "0.62731194", "0.62680393", "0.62675935", "0.6249478", "0.6249478", "0.6232589", "0.61346346", "0.61027455", "0.6018483", "0.60065645", "0.59818196", "0.5964211", "0.5924196", "0.5923...
0.71293247
0
Load an unloaded record's row from the database and hydrate the record's attributes
def load assert_keys_present! record_collection.load! unless loaded? self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_record\n if persisted?\n @record = proxy.get_record(ref)\n # create proper variables from the underlying proxy structure\n @record = cast_attributes(@record)\n else\n @record = {}\n end\n rescue\n # TODO: Hmmmm, I should probably do something here\n ...
[ "0.70834786", "0.6869384", "0.6591487", "0.6462812", "0.6317901", "0.6253425", "0.61820847", "0.6160953", "0.61304975", "0.61077774", "0.6089771", "0.6084778", "0.6027913", "0.59835374", "0.595117", "0.5913335", "0.5911003", "0.5893945", "0.58805156", "0.586133", "0.5845384",...
0.6141943
8
Attempt to load an unloaded record and raise an error if the record does not correspond to a row in the database
def load! load.tap do if transient? raise RecordNotFound, "Couldn't find #{self.class.name} with #{key_attributes.inspect}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load record\n end", "def load record\n case\n when record[\"_delete\"]\n delete(record)\n else\n create_or_update(record)\n end\n end", "def test_load_failure\n # Check for load failure\n assert_raises(ActiveRecord::RecordNotFound) { Source....
[ "0.63192517", "0.619877", "0.6183223", "0.61430836", "0.6098316", "0.5928997", "0.5863406", "0.58202946", "0.57965213", "0.5789763", "0.5740768", "0.5694101", "0.5648726", "0.5624894", "0.5578797", "0.55716056", "0.5470665", "0.5470452", "0.5431364", "0.5431074", "0.5429149",...
0.6485114
0
Persist the record to the database. If this is a new record, it will be saved using an INSERT statement. If it is an existing record, it will be persisted using a series of `UPDATE` and `DELETE` statements which will persist all changes to the database, including atomic collection modifications.
def save(options = {}) options.assert_valid_keys if new_record? then create else update end @new_record = false true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if persisted?\n update\n else\n create\n end\n true\n end", "def save_record\n if !saved_already?\n if valid?\n run_sql(\"INSERT INTO #{table} (#{string_field_names}) VALUES (#{stringify_self});\")\n @id = CONNECTIO...
[ "0.7181925", "0.70108926", "0.70029014", "0.70029014", "0.69845104", "0.6982174", "0.698102", "0.68869466", "0.6879284", "0.686177", "0.68315417", "0.6797221", "0.67828035", "0.6751344", "0.67265445", "0.6700061", "0.6684362", "0.66654474", "0.6624804", "0.6595409", "0.658852...
0.67344904
14
Set attributes and save the record
def update_attributes(attributes) self.attributes = attributes save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persist!\n record.assign_attributes(\n attribute_one: attribute_one,\n attribute_two: attribute_two\n )\n record.save!\n end", "def save\n path = new_record? ? endpoint : \"#{endpoint}/#{attributes[:id]}\"\n response = client.send(persistence_action, path, attributes)\n ...
[ "0.70223457", "0.70181555", "0.7011013", "0.6998478", "0.6960114", "0.6878854", "0.6752469", "0.67400175", "0.6739568", "0.6739568", "0.6710492", "0.6710492", "0.6710492", "0.6710492", "0.6709311", "0.66959405", "0.668481", "0.6675337", "0.6669491", "0.6669491", "0.6648401", ...
0.6540249
32
Remove this record from the database
def destroy assert_keys_present! metal_scope.delete transient! self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(record)\n record.del\n end", "def remove_record(record)\n atoms = condense_record(record)\n load_atoms(atoms)\n atoms.each do |a|\n @atoms[a].remove_record(record.id) if @atoms.has_key?(a)\n @records_size -= 1\n #p \"removing #{re...
[ "0.7319968", "0.72709024", "0.7269658", "0.72601265", "0.7202779", "0.7045799", "0.70445746", "0.7041324", "0.7041324", "0.7031426", "0.70229125", "0.699901", "0.69575864", "0.6923145", "0.68853587", "0.68836516", "0.6882446", "0.68663514", "0.6840276", "0.67941636", "0.67912...
0.0
-1
Eh, I don't like that as much
def find_volume_of_cube (length, width, height, lwh) puts "The volume is #{length}*#{width}*#{height}= #{lwh}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def suivre; end", "def terpene; end", "def formation; end", "def offences_by; end", "def stderrs; end", "def who_we_are\r\n end", ...
[ "0.71743107", "0.67504394", "0.6374173", "0.62940437", "0.62392384", "0.62392384", "0.62392384", "0.62392384", "0.6204111", "0.6195121", "0.614045", "0.60964936", "0.6024435", "0.5939403", "0.59190243", "0.5906739", "0.58337843", "0.5816291", "0.5803434", "0.5803434", "0.5799...
0.0
-1
number of docs in class i classified correctly
def recall category send(category).values.sum > 0 ? send(category)[category].fdiv(send(category).values.sum) : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end", "def total_documented\n @methods.select {|b| b}.length +\n @classes.select {|b| b}.length +\n @modules.select {|b| b}.length +\n @attrs.select {|b| b}.length +\n @constants.select {|b| b}.length\n end", "d...
[ "0.6933874", "0.66382706", "0.6514839", "0.63718736", "0.6371683", "0.6266563", "0.6266563", "0.6266563", "0.6246948", "0.6234931", "0.6210288", "0.6210288", "0.6190275", "0.61775357", "0.6176621", "0.6165821", "0.6163104", "0.60942006", "0.6032456", "0.60228103", "0.6021521"...
0.0
-1
fraction of docs assigned class i that are actually about class i
def precision category positive[category] + negative[category] + neutral[category] > 0 ? send(category)[category].fdiv(positive[category] + negative[category] + neutral[category]) : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def P_of_c(clazz)\n Math.log(doc_count(clazz).to_f / num_of_docs)\n end", "def total_documented\n @methods.select {|b| b}.length +\n @classes.select {|b| b}.length +\n @modules.select {|b| b}.length +\n @attrs.select {|b| b}.length +\n @constants.select {|b| b}.length\n end", "d...
[ "0.7345539", "0.67142737", "0.6701295", "0.66454923", "0.6640904", "0.6482616", "0.623768", "0.6133526", "0.60752577", "0.5988406", "0.59357417", "0.5857859", "0.58155733", "0.5763468", "0.5750032", "0.57364076", "0.5687588", "0.56851107", "0.5671774", "0.56671935", "0.566160...
0.0
-1
fraction of all docs classified correctly
def accuracy number_of_documents > 0 ? number_of_right_classifications.fdiv(number_of_documents) : 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_doc\n return @percent_doc if @percent_doc\n\n @fully_documented = (@num_items - @doc_items) == 0\n\n @percent_doc = @doc_items.to_f / @num_items * 100 if @num_items.nonzero?\n @percent_doc ||= 0\n\n @percent_doc\n end", "def score\n documented = @files.inject(0) {|sum, file| sum +=...
[ "0.719712", "0.7075571", "0.6830675", "0.6715341", "0.6404839", "0.63075536", "0.62874013", "0.6263566", "0.6119637", "0.6117184", "0.6046707", "0.60423654", "0.6003702", "0.6003702", "0.5991425", "0.5967314", "0.5962636", "0.5959162", "0.5943181", "0.593852", "0.5873184", ...
0.6465935
4
Creates an entry in events_users table
def add @event = Event.find(params[:id]) @user = current_user @content = "is_interested" @object = @event.id if current_user @event.users << current_user redirect_to @event, :notice => I18n.t(:reminders_add) else redirect_to sign_up_url, :notice => I18n.t(:remindes_add_else) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @event = Event.new(params[:event])\n @event.users << User.find(params['add_to_event']) if params['add_to_event']\n\n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to event_url(@event) }\n format....
[ "0.70097387", "0.6856143", "0.6687824", "0.6652248", "0.6606097", "0.6595752", "0.65437585", "0.6531251", "0.65312326", "0.6499835", "0.6461565", "0.64571834", "0.64412755", "0.63943845", "0.638981", "0.6370132", "0.63630563", "0.632809", "0.63271004", "0.62854284", "0.627192...
0.0
-1
Deletes an entry in events_useres table
def delete @event = Event.find(params[:id]) @user = current_user @event.users.delete(@user) redirect_to reminders_path(:id => current_user.id), :notice => I18n.t(:reminders_delete) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.find(params[:id])\n @event.users.clear\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def delete_saved_event\n # Get user\n user = AuthorizeApiRequest.call(params)....
[ "0.6835405", "0.6815057", "0.68048763", "0.67889494", "0.67140436", "0.67030656", "0.6679145", "0.6668456", "0.6608647", "0.6587803", "0.6581414", "0.65792716", "0.6556418", "0.65254265", "0.64546657", "0.64546657", "0.64214385", "0.6401797", "0.63489574", "0.6340448", "0.631...
0.71880275
0
Look at the current round and return the last card
def last_guessed_card current_round.guesses.last.card_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_round\r\n self.rounds.last\r\n end", "def last_round\n rounds.first[:partidos].map(&method(:build_match))\n end", "def current_card\n @deck.cards[@turns.count]\n end", "def draw_card\n self.cards.pop\n end", "def draw\n return @cards.pop\n end", "def get_card\n ...
[ "0.7581223", "0.7102214", "0.69722795", "0.6854367", "0.68333274", "0.6824264", "0.6766007", "0.67535", "0.6729085", "0.66591233", "0.66379464", "0.66031456", "0.6548067", "0.6537006", "0.6534383", "0.649328", "0.6487335", "0.6473156", "0.64525765", "0.6429279", "0.6419419", ...
0.74348897
1
Only keeps track of first guesses
def result_message(response) original_game_card = Card.find_by(id: last_guessed_card) if original_game_card.answer == response return "win" else return "lose" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_guess\n unmatched_pos || random_guess\n end", "def use_guess\n @guesses -= 1\n end", "def is_repeated_guess(guess)\n @prev_guesses.include? guess\n end", "def guessed\n\n end", "def analyze\n @hits.times do\n @guesses << @last_guess unless @guesses.length == 4\n end\n end...
[ "0.7323093", "0.72212434", "0.7066895", "0.7006999", "0.69210887", "0.69210887", "0.6892633", "0.68330896", "0.6820144", "0.6805469", "0.68028563", "0.68019205", "0.6787944", "0.6787944", "0.67553085", "0.6711685", "0.6711474", "0.67003614", "0.66686326", "0.665385", "0.66190...
0.0
-1
Returns true/false depending on if the card exists
def card_exists?(card_to_check) if !Card.find_by(id: card_to_check.id).nil? return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_card? test_card\r\n @card_list.has_card? test_card\r\n end", "def has_card? test_card \n @card_list.has_card? test_card\n end", "def has_card? test_card\n @cards.each do |card|\n if card.to_string==test_card.to_string\n return true\n end\n end\n false\n end", "def c...
[ "0.8174158", "0.81427956", "0.7950292", "0.7850362", "0.7831971", "0.765348", "0.75766695", "0.74324214", "0.7366732", "0.7224996", "0.7142346", "0.7056457", "0.69903344", "0.6968953", "0.6897681", "0.6876366", "0.6868744", "0.68512475", "0.6845755", "0.6845755", "0.6751604",...
0.8404178
0
def current_user token = params[:token] payload = TokiToki.decode(token)
def current_user @current_user ||= User.find_by(client_token: params[:client_token]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data\n token\n end", "def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #using user_id to find our user\n @user = User.find_by(id: user_id)\n else\n ...
[ "0.7229372", "0.71712506", "0.7038162", "0.7036996", "0.70263565", "0.6972287", "0.6961789", "0.6958177", "0.6955986", "0.69461083", "0.69461083", "0.69461083", "0.69461083", "0.69461083", "0.69461083", "0.69461083", "0.69461083", "0.69305223", "0.6911782", "0.6910056", "0.68...
0.0
-1
might need a better home for this eventually
def parameter(name, type, options={}) defaultValue = options.delete(:default) allowableValues = options.delete(:allowed) || allowable_values_for_type(type) case allowableValues when Range min, max = allowableValues.min, allowableValues.max allowableValues = build_range(min, max) when Ar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def stderrs; end", "def anchored; end", "def formation; end", "def berlioz; end", "def terpene; end", "def suivre; end", "def operations; end", "def o...
[ "0.7319934", "0.67667055", "0.6432933", "0.6220333", "0.6220333", "0.6220333", "0.6220333", "0.60927516", "0.59981585", "0.5950657", "0.59349644", "0.593452", "0.593358", "0.58678865", "0.58678865", "0.58459604", "0.58410907", "0.58257705", "0.5820055", "0.57706594", "0.57583...
0.0
-1
convenience method for adding some pagination fields
def pagination! parameter :page, :integer, :required => false, :default => 1, :paramType => "query" parameter :per_page, :integer, :required => false, :default => 30, :paramType => "query", :allowed => 1..1000 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagination\n [ :next_page ]\n end", "def will_paginate_extended(collection, options = {})\n all_options = { style: 'display: inline-block;' }\n all_options = options.merge(all_options)\n\n (will_paginate(collection, all_options) || ''.html_safe) +\n '&nbsp;&nbsp;&nbsp;&nbsp;Per page: '.html_s...
[ "0.67922986", "0.673417", "0.6640047", "0.66056246", "0.65518945", "0.65159583", "0.6512262", "0.65092266", "0.64789146", "0.6457788", "0.6454094", "0.6410056", "0.63749343", "0.6346653", "0.63360435", "0.6320317", "0.6317577", "0.6314233", "0.63074255", "0.6291523", "0.62681...
0.64428455
11
determines minimum size of a referal code
def pad 26 ** 3 # insure at least four digits end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressed_size; end", "def compressed_size; end", "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length (wchars)\n space += 512 * ...
[ "0.64844245", "0.64844245", "0.63503367", "0.63217646", "0.63183355", "0.6283515", "0.62434745", "0.6231004", "0.62273186", "0.616727", "0.6160358", "0.6084786", "0.60759836", "0.6034576", "0.6006224", "0.59999186", "0.59890276", "0.59730864", "0.59730864", "0.59700304", "0.5...
0.0
-1
Use base 26 here to avoid numeric codes (We want codes to be clearly distinguishable from ids)
def id_to_code(id) (id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_to_id(code)\n (code.to_s.tr('a-z', '0-9a-p').to_i(26) - pad) / factor\n end", "def bijective_encode(id)\n code = ''\n\n while id > 0\n code << CHARS[id.modulo(BASE)]\n id /= BASE\n end\n\n code.reverse\n end", "def con10to62(id)\n\tnew_id = \"0000\"\n\tfor i in 0..3\n\t\...
[ "0.7524246", "0.72511727", "0.7221499", "0.7210848", "0.7156676", "0.71100825", "0.70648223", "0.69518495", "0.6793804", "0.67484933", "0.67287767", "0.6642566", "0.6534079", "0.6515304", "0.65014166", "0.64807594", "0.64806706", "0.6459755", "0.64395106", "0.6412547", "0.636...
0.80880904
0
exact inverse of id_to_code
def code_to_id(code) (code.to_s.tr('a-z', '0-9a-p').to_i(26) - pad) / factor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id_to_code(id)\n (id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z')\n end", "def es_code\n id.to_s\n end", "def code\n id ? id.to_s(36) : nil\n end", "def convert_data_field_codes_to_id_strings!\n self.data = convert_data_field_codes_to_id_strings(self.data)\n end", "def convert_...
[ "0.73503023", "0.7150434", "0.71309257", "0.6804881", "0.6804881", "0.6756429", "0.6756429", "0.6617264", "0.66046596", "0.6517411", "0.6425214", "0.64221305", "0.62430435", "0.62228477", "0.61595315", "0.60851306", "0.6079835", "0.60061246", "0.59717643", "0.5969299", "0.591...
0.6635879
7
GET /clubs GET /clubs.json
def index if is_admin? @clubs = Club.paginate(page: params[:page], :per_page => 15) elsif is_association? @clubs = Club.where( association_id: my_association ).paginate(page: params[:page], :per_page => 15) elsif is_club? @clubs = Club.where( club_id: current_user.id ).paginate(page: param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clubs = Club.all\n render json: @clubs\n end", "def index\n\t\t@clubs = Club.all\n\t\trender json: @clubs\n\tend", "def show\n @club = Club.find(params[:id])\n\n render json: @club\n end", "def index\n @clubs = Club.all\n\n respond_to do |format|\n format.html # index.ht...
[ "0.82473654", "0.8111927", "0.80283284", "0.8004295", "0.7850272", "0.77443665", "0.7703937", "0.75692767", "0.75692767", "0.75692767", "0.75216234", "0.7386078", "0.7347323", "0.7230501", "0.71990705", "0.7183093", "0.7097331", "0.70414716", "0.7035367", "0.6946004", "0.6916...
0.0
-1
GET /clubs/1 GET /clubs/1.json
def show unless is_admin? if is_association? @club = Club.where( "id = :cid and association_id = :aid", { cid: params[ :id ], aid: my_association } ).first elsif is_club? @club = Club.find_by( club_id: current_user.id ) #CSH end end @athlete = Athlete.new(club_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @club = Club.find(params[:id])\n\n render json: @club\n end", "def show\n \n @club = Club.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @club }\n end\n\n \n end", "def index\n @clubs = Club.all\n ren...
[ "0.8393127", "0.82144034", "0.8102366", "0.807733", "0.7889921", "0.7875996", "0.7862455", "0.7852308", "0.7502851", "0.7447347", "0.7447347", "0.7447347", "0.7374375", "0.7263114", "0.72192913", "0.72010046", "0.7195952", "0.71677196", "0.70656693", "0.70562834", "0.7013559"...
0.0
-1
POST /clubs POST /clubs.json
def create @club = Club.new(club_params) # valores default @club.active = true @club.association_id = Association.find_by( :user_id => current_user.id ).id if @club.email.present? and @club.email.length > 5 @user = User.new(name: @club.name, email: @club.email, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @club = Club.new(params[:club])\n\n if @club.save\n render json: @club, status: :created, location: @club\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@club = Club.new(club_params)\n\n\t\tif @club.save\n\t\t \trender json: @c...
[ "0.8054806", "0.7774694", "0.76952463", "0.7686164", "0.7630623", "0.7630623", "0.73835504", "0.73758984", "0.7167092", "0.7161889", "0.7137184", "0.7117601", "0.7095895", "0.70014334", "0.69563246", "0.6934114", "0.6888747", "0.6851928", "0.68437815", "0.6838768", "0.6835147...
0.60677963
90
PATCH/PUT /clubs/1 PATCH/PUT /clubs/1.json
def update # só criar o user no caso de ainda não existir if @club.user_id.nil? and @club.email.present? and @club.email.length > 5 @user = User.new(name: @club.name, email: @club.email, password: @club.email, password_confirmation: @...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end", "def update\n @club = Club.find(params[:id])\n\n respond_to do |format|\n if @club.update_...
[ "0.7855932", "0.76613015", "0.7647316", "0.756348", "0.751144", "0.7491333", "0.7491333", "0.7459585", "0.7459585", "0.7459585", "0.7459585", "0.7459585", "0.74384224", "0.72633684", "0.7250867", "0.7217931", "0.7158138", "0.71350515", "0.71099013", "0.7003405", "0.7003056", ...
0.5819406
82
DELETE /clubs/1 DELETE /clubs/1.json
def destroy @club.destroy respond_to do |format| flash[:notice] = 'Clube foi apagado com sucesso.' format.html { redirect_to clubs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.ht...
[ "0.81467396", "0.8125921", "0.8125921", "0.80589193", "0.80589193", "0.80283463", "0.7990399", "0.7949108", "0.79312074", "0.78865546", "0.78865546", "0.78865546", "0.78705937", "0.78516614", "0.77526957", "0.7699575", "0.7623334", "0.7608901", "0.7604228", "0.7587584", "0.75...
0.771957
15
Use callbacks to share common setup or constraints between actions.
def set_club @club = Club.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.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