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
Never trust parameters from the scary internet, only allow the white list through.
def payment_notification_params params.require(:payment_notification).permit(:params, :status, :payment_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
Add nav link items See UiBibz::Ui::Core::Navigations::NavLink
def link(content = nil, options = {}, html_options = nil, &block) if block content[:nav_type] = type content[:nav_tags] = nav_tags else options[:nav_type] = type options[:nav_tags] = nav_tags end @items << NavLink.new(content, options, html_options, &block) en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nav_items\n [\n {\n url: root_path,\n title: \"Home\"\n },\n {\n url: about_me_path,\n title: \"About Me\"\n },\n {\n url: contact_path,\n title: \"Contact\"\n },\n {\n url: tech_news_path,\n title: \"Rails News\"\n ...
[ "0.6624341", "0.66184735", "0.6509144", "0.64886117", "0.64721674", "0.6448384", "0.64159334", "0.6415736", "0.6396603", "0.6386151", "0.63787156", "0.6375118", "0.630559", "0.6302862", "0.62759805", "0.6213496", "0.6212438", "0.6210317", "0.61869305", "0.61754245", "0.617173...
0.7486588
0
Add nav in nav
def nav(content = nil, options = {}, html_options = nil, &block) @items << UiBibz::Ui::Core::Component.new(Nav.new(content, options).tap(&block).render, {}, html_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nav\n add_property('nav')\n end", "def nav(options = {}, &block)\n @nav_link = true\n nav = content_tag :ul, nav_options(options), &block\n nav.tap{ @nav_link = false }\n end", "def nav\n [\n {:label => '1. Introduction', :content => '1-introduction.html', :nav => []},...
[ "0.7696001", "0.7176324", "0.6839504", "0.6675847", "0.6661199", "0.65775853", "0.6563668", "0.6562474", "0.6531337", "0.64178985", "0.638479", "0.63839227", "0.6371324", "0.6363437", "0.6351883", "0.63310945", "0.6319051", "0.63117355", "0.63116527", "0.6271389", "0.6219382"...
0.73365295
1
Add nav dropdown items See UiBibz::Ui::Core::Navigations::NavDropdown
def dropdown(content = nil, options = {}, html_options = nil, &block) @items << NavDropdown.new(content, options, html_options).tap(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nav(content = nil, options = {}, html_options = nil, &block)\n @items << UiBibz::Ui::Core::Component.new(Nav.new(content, options).tap(&block).render, {}, html_options)\n end", "def dropdown_menu(name, path, menu_sub_items)\n caret = content_tag(:b, '', class: 'caret')\n content_tag(:li, '', cl...
[ "0.6587463", "0.6545104", "0.63012004", "0.6061605", "0.60542864", "0.6048152", "0.6020219", "0.6013601", "0.5942613", "0.5889922", "0.58750856", "0.5829155", "0.5825534", "0.58007056", "0.57865214", "0.5772391", "0.57676417", "0.5678112", "0.5635372", "0.5630004", "0.5609738...
0.7601262
0
The sequence is defined by 3 nonnegative values: begin, end, step. If begin value is greater than the end, function should returns 0 Examples sequenceSum(2,2,2) === 2 sequenceSum(2,6,2) === 12 // 2 + 4 + 6 sequenceSum(1,5,1) === 15 // 1 + 2 + 3 + 4 + 5 sequenceSum(1,5,3) === 5 // 1 + 4 This is the first kata in the ser...
def sequence_sum(begin_number, end_number, step) return 0 if end_number < begin_number x = begin_number sum = 0 while x <= end_number sum += x x += step end sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_sum(begin_number, end_number, step)\n return 0 if begin_number > end_number\n sum = 0\n until begin_number > end_number\n \tsum += step\n end\nend", "def sum_of_sequence(begin_number, end_number, step)\n begin_number.step(end_number, step).reduce(0, :+)\nend", "def sequence_sum(begin_number,...
[ "0.81420606", "0.79409516", "0.7938783", "0.689466", "0.6859409", "0.6790665", "0.67495406", "0.6723658", "0.6671831", "0.6644726", "0.66446817", "0.6604012", "0.65770936", "0.65421134", "0.6503069", "0.6482389", "0.6461727", "0.63369447", "0.6327622", "0.63086236", "0.628400...
0.8161649
0
class methods ............................................................. public instance methods ...................................................
def formated_api { url: self.attachment.url, md5: self.md5, } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def methods() end", "def implementation; end", "def implementation; end", "def public; end", "def public; end", "def instance; end", "def instance; end", "def instance; end", "def internal;...
[ "0.77851504", "0.7466502", "0.7466502", "0.7466502", "0.7466502", "0.7404214", "0.7365993", "0.7365993", "0.7145498", "0.7145498", "0.7136925", "0.7136925", "0.7136925", "0.70465684", "0.7001774", "0.6890904", "0.6833187", "0.6833187", "0.6833187", "0.6833187", "0.6833187", ...
0.0
-1
Retrieve the wave file from Twilio
def save_audio(url, sid) # Name the file with the RecordingSid from Twilio wavfile = "/tmp/#{sid}.wav" File.open(wavfile, "wb") do |file| file.write open(url).read end return wavfile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wav\n @wav ||= @info_file.sub(/txt$/, 'wav')\n end", "def waveform\n authorize! :read, @master_file\n\n ds = params[:empty] ? WaveformService.new(8, samples_per_frame).empty_waveform(@master_file) : @master_file.waveform\n\n if ds.nil? || ds.empty?\n render plain: 'Not Found', status: :...
[ "0.69298327", "0.65729344", "0.65000325", "0.6352579", "0.62052", "0.61821055", "0.61611384", "0.6070775", "0.59938824", "0.59861267", "0.59611785", "0.5926265", "0.5906266", "0.5882757", "0.58542526", "0.58458406", "0.5838586", "0.5789846", "0.57808954", "0.57796764", "0.574...
0.6343755
4
Upload the wave file to the Google Speech API
def transcribe_speech(wavfile) apiurl = "https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=#{GOOGLEKEY}" command = "curl -X POST --data-binary @'#{wavfile}' --header 'Content-Type: audio/l16; rate=8000;' '#{apiurl}'" response = `#{command}` if response transcript = parse_google_speech(res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(file_path, options = {})\n\n # If not logged in, raise this exception\n raise 'Login first!' unless @customer_login_id\n\n # Extract options from the options hash\n multiple_speakers = options[:multiple_speakers] || true\n description = options[:description]\n ...
[ "0.65633404", "0.654943", "0.65177774", "0.6303917", "0.62623864", "0.6131443", "0.6100367", "0.60944897", "0.6091719", "0.6090235", "0.6089062", "0.60842186", "0.60392463", "0.60281503", "0.5923811", "0.5916112", "0.5915519", "0.5902745", "0.5848396", "0.5832632", "0.5793931...
0.65257466
2
Get the transcribed text from the Google Speech response
def parse_google_speech(response) # The google speech api doesn't return valid JSON, we have to clean it up json = response.split('{"result":[]}')[1] if valid_json(json) result = JSON.parse(json) transcript = result['result'][0]['alternative'][0]['transcript'] return transcript end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transcribe_speech(wavfile)\n\tapiurl = \"https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=#{GOOGLEKEY}\"\n\tcommand = \"curl -X POST --data-binary @'#{wavfile}' --header 'Content-Type: audio/l16; rate=8000;' '#{apiurl}'\"\n\tresponse = `#{command}`\n\tif response \n\t\ttranscript = par...
[ "0.6739301", "0.6576749", "0.6568496", "0.6414542", "0.6395204", "0.63432026", "0.6220854", "0.61446214", "0.6075139", "0.60631603", "0.60255194", "0.602219", "0.5981518", "0.59521276", "0.5877414", "0.5867231", "0.5766473", "0.5751853", "0.57338", "0.5690859", "0.5688077", ...
0.74979067
0
Connect to WolframAlpha and submit a query, return the answer
def ask_wolf(query) options = { "format" => "plaintext" } client = WolframAlpha::Client.new WOLFKEY, options response = client.query query input = response["Input"] result = response.find { |pod| pod.title == "Result" } if result return "#{result.subpods[0].plaintext}" else return "Sorry, unable to process ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_query(query)\n root_url = 'https://research.tsadra.org/api.php?'\n research_query = root_url + query\n client = MediawikiApi::Client.new(research_query)\n\n client.log_in(ENV['RESEARCH_WIKI_USERNAME'], ENV['RESEARCH_WIKI_PASSWORD'])\n response = client.query\n response.data\...
[ "0.6636241", "0.6349877", "0.61280066", "0.6039483", "0.6010888", "0.5870072", "0.580877", "0.57911086", "0.57907027", "0.57907027", "0.5747086", "0.5719041", "0.5710335", "0.5689746", "0.5676537", "0.5653945", "0.5632559", "0.5593367", "0.55809444", "0.55533046", "0.55483735...
0.6906067
0
Delete recording message from Twilio
def delete_message(sid) @client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN @client.recordings.get(sid).delete() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_message(id)\n record \"/msg/delete/#{id}\"\n end", "def delete_recording(record_id)\n bbb_server.delete_recordings(record_id)\n end", "def destroy\n get_message().delete\n end", "def destroy\n\n begin \n @client = Twilio::REST::Client.new BwCallTracking::Application.config.ac...
[ "0.72780347", "0.7199949", "0.6975486", "0.68913865", "0.6889393", "0.6889393", "0.6789008", "0.6786938", "0.67840385", "0.6776102", "0.67509925", "0.67400223", "0.67161083", "0.6707141", "0.6686035", "0.66647106", "0.6626817", "0.6606662", "0.6535171", "0.6526629", "0.652293...
0.8154785
0
Catches json parsing errors
def valid_json(string) JSON.parse(string) return true rescue JSON::ParserError return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_or_error(json, page)\n begin\n result = JSON.parse page.body\n rescue Exception=>e\n raise \"Got parse error #{e} in #{page.to_s}, json submitted was #{json}\"\n end\n if result.key? \"error\" then\n raise \"Got error in #{page.to_s}, #{result.error},...
[ "0.78042686", "0.75160396", "0.75160396", "0.74804956", "0.73354685", "0.71535707", "0.7128748", "0.7117694", "0.7114573", "0.7001171", "0.6948248", "0.6947636", "0.692979", "0.6889604", "0.68313074", "0.68119675", "0.6789682", "0.6769225", "0.6684677", "0.6640073", "0.661062...
0.67873025
17
See README.md for instructions on how to do this
def fizzbuzz(input) if input%3 ==0 && input%5 == 0 return "FizzBuzz" elsif input%3 == 0 return "Fizz" elsif input%5 == 0 return "Buzz" else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def main; end", "def main\n end", "def run; end", "def run; end", "def run; end", "de...
[ "0.67682546", "0.6703943", "0.6703943", "0.6703943", "0.6703943", "0.6703943", "0.6703943", "0.6703943", "0.6698967", "0.6693681", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.6667223", "0.66576946", "0.66576946", ...
0.0
-1
take the input through a round trip
def assert_valid_input(input) # round trip packed = Protocol.pack(input) unpacked = Protocol.unpack(packed) # dirty way to check if objects identical. j = Marshal::dump input k = Marshal::dump unpacked assert j == k end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input; @input; end", "def input; @input; end", "def input; end", "def input; end", "def input; end", "def source=(input); end", "def input=(_arg0); end", "def preprocess_input(input)\n input\nend", "def call(input)\r\n process(*input)\r\n end", "def call(form)\n# p [:inp, form] ...
[ "0.62319684", "0.62319684", "0.6017258", "0.6017258", "0.6017258", "0.59650195", "0.59132826", "0.56036097", "0.55957156", "0.5568419", "0.54987246", "0.54694855", "0.54626846", "0.54619604", "0.53910136", "0.5292862", "0.529277", "0.529277", "0.52847755", "0.5273832", "0.523...
0.0
-1
Function to count fish in river
def river_count return @fishes.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fish_count()\n return @fish.length()\n end", "def sheep_count(num)\n \nend", "def count\n @forest.count(&:negative?)\n end", "def food_count()\nreturn @stomach.count()\nend", "def countSheeps array\n count = 0\n array.each { |sheep| count += 1 if sheep == true }\n count\nend", "de...
[ "0.7664002", "0.702714", "0.69913274", "0.66564316", "0.66214335", "0.64917904", "0.6479066", "0.6459972", "0.6443756", "0.64345753", "0.64292246", "0.6375801", "0.63629407", "0.63240004", "0.63174593", "0.6298174", "0.62606925", "0.62558633", "0.6215936", "0.620488", "0.6201...
0.7583681
1
helper method to split a string with caps with spaces i.e. "FoodCarts" > "Food Carts"
def split_on_caps(word) word.split(/(?=[A-Z])/).join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camel_caps(str, splitChr=\" \")\n words = str.downcase.split(splitChr).each_with_index.map { |v| v.capitalize }\n return [words.join('-'), words.join(' ')]\n end", "def cap_the_words(string)\r\n string.split(\" \").map{|e| e.capitalize }.join(\" \")\r\nend", "def word_cap(string)\n str...
[ "0.7156496", "0.70262504", "0.69613546", "0.6947377", "0.69223976", "0.69084334", "0.69056034", "0.6887552", "0.68872845", "0.6882519", "0.68822104", "0.687517", "0.6861694", "0.6861694", "0.6858127", "0.685549", "0.6839475", "0.68380404", "0.68323344", "0.6831453", "0.681595...
0.81161594
0
Public: Initializes a new Category. name the String name of the category courses the Array of courses of the category
def initialize(name, courses) @name = name @courses = courses || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_group_category_courses(course_id,name,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :name,\n :self_signup,\n :auto_leader,\n :group_limit,\n :create_group_count,\n :split_group_count,\n \n ]\n\n # verify ...
[ "0.7157657", "0.68717897", "0.6435461", "0.63314164", "0.62277216", "0.61936694", "0.61637616", "0.60843635", "0.6066693", "0.6050976", "0.5975052", "0.59646", "0.5947652", "0.59357095", "0.5898619", "0.58953345", "0.58779955", "0.5824541", "0.5787948", "0.5787455", "0.577227...
0.7723106
0
If we've got segments that style us across different ranges, it might be in either, or both, of the segments. This method figures out which segments apply, and what the relative ranges within each segment to use.
def segment_ranges(text_range) return [] unless text_range.any? first_text = @segments.first.text slice = first_text[text_range] if slice.nil? || slice.empty? results_in_last_segment(text_range, first_text) elsif slice.length < text_range.count ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segments(progress = nil)\n @options[:split_across] ? segments_across(progress) :\n segments_within(progress)\n end", "def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n ...
[ "0.5870862", "0.5843216", "0.58333844", "0.5753166", "0.56462145", "0.5552986", "0.54956675", "0.540908", "0.53779763", "0.5375703", "0.5369034", "0.5359375", "0.53427047", "0.5339222", "0.53351784", "0.53323346", "0.5332294", "0.5295722", "0.5293328", "0.52872443", "0.528064...
0.6337771
0
Returns the relative position within the appropriate segment for index in the overall DSL text
def relative_text_position(index) if at_end?(index) relative_end_position elsif relative_in_first_segment?(index) relative_in_first_segment(index) else relative_in_last_segment(index) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position(index)\n return [-1, -1] unless index < string.length\n\n row_start = @line_starts.select { |line_start| line_start <= index }.last\n row = @line_starts.index(row_start)\n column = index - row_start\n [row, column]\n end", "def to_offset(text, position); end", "def text...
[ "0.66486275", "0.6589282", "0.6348012", "0.62666184", "0.61083406", "0.60814464", "0.60577065", "0.6004425", "0.5988692", "0.5963936", "0.5961125", "0.59285927", "0.5917301", "0.58843416", "0.5881084", "0.5856167", "0.5856167", "0.5856167", "0.5856167", "0.58510685", "0.58086...
0.79371536
0
This could be smarter, basing height on the actual line the cursor's in. For now, just use the first line's (purported) height.
def cursor_height if @segments.first.text.empty? # Heights are off for empty text layouts. Fake it to make it (it # being a real height). new_segment = TextSegment.new(@dsl, "Hi", 100) height_from_segment(new_segment) else height_from_segme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_get_line_height(x); (@row_height || -1); end", "def line_height\n return @common.lineHeight\n end", "def cursor_height\n return Font.default_size\n end", "def line_height(height=nil)\n cur_page.line_height(height)\n end", "def height\n return nil unless @height\n if @height...
[ "0.8026151", "0.76225364", "0.746348", "0.74320817", "0.73547643", "0.7331467", "0.7276762", "0.72711116", "0.71595883", "0.7096088", "0.7096088", "0.70721084", "0.70721084", "0.7055111", "0.70435935", "0.70426345", "0.6985772", "0.69084233", "0.6897957", "0.68363136", "0.675...
0.7666297
1
Contacts the Beams service to remove all the devices of the given user.
def delete_user client.delete(user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(user)\n @@contact_list.delete(user)\n end", "def delete_all_appointment(user)\n Appointment.where(user_id: user.id).destroy_all\n end", "def delete_users\n delete(users_path)\n end", "def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurre...
[ "0.75483745", "0.6494067", "0.6461115", "0.6395876", "0.62618035", "0.62043124", "0.6185831", "0.6163277", "0.6154651", "0.6134237", "0.613347", "0.612344", "0.611702", "0.6102736", "0.606502", "0.60624295", "0.60585344", "0.59976524", "0.5993692", "0.59835196", "0.5955486", ...
0.65916985
1
Asserts that the method will not be called on the +object+ in the block
def refute_called(object, method_name, message = nil, &block) assert_called(object, method_name, message, times: 0, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assert_no_difference(object, method, &block)\n assert_difference object, method, 0, &block\n end", "def assert_not_respond_to( obj, meth )\n\t\t\tmsg = \"%s expected NOT to respond to '%s'\" %\n\t\t\t\t[ obj.inspect, meth ]\n\t\t\tassert_block( msg ) {\n\t\t\t\t!obj.respond_to?( meth )\n\t\t\t}\n\t\tend"...
[ "0.7294542", "0.71359766", "0.7045201", "0.69902855", "0.6629294", "0.65910316", "0.6583956", "0.65197104", "0.6517358", "0.6485928", "0.6469474", "0.6434245", "0.64309806", "0.6398425", "0.63845915", "0.6379538", "0.63630086", "0.6362763", "0.6358553", "0.6352392", "0.633913...
0.7154889
1
Asserts that the method will be called with the +arguments+ on the +object+ in the block
def assert_called_with(object, method_name, arguments, returns: nil) mock = Minitest::Mock.new if arguments.all? { |argument| argument.is_a?(Array) } arguments.each { |argument| mock.expect(:call, returns, argument) } else mock.expect(:call, returns, arguments) end object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blocks_can_take_arguments\n method_with_block_arguments do |argument|\n assert_equal 'Jim', argument\n end\n end", "def method_missing(method, *args, &block)\n __check_expectation__(method, args)\n block.call if block\n end", "def refute_called(object, method_name, messa...
[ "0.7260483", "0.6900785", "0.66686606", "0.6405811", "0.6310498", "0.6120302", "0.6065156", "0.6043759", "0.60226905", "0.6011599", "0.60110104", "0.6007947", "0.5997734", "0.5971881", "0.59689206", "0.59689206", "0.5965585", "0.5937616", "0.591607", "0.59116554", "0.5897283"...
0.72745866
0
Asserts that the method will be called on an instance of the +klass+ in the block assert_called_on_instance_of(Post, :title) do
def assert_called_on_instance_of(klass, method_name, message = nil, times: 1, returns: nil) times_called = 0 klass.define_method("stubbed_#{method_name}") do |*| times_called += 1 returns end klass.alias_method("original_#{method_name}", method_name) klass.alias_method(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refute_called_on_instance_of(klass, method_name, message = nil, &block)\n assert_called_on_instance_of(klass, method_name, message, times: 0, &block)\n end", "def assert_instance_of(cls, obj, msg=nil)\n InstanceAssay.assert!(obj, cls, :message=>msg, :backtrace=>caller)\n end", "def assert_i...
[ "0.7005223", "0.6078599", "0.60601294", "0.5779257", "0.57301664", "0.55903065", "0.5493179", "0.54665816", "0.5335424", "0.5332196", "0.5332196", "0.53284216", "0.5324599", "0.5277575", "0.52712244", "0.52670324", "0.5243012", "0.5234383", "0.522944", "0.5229104", "0.5229104...
0.6299824
1
Asserts that the method will not be called on an instance of the +klass+ in the block refute_called_on_instance_of(Post, :title) do
def refute_called_on_instance_of(klass, method_name, message = nil, &block) assert_called_on_instance_of(klass, method_name, message, times: 0, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wont_be_instance_of(cls, msg=nil)\n InstanceAssay.refute!(self, cls, :message=>msg, :backtrace=>caller)\n end", "def refute_instance_of(cls, obj, msg=nil)\n InstanceFailure.refute(obj, cls, :message=>msg, :backtrace=>caller)\n end", "def assert_does_not_send(receiver, method, *args)\n ...
[ "0.66511106", "0.6308737", "0.6039106", "0.5999823", "0.59715915", "0.59653133", "0.5895164", "0.587456", "0.58586216", "0.58502084", "0.58146465", "0.58135134", "0.57933384", "0.5788678", "0.564365", "0.56414884", "0.5627045", "0.5559912", "0.5533262", "0.55287755", "0.55017...
0.7441982
0
Add to 'X results found' message Returns ' in [a country name here]' or ''
def searched_in(filter, with_html: false) selected = selected_filter_option_names(filter) message = '' separator_in = ' in ' list = [] if selected.length.positive? separator_or = ' or ' # If HTML is required, wrap things in tags. if with_html separator_in = content_tag('sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def names_of_people_who_failed_english(results_set)\nend", "def names_of_people_who_took_french(results_set)\nend", "def results_output(city,results,count)\n #Output the name of the current city.\n puts \"#{city}:\"\n #If there are a positive number of listings format the results.\n if count>0\n ...
[ "0.6303307", "0.618445", "0.6153538", "0.61385065", "0.6132019", "0.6034135", "0.5776957", "0.57247216", "0.57170063", "0.5659277", "0.5612975", "0.55638385", "0.5544268", "0.55422175", "0.54520464", "0.54151285", "0.5392147", "0.5382174", "0.53532845", "0.53427666", "0.53423...
0.0
-1
Returns list of names for selected filter options.
def selected_filter_option_names(filter) region_names = filter.regions(:name).sort country_names = filter.reduced_countries(:name).sort region_names.concat(country_names) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_options\n all.map {|e| [e.name, e.to_s] }\n end", "def select_options\n all.map {|e| [e.name, e.to_s] }\n end", "def list_filter_options(**opt)\n # TODO: ???\n end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filt...
[ "0.74465245", "0.74465245", "0.68725526", "0.6791138", "0.67598504", "0.6624315", "0.65420794", "0.6410288", "0.62872136", "0.62298614", "0.61374295", "0.613412", "0.6124813", "0.6124813", "0.60925007", "0.6086428", "0.60659045", "0.605564", "0.6048437", "0.6002183", "0.59973...
0.7917641
0
Given the array of stock prices, identify the buy and sell date The sell date should come after the buy date
def stock_picker(stocks) profit = 0 for i in 0...stocks.length # ensures when looping through the prices, sell date comes after buy date for j in (i + 1)...stocks.length if (stocks[j] - stocks[i]) > profit profit = stocks[j] - stocks[i] buy_date = i sell_date = j end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_picker(arr)\n buy = \"\"\n sell = \"\"\n biggest_difference = 0\n profit = 0\n arr.each_with_index do |day, index|\n #no days after last day so last day can't be the buy day\n if (day != arr[-1])\n #sell date must be after purchase date, therefore only want indicies after current\n ...
[ "0.83561015", "0.8188632", "0.77792907", "0.77631384", "0.7741109", "0.7701709", "0.75953424", "0.75602543", "0.7458372", "0.7398455", "0.7396619", "0.73492193", "0.7341884", "0.7325963", "0.73195493", "0.7303484", "0.7263093", "0.72483176", "0.7243251", "0.72423035", "0.7240...
0.7563096
7
GET /bar82s or /bar82s.json
def index @bar82s = Bar82.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bar81s = Bar81.all\n end", "def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n hea...
[ "0.6146963", "0.592101", "0.5914507", "0.59037584", "0.5792928", "0.5656644", "0.56399024", "0.5590926", "0.5575057", "0.55455536", "0.5524926", "0.5518452", "0.5516562", "0.5479901", "0.5437426", "0.5436914", "0.5424369", "0.5419692", "0.5416664", "0.54164", "0.5415199", "...
0.6749949
0
GET /bar82s/1 or /bar82s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bar82s = Bar82.all\n end", "def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end", "def index\n @bar81s = Bar81.all\n end", "def set_bar82\n @bar82 = Bar82.fin...
[ "0.66027665", "0.6374294", "0.62974954", "0.60728306", "0.59291834", "0.58906126", "0.58099025", "0.5791913", "0.57674146", "0.57553905", "0.57461804", "0.5723884", "0.572078", "0.57185477", "0.5700496", "0.5643349", "0.5620223", "0.5606667", "0.55836177", "0.5566354", "0.555...
0.0
-1
POST /bar82s or /bar82s.json
def create @bar82 = Bar82.new(bar82_params) respond_to do |format| if @bar82.save format.html { redirect_to @bar82, notice: "Bar82 was successfully created." } format.json { render :show, status: :created, location: @bar82 } else format.html { render :new, status: :unprocess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @bar81 = Bar81.new(bar81_params)\n\n respond_to do |format|\n if @bar81.save\n format.html { redirect_to @bar81, notice: \"Bar81 was successfully created.\" }\n format.json { render :show, status: :created, location: @bar81 }\n else\n format.html { render :new, sta...
[ "0.6307641", "0.6241999", "0.61582136", "0.6103623", "0.60401356", "0.5964118", "0.58469856", "0.5835336", "0.58006257", "0.57919943", "0.5761919", "0.57415605", "0.5644622", "0.56383204", "0.56297034", "0.5623457", "0.56006086", "0.5584762", "0.5584173", "0.55833817", "0.556...
0.7018014
0
PATCH/PUT /bar82s/1 or /bar82s/1.json
def update respond_to do |format| if @bar82.update(bar82_params) format.html { redirect_to @bar82, notice: "Bar82 was successfully updated." } format.json { render :show, status: :ok, location: @bar82 } else format.html { render :edit, status: :unprocessable_entity } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @bar81.update(bar81_params)\n format.html { redirect_to @bar81, notice: \"Bar81 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar81 }\n else\n format.html { render :edit, status: :unprocessable_entity }...
[ "0.6967599", "0.68536407", "0.682892", "0.6740691", "0.6719202", "0.6674266", "0.6605528", "0.65626293", "0.65502095", "0.65256834", "0.65247875", "0.65194714", "0.6482611", "0.6472828", "0.6454025", "0.64528424", "0.6431007", "0.64278936", "0.64251775", "0.64226025", "0.6390...
0.7021299
0
DELETE /bar82s/1 or /bar82s/1.json
def destroy @bar82.destroy respond_to do |format| format.html { redirect_to bar82s_url, notice: "Bar82 was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @bar81.destroy\n respond_to do |format|\n format.html { redirect_to bar81s_url, notice: \"Bar81 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @bar84.destroy\n respond_to do |format|\n format.html { redirect_to bar84s_u...
[ "0.68077564", "0.6685192", "0.66562295", "0.66412467", "0.6636573", "0.66306084", "0.66253275", "0.6623082", "0.6608763", "0.6590119", "0.65893143", "0.65810025", "0.65804964", "0.6575559", "0.6567408", "0.6564513", "0.6553399", "0.65452445", "0.65237373", "0.6510447", "0.649...
0.6892144
0
Use callbacks to share common setup or constraints between actions.
def set_bar82 @bar82 = Bar82.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def bar82_params params.require(:bar82).permit(:foo1, :foo2, :foo3, :foo4, :foo5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
def isbn_13_dashes_n_spaces(num) num.gsub!(/[ ]/, '') wrong = 0 if num.gsub(/[\D]/, '') != num wrong += 1 end if num.length < 13 wrong += 1 end unless wrong == 0 return false end num end
def isbn13_arr(num) if num == false return false end stopgap = num.split('') stopgap end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_chars(isbn)\r\n\tvalid = true\r\n\tisbn_length = strip_length(isbn)\r\n\t#Set match to false, because a match means invalid ISBN.\r\n\tif isbn_length == 10\r\n\t\t$store_length = 10\r\n\r\n\t\tif isbn[0...-1].match(/[^- 0-9]/)\r\n\t\t\tvalid = false\r\n\t\tend\r\n\r\n\telse isbn_length == 13\r\n\t\t$stor...
[ "0.7341718", "0.733496", "0.7321606", "0.73062104", "0.72153413", "0.7142483", "0.71409905", "0.7101488", "0.69803715", "0.6966953", "0.6833066", "0.66760725", "0.6668895", "0.6628402", "0.6628238", "0.6614583", "0.6596067", "0.65720415", "0.6561669", "0.65592957", "0.6504602...
0.6436338
24
writes the rack_response to socket as an HTTP response
def http_response_write(socket, status, headers, body, response_start_sent=false) status = CODES[status.to_i] || status hijack = nil http_response_start = response_start_sent ? '' : 'HTTP/1.1 ' if headers buf = "#{http_response_start}#{status}\r\n" \ "Date: #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_response\n\t\t\tsend_headers\n\t\t\tsend_body\n\t\t\tsend_trailer\n\t\t\tclose_connection_after_writing unless (@keep_connection_open and (@status || 200) < 500)\n\t\tend", "def send_response(response)\n # Set the connection to close or keep-alive depending on what the client\n # can support.\n ...
[ "0.7228429", "0.7102285", "0.6924021", "0.66481465", "0.6542491", "0.64858997", "0.64451", "0.64212203", "0.6392493", "0.6240523", "0.623002", "0.62286055", "0.6165545", "0.6098221", "0.608026", "0.6055709", "0.6050424", "0.6012064", "0.59551805", "0.5947803", "0.5913569", ...
0.73238826
0
default_value is available only when the variable is an assoc array.
def default_value(val=nil, &b) if b @def_default = :proc @default_val = proc(&b) else @def_default = :val @default_val = val end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default(value)\r\n\t\tif value.kind_of? Array\r\n\t\t\tself.default_value = value.first\r\n\t\telse\r\n\t\t\tself.default_value = value\r\n\t\tend\r\n\tend", "def default_value\n if @default_value\n @default_value\n elsif @multiple\n []\n end\n end", "def default_value ...
[ "0.7046374", "0.69799155", "0.6870436", "0.68023145", "0.6739912", "0.66843754", "0.6661879", "0.6612366", "0.6572423", "0.65257835", "0.64963686", "0.64378434", "0.6413582", "0.64026684", "0.63593954", "0.6348542", "0.6302792", "0.6299458", "0.62937385", "0.62892336", "0.628...
0.0
-1
use Ruby script version of set tkvariable (traditional methods)
def _value begin INTERP._eval(Kernel.format('global %s; set %s', @id, @id)) #INTERP._eval(Kernel.format('set %s', @id)) #INTERP._invoke_without_enc('set', @id) rescue if INTERP._eval(Kernel.format('global %s; array exists %s', @id, @id)) != "1" #if INTER...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_variable( name, value)\n\t\tq_value = \n\t\t\tcase value\n\t\t\twhen String\n\t\t\t\t\"\\\"#{value}\\\"\"\t\n\t\t\telse\n\t\t\t\tvalue\n\t\t\tend\n\t\tVim::command(\"let #{name} = #{q_value}\")\n\tend", "def set_variable(name, value)\n if @handle.ptr == nil\n raise \"this is dis...
[ "0.6958899", "0.6860596", "0.6709402", "0.6624295", "0.65017664", "0.6500213", "0.64626914", "0.63881963", "0.6285091", "0.62023175", "0.6181136", "0.6154313", "0.61043483", "0.60546374", "0.6017781", "0.5981439", "0.5981439", "0.594538", "0.59307283", "0.58997124", "0.588838...
0.0
-1
Define a method that returns the sum of all the elements in its argument (an array of numbers).
def array_sum(arr) arr.reduce(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_array(numbers)\n return numbers.sum()\nend", "def sum_array(array)\n array.sum\nend", "def sum(array)\n array.sum\nend", "def sum_array(array)\n array.sum\nend", "def sum(array_of_integers)\n # TODO\nend", "def sum_array(integers)\n integers.sum\nend", "def sum arr\n #this is slightl...
[ "0.8794013", "0.8708291", "0.87011474", "0.86846805", "0.86200446", "0.8532608", "0.8443816", "0.8443089", "0.8412834", "0.83718044", "0.8364746", "0.83211315", "0.8318501", "0.8311517", "0.8290177", "0.8281845", "0.82000655", "0.8187457", "0.8163953", "0.8126575", "0.8103355...
0.8344654
11
Define a method that returns a boolean indicating whether substring is a substring of all the long_strings (an array).
def in_all_strings?(long_strings, substring) long_strings.all? {|word| word.include?(substring)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_all_strings?(long_strings, substring)\n long_strings.all? { |long_string| sub_string?(long_string, substring) }\nend", "def in_all_strings?(long_strings, substring)\n long_strings.each do |string|\n return false unless string.include?(substring)\n end\n\n return true\nend", "def in_all_strings?(l...
[ "0.86071897", "0.8519254", "0.8510517", "0.85094804", "0.8503872", "0.8488817", "0.8487766", "0.84790075", "0.84578764", "0.84302753", "0.8425006", "0.82678366", "0.8244377", "0.81091505", "0.8106513", "0.79848105", "0.78386045", "0.77992976", "0.7143393", "0.71118593", "0.70...
0.84145665
11
Define a method that accepts a string of lower case words (no punctuation) and returns an array of letters that occur more than once.
def non_unique_letters(string) letters = string.chars.uniq letters.select {|letter| string.count(letter) > 1 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_letters str\n arr = str.split('')\n count = 0\n arr2 = []\n for i in arr\n if (arr.count(i) <= 1)\n arr2.push(i)\n end\n end\n arr2\nend", "def check_duplicate_letter(words)\n # The reject method return a new Array without the items defined by its input block.\n return words.r...
[ "0.7207491", "0.71665466", "0.7092844", "0.709104", "0.70097816", "0.6989676", "0.697137", "0.69607043", "0.692762", "0.6922691", "0.6903257", "0.68760794", "0.68461144", "0.6836656", "0.68230194", "0.681781", "0.68014985", "0.67983896", "0.6798007", "0.6791212", "0.67876726"...
0.68124247
16
Define a method that returns an array of the longest two words (in order) in the method's argument. Ignore punctuation!
def longest_two_words(string) string = string.delete(".,") words = string.split(" ") words.sort_by {|word| word.length}[-2..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_two_words(string)\n new_arr = string.split.sort_by {|word| word.length}\n return [new_arr[-1], new_arr[-2]]\nend", "def longest_two_words(string)\n arr = string.split.sort_by(&:length)\n [arr[-1], arr[-2]]\nend", "def longest_two_words(string)\n string.delete!(',.?:;\"!\"')\n word_arr = strin...
[ "0.8057187", "0.80398995", "0.7907086", "0.7888499", "0.7723449", "0.7716741", "0.7716741", "0.7697709", "0.7697169", "0.7681422", "0.76502293", "0.764035", "0.7437496", "0.7421829", "0.7403947", "0.7395618", "0.73702997", "0.73260784", "0.73056", "0.72814894", "0.7279849", ...
0.76658255
10
MEDIUM Define a method that returns an array of letters that do not occur in the method's argument.
def missing_letters(string) string = string.downcase ("a".."z").to_a.reject {|letter| string.include?(letter) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def missing_letters\n missing = Array.new\n ('a'..'z').each {|l| missing << l if @hist[l] == 0}\n missing\n end", "def missing_letters(string)\n\n result = []\n\n (\"a\"..\"z\").each do |ch|\n result << ch if string.downcase.include?(ch) == false\n\n end\n result\nend", "def non_unique_letters...
[ "0.6884043", "0.6776585", "0.65365475", "0.65228575", "0.64940184", "0.6458438", "0.6421395", "0.6415708", "0.6397645", "0.6391474", "0.6385611", "0.6346461", "0.6321072", "0.6296356", "0.6294133", "0.625361", "0.61875015", "0.6156634", "0.6149217", "0.61074233", "0.6099803",...
0.6448072
6
Define a method that accepts two years and returns an array of the years within that range (inclusive) that have no repeated digits. Hint: helper method?
def no_repeat_years(first_yr, last_yr) years = (first_yr..last_yr).to_a years.select {|year| not_repeat_year?(year)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_repeat_years(first_yr, last_yr)\n array = []\n (first_yr..last_yr).each do |year|\n array << year if not_repeat_year?(year)\n end\n array\nend", "def no_repeat_years(first_yr, last_yr)\n result = []\n (first_yr..last_yr).each do |num|\n if not_repeat_year?(num)\n result << num\n end\n ...
[ "0.8127202", "0.7929555", "0.7897983", "0.7888205", "0.7873483", "0.78085506", "0.77044356", "0.76659846", "0.7554254", "0.7553482", "0.7518304", "0.7501522", "0.7496639", "0.7451645", "0.7450835", "0.7395562", "0.73941165", "0.7384834", "0.73534065", "0.73532516", "0.7328539...
0.7733247
6
HARD Define a method that, given an array of songs at the top of the charts, returns the songs that only stayed on the chart for a week at a time. Each element corresponds to a song at the top of the charts for one particular week. Songs CAN reappear on the chart, but if they don't appear in consecutive weeks, they're ...
def one_week_wonders(songs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend", "def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend", "def one_week_wonders(songs)\n new_arr = songs.select {|song| no_repeats?(song, songs)}\n return new_arr.uniq\nend", "def ...
[ "0.8243528", "0.8243528", "0.8224437", "0.82170314", "0.8215965", "0.81839937", "0.8114331", "0.8114331", "0.80407166", "0.7882509", "0.78657466", "0.7674267", "0.75233424", "0.6094286", "0.5750226", "0.5594478", "0.5577955", "0.5554141", "0.55528796", "0.5536474", "0.5505156...
0.55766183
17
Define a method that, given an array of numbers, returns a nested array of twoelement arrays that each contain the start and end indices of whenever a number appears multiple times in a row. repeated_number_ranges([1, 1, 2]) => [[0, 1]] repeated_number_ranges([1, 2, 3, 3, 4, 4, 4]) => [[2, 3], [4, 6]]
def repeated_number_ranges(arr) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeated_number_ranges(arr)\n ranges = []\n start_idx = nil\n (0...arr.length).each do |idx|\n if arr[idx] == arr[idx + 1]\n start_idx = idx unless start_idx\n elsif start_idx\n ranges << [start_idx, idx]\n start_idx = nil\n end\n end\n ranges\nend", "def repeated_number_ranges(a...
[ "0.7930446", "0.79050684", "0.7853276", "0.78281957", "0.77776337", "0.77694046", "0.7758385", "0.77156407", "0.7593864", "0.7542331", "0.741867", "0.7306693", "0.7196418", "0.63080716", "0.6252893", "0.5891359", "0.58614177", "0.5798617", "0.57902294", "0.5786588", "0.578261...
0.7888471
2
Example: placeholder_image("No Image", width: 100, height: 100) =>
def placeholder_image(text, args={}) image = Dragonfly::App[:images].generate(:text, text, { color: "#fff", background_color: "#ccc", padding: '200' }) image.process(:crop, { width: 100, height: 100, gravity: "c" }.merge(args)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeholder_image_tag(text, args={})\n image_tag('koi/application/placeholder-image-none.png', args)\n# image_tag(placeholder_image(text, args).url, args)\n end", "def placeholder_image_tag(text, args={})\n image_tag('koi/application/placeholder-image-none.png', args)\n# image_tag(placeholder_im...
[ "0.7878012", "0.7878012", "0.7270974", "0.7270974", "0.71125513", "0.7080594", "0.7022227", "0.67357725", "0.6691958", "0.6678529", "0.66382843", "0.6592771", "0.6574657", "0.6574657", "0.6561504", "0.6456352", "0.64238334", "0.63705564", "0.63705564", "0.62286454", "0.621050...
0.7563387
3
Example: placeholder_image_tag("No Image", width: 100, height: 100) => ""
def placeholder_image_tag(text, args={}) image_tag('koi/application/placeholder-image-none.png', args) # image_tag(placeholder_image(text, args).url, args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not-found.png\"\n end", "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/static/images/not...
[ "0.70261794", "0.70261794", "0.68248487", "0.6759523", "0.6515076", "0.6515076", "0.6446148", "0.6385905", "0.6378657", "0.63597995", "0.62657785", "0.62657785", "0.62195015", "0.6158347", "0.61463237", "0.613433", "0.6069443", "0.6062321", "0.60460943", "0.6042063", "0.60218...
0.8190285
1
SVG Image Helper Converts a dragonflystored SVG image to inline SVG with a missing asset fallback.
def svg_image(image) raw image.data rescue Dragonfly::Job::Fetch::NotFound "Image missing" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inline_svg(path)\n file = File.open(\"public/images/#{path}\", \"rb\")\n file.read\n end", "def image file, opts = {}\n # FIXME handle case when SVG is a File or IO object\n if ::String === file && (file.downcase.end_with? '.svg')\n opts[:fallback_font_name] ||= default_svg_font if respond_...
[ "0.697558", "0.6938139", "0.68882436", "0.6707804", "0.6665351", "0.6662954", "0.6646917", "0.661754", "0.6557737", "0.62823963", "0.6263408", "0.62394166", "0.61293775", "0.6115131", "0.6115131", "0.6015937", "0.5942396", "0.588816", "0.58300024", "0.57817495", "0.5743747", ...
0.75471467
1
Navigation helper to mark list item as active
def navigation_helper(label, link_path, link_opts={}) li_opts = {} li_opts = request.path.eql?(link_path) ? { class: "selected" } : {} content_tag(:li, link_to(label, link_path, link_opts), li_opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_nav\n @active = \"user\"\n end", "def navigation_item(content = false, &block)\n cls = 'navigation-item'\n cls << ' active' if content\n\n tag('li', content, class: cls, &block)\n end", "def navbar_active\n # reset in controller for active navbar menu item\...
[ "0.7416105", "0.726066", "0.7212151", "0.6968563", "0.6961924", "0.68889886", "0.68802696", "0.67910177", "0.678038", "0.6778282", "0.6772589", "0.6768204", "0.6768204", "0.6762199", "0.6748759", "0.6727709", "0.67225605", "0.67193747", "0.67095065", "0.670643", "0.67009544",...
0.6521129
30
Finder Methods Search for the collection elements with properties passed as parameter find_by returns first occurrence and find_all_by and search() return all occurrences Format :. find_by(:property_name => property_name)
def find_by(args) self.find{|el| !args.map{|a,b| el.send(a) == b }.include?(false)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by()\n\n end", "def find_all_by(attributes = {})\n raise NotImplementedError.new\n end", "def find(input, property, value); end", "def find_by(attributes = {}, options = {}, header = {})\n search = { search: attributes }.merge!(options)\n request = requester.new(:get, \"...
[ "0.6617432", "0.6431689", "0.63915676", "0.6362718", "0.61212724", "0.5995799", "0.5992113", "0.59841233", "0.5962582", "0.5946644", "0.5928953", "0.59193337", "0.5869344", "0.5862938", "0.5854506", "0.58331144", "0.5784838", "0.57826716", "0.57629734", "0.57623893", "0.57327...
0.5415664
63
2: initializes `nodes` with `node` & takes advantage of precedence to compact.
def loop_size(node) nodes = [node] # shovel operator has higher precedence than assignment # - https://ruby-doc.org/core-2.3.4/doc/syntax/precedence_rdoc.html nodes << node = node.next until nodes.include?(node.next) nodes.size - nodes.index(node.next) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concat(nodes); end", "def initialize\n @nodes = []\n end", "def initialize\n\t\t@nodes = []\n\tend", "def initialize\n @nodes = []\n end", "def from_node(node); end", "def initialize(node)\n @node = node\n end", "def node=(_arg0); end", "def nodes; end", "def nodes; ...
[ "0.63746744", "0.6268906", "0.62514186", "0.614346", "0.60831934", "0.6040381", "0.5970489", "0.596158", "0.596158", "0.596158", "0.5924986", "0.5906481", "0.5906481", "0.5899902", "0.58944774", "0.58944774", "0.5859409", "0.583068", "0.58156407", "0.58156407", "0.58156407", ...
0.0
-1
3: Cycle detection > Hare and tortoise algorithm
def loop_size(node) tortoise = hare = node cycle_found = false loop_count = 0 while !tortoise.next.nil? && !hare.next.nil? && !hare.next.next.nil? # two 'pointers' that move at different speeds tortoise = tortoise.next hare = hare.next.next # the loop is completed once we reach the loop point ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_cycle_in_graph(edges)\nend", "def detect_cycles\n cycles = Array.new\n\n self.courses.each do |course|\n courses = Hash.new\n stack = Array.new\n add_course(course, course, courses, cycles, stack) unless courses.has_key?(course.id)\n end\n\n return cycles\n end", "def get...
[ "0.6618593", "0.58755916", "0.57878137", "0.57527286", "0.57216084", "0.567629", "0.5632151", "0.562902", "0.5614849", "0.5597455", "0.54537153", "0.5422919", "0.54196334", "0.5414217", "0.5374755", "0.53741235", "0.5373352", "0.5366006", "0.5364375", "0.534929", "0.5323412",...
0.57190114
5
From the challenge: use this if you want to create your code on you computer the class of the node is in the description
def create_chain_for_test(tail_size, loop_size) prev_node = start = Node.new start.next = start return start if loop_size == 1 (1..tail_size).each do |i| prev_node.next = Node.new prev_node = prev_node.next end end_loop = prev_node # <-------------------------- (1...loop_size).each do |i| prev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; e...
[ "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "0.6263884", "...
0.0
-1
def members=(members) memberships = members.map do |member| ConversationMembership.new user: member end end alias :users= :members=
def members_without(user) (members - [user]).compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def members=(value)\n self.users = value\n end", "def members=(value)\n @members = value\n end", "def members=(value)\n @members = value\n end", "def members=(value)\n @members = value\n end", "def members=(value)\n ...
[ "0.81531733", "0.7691636", "0.7691636", "0.7691636", "0.7691636", "0.73947525", "0.72478014", "0.69439745", "0.6749919", "0.6735693", "0.66625303", "0.6623564", "0.66004395", "0.6599349", "0.6553422", "0.65231514", "0.6479803", "0.6433864", "0.63815886", "0.6367538", "0.63434...
0.0
-1
def open_by(user) set opened: true end alias :mark_as_read :open alias :read :open
def read_by!(user) find_membership_by(user).read! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open=(v)\n @open = v\n end", "def reopen #rename to differentiate variables\n@open = true\nend", "def is_open?\n @open\n end", "def is_open?\n return state == :open\n end", "def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@gen...
[ "0.68792063", "0.6443921", "0.6403344", "0.6375091", "0.63489527", "0.6334902", "0.6312879", "0.6253914", "0.6251694", "0.6237169", "0.6214877", "0.6174097", "0.61711925", "0.6169918", "0.61585706", "0.61259806", "0.6108563", "0.6102136", "0.6100499", "0.6097248", "0.6096269"...
0.0
-1
The below codes are working fine, however not passing through the rake test
def repeat (say, how_many = 2) ("#{say} " * how_many).strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graffiti_test\n end", "def testNominalWithSeveralRN\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@G...
[ "0.59897447", "0.5893299", "0.5844993", "0.57106686", "0.57047", "0.5677577", "0.56689847", "0.5662999", "0.5661365", "0.5660307", "0.5659807", "0.56428605", "0.564086", "0.5632187", "0.56287587", "0.5611297", "0.5604875", "0.55877894", "0.5582145", "0.5567939", "0.5563412", ...
0.0
-1
str will return number of letters from num string
def start_of_word (str, num) str[0, num] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def character_count(str)\n str.length\n end", "def letter_count(str)\nletters = Hash.new(0)\n\tstr.each_char do |letter| letters[letter] += 1 end\n\t\treturn letters\nend", "def str_count(word, letter)\n p word.count(letter)\nend", "def letter_count(str)\nletters = {}\nletters.default = 0\n\n\ts...
[ "0.7094074", "0.7091773", "0.70078826", "0.6974889", "0.6920205", "0.6872314", "0.68421996", "0.68378395", "0.67951894", "0.67902297", "0.6749208", "0.6729498", "0.67255145", "0.6699386", "0.66946507", "0.6669303", "0.666161", "0.66526234", "0.66415167", "0.6625899", "0.66255...
0.0
-1
GET /profiles GET /profiles.json
def index @profiles_all = current_user.profiles.search(params[:search]) .paginate(page: params[:page]) .order('lastname ASC') if current_user.business @businesses = current_user.business.name end respond_to do |format| format.html { render @users } format.json { render json: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access...
[ "0.7720244", "0.7511753", "0.7511205", "0.7474065", "0.747391", "0.7429771", "0.7368022", "0.7368022", "0.7277252", "0.72754085", "0.72646606", "0.7194632", "0.71890444", "0.7109752", "0.7068873", "0.7061951", "0.7061951", "0.7061951", "0.7036681", "0.70242476", "0.699903", ...
0.0
-1
GET /profiles/1 GET /profiles/1.json
def show @profiles_all = current_user.profiles.order('lastname ASC') if current_user.business @business = current_user.business.name end @profile = current_user.profiles.find(params[:id]) @profile_tickets = Ticket.where(:user => @user).order('date_opened DESC') .paginate(page: params[:pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def index\n authorize Profile\n @profi...
[ "0.7775649", "0.74931335", "0.74876684", "0.736598", "0.7305961", "0.7302657", "0.7301793", "0.72450936", "0.72319347", "0.72319347", "0.72319347", "0.72181976", "0.72181976", "0.71651715", "0.71410364", "0.7114219", "0.70800215", "0.7046293", "0.70175827", "0.69905627", "0.6...
0.0
-1
Check that parameters contains only allowed values.
def position_params params.require(:position).permit(:title, :description, :active) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_param_values\n self.class.get_parameters_info.each do |k, v|\n if is_a_checkable_class?(v) && !v[:check].call(self.send(k))\n raise ParameterizableValueIncorrect.new(v[:check], self.send(k))\n end\n end\n end", "def validate_parameter(*param)\n par...
[ "0.73896956", "0.7241826", "0.72030324", "0.712715", "0.7066954", "0.703324", "0.70120037", "0.7000719", "0.7000487", "0.6977135", "0.692024", "0.69133884", "0.6882613", "0.6872119", "0.68713456", "0.6831777", "0.6790493", "0.6764653", "0.6751055", "0.67436385", "0.6740023", ...
0.0
-1
Executes a sequence of commands in a shell on a remote host. Yields control of the channel an optionally provided block after executing all the given commands, if you want to send some more commands. Returns a single string of all output generated by the remote host
def expect_ssh(host, user, password, commands, verbose=false, opts={}) @verbose = verbose def log(message) STDERR.puts message if @verbose end output = "" opts[:password] = password if opts[:password].nil? Net::SSH.start(host, user, opts) do |ssh| log "started session" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_exec!(ssh)\n output_data = ''\n exit_code = nil\n exit_signal = nil\n\n ssh.open_channel do |channel|\n channel.exec(@command) do |ch, success|\n abort \"FAILED: couldn't execute command (ssh.channel.exec)\" unless success\n\n ...
[ "0.6885983", "0.67244023", "0.6369842", "0.63304", "0.60644764", "0.6057245", "0.6055209", "0.6055209", "0.6052423", "0.6030599", "0.59540033", "0.59022343", "0.5886991", "0.5861726", "0.5858086", "0.5841568", "0.5841289", "0.5829182", "0.5826706", "0.5752824", "0.5745991", ...
0.63603914
3
I spent [] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? input is a positive integer, a fixnum What is the output? (i.e. What should the code return...
def separate_comma(num) return nil if !(num.is_a? Integer) num_array = num.to_s.split(//) return num_array.collect.with_index { |digit, i| num_digits = num_array.length - i if num_digits > 3 && num_digits % 3 == 1 digit + ',' else digit end }.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def separate_comma(number)\n array = number.to_s.split('') #creates an array from number w/ digits\n number_commas = array.size/3.0 #how many commas\n if array.size < 4 #this is a 3 digit number\n return number.to_s #return number no comma needed\n elsif array.size%3 == 0\n n = -4\n (number_commas.to_...
[ "0.79625225", "0.77760124", "0.7761377", "0.773113", "0.7730171", "0.7722589", "0.77220964", "0.76838607", "0.76598644", "0.7626923", "0.76217884", "0.76109844", "0.7600515", "0.7591759", "0.7571929", "0.75672114", "0.7562809", "0.7554514", "0.7546001", "0.75430435", "0.75299...
0.73747647
37
Initialize given array of com.gravitext.concurrent.TestFactory instances.
def initialize( factories ) @factories = factories @thread_count = Concurrent::available_cores @warmup_exec_target = 8.0 @warmup_total_target = 25 @warmup_tolerance = 0.05 @final_iterations = 3 @final_runs = nil @final_exec_target = 10.0 @max_al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_test_objects(tests, run_options, run_id = @id)\n @event_emitter.emit_event(:info => 'Creating test objects')\n test_objects = []\n tests.each do |test|\n test_object = DATSauce::Test.new(run_id, test, run_options, @projectId)\n test_objects << test_object\n @event_emi...
[ "0.61079526", "0.5989277", "0.5869395", "0.58498037", "0.5788631", "0.57334226", "0.57334226", "0.5694033", "0.56865627", "0.56438243", "0.56328493", "0.5602827", "0.56016016", "0.55729944", "0.55697674", "0.55509895", "0.5514298", "0.55090123", "0.54989135", "0.5497344", "0....
0.60024244
1
Status is written via out << (default $stdout)
def initialize( out = $stdout ) @out = out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(msg = '')\n\t\toutput.print_status(msg)\n\tend", "def output\n out ||= $output || $stdout\n out\n end", "def print_status\n\t\tputs \"#{status}\"\n\tend", "def stdout\n run unless ran?\n\n @stdout\n end", "def write_status(state, mesg = '')\n msg = \"#{state} #{mesg}\\...
[ "0.6842943", "0.67918205", "0.66152614", "0.6592868", "0.65536904", "0.65338916", "0.65338916", "0.65338916", "0.65338916", "0.65338916", "0.65338916", "0.6530058", "0.65114176", "0.63623166", "0.63171166", "0.6239588", "0.6235851", "0.6234313", "0.62331414", "0.6217379", "0....
0.60085446
37
Print run start and result output on single log line
def print_result( exec, prior = nil ) line = "" orig_result_start( exec, line ) super( exec, prior, line ) @out << line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out_line\n name = @run_name\n name += \" (res: #@restart_id)\" if @restart_id\n name += \" real_id: #@real_id\" if @real_id\n beginning = sprintf(\"%2d:%d %-60s %1s:%2.1f(%s) %3s%1s\", @id, @job_no, name, @status.to_s[0,1], @run_time.to_f / 60.0, @nprocs.to_s, percent_complete, \"%\...
[ "0.7132155", "0.69658834", "0.6963997", "0.6663936", "0.64939296", "0.63037574", "0.6215825", "0.6177743", "0.6155874", "0.60999614", "0.60979277", "0.6096635", "0.60947686", "0.6084679", "0.6032095", "0.60209125", "0.6016826", "0.60111", "0.60019207", "0.60019207", "0.600192...
0.6081419
14
Defaults to displaying show
def call(state = :show, *args) @action_name = state super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show; @showing = false; end", "def show\n self.visible = true\n end", "def show!\n visible(true)\n end", "def show!\n visible(true)\n end", "def set_show(val)\n self.show = val\n self\n end", "def show() end", "def show() end", "def show() end", "def...
[ "0.7779426", "0.73725694", "0.7352178", "0.7352178", "0.7212532", "0.7203465", "0.7203465", "0.7203465", "0.7157672", "0.7131566", "0.7120393", "0.7093455", "0.7069411", "0.6952264", "0.6933985", "0.69299424", "0.69250864", "0.6875687", "0.6843306", "0.6843306", "0.6843306", ...
0.0
-1
returns a hash with each word as a key and the value is the number of times the word appears in the passed in words array
def terms_hash_from_words_array(words) terms = Hash.new(0) stemmed_words.each do |term| terms[term] += 1 end return terms end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_occurrences(words)\n hash ={}\n words.each do |word|\n if hash.has_key?(word)\n hash[word] += 1\n else\n hash[word] = 1\n end\n end\n \n hash.each {|k, v| puts \"#{k} => #{v}\"}\nend", "def count_occurrences(array)\n frequncies = Hash.new(0)\n\n array.each do |word|\n frequ...
[ "0.8266813", "0.82027876", "0.81355965", "0.81282026", "0.8090094", "0.808158", "0.8057346", "0.7950118", "0.78618085", "0.7714195", "0.7709175", "0.7682765", "0.76752186", "0.7656667", "0.7646616", "0.7645848", "0.7635429", "0.7570049", "0.75469226", "0.7517314", "0.75044924...
0.80298007
7
Remove punctuation, numbers and symbols
def clean_text text.tr("'@_", '').gsub(/\W/, ' ').gsub(/[0-9]/, '').downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punctuation\n gsub /[[:punct:]]/, ''\n end", "def remove_punctuation(phrase)\n phrase.gsub(/[^0-9a-z ,]/i, '')\n end", "def strip_non_word_characters!\n @raw.gsub!(/[^\\w\\ \\-.,]/, ' ')\n end", "def remove_punctuation(str)\n str.gsub(/[^0-9A-Za-z]/, '')\n end", "def punctuat...
[ "0.7959122", "0.7800136", "0.77023166", "0.76988715", "0.76151574", "0.7560341", "0.7553866", "0.7523271", "0.7497449", "0.74768806", "0.7468285", "0.74500436", "0.7394711", "0.7355957", "0.72781575", "0.7195138", "0.7177885", "0.71530527", "0.71353936", "0.71298397", "0.7129...
0.74040556
12
deletion_logs domain_tags flag_logs moderator_sites
def gen_field(name) ar_class = name.camelize.constantize graphql_type = "Types::#{name.camelize}Type".constantize field name.to_sym do type graphql_type argument :id, types.ID, "Get one #{ar_class} by id" description "Find one #{ar_class}" resolve ->(_obj, args, _ctx) do ar_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_weblog_explain; \"Remove weblog from your list.\"; end", "def log_destroy\n (glossary_terms + observations).each do |object|\n object.log(:log_image_destroyed, name: log_name, touch: true)\n end\n end", "def tag_clean_up\n all_tags = Tag.all\n all_modules = UniModule.all\n\n ...
[ "0.6680086", "0.58972687", "0.5893606", "0.58650494", "0.5847246", "0.579774", "0.5773462", "0.5766083", "0.57190263", "0.5647309", "0.5646022", "0.56333506", "0.56126106", "0.561028", "0.56023955", "0.56023955", "0.56023955", "0.55902827", "0.55867344", "0.5569048", "0.55517...
0.0
-1
Test 2: Populated group and empty note
def test02_DraftEmptyN loginPost $browser.goto($patch_note) sleep 2 if $post_pick_group.exists? postGroupPop sleep 4 $post_save_draft.fire_event("onclick") else puts "PDEVT02: FAILED! Unable to locate draft button." end begin assert $post_draft_error.exists? rescue => e ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group; end", "def group\n nil\n end", "def group\n nil\n end", "def group\n nil\n end", "def group\n nil\n end", "def begin_group(kind); end", "def message\n 'Example grouping has no name'\n end", "def example_group_started(notif...
[ "0.61904573", "0.616146", "0.616146", "0.616146", "0.60659766", "0.60484064", "0.60296696", "0.59783274", "0.597453", "0.5960421", "0.59596574", "0.5902159", "0.58329964", "0.58198404", "0.5810976", "0.57940906", "0.5688653", "0.5684176", "0.5672094", "0.564927", "0.56473273"...
0.51639456
65
Test 3: Empty group and populated note
def test03_DraftEmptyG loginPost $browser.goto($patch_note) sleep 2 if $post_compose_note.exists? $post_compose_note.set("Note field populated by automated test.") sleep 4 $post_save_draft.fire_event("onclick") sleep 5 else puts "PDEVT03: FAILED! Unable to locate draft button." end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message\n 'Example grouping has no name'\n end", "def group\n nil\n end", "def group\n nil\n end", "def group\n nil\n end", "def group\n nil\n end", "def print_group(group)\n puts \"Name: \" + group.name\n puts \"Description: \" + ...
[ "0.5865264", "0.5865226", "0.5865226", "0.5865226", "0.578597", "0.5722301", "0.56676257", "0.5641609", "0.5631657", "0.55940396", "0.558204", "0.5574737", "0.5564067", "0.5553942", "0.55511326", "0.5506144", "0.5498791", "0.549863", "0.5438186", "0.53891087", "0.538337", "...
0.5465325
18
Test 4: Populated group and populated note
def test04_DraftPopGN loginPost $browser.goto($patch_note) sleep 2 if $post_pick_group.exists? postGroupPop $post_compose_note.set("Note field populated by automated test.") sleep 4 $post_save_draft.fire_event("onclick") else puts "PDEVT04: FAILED! Unable to locate draft button." end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_group_started(notification)\n # there is a super method for this\n super(notification)\n doc = {\n 'type' => 'case',\n 'subtype' => 'describe',\n 'label' => \"#{notification.group.description}\",\n 'level' => @example_group_stack.size\n }\n @e...
[ "0.62097305", "0.6084959", "0.59793395", "0.58924246", "0.58590716", "0.5831977", "0.57817894", "0.56720966", "0.56541556", "0.5625153", "0.56152356", "0.56034803", "0.55899423", "0.5583139", "0.5569327", "0.5561245", "0.5536385", "0.5536385", "0.5536385", "0.55273426", "0.55...
0.0
-1
Articles! Test 5: Empty group, empty title, empty article
def test05_DraftEmptyGN loginPost $browser.goto($patch_article) sleep 2 if $post_now.exists? sleep 4 $post_save_draft.fire_event("onclick") else puts "PDEVT05: FAILED! Unable to locate draft button." end begin assert $post_draft_error.exists? rescue => e puts ("PDEVT05: FAILED...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @articles = Article.visible.where(press_release: 0).sorted.limit(5)\n if I18n.locale == :en\n @articles.reject!{|x| x.title_en.to_s.strip.length == 0 }\n else\n @articles.reject!{|x| x.title_no.to_s.strip.length == 0 }\n end\n end", "def test02_ArticleAllFields\n\t\tloginPost\n...
[ "0.6179045", "0.61271554", "0.6016107", "0.5884597", "0.5833565", "0.577293", "0.57325226", "0.57245195", "0.5618222", "0.5589564", "0.5582066", "0.55707055", "0.555798", "0.5557254", "0.5502684", "0.5487709", "0.5476266", "0.54559326", "0.54496896", "0.5438277", "0.5413793",...
0.50560296
79
if your formula requires any X11/XQuartz components
def install system "make" system "make", "PREFIX=#{prefix}", "install" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def x11_installed?\n Pathname.new('/usr/bin/X').exist?\n end", "def install\n # Avoid references to shim\n inreplace Dir[\"**/*-config.in\"], \"@PKG_CONFIG@\", Formula[\"pkg-config\"].opt_bin/\"pkg-config\"\n\n\n # Add a symlink that points to the X11 include files provided by XQuartz.\n ...
[ "0.6415147", "0.6149812", "0.5639716", "0.5599019", "0.5455516", "0.5351954", "0.5301597", "0.52996176", "0.52267766", "0.52267766", "0.52234536", "0.5190686", "0.5163052", "0.515997", "0.5138814", "0.5138814", "0.50926703", "0.49954116", "0.49677074", "0.49160692", "0.491399...
0.0
-1
GET /workers GET /workers.json
def index @workers = Worker.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @worker = Worker.find(params[:id])\n\n render json: @worker\n end", "def workers_all\n @work_order_workers = WorkOrderWorker.by_id\n render json: serialized_work_order_workers(@work_order_workers)\n end", "def workers\n if known?\n @workers\n else\n ...
[ "0.70793694", "0.6959667", "0.6825376", "0.6597208", "0.6523171", "0.65024567", "0.6455736", "0.64446664", "0.6419539", "0.63906205", "0.6289473", "0.623814", "0.6193921", "0.61886203", "0.6143135", "0.6116797", "0.607966", "0.6078476", "0.60630536", "0.6014862", "0.6009841",...
0.69443476
5
GET /workers/1 GET /workers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @worker = Worker.find(params[:id])\n\n render json: @worker\n end", "def show\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worker }\n end\n end", "def show\n\tLogger.log current_user\n ...
[ "0.7356612", "0.6860225", "0.6767602", "0.6722031", "0.6722031", "0.6722031", "0.6722031", "0.6501165", "0.63908213", "0.6290609", "0.6214619", "0.62064886", "0.61636055", "0.6092462", "0.60724896", "0.6032988", "0.6032022", "0.601833", "0.5998301", "0.5949724", "0.5913643", ...
0.0
-1
POST /workers POST /workers.json
def create @worker = Worker.new(worker_params) respond_to do |format| if @worker.save format.html { redirect_to @worker, notice: 'Worker was successfully created.' } format.json { render :show, status: :created, location: @worker } else format.html { render :new } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @worker = Worker.new(worker_params)\n\n respond_to do |format|\n if @worker.save\n format.html { redirect_to tenant_workers_path, notice: 'Worker was successfully created.' }\n format.json { render :show, status: :created, location: @worker }\n else\n format.html {...
[ "0.67180526", "0.6703459", "0.66034454", "0.65615827", "0.6258718", "0.61167574", "0.60079324", "0.5969695", "0.59163606", "0.5894049", "0.58609104", "0.5781898", "0.5774839", "0.5733632", "0.57305807", "0.57161295", "0.5698196", "0.56878626", "0.567291", "0.5672617", "0.5623...
0.66233706
4
PATCH/PUT /workers/1 PATCH/PUT /workers/1.json
def update respond_to do |format| @worker.answered = true if @worker.update(worker_params) format.html { redirect_to @worker, notice: 'La encuesta fue recibida con éxito' } format.json { render :show, status: :ok, location: @worker } else format.html { redirect_to root_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @worker = Worker.find(params[:id])\n\n respond_to do |format|\n if @worker.update_attributes(params[:worker])\n format.html { redirect_to @worker, notice: 'Worker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: ...
[ "0.68544406", "0.67247623", "0.6672546", "0.65646887", "0.650939", "0.63493574", "0.6064787", "0.5989119", "0.595985", "0.59256303", "0.58988476", "0.5867081", "0.58444315", "0.57654226", "0.5760576", "0.57586205", "0.5756326", "0.57534796", "0.5739615", "0.5728026", "0.57154...
0.6181776
7
DELETE /workers/1 DELETE /workers/1.json
def destroy @worker.destroy respond_to do |format| format.html { redirect_to workers_url, notice: 'Worker was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @worker = Worker.find(params[:id])\n @worker.destroy\n\n respond_to do |format|\n format.html { redirect_to workers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @worker.destroy\n respond_to do |format|\n format.html { redirect_to workers_ur...
[ "0.74186075", "0.741108", "0.741108", "0.7144842", "0.7144842", "0.70956385", "0.70161456", "0.6767727", "0.6742471", "0.67078096", "0.6585025", "0.6379477", "0.6326395", "0.63209563", "0.6319651", "0.6302331", "0.6220509", "0.6215952", "0.6152925", "0.6110454", "0.61069375",...
0.70414656
8
Use callbacks to share common setup or constraints between actions.
def set_worker @worker = Worker.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 worker_params params.require(:worker).permit(:rut,:position,:local,:w_qf_apron, :m_qf_apron, :w_vmf_apron, :m_vmf_apron, :w_shirt, :m_shirt, :m_blue_trouser, :w_blue_trouser, :m_black_trouser, :w_black_trouser, :nativa_trouser, :beauty_trouser, :m_blue_polar, :w_blue_polar, :nativa_polar, :m_black_polar, :w_b...
{ "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
Task 4: People have birthdays! Create a new method "birthday" that increments a person's age by 1 year prove that it works by incrementing the age of one of your patients and printing it in a sentence like "my age is now 44 years old". Where should the birthday method be?
def birthday @age = Integer(@age) @age += 1 puts "my age is now #{@age}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def birthday!\n puts \"Happy birthday #{name}\"\n self.age += 1\n end", "def birthday\n \t@age += 1\n end", "def celebrate_birthday\n @age += 1\n puts \"My age: #{@age}\"\n end", "def celebrate_birthday\n @age = @age + 1\n puts \"It's Santa's Birthday! He is now #{@age} years old!\"\n ...
[ "0.8003018", "0.7885876", "0.785409", "0.78487796", "0.7823835", "0.77618396", "0.77151823", "0.7653172", "0.76429534", "0.7634194", "0.76258415", "0.7603571", "0.7603571", "0.7603571", "0.7603571", "0.7603571", "0.7603571", "0.7603571", "0.7575553", "0.75726485", "0.75426346...
0.7496711
23
======================================================== = Connect to database, error out if we have any issues = ========================================================
def connect(args) begin # sensible? defaults args[:host] ||= 'localhost' args[:port] ||= 3306 args[:user] ||= 'root' args[:password] ||= '' db = Mysql.connect(args[:host], args[:user], args[:password], args[:name], args[:port]) @debug and puts "-- #{args[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_db_method\n begin\n self.con = PG.connect :dbname => self.dbname, :user => self.username, :password => self.password\n return true\n rescue PG::Error => e\n puts e.message\n puts \"Sorry Connection cannot be established\"\n # => Forceful exit from the program\n Kerne...
[ "0.75217503", "0.7402938", "0.73641014", "0.7238357", "0.72258383", "0.71789145", "0.7128", "0.7128", "0.7100894", "0.7052579", "0.70454884", "0.7022473", "0.69572777", "0.690286", "0.6863348", "0.6863348", "0.684692", "0.68178165", "0.68115216", "0.6798794", "0.67251194", ...
0.601733
73
======================================================================= = We should use these if we are doing a real time update to a live db = =======================================================================
def lock_table(db, table) begin db.query("LOCK #{table}") rescue Mysql::Error => e $stderr.puts "Error code: #{e.errno}" $stderr.puts "Error message: #{e.error}" $stderr.puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate") exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mte_prepare_updating; send_request_to_mite(\"update\"); end", "def update ; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def updated_data; end", "def update() end", "def on_...
[ "0.643463", "0.64091665", "0.6408948", "0.6408948", "0.6408948", "0.6408948", "0.6408948", "0.6408948", "0.6408948", "0.6408948", "0.63126355", "0.62747276", "0.62363195", "0.6183769", "0.61452895", "0.61452895", "0.6128136", "0.6125239", "0.61159617", "0.61129725", "0.609738...
0.0
-1
========================================== = Wrap up query with some error handling = ==========================================
def query(db, query, type = "array") begin result = db.query(query) return (type == "hash" ? result.to_hash : result.to_array) rescue Mysql::Error => e $stderr.puts "Error code: #{e.errno}" $stderr.puts "Error message: #{e.error}" $stderr.puts "Error SQLSTATE: #{e.sqlstate}" if e.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_query(sql)\n\t\t\t\tbegin\n \tdbslay_results = cmd_execute(:db, 'SQL' => sql)\n rescue OpenURI::HTTPError\n\t\t\t\t\traise DbslayerException, \"Error connecting to dbslayer #{host}:#{port}\"\n\t\t\t\trescue JSON::ParserError\n\t\t\t\t\traise DbslayerException, \"Unable to parse result from JS...
[ "0.6455685", "0.6394911", "0.63838273", "0.62484527", "0.62200093", "0.6210109", "0.6194102", "0.61474305", "0.6144852", "0.6134967", "0.61261857", "0.6056278", "0.6039376", "0.60265696", "0.60125273", "0.5982247", "0.5933611", "0.59315366", "0.58865607", "0.58499026", "0.584...
0.54803973
41
================================================================= = Compare the schema and output mysql script to update other db = =================================================================
def compare_schema tables1 = query(@db1, 'show tables') tables2 = query(@db2, 'show tables') # reject tables that are already in this database add_to_db2 = tables1.reject {|t| tables2.include?(t) } add_to_db1 = tables2.reject {|t| tables1.include?(t) } # add tables and data for tables ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_db\n require \"#{File.dirname(__FILE__)}/../conf/db_schema.rb\"\n Knj::Db::Revision.new.init_db(\"debug\" => false, \"db\" => @db, \"schema\" => Openall_time_applet::DB_SCHEMA)\n end", "def mysql_v2_migration_lookup_scripts\n #TODO fix this so epoch is not hard coded.\n puts \"WE ARE HARDCODI...
[ "0.61447155", "0.6077743", "0.60172755", "0.60071975", "0.60071975", "0.60071975", "0.5988776", "0.5985595", "0.59541106", "0.5848874", "0.5848388", "0.58174443", "0.5765605", "0.57549644", "0.57533437", "0.5746827", "0.5746827", "0.57367474", "0.57367474", "0.57367474", "0.5...
0.70708746
0
======================================================================= = Compare the table columns and output mysql script to alter other db = =======================================================================
def compare_columns(table) t1_cols = query(@db1, "DESCRIBE #{table}") t2_cols = query(@db2, "DESCRIBE #{table}") # reject cols that already exist in the table add_to_t2 = t1_cols.reject {|t| t2_cols.include?(t) } add_to_t1 = t2_cols.reject {|t| t1_cols.include?(t) } changes = false ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_schema\n tables1 = query(@db1, 'show tables')\n tables2 = query(@db2, 'show tables')\n \n # reject tables that are already in this database\n add_to_db2 = tables1.reject {|t| tables2.include?(t) }\n add_to_db1 = tables2.reject {|t| tables1.include?(t) }\n \n # add tables and dat...
[ "0.7000991", "0.6314979", "0.626774", "0.626774", "0.626774", "0.61962426", "0.61662436", "0.6136029", "0.60924315", "0.60924315", "0.60924315", "0.606657", "0.59891766", "0.58917356", "0.5850843", "0.5845987", "0.57604754", "0.56962806", "0.56962806", "0.56962806", "0.568353...
0.7542412
0
================================================================================================= = Compare data line by line and add to other db (very slow, maybe won't work for large tables?) = =================================================================================================
def compare_data(table) data1 = query(@db1, "SELECT * FROM #{table}", "hash") data2 = query(@db2, "SELECT * FROM #{table}", "hash") changes = false data1.each do |row| if ! data2.include?(row) to_insert(@db2_output, table, row) changes = true end end @db2_outpu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def differences(dbh1, dbh2, name1, name2, masks, block) # :nodoc:\n idc = []\n mask_insert = []\n mask_delete = []\n mask = 0 # mask of previous table\n count = 0\n inserts = 0\n updates = 0\n deletes = 0\n (masks.size-1).downto(0) do |level|\n next_idc = []\n $stderr.print(...
[ "0.6244009", "0.6117984", "0.6041174", "0.6041174", "0.6041174", "0.5935672", "0.5793832", "0.56819475", "0.5593474", "0.5573689", "0.5566273", "0.5529571", "0.5513216", "0.54628307", "0.54237926", "0.54223216", "0.54166734", "0.53869295", "0.53586113", "0.5354352", "0.535190...
0.8040111
0
======================================== = Insert data for tables from other db = ========================================
def insert_data(output, db, table) result = query(db, "SELECT * FROM #{table}", "hash") changes = false result.each do |row| to_insert(output, table, row) changes = true end output << "\n" if changes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_to(db, args = {})\r\n data[\"tables\"].each do |table|\r\n table_args = nil\r\n table_args = args[\"tables\"][table[\"name\"].to_s] if args and args[\"tables\"] and args[\"tables\"][table[\"name\"].to_s]\r\n next if table_args and table_args[\"skip\"]\r\n table.delete(\"indexes\") i...
[ "0.68363047", "0.6344963", "0.62986237", "0.6273163", "0.6214833", "0.6175388", "0.617209", "0.6145948", "0.6126718", "0.60770786", "0.6074369", "0.60679483", "0.60565096", "0.60249174", "0.6023097", "0.6020262", "0.59394026", "0.593144", "0.59067476", "0.5897923", "0.5874269...
0.59444445
16
==================== = Build the insert = ====================
def to_insert(output, table, row) columns = @columns[table].map {|i| i[0] }.join(',') values = map_values(row, @columns[table]) output << "INSERT INTO #{table} (#{columns}) VALUES (#{values});\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert()\n\n end", "def create_insert()\n script = []\n attributes.each do |a|\n script << a.create_insert\n end\n children.each do |c|\n script << c.create_insert\n end\n \n InsertElement.new(XElement.new(self.name), script)\n end", "def build_insert(da...
[ "0.7036704", "0.696345", "0.680154", "0.67320836", "0.66534424", "0.6588862", "0.650578", "0.6459078", "0.64143246", "0.64064515", "0.64011747", "0.63694197", "0.6259809", "0.62579143", "0.621046", "0.6206325", "0.6188985", "0.6144085", "0.6109994", "0.61077017", "0.61077017"...
0.59958184
30
================================================================================ = Create the output values as a string, change formatting based on column type = ================================================================================
def map_values(row, columns) values = columns.map do |v| # TODO - stw - which other cases do we need to handle? case v[1] when /int/: row[v[0]] || 'NULL' else (row[v[0]].nil? ? 'NULL' : "'" + @db1.escape_string(row[v[0]].to_s) + "'") end end values = v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n columns.each{|c| \"#{c}: #{self.send(c)}\\n\"}\n end", "def to_s\n value.map { |ar| ar.map { |v| v.to_s.gsub(/\\t|\\n|\\r/,' ') }.join \"\\t\" }.join($/)\n end", "def process_row(row)\n row.to_s\n end", "def to_s\n [@rows.collect { |row| row.inspect }].join(\"\\n\")\n ...
[ "0.6552571", "0.648149", "0.640044", "0.63775325", "0.63274014", "0.6262018", "0.62392235", "0.62321633", "0.6230366", "0.6182196", "0.6174636", "0.6167937", "0.6162997", "0.6162895", "0.6152576", "0.61520404", "0.61366445", "0.61275446", "0.61131656", "0.6099695", "0.6096364...
0.5742113
63
================================== = Create table definition output = ==================================
def create_table(output, db, table) cols = query(db, "DESCRIBE #{table}") output << "CREATE TABLE #{table} (\n" cols.each_with_index do |c, i| output << ",\n" if i > 0 output << "\t#{c[0]} #{c[1]}" output << " primary key" if c[3] == "PRI" output << " DEFAULT NULL" if c[2] == "Y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_table_def_table()\r\n table_def_name = \"table_definitions\"\r\n\r\n # If the table doesn't already exist, create it\r\n puts \"Creating table definition table (#{table_def_name}) if it doesn't exist.\" if @enable_debug_logging\r\n db_column_size_limits = @db_column_size_limits\r\n @db....
[ "0.76276714", "0.75065047", "0.74421644", "0.7439836", "0.740974", "0.7330629", "0.7267921", "0.70289016", "0.70289016", "0.70289016", "0.70289016", "0.7020152", "0.7012371", "0.7010633", "0.6985055", "0.6982562", "0.69654113", "0.69384295", "0.6932697", "0.69057417", "0.6848...
0.7559324
1
Update comment property [path] /projects/project_name [method] PUT
def update(comment) response = ODPS.conn.put do |req| req.url "projects/#{self.name}" req.headers['Content-Type'] = 'application/xml' req.body = serialize [String, nil, 'Name', @name], [String, nil, 'Comment', comment] end # Update project object's ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @project_comment = ProjectComment.find(params[:id])\n\n respond_to do |format|\n if @project_comment.update_attributes(params[:project_comment])\n format.html { redirect_to @project_comment, :notice => 'Project comment was successfully updated.' }\n format.json { head :no_cont...
[ "0.7611285", "0.74350226", "0.723585", "0.71874416", "0.71276116", "0.70545596", "0.6834219", "0.6824895", "0.6735253", "0.671275", "0.6621919", "0.6601018", "0.6599406", "0.65776676", "0.6576867", "0.65403", "0.6511919", "0.64909405", "0.6436575", "0.64087766", "0.63712466",...
0.7993378
0
Reload project's information from ODPS. [path] /projects/project_name [method] GET
def reload response = ODPS.conn.get "projects/#{self.name}" self.creation_time = response['x-odps-creation-time'] self.last_modified_time = response['Last-Modified'] self.owner = response['x-odps-owner'] self.deserialize response.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_updates\n @project = Project.find(params[:id])\n end", "def load_project\n @project = Project.find(params[:id])\n end", "def load_project\n local_params = params\n @project = Project.find local_params[:project_id]\n end", "def show\n @projects = find_projects\n end", ...
[ "0.7077725", "0.6840095", "0.6734995", "0.6715528", "0.6609616", "0.65758896", "0.6558649", "0.6537879", "0.65254927", "0.6521222", "0.6483089", "0.64574164", "0.6450474", "0.6449663", "0.64452195", "0.6435212", "0.64022136", "0.6400198", "0.63828474", "0.63723487", "0.635644...
0.80937916
0
GET /bar30s or /bar30s.json
def index @bar30s = Bar30.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n ...
[ "0.6362529", "0.6289805", "0.6171524", "0.6024099", "0.5976846", "0.5975547", "0.59039766", "0.5900697", "0.5899785", "0.5848798", "0.5840159", "0.5835464", "0.5834574", "0.5834559", "0.5821183", "0.57996494", "0.5789613", "0.57779247", "0.5775613", "0.576119", "0.5727915", ...
0.6540239
0
GET /bar30s/1 or /bar30s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrack }\n end\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOG...
[ "0.6323756", "0.6297588", "0.6257435", "0.6247872", "0.6073965", "0.60456246", "0.60347545", "0.5962426", "0.58899504", "0.5882402", "0.58779335", "0.58698297", "0.5843114", "0.58401155", "0.5814148", "0.5795897", "0.57896525", "0.57861584", "0.5737473", "0.5720805", "0.57141...
0.0
-1
POST /bar30s or /bar30s.json
def create @bar30 = Bar30.new(bar30_params) respond_to do |format| if @bar30.save format.html { redirect_to @bar30, notice: "Bar30 was successfully created." } format.json { render :show, status: :created, location: @bar30 } else format.html { render :new, status: :unprocess...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @non_smoking_bar = NonSmokingBar.new(params[:non_smoking_bar])\n\n respond_to do |format|\n if @non_smoking_bar.save\n format.html { redirect_to root_url, notice: 'Successfully created.' }\n format.json { render json: @non_smoking_bar, status: :created, location: @non_smoking_...
[ "0.6189", "0.6126693", "0.61192787", "0.6115671", "0.6069139", "0.6058635", "0.6053784", "0.60125124", "0.6004121", "0.59471154", "0.5944439", "0.593173", "0.59185135", "0.5895411", "0.58735657", "0.578553", "0.57761145", "0.57754856", "0.5757895", "0.57381195", "0.5715265", ...
0.67486924
0
PATCH/PUT /bar30s/1 or /bar30s/1.json
def update respond_to do |format| if @bar30.update(bar30_params) format.html { redirect_to @bar30, notice: "Bar30 was successfully updated." } format.json { render :show, status: :ok, location: @bar30 } else format.html { render :edit, status: :unprocessable_entity } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @bar42.update(bar42_params)\n format.html { redirect_to @bar42, notice: \"Bar42 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bar42 }\n else\n format.html { render :edit, status: :unprocessable_entity }...
[ "0.6533662", "0.6453127", "0.64354", "0.6431267", "0.64278734", "0.64246917", "0.6371577", "0.63508296", "0.63371503", "0.6314712", "0.6289546", "0.62456", "0.6189202", "0.6188375", "0.6184908", "0.6139122", "0.61146617", "0.6107341", "0.61008525", "0.60961545", "0.6089812", ...
0.68084115
0