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 |
|---|---|---|---|---|---|---|
output length of string | def length_of_string(the_string)
puts 'your string is this many characters ' + the_string.length.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n string.length\n end",
"def length\n @string.length\n end",
"def length(str)\n g_unpack(str).length\n end",
"def get_length(str)\n @str.length.to_i\n end",
"def length()\n return to_s.gsub(\" \", \"\").gsub(\"-\", \"\").length\n end",
"def prindex(output_st... | [
"0.81012446",
"0.8001082",
"0.79396033",
"0.7835031",
"0.77954346",
"0.7794475",
"0.779393",
"0.7745428",
"0.7745428",
"0.7745428",
"0.7745428",
"0.7727807",
"0.76982355",
"0.76375353",
"0.76054984",
"0.76054984",
"0.7602933",
"0.7594176",
"0.75270975",
"0.75184584",
"0.74726... | 0.79117 | 3 |
Find if it's possible to reach 0 by starting at the index. You can only move left or right by the distance found at array[index]. | def can_win?(array, index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_win?(array, index)\n until index < 0 || index >= array.length\n return true if array[index] == 0\n index += array[index]\n end\n false\nend",
"def can_win(array, index)\r\n positions_to_try = [index]\r\n visited_positions = Array.new(array.length, false)\r\n visited_positions[index] = true\r\... | [
"0.72196233",
"0.7191224",
"0.71875805",
"0.7180952",
"0.7124997",
"0.6833167",
"0.6660802",
"0.6660802",
"0.66597617",
"0.6653154",
"0.6653154",
"0.6653154",
"0.6653154",
"0.66071224",
"0.6579725",
"0.6565628",
"0.6542761",
"0.6527837",
"0.6527837",
"0.6527837",
"0.6527837",... | 0.0 | -1 |
Test methods below for RMS 4.1 : [SPB] Fix File reading errors in Ruby | def read_nonexistfile
invalidpath = "/programFiles/Test/rholog.txt"
temporaryDirectory = Rho::RhoFile.join(Rho::Application.userFolder, "temporaryDirectory")
Rho::RhoFile.makeDir(temporaryDirectory)
begin
Rho::RhoFile.new(invalidpath, Rho::RhoFile::OPEN_FOR_READ)
rescue => e
des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_file\n begin\n File.open('test.txt', 'w') { |f| f.write('0|0|SYSTEM>569274(100)|1553184699.650330000|288d') }\n end\n assert_equal [['569274', 100]], @verify.read('test.txt')\n end",
"def test_should_read_error_from_file\n \n input = \"test_should_read_error_from_file\"\n ou... | [
"0.67253137",
"0.6670005",
"0.6622927",
"0.65151685",
"0.6464086",
"0.63189787",
"0.6313751",
"0.6276407",
"0.6269392",
"0.62588185",
"0.62376523",
"0.6224505",
"0.6217051",
"0.61832",
"0.61825806",
"0.6149757",
"0.6149757",
"0.613919",
"0.613919",
"0.61143667",
"0.6112722",
... | 0.0 | -1 |
it gets next possible authorized events of current state | def next_state_events
t = self.state_transitions(:from => self.state.to_sym)
authorized_events = Array.new
t.each do |transition|
#if (is_authorized_event?(transition.event.to_s, user.role.name, self.state))
authorized_events << transition
#end
end
authorized_events
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end",
"def possible_events\n\t\t\t@events = []\n\t\t\topts = self.class.class_variable_get :@@options\n\t\t\tif self.has_attribute?(opts[:column_name].to_sym)\n\n\t\t\t\t@current = send(opts[:column_name].to_sym).to_sym #self.state.to_s... | [
"0.6110923",
"0.6020081",
"0.59113693",
"0.58372205",
"0.57787544",
"0.57519424",
"0.57169056",
"0.57169056",
"0.5653482",
"0.56204724",
"0.55826163",
"0.5550376",
"0.5547618",
"0.55452985",
"0.55440724",
"0.5543414",
"0.5534444",
"0.5528919",
"0.552812",
"0.54969764",
"0.548... | 0.835612 | 0 |
if there is an H1, change it to an H2, unless it's the only thing there TODO: or unless the slide class is whatever | def mutate_h1? doc
h1s = doc.css('h1') || []
if h1s.size == 0
false
else
stuff = doc.css('body>*')
if stuff.size == 1
false
else
true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_title_h1\n # @_already_shown_h1 is a hack to prevent duplicate headings. # See main_layout\n @_already_shown_h1 = true\n content_tag(:h1, @page_title)\n end",
"def old_heading match\n if match[:had_slug?]\n \"<h#{match[:level]} id=\\\"#{match[:slug]}\\\">#{match[:title]}</h#{match[:level]}... | [
"0.6892488",
"0.67165995",
"0.6414657",
"0.6358874",
"0.62756234",
"0.622364",
"0.608961",
"0.60798043",
"0.60722435",
"0.5842357",
"0.58283883",
"0.5811035",
"0.5790498",
"0.5780083",
"0.5756207",
"0.5734772",
"0.5715571",
"0.5707096",
"0.56970745",
"0.5687368",
"0.56596845"... | 0.6411666 | 3 |
here we convert (and friends) into a placeholder string that won't get HTMLescaped | def munge_md text
text.gsub(/<!(--)?(\/?BOX)(--)?>/, "===\\2===\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def placeholder_html\n to_html\n end",
"def sub_string\n return unless obj.is_placeholder?(@field)\n value = if @opts[:formatter]\n obj.send(@opts[:formatter], @field)\n else\n obj.send @field\n end\n value = '' if value.nil?\n @... | [
"0.7170097",
"0.6795686",
"0.66947967",
"0.6237008",
"0.6192389",
"0.61899257",
"0.617585",
"0.6134787",
"0.60956174",
"0.60725445",
"0.5996481",
"0.5985021",
"0.5950127",
"0.59398204",
"0.59320986",
"0.5930649",
"0.58993375",
"0.58674204",
"0.58672273",
"0.58593273",
"0.5845... | 0.0 | -1 |
Validates that none of the attributes passed are present | def validates_absence_of(*attr_names)
validates_each(attr_names) do |record, attr_name, value|
if record.send(attr_name)
record.errors.add(
attr_name,
:invalid,
:default => "mistakenly tried to instantiate #{self.to_s} with attribute \"#{attr_name}\""
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_attributes!(attributes)\n return attributes if attributes.blank?\n invalid_properties = attributes.keys.map(&:to_s) - self.attributes.keys\n invalid_properties.reject! { |name| self.respond_to?(\"#{name}=\") }\n fail UndefinedPropertyError, \"Undefined properties: #{invalid_propert... | [
"0.7799581",
"0.7727547",
"0.7656629",
"0.7644848",
"0.7617071",
"0.75932705",
"0.7572185",
"0.7551108",
"0.7437902",
"0.7339227",
"0.7315124",
"0.7315124",
"0.7287869",
"0.7245431",
"0.7139085",
"0.7126751",
"0.7114414",
"0.70819277",
"0.7056886",
"0.7043309",
"0.70249766",
... | 0.6488064 | 83 |
Validates that specified attributes are of type Time. Configuration Options: :allow_nil skip validation if attribute is nil, default is true | def validates_as_datetime(*attr_names)
configuration = { :message => "attribute should be of type Time" }
validates_each(attr_names, configuration) do |record, attr_name, value|
unless value.is_a?(Time)
record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_validations_for_time\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time\") if value && (! value.kind_of?(Time))\n end\n end",
"def valid_time_or_date?(value)\n value.is_a?(Time) || value.is_a?(Date) || val... | [
"0.735033",
"0.6858368",
"0.6785579",
"0.6713121",
"0.658745",
"0.6453842",
"0.643243",
"0.6418908",
"0.63932884",
"0.63516086",
"0.634748",
"0.6200382",
"0.6161707",
"0.6152662",
"0.6139288",
"0.6134683",
"0.6130779",
"0.61129165",
"0.610329",
"0.6092467",
"0.6085369",
"0.... | 0.7156931 | 1 |
Validates that specified attributes are of type date. Configuration Options: :allow_nil skip validation if attribute is nil, default is true | def validates_as_date(*attr_names)
configuration = { :message => "attribute should be of type Date" }
validates_each(attr_names, configuration) do |record, attr_name, value|
unless value.is_a?(Date)
record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_date_validation(context, attributes_list, attribute, check_blank)\n if context[attribute].nil? && attributes_list[attribute.to_s].blank? && check_blank\n context.errors.add attribute, :blank\n elsif context[attribute].nil?\n context.errors.add attribute, :invalid_format\n end... | [
"0.7344137",
"0.7344137",
"0.71678716",
"0.7136495",
"0.7030341",
"0.6778223",
"0.6658247",
"0.6468464",
"0.6455828",
"0.64266515",
"0.6413869",
"0.63950586",
"0.6386332",
"0.63859504",
"0.634804",
"0.6281497",
"0.6269098",
"0.62184244",
"0.6196279",
"0.617388",
"0.6114876",
... | 0.72773314 | 2 |
Validates that attributes provided are in order of increasing value. Configuration Options: :allow_nil skips validation if either attribute is nil | def validates_as_increasing(first_attr, second_attr, options = {})
configuration = {
:message => options[:message] || "attribute fails to increase in value" }
validates_each(first_attr) do |record, attr_name, value|
next if (record.send(first_attr).nil? || record.send(second_attr).nil?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_order!(options)\r\n return unless options && options[:order]\r\n\r\n (options[:order] = options[:order].to_s).split(/, +/).each do |order|\r\n sort = order.split(/ +/)\r\n\r\n if [1, 2].include? sort.size\r\n attribute, direction = sort\r\n else\r\n rai... | [
"0.57198775",
"0.5524819",
"0.5228231",
"0.51627207",
"0.5136188",
"0.510762",
"0.5102161",
"0.50788164",
"0.5076156",
"0.5061758",
"0.50506765",
"0.5040208",
"0.50308955",
"0.49812314",
"0.4972494",
"0.4963474",
"0.4961232",
"0.4946612",
"0.4946033",
"0.49426067",
"0.4907719... | 0.65679926 | 0 |
validate uniquenss of required attribute combo | def validates_as_unique(options = {})
validated_columns = self.dimension_columns.map { |c| c.to_sym }
return if validated_columns.empty?
validates_each(validated_columns.first, options) do |record, attr_name, value|
where_parts = []
validated_columns.each do |column|
value = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_required_attributes\n attributes = DSL.attributes.values.select(&:required?)\n attributes.each do |attr|\n value = spec.send(attr.name)\n unless value && (!value.respond_to?(:empty?) || !value.empty?)\n if attr.name == :license\n results.add_warning... | [
"0.7059307",
"0.6968698",
"0.6872287",
"0.6854589",
"0.684423",
"0.68401474",
"0.6771582",
"0.6765039",
"0.67636144",
"0.6711209",
"0.668764",
"0.6636913",
"0.66300553",
"0.6604025",
"0.65749484",
"0.65686744",
"0.6525103",
"0.6514894",
"0.6477645",
"0.64593333",
"0.64591813"... | 0.0 | -1 |
I worked on this challenge [by myself]. Your Solution Below | def good_guess?(value)
if value == 42
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def challenge; end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx]... | [
"0.65220606",
"0.6284997",
"0.6123468",
"0.6051541",
"0.6033905",
"0.59978485",
"0.5994285",
"0.59888875",
"0.59109557",
"0.5905475",
"0.58993614",
"0.5898826",
"0.5897172",
"0.588322",
"0.58752793",
"0.5865176",
"0.58650845",
"0.5861422",
"0.58606976",
"0.5857151",
"0.585419... | 0.0 | -1 |
that contains the orignal value using staggered capitalization in which every other character is capitalized starting at the first Non letters should not be changed, but do count when switching staggered_case('I Love Launch School!') == 'I LoVe lAuNcH ScHoOl!' staggered_case('ALL_CAPS') == 'AlL_CaPs' staggered_case('ig... | def staggered_case(string)
index = 0
characters = string.split('')
loop do
break if index >= characters.size
if characters[index] =~ /[a-zA-Z]/ && index.even?
characters[index].upcase!
elsif characters[index] =~ /[a-zA-Z]/ && index.odd?
characters[index].downcase!
end
index += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def staggered_case(str)\n alt_cap = ''\n need_upper = true\n split_str = str.chars\n split_str.each do |char|\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\... | [
"0.8013326",
"0.797562",
"0.79535466",
"0.7899825",
"0.7873973",
"0.7865569",
"0.7858851",
"0.7853035",
"0.7845175",
"0.7828107",
"0.7826091",
"0.78234136",
"0.78184366",
"0.78165525",
"0.781552",
"0.781552",
"0.780833",
"0.77889967",
"0.7753692",
"0.77483207",
"0.7740445",
... | 0.78491145 | 8 |
Modify to allow user to choose the first character to be downcase | def staggered_case(string, downcase_first = nil)
result = ''
downcase_first == nil ? need_upper = true : need_upper = false
string.chars.each do |char|
if need_upper
result += char.upcase
else
result += char.downcase
end
need_upper = !need_upper
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def downcase() end",
"def downcase(input); end",
"def downcase; end",
"def downcase!() end",
"def downcase_first\n\t\treturn self.blank? ? \"\" : self[0].downcase + self[1..-1]\n\tend",
"def downcase_first_letter(str)\n str[0].downcase + str[1..-1]\n end",
"def downcase_first\n return \"\" i... | [
"0.8284103",
"0.81378293",
"0.8086732",
"0.8030839",
"0.78184754",
"0.75968707",
"0.75056314",
"0.7468002",
"0.7460985",
"0.7420397",
"0.7409618",
"0.73807204",
"0.73203266",
"0.7302722",
"0.728051",
"0.728051",
"0.72671443",
"0.7238827",
"0.72008467",
"0.71770656",
"0.714480... | 0.0 | -1 |
Score is in format (WLT) | def score
score_list = [self.wins.size, self.losses.size, self.tie.size]
return score_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def score\n p1_score = players.first.score \n p2_score = players[1].score\n\n if p1_score == p2_score\n score_word = SCORE_NUMBER_TO_WORD_MAP[0..-2][p1_score]\n return score_word ? score_word + \"-All\" : \"Deuce\"\n elsif p1_score <= 3 && p2_score <= 3\n return players.map{|player| SCOR... | [
"0.64964795",
"0.64955527",
"0.64552194",
"0.6454865",
"0.6378758",
"0.6352828",
"0.6235006",
"0.621835",
"0.61676055",
"0.61381924",
"0.61255157",
"0.61059475",
"0.6100661",
"0.60776544",
"0.60776544",
"0.6043742",
"0.6041036",
"0.6029558",
"0.6029498",
"0.6003345",
"0.59948... | 0.0 | -1 |
addMarker method to add markers based on existing markers | def addMarker f, m, mrk, t
out = File.open(f,"a")
out.puts "Mk#{m}=Stimulus,#{mrk},#{t},0,0"
out.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_marker(marker)\n markers << marker\n end",
"def add_marker(marker)\n \n marker[:create_with] = 'default' if marker[:create_with].nil? \n \n @markers << marker\n \n end",
"def add_markers(markers_or_options)\n markers_or_options.each do |marker_or_o... | [
"0.7826158",
"0.75930476",
"0.69516236",
"0.6898151",
"0.68197614",
"0.66646117",
"0.64967453",
"0.6432649",
"0.6403526",
"0.6192513",
"0.61859393",
"0.6149102",
"0.60741997",
"0.6046464",
"0.6039982",
"0.6006521",
"0.6006521",
"0.5992622",
"0.5977251",
"0.5977251",
"0.591811... | 0.5327193 | 62 |
validates_presence_of :user_name, :user_fullname, :user_address, :user_phone, :role_id, :outlet_id, message: "Semua field harus diisi!" validates_uniqueness_of :user_name, message: "Username harus unik!" | def assign_role
self.role = Role.find_by role_name: "PIC Pengadaan" if self.role.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_user \n errors.add(:user_id, 'user not presence') if User.find_by_id( self[:user_id] ) == nil\n end",
"def username_must_be_unique\n errors.add(:username, :taken) if username.present? && User.where(username: username).where.not(id: model.id).exists?\n end",
"def validate_user\n errors.a... | [
"0.6938095",
"0.68357724",
"0.67975616",
"0.678456",
"0.67714006",
"0.6654464",
"0.65644586",
"0.6535802",
"0.64958394",
"0.64941293",
"0.6470127",
"0.63696164",
"0.6359569",
"0.6350191",
"0.6349142",
"0.6349142",
"0.6336402",
"0.63192433",
"0.630818",
"0.63016135",
"0.629287... | 0.0 | -1 |
Tests! Test 25839: Verify default home town is shown and can be saved other home town option | def test_ID_25839_edit_profile_home_patch
login_as_user1
go_to_edit_profile_page
verify_users_default_town_name_displayed_as_home_patch "test_ID_25835_edit_profile_desc" , "Bellmore Patch"
verify_hometown_change_is_saved "Bellmore Patch","Garden City Patch"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_possible_location_from_museum_if_rand_is_one\r\n\t\toakland = City::new\r\n\t\trand_val = 1\r\n\t\thillman = oakland.generate_museum_locs(oakland, rand_val)\r\n\r\n\t\tassert_equal hillman[0], \"Hillman\"\r\n\t\tassert_equal hillman[1][0], \"Fifth Ave.\"\r\n\tend",
"def trainer_chooses_town\n tow... | [
"0.6387711",
"0.6306355",
"0.6097093",
"0.6096076",
"0.6075655",
"0.6014291",
"0.6007376",
"0.59226304",
"0.59221965",
"0.5875528",
"0.58449423",
"0.58434427",
"0.58055",
"0.5803625",
"0.578444",
"0.57274044",
"0.5726719",
"0.57054245",
"0.57009995",
"0.5694224",
"0.56940365"... | 0.7072245 | 1 |
Test 25846: Verify Name with special character and html tag is saved | def test_ID_25846_edit_profile_name_validation
login_as_user1
go_to_edit_profile_page
verify_name_change_is_saved "test_ID_25835_edit_profile_desc", "Jame Smith", "Temp name"
verify_name_validation "test_ID_25835_edit_profile_desc", "Jame Smith", "%$#%<html>"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ID_25846_edit_profile_name_validation\n login_as_user1\n go_to_edit_profile_page\n verify_name_change_is_saved \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"Temp name\"\n verify_name_validation \"test_ID_25835_edit_profile_desc\", \"Jamie Smith\", \"%$#%<html>\"\n end",
"def html_... | [
"0.6565556",
"0.650803",
"0.64556634",
"0.6301773",
"0.62290746",
"0.62290746",
"0.6226756",
"0.6171377",
"0.6062398",
"0.6038972",
"0.60351735",
"0.60013187",
"0.60013187",
"0.59386706",
"0.59148514",
"0.58626354",
"0.5814946",
"0.577841",
"0.5733889",
"0.5684184",
"0.567312... | 0.65492976 | 1 |
returns the number of items within the entire collection | def item_count
@collection.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_count\n collection.length\n end",
"def item_count\n @collection.length\n end",
"def item_count\n @collection.count\n end",
"def count\n collection.count\n end",
"def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize... | [
"0.89182365",
"0.88980097",
"0.88107663",
"0.8566488",
"0.85653955",
"0.8261895",
"0.82609075",
"0.8230747",
"0.81601036",
"0.81571585",
"0.81363064",
"0.80553305",
"0.7923824",
"0.7866361",
"0.7866361",
"0.78641343",
"0.7864004",
"0.7846714",
"0.7804743",
"0.7802818",
"0.771... | 0.8950496 | 0 |
returns the number of pages | def page_count
(item_count / @items_per_page.to_f).ceil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_count; pages.count; end",
"def number_of_pages\n return @number_of_pages\n end",
"def page_count\n @total_pages\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end",
"def total_pages\n ... | [
"0.8871328",
"0.8835811",
"0.87635493",
"0.86556756",
"0.8639673",
"0.8625077",
"0.8625077",
"0.8625077",
"0.8625077",
"0.8606896",
"0.84872305",
"0.8312499",
"0.8308352",
"0.82833606",
"0.82538044",
"0.8244665",
"0.82341814",
"0.82276404",
"0.8223418",
"0.81749964",
"0.81725... | 0.7667015 | 61 |
returns the number of items on the current page. page_index is zero based. this method should return 1 for page_index values that are out of range | def page_item_count(page_index)
# input page index
# array of pages : transform page_count to array of page_count elements
pages_array = Array.new(page_count) { |i| i }
# return the number of item on page_index if page_index in the range else return -1
return -1 unless (0...page_count).include?(page... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index >= self.page_count\n @pages[page_index].count\n end",
"def page_item_count(page_index)\n return -1 if page_index > @collection[-1] || page_index < 0\n @collection.count {|v| v == page_index}\n end",
"def page_item_count(p... | [
"0.9075975",
"0.88048995",
"0.87935823",
"0.86645687",
"0.84724736",
"0.843572",
"0.829621",
"0.799585",
"0.79912686",
"0.798922",
"0.7881686",
"0.7852744",
"0.77564156",
"0.77449125",
"0.77269053",
"0.76941365",
"0.7684223",
"0.7684223",
"0.7684223",
"0.7684223",
"0.76729554... | 0.83151376 | 6 |
determines what page an item is on. Zero based indexes. this method should return 1 for item_index values that are out of range | def page_index(item_index)
# input item index
# guard clause to check item in is the range
return -1 unless (0...item_count).include?(item_index)
# return the page index if item in the range else return -1
item_index / @items_per_page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_index(item_index)\n return -1 if item_index < 0 || item_index >= self.item_count\n location = item_index.divmod @items_per_page\n location[0]\n end",
"def page_index(item_index) \n return -1 if !(item_index < item_count) || item_index < 0\n @collection[item_index]\n end",
"def page_in... | [
"0.83168113",
"0.8298332",
"0.8263321",
"0.8022921",
"0.79674655",
"0.72547466",
"0.6934565",
"0.68800926",
"0.6863384",
"0.68501455",
"0.68387663",
"0.67768264",
"0.6731977",
"0.66951525",
"0.65228564",
"0.649214",
"0.6489511",
"0.64002305",
"0.6397432",
"0.63581395",
"0.625... | 0.8020156 | 4 |
Sign Up Page << Updated for both types of sign up | def new
if logged_in?
flash[:notice] = "You are already signed in. If this is not your account, please 'Log Out'."
redirect_to root_path
else
flash[:notice] = ""
@new_user = User.new
@google_user_info_hash = {"name" => "", "username" => "", "uid" => "", "image" => ""}
if sess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signup\n end",
"def signup\n end",
"def signup\r\n\t@title = \"Sign Up\"\r\n end",
"def signup_info\n end",
"def signup_step1\n unless defined? params[:signup_email] or params[:signup_password]\n flash[:error] = \"Fields can't be blank !\"\n render :js => form_e... | [
"0.7668877",
"0.7668877",
"0.72126067",
"0.7171933",
"0.71321267",
"0.685181",
"0.68471724",
"0.68471724",
"0.6844915",
"0.6807268",
"0.6720681",
"0.67119116",
"0.66867936",
"0.665301",
"0.6649461",
"0.66246843",
"0.66239685",
"0.66091764",
"0.65869606",
"0.6581523",
"0.65700... | 0.0 | -1 |
NOTE : Since using resources as routes, adding check that the user attempting modification is the current user | def user_check(id)
check_user = User.find(id)
if check_user != current_user
flash[:notice] = "You can only modify your own user information."
redirect_to user_path(check_user)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updatable_by?(user)\n user.has_role?(:admin) or resource.user_id == user.id\n end",
"def modify?(current_user, request)\n if request.delete? || request.post? || request.put?\n case request.params[\"controller\"]\n when \"api/items\"\n user = request.post? ? List.find(request.params[\"... | [
"0.69469595",
"0.6912029",
"0.6888326",
"0.6790005",
"0.6787869",
"0.6760585",
"0.67087406",
"0.6693364",
"0.6668193",
"0.6656426",
"0.66458374",
"0.66321796",
"0.6543192",
"0.6535266",
"0.6530931",
"0.65276784",
"0.652036",
"0.6520274",
"0.6519113",
"0.6512239",
"0.6509241",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_lot
@lot = Lot.find(params[:id] || params[:lot_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 lot_params
params.require(:lot).permit(:category_id, :user_id, :starting_price, :current_price, :expires_at, :title, :description)
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 |
Setup connection to Fyber and returns instance of FyberApi::Response Accepts hash with additional options, refer: | def connect(options={})
query = query_string(options)
request = generate_request(query)
begin
response = Net::HTTP.get_response(request)
Response.new response
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, SocketError,
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_connection\n Faraday.new(:url => @api_url) do |connection|\n #connection.request :url_encoded\n connection.request :json\n #connection.request :retry\n\n connection.response :logger if debug?\n connection.response :raise_error\n c... | [
"0.66307956",
"0.6570541",
"0.65580946",
"0.6509174",
"0.64221036",
"0.6329835",
"0.6323521",
"0.63048404",
"0.62853926",
"0.6279985",
"0.62614596",
"0.62568945",
"0.62159157",
"0.621586",
"0.6187843",
"0.6125363",
"0.6125363",
"0.60874313",
"0.6078985",
"0.60666156",
"0.6043... | 0.0 | -1 |
Returns hash with mandatory request parameters | def default_options
{
appid: app_id,
device_id: device_id,
locale: locale,
ip: ip,
offer_types: offer_types,
timestamp: Time.now.to_i
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mandatory_params\n return {}\n end",
"def request_parameters\n {:email => @email, :receiverid => @receiverid, :amt => @amt,\n :uniqueid => @unique, :note => @note}.reject{|k,v| v.nil? }\n end",
"def http_params\n {}\n end",
"def request_query_params\n ... | [
"0.8041049",
"0.74660265",
"0.73966223",
"0.73591834",
"0.73377234",
"0.7303018",
"0.72665834",
"0.71477747",
"0.7111555",
"0.70656204",
"0.70598215",
"0.7031733",
"0.70183265",
"0.7012148",
"0.69765174",
"0.69594276",
"0.6949831",
"0.6949831",
"0.6943347",
"0.6939573",
"0.69... | 0.0 | -1 |
Gathers all request parameters, orders alphabetically and concatenate theme Params: options: hash with query options | def query_string(options={})
default_options.merge(options).delete_if{ |k, v| v.nil? || v == "" }.sort.map{ |arr| "#{arr[0]}=#{arr[1]}" }.join("&")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_request_params(options)\n params = detect_request_input options.delete(:input)\n\n options.inject(params) do |params, kv|\n key, value = kv\n params.merge!(\"#{key.to_s.downcase.gsub(/_+/,'')}\" => value) \n end\n end",
"def options_to_url_params # :nodoc:\n param... | [
"0.62746507",
"0.6216365",
"0.6096769",
"0.60919523",
"0.6010972",
"0.59482014",
"0.59400815",
"0.59275913",
"0.59165466",
"0.58847594",
"0.58330905",
"0.5810529",
"0.5788973",
"0.5785943",
"0.5765643",
"0.57616067",
"0.57438177",
"0.57266897",
"0.5724783",
"0.571665",
"0.567... | 0.5791237 | 12 |
Concatenate query with API key and hash the result using SHA1 Params: query: should be already parsed with :query_string | def hashkey_calculation(query)
validate(query)
query += '&' + api_key.to_s
Digest::SHA1.hexdigest(query)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_request(query)\n validate(query)\n URI(API_URL + '?' + query + \"&hashkey=\" + hashkey_calculation(query))\n end",
"def build_query\n query = { key: @api_key }\n query.merge! @parameters if @parameters\n query.map { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def query_strin... | [
"0.71645117",
"0.64877886",
"0.6349925",
"0.63318294",
"0.6331112",
"0.62729686",
"0.62658715",
"0.62531596",
"0.6245297",
"0.61782455",
"0.61772114",
"0.61146104",
"0.6099499",
"0.6072486",
"0.60346204",
"0.59875363",
"0.5983837",
"0.59809715",
"0.5958829",
"0.5870341",
"0.5... | 0.80432904 | 0 |
Generates final request, signed with hashkey Params query: should be already parsed with :query_string and :hashkey_calculation | def generate_request(query)
validate(query)
URI(API_URL + '?' + query + "&hashkey=" + hashkey_calculation(query))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n query_param = @request_parameters.to_query.gsub(/^&/, '')\n\n uri = URI(@url)\n remove_txt = uri.query\n final_url = @url.gsub(/\\?#{remove_txt}\\Z/i, '')\n\n str = \"#{final_url}?#{query_param}\"\n generate_signature(str)\n end",
"def query_string_sig2\n @quer... | [
"0.7331849",
"0.71501786",
"0.70570374",
"0.6901425",
"0.6854314",
"0.68339723",
"0.6699635",
"0.6603011",
"0.6546108",
"0.6463349",
"0.6445805",
"0.6333802",
"0.62228686",
"0.6217731",
"0.6217731",
"0.6181515",
"0.61692715",
"0.61514604",
"0.6142151",
"0.61349416",
"0.613090... | 0.7817429 | 0 |
Validates if given argument is String Params query: String | def validate(query)
raise(ArgumentError, ":query must be a string") unless query.is_a?(String)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def valid_string?(field, param)\n true\n end",
"def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end",
"def require_string(value)\n ... | [
"0.7296617",
"0.6979895",
"0.6675834",
"0.6454253",
"0.6302353",
"0.6290712",
"0.6271218",
"0.62394786",
"0.62336737",
"0.6228103",
"0.62264895",
"0.62121916",
"0.61910534",
"0.61852807",
"0.6171702",
"0.61708325",
"0.61611784",
"0.6132131",
"0.6126552",
"0.61027086",
"0.6090... | 0.8137951 | 0 |
Sort relation if not sorted already ;) This is lame see my comment about Relationsorted? predicate in dkubb/veritas. | def sort(relation)
if relation.kind_of?(Axiom::Relation::Operation::Order)
return relation
end
# There must be a shortcut for this ;)
relation.sort_by { relation.header.map(&:asc) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def apply_sorting_to_relation(rel)\n return rel if !params[:sort]\n\n sorts = params[:sort].split(',')\n\n sorts.each do |sort|\n if sort =~ /^([-+]?)(.*)$/\n desc = ($1 && $1 == '-')\n attrname = $2\... | [
"0.722653",
"0.7214671",
"0.6486588",
"0.61020243",
"0.6093317",
"0.60115176",
"0.5992676",
"0.5956728",
"0.5886372",
"0.58703023",
"0.5859927",
"0.58441806",
"0.5842285",
"0.5819686",
"0.5740428",
"0.5739125",
"0.5726069",
"0.5719157",
"0.56643444",
"0.5662638",
"0.5661686",... | 0.66725737 | 2 |
GET /achadoperdidos GET /achadoperdidos.json | def index
@achadoperdidos = Achadoperdido.where(condominio_id: current_user.condominio_id).page(params[:page]).per(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n ... | [
"0.6331085",
"0.63058555",
"0.62928563",
"0.6262274",
"0.62225366",
"0.6150523",
"0.613678",
"0.61331254",
"0.61321425",
"0.6121954",
"0.6112287",
"0.6095815",
"0.6086467",
"0.6084294",
"0.6073636",
"0.60685337",
"0.60244524",
"0.6002087",
"0.59925187",
"0.5987801",
"0.598118... | 0.6487555 | 0 |
GET /achadoperdidos/1 GET /achadoperdidos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n ... | [
"0.65452653",
"0.6419768",
"0.6365586",
"0.6244953",
"0.62082076",
"0.6180303",
"0.6137809",
"0.61373883",
"0.61319107",
"0.61291736",
"0.61016124",
"0.6090398",
"0.60869664",
"0.6071829",
"0.60593027",
"0.60529286",
"0.604504",
"0.6038303",
"0.59969753",
"0.5980802",
"0.5977... | 0.0 | -1 |
POST /achadoperdidos POST /achadoperdidos.json | def create
@achadoperdido = Achadoperdido.new(achadoperdido_params)
@achadoperdido.data_entrega = @achadoperdido.morador_id != nil ? Time.zone.now : nil
respond_to do |format|
if @achadoperdido.save
format.html { redirect_to @achadoperdido, notice: 'Cadastro realizado com sucesso.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def achadoperdido_params\n params.require(:achadoperdido).permit(:descricao, :... | [
"0.6251221",
"0.5773458",
"0.5718144",
"0.56822246",
"0.5655851",
"0.5614432",
"0.5579577",
"0.54411376",
"0.5439007",
"0.543454",
"0.54041636",
"0.5388893",
"0.5377803",
"0.5363767",
"0.53593206",
"0.5356497",
"0.535342",
"0.53495914",
"0.53429127",
"0.53311116",
"0.53129274... | 0.56641054 | 4 |
PATCH/PUT /achadoperdidos/1 PATCH/PUT /achadoperdidos/1.json | def update
@achadoperdido.data_entrega = @achadoperdido.morador_id != nil ? Time.zone.now : nil
respond_to do |format|
if @achadoperdido.update(achadoperdido_params)
format.html { redirect_to @achadoperdido, notice: 'Alteração realizada com sucesso.' }
format.json { render :show, status: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(... | [
"0.67126393",
"0.65649",
"0.64679134",
"0.63956213",
"0.6309927",
"0.62479305",
"0.624571",
"0.6239271",
"0.6231568",
"0.622132",
"0.6216396",
"0.6209211",
"0.61528903",
"0.61465436",
"0.6139297",
"0.6131534",
"0.6121762",
"0.61009544",
"0.6093939",
"0.6092235",
"0.6092235",
... | 0.0 | -1 |
DELETE /achadoperdidos/1 DELETE /achadoperdidos/1.json | def destroy
@achadoperdido.destroy
respond_to do |format|
format.html { redirect_to achadoperdidos_url, notice: 'Exclusão realizada com sucesso.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete()\n @api.do_request(\"DELET... | [
"0.7301356",
"0.72550136",
"0.69830894",
"0.6943896",
"0.6943896",
"0.6943896",
"0.6943896",
"0.69184613",
"0.6907067",
"0.6862206",
"0.68523204",
"0.6840935",
"0.68346417",
"0.6816051",
"0.68119955",
"0.6810588",
"0.6803573",
"0.68018365",
"0.68017256",
"0.6794898",
"0.67925... | 0.66506904 | 43 |
Use callbacks to share common setup or constraints between actions. | def set_achadoperdido
@achadoperdido = Achadoperdido.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def achadoperdido_params
params.require(:achadoperdido).permit(:descricao, :data_achado, :data_entrega, :observacao, :morador_id, :condominio_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
POST /hexa_cpus POST /hexa_cpus.json | def create
@hexa_cpu = HexaCpu.new(hexa_cpu_params)
@exercise = HexaExercise.new
@exercise.name = params[:name]
respond_to do |format|
if @hexa_cpu.save
@exercise.hexa_cpu_id = @hexa_cpu.id
@exercise.user_id = current_user.id
@exercise.save
@hexa_ram = HexaRam.new
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hexa_cpu_params\n params.require(:hexa_cpu).permit(:co, :dir, :pc, :directions, :load, :store, :add, :sub)\n end",
"def cpus(arg=nil)\n set_or_return(:cpus, arg, :kind_of => Integer)\n end",
"def create\n @cpu = Cpu.new(cpu_params)\n\n respond_to do |format|\n i... | [
"0.62834257",
"0.5898487",
"0.5825665",
"0.5792147",
"0.5792147",
"0.5759557",
"0.5717531",
"0.569532",
"0.56797826",
"0.55975825",
"0.5554945",
"0.5541814",
"0.5435115",
"0.53803724",
"0.5378606",
"0.5318485",
"0.52884614",
"0.5277626",
"0.5264568",
"0.52617526",
"0.5246975"... | 0.5689826 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_hexa_cpu
@hexa_cpu = HexaCpu.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 |
Never trust parameters from the scary internet, only allow the white list through. | def hexa_cpu_params
params.require(:hexa_cpu).permit(:co, :dir, :pc, :directions, :load, :store, :add, :sub)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
GET /listings GET /listings.json | def index
@listings = Listing.search(params[:search], params[:city])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { r... | [
"0.8407112",
"0.823",
"0.80734456",
"0.80728763",
"0.7699037",
"0.7699037",
"0.7699037",
"0.7699037",
"0.7699037",
"0.7699037",
"0.7644672",
"0.75575453",
"0.7544045",
"0.7541681",
"0.7541681",
"0.75016767",
"0.74329275",
"0.7331521",
"0.72823316",
"0.72809607",
"0.7227034",
... | 0.66205156 | 71 |
GET /listings/1 GET /listings/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end",
"def index\n @listings = Listing.all\n\n respond_to d... | [
"0.7888308",
"0.7693812",
"0.76934797",
"0.76559603",
"0.7541514",
"0.73575544",
"0.73575544",
"0.73575544",
"0.73575544",
"0.73575544",
"0.73575544",
"0.7326395",
"0.7326395",
"0.7326395",
"0.7302459",
"0.7253915",
"0.7239842",
"0.7234065",
"0.7224667",
"0.7222903",
"0.72229... | 0.0 | -1 |
POST /listings POST /listings.json | def create
# @profile_id = current_user.profile.id
# @profile_name = current_user.profile.first_name
@listing = current_user.profile.listings.create(listing_params)
respond_to do |format|
if @listing.save
format.html { redirect_to @listing, notice: 'Listing was successfully created.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end",
"def create\n #debugger\n #TODO: DELETE A... | [
"0.7446849",
"0.7005198",
"0.6835745",
"0.6828753",
"0.68283397",
"0.67769015",
"0.6735005",
"0.67246014",
"0.67246014",
"0.6674794",
"0.6612892",
"0.66121215",
"0.6583286",
"0.6568545",
"0.6566827",
"0.6560705",
"0.65571827",
"0.6516789",
"0.6491179",
"0.6447116",
"0.6436306... | 0.62026656 | 47 |
PATCH/PUT /listings/1 PATCH/PUT /listings/1.json | def update
if current_user.profile != @listing.profile
redirect_to profile_path(current_user)
end
respond_to do |format|
if @listing.update(listing_params)
format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }
format.json { render :show, status: :ok, l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #updating the listings\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: \"Listing was successfully updated.\" }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render ... | [
"0.68559015",
"0.6816421",
"0.6815671",
"0.6807912",
"0.6584185",
"0.6574344",
"0.6574344",
"0.6574344",
"0.65733165",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.65476894",
"0.... | 0.0 | -1 |
DELETE /listings/1 DELETE /listings/1.json | def destroy
@listing.destroy
respond_to do |format|
format.html { redirect_to listings_url, notice: 'Listing was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n api_delete(\"/listings/#{@listing_id}\")\n end",
"def destroy\n @listing = Listing.find(params[:id])\n @listing.destroy\n\n respond_to do |format|\n format.html { redirect_to listings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @listi... | [
"0.82345164",
"0.74539715",
"0.74539715",
"0.74539715",
"0.74539715",
"0.74539715",
"0.7326562",
"0.7326562",
"0.7326562",
"0.7326562",
"0.7326562",
"0.73037916",
"0.72940636",
"0.7221047",
"0.7205228",
"0.7195688",
"0.7195688",
"0.7195688",
"0.71829325",
"0.7143359",
"0.7079... | 0.6993825 | 39 |
Use callbacks to share common setup or constraints between actions. | def set_listing
@listing = Listing.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 listing_params
params.require(:listing).permit(:profile_id, :hobby_id, :description, :location, :date, :city_id, :equipment, :capacity)
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 |
used when stating receiving bank's name in a transfer message | def initialize(bankname)
@bankname = bankname
@accounts = {}
@cc_limits = {}
@cc_balances = {}
@cc_holds = {}
@cc_rates = {}
puts "#{@bankname} bank was just created."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n fetch('bank.name')\n end",
"def get_bank_name()\n return @RESPONSE_HASH['BANK_NAME']\n end",
"def branch_name\n if name.in?(['Cole Taylor Bank', 'MB Financial Bank, N.A.'])\n sfx = Channel.consumer_direct.identifier.eql?(channel) ? ' CD' : ''\n \"MB #{city}#{sfx}\"\n ... | [
"0.7000166",
"0.69617236",
"0.65300655",
"0.6475739",
"0.64026314",
"0.61859244",
"0.61142457",
"0.6019673",
"0.59826",
"0.5970252",
"0.5913609",
"0.58900875",
"0.5872245",
"0.58631074",
"0.5811751",
"0.5806766",
"0.58029807",
"0.5792217",
"0.57876253",
"0.57843304",
"0.57817... | 0.0 | -1 |
Calculates the amount of New Business for this contract | def new_business
if predecessors.size > 0
@newbusiness = [total_revenue - predecessors.inject(0) { |sum, n| sum + n.total_revenue }, 0].max
else
@newbusiness = total_revenue
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_total\n sub_total = 0\n\n if size\n sub_total += Config.booths[size][:price]\n end\n\n self.add_ons.each do |add_on|\n sub_total += add_on.total\n end\n sub_total += industries.length * 35000\n sub_total += fees.pluck(:amount).reduce(0, &:+)\n\n self.total = sub_tota... | [
"0.65982175",
"0.6334207",
"0.6262105",
"0.62236774",
"0.6210603",
"0.61579555",
"0.61101806",
"0.60631305",
"0.60626227",
"0.6054103",
"0.6045721",
"0.6041965",
"0.60165745",
"0.5974167",
"0.59501964",
"0.5926293",
"0.5902033",
"0.58920395",
"0.58809835",
"0.5880068",
"0.587... | 0.7026628 | 0 |
Calculates the amount of change, per contract, bewteen current year and previous year | def renewal_attrition
if predecessors.size > 0
@attrition = total_revenue - predecessors.inject(0) { |sum, n| sum + n.total_revenue }
else
@attrition = 0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_years(principal, interest, tax, desired)\n# principal amount\n year = 0\n while principal < desired\n year += 1\n income = principal * interest\n principal += income - income * tax\n end\n year\nend",
"def get_price_change_ytd(stock)\n stock_price = get_stock_price(stock)\n ytd_p... | [
"0.6899992",
"0.6727884",
"0.6665387",
"0.6643909",
"0.6632303",
"0.6584397",
"0.65593356",
"0.64529634",
"0.6377787",
"0.6358258",
"0.63187474",
"0.62860596",
"0.62542844",
"0.62223196",
"0.6209327",
"0.61888486",
"0.61825407",
"0.6157842",
"0.61454636",
"0.6138519",
"0.6098... | 0.0 | -1 |
returns true if the monthly billing changes during the contract period. | def billing_fluctuates?
return false if self.expired
return false if self.end_date < Date.today
start_dates = line_items.reject { |l| l.list_price.nil? || l.list_price == 0 }.map { |line| line.begins }
end_dates = line_items.reject { |l| l.list_price.nil? || l.list_price == 0 }.map { |line| line.ends }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_changed?\n self.month != (self-1.hour).month\n end",
"def billing_monthly?\n numbering_period == 'monthly'\n end",
"def current?\n period.same_month?(Time.now.utc.to_date) && !buyer_account.try!(:destroyed?)\n end",
"def monthly?\n charge_code == LEGACY_MID_TERM\n end",
... | [
"0.73995256",
"0.693177",
"0.68542236",
"0.6428843",
"0.6372673",
"0.63431394",
"0.6127029",
"0.60915065",
"0.6025879",
"0.5973996",
"0.5965256",
"0.5944495",
"0.59186965",
"0.5900267",
"0.58770245",
"0.5816976",
"0.57581824",
"0.5716487",
"0.5705713",
"0.5654273",
"0.5636085... | 0.5773752 | 16 |
TODO: ADD THIS AS A FIELD AND RUN NIGHTLY JOB | def parts_cost
begin
@parts_cost = ::FishbowlPartsCost.cost_for(self.id).cost
rescue ActiveResource::ResourceNotFound
@parts_cost = BigDecimal.new('0.0')
end
@parts_cost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reserve_and_run_one_job; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run() end",
"def run_job\n end",
"def... | [
"0.6692309",
"0.653992",
"0.653992",
"0.653992",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.6456174",
"0.63381004",
"0.61423767",
"0.6078427",
"0.6056549",
"0.6056549",
"0.6040719",
"0.6040719",
"0.60307086",
"... | 0.0 | -1 |
GET /officials/:id/edit GET /users/:user_id/officials/:id/edit | def edit
@official = Official.find(params[:id])
if params[:user_id]
@user = User.find(params[:user_id])
# if the users don't match we shouldn't be here
record_not_found and return if @user != current_user and !admin? and !official_admin?
else
# if we aren't an admin we shouldn't be h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n # @user = User.find(params[:id]) -- not needed bc of correct_user\n end",
"def edit\n # @user = User.find(params[:id])\n # already in correct_user\n end",
"def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's ... | [
"0.7091097",
"0.70327264",
"0.6907531",
"0.6826215",
"0.6816166",
"0.680575",
"0.6793296",
"0.6785851",
"0.67780495",
"0.6770842",
"0.67447424",
"0.67173153",
"0.66815037",
"0.6658933",
"0.6658315",
"0.6657119",
"0.6645442",
"0.6645442",
"0.66376853",
"0.66301095",
"0.6620096... | 0.79257774 | 0 |
PUT /officials/:id PUT /users/:user_id/officials/:id | def update
@official = Official.find(params[:id])
if params[:user_id]
@user = User.find(params[:user_id])
# if the users don't match we shouldn't be here
record_not_found and return if @user != current_user and !admin? and !official_admin?
@official.attributes = params[:official]
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update\n @official_tenure = OfficialTenure.find(params[:id])\n\n... | [
"0.7388129",
"0.6383346",
"0.62522936",
"0.61110514",
"0.60143906",
"0.59889877",
"0.59451675",
"0.59442526",
"0.58542216",
"0.58532256",
"0.57706785",
"0.57581484",
"0.57222384",
"0.5703599",
"0.56999815",
"0.56987166",
"0.5695764",
"0.56654626",
"0.564772",
"0.5614",
"0.558... | 0.66150486 | 1 |
POST /officials/:id/send_evaluation send an evaluation for this official to a third party | def send_evaluation
if (!params[:resend])
# check and make sure this evaluation hasn't already been sent
return if Evaluation.find(:first, :conditions => "official_id = #{params[:id]} and sent_to_email = '#{params[:sent_to_email]}'")
end
# create a new evaluation
@evaluation = Eval... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_evaluation_email\n EvaluationMailer.evaluation(self).deliver_now\n end",
"def send_evaluate_prop\n task = @proposal.evaluate_proposals.create\n task.workbench = Organization.find params[:organization][:organization_id]\n task.save\n redirect_to :action => \"pending\"\n end",
"def send... | [
"0.6524879",
"0.6466458",
"0.6378147",
"0.635786",
"0.6299457",
"0.6227433",
"0.61915815",
"0.61808187",
"0.6075361",
"0.6067509",
"0.60182476",
"0.6018223",
"0.5996034",
"0.59344345",
"0.59313107",
"0.59225196",
"0.59225196",
"0.59093606",
"0.5907066",
"0.5888296",
"0.588600... | 0.757174 | 0 |
send default evaluations to the official's district and regional directors | def send_default_evaluations
# create a new evaluation for the district director
unless @official.district.nil? or @official.district.email.empty?
# create a new evaluation
@district_evaluation = Evaluation.new
@district_evaluation.sent_to_name = @official.district.director
@district_eva... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def electoral_districts!\n raise NotImplementedError\n end",
"def eurocentric_institutions!\n warn \"Experimental code #{__method__}. Do not enable in release. #{__FILE__}:#{__LINE__}\"\n\n # Nerf dev pushing just slightly, to prevent AI Ming/Korea spawning Renaissance really early\n ... | [
"0.5548938",
"0.5148984",
"0.51133657",
"0.5091587",
"0.50822204",
"0.4945681",
"0.49261189",
"0.4921591",
"0.4856815",
"0.48412216",
"0.4819752",
"0.47960028",
"0.47914156",
"0.4768501",
"0.47369948",
"0.47295067",
"0.47052026",
"0.46919775",
"0.46914423",
"0.46873862",
"0.4... | 0.7389808 | 0 |
An arena can have gladiators | def gladiator_count
return
# def fight(gladiator_1, gladiator_2)
# fight = {
# "Trident" => "Spear",
# "Spear" => "Club",
# "Club" => "Trident"
# }
# if fight[gladiator_1[:fight]] == gladiator_2[:play]
# return "#{gladiator_1[:name]} wins!"
# else
# return "#{glad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_gladiator(g)\n if gladiators.count < 2\n gladiators << g\n end\n end",
"def spawn_enemy_balls\n # TODO\n end",
"def spawnAnt\n\t\tant = Ant.new(@anthill)\n\t\tcase @type\n\t\twhen \"builder\"\n\t\t\tclass << ant\n\t\t\t\tdef setAnt\n\t\t\t\t\t@ant_type = \"builder\"\n\t\t\t\tend... | [
"0.56062955",
"0.554612",
"0.5355021",
"0.52468294",
"0.5226132",
"0.5222449",
"0.5210311",
"0.5136265",
"0.51275724",
"0.5127408",
"0.5116131",
"0.5105044",
"0.5081173",
"0.50687754",
"0.5061658",
"0.5059713",
"0.50567955",
"0.50518525",
"0.50380147",
"0.5025473",
"0.5022884... | 0.0 | -1 |
GET /sections GET /sections.json | def index
@sections = Section.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n course = Course.find(params[:course_id])\n sections = co... | [
"0.7657255",
"0.7629772",
"0.76165533",
"0.74706644",
"0.74706644",
"0.7328107",
"0.7307292",
"0.7259536",
"0.7236849",
"0.7150811",
"0.70597434",
"0.6901461",
"0.6901461",
"0.6901461",
"0.68706095",
"0.6828614",
"0.68284744",
"0.6800358",
"0.6774491",
"0.6767984",
"0.6756643... | 0.72006536 | 14 |
GET /sections/1 GET /sections/1.json | def show
@section.comments.each do |c|
c.score = c.comment_score
c.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end",
"def index\n @sections = Section.all\n\n respond_to do |format|\n ... | [
"0.76172704",
"0.75330263",
"0.7447315",
"0.7354998",
"0.7354998",
"0.7354998",
"0.7288897",
"0.7163191",
"0.71099484",
"0.7071269",
"0.7071269",
"0.7071269",
"0.7071269",
"0.7071269",
"0.7071269",
"0.7071269",
"0.70165604",
"0.70165604",
"0.6951023",
"0.69294894",
"0.6897185... | 0.0 | -1 |
POST /sections POST /sections.json | def create
@section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))
respond_to do |format|
if @section.save
format.html { redirect_to @section, notice: 'Section was successfully created.' }
format.json { render :show, status: :created, location: @se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @section = Section.new(section_params)\n\n if @section.save\n re... | [
"0.7241766",
"0.7117048",
"0.6975109",
"0.6892432",
"0.68632454",
"0.6826701",
"0.68073636",
"0.6783039",
"0.6783013",
"0.6783013",
"0.6783013",
"0.6783013",
"0.67417693",
"0.67033625",
"0.6655417",
"0.663827",
"0.66318464",
"0.6615877",
"0.6607835",
"0.65884143",
"0.65539175... | 0.6186403 | 36 |
PATCH/PUT /sections/1 PATCH/PUT /sections/1.json | def update
respond_to do |format|
if @section.update(section_params)
format.html { redirect_to @section, notice: 'Section was successfully updated.' }
format.json { render :show, status: :ok, location: @section }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n section_chunks = get_chunks(params)\n\n puts params\n redirect_to @course\n\n return\n\n sections = params['sections']\n if sections.nil?\n # Loop through course's existing sections.\n @course.sections.each do |section|\n\n end\n end\n \n respond_to do |format... | [
"0.6911073",
"0.6826125",
"0.68166745",
"0.6784174",
"0.66672015",
"0.6617956",
"0.65984285",
"0.658834",
"0.6584153",
"0.6517693",
"0.64748657",
"0.6465158",
"0.6426324",
"0.63903034",
"0.63802546",
"0.63802546",
"0.63581306",
"0.6352856",
"0.6346238",
"0.6332728",
"0.630332... | 0.6545191 | 13 |
DELETE /sections/1 DELETE /sections/1.json | def destroy
@section.destroy
respond_to do |format|
format.html { redirect_to sections_url, notice: 'Section was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @section = Section.find(params[:id])\n @section.destroy\n\n respond_to do |format|\n format.html { redirect_to sections_url }\n format.json { head :no_content ... | [
"0.7680669",
"0.75949883",
"0.75949883",
"0.75782114",
"0.75782114",
"0.7464437",
"0.7425009",
"0.7399472",
"0.7321908",
"0.7321908",
"0.7286962",
"0.7268021",
"0.7204781",
"0.71828485",
"0.7168917",
"0.71149045",
"0.7077172",
"0.70642954",
"0.7054018",
"0.70320314",
"0.70271... | 0.7209629 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_section
@section = Section.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 |
Never trust parameters from the scary internet, only allow the white list through. | def section_params
params.require(:section)
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.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
counter = 0
value_sort = []
if name_hash.size > 0
name_hash.each do |key, value|
value_sort<< value
end
min = value_sort[counter]
value_sort.each do |value|
min = value_sort[0]
if min >= value_sort[counter]
min = value_sort[counter]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
1. Create a bitmap context 2. Create an array of shapes. 4 different shapes are needed. 1. A filled Rectangle 2. A stroked Circle 3. A filled Triangle 4. A stroked rounded rectangle 3. Set fill color to be blue, set stroke color to be red. 4. Override fill color to green and stroke color to blue in the the circle. 5. D... | def test01()
baseImageName = "arrayofshapes.jpg"
begin
theCommands = CommandModule::SmigCommands.new
theCommands.saveresultstype = :lastcommandresult
# 1. Create the bitmap context command
bitmapContextName = SecureRandom.uuid
createBitmapContextCommand = CommandModule.make_createbitmapcontext(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graphicsmagick?; end",
"def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2... | [
"0.63012165",
"0.6245588",
"0.60391575",
"0.60177165",
"0.5967218",
"0.59192675",
"0.591726",
"0.58913577",
"0.58510387",
"0.5822406",
"0.57797533",
"0.5774643",
"0.57192075",
"0.57141787",
"0.57024175",
"0.5669788",
"0.5660939",
"0.5656441",
"0.56337357",
"0.56196654",
"0.56... | 0.70916605 | 0 |
Get all chats at a table after a certain id. | def index
table = Table.find params[:table_id].to_i
result = []
index = -1;
table.chat.each do |c|
if c.id >= index
index = c.id
end
if c.id > params[:chat_index].to_i
result << {
index: c.id,
message: c.message,
username: c.user.username
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chats\n @chats ||= Chat.find_all_by_match_id(params[:match_id], :include => :player)\n end",
"def index\n list = current_user.chats.pluck :id\n\n options = filter_params\n options[:id] = filter_params[:id] == 'all' ? list : [filter_params[:id]]\n @messages = ChatMessage.filter options\n @m... | [
"0.6356817",
"0.6046426",
"0.5964422",
"0.57613766",
"0.56681323",
"0.56353366",
"0.5601546",
"0.5565759",
"0.54716974",
"0.5405941",
"0.53905225",
"0.53905225",
"0.53905225",
"0.53905225",
"0.53729755",
"0.5369597",
"0.5312032",
"0.52965844",
"0.5267343",
"0.5261308",
"0.518... | 0.55810016 | 7 |
======= Handle iManage10 Resources ======== | def get_matter_worklist(options={})
parser.results_parser(get({ path: ROUTES[:get_recent_workspaces].call(@customer_id, @library_id), headers: authorization_header_for_rest_api}))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_resource_management10\n @resource_management10 = ResourceManagement10.find(params[:id])\n end",
"def resources()\n end",
"def resources; end",
"def resources; end",
"def edit\n device = Device.find(params[:id])\n hostname = device.hostname\n @bulk_ints = {'device_id' => device.i... | [
"0.6166651",
"0.59885055",
"0.58909243",
"0.58909243",
"0.58360726",
"0.57955086",
"0.5776999",
"0.56543475",
"0.5610249",
"0.5582145",
"0.55574256",
"0.55565125",
"0.5540312",
"0.5516043",
"0.55119526",
"0.5474215",
"0.54652715",
"0.54610056",
"0.5440959",
"0.5440766",
"0.54... | 0.0 | -1 |
GET /tipocostos GET /tipocostos.json | def index
@tipocostos = Tipocosto.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.... | [
"0.6572074",
"0.65453905",
"0.65211177",
"0.64452153",
"0.6416271",
"0.639979",
"0.639979",
"0.6366315",
"0.63555527",
"0.63492835",
"0.63174975",
"0.6300568",
"0.6275907",
"0.6204112",
"0.61811197",
"0.6166865",
"0.6160931",
"0.615184",
"0.61191875",
"0.6110729",
"0.6102195"... | 0.7079464 | 0 |
GET /tipocostos/1 GET /tipocostos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tipocostos = Tipocosto.all\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n... | [
"0.6991009",
"0.6823776",
"0.6730764",
"0.66642797",
"0.6640364",
"0.6591025",
"0.6538663",
"0.6538663",
"0.6501198",
"0.64926696",
"0.6486197",
"0.64375985",
"0.64308095",
"0.63918775",
"0.6329601",
"0.63149685",
"0.6291333",
"0.62815505",
"0.6260961",
"0.6256599",
"0.624849... | 0.0 | -1 |
POST /tipocostos POST /tipocostos.json | def create
@tipocosto = Tipocosto.new(tipocosto_params)
respond_to do |format|
if @tipocosto.save
format.html { redirect_to @tipocosto, notice: 'Tipocosto was successfully created.' }
format.json { render :show, status: :created, location: @tipocosto }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tipocosto_params\n params.require(:tipocosto).permit(:nombre, :descripcion)\n end",
"def resource_params\n params.require(:tratamiento).permit(:tipo)\n end",
"def solicitacao_tipo_params\n params.require(:solicitacao_tipo).permit(:tipo)\n end",
"def tipoapreensao_params\n par... | [
"0.71564853",
"0.6728982",
"0.66073877",
"0.65996337",
"0.65719897",
"0.65394413",
"0.6528853",
"0.65234065",
"0.65127",
"0.64819837",
"0.64773923",
"0.6448373",
"0.64345676",
"0.6407403",
"0.6388954",
"0.6373684",
"0.6352138",
"0.6351901",
"0.634243",
"0.6340679",
"0.6340627... | 0.71685696 | 0 |
PATCH/PUT /tipocostos/1 PATCH/PUT /tipocostos/1.json | def update
respond_to do |format|
if @tipocosto.update(tipocosto_params)
format.html { redirect_to @tipocosto, notice: 'Tipocosto was successfully updated.' }
format.json { render :show, status: :ok, location: @tipocosto }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\... | [
"0.6660822",
"0.65943635",
"0.6552439",
"0.655173",
"0.6545005",
"0.6478523",
"0.641771",
"0.6402368",
"0.63949895",
"0.6327435",
"0.6319234",
"0.6317863",
"0.6296151",
"0.62789994",
"0.626445",
"0.62534684",
"0.62453437",
"0.62355584",
"0.62349224",
"0.6231238",
"0.6230397",... | 0.6813382 | 0 |
DELETE /tipocostos/1 DELETE /tipocostos/1.json | def destroy
@tipocosto.destroy
respond_to do |format|
format.html { redirect_to tipocostos_url, notice: 'Tipocosto was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_neg... | [
"0.72591",
"0.7174755",
"0.71046",
"0.7092926",
"0.7091885",
"0.70784754",
"0.7038179",
"0.70350397",
"0.70316184",
"0.70159054",
"0.7014068",
"0.6994183",
"0.6975027",
"0.6975027",
"0.6975027",
"0.6972791",
"0.6963028",
"0.69624794",
"0.69613165",
"0.6948597",
"0.6946001",
... | 0.7299115 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tipocosto
@tipocosto = Tipocosto.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 tipocosto_params
params.require(:tipocosto).permit(:nombre, :descripcion)
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 |
ability to get paid/recieve payments | def deduct_happiness_or_hygiene (attribute, num)
if attribute - num <10
attribute = 0
elsif
attribute - num
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pay(payment)\n retval\n end",
"def paid\r\n #if @notification.acknowledge # check if it’s genuine Robokassa request\r\n #@user.approve! # project-specific code\r\n render :text => @notification.success_response\r\n @payment.approve!\r\n #else\r\n #head :bad_request\r\n ... | [
"0.7191645",
"0.712794",
"0.70045877",
"0.6986698",
"0.6977797",
"0.69662106",
"0.69396836",
"0.6926472",
"0.6915296",
"0.6895596",
"0.68843806",
"0.68710554",
"0.68215287",
"0.68164897",
"0.6807775",
"0.6779679",
"0.677788",
"0.67342824",
"0.67269766",
"0.6725366",
"0.669851... | 0.0 | -1 |
take a bath call a friend | def call_friend(friend)
friend.happiness +=3
self.happiness +=3
"Hi #{friend.name}! It's #{self.name}. How are you?"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def friend_request\n\nend",
"def call_friend(friend)\n self.happiness += 3\n friend.happiness += 3\n \"Hi #{friend.name}! It's #{self.name}. How are you?\"\n end",
"def call_friend(friend) \n self.happiness = (@happiness + 3)\n friend.happiness = (friend.happiness +... | [
"0.705566",
"0.65800124",
"0.65014017",
"0.64275",
"0.642278",
"0.64181376",
"0.637658",
"0.6262615",
"0.6249483",
"0.62059075",
"0.61844444",
"0.61656314",
"0.61321855",
"0.6106007",
"0.60899764",
"0.60836405",
"0.60804045",
"0.60724723",
"0.60703367",
"0.6064451",
"0.604775... | 0.5949997 | 24 |
def after_sign_out_path_for(resource) redirect_to " and return end | def app_name
Rails.application.class.to_s.split("::").first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource)\n '/'\n end",
"def after_sign_out_path_for(resource)\n \tnew_user_session_path\n end",
"def after_sign_out_path_for(resource)\n #if current_user_signed_in?\n # redirect_to home_path \n # else\n redirect_to site_index_path \n #end \n end",
"def aft... | [
"0.8967652",
"0.8863825",
"0.8812551",
"0.8766772",
"0.8759524",
"0.8759524",
"0.8759524",
"0.8759524",
"0.8759524",
"0.8752132",
"0.87087554",
"0.86784965",
"0.86784965",
"0.8660553",
"0.8658358",
"0.8658358",
"0.8658358",
"0.86544144",
"0.8653227",
"0.8631777",
"0.8631777",... | 0.0 | -1 |
Irving's Corollary 1.3 i && ii | def phase1_reduce
removed_all = []
# 1.3i - remove any that match 1.3i
@best_proposals.each_with_index do |p,i|
slice_point = @people_prefs[i].index(p) + 1
removed_from_i = @people_prefs[i].slice!(slice_point, @people_prefs[i].count)
removed_all << removed_from_i
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def and_c\n end",
"def and_b\n end",
"def and_l\n end",
"def AND(x,y); \tif x==1 && y==1 \tthen 1 else 0 end; end",
"def and_a\n end",
"def and_e\n end",
"def And(a, b)\n return a && b\nend",
"def checkEqri(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instru... | [
"0.65174013",
"0.6462467",
"0.6327168",
"0.6217834",
"0.61902726",
"0.61707807",
"0.60427177",
"0.6006822",
"0.59590083",
"0.5951704",
"0.5941352",
"0.5894878",
"0.5847367",
"0.5831126",
"0.5774261",
"0.5719947",
"0.5719648",
"0.56832504",
"0.5675474",
"0.5627321",
"0.5623366... | 0.0 | -1 |
start the recursive cycle_crawl method | def find_cycle
first = @people_prefs.index{|i| i.size > 1}
cycle_crawl(first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform\n if perform_crawl?\n if get_page\n store_page\n normalize_links\n filter_links\n continue_crawl\n end\n else\n # puts \"Depth limit reached for #{@url}\"\n end\n end",
"def continue_crawl\n # puts \"I am on #{@url} (#{@links.size} links)-> I wa... | [
"0.71131265",
"0.7093219",
"0.6875442",
"0.683654",
"0.66462505",
"0.64622253",
"0.6460753",
"0.6445372",
"0.63977844",
"0.63934946",
"0.6375088",
"0.63032925",
"0.6243689",
"0.615145",
"0.6151447",
"0.6105316",
"0.60971105",
"0.6074925",
"0.60607964",
"0.6027192",
"0.6015987... | 0.62924325 | 12 |
Looking for a pattern in the proposals. | def cycle_crawl(person, ps=[], qs=[])
puts "cycle crawl with (#{person}, #{ps}, #{qs})" if $DEBUG
second_choice = @people_prefs[person][1]
puts "second_choice: #{second_choice}" if $DEBUG
if ps.include?(person) && qs.include?(second_choice)
puts "ps: #{ps} << #{person}" if $DEBUG
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_suggest\n puts suggest_pattern if suggest_pattern\n end",
"def fetch_pattern(type, indentation); end",
"def match(pattern); end",
"def on_match_pattern_p(node); end",
"def p(pattern)\n Parslet::Pattern.new(pattern)\n end",
"def pattern_candidates(pattern,representative)\n candi... | [
"0.6117286",
"0.6080075",
"0.5994249",
"0.59061885",
"0.5905025",
"0.5904188",
"0.5836107",
"0.57820493",
"0.5766312",
"0.57591313",
"0.57568693",
"0.5708624",
"0.56703407",
"0.566316",
"0.56433713",
"0.56397295",
"0.5625907",
"0.5625907",
"0.5625907",
"0.56041574",
"0.559895... | 0.0 | -1 |
pretty print the main preference array | def print_prefs
puts "____________"
puts "Reduced Sets"
@people_prefs.each_with_index do |prefs, i|
puts "#{i}| #{prefs.join(' ')} "
end
puts "____________"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printable\n\t\t@entries.sort.map do |key, value|\n\t\t\t\"[#{key}] \\\"#{value}\\\"\"\n\t\tend.join(\"\\n\")\n\tend",
"def pretty_print(pp)\n pp.object_address_group(self) do\n ivs = sorted_instance_variables.map(&:to_s)\n pp.seplist(ivs, proc { pp.text ',' }) do |iv|\n pp.breakab... | [
"0.6498766",
"0.6253276",
"0.622676",
"0.6217241",
"0.61778057",
"0.6145192",
"0.6119178",
"0.61112356",
"0.61017865",
"0.60955966",
"0.60749817",
"0.60544515",
"0.6044456",
"0.6044418",
"0.6026847",
"0.6026847",
"0.60171723",
"0.60090774",
"0.5975832",
"0.5951366",
"0.591409... | 0.7559025 | 0 |
pretty print the current proposals | def print_proposals
puts "____________"
puts "Proposals"
sent_proposals.each_with_index do |proposed, i|
puts "#{i} => #{proposed}"
end
puts "____________"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_print\n puts `ruby -r pp -e 'pp(#{@template.inspect})'`\n end",
"def index\n @proposals = current_user.proposals\n end",
"def pretty_print(pp)\n super if defined? super\n\n pp.breakable\n pp.text \"Frame Selection:\"\n if !frame_mappings.em... | [
"0.65075916",
"0.6336798",
"0.6319366",
"0.62258077",
"0.62258077",
"0.60799396",
"0.6078815",
"0.60687816",
"0.6024537",
"0.6024537",
"0.6016813",
"0.59843254",
"0.5980591",
"0.5959872",
"0.5898074",
"0.5892125",
"0.5873744",
"0.58671796",
"0.58551556",
"0.5836272",
"0.58340... | 0.84440047 | 0 |
inverts the array of who proposals are received from to who (index) has sent a proposal to whom (value) | def sent_proposals
reversed_matches = Array.new(@group_size)
@best_proposals.each_with_index do |e, i|
reversed_matches[e] = i if e
end
reversed_matches
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def undolist\n @rank_participants = RankParticipant.only_deleted.reverse\n end",
"def invert() end",
"def untransform(offset)\n\t\tresult = []\n\t\trev_upp_index = @upp_index.reverse\n\t\trev_low_index = @low_index.reverse\n\t\ttemp_arr = @message.split(\"\")\n\t\ttemp_arr.each do |letter|\n \n\t\t\tif upc... | [
"0.52163005",
"0.5102134",
"0.5054074",
"0.5049644",
"0.5039508",
"0.50368875",
"0.49997428",
"0.49897185",
"0.49829575",
"0.49809775",
"0.49677464",
"0.4966721",
"0.49449113",
"0.4933768",
"0.49148613",
"0.49141455",
"0.49096164",
"0.49046487",
"0.49003753",
"0.4896879",
"0.... | 0.62182397 | 0 |
METHOD ORGANIZATION: create read update delete CREATE | def new
# Display a form to create a new post
# The actual post creation is handled by method: create
@post = Post.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\r\n\r\n\r\n end",
"def create\n \n end",
"def create\r\n end",
"def create \n end",
"def create \n end",
"def create\n \t\n end",
"def create\n \n end",
"def create #:doc:\n end",
"def ... | [
"0.6491227",
"0.6491227",
"0.6491227",
"0.6491227",
"0.6225774",
"0.62046695",
"0.61070096",
"0.60603356",
"0.60603356",
"0.60411954",
"0.60398775",
"0.59543073",
"0.59449923",
"0.59004503",
"0.59004503",
"0.59004503",
"0.57919914",
"0.57919914",
"0.57919914",
"0.57919914",
"... | 0.0 | -1 |
What we do here is to go through the builder heirarchy and push all the code from children up to the parent, ending up with all the code in the toplevel builder | def process_code(builder)
builder.write
@includes << builder.includes
@declarations << builder.declarations
@registrations << builder.registrations
# Process the globals
builder.global_nodes.each do |g|
g.write
@includes << g.includes
@glob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ancestor_builder; end",
"def ancestor_builder; end",
"def process_and_build_components \n end",
"def builder_method\n config[:child_builder]\n end",
"def method_missing(name, *args, &block)\n super unless respond_to? name\n @builder = Builder.new(builder.tree) do\n ... | [
"0.6345256",
"0.6345256",
"0.60644126",
"0.6062922",
"0.6027436",
"0.59478426",
"0.5879767",
"0.57794195",
"0.5756173",
"0.5756173",
"0.5756173",
"0.57362235",
"0.5721253",
"0.5712791",
"0.5705051",
"0.5661904",
"0.56467044",
"0.5637724",
"0.5610825",
"0.5573292",
"0.55657905... | 0.62507844 | 2 |
saving parsed result to database | def save_parsed_result(log_hash)
log_hash.each do |visitor_id, visitor_hash|
Visitor.create_entry(self.id, visitor_id, visitor_hash)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_report\n\n # Parse the result with Nokogiri\n response = connect\n\n # Add the column headers to the file\n write_column_headers\n\n # Append the first batch of data to the file\n write_batch_data\n\n # Save the token for successive calls\n token = \"&token=\" + res... | [
"0.65104187",
"0.6214937",
"0.6209489",
"0.5997518",
"0.59887755",
"0.5956781",
"0.59418285",
"0.59229976",
"0.59139365",
"0.59119546",
"0.5875554",
"0.5875554",
"0.58025515",
"0.5792799",
"0.5788842",
"0.5788842",
"0.5788842",
"0.5788842",
"0.5788842",
"0.5788842",
"0.578884... | 0.6489004 | 1 |
INSTANCE METHODS return correct path to file based on visibility & type | def download_path
if self.upload_file_name.nil?
self.human_fastq_url
else
if self.study.public?
download_file_path(self.study.url_safe_name, filename: self.bucket_location)
else
download_private_file_path(self.study.url_safe_name, filename: self.bucket_location)
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_for(type_name)\n path = path_join type_name.file_path\n ensure_path_exists path\n\n File.join path, type_name.file_name\n end",
"def file_path; end",
"def type\n if File.directory?(path)\n return :filesystem\n elsif File.file?(path)\n return :z... | [
"0.6923985",
"0.6746273",
"0.6722179",
"0.66515857",
"0.66515857",
"0.66515857",
"0.6632568",
"0.66279423",
"0.6622906",
"0.6622045",
"0.66123176",
"0.6542071",
"0.65322053",
"0.64890814",
"0.64755684",
"0.6463622",
"0.6462083",
"0.6367561",
"0.6365949",
"0.63659465",
"0.6353... | 0.0 | -1 |
JSON response for jQuery uploader | def to_jq_upload(error=nil)
{
'_id' => self._id,
'name' => read_attribute(:upload_file_name),
'size' => read_attribute(:upload_file_size),
'url' => download_path,
'delete_url' => delete_study_file_study_path(self.study._id, self._id),
'delete_type' => "DELETE"
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_jq_upload(error=nil)\n {\n files: [\n {\n name: read_attribute(:upload_file_name),\n size: read_attribute(:upload_file_size),\n url: upload.url(:original),\n delete_url: Rails.application.routes.url_helpers.fu_path(self),\n delete_type: \"DELETE\" ... | [
"0.765636",
"0.74163646",
"0.739788",
"0.71944183",
"0.7146097",
"0.710833",
"0.71040845",
"0.70997053",
"0.7092476",
"0.7059928",
"0.7043746",
"0.6995429",
"0.6977499",
"0.69730824",
"0.6930484",
"0.6923696",
"0.69114417",
"0.68750405",
"0.6776725",
"0.67615986",
"0.6688301"... | 0.72372335 | 3 |
file type as a css class | def file_type_class
self.file_type.downcase.split.join('-') + '-file'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon_css_class\n case file_mime_type\n when *ARCHIVE_FILE_TYPES\n then \"archive\"\n when *AUDIO_FILE_TYPES\n then \"audio\"\n when *IMAGE_FILE_TYPES\n then \"image\"\n when *VIDEO_FILE_TYPES\n then \"video\"\n when \"application/x-sho... | [
"0.7614549",
"0.67976934",
"0.6675475",
"0.66548175",
"0.6612433",
"0.66028124",
"0.65543723",
"0.6442667",
"0.64230216",
"0.64178234",
"0.6254557",
"0.6234135",
"0.6227203",
"0.61953455",
"0.6165062",
"0.61419713",
"0.6124748",
"0.6092156",
"0.6083704",
"0.60708445",
"0.6041... | 0.7353891 | 1 |
generate a gsurl to this study file in the study's GCS bucket | def gs_url
"gs://#{self.study.bucket_id}/#{self.bucket_location}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gs_url(filename)\n if self.has_file?(filename)\n \"gs://#{self.study.bucket_id}/#{filename}\"\n end\n end",
"def gs_url(filename)\n\t\tif self.has_file?(filename)\n\t\t\t\"gs://#{self.study.bucket_id}/#{filename}\"\n\t\tend\n\tend",
"def gs_url filename\n \"gs://#{storage_bucket_name}/#{filena... | [
"0.8387518",
"0.8290163",
"0.80307436",
"0.7798833",
"0.69527364",
"0.66806036",
"0.66203326",
"0.6573503",
"0.6488117",
"0.64046985",
"0.6259167",
"0.6218112",
"0.62014294",
"0.6166533",
"0.60714334",
"0.6052439",
"0.6045092",
"0.60388225",
"0.6010913",
"0.6008221",
"0.59794... | 0.8616391 | 0 |
convert all domain ranges from floats to integers | def convert_all_ranges
if self.file_type == 'Cluster'
required_vals = 4
domain = {
x_axis_min: self.x_axis_min.to_i == 0 ? nil : self.x_axis_min.to_i,
x_axis_max: self.x_axis_max.to_i == 0 ? nil : self.x_axis_max.to_i,
y_axis_min: self.y_axis_min.to_i == 0 ? nil : self.y_ax... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def numericize\n\t\tcollect(&:to_f)\n\tend",
"def mapping_data(conversion_targetfloat,in_min,in_max,out_min,out_max)\n\n # Convert \"conversion_targetfloat\" from \"in_min\" to \"in_max\" range to \"out_min” to ”out_max\" range.\n return (conversion_targetfloat - in_min) * (out_max - out_min) / (in_max - in_mi... | [
"0.64797974",
"0.6355557",
"0.62373316",
"0.60975486",
"0.59648806",
"0.5937656",
"0.58894086",
"0.57794255",
"0.5708875",
"0.5686549",
"0.56849384",
"0.5674693",
"0.56714606",
"0.56503946",
"0.5567694",
"0.5566704",
"0.55648446",
"0.55251783",
"0.55166245",
"0.549079",
"0.54... | 0.5148871 | 65 |
end path for a file when localizing during a parse | def download_location
self.remote_location.blank? ? File.join(self.id, self.upload_file_name) : self.remote_location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def track_end track\n unless File.file?( extract_pth( track[:dict], \"Location\" ) )\n super track\n end\n end",
"def fullpath; end",
"def normalized_path(file); end",
"def processed_file\n last_dir_in_path = Pathname(@origional_path).each_filename.to_a.last\n file_wo_path = @origional_file... | [
"0.6376798",
"0.6016299",
"0.59044445",
"0.578929",
"0.57648736",
"0.57648736",
"0.57648736",
"0.57320124",
"0.5721042",
"0.57158613",
"0.56957966",
"0.56800765",
"0.56644934",
"0.56415075",
"0.56415075",
"0.562539",
"0.56154597",
"0.5602053",
"0.5544015",
"0.5539829",
"0.553... | 0.0 | -1 |
for constructing a path to a file in a Google bucket | def bucket_location
self.remote_location.blank? ? self.upload_file_name : self.remote_location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gs_url filename\n \"gs://#{storage_bucket_name}/#{filename}\"\nend",
"def get_bucket_path(path)\n [@aliyun_bucket, path].join('/')\n end",
"def full_path(file_or_bucket)\n path = ''\n if(file_or_bucket.respond_to?(:bucket))\n path << '/' << bucket_path(file_or_bucket.b... | [
"0.73898405",
"0.72752774",
"0.7258967",
"0.70551693",
"0.6990756",
"0.6953834",
"0.6934465",
"0.686608",
"0.68621624",
"0.67957103",
"0.67534214",
"0.66887486",
"0.6684077",
"0.664718",
"0.6581303",
"0.64871186",
"0.64487404",
"0.64444846",
"0.6432581",
"0.64284116",
"0.6370... | 0.6065077 | 50 |
retrieve the target cluster group from the options hash for a cluster labels file | def coordinate_labels_target
if self.options[:cluster_group_id].blank?
nil
else
ClusterGroup.find(self.options[:cluster_group_id])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group\n @opts[:group] || DEFAULT_GROUP\n end",
"def find_target_group\n resp = elb.describe_target_groups(names: [@name])\n # assume first target group is one we want\n # TODO: add logic to look for target group with ufo tag\n # and then fall back to the first target group\n ... | [
"0.5912441",
"0.5761635",
"0.56943035",
"0.5648282",
"0.558534",
"0.5550395",
"0.55043715",
"0.5486015",
"0.5475413",
"0.5466922",
"0.5403466",
"0.5391072",
"0.5378819",
"0.5306088",
"0.5305859",
"0.5304566",
"0.52992374",
"0.5240363",
"0.5226691",
"0.51968336",
"0.5144807",
... | 0.7088547 | 0 |
retrieve the cluster group id from the options hash for a cluster labels file | def coordinate_labels_font_family
if self.options[:font_family].blank?
'Helvetica Neue'
else
self.options[:font_family]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinate_labels_target\n if self.options[:cluster_group_id].blank?\n nil\n else\n ClusterGroup.find(self.options[:cluster_group_id])\n end\n end",
"def cluster_id\n @grpc.name.split(\"/\")[5]\n end",
"def group_id\n get_info[:groupID]\n end",
"def option_grou... | [
"0.64637643",
"0.64415985",
"0.63687044",
"0.62680787",
"0.5901476",
"0.58865",
"0.5820651",
"0.5813639",
"0.57892185",
"0.5787257",
"0.57725286",
"0.57459444",
"0.5729334",
"0.5697569",
"0.5663307",
"0.56363416",
"0.5636309",
"0.5619976",
"0.5598283",
"0.5592878",
"0.556171"... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.