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
Modify sign up params to include firt and last names. When adding new parameters, need to edit views/devise/registrations/new to include new fields.
def sign_up_params params.require(:user).permit(:first_name, :last_name, :email, :password, :password_confirmation) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [:first_name, :last_name]\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << :firs...
[ "0.7825672", "0.77927095", "0.77289957", "0.76966476", "0.76915294", "0.7689279", "0.7676229", "0.7664107", "0.7647835", "0.7633539", "0.7618216", "0.7589338", "0.7587957", "0.757993", "0.7544609", "0.7533399", "0.7533028", "0.75178266", "0.75052375", "0.7497262", "0.7478427"...
0.7287222
48
>> quiz = [0,0,0,1,0,0,1,1,0,1] >> count_quiz_completions(quiz) => "The number of participants who did not attempt Quiz 1 is 6 out of 10 total participants."
def count_quiz_completions(quiz_results) no_quiz = quiz_results.count(0) total = quiz_results.count "The number of participants who did not attempt Quiz 1"\ " is #{no_quiz} out of #{total} total participants." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_quiz(questions)\r\n answer = \"\"\r\n score = 0\r\n for question in questions #a for loop for every question in the above array\r\n puts question.prompt\r\n answer = gets.chomp()\r\n if answer == question.answer\r\n score += 1\r\n end\r\nend\r\n puts \"you got\" + score.to_s ...
[ "0.7076016", "0.6728585", "0.6710225", "0.6652424", "0.6644462", "0.663831", "0.6636416", "0.6606279", "0.6586398", "0.64089113", "0.6376458", "0.6270606", "0.6246921", "0.6238103", "0.6178607", "0.6170431", "0.61440253", "0.61341083", "0.61295664", "0.611574", "0.61090994", ...
0.8939018
0
Examples: puts digit_list(12345) == [1, 2, 3, 4, 5] => true puts digit_list(7) == [7] => true puts digit_list(375290) == [3, 7, 5, 2, 9, 0] => true puts digit_list(444) == [4, 4, 4] => true
def digit_list(n) list = n.to_s list = list.split('') list = list.map do |i| i.to_i end return list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digit_list(num)\n if num < 10\n [num % 10]\n else\n num, digit = num.divmod(10)\n digit_list(num).push(digit)\n end\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.cha...
[ "0.7146804", "0.7023496", "0.7023496", "0.7023496", "0.7023496", "0.7023496", "0.70180815", "0.7003432", "0.69714344", "0.69529855", "0.6861188", "0.6861188", "0.6854448", "0.68284076", "0.6825373", "0.6822835", "0.68216735", "0.6801563", "0.68005943", "0.677273", "0.67655754...
0.6549808
29
Reloads the current page.
def reload(opts = {}) options = {} options[:ignoreCache] = true if opts[:skip_cache] options[:scriptToEvaluateOnLoad] = opts[:onload] if opts[:onload] @rpc.call 'Page.reload', options self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reloads\n load_page\n end", "def reload\n Howitzer::Log.info \"Reload '#{current_url}'\"\n visit current_url\n end", "def reload\n\t\tself.request( :reload )\n\tend", "def refresh\n command(\"Page.reload\", wait: timeout, slowmoable: true)\n end", "def refresh()\r\n ...
[ "0.85944563", "0.77237356", "0.6736358", "0.6511745", "0.6510518", "0.650939", "0.6459356", "0.6456156", "0.6456156", "0.6436067", "0.6384718", "0.63736385", "0.6370422", "0.6206377", "0.6179553", "0.61768574", "0.61768574", "0.61768574", "0.61768574", "0.61768574", "0.617685...
0.6024481
32
Enables or disables the generation of events in the Page domain.
def page_events=(new_page_events) new_page_events = !!new_page_events if new_page_events != page_events @rpc.call(new_page_events ? 'Page.enable' : 'Page.disable') @page_events = new_page_events end new_page_events end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable\n {\n method: \"Page.enable\"\n }\n end", "def set_lifecycle_events_enabled(enabled:)\n {\n method: \"Page.setLifecycleEventsEnabled\",\n params: { enabled: enabled }.compact\n }\n end", "def disable\n {\n method: \"Pag...
[ "0.67002696", "0.6632279", "0.5825981", "0.5763034", "0.55463254", "0.5482061", "0.545053", "0.5421582", "0.5420663", "0.53439677", "0.5221659", "0.52019787", "0.5195125", "0.5152388", "0.5122626", "0.51105136", "0.5058344", "0.5049732", "0.5035277", "0.50184125", "0.4998353"...
0.7110019
0
Returns string containing respondent's first and last name
def respondent_full_name [respondent_first_name, respondent_last_name].compact.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name...
[ "0.7651924", "0.7569874", "0.7541533", "0.75231886", "0.75231886", "0.7517006", "0.7505338", "0.74688125", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.74542254", "0.7438604", "0.74363995", "0.74363995", "0.74363995", "0.74363995", "0.74363995", "0...
0.8590738
0
custom validation for custom message without standard attribute prefix
def presence_of_subject_relationship_other if subject_relationship_other.blank? errors.add(:subject_relationship_other, ActiveRecord::Error.new( self, :base, :blank, { :message => "You must specify a relationship with 'other relationship' is selected." } ) ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_valid_message; nil; end", "def not_valid_message; nil; end", "def test_generate_message_exclusion_with_default_message\n assert_equal \"is reserved\", @person.errors.generate_message(:title, :exclusion, value: \"title\")\n end", "def full_message(attribute, message)\n return message if attribu...
[ "0.6785426", "0.6785426", "0.65165544", "0.65028995", "0.64755994", "0.64455605", "0.6276569", "0.62678266", "0.62557137", "0.6157303", "0.61564267", "0.6112558", "0.6104179", "0.60769665", "0.607073", "0.607073", "0.6026137", "0.5985616", "0.598447", "0.59594524", "0.592398"...
0.0
-1
If input lines are not equal length, we might land in the middle of a line
def rewind_line(file, line) until file_at_starting_position?(file, line) line_rewind_one_char(file, line) do |rewound_line| return line if newline?(rewound_line) line = rewound_line end end line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_line( x, y )\n x + @left_column < line_at( y ).length\n end", "def in_line( x, y )\n x + @left_column < line_at( y ).length\n end", "def two_empty_in_line(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(marker, initial, initial)\n end", "def is_same_li...
[ "0.6792005", "0.6792005", "0.6657288", "0.63800746", "0.6377823", "0.6270609", "0.6257391", "0.6173206", "0.60937303", "0.60112345", "0.5990658", "0.5978543", "0.5940403", "0.590957", "0.58649224", "0.5851992", "0.5829994", "0.58281827", "0.5816978", "0.58121437", "0.5777859"...
0.0
-1
================= = Guard methods = ================= Call once when guard starts
def start UI.info "Starting up WEBrick..." if running? UI.error "Another instance of WEBrick::HTTPServer is running." false else @pid = Spoon.spawnp('ruby', File.expand_path(File.join(File.dirname(__FILE__), %w{webrick server.rb})), @options[:host], @options[:port].to_s, @options[:ssl].to_s, @options[:docroot] ) wait_for_port if @options[:launchy] scheme = options[:ssl] ? "https" : "http" Launchy.open("#{scheme}://#{@options[:host]}:#{@options[:port]}") @options[:launchy] = false # only run once end @pid end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guard; end", "def guard(*args)\n @guard_count += 1\n super\n end", "def unguarded(&block)\n @guard_count += 1\n super\n end", "def sharded?; true; end", "def sharded?; false; end", "def start\n ::Guard.start(options)\n end", "def guard(guard_result)\r\n @guar...
[ "0.81878746", "0.7439578", "0.70606685", "0.6533401", "0.63737994", "0.6347317", "0.6341487", "0.6247641", "0.6201087", "0.61370736", "0.6052029", "0.6016231", "0.59248835", "0.5913648", "0.5906934", "0.58924174", "0.58633196", "0.5851018", "0.57840735", "0.5767945", "0.57650...
0.0
-1
Call with CtrlC signal (when Guard quit)
def stop UI.info "Shutting down WEBrick..." Process.kill("TERM", @pid) Process.wait(@pid) @pid = nil true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_on_ctrl_c(pids, options); end", "def trap_sigint(metabolizer, &block)\n trap 'SIGINT', proc {\n block.call if block\n metabolizer.stop\n }\nend", "def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end", "def trap_signals\n Signal.t...
[ "0.66534656", "0.65227354", "0.64948726", "0.63025624", "0.62676966", "0.6243309", "0.6243309", "0.62404484", "0.62300026", "0.6173701", "0.6061436", "0.6013525", "0.59871143", "0.5986814", "0.5983193", "0.596696", "0.5964279", "0.5955736", "0.5937405", "0.5930841", "0.589944...
0.0
-1
Call with CtrlZ signal
def reload restart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal; end", "def signal; end", "def doge_control_signal\r\n end", "def signal\n end", "def onCmdPanic(sender, sel, ptr)\n bctrl :flat, :buy, :short, :flip, :panic\n @watcher.cmdPanic\n end", "def interrupt; end", "def _interrupt\n\t\tbegin\n\t\t\tuser_want_abort?\n\t\trescue Interrupt\n\...
[ "0.6227386", "0.6227386", "0.6156666", "0.6150177", "0.5945292", "0.58566076", "0.57252514", "0.56801915", "0.567889", "0.56499046", "0.56159925", "0.559462", "0.5574696", "0.55651414", "0.5536165", "0.5512863", "0.5481604", "0.54298174", "0.542644", "0.5418715", "0.53748584"...
0.0
-1
Call on file(s) modifications
def run_on_change(paths = {}) restart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files(options); end", "def modified_files(options); end", "def modified_files; end", "def on_change(modified, added, deleted)\n # Modifications and additions are treated the same.\n (modified + added).uniq.each do |path|\n if file = Ichiban::ProjectFile.from_abs(path)\n ...
[ "0.72283614", "0.72283614", "0.7162714", "0.69458354", "0.6847766", "0.6808504", "0.6670028", "0.6489144", "0.6489144", "0.6477731", "0.6453445", "0.6439013", "0.64367425", "0.6427774", "0.6408381", "0.6404536", "0.6350342", "0.6317544", "0.631484", "0.6302051", "0.6300315", ...
0.5685971
91
Called when accepting invitation should return an instance of resource class
def accept_resource resource = resource_class.accept_invitation!(update_resource_params) SubscriptionService.new(account).update_subscription resource end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept_resource\n resource_class.accept_invitation!(update_resource_params)\n resource\n end", "def accept_resource\n resource = resource_class.accept_invitation!(update_resource_params)\n if resource.is_a?(Admin)\n OnboardingMailer.admin_onboarding(resource).deliver_later\n elsif resour...
[ "0.811412", "0.79219496", "0.7850943", "0.76063305", "0.7255781", "0.70342654", "0.6963639", "0.6812012", "0.670473", "0.66814524", "0.6668469", "0.66216135", "0.6439521", "0.6403509", "0.63733107", "0.63627434", "0.63505477", "0.6298703", "0.62884086", "0.6278829", "0.626236...
0.753008
4
fixes birth number badly transfered from candidates
def fix_bad_birth_numbers(students = nil) ActiveRecord::Base.connection.execute('SET NAMES UTF8') notfound = [] students ||= Student.find(:all) @@mylog.info "There are %i students" % students.size students.each do |student| if c = Candidate.find(:all, :conditions => ["birth_number like ?", "%s_" % student.birth_number]) if c.size > 0 if c.size > 1 @@mylog.info "More than one candidate for student %i. Getting first." % student.id end c = c.first @@mylog.info "Found one candidate for student %i" % student.id if c.birth_number =~ /\d{6}\// bn = c.birth_number.gsub(/\//, '') @@mylog.info "Got slash in birth number. Fixin student %i with %s" % [student.id, bn] student.update_attribute(:birth_number, bn) else @@mylog.info "No slash in birth number for %i" % student.id end else @@mylog.info "Candidate has't been found" notfound << student.id end end end return notfound end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def celebrate_birthday\n\t\t@age += 1\n\t\tabout(true)\n\tend", "def celebrate_birthday(age)\n\t\t\tage = @age\n\t\t\tage + 1\n\t\tend", "def celebrate_birthday\n\t\t@age += 1\n\tend", "def celebrate_birthday\n\t\t@age += 1\n\tend", "def celebrate_birthday\r\n\t\t@age += 1\r\n\tend", "def celebrate_birth...
[ "0.61577225", "0.6135849", "0.60823715", "0.60823715", "0.60721546", "0.60409033", "0.60383934", "0.6026922", "0.6012647", "0.5918162", "0.59168875", "0.59168875", "0.5915824", "0.5908193", "0.5894481", "0.58818865", "0.585106", "0.5849952", "0.5849952", "0.5849952", "0.58261...
0.6877508
0
reads sident from webservice and change it for students
def repair_sident(indices) @@mylog.info "There are %i students" % indices.size @client = SOAP::NetHttpClient.new service = SERVICE_URL + SIDENT_SERVICE_PATH f = File.new("sident_errs.txt", "wb") indices.each do |index| @@mylog.info "Procesing index #%i" % index.id service_url = service % [index.student.birth_number, index.specialization.code] @@mylog.debug "Service url is: %s" % service_url begin sident = @client.get_content(service_url) rescue URI::InvalidURIError @@mylog.error "Bad service url %s" % service_url next end if sident =~ /<SIDENT>(.*)<\/SIDENT>/ sident = $1 @@mylog.info "Got sident %i" % sident if sident != "-1" index.update_attribute(:sident, sident) @@mylog.info "Updated sident" else @@mylog.error "Service returned bad code for student #%i" % index.id f.puts "%i, %s, %s, %s" % [index.id, index.student.display_name, index.student.birth_number, index.specialization.code] end end end ensure f.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_uic(birth_number)\n service = prepare_service(birth_number)\n @@logger.debug \"Trying service for student with bn #{birth_number}\"\n @@logger.debug service\n begin\n service_response = query_service(service)\n rescue Exception => e\n @@logger.error 'Something gone wrong with servi...
[ "0.6116094", "0.6046837", "0.6037891", "0.5998901", "0.59817576", "0.59674853", "0.59195304", "0.5898165", "0.5895579", "0.5892546", "0.58843505", "0.58116835", "0.58065975", "0.5803452", "0.5801357", "0.58009857", "0.5794507", "0.57696253", "0.5760095", "0.57466507", "0.5745...
0.64471924
0
removes , Ing from names
def remove_ings_from_lastname students = Student.find(:all, :conditions => "firstname like '%, Mgr.' or firstname like '%, Ing.'") @@mylog.info "There are %i students" % students.size students.each do |student| new_first = student.firstname[0..-7] @@mylog.info "Changing student #{student.display_name}" student.update_attribute(:firstname, new_first) @@mylog.info "New first name #{student.firstname}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decommafy\n gsub(/(.+), (.+)/) { |s| \"#{$2} #{$1}\" }.strip.squeeze(' ')\n end", "def clean_name(name)\n if name.present?\n name.gsub(/(\\s|-|\\.|,)/,'')\n end\n end", "def format_name(name)\n name.match(/\\,/).nil? ? name : \"#{name.split(\", \").reverse.join(\" \")}\"\...
[ "0.70201904", "0.692563", "0.6634512", "0.647524", "0.6436294", "0.6103208", "0.6097855", "0.6097855", "0.60813886", "0.6057161", "0.6024773", "0.6012544", "0.5993728", "0.5979346", "0.59728575", "0.59728575", "0.59635544", "0.59599197", "0.5939945", "0.5928204", "0.5914653",...
0.0
-1
creates copy of specializations with S on end of code
def copy_old_corridors(specializations) specializations.map {|c| c.clone.save c.code = "%sS" % c.code c.accredited = false c.save c } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def templates=(_arg0); end", "def specializeMethodOrConstructor(newMethodName, arguments, store = Store.new)\n #this collection contains the parameters that need to be removed because the arguments passed in for the parameters are compile time\n paramsToRemove = []\n\n #loop through all the arguments an...
[ "0.54380274", "0.54292226", "0.5273696", "0.51965106", "0.5109746", "0.50951195", "0.5011174", "0.4951381", "0.49502075", "0.48915944", "0.48915944", "0.48778608", "0.48778608", "0.48767236", "0.48662916", "0.48567697", "0.48529667", "0.48314938", "0.4823196", "0.48209405", "...
0.5362502
2
copies corridor subject from one to another corridor
def copy_corridor_subject(from_specialization, to_specialization) SpecializationSubject.find_all_by_specialization_id(from_specialization).each {|cs| csn = cs.clone csn.update_attribute(:specialization_id, to_specialization) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_to(other); end", "def assign_canned_subject\n self.subject = canned_subject\n end", "def combine_subjects\n @sentences.each_cons(2) do |s1, s2|\n if s1.subject == s2.subject\n s2.subject = Pronoun.new(s1.subject.gender)\n end\n end\n end", "def copy(new_prefix, other_vals...
[ "0.62365746", "0.590587", "0.5584064", "0.55696654", "0.54849213", "0.5470133", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53966343", "0.53887695", "0.53752095", "0.5329787", "0.529699", "0.52954537", "0.5282319", "0.5...
0.77002716
0
adds corridor subjects from type and subjects ids
def add_corridor_subjects(specialization_id, type, *ids) ids.each {|i| type.create(:subject_id => i, :specialization_id => specialization_id) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject_ids=(*ids)\n ids.flatten!\n subjects = subscribables_subscriptions.find(:all, :conditions => { :subscribable_type => 'Subject' })\n subscribables_subscriptions.delete(subjects)\n subscribables.reload\n unless ids == [0]\n ids.delete('0')\n subscribables << Subject.find_all_by_i...
[ "0.5937251", "0.58760554", "0.5841737", "0.57777596", "0.57418853", "0.5698272", "0.564167", "0.5517109", "0.55109835", "0.54901993", "0.545795", "0.5440346", "0.5438689", "0.5360564", "0.5348204", "0.5291302", "0.5288366", "0.5284829", "0.52696025", "0.5267824", "0.5262338",...
0.8289575
0
TEST URLS Gets the top entry of the LIST_FILE, returns it, if the file is not empty and deletes the entry from the file.
def get_next_list_entry! begin # Read out every line of list file # into an array full_file = [] File.open(@list_file, 'r') do |file| while _line = file.gets unless _line == '' || _line.start_with?('#') full_file << _line.sub(/\n/, '') end end end # If the array is not empty, shift the first # entry into an output variable and save the # shifted array in the file by overwriting. # Then, return the output variable if !full_file.empty? _out = full_file.shift.split('|') File.open(@list_file, 'w') do |file| full_file.each { |ln| file.puts ln } end return _out end return nil rescue Exception => e puts "[FATAL ERROR] in 'DavidGetter#get_next_list_entry': #{e}" exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list(url, directory)\n puts \"Pulling \" + url\n package_list = HTTP.get url\n # Saves the file to list.json\n if File.open(directory + 'list.json', 'w') { |file| file.write(package_list) }\n puts \"Downloaded lits.json to \".green + directory.green\n end\nend", "def delete_list_member(f)\n F...
[ "0.56352484", "0.5620324", "0.55731684", "0.55662125", "0.5500732", "0.54530996", "0.54254276", "0.5311705", "0.5285505", "0.5261224", "0.5246744", "0.5213407", "0.5176522", "0.5166932", "0.51295173", "0.5122836", "0.5098937", "0.50776595", "0.50772977", "0.50565594", "0.5042...
0.5609063
2
Get the first image url from a website by link
def get_image_url (origin_url) begin html = open(origin_url).read urls = URI.extract(html) .select { |lnk| lnk[/\.jpg$|\.png$|\.gif$|\.jpeg/m] } return urls.empty? ? nil : urls[0] rescue Exception => e puts "[ERROR] in 'DavidGetter#get_image': #{e}" return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_image_url(link)\n url = nil\n if !link.nil?\n url = image_url_instagram link if (link.index('instagr.am') || link.index('instagram.com'))\n url = image_url_picplz link if link.index 'picplz'\n url = image_url_twitpic link if link.index 'twitpic'\n url = image_url_yfrog link if li...
[ "0.7842618", "0.7757024", "0.75224406", "0.7297792", "0.72739816", "0.71515715", "0.71481353", "0.7114568", "0.705758", "0.6992823", "0.6981656", "0.6940127", "0.69209826", "0.68506926", "0.6827599", "0.681797", "0.6805199", "0.6736064", "0.6727465", "0.6631616", "0.662678", ...
0.72258526
5
Download image by image url and save it to file
def dl_image (url) _filename = @img_path + '/' + url.split('/').last begin if !File.directory?(@img_path) require 'fileutils' FileUtils::mkdir_p @img_path puts "[INFO] created path '#{@img_path}'" end puts "[INFO] writing image file '#{_filename}'" File.open(_filename, 'wb') do |file| file.write open(url).read end return _filename rescue Exception => e puts "[ERROR] in 'DavidGetter#dl_image': #{e}" end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download( url )\n image = open( \"#{url}.jpg\" ).read\n File.write @path, image\n end", "def save_image_to_file( image_url, filename )\n image_uri = URI.parse( image_url )\n data = Net::HTTP.get_response( image_uri.host, image_uri.path ).body\n open( filename, 'w' ) do |f|\n f.write( da...
[ "0.8675342", "0.8023153", "0.7759042", "0.75892997", "0.75708723", "0.75036615", "0.7479027", "0.74535763", "0.74535763", "0.7332216", "0.722876", "0.7179486", "0.70956534", "0.7051066", "0.70368344", "0.7001597", "0.6983319", "0.6982645", "0.69601375", "0.694726", "0.6924285...
0.6971018
18
Get top url from iMG list, get url of image out of that url and download the file returning the file path after success.
def get_next _info = self.get_next_list_entry! unless _info.nil? _url = _info[0] _imgurl = self.get_image_url _url unless _imgurl.nil? _filename = self.dl_image _imgurl return { 'filename' => _filename, 'author' => _info[1], 'title' => _info[2], 'origin' => _url } end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_image\n Net::HTTP.start(@uri.host, @uri.port) do |http|\n\tif http.head(@uri.request_uri).code == \"200\"\n\tresp = http.get(@tempo.link)\n\topen(\"public/images/original/#{@original_image_name}\", \"wb\") do |file|\n\t file.write(resp.body)\n\tend\n end\n end\n end", "def download_im...
[ "0.723736", "0.7030896", "0.7027722", "0.69912356", "0.6897342", "0.68823", "0.6858112", "0.6749199", "0.6727789", "0.6681844", "0.66760135", "0.6673684", "0.66621995", "0.6653859", "0.66529506", "0.6650706", "0.6621601", "0.6542539", "0.65372795", "0.6476612", "0.6472112", ...
0.0
-1
Breaks out the given name (key in the provided hash) into first and last, to be compared to email parts
def determine_name_parts(name) @first_name = name[0..name.index(" ")].strip.downcase @last_name = name[name.index(" ")..name.length].strip.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_in_name(thing)\n return unless thing.include?(\"@\")\n parts = thing.split(\" \")\n emails = parts.reject { |part| !part.include?(\"@\") }\n results = []\n Array(emails).each do |email|\n id = email.split('@')[0]\n results << (login_name(id) || results_hash(mail: [e...
[ "0.68803895", "0.60028666", "0.5841405", "0.58245814", "0.5779989", "0.57155174", "0.56763613", "0.55923903", "0.5555105", "0.55503273", "0.55173415", "0.5493623", "0.5477868", "0.5423242", "0.5420122", "0.5419688", "0.5414454", "0.5413704", "0.5408585", "0.5391888", "0.53767...
0.563035
7
Breaks out email parts similarly to be compared to first and last names above to determine email format later
def set_email_parts(email) #If instance of EmailObject already has a value for email, then we're setting #another with another email format, append them accordingly. if @email.nil? @email = email @first_local_part = email[0..email.index(".") - 1].strip.downcase @last_local_part = email[email.index(".") + 1..email.index("@") - 1].strip.downcase @domain = email[email.index("@") + 1..email.length].strip.downcase else @email = @email + " or " + email @first_local_part = @first_local_part + "," + email[0..email.index(".") - 1].strip.downcase @last_local_part = @last_local_part + "," + email[email.index(".") + 1..email.index("@") - 1].strip.downcase @domain = email[email.index("@") + 1..email.length].strip.downcase end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser_email(line)\n if line.include? MailHeader.from\n fields=line.split(MailHeader.key_separator)\n if fields.length>1\n\t\t\t\tvalue=fields[1].split(\" \")\n if value.length>1\n firstname_lastname=value[0];\n email_address=value[1].gsub(/[<>]/,'')\n company_url...
[ "0.69811", "0.68171275", "0.6684519", "0.66841555", "0.65945596", "0.6575596", "0.6541155", "0.6524848", "0.64863837", "0.6403251", "0.63669395", "0.63220716", "0.632016", "0.6308765", "0.62817734", "0.62810695", "0.6272382", "0.62651664", "0.62637085", "0.62537616", "0.62440...
0.6696235
2
For each keyvalue pair in the second provided hash, predict the email given the format(s) in company_email_format_hash
def predict_email(prediction_dataset_hash) prediction_dataset_hash.each do |name, domain| new_email = EmailObject.new(name) new_email.domain = domain if @company_email_format_hash.key? domain new_email.email_format = @company_email_format_hash[domain] puts "Name: #{new_email.name} Domain: #{new_email.domain} Format:#{new_email.email_format}" if !new_email.email_format.include? "," generate_email_address(new_email,new_email.email_format) else new_email.email_format.split(",").each do |format| generate_email_address(new_email, format) end end else puts "We can't predict the email for " + new_email.domain + " as it wasn't in the sample hash" end puts "Email:#{new_email.email}" puts "\n" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emails_to_hash(emails)\n {\n :primary => emails.find { |email| email.primary }.email,\n :additional => emails.select { |email| !email.primary && email.verified}.map { |email| email.email }\n }\nend", "def read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, ...
[ "0.5980221", "0.5902993", "0.5503901", "0.54622376", "0.5426123", "0.5385771", "0.53739285", "0.53543955", "0.53529567", "0.534108", "0.5340184", "0.5290035", "0.5247238", "0.5213672", "0.5188327", "0.51502", "0.50781226", "0.5064934", "0.50607044", "0.5059193", "0.5049328", ...
0.7308328
0
Returns map of word to ending position of word in input.
def substrings(words, input) result = Hash.new {|h,k| h[k] = Set.new} l = input.length words.each do |word| i = 0 while i + word.length <= l j = input.index(word, i) break if ! j result[word] << j + word.length i = j + 1 end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_word_end_marks(startpos, endpos)\n startpos = 0 if startpos < 0\n endpos = self.size if endpos > self.size\n search_str = self[(startpos)..(endpos)]\n return if search_str == nil\n wsmarks = scan_indexes(search_str, /(?<=\\p{Word})[^\\p{Word}]/)\n wsmarks = wsmarks.collect { |x| x + start...
[ "0.6605645", "0.613523", "0.5933685", "0.5891929", "0.58277684", "0.5756427", "0.56902885", "0.56832784", "0.56231576", "0.5605986", "0.5581165", "0.55264384", "0.55207485", "0.55062765", "0.54799604", "0.5407607", "0.53735477", "0.5367364", "0.53637606", "0.53330296", "0.532...
0.0
-1
1. For a given person, return their favourite tv show
def tv_show(person) return person[:favourites][:tv_show] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tv_show(person)\n tv_show = person[:favourites][:tv_show]\n return tv_show\nend", "def fav_tv_show(person)\n return person[:favourites][:tv_show]\nend", "def get_favourite_tv_show(person)\n return person[:favourites][:tv_show]\nend", "def get_tv_show(person)\n return person[:favourites][:tv_show]\ne...
[ "0.7669126", "0.74630356", "0.7420349", "0.7370223", "0.7161871", "0.71301794", "0.71096283", "0.69950676", "0.68426484", "0.6778154", "0.676397", "0.6762284", "0.6553473", "0.65082234", "0.6430549", "0.6378693", "0.63551176", "0.6304187", "0.6287841", "0.6226974", "0.6220912...
0.7502839
1
2. For a given person, check if they like a particular food
def favourite_foods(person, food) return person[:favourites][:things_to_eat].include?(food) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def like_food?(food, person)\n person[:favourites][:things_to_eat].include?(food)\nend", "def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend", "def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend", "def likes_to_eat(person, foo...
[ "0.7919499", "0.78323776", "0.77574116", "0.7713096", "0.751024", "0.7380237", "0.7305857", "0.7177955", "0.70903224", "0.6897792", "0.66555876", "0.66448325", "0.66385484", "0.66385484", "0.6511732", "0.6496382", "0.64185596", "0.64185596", "0.6361961", "0.6361961", "0.62514...
0.7660454
4
3. Allow a new friend to be added to a given person Amend to properly test whether the function actually appends the friend to the array. As it is, the test would pass if another friend named "Mick Jagger" were already in the array, but the function added nothing
def add_friend(person, friend) return person[:friends].push(friend) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_friend(person, new_friend)\n person[:friends].push(new_friend)\n return person[:friends].length()\nend", "def new_friend(person, new_friend)\n return person[:friends] << new_friend\nend", "def add_friend(person, friend_to_add)\n person[:friends] << friend_to_add\n return person[:friends].length()\...
[ "0.73931926", "0.72478646", "0.71059775", "0.7091791", "0.70035666", "0.6995056", "0.6995056", "0.6811375", "0.64103395", "0.62606937", "0.62432367", "0.62128067", "0.61727315", "0.6167333", "0.61582047", "0.61464274", "0.6122372", "0.6022118", "0.60167253", "0.60007757", "0....
0.70344627
4
4. Allow a friend to be removed from a given person Flawed because the [:friends] array could include more than one friend with the same name. You would only want to remove one of them, not all.
def remove_friend(person, friend) # binding.pry person[:friends].delete(friend) return person[:friends] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_friend(person, friend)\n person[:friends].delete(friend)\nend", "def remove_friend(person, friend)\n person[:friends].delete(friend)\nend", "def remove_friend(person, friend_to_remove)\n person[:friends].delete(friend_to_remove)\n return person[:friends].length()\nend", "def remove_friend\n ...
[ "0.8279636", "0.8279636", "0.825414", "0.78877383", "0.7786883", "0.71954906", "0.7155082", "0.68473107", "0.6845949", "0.68290174", "0.6815851", "0.6774512", "0.67719716", "0.67620695", "0.67279917", "0.6683872", "0.66582966", "0.66195554", "0.6601869", "0.6590391", "0.65120...
0.7881897
4
5. Find the total of everyone's money
def total_money(people) total = 0 for person in people total += person[:monies] end return total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend", "def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end", "def test_sum_money_works\n result = sum_money(@peopl...
[ "0.7326089", "0.7257883", "0.71865255", "0.71106976", "0.7099457", "0.7091431", "0.7044157", "0.70200515", "0.7013855", "0.6976792", "0.69635546", "0.69558024", "0.69454443", "0.6941253", "0.69317925", "0.69196814", "0.6913313", "0.6885583", "0.68793327", "0.6865523", "0.6862...
0.7045997
7
6. For two given people, allow the first person to loan a given value of money to the other
def loan(lender, lendee, amount) lendee_balance = lendee[:monies] + amount lender_balance = lender[:monies] - amount return [lender_balance, lendee_balance] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loan_money(person_lending, person_receiving, loan)\n person_lending[:monies] -= loan\n person_receiving[:monies] += loan\nend", "def loan_money_to_other(lender, lendee, amount)\n lender[:monies] -= amount\n lendee[:monies] += amount\nend", "def loan_money(lender, lendee, amount)\nlender[:monies] -= amo...
[ "0.720353", "0.7112266", "0.6799679", "0.67730445", "0.6648425", "0.6536027", "0.63850546", "0.6319459", "0.6268873", "0.62365645", "0.61992204", "0.61785495", "0.61775845", "0.6167444", "0.6129317", "0.6103868", "0.6019733", "0.6013706", "0.6006992", "0.5998496", "0.5981781"...
0.6720866
4
7. Find the set of everyone's favourite food joined together
def all_foods(people) all_foods = [] for person in people all_foods.concat(person[:favourites][:things_to_eat]) end return all_foods end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def every_favourite_food(people)\n #Create a empty array to save all the strings\n all_food = \"\"\n #For loop to iterate person in the array people\n for person in people\n #For loop to iterate in snacks in person\n for snacks in person[:favourites][:snacks]\n #adds new items to the array\n p ...
[ "0.68981284", "0.68822867", "0.6614809", "0.6601522", "0.6590655", "0.6584551", "0.65645766", "0.65544635", "0.64366883", "0.64355934", "0.63708866", "0.63336664", "0.6217467", "0.6215299", "0.62020653", "0.6173818", "0.6133609", "0.6123532", "0.6097411", "0.6075723", "0.6061...
0.68072504
2
8. Find people with no friends .empty? is perhaps better to use?
def no_friends(people) no_friends = [] for person in people if person[:friends] == [] no_friends.push(person[:name]) end end return no_friends end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_no_friends(people)\n no_mates = []\n for person in people\n if person[:friends].length == 0\n no_mates.push(person)\n end\n end\n return no_mates\nend", "def find_people_with_no_friends(people)\n no_friends_array = []\n for person in people\n if person[:friends].length() == 0\n ...
[ "0.7859189", "0.7844656", "0.7781487", "0.7568054", "0.68728745", "0.68686306", "0.6855461", "0.6831718", "0.6800421", "0.6783305", "0.6769409", "0.6767883", "0.6767883", "0.6694006", "0.66837823", "0.6677382", "0.6677382", "0.6631069", "0.6629533", "0.66094846", "0.6600293",...
0.7611207
3
INSANE Find the people who have the same favourite tv show
def same_tv_show(people) people_and_their_shows = [] for person in people people_and_their_shows.push({ person[:favourites][:tv_show]=> person[:name] }) end # The next line of code was made possible by glenn mcdonald's answer here: # http://stackoverflow.com/questions/5490952/merge-array-of-hashes-to-get-hash-of-arrays-of-values?rq=1 merged_people_and_shows = people_and_their_shows.reduce({}) {|h,pairs| pairs.each {|k,v| (h[k] ||= []) << v}; h} # binding.pry merged_people_and_shows.each do |key, value| # binding.pry if value.length < 2 merged_people_and_shows.delete(key) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_favourite_tv_show(people)\n tv_shows = []\n for person in people\n tv_shows.push(person[:favourites][:tv_show])\n end\n\n same_show = []\n count = 0\n\n for show in tv_shows\n if tv_shows.count(show) > 1\n same_show.push(count)\n end\n count += 1\n end\n\n result = []\n for index...
[ "0.7872839", "0.7553552", "0.73653543", "0.73603415", "0.63575584", "0.6047088", "0.6034171", "0.6013636", "0.5986206", "0.5981018", "0.59420466", "0.5892891", "0.5871625", "0.58704853", "0.58329", "0.580362", "0.57606626", "0.5753612", "0.5713719", "0.56944746", "0.56551397"...
0.6425702
4
def bin_decision_backup(past_yield, desired_yield) if(past_yield <= desired_yield) bin = 1 else bin = rand(2..10) end return bin end
def bin_decision(threshold) tmp = rand(1..100) if(tmp <= threshold) bin = 1 else bin = rand(2..10) end return bin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_gen\n rand100 = rand(1..100)\n if (0..50).cover?(rand100)\n output_val = 1\n elsif (51..75).cover?(rand100)\n output_val = 2\n elsif (76..90).cover?(rand100)\n output_val = 3\n elsif (91..95).cover?(rand100)\n output_val = 4\n elsif (96..100).cover?(rand100)\n ...
[ "0.6501454", "0.64549047", "0.64001167", "0.63501245", "0.63500243", "0.6141074", "0.6114508", "0.60487866", "0.59814036", "0.59814036", "0.59814036", "0.5966036", "0.59596086", "0.5950158", "0.59330815", "0.5932772", "0.5895907", "0.5883795", "0.583623", "0.5817098", "0.5809...
0.79586697
0
Only allow a trusted parameter "white list" through.
def professor_params params.require(:professor).permit(:name, :professor_id, :email, :admin, :password, :password_confirmation) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
This should be passed either: 1: A name or ID for the things to retrieve from the server 2: A preretrieved blob of JSON.
def initialize(blob,*rest) case when blob.is_a?(String) || blob.is_a?(Integer) @blob,res = REST.get("#{self.class.path}/#{blob}") raise("Failed to get #{self.class.name} object named #{name}") if res != 200 when blob.is_a?(Hash) && blob["id"] @blob = blob else raise("Cannot cast #{blob.inspect} into a #{name}}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta\n blob = ActiveStorage::Blob.find_signed(params[:id])\n\n render json: { blob: blob, url: rails_blob_url(blob) }\n end", "def blob(id)\n head \"/blobs/#{id}\"\n end", "def get_object(id)\n return nil unless (blob = find_blob(id)) && (obj = blob.read_object(id))\n deserialize(obj)\...
[ "0.60337645", "0.5984096", "0.586606", "0.58217174", "0.5819593", "0.56618345", "0.5627939", "0.5559886", "0.55071396", "0.548059", "0.5458331", "0.5437207", "0.5394814", "0.53879803", "0.53598005", "0.5349231", "0.5328785", "0.5321275", "0.53176373", "0.5315606", "0.53079975...
0.5668355
5
sequence is Array of Sequence object (or Enumerator)
def process_sequence(sequence) @current_node = @init_node sequence.each do |instance| next_label = instance.label next_node = @label_to_node[next_label] if !next_node next_node = Node.new next_node.label = next_label next_node.output = instance.output @label_to_node[next_label] = next_node end @labels.add next_label @outputs.add instance.output @current_node.add_obj(instance, @seq_n) @graph.add_edge(@current_node, next_node) @current_node = next_node end @graph.add_edge(@current_node, @end_node) @seq_n += 1; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence()\n if !defined?(@sequence) or @sequence.nil? then\n @sequence = []\n each_sequence_member() {|member| @sequence << member }\n end\n \n return @sequence\n end", "def sequence()\n if !defined?(@sequence) or @sequence.nil? then\n ...
[ "0.69599664", "0.69599664", "0.6674463", "0.6637912", "0.64463955", "0.6435159", "0.6418211", "0.63987774", "0.6295161", "0.6254222", "0.61786944", "0.6177585", "0.6150648", "0.614309", "0.60671854", "0.6046162", "0.6017982", "0.594593", "0.5925508", "0.5923922", "0.5875866",...
0.5620055
46
ask the given question and get the proper answer from a user
def get_user_input(question, range = nil) print "\n#{question} : " user_response = gets.chomp if range === nil then # check whether the user input is empty while user_response.empty? do print "\nError! You entered a wrong input!" + "\n#{question} : " user_response = gets.chomp end else # check whether the user input is an integer and also it is within the given range unless user_response.to_i.is_a?(Integer) && user_response.to_i.between?(0, range - 1) print "\nError! You entered a wrong input!" + "\n#{question} : " user_response = gets.chomp end end user_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_question_and_check_answer\n question = MathGame::Question.new\n puts \"#{@turn}: #{question.display_question}\"\n question.obtain_answer\n question.display_message_on_answer\n question.correct?\n end", "def ask question\n\twhile true\n\t\tputs question\n\t\treply = gets.chomp.downcase\n\n...
[ "0.77588826", "0.7662557", "0.76444864", "0.7618604", "0.75639653", "0.74911684", "0.7469871", "0.7467118", "0.7465404", "0.7462833", "0.7462138", "0.7448371", "0.7425379", "0.73847806", "0.73479426", "0.73365515", "0.73293495", "0.73152524", "0.72799134", "0.72641975", "0.72...
0.0
-1
Only allow a trusted parameter "white list" through.
def access_request_params params.require(:access_request).permit( :contact_email, :requested_by, :service_name, :reason, :environment_id, :client_pub_key_file, :client_pub_key ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
GET /sugerencia GET /sugerencia.json
def index @sugerencia = Sugerencium.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end", "def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.72761774", "0.68169713", "0.6796274", "0.6682284", "0.66280377", "0.6622965", "0.6590006", "0.65612096", "0.6553834", "0.6518124", "0.6517491", "0.64905596", "0.6483023", "0.6475718", "0.6470056", "0.6467829", "0.64613914", "0.6451942", "0.64466673", "0.6444898", "0.644489...
0.0
-1
GET /sugerencia/1 GET /sugerencia/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end", "def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7381647", "0.69704837", "0.6916371", "0.68250835", "0.6704583", "0.66801", "0.66680247", "0.66345376", "0.66262823", "0.6625202", "0.6597829", "0.6547812", "0.6535372", "0.65298617", "0.6510568", "0.65046555", "0.6483818", "0.6475019", "0.6472873", "0.64684963", "0.6464164...
0.0
-1
POST /sugerencia POST /sugerencia.json
def create @sugerencium = Sugerencium.new(sugerencium_params) respond_to do |format| if @sugerencium.save format.html { redirect_to @sugerencium, notice: 'Sugerencium was successfully created.' } format.json { render :show, status: :created, location: @sugerencium } else format.html { render :new } format.json { render json: @sugerencium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @suger...
[ "0.74463266", "0.66418415", "0.6555439", "0.65478534", "0.6546365", "0.6544737", "0.6540366", "0.6524748", "0.65196496", "0.6501394", "0.64934564", "0.6486315", "0.6480253", "0.64797366", "0.6476122", "0.6452414", "0.6436965", "0.6433962", "0.6425439", "0.6423424", "0.6416652...
0.62373537
50
PATCH/PUT /sugerencia/1 PATCH/PUT /sugerencia/1.json
def update respond_to do |format| if @sugerencium.update(sugerencium_params) format.html { redirect_to @sugerencium, notice: 'Sugerencium was successfully updated.' } format.json { render :show, status: :ok, location: @sugerencium } else format.html { render :edit } format.json { render json: @sugerencium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.htm...
[ "0.6919478", "0.65822756", "0.65767914", "0.6546006", "0.6529974", "0.6464133", "0.64206266", "0.6409226", "0.6391428", "0.63783514", "0.63776445", "0.6371563", "0.6363634", "0.6347548", "0.63392264", "0.63351893", "0.6311469", "0.6307112", "0.63061196", "0.6297077", "0.62958...
0.0
-1
DELETE /sugerencia/1 DELETE /sugerencia/1.json
def destroy @sugerencium.destroy respond_to do |format| format.html { redirect_to sugerencia_url, notice: 'Sugerencium was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_c...
[ "0.7420884", "0.72901267", "0.71937525", "0.70629305", "0.70629305", "0.7038623", "0.7030972", "0.70097893", "0.700909", "0.70057106", "0.70035386", "0.6988629", "0.6980195", "0.6967367", "0.69510376", "0.6941451", "0.6938542", "0.6938299", "0.6933731", "0.6920838", "0.692012...
0.7091897
3
Use callbacks to share common setup or constraints between actions.
def set_sugerencium @sugerencium = Sugerencium.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sugerencium_params params.require(:sugerencium).permit(:fecha, :titulo, :detalle) 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.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
when safari submits a form where no file has been selected, it does not transmit a contenttype and the result is an empty string ""
def test_no_file_uploaded_with_safari e = Resource.new assert_nothing_raised { e.file = "" } assert_equal nil, e.file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enctype; end", "def enctype=(_arg0); end", "def content_mime_type; end", "def content_type\n nil\n end", "def enctype_multipart\n enctype('multipart/form-data')\n end", "def mime_type\n return content_type\nend", "def mime_type; end", "def mime_type; end", "def mime_typ...
[ "0.7112963", "0.696698", "0.66016024", "0.64809066", "0.64719623", "0.6380976", "0.63598716", "0.63598716", "0.63598716", "0.63598716", "0.6342857", "0.63284516", "0.6280066", "0.6280066", "0.6280066", "0.6275984", "0.62507224", "0.6236363", "0.6236363", "0.6236363", "0.62363...
0.59024924
46
Find a move number of a possible fork:
def move_number_fork current = @game.current_player if current == :O @count_spots.last if @game.fork?.size > 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_fork(wins, forker, forkee)\n position_counts = count_positions(wins, forker, forkee)\n forking_moves = []\n position_counts.each do |position, count|\n forking_moves.push(position) if count > 1\n end\n forking_moves = (forking_moves - (forking_moves & forker))\n forking_moves.empty?...
[ "0.7214283", "0.67108524", "0.6621591", "0.65560275", "0.6528573", "0.635649", "0.6356065", "0.6356065", "0.6188072", "0.60513544", "0.6030303", "0.5945687", "0.5834187", "0.5826054", "0.57539535", "0.572253", "0.5696886", "0.56904507", "0.5681871", "0.562731", "0.55833095", ...
0.72230446
0
Use callbacks to share common setup or constraints between actions.
def set_health19 @health19 = Health19.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Only allow a trusted parameter "white list" through.
def health19_params params.require(:health19).permit(:Districts, :Target, :Selection, :Year) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7120904", "0.70538116", "0.69469863", "0.6901261", "0.67348766", "0.6717708", "0.66874576", "0.6676195", "0.66601187", "0.65563625", "0.6525127", "0.64565873", "0.64494514", "0.644928", "0.64452374", "0.6433947", "0.6412815", "0.6412815", "0.6391939", "0.63792473", "0.6379...
0.0
-1
GET /job_applications GET /job_applications.json
def index if current_user.admin? @new = JobApplication.where(state: @state) @vacancies = Vacancy.all else @job_assignments = JobAssignment.where(manager_id: current_user.id, reviewed: false) end respond_to do |format| format.html # show.html.erb format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @job_applications = JobApplication.all\n end", "def index\n @jobapplications = Jobapplication.all\n end", "def applications_list\n get \"applications\"\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eag...
[ "0.7649894", "0.764502", "0.7387177", "0.73761916", "0.7342064", "0.7204362", "0.7185809", "0.7047377", "0.7020832", "0.70059836", "0.6856699", "0.68265283", "0.68219966", "0.6801303", "0.6795594", "0.6754994", "0.67336607", "0.67336607", "0.672512", "0.67169476", "0.67136806...
0.0
-1
GET /job_applications/1 GET /job_applications/1.json
def show @vacancy = Vacancy.find(params[:id]) @new = JobApplication.where(state: "send", vacancy_id: @vacancy.id).includes(:user) @forwarded = JobApplication.where(state: "manager_review", vacancy_id: @vacancy.id).includes(:user) @reviewed = JobApplication.where(state: "manager_review_listed", vacancy_id: @vacancy.id).includes(:user) @employed = JobApplication.where(state: "employed", vacancy_id: @vacancy.id).includes(:user) @rejected = JobApplication.where(state: "rejected", vacancy_id: @vacancy.id).includes(:user) respond_to do |format| format.html # show.html.erb format.json { render json: @job_application } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @job_applications = JobApplication.all\n end", "def index\n @jobapplications = Jobapplication.all\n end", "def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).pe...
[ "0.73992616", "0.7387969", "0.7181728", "0.716288", "0.70688754", "0.705798", "0.6846004", "0.6846004", "0.6843619", "0.6792671", "0.67818606", "0.67695767", "0.67623425", "0.6675928", "0.6674146", "0.66518587", "0.66145766", "0.6613072", "0.6604981", "0.6604981", "0.6604981"...
0.0
-1
GET /job_applications/new GET /job_applications/new.json
def new @vacancy = Vacancy.find_by_id(params[:vacancy_id]) @job_application = JobApplication.new respond_to do |format| format.html # new.html.erb format.json { render json: @job_application } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n if params[:id].nil?\n redirect_to \"/\", :alert=>\"You need to apply through a job\"\n return\n end\n\n @job = Job.find(params[:id])\n @company = @job.company.name\n @title = @job.title\n\n @application = Application.new\n\n respond_to do |format|\n format.html# new.ht...
[ "0.78769815", "0.76448405", "0.7611983", "0.76089746", "0.75255907", "0.748417", "0.7333698", "0.73262423", "0.732238", "0.7320585", "0.729584", "0.729584", "0.729584", "0.729584", "0.7282727", "0.7282727", "0.72255003", "0.72139555", "0.7210812", "0.7123395", "0.71162766", ...
0.7592338
4
POST /job_applications POST /job_applications.json
def create @job_application = JobApplication.new(params[:job_application]) @vacancy = Vacancy.find_by_id(params[:vacancy_id]); if user_signed_in? && !current_user.admin? applicant = Applicant.find_by_id(current_user.id) @job_application.applicant_id = current_user.id @job_application.vacancy_id = @vacancy.id end respond_to do |format| if @job_application.save format.html { redirect_to @vacancy, notice: 'Job application was successfully created.' } format.json { render json: @job_application, status: :created, location: [applicant, @job_application] } else format.html { render action: "new" } format.json { render json: @job_application.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @jo...
[ "0.7440632", "0.74280643", "0.74198717", "0.7308676", "0.72082317", "0.70518476", "0.70083183", "0.6915704", "0.6885722", "0.6787565", "0.67020357", "0.6698185", "0.6562608", "0.64944416", "0.64358145", "0.6430998", "0.6424024", "0.6364738", "0.6354386", "0.6348297", "0.63115...
0.6225921
25
PUT /job_applications/1 PUT /job_applications/1.json
def update @job_application = JobApplication.find(params[:id]) respond_to do |format| if @job_application.update_attributes(params[:job_application]) format.html { redirect_to vacancy_path(@job_application.vacancy_id), notice: 'Job application was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @job_application.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @j_id = @application.job_id\n respond_to do |format|\n if @application.update(application_params)\n format.html { redirect_to @application, notice: 'Application was successfully updated.' }\n format.json { render :show, status: :ok, location: @application }\n else\n ...
[ "0.74310696", "0.7420781", "0.7347127", "0.729786", "0.72329706", "0.72329706", "0.7201282", "0.7197836", "0.71683437", "0.6954095", "0.6954095", "0.6900336", "0.6900336", "0.68689764", "0.68689764", "0.68689764", "0.68689764", "0.68689764", "0.68689764", "0.68689764", "0.684...
0.70274913
9
DELETE /job_applications/1 DELETE /job_applications/1.json
def destroy @job_application = JobApplication.find(params[:id]) @job_application.destroy respond_to do |format| format.html { redirect_to job_applications_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.77907234", "0.76370245", "0.76344377", "0.759618", "0.7492192", "0.7373139", "0.7373139", "0.73712915", "0.73712915", "0.732129", "0.7297743", "0.72826266", "0.72216356", "0.7197681", "0.71140724", "0.7089768", "0.70889133", "0.70451796", "0.70451796", "0.70451796", "0.704...
0.7635535
3
Return an array of primary region replicas tableName table to return regions for
def getPrimaryRegionEncodedNames(tableName) c = HBaseConfiguration.new() tableNameObj = TableName.valueOf(tableName) t = HTable.new(c, tableNameObj) regions = t.getRegionsInRange(t.getStartKeys[0], t.getEndKeys[t.getEndKeys.size-1]) priRegions = Array.new regions.each do |r| if (r.getRegionInfo().getReplicaId() == 0) priRegions << r.getRegionInfo().getEncodedName() end end priRegions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_regions(name, start_row = nil, end_row = nil)\n raise NotImplementedError, \"Getting the table regions is not supported yet\"\n end", "def getPrimaryDistribution(tableName)\n c = HBaseConfiguration.new()\n tableNameObj = TableName.valueOf(tableName)\n t = HTable.new(c, tableNameObj)\n r...
[ "0.6588477", "0.6113635", "0.5896268", "0.58489084", "0.5829196", "0.58112407", "0.57174903", "0.5666384", "0.5639907", "0.56119996", "0.55950606", "0.55498254", "0.5516848", "0.5445279", "0.543753", "0.5359669", "0.5347066", "0.5328389", "0.5319675", "0.53120387", "0.5307764...
0.7482731
0
Distribute the regions in the array passed uniformly across the server array provided
def distributePrimaryRegions(priRegions) c = HBaseConfiguration.new() admin = HBaseAdmin.new(c) servers = Array.new() dServers = Array.new() dServers = admin.getClusterStatus.getDeadServerNames() serv = admin.getClusterStatus.getServers() serv.each do |s| if (!dServers.include?(s)) servers << s.getServerName() end end count=0 totRS = servers.size() priRegions.each do |r| puts r+" will move to "+servers[count%totRS] move r,servers[count%totRS] count+=1 end puts priRegions.size().to_s() + "primary regions moved" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def divide_individually(array_with_number_of_addresses)\n possible_ranges = []\n num = self.to_num()\n bits_to_move = 32 - @bits\n remaining_addresses = self.free\n array_with_number_of_addresses.each() {|number_of_addresses_for_subnet|\n if (2 ** bits_to_move) < number_of_addresses_for_subnet\...
[ "0.5648439", "0.5311164", "0.5304631", "0.51253974", "0.50617677", "0.5017626", "0.49934906", "0.48969123", "0.48899093", "0.4840798", "0.4821756", "0.47919583", "0.47817144", "0.47581056", "0.47357437", "0.47319466", "0.47319466", "0.4725475", "0.47095367", "0.47092828", "0....
0.62527525
0
Check the allocations of primary region replication in the region servers in the cluster
def getPrimaryDistribution(tableName) c = HBaseConfiguration.new() tableNameObj = TableName.valueOf(tableName) t = HTable.new(c, tableNameObj) regions = t.getRegionsInRange(t.getStartKeys[0], t.getEndKeys[t.getEndKeys.size-1]) count = Hash.new(0) regions.each do |r| #puts r.getRegionInfo().getRegionNameAsString()+" id "+r.getRegionInfo().getReplicaId().to_s()+" enc name "+r.getRegionInfo().getEncodedName()+" server name "+r.getServerName().getHostname() z = count[r.getServerName().getHostname()] count[r.getServerName().getHostname()]=z+1 end count.each do |r,c| puts r.to_s()+" "+c.to_s() end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distributePrimaryRegions(priRegions)\n c = HBaseConfiguration.new()\n admin = HBaseAdmin.new(c)\n servers = Array.new()\n dServers = Array.new()\n dServers = admin.getClusterStatus.getDeadServerNames()\n serv = admin.getClusterStatus.getServers()\n serv.each do |s|\n if (!dServers.include?(s))\n ...
[ "0.61141026", "0.58475375", "0.56714237", "0.55815756", "0.5569497", "0.55681926", "0.5551988", "0.54876715", "0.5474694", "0.54607695", "0.5459429", "0.5452795", "0.54525924", "0.5408479", "0.5386651", "0.5383213", "0.5354983", "0.5354983", "0.5351252", "0.53347504", "0.5324...
0.0
-1
Initializes a new Ban object
def initialize(raw_ban) @raw_ban = raw_ban end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\r\n @owner = msg.sender\r\n @counter = 0\r\n @bets = Mapping.of( Integer => Bet ) ## type mapping( uint => Bet )\r\n end", "def initialize(name, bulbs)\n\t\t@name = name\n\t\t@bulbs = bulbs\n\tend", "def initialize (banco, numero_cuenta, saldo_cuenta = 0)\n @banco ...
[ "0.68401676", "0.656826", "0.65381145", "0.64578813", "0.6371757", "0.6274962", "0.62144697", "0.62128013", "0.6204669", "0.62019575", "0.61475253", "0.6133302", "0.6085256", "0.6084247", "0.60379523", "0.60094404", "0.6001493", "0.59995127", "0.59748083", "0.5948451", "0.593...
0.77015656
0
The player's Steam 64 bit ID
def steam_id raw_ban['SteamId'].to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def steam_id\n raw_friend['steamid'].to_i\n end", "def uid\n id && Base58GMP.encode(id)\n end", "def tuid\n self.player_id.to_s + self.team_id.to_s\n end", "def secret_ID(id = nil)\r\n return id ? id >> 16 : @id >> 16\r\n end", "def identifier\n SecureRandom.hex(16)\n end", "def u...
[ "0.73491544", "0.67257905", "0.66229326", "0.6490911", "0.6408611", "0.6287923", "0.6262609", "0.6262545", "0.6260919", "0.6202612", "0.62016654", "0.6170822", "0.616833", "0.6164912", "0.61478496", "0.6097115", "0.60859674", "0.6085555", "0.6085555", "0.6082716", "0.6076983"...
0.7306445
1
String containing the player's ban status in the economy.
def economy_banned_status raw_ban['EconomyBan'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n output = \"\"\n player = @game.player\n output << \"You won!! you have scaped with life from the castle!!! \"\n output << \"WELL DONE!!\"\n end", "def status()\r\n\t\treturn to_s() + \", #{total_guess_count()} guesses (#{bad_guess_count()} bad), won? #{won?}, lost? #{lost?}\"\r\n\tend",...
[ "0.6465956", "0.64026785", "0.6379537", "0.63592315", "0.6345788", "0.6337388", "0.63297904", "0.62974423", "0.619753", "0.6189802", "0.61089504", "0.6094221", "0.60374403", "0.60345924", "0.6032034", "0.60320145", "0.6027504", "0.6008943", "0.60056204", "0.59927166", "0.5975...
0.8089339
0
If a block is passed this method will call the block when the server is up and running. The block should return quickly.
def start(clientHandlerProc) @socket = Socket.new( AF_INET, SOCK_STREAM, 0 ) sockaddr = Socket.pack_sockaddr_in( @port, @addr ) @socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true) @socket.bind( sockaddr ) @socket.listen( 5 ) yield if block_given? while true break if @exit sleep 0.1 clientSock = nil begin clientSock, client_sockaddr = @socket.accept_nonblock rescue # Error, or nothing to accept. next end port, addr = Socket.unpack_sockaddr_in(client_sockaddr) if @doLog $logger.info "Server: Got connection from #{addr}:#{port}" if @doLog end Thread.new(clientSock, addr, port){ |clientSock, addr, port| begin clientHandlerProc.call(clientSock, addr, port) rescue => e $logger.error "Server: exception in client handler proc: #{$!}" $logger.error e.backtrace.join(" ") end } end @socket.close $logger.info "Server: exiting" if @doLog end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def when_ready(&block)\n handle :ready, &block\n end", "def begin!\n start_server\n end", "def run target, &block\n server = start target, &block\n server.wait_until_stopped\n self\n end", "def on_ready(&block)\n block_given? ? @_on_ready = block : @_on_ready\n end",...
[ "0.6784748", "0.6515248", "0.6513337", "0.6328749", "0.6220377", "0.61760056", "0.6168303", "0.6168303", "0.5948911", "0.59231967", "0.5921004", "0.5921004", "0.590557", "0.58605283", "0.58460635", "0.5815796", "0.576067", "0.576067", "0.57150215", "0.57049197", "0.56994814",...
0.0
-1
Due to `if Jets::Stack.has_resources?` check early on in the bootstraping process The code has not been built at that point. So we use a placeholder and will replace the placeholder as part of the cfn template build process after the code has been built and the code_s3_key with md5 is available.
def code_s3_key "code_s3_key_placeholder" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end", "def bucket_name\n 'ios-ksr-builds'...
[ "0.5726733", "0.5661511", "0.5531613", "0.55142844", "0.5394334", "0.5278653", "0.52558106", "0.52528733", "0.51931196", "0.51488304", "0.5136274", "0.51173973", "0.51095766", "0.5100951", "0.5076209", "0.504742", "0.5042179", "0.50356054", "0.5010599", "0.5001653", "0.497814...
0.7231689
0
DELETE /friendships/1 DELETE /friendships/1.json
def destroy raise @friendship = Friendship.all.sample @friendship.destroy respond_to do |format| format.html { redirect_to friendships_path, notice: 'Project was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id])\n @frien...
[ "0.8221355", "0.8084778", "0.79870325", "0.7875871", "0.77671146", "0.77334946", "0.7714659", "0.7688466", "0.768427", "0.76728183", "0.76411515", "0.7634922", "0.7602406", "0.7581604", "0.75702053", "0.7564261", "0.7549776", "0.749582", "0.74902916", "0.748306", "0.7479315",...
0.726128
30
Returns +true+ iff the current severity level allows for the printing of +DEBUG+ messages.
def debug?; @level <= DEBUG; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug?\n severity == :DEBUG\n end", "def debug?\n level <= DEBUG\n end", "def debug?\n level >= ASL_LEVEL_DEBUG\n end", "def debug?\n DEBUG == log_level\n end", "def debug?\n @level <= 0\n end", "def debug_logging\n log.level == Logge...
[ "0.83979154", "0.8258234", "0.80911684", "0.80764467", "0.7767665", "0.7196316", "0.71661764", "0.71177983", "0.70868945", "0.7083942", "0.7010531", "0.6979406", "0.69387895", "0.6937358", "0.6934885", "0.6867599", "0.6867599", "0.685835", "0.68517625", "0.6842682", "0.676083...
0.7382839
6
Returns +true+ iff the current severity level allows for the printing of +INFO+ messages.
def info?; @level <= INFO; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info?\n severity == :INFO\n end", "def info?\n level <= INFO\n end", "def info?\n level >= ASL_LEVEL_INFO\n end", "def informational?\n severity == 0\n end", "def info?\n @level <= 1\n end", "def info?; @loggers.first.level <= INFO; end", ...
[ "0.83859193", "0.8089953", "0.7860342", "0.73901504", "0.71243024", "0.6739494", "0.66157424", "0.64953405", "0.6285898", "0.6283893", "0.6129055", "0.6063748", "0.5954058", "0.5951774", "0.59431934", "0.5858298", "0.5844786", "0.57633334", "0.57496476", "0.5749371", "0.56526...
0.71250546
5
Returns +true+ iff the current severity level allows for the printing of +WARN+ messages.
def warn?; @level <= WARN; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warn?\n level <= WARN\n end", "def warn?\n level >= ASL_LEVEL_WARNING\n end", "def warn?\n @level <= 2\n end", "def warning?\n severity == :WARNING\n end", "def warning?\n level == 1\n end", "def warn?; @loggers.first.level <= WARN; end", ...
[ "0.8223114", "0.7938514", "0.7714942", "0.7605091", "0.7263491", "0.71076566", "0.6793042", "0.6791345", "0.67360073", "0.67079717", "0.6662894", "0.6534598", "0.63765335", "0.6294013", "0.62064004", "0.61641854", "0.6117844", "0.60956347", "0.60843235", "0.6075789", "0.60619...
0.7296957
5
Returns +true+ iff the current severity level allows for the printing of +ERROR+ messages.
def error?; @level <= ERROR; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error?\n severity == :ERROR\n end", "def error?\n level <= ERROR\n end", "def error?\n level >= ASL_LEVEL_ERR\n end", "def error?\n @level <= 3\n end", "def error?\n level == 2\n end", "def error?; @loggers.first.level <= ERROR; end", "def...
[ "0.77304804", "0.7616635", "0.73450714", "0.6940619", "0.686765", "0.64692503", "0.623947", "0.6180464", "0.61753416", "0.61362493", "0.6051478", "0.60292786", "0.6011104", "0.60038245", "0.60038245", "0.596217", "0.5952178", "0.59461826", "0.59132355", "0.58931124", "0.58799...
0.6369211
7
Returns +true+ iff the current severity level allows for the printing of +FATAL+ messages.
def fatal?; @level <= FATAL; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fatal?\n level <= FATAL\n end", "def fatal?\n level == 3\n end", "def fatal?\n level >= ASL_LEVEL_CRIT\n end", "def fatal?\n @level <= 4\n end", "def fatal?; @loggers.first.level <= FATAL; end", "def fatal?\n @loggers.any? { |logger| logger.respond_to?...
[ "0.77756155", "0.7150207", "0.7125422", "0.69832444", "0.6974065", "0.6700929", "0.6686336", "0.64078915", "0.6388756", "0.6341685", "0.6206407", "0.6029912", "0.60012996", "0.59957343", "0.589634", "0.58779365", "0.58617437", "0.58332825", "0.5798257", "0.5685233", "0.566904...
0.66925335
7
=== Synopsis Logger.new(name) Logger.new(name) === Args +logdev+:: The log device. This is a filename (String) or IO object (typically +STDOUT+, +STDERR+, or an open file). === Description Create an instance.
def initialize(logdev) @progname = nil @level = DEBUG @default_formatter = Formatter.new @formatter = nil @logdev = nil if logdev @logdev = LogDevice.new(logdev) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_logger(name, logdev, loglvl)\n logdev = [ global_logdev(name), logdev, $stderr ].find { |e| e }\n loglvl = [ global_loglvl(name), loglvl, Logger::INFO ].find { |e| e }\n logger = Logger.new(logdev)\n logger.level = loglvl\n logger.formatter = proc { |sev, datetime, progname, msg|\n...
[ "0.7649776", "0.73470795", "0.7044453", "0.6760448", "0.6678281", "0.66355383", "0.6634606", "0.64760494", "0.645018", "0.6426587", "0.64182603", "0.6361228", "0.6234812", "0.6170884", "0.6144222", "0.613529", "0.6068744", "0.6063894", "0.60565615", "0.59112936", "0.58935755"...
0.721984
2
Dump given message to the log device without any formatting. If no log device exists, return +nil+.
def <<(msg) unless @logdev.nil? @logdev.write(msg) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message)\n return unless debugging?\n\n logger.debug(message.to_s)\n nil\n end", "def output(message)\n return if disabled\n if Device.simulator?\n puts(message)\n else\n NSLog(message)\n end\n message\n end", "def debugonce(message)\n ...
[ "0.60039926", "0.58382386", "0.56024206", "0.55666196", "0.55440235", "0.55388784", "0.55302936", "0.5462529", "0.54331875", "0.53947324", "0.5375474", "0.53453916", "0.5311871", "0.5254254", "0.5251005", "0.5231307", "0.5220675", "0.52088624", "0.5199539", "0.5190324", "0.51...
0.5844435
1
Log a +DEBUG+ message. See info for more information.
def debug(progname = nil, &block) add(DEBUG, nil, progname, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug(message)\n log(0, message)\n end", "def debug(message)\n puts message if debug?\n end", "def debug(message)\n if DEBUG\n log message\n end\nend", "def debug(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_DEBUG, message)\n end", "def debug(msg)\n ...
[ "0.81238574", "0.8037817", "0.7993771", "0.79338396", "0.79313105", "0.79120904", "0.78907484", "0.78665197", "0.7861358", "0.7861358", "0.7839613", "0.78286034", "0.7825766", "0.7813897", "0.779124", "0.77861345", "0.773199", "0.7707478", "0.76958734", "0.7694209", "0.767791...
0.0
-1
Log a +WARN+ message. See info for more information.
def warn(progname = nil, &block) add(WARN, nil, progname, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warn message\n log Logger::WARN, message\n end", "def warn(msg)\n log.warn msg\n end", "def warn(msg)\n log(msg, level: Level::WARN)\n end", "def warn(msg); @logger.warn(msg); end", "def warn message; write WARN, message, caller[0] unless level > @level end", "def log_warn...
[ "0.84723234", "0.805111", "0.8026166", "0.80017537", "0.79737777", "0.79291064", "0.7920227", "0.78929764", "0.784341", "0.7820772", "0.7762179", "0.77461296", "0.77437407", "0.7740863", "0.7720108", "0.7701571", "0.7698247", "0.7688204", "0.7669562", "0.7648691", "0.7569844"...
0.70628035
56
Log an +ERROR+ message. See info for more information.
def error(progname = nil, &block) add(ERROR, nil, progname, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error(message)\n log(\"#{color(\"ERROR:\", :red, :bold)} #{message}\")\n end", "def error(msg)\n log.error msg\n end", "def error(message)\n logger.error(PROG_NAME) { message }\n end", "def error(message)\n # note, we always log error messages\n add(:error, message)\...
[ "0.7665498", "0.75884163", "0.7553211", "0.75189656", "0.75189656", "0.7481797", "0.7467938", "0.7434785", "0.7417396", "0.7389026", "0.7310417", "0.73073065", "0.729017", "0.7257062", "0.71727955", "0.71401644", "0.71396303", "0.7083497", "0.70831794", "0.7051143", "0.704389...
0.0
-1
Log a +FATAL+ message. See info for more information.
def fatal(progname = nil, &block) add(FATAL, nil, progname, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fatal message; write FATAL, message, caller[0] unless level > @level end", "def fatal(message)\n log(\"#{color(\"FATAL:\", :red, :bold)} #{message}\")\n end", "def fatal(message)\n log(4, message)\n end", "def fatal(msg)\n log(msg, level: Level::FATAL)\n end", "def fatal...
[ "0.81237775", "0.7936535", "0.7876504", "0.7806069", "0.7619184", "0.7555627", "0.7514704", "0.74702346", "0.7452359", "0.74346936", "0.74006814", "0.7318397", "0.7298454", "0.7294897", "0.7280418", "0.72745955", "0.7246595", "0.72340906", "0.71783423", "0.7109056", "0.706729...
0.6866033
26
Log an +UNKNOWN+ message. This will be printed no matter what the logger's level. See info for more information.
def unknown(progname = nil, &block) add(UNKNOWN, nil, progname, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unknown(*args, &block)\n logger_instance.unknown(args, &block)\n end", "def unknown(message)\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_EMERG, message)\n end", "def unknown(message = nil, progname = nil, &block)\n add(UNKNOWN, message, progname, &block)\n end", "def <<(message)\n ...
[ "0.70054436", "0.65999097", "0.65218997", "0.6402451", "0.61886585", "0.5943599", "0.5842592", "0.57028", "0.55858874", "0.5540516", "0.5508974", "0.5400999", "0.5396245", "0.53955823", "0.53819925", "0.53815335", "0.53673345", "0.5352537", "0.5333538", "0.5292616", "0.528780...
0.5244772
26
Close the logging device.
def close @logdev.close if @logdev end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @logdev.close if @logdev\n end", "def close\n @logdevs.each do |name, ld|\n ld[:dev].close\n end\n end", "def closeLog()\n @logger.close() ;\n end", "def close\n flush\n @log.close if @log.respond_to?(:close) && !@log.tty?\n @log = nil\n end", "def ...
[ "0.81122386", "0.7884688", "0.7607325", "0.75072706", "0.74091536", "0.7402672", "0.73840773", "0.7304757", "0.71073735", "0.6899726", "0.68814754", "0.68182427", "0.6670712", "0.6466136", "0.6224144", "0.6173834", "0.61599284", "0.6155557", "0.61449194", "0.6142942", "0.6099...
0.81379324
0
GET /teams GET /teams.json
def index @teams = policy_scope(Team) @user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def teams\n render json: @team_query\n end", "def index\n @teams = Team.all\n render json: @teams\n end", "def organization_teams\n get(\"/organizations/#{@default_org_slug}/teams/\")\n en...
[ "0.81233996", "0.8093715", "0.78999794", "0.78722113", "0.78547835", "0.78078264", "0.7747201", "0.77240586", "0.77240586", "0.76768875", "0.76768875", "0.7509183", "0.748406", "0.74762034", "0.7434379", "0.7405707", "0.738585", "0.73797023", "0.73748475", "0.73599476", "0.73...
0.0
-1
GET /teams/1 GET /teams/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team(id)\n get \"/teams/#{id}\"\n end", "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "def show\n @team = Team.find(params[:id])\n\n render json: @team\n end", "def show\n\t\t@team = Team.find(params[:id])\n\t\trender '/teams/show.jso...
[ "0.79965734", "0.7839026", "0.77549696", "0.7668721", "0.76588887", "0.7612523", "0.7592633", "0.75889164", "0.75806767", "0.7573229", "0.7573229", "0.7572959", "0.7543039", "0.7533832", "0.7533832", "0.75130427", "0.75130427", "0.75130427", "0.75130427", "0.747294", "0.74714...
0.0
-1
POST /teams POST /teams.json
def create @team = Team.new(team_params) authorize @team current_user.update team: @team respond_to do |format| if @team.persisted? format.html { redirect_to @team, notice: 'Team was successfully created.' } format.json { render :show, status: :created, location: @team } else format.html { render :new } format.json { render json: @team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @response = HTTParty.get('http://laxapi.herokuapp.com/api/teams')\n CreateTeamService.new.create_team_objects(@response)\n render :json => {\n :message => \" #{Team.count} teams have been created\",\n status: 200\n }\n end", "def create\n @team = Team.new(params[:team])\n...
[ "0.74072", "0.7352566", "0.72058403", "0.71848714", "0.70729256", "0.70230156", "0.70230156", "0.70230156", "0.69894767", "0.6969357", "0.69600475", "0.692509", "0.69239825", "0.69201565", "0.6915113", "0.6915113", "0.6915113", "0.6915113", "0.6915113", "0.6915113", "0.691511...
0.64705455
62
PATCH/PUT /teams/1 PATCH/PUT /teams/1.json
def update respond_to do |format| if @team.update(team_params) format.html { redirect_to @team, notice: 'Team was successfully updated.' } format.json { render :show, status: :ok, location: @team } else format.html { render :edit } format.json { render json: @team.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end", "def update\n @team = Team.find(params[:id])\n\n respond_to do |format|\n if @team.update_...
[ "0.7289483", "0.7120175", "0.7045829", "0.7030194", "0.70000815", "0.69931203", "0.69931203", "0.6977324", "0.6977324", "0.6977324", "0.6977324", "0.6977324", "0.6977324", "0.69671524", "0.6939162", "0.6861243", "0.68286526", "0.6816322", "0.6816322", "0.6810702", "0.68044317...
0.67115885
49
DELETE /teams/1 DELETE /teams/1.json
def destroy @team.destroy respond_to do |format| format.html { redirect_to teams_url, notice: 'Team was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @team = Team.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to teams_url }\n ...
[ "0.7868205", "0.7819776", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.7807478", "0.77657557", "0.77657557", "0.77657557", "0.77657557", "0.77476865", "0.7617056", "0.75655633...
0.75439465
22
Use callbacks to share common setup or constraints between actions.
def set_team @team = Team.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def team_params params.require(:team).permit(:name, :image_url, :invite_parms) 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.6978086", "0.6780264", "0.6742658", "0.6738813", "0.67338693", "0.65908474", "0.6501793", "0.6495506", "0.64796513", "0.64755446", "0.6454826", "0.6437561", "0.6377127", "0.63722163", "0.6364058", "0.63178706", "0.62979764", "0.62968165", "0.62913024", "0.6289789", "0.6289...
0.0
-1
GET /ios_topbars/1 GET /ios_topbars/1.json
def show @ios_topbar = @user.ios_topbar if @ios_topbar == nil @ios_topbar = @user.build_ios_topbar render action: "new" else respond_to do |format| format.html # show.html.erb format.json { render json: @ios_topbar } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end", "def index\n @barns = current_user.barns\n\n set_page_title\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @barns }\n end\n end", "def show\n ...
[ "0.66528857", "0.6166441", "0.60621494", "0.6062122", "0.60161376", "0.5995399", "0.5873841", "0.58144885", "0.5767542", "0.57427114", "0.5711255", "0.5693885", "0.56908983", "0.568174", "0.56807774", "0.5676478", "0.5645216", "0.56350785", "0.5589838", "0.55607957", "0.55446...
0.6150471
2
GET /ios_topbars/new GET /ios_topbars/new.json
def new @ios_topbar = @user.build_ios_topbar respond_to do |format| format.html # new.html.erb format.json { render json: @ios_topbar } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created...
[ "0.67649686", "0.6763822", "0.6451191", "0.6434442", "0.63553584", "0.63374573", "0.62913173", "0.6272199", "0.6260369", "0.62488884", "0.6220289", "0.61899066", "0.6173362", "0.6168536", "0.6167665", "0.6144411", "0.61321086", "0.6129298", "0.61153615", "0.6110055", "0.61036...
0.70895004
0
POST /ios_topbars POST /ios_topbars.json
def create @ios_topbar = @user.build_ios_topbar(params[:ios_topbar]) respond_to do |format| if @ios_topbar.save format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } } format.json { render json: @ios_topbar, status: :created, location: @ios_topbar } else format.html { render action: "new" } format.json { render json: @ios_topbar.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @ios_topbar = @user.build_ios_topbar\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ios_topbar }\n end\n end", "def top_bar\n raise \"No top level progress bar\" unless @top_bar\n\n @top_bar\n end", "def destroy\n @ios_t...
[ "0.63054585", "0.58808243", "0.5842777", "0.5764179", "0.5598212", "0.5550156", "0.55280316", "0.54193044", "0.5368331", "0.53079444", "0.5147426", "0.5113014", "0.50867176", "0.5082762", "0.5045289", "0.5043123", "0.503894", "0.5021577", "0.49959806", "0.49874905", "0.496399...
0.6848883
0
PUT /ios_topbars/1 PUT /ios_topbars/1.json
def update @ios_topbar = @user.ios_topbar respond_to do |format| if @ios_topbar.update_attributes(params[:ios_topbar]) format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully updated.' } } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @ios_topbar.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @ios_topbar = @user.build_ios_topbar(params[:ios_topbar])\n\n respond_to do |format|\n if @ios_topbar.save\n format.html { redirect_to user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully created.' } }\n format.json { render json: @ios_topbar, status: :created...
[ "0.6147237", "0.58415157", "0.5777632", "0.5756605", "0.56879574", "0.56521755", "0.56232065", "0.5592485", "0.55634034", "0.5460779", "0.5442371", "0.54187995", "0.54149514", "0.53758353", "0.53338075", "0.53068495", "0.5272955", "0.5256504", "0.52412534", "0.5218861", "0.52...
0.69610995
0
DELETE /ios_topbars/1 DELETE /ios_topbars/1.json
def destroy @ios_topbar = @user.ios_topbar @ios_topbar.destroy respond_to do |format| format.html { redirect_to new_user_ios_topbar_url, :flash => { success: 'Top Bar Color successfully deleted.' } } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n # Make sure the request came from an admin\n unless session[:admin_id]\n redirect_to_home\n return\n end\n \n @bar = Bar.find(params[:id])\n @bar.destroy\n\n respond_to do |format|\n format.html { redirect_to bars_url }\n format.json { head :no_content }\n en...
[ "0.67203504", "0.6693712", "0.66052395", "0.6596948", "0.65449905", "0.6540875", "0.65384316", "0.65342724", "0.65323496", "0.65127444", "0.6466629", "0.64347625", "0.64247054", "0.63976705", "0.6392009", "0.63696116", "0.63678545", "0.6366376", "0.6366376", "0.63474625", "0....
0.7557382
0
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Video Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter
def videos_test end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_video_element(video_doc, video_options)\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:thumbnail_loc').text).to eq(video_options[:thumbnail_loc])\n expect(video_doc.at_xpath('video:gallery_loc').text).to eq(vi...
[ "0.5891938", "0.5838972", "0.58306587", "0.5765835", "0.5723487", "0.5677557", "0.5674475", "0.56693363", "0.5656986", "0.5590565", "0.55620307", "0.5522716", "0.54958296", "0.54794925", "0.5467298", "0.5377037", "0.53142023", "0.53003246", "0.52932036", "0.52903837", "0.5275...
0.66605896
0
Description Test useful to check correctness of conversion and cross browser visibility of all elements of kind Audio Mode Html Specific filters ApplicationControlleradmin_authenticate Skipped filters ApplicationControllerauthenticate ApplicationControllerinitialize_location ApplicationControllerinitialize_players_counter
def audios_test end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.find_element(@@список_смартфонов) }\n rescue => e\n error('Eti mob...
[ "0.56154615", "0.5464052", "0.54391384", "0.53845745", "0.5375689", "0.5348216", "0.5299415", "0.52725124", "0.5262615", "0.5251521", "0.5251047", "0.52241135", "0.51914674", "0.51686305", "0.51580733", "0.51398253", "0.5126495", "0.51260114", "0.51169014", "0.51077414", "0.5...
0.6196123
0
Description Main page of the section 'elements'. When it's called via ajax it's because of the application of filters, paginations, or after an operation that changed the number of items in the page. Mode Html + Ajax Specific filters ApplicationControllerinitialize_layout MediaElementsControllerinitialize_paginator
def index get_own_media_elements if @page > @pages_amount && @pages_amount != 0 @page = @pages_amount get_own_media_elements end render_js_or_html_index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @page_elements = @page.page_elements\n if (@page)\n @mainelements = @page.page_elements.where(visible: true,sidebar: false)\n @sidebarelements = @page.page_elements.where(visible:true,sidebar: true)\n end\n if(@mainelemnents) && (@mainelements.count > 1)\n @mainelements = @ma...
[ "0.625409", "0.61387765", "0.6132003", "0.6017818", "0.59001946", "0.5831664", "0.5740247", "0.5725626", "0.5712588", "0.5699596", "0.5685144", "0.5675316", "0.56638634", "0.5645248", "0.55774915", "0.5576835", "0.5566876", "0.55541265", "0.5545101", "0.55389386", "0.55271435...
0.64609236
0
Description Opens the general page of the elements editor: the video icon redirects to VideoEditorControllernew the audio icon redirects to AudioEditorControllernew the image icon redirects to GalleriesControllerimage_for_image_editor (and successively to ImageEditorControlleredit) Mode Html
def new render :layout => 'media_element_editor' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n ...
[ "0.6211096", "0.5943301", "0.584834", "0.5838946", "0.5833649", "0.57943696", "0.57561123", "0.57561123", "0.5717198", "0.56711775", "0.5628239", "0.5617931", "0.5597701", "0.5596176", "0.557289", "0.55670696", "0.55634266", "0.5531548", "0.5519143", "0.5514199", "0.5507684",...
0.63153374
0
Description This action checks for errors without setting the media on the new element Mode Js
def create_fake record = MediaElement.new record.title = params[:title_placeholder] != '0' ? '' : params[:title] record.description = params[:description_placeholder] != '0' ? '' : params[:description] record.tags = params[:tags_value] record.user_id = current_user.id record.save_tags = true record.valid? @errors = convert_media_element_error_messages record.errors @errors[:media] = t('forms.error_captions.media_file_too_large').downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_retry\n\t\t#@media = Media.find(params[:id])\n\t\t\n\t\tif [:error, :invalid].include? @media.workflow_state.to_sym\n\t\t\t@media.workflow_state = 'checking'\n\t\t\t@media.media_type = nil\n\t\t\t@media.save!\n\t\tend\n\t\t\n\t\t@media.check_media\n\tend", "def media_element\n if correct_integer?(pa...
[ "0.63747287", "0.5950261", "0.590259", "0.5877903", "0.57182795", "0.5624235", "0.54531837", "0.5447904", "0.54159355", "0.5407462", "0.540742", "0.53515553", "0.53004056", "0.5252276", "0.52428377", "0.52267224", "0.5198166", "0.51672584", "0.5161317", "0.5160924", "0.515516...
0.5451369
7
Description Action that calls the uploader, casts the type, and creates the new element Mode Html
def create media = params[:media] record = MediaElement.new :media => media record.title = params[:title_placeholder] != '0' ? '' : params[:title] record.description = params[:description_placeholder] != '0' ? '' : params[:description] record.tags = params[:tags_value] record.user_id = current_user.id record.save_tags = true if record.save if !record.image? Notification.send_to( current_user.id, I18n.t("notifications.#{record.class.to_s.downcase}.upload.started.title"), I18n.t("notifications.#{record.class.to_s.downcase}.upload.started.message", :item => record.title), '' ) end else if record.errors.added? :media, :too_large return render :file => Rails.root.join('public/413.html'), :layout => false, :status => 413 end @errors = convert_media_element_error_messages record.errors end render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_uploader\n # TODO\n end", "def new\n @upload = Upload.new\n @upload.tmp_content_type = params[:content_type]\n\n upload_type = [\"image\",\"document\"].delete(params[:type])\n \n\n respond_to do |format|\n format.html { \n layout = true\n layout = \"ajax\" if reques...
[ "0.65443194", "0.6024381", "0.6024381", "0.5881656", "0.58660126", "0.582179", "0.5816329", "0.571392", "0.5711732", "0.5711732", "0.5687911", "0.5664766", "0.5650847", "0.56303483", "0.5628996", "0.55806154", "0.5491383", "0.54716045", "0.5465243", "0.5456131", "0.54556197",...
0.5491391
16
Description Adds a link of this element to your section. found: reloads the element in compact mode compact: [this action doesn't occur] expanded: removes the element and reloads the whole page Mode Ajax + Json Specific filters ApplicationControllerinitialize_media_element ApplicationControllerinitialize_media_element_destination
def add @ok_msg = t('other_popup_messages.correct.add.media_element') if @ok if !current_user.bookmark('MediaElement', @media_element_id) @ok = false @error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element') end else @error = I18n.t('activerecord.errors.models.bookmark.problem_creating_for_media_element') end if @destination == ButtonDestinations::FOUND_MEDIA_ELEMENT prepare_media_element_for_js @ok_msg = nil render 'media_elements/reload.js' else render :json => {:ok => @ok, :msg => (@ok ? @ok_msg : @error)} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_new_content_link(element)\n\t\t\t\tlink_to_overlay_window(\n\t\t\t\t\trender_icon('create') + t('add new content'),\n\t\t\t\t\talchemy.new_admin_element_content_path(element),\n\t\t\t\t\t{\n\t\t\t\t\t\t:size => '335x70',\n\t\t\t\t\t\t:title => t('Select an content'),\n\t\t\t\t\t\t:overflow => true\n\t\t...
[ "0.5843755", "0.5815826", "0.57196784", "0.5506087", "0.53053194", "0.5248692", "0.5224908", "0.51986885", "0.51724136", "0.51460075", "0.50608623", "0.50183207", "0.49998343", "0.4998185", "0.49402708", "0.49364203", "0.49209848", "0.4889916", "0.48832592", "0.48704955", "0....
0.5955865
0