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
Checks whether the updated course data conforms to the valence api for the update data JSON object. If it does conform, then nothing happens and it simply returns true. If it does not conform, then the JSON validator raises an exception.
def check_updated_course_data_validity(course_data) schema = { 'type' => 'object', 'required' => %w(Name Code StartDate EndDate IsActive), 'properties' => { 'Name' => { 'type' => 'string' }, 'Code' => { 'type' => 'string' }, 'StartDate' => { 'type' => %w(string null) }, 'EndDate' => { 'type' => %w(string null) }, 'IsActive' => { 'type' => 'boolean' } } } JSON::Validator.validate!(schema, course_data, validate_schema: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_course_template_updated_data_validity(course_template_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' }\n }\n }\n JSON::Validator.val...
[ "0.7178554", "0.70279723", "0.69225776", "0.66739684", "0.6107234", "0.61004287", "0.60181195", "0.59492326", "0.5946406", "0.59022367", "0.5897132", "0.5889953", "0.5858691", "0.58476937", "0.5825676", "0.5818136", "0.5817091", "0.5773975", "0.5721874", "0.5696872", "0.56609...
0.7681309
0
Update the course based upon the first argument. This course object is first referenced via the first argument and its data formatted via merging it with a predefined payload. Then, a PUT http method is executed using the new payload. Utilize the second argument and perform a PUT action to replace the old data
def update_course_data(course_id, new_data) # Define a valid, empty payload and merge! with the new data. payload = { 'Name' => '', # String 'Code' => 'off_SEMESTERCODE_STARNUM', # String 'StartDate' => nil, # String: UTCDateTime | nil 'EndDate' => nil, # String: UTCDateTime | nil 'IsActive' => false # bool }.merge!(new_data) check_updated_course_data_validity(payload) # ap payload # Define a path referencing the courses path path = "/d2l/api/lp/#{$lp_ver}/courses/" + course_id.to_s _put(path, payload) # requires: CourseOfferingInfo JSON block puts '[+] Course update completed successfully'.green # Define a path referencing the course data using the course_id # Perform the put action that replaces the old data # Provide feedback that the update was successful end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @course.update_attributes(parama[:course])\n respond_with(@course)\n end", "def update\n @course.update(course_params)\n respond_with(@course, location: course_path)\n end", "def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end", "def update!(*...
[ "0.75104904", "0.745937", "0.7406063", "0.7292423", "0.7292423", "0.7139117", "0.71173906", "0.7098841", "0.7098841", "0.7098841", "0.7098841", "0.7098841", "0.7098841", "0.7098841", "0.7098841", "0.7082245", "0.7073707", "0.70197505", "0.7016426", "0.6970863", "0.69693744", ...
0.7382477
3
REVIEW: Update the course image for a course offering.
def update_course_image(org_unit_id, image_file_path) path = "/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}/image" # (SCHEMA) Make sure file isnt > 2MB raise ArgumentError, "File referrenced by 'image_file_path' must be less than 1000KB." if File.size(image_file_path) > 2_000_000 raise ArgumentError, "File referrenced by 'image_file_path' is not a valid image." if MIME::Types.type_for(image_file_path).first.media_type.downcase.casecmp("image").zero? _image_upload(path, image_file_path, "PUT") # PUT /d2l/api/lp/(version)/courses/(orgUnitId)/image end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @course_offering = CourseOffering.find(params[:id])\n\n respond_to do |format|\n if @course_offering.update_attributes(params[:course_offering])\n format.html { redirect_to @course_offering, :notice => 'Course offering was successfully updated.' }\n format.json { head :no_cont...
[ "0.63075924", "0.61385244", "0.5987072", "0.5917917", "0.5778426", "0.5708148", "0.5692278", "0.568858", "0.56664526", "0.5655829", "0.565345", "0.56524974", "0.5646216", "0.56423664", "0.5621182", "0.5617148", "0.5612159", "0.5608686", "0.556755", "0.55654484", "0.55416214",...
0.6758094
0
COURSE TEMPLATES: NOTE: Course template related functions are now in 'course_template.rb' COPYING COURSES:
def get_copy_job_request_status(org_unit_id, job_token) path = "/d2l/api/le/#{$le_ver}/import/#{org_unit_id}/copy/#{job_token}" _get(path) # returns GetCopyJobResponse JSON block # GetImportJobResponse: # {"JobToken" => <string:COPYJOBSTATUS_T>, # "TargetOrgUnitID" => <number:D2LID>, # "Status" => <string:IMPORTJOBTSTATUS_T>} # States of getImport: UPLOADING, PROCESSING, PROCESSED, IMPORTING, # IMPORTFAILED, COMPLETED end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course; end", "def course_name; end", "def course_string\n return \"#{course_number}#{section_id}\"\n end", "def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a ...
[ "0.7152722", "0.68090796", "0.65075195", "0.6427225", "0.64270264", "0.6349448", "0.6307715", "0.62758553", "0.6217282", "0.6209378", "0.62011635", "0.61862105", "0.6183082", "0.6146875", "0.6127765", "0.6127688", "0.6120597", "0.6118269", "0.6113627", "0.60742116", "0.607249...
0.0
-1
simple schema check to assure the course component is an actual course component returns: boolean
def course_component?(key) valid_components = %w(AttendanceRegisters Glossary News Checklists Grades QuestionLibrary Competencies GradesSettings Quizzes Content Groups ReleaseConditions CourseFiles Homepages Rubrics Discussions IntelligentAgents Schedule DisplaySettings Links SelfAssessments Dropbox LtiLink Surveys Faq LtiTP ToolNames Forms Navbars Widgets) valid_components.include?(key) # returns whether the key is actually a course component end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?(component)\n true\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def has_course?(course)\n self.courses.include?(course)\n end", "def completely_valid?\n course_valid = course.valid?\n valid? && course_valid\n end", "def course_ok?(course)\n i...
[ "0.69989395", "0.6998099", "0.6998099", "0.69849813", "0.6947838", "0.6907575", "0.6847864", "0.6818359", "0.6817706", "0.66928", "0.65404165", "0.6501041", "0.64686", "0.6466505", "0.64612025", "0.6452463", "0.64008105", "0.63711745", "0.63245374", "0.62828195", "0.62735206"...
0.7360352
0
TODO: UNSTABLE!!!! Retrieve the list of logs for course copy jobs. Query Params: OPTIONAL bookmark : string page_size : number source_org_unit_id : number destination_org_unit_id : number start_date : UTCDateTime end_date : UTCDateTime RETURNS: An object list page containing the resulting CopyCourseLogMessage data blocks
def get_copy_jobs_logs(bookmark = '', page_size = 0, source_org_unit_id = 0, destination_org_unit_id = 0, start_date = '', end_date = '') # GET /d2l/api/le/(version)/ccb/logs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_copy_messages(copies)\n messages = []\n\n copied_count = copies.select(&:copied).size\n if copied_count.positive?\n messages << {\n type: \"success\",\n message: I18n.t(\"api.jobs.copy.success\", count: copied_count),\n }\n end\n\n not_copied_jobs ...
[ "0.5215734", "0.50752604", "0.49905226", "0.49079382", "0.48620108", "0.47494557", "0.47428542", "0.4734707", "0.46586376", "0.46145928", "0.4567685", "0.45585614", "0.45498616", "0.45498616", "0.454199", "0.45240733", "0.44913867", "0.44837114", "0.4474451", "0.44648552", "0...
0.79536736
0
REVIEW: Create a new course import job request. INPUT: simple file upload process using "course package" as the uploaded file
def create_course_import_request(org_unit_id, file_path, callback_url = '') path = "/d2l/le/#{$le_ver}/import/#{org_unit_id}/imports/" path += "?callbackUrl=#{callback_url}" if callback_url != '' # TODO: (SCHEMA) Find out WTH a 'course package' entails as far as standards. _course_package_upload(path, file_path, "POST") # RETURNS: Parsed CreateImportJobResponse JSON block. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_upload_and_import_course_job_with_http_info(course_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CourseApi.create_upload_and_import_course_job ...'\n end\n # verify the required parameter 'course_id' is set\n if @api_client.co...
[ "0.67535335", "0.64923334", "0.6428373", "0.6372164", "0.6300752", "0.6245638", "0.6145344", "0.6128942", "0.6110235", "0.6102416", "0.6056397", "0.60250336", "0.60044956", "0.59673786", "0.5941405", "0.594126", "0.5927387", "0.59233713", "0.5920496", "0.59095615", "0.5905888...
0.76651603
0
ADDITIONAL FUNCTIONS: In order to retrieve an entire department's class list, this method uses a predefined org_unit identifier. This identifier is then appended to a path and all classes withiin the department are returned as JSON objects in an arr. returns: JSON array of classes.
def get_org_department_classes(org_unit_id) path = "/d2l/api/lp/#{$lp_ver}/orgstructure/#{org_unit_id}" _get(path) # returns: JSON array of classes. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_department_pages\n return [Nokogiri::HTML(open('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=ICS')).css(\".listOfClasses\").to_s,\n Nokogiri::HTML(open('https://www.sis.hawaii.edu/uhdad/avail.classes?i=MAN&t=201430&s=MATH')).css(\".listOfClasses\").to_s,\n Nokogi...
[ "0.5941465", "0.5908288", "0.57568353", "0.5739152", "0.5506753", "0.54559404", "0.54546386", "0.5434301", "0.5400554", "0.5384432", "0.53060865", "0.5276067", "0.52335286", "0.5164863", "0.51483834", "0.5136879", "0.5112147", "0.509447", "0.5087146", "0.508517", "0.4988712",...
0.8432338
0
much slower means of getting courses if less than 100 courses
def get_courses_by_code(org_unit_code) all_courses = get_all_courses courses = [] all_courses.each do |course| courses.push(course) if course["Code"].downcase.include? org_unit_code.to_s.downcase end courses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def courses_taked\n\t\tself.normal_scores.includes(:course_detail, :semester, :course_teachership, :course, :course_field)\n\tend", "def list_courses(courses_collection)\n courses_collection.each do |course|\n\n end\n end", "def courses\n @learn_courses\n end", "def get_test_courses\n return [g...
[ "0.6840519", "0.66042656", "0.64816904", "0.6467053", "0.64094794", "0.6355672", "0.63181573", "0.62790793", "0.6241751", "0.62415713", "0.6208302", "0.6206284", "0.6203485", "0.6197475", "0.61804676", "0.6166265", "0.6157328", "0.61529714", "0.6110595", "0.6107226", "0.60841...
0.0
-1
Retrieves all courses that have a particular string (org_unit_name) within their names. This is done by first defining that none are found yet and then searching through all course for ones that do have a particular string within their name, the matches are pushed into the previously empty array of matches. This array is subsequently returned; if none were found, a message is returned returns: JSON array of matching course data objects
def get_courses_by_name(org_unit_name) get_courses_by_property_by_string('Name', org_unit_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_template_by_name(org_unit_name)\n course_template_not_found = true\n course_template_results = []\n puts \"[+] Searching for templates using search string: \\'#{org_unit_name}\\'\".yellow\n results = get_all_course_templates\n results.each do |x|\n if x['Name'].downcase.include...
[ "0.7345237", "0.658706", "0.595688", "0.55969757", "0.5504977", "0.5322676", "0.5171025", "0.51352715", "0.50812685", "0.4971839", "0.48532555", "0.48422876", "0.48376912", "0.48258653", "0.48227054", "0.481542", "0.48152682", "0.48012352", "0.47489536", "0.47330898", "0.4732...
0.7472313
0
Retrieves all matching courses that are found using a property and a search string. First, it is considered that the class is not found. Then, all courses are retrieved and stored as a JSON array in the varaible +results+. After this each of the +results+ is iterated, downcased, and checked for their matching of the particular search string. If there is a match, they are pushed to an array called +courses_results+. This is returned at the end of this op. returns: array of JSON course objects (that match the search string/property)
def get_courses_by_property_by_string(property, search_string) puts "[+] Searching for courses using search string: #{search_string}".yellow + + " -- And property: #{property}" courses_results = [] results = get_all_courses results.each do |x| if x[property].downcase.include? search_string.downcase courses_results.push(x) end end courses_results # returns array of all matching courses in JSON format. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses_by_property_by_regex(property, regex)\n puts \"[+] Searching for courses using regex: #{regex}\".yellow +\n + \" -- And property: #{property}\"\n courses_results = []\n results = get_all_courses\n results.each do |x|\n courses_results.push(x) unless (x[property] =~ regex)...
[ "0.75900936", "0.60762036", "0.5936889", "0.58669", "0.5669235", "0.5567699", "0.5559371", "0.551994", "0.5506607", "0.5477952", "0.5434904", "0.54256994", "0.53934413", "0.5346485", "0.5343129", "0.5312721", "0.52828413", "0.5271418", "0.5229791", "0.5219533", "0.5216814", ...
0.8216064
0
Retrieves all courses that have the specified prop match a regular expression. This is done by iterating through all courses and returning an array of all that match a regular expression. returns: array of JSON course objects (with property that matches regex)
def get_courses_by_property_by_regex(property, regex) puts "[+] Searching for courses using regex: #{regex}".yellow + + " -- And property: #{property}" courses_results = [] results = get_all_courses results.each do |x| courses_results.push(x) unless (x[property] =~ regex).nil? end courses_results # returns array of all matching courses in JSON format. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses_by_property_by_string(property, search_string)\n puts \"[+] Searching for courses using search string: #{search_string}\".yellow +\n + \" -- And property: #{property}\"\n courses_results = []\n results = get_all_courses\n results.each do |x|\n if x[property].downcase.incl...
[ "0.6683183", "0.560437", "0.54976016", "0.53587973", "0.53535575", "0.53462136", "0.53156537", "0.52581584", "0.525456", "0.51871294", "0.507962", "0.5058158", "0.5046908", "0.50450385", "0.50023997", "0.4980782", "0.49271637", "0.49209687", "0.48728696", "0.48446837", "0.484...
0.8201993
0
Link to kata: Description: This series of katas will introduce you to basics of doing geometry with computers. Point objects have x and y attributes (X and Y in C) attributes. Write a function calculating distance between Point a and Point b. Tests round answers to 6 decimal places. Answer:
def distance_between_points(a, b) Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end", "def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend", "def distance x1, y1, x2,...
[ "0.7905376", "0.78552496", "0.7751169", "0.7720782", "0.7596627", "0.7582881", "0.7576329", "0.7529481", "0.7444123", "0.74125564", "0.7381458", "0.7376609", "0.73298013", "0.72625184", "0.7206982", "0.71419656", "0.70943946", "0.707856", "0.70414054", "0.70018256", "0.699043...
0.8094215
0
The calculation of a circle's bounding box is different for polygonal shapes.
def bounding_box r = @radius bottom_left = Point[@centre.x - r, @centre.y - r] top_right = Point[@centre.x + r, @centre.y + r] [bottom_left, top_right] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box\r\n end", "def bounding_box \r\n if @cached_bounding_box\r\n @cached_bounding_box.x = self.x + @_x_diff\r\n @cached_bounding_box.y = self.y + @_y_diff\r\n \r\n return @cached_bounding_box\r\n end\r\n \r\n width, height =...
[ "0.7428176", "0.7202701", "0.70511365", "0.69864935", "0.68783224", "0.6867433", "0.6771426", "0.6766057", "0.6725074", "0.67034924", "0.66394746", "0.6610041", "0.6594119", "0.6548755", "0.63996863", "0.6380179", "0.6330467", "0.6306855", "0.62625355", "0.62551135", "0.62551...
0.737114
1
This is an esoteric method designed entirely to assist the implementation of arcs. A circle and arc may be specified like this: circle :diameter => :AC arc :diameter => :AC, :angles => [45,100] In the case of the arc, the angles 45 and 100 degrees are _relative_ to the segment AC. The Arc class needs the angle that AC makes so it can offset the angles 45 and 100. Since Arc relies on Circle to understand the :diameter => :AC part, that information is lost by the time it gets to Arc. That's why this method exists.
def angle_of_specified_radius @angle_of_radius end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arc(x, y, radius, angle1, angle2)\n [x.value, y.value, radius.value, angle1.value * (Math::PI / 180.0), angle2.value * (Math::PI / 180.0)]\n end", "def arc(x, y, radius, start_angle, end_angle)\n start_angle = radians(90-start_angle)\n end_angle = radians(90-end_angle)\n clockwise = 1 ...
[ "0.7482197", "0.7258909", "0.716786", "0.71026576", "0.68332565", "0.6775048", "0.67609054", "0.66813356", "0.66432804", "0.65215737", "0.64208436", "0.63725406", "0.63396716", "0.63303024", "0.6256274", "0.61992407", "0.61146986", "0.60963464", "0.6053219", "0.60391665", "0....
0.57359123
31
Prepare the OCCI XML Response resource:: _Pool_ or _PoolElement_ that represents a OCCI resource [return] _String_,_Integer_ Resource Representation or error, status code
def to_occi_xml(resource, opts) xml_response = resource.to_occi(@base_url, opts[:verbose]) return xml_response, 500 if OpenNebula.is_error?(xml_response) return xml_response, opts[:code] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_rif\n xml = ::Builder::XmlMarkup.new\n xml.registryObjects OAI::Provider::Metadata::Rif.instance.header_specification do\n xml.registryObject 'group' => 'PARADISEC' do\n xml.key xml_key\n xml.originatingSource 'http://catalog.paradisec.org.au', 'type' => 'authoritative'\n\n x...
[ "0.5151261", "0.50918853", "0.50789857", "0.50687975", "0.5055344", "0.5023994", "0.49921778", "0.4888297", "0.48567396", "0.4849295", "0.48469532", "0.48064965", "0.47629827", "0.47422102", "0.4727172", "0.4714025", "0.47051042", "0.46653515", "0.46473524", "0.46444786", "0....
0.60069823
0
Gets the pool representation of COMPUTES request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Pool Representation or error, status code
def get_computes(request) # --- Get User's VMs --- vmpool = VirtualMachinePoolOCCI.new( @client, POOL_FILTER) # --- Prepare XML Response --- rc = vmpool.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(vmpool, :code=>200, :verbose=>request.params['verbose']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pool_header\n \"'#{object.pool_name}' (#{object.lanes}x#{object.pool_type}), #{object.pool_address} #{object.city}\"\n end", "def hash\n [pool_usage_percentage, pool_capacity, pool_member_severity, pool_member_capacity, pool_member_usage_percentage, current_virtual_server_count, current_pool_cou...
[ "0.63212556", "0.5779965", "0.5752833", "0.5696945", "0.55221015", "0.546353", "0.54494035", "0.54035455", "0.5398157", "0.53892833", "0.5385632", "0.53792584", "0.53773105", "0.53336877", "0.5325549", "0.5324864", "0.5295864", "0.52746665", "0.52712417", "0.5252542", "0.5234...
0.5750922
3
Gets the pool representation of NETWORKS request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Network pool representation or error, => status code
def get_networks(request) # --- Get User's VNETs --- network_pool = VirtualNetworkPoolOCCI.new( @client, POOL_FILTER) # --- Prepare XML Response --- rc = network_pool.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(network_pool, :code=>200, :verbose=>request.params['verbose']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details(options={})\n param = {\n :id => @id,\n :uniq_id => @uniq_id,\n :free_only => false\n }.merge options\n param[:free_only] = param[:free_only] ? 1 : 0\n data = Storm::Base::SODServer.remote_call '/Network/Pool/details',\n ...
[ "0.5959342", "0.58248484", "0.58158284", "0.57603574", "0.5691463", "0.56329024", "0.562884", "0.5591048", "0.5559266", "0.5556091", "0.55421317", "0.55421317", "0.5523109", "0.54806215", "0.54266936", "0.5419752", "0.54166657", "0.5413818", "0.53735924", "0.53471094", "0.533...
0.59439653
1
Gets the pool representation of STORAGES request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Image pool representation or error, status code
def get_storages(request) # --- Get User's Images --- image_pool = ImagePoolOCCI.new( @client, POOL_FILTER) # --- Prepare XML Response --- rc = image_pool.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(image_pool, :code=>200, :verbose=>request.params['verbose']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n rc = image.info\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n...
[ "0.63070345", "0.5877132", "0.5860189", "0.58468264", "0.5790439", "0.5790439", "0.56544346", "0.5383488", "0.5374307", "0.53427804", "0.5308707", "0.5305863", "0.52830684", "0.52544564", "0.5253932", "0.5243986", "0.5216504", "0.52100426", "0.5200307", "0.51825136", "0.51723...
0.6713743
0
Gets the pool representation of USERs request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ User pool representation or error, status code
def get_users(request) # --- Get Users Pool --- user_pool = UserPoolOCCI.new(@client) # --- Prepare XML Response --- rc = user_pool.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(user_pool, :code=>200, :verbose=>request.params['verbose']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user(name)\n user = nil\n \n @user_pool.info\n @user_pool.each{ |u|\n if u.name==name\n user=Hash.new\n\n user[:id] = u.id\n user[:name] = u.name\n user[:password] = u[:password]\n end\n ...
[ "0.7049849", "0.6504191", "0.5973878", "0.5883809", "0.5785773", "0.57658166", "0.573974", "0.5679094", "0.56702787", "0.56545967", "0.56527793", "0.5651384", "0.56510574", "0.56415576", "0.56323504", "0.5600393", "0.55941266", "0.55926484", "0.55583125", "0.5540454", "0.5534...
0.6892352
1
ENTITY RESOURCE METHODS COMPUTE Methods Post a new compute to the COMPUTE pool request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ COMPUTE Representation or error, status code
def post_compute(request) # --- Create the new Instance --- vm = VirtualMachineOCCI.new( VirtualMachine.build_xml, @client, request.body.read, @config[:instance_types], @config[:template_location]) # --- Generate the template and Allocate the new Instance --- template = vm.to_one_template return template, 500 if OpenNebula.is_error?(template) rc = vm.allocate(template) if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end # --- Prepare XML Response --- vm.info return to_occi_xml(vm, :code=>201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_params\n params[:compute]\n end", "def do_comp!\n # user = User.where('id=? OR rfid=?', user_param.to_i, user_param).first\n user = User.find(user_param)\n user.comps.create!(\n amount_in_cents: comp_amount,\n employee_id: comp_params.dig(:employee_id),\n venue_id: comp_para...
[ "0.55139196", "0.54700345", "0.5227526", "0.51713735", "0.517043", "0.50953025", "0.5044701", "0.5043222", "0.5024635", "0.4999909", "0.49860853", "0.49687216", "0.4944928", "0.49402347", "0.4939353", "0.49281505", "0.49160698", "0.49147758", "0.49100405", "0.48706204", "0.48...
0.5952024
0
Get the representation of a COMPUTE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ COMPUTE representation or error, status code
def get_compute(request, params) # --- Get the VM --- vm = VirtualMachineOCCI.new( VirtualMachine.build_xml(params[:id]), @client) # --- Prepare XML Response --- rc = vm.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(vm, :code=>200) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result\n if @validate && validation_errors.any?\n return { \"errors\" => validation_errors }\n end\n\n @result ||= Executor.new(self, @operation_name).result\n end", "def rc\n @result.rc\n end", "def get_computes(request)\n # --- Get User's VMs ---\n vmpool = VirtualMachine...
[ "0.54124105", "0.53652483", "0.53314066", "0.52349776", "0.5209725", "0.520028", "0.51011795", "0.506842", "0.49978283", "0.49641207", "0.4955594", "0.49522096", "0.49494216", "0.49409923", "0.49097928", "0.48472232", "0.484158", "0.48066482", "0.47977656", "0.47960436", "0.4...
0.4585825
44
Deletes a COMPUTE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Delete confirmation msg or error, status code
def delete_compute(request, params) # --- Get the VM --- vm = VirtualMachineOCCI.new( VirtualMachine.build_xml(params[:id]), @client) # --- Finalize the VM --- result = vm.finalize if OpenNebula.is_error?(result) return result, CloudServer::HTTP_ERROR_CODE[result.errno] end return "", 204 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n head :no_content\n end", "def destroy\n @compromise = Compromise.find(params[:id])\n @compromise.destroy\n\n respond_to do |format|\n format.html { redirect_to compromises_url }\n format.json { head :n...
[ "0.64609843", "0.62255913", "0.6118413", "0.6086015", "0.6044281", "0.60010153", "0.599964", "0.5987568", "0.5986889", "0.5978142", "0.59572107", "0.595649", "0.5945429", "0.5942066", "0.5936854", "0.5935057", "0.59322274", "0.592165", "0.58854043", "0.58853126", "0.5873431",...
0.6205852
2
Updates a COMPUTE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Update confirmation msg or error, status code
def put_compute(request, params) # --- Get the VM --- vm = VirtualMachineOCCI.new( VirtualMachine.build_xml(params[:id]), @client) rc = vm.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end result, code = vm.update_from_xml(request.body) if OpenNebula.is_error?(result) return result, code else vm.info return to_occi_xml(vm, :code=>code) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n rpc(:block_confirm, :hash, _access: :started) == 1\n end", "def chore_completion_confirmation(v1_requests_params)\n #Here we just want to change the specific chore's completion property to true\n @chore = Chore.find(v1_requests_params[:chore_id])\n\n if v1_requests_params[:re...
[ "0.53257394", "0.53214353", "0.53065634", "0.52955234", "0.5289577", "0.5285446", "0.527888", "0.5261393", "0.52085245", "0.51650673", "0.51531404", "0.51506734", "0.5135618", "0.5113841", "0.5113841", "0.50991344", "0.5090246", "0.5048523", "0.5032623", "0.5031425", "0.50281...
0.0
-1
NETWORK Methods Post a new network to the NETWORK pool request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Network Representation or error, status code
def post_network(request) # --- Create the new Instance --- network = VirtualNetworkOCCI.new( VirtualNetwork.build_xml, @client, request.body, @config[:template_location]) # --- Generate the template and Allocate the new Instance --- template = network.to_one_template return template, 500 if OpenNebula.is_error?(template) rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID) if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end # --- Prepare XML Response --- network.info return to_occi_xml(network, :code=>201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_network(network_hash)\n post(\"cloud-instances/#{guid}/networks\", network_hash.to_json)\n end", "def save\n requires :display_text, :name, :network_offering_id, :zone_id\n\n options = {\n 'displaytext' => display_text,\n 'name' ...
[ "0.7415104", "0.6835048", "0.6796088", "0.67456996", "0.6730821", "0.67217386", "0.6683238", "0.6464567", "0.64469606", "0.6358545", "0.63019747", "0.6300043", "0.6278791", "0.62399447", "0.59392977", "0.5917491", "0.59170115", "0.59090996", "0.5907089", "0.5895139", "0.58803...
0.7069878
1
Retrieves a NETWORK resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ NETWORK occi representation or error, status code
def get_network(request, params) network = VirtualNetworkOCCI.new( VirtualNetwork.build_xml(params[:id]), @client) # --- Prepare XML Response --- rc = network.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(network, :code=>200) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def net_http_res; end", "def get url\n net_http_response = self.connection.get url\n [net_http_response.body, net_http_response.code.to_i, net_http_response.message]\n end", "def get_network(network_id)\n get(\"cloud-instances/#{guid}/networks/#{network_id}\")\n end", "def get_network ...
[ "0.571246", "0.57034516", "0.5534102", "0.55230284", "0.5470654", "0.5448324", "0.5382253", "0.5352516", "0.52315885", "0.52270275", "0.52267224", "0.52080965", "0.51655203", "0.51390004", "0.5123696", "0.5123433", "0.51118255", "0.5111518", "0.5082296", "0.5082296", "0.50636...
0.589049
0
Deletes a NETWORK resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Delete confirmation msg or error, status code
def delete_network(request, params) network = VirtualNetworkOCCI.new( VirtualNetwork.build_xml(params[:id]), @client) # --- Delete the VNET --- rc = network.delete if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return "", 204 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n data = Storm::Base::SODServer.remote_call '/Network/Pool/delete',\n :uniq_id => @uniq_id\n data[:deleted]\n end", "def hash_delete_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.d...
[ "0.6719558", "0.6421765", "0.62672", "0.6250158", "0.6222849", "0.62045443", "0.61145073", "0.61036426", "0.6037797", "0.6016998", "0.6003256", "0.59885496", "0.5987191", "0.59857637", "0.59823245", "0.5971118", "0.5969072", "0.59595627", "0.59593415", "0.59438455", "0.591772...
0.66895485
1
Updates a NETWORK resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Update confirmation msg or error, status code
def put_network(request, params) xmldoc = XMLElement.build_xml(request.body, 'NETWORK') vnet_info = XMLElement.new(xmldoc) if xmldoc != nil vnet = VirtualNetworkOCCI.new( VirtualNetwork.build_xml(params[:id]), @client) rc = nil if vnet_info['PUBLIC'] == 'YES' rc = vnet.publish elsif vnet_info['PUBLIC'] == 'NO' rc = vnet.unpublish end if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end # --- Prepare XML Response --- vnet.info return to_occi_xml(vnet, :code=>202) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ddns_update_he(user, pw, tid, ip)\n uri = URI.parse(\"https://ipv4.tunnelbroker.net/nic/update?username=#{user}&password=#{pw}&hostname=#{tid}&myip=#{ip}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri....
[ "0.5791892", "0.5602456", "0.5535271", "0.5535271", "0.5530031", "0.5528361", "0.5526567", "0.5483814", "0.54680413", "0.545317", "0.5417125", "0.5407884", "0.5389521", "0.53892463", "0.53804374", "0.5365714", "0.53606933", "0.53484696", "0.534638", "0.5311758", "0.5299952", ...
0.49441743
70
STORAGE Methods Post a new image to the STORAGE pool request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Image representation or error, status code
def post_storage(request) # --- Check OCCI XML from POST --- if request.params['occixml'] == nil error_msg = "OCCI XML representation of Image" + " not present in the request" error = OpenNebula::Error.new(error_msg) return error, 400 end # --- Create and Add the new Image --- occixml = request.params['occixml'] occixml = occixml[:tempfile].read if occixml.class == Hash image = ImageOCCI.new( Image.build_xml, @client, occixml, request.params['file']) # --- Generate the template and Allocate the new Instance --- template = image.to_one_template return template, 500 if OpenNebula.is_error?(template) rc = image.allocate(template, @config[:datastore_id]||1) if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end image.info #wait until image is ready to return while (image.state_str == 'LOCKED') && (image['RUNNING_VMS'] == '0') do sleep IMAGE_POLL_SLEEP_TIME image.info end # --- Prepare XML Response --- return to_occi_xml(image, :code=>201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postEntityImage( entity_id, filedata, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['filedata'] = filedata\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image\",params)\n end", "def create\n @image = Image.new(image_params)\n\n # fet...
[ "0.67971957", "0.6755075", "0.6672485", "0.6648152", "0.65387076", "0.64971286", "0.64965427", "0.6488962", "0.6455221", "0.641899", "0.6408193", "0.63755584", "0.63744974", "0.6345196", "0.6332142", "0.63267213", "0.63208973", "0.63077366", "0.6296497", "0.6268984", "0.62561...
0.7628148
0
Get a STORAGE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ STORAGE occi representation or error, status code
def get_storage(request, params) # --- Get the Image --- image = ImageOCCI.new( Image.build_xml(params[:id]), @client) rc = image.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end # --- Prepare XML Response --- return to_occi_xml(image, :code=>200) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storage_key\n ret = storage_key_do\n render status: ret['status'], json: ret.to_json\n end", "def storage_url\n self.auth_response[:storage_url]\n end", "def request\n SharedStorage.get(:request)\n end", "def storage_key_do\n version = params_u(:version).to_i\n ark = para...
[ "0.61961967", "0.61647546", "0.5757967", "0.555073", "0.5523361", "0.5523294", "0.5523294", "0.5519704", "0.5505577", "0.5468509", "0.5406544", "0.53990936", "0.5371849", "0.5343856", "0.53168654", "0.52987033", "0.5296087", "0.5279063", "0.5269528", "0.526301", "0.5260072", ...
0.61472064
2
Clone a STORAGE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ STORAGE occi representation or error, status code
def clone_storage(request, params, action_xml) # --- Get the Image --- image = ImageOCCI.new( Image.build_xml(params[:id]), @client) rc = image.clone(action_xml["PARAMS/NAME"]) if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end new_image = ImageOCCI.new( Image.build_xml(rc), @client) new_image.info # --- Prepare XML Response --- return to_occi_xml(new_image, :code=>201) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_clone\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/clone\", { \n headers: {\"Fastly-Key\" => $key} \n })\n end", "def clone_storage(storage_uuid, zone: \"fi-hel1\", title:, tier: \"maxiops\")\n data = {\n \"storage\" => {\n \"zone\" => zone,\n...
[ "0.6568503", "0.6119787", "0.5941364", "0.5908649", "0.58865446", "0.5865877", "0.58568174", "0.5722834", "0.57163376", "0.5662461", "0.5638569", "0.55971825", "0.5587083", "0.5587083", "0.5587083", "0.55769396", "0.5566781", "0.5547703", "0.5547354", "0.5533044", "0.55106825...
0.6597822
0
Deletes a STORAGE resource (Not yet implemented) request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Delete confirmation msg or error, status code
def delete_storage(request, params) # --- Get the Image --- image = ImageOCCI.new( Image.build_xml(params[:id]), @client) # --- Delete the Image --- rc = image.delete if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return "", 204 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", ...
[ "0.70092905", "0.6851004", "0.6830011", "0.68268085", "0.6793854", "0.6785949", "0.6747967", "0.6720591", "0.6695621", "0.6692815", "0.6687555", "0.66851336", "0.6679694", "0.66793954", "0.6678819", "0.6674363", "0.66681165", "0.66367286", "0.66300064", "0.6590539", "0.657624...
0.71852046
0
Updates a STORAGE resource request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ Update confirmation msg or error, status code
def put_storage(request, params) xmldoc = XMLElement.build_xml(request.body, 'STORAGE') image_info = XMLElement.new(xmldoc) if xmldoc != nil image = ImageOCCI.new( Image.build_xml(params[:id]), @client) rc = nil if image_info['PERSISTENT'] && image_info['PUBLIC'] error_msg = "It is not allowed more than one change per request" return OpenNebula::Error.new(error_msg), 400 elsif image_info['PERSISTENT'] == 'YES' rc = image.persistent elsif image_info['PERSISTENT'] == 'NO' rc = image.nonpersistent elsif image_info['PUBLIC'] == 'YES' rc = image.publish elsif image_info['PUBLIC'] == 'NO' rc = image.unpublish end if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end # --- Prepare XML Response --- image.info return to_occi_xml(image, :code=>202) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @storage.update(storage_params)\n format.html { redirect_to @storage, notice: \"Storage was successfully updated.\" }\n format.json { render :show, status: :ok, location: @storage }\n else\n format.html { render :edit, status: :unprocessabl...
[ "0.6439257", "0.6394578", "0.6344798", "0.6183247", "0.6146059", "0.61344284", "0.60532194", "0.6014788", "0.59196174", "0.5894027", "0.58700657", "0.58675426", "0.58634055", "0.5862302", "0.58304083", "0.5797305", "0.5772364", "0.576923", "0.576596", "0.5765593", "0.57644755...
0.58892375
10
Get the representation of a USER request:: _Hash_ hash containing the data of the request [return] _String_,_Integer_ USER representation or error, status code
def get_user(request, params) # --- Get the USER --- user = UserOCCI.new( User.build_xml(params[:id]), @client) # --- Prepare XML Response --- rc = user.info if OpenNebula.is_error?(rc) return rc, CloudServer::HTTP_ERROR_CODE[rc.errno] end return to_occi_xml(user, :code=>200) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_hash\n response_hash.key?(:user) ? response_hash[:user] : {}\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def user_info\n auth_hash['user_info']\n end", "def user_info\n response = from_server...
[ "0.7011797", "0.6790858", "0.6737768", "0.66233015", "0.65978986", "0.6557041", "0.65402645", "0.64487785", "0.64438814", "0.63948894", "0.63893664", "0.6357348", "0.634812", "0.63466585", "0.6341286", "0.6328186", "0.62869936", "0.6283917", "0.6274936", "0.6274208", "0.62742...
0.6627048
3
GET /orders GET /orders.json
def index @orders = Order.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n ...
[ "0.83267236", "0.815406", "0.80041754", "0.7947603", "0.7846487", "0.7823147", "0.78028905", "0.76992875", "0.76980406", "0.7682792", "0.7682792", "0.7682792", "0.7682792", "0.76827645", "0.75880665", "0.7574349", "0.756171", "0.7531827", "0.74860185", "0.7432208", "0.7369724...
0.70640796
79
GET /orders/1 GET /orders/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.71261...
0.0
-1
POST /orders POST /orders.json
def create #current_cart.each do |item| # item['meal_id'] # item['quantity'] #end #curent_user #Order.order_meals.new(:meal_id, :quantity) #Order.user #Order.price cart_total_price #Order.Situation = 1 => pendente #Order.save #select_situation @order = Order.new @order.user = current_user @order.situation_id = Situation.first.id @order.price = params[:total_price].to_f @order.save current_cart.each do |item| @meal = Meal.find item['meal_id'] OrderMeal.create(order: @order, meal: @meal, quantity: item['quantity']) end respond_to do |format| if @order.save #esvazia o carrinho session[:cart] = nil format.html { redirect_to @order, notice: 'Order was successfully created.' } format.json { render :show, status: :created, location: @orders_path } else format.html { render :new } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247"...
0.0
-1
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
def update respond_to do |format| if @order.update(order_params) format.html { redirect_to orders_path, notice: 'Order was successfully updated.' } format.json { render :show, status: :ok, location: @orders_path } else format.html { render :edit } format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte...
[ "0.68025535", "0.68025535", "0.6774487", "0.67430097", "0.6735168", "0.6726719", "0.6723002", "0.6719217", "0.6704413", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0.67043465", "0...
0.6654807
37
DELETE /orders/1 DELETE /orders/1.json
def destroy @order.destroy respond_to do |format| format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.7592003", "0.7475092", "0.74298924", "0.7371978", "0.7371411", "0.7371187", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_order @order = Order.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_params params.require(:order).permit(:price, :user_id, :situation_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
create an empty array for the driver function
def initialize @drivers = Array.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_empty_array\n @outcome_array = Array.new(find_number_of_rows+1) { Array.new(find_number_of_columns+1) }\nend", "def initialize; @ary = []; end", "def build_array\n arr = []\n yield(arr)\n arr \n end", "def initialize\n @array = []\n end", "def to_a; []; end", "def to_ary...
[ "0.7274783", "0.7116447", "0.6988439", "0.6834058", "0.68133175", "0.6801339", "0.6726756", "0.66099775", "0.6559772", "0.65536916", "0.65392107", "0.6519436", "0.6490399", "0.6429619", "0.6415151", "0.6394518", "0.6382642", "0.63699317", "0.6316215", "0.6294034", "0.62884283...
0.6172924
35
GET /collections GET /collections.json
def index #@collections = Collection.all @root_collections = [] #filter by parent collection id if requested if params.include?('parent_id') #@all_collections = Collection.where(:collection_id => params['parent_id'].to_i) #TODO: ancestry? else #only root collections #TODO #@all_collections = Collection.where(:collection_id => nil).order('name') @all_collections = Collection.roots.order('name') end #add additional data, mostly for json requests @all_collections.each do |c| c.validated = collection_is_validated(c) end #filter for permission @all_collections.each do |c| if collection_is_viewable(c, current_user) @root_collections << c end end respond_to do |format| format.html # index.html.erb format.json { render json: @root_collections } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end", "def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end", "def list\n @collection...
[ "0.7903878", "0.7902042", "0.7901478", "0.7798958", "0.76547277", "0.74742806", "0.7404062", "0.73411196", "0.73396087", "0.7331687", "0.7301158", "0.7301158", "0.7140841", "0.70761335", "0.7036882", "0.70322394", "0.70099014", "0.6999159", "0.6996238", "0.6944972", "0.694326...
0.6859882
26
GET /collections/1 GET /collections/1.json
def show @collection = Collection.find(params[:id]) #@documents = Document.where(:collection_id => @collection.id).paginate(:per_page => 5, :page => params[:page]) @documents_all = Document.where(:collection_id => @collection.id) @documents = [] @documents_all.each do |doc| if doc_is_viewable(doc, current_user) @documents << doc end end respond_to do |format| format.html # show.html.erb format.json { render json: @collection } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection(slug, options)\n _get(\"v1/collections/\" + slug, options)\n end", "def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end", "def show\n\n @collecti...
[ "0.7678446", "0.76061696", "0.75371283", "0.7443003", "0.72130686", "0.7119864", "0.7102526", "0.7100734", "0.7100734", "0.709121", "0.7061903", "0.704557", "0.70365316", "0.7006357", "0.6956208", "0.6920214", "0.6828716", "0.6815708", "0.68125314", "0.6763249", "0.6738598", ...
0.0
-1
GET /collections/new GET /collections/new.json
def new @collection = Collection.new(:parent_id => params[:parent_id]) respond_to do |format| format.html # new.html.erb format.json { render json: @collection } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @collection = @user.collections.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end", "def new\n @collection = Collection.new\n respond_to do |format|\n format.html { create }\n format.json { render :json =...
[ "0.8212754", "0.7904696", "0.7887533", "0.7812707", "0.7530531", "0.7433335", "0.7379678", "0.73161477", "0.726516", "0.72472954", "0.72107565", "0.72065353", "0.72065353", "0.72060066", "0.7201293", "0.71548676", "0.7118826", "0.7113571", "0.7097056", "0.70900774", "0.705747...
0.73381054
7
POST /collections POST /collections.json
def create @collection = Collection.new(params[:collection]) @collection.user = current_user #Checks collection for parent, inherits permissions if ( params[:collection].include?("parent_id") and params[:collection]["parent_id"] != "" ) parent_collection = Collection.find(params[:collection]["parent_id"]) inherit_collection(parent_collection) else puts "### Collection has no parent" end respond_to do |format| if @collection.save #format.html { redirect_to @collection, notice: 'Collection was successfully created.' } format.html { redirect_to collections_path, notice: 'Collection was successfully created.' } #format.json { render json: @collection, status: :created, location: @collection } format.json { render json: collections_path, status: :created, location: collections_path } else format.html { render action: "new" } format.json { render json: @collection.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end", "def create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @col...
[ "0.7406109", "0.73826146", "0.7293025", "0.70655507", "0.70375437", "0.6995771", "0.6995771", "0.69555485", "0.6955021", "0.6950639", "0.6943942", "0.6942102", "0.69265264", "0.6894755", "0.6851965", "0.6742832", "0.67059416", "0.6694796", "0.6656791", "0.6656791", "0.6559917...
0.6027329
61
PUT /collections/1 PUT /collections/1.json
def update @collection = Collection.find(params[:id]) #Parent collection stuff parent_child_violation = false access_violation = false if params.include?("collection") and params[:collection].include?("parent_id") and params[:collection]["parent_id"] != "" parent_collection = Collection.find(params[:collection]["parent_id"]) if (parent_collection.user_id != @collection.user_id) access_violation = true else #if !collection_is_parent(@collection, parent_collection) if !parent_collection.ancestors.include?(@collection) @collection.parent_id = parent_collection.id #inherits project (and permissions) of parent by default inherit_collection(parent_collection) else parent_child_violation = true end end #if parent end #if params #Update #do this now, so the spawn doesn't PG:Error b/c spawned code has locked @colllection update_collection_attrs_suc = false if (not parent_child_violation and not access_violation) update_collection_attrs_suc = @collection.update_attributes(params[:collection]) end #Validation if (params.include?("post") and params[:post].include?("ifilter_id") and params[:post][:ifilter_id] != "" ) f = get_ifilter( params[:post][:ifilter_id].to_i ) validate_collection_helper(@collection, f) end #Add metadata from a metaform if (params.include?("post") and params[:post].include?("metaform_id") and params[:post][:metaform_id] != "" ) add_collection_metaform(@collection, params[:post][:metaform_id].to_i) end #Add to my project if (params.include?("proj") and params[:proj].include?("id") and params[:proj][:id] != "" ) project = Project.find( params[:proj][:id] ) add_project_col(project, @collection) #call to collection helper, adds collection to project end #Add selected upload as a note to the collection if (params.include?("note") and params["note"].include?("upload_id") and (!params["note"]["upload_id"].blank?) ) add_note_collection( params["note"]["upload_id"] ) end if (params.include?("remove_ids") and (!params["remove_ids"].blank?) ) remove_notes_collection( params["remove_ids"] ) #Remove notes end =begin #Add to other project (as editor) if (params.include?("ed_proj") and params[:ed_proj].include?("pro_id") and params[:ed_proj][:pro_id] != "" ) project = Project.find( params[:ed_proj][:pro_id] ) add_project_col(project, @collection) #from collection helper end =end #Recursive remove from project if params.include?("remove_project") params["remove_project"].each do |k,v| if v.to_i == 1 project = Project.find(k.to_i) @collection.projects.delete project @collection.descendants.each do |c| if !c.projects.empty? c.projects.delete project end end end end end respond_to do |format| if access_violation @collection.errors.add(:base, "You are not authorized to do that.") format.html { render action: "edit" } elsif parent_child_violation #flash[:error] = "Warning: cannot set parent collection to a child." @collection.errors.add(:base, "Cannot set parent collection to a child.") format.html { render action: "edit" } elsif update_collection_attrs_suc format.html { redirect_to edit_collection_path(@collection), notice: 'Collection was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @collection.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(...
[ "0.711726", "0.692394", "0.6920681", "0.68739355", "0.68739355", "0.68739355", "0.6854399", "0.6804631", "0.6757976", "0.6708035", "0.6687051", "0.66558677", "0.6608879", "0.6608879", "0.6608879", "0.6595922", "0.6555337", "0.6544417", "0.65073687", "0.6490544", "0.64888984",...
0.0
-1
DELETE /collections/1 DELETE /collections/1.json
def destroy @collection = Collection.find(params[:id]) #destroy all child documents @collection.documents.each do |d| upload_remove(d) #Removes upload record if file is deleted d.destroy end #destroy all child collections @collection.collections.each do |c| collection_recursive_destroy(c) end @collection.destroy respond_to do |format| format.html { redirect_to collections_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n response = connection.delete(\"/collections/#{id}\")\n (200..299).include?(response.status)\n end", "def destroy\n @collection = Collection.find(params[:id])\n @collection.destroy\n\n respond_to do |format|\n format.html { redirect_to collections_url }\n format.json ...
[ "0.7955601", "0.76791966", "0.7664679", "0.7664679", "0.7664679", "0.7664679", "0.75711703", "0.7557922", "0.7541033", "0.7540196", "0.7532294", "0.74901825", "0.74650514", "0.7449756", "0.7449204", "0.7449204", "0.7449204", "0.74310577", "0.7296184", "0.7282262", "0.7269583"...
0.7258112
22
Downloads a single "note" file linked to a collection. GET /collections/download_note_collection/1
def download_note_collection collection = Collection.find(params[:id]) authorize! :download_note_collection, collection upload = Upload.find(params[:upload_id]) send_file upload.upfile.path, :filename => upload.upfile_file_name, :type => 'application/octet-stream' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_note\n document = Document.find(params[:id])\n authorize! :download_note, document\n \n begin\n upload = Upload.find(params[:upload_id])\n rescue\n puts \"### ERROR: \" + e.message\n redirect_to show_path(document), notice: \"ERROR: file (upload) ID not found. Upload may ...
[ "0.7027031", "0.65993714", "0.646868", "0.6446212", "0.64040387", "0.6289908", "0.6058273", "0.6046466", "0.59440285", "0.59069484", "0.58924234", "0.5851533", "0.5827845", "0.5797692", "0.57898897", "0.57744855", "0.5773716", "0.5746124", "0.5738348", "0.57346666", "0.573424...
0.8048382
0
Creates the hash to initialize the single resource property object
def res_prop_hash(nodoc) props = {} statement[1].entries.each do |e| next if e == false if %i[var_ref array].include?(e.type) props[:type] = e.source elsif e.type == :symbol_literal props[:identifier] = e.source.delete(':') elsif e.type == :list props[:options] = parse_option_list(e) end end props[:docstring] = nodoc ? '' : statement.docstring props end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @property_hash = {\n name: @resource[:name],\n ensure: :present,\n primitive: @resource[:primitive],\n clone_max: @resource[:clone_max],\n clone_node_max: @resource[:clone_node_max],\n notify_clones: @resource[:notify_clon...
[ "0.80609727", "0.7753581", "0.7752089", "0.76519877", "0.75903183", "0.7570889", "0.75233877", "0.7217106", "0.6979977", "0.6765076", "0.6713236", "0.6557821", "0.64900696", "0.6467436", "0.6337968", "0.63246053", "0.6239433", "0.62285423", "0.6222591", "0.62074775", "0.62023...
0.0
-1
Goes through the option list AST node and returns a simple hash
def parse_option_list(list) return nil if list.nil? || list.empty? opts = {} list.each do |opt| next unless opt.type == :assoc opts[opt[0].source.delete(':')] = opt[1].source end opts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optionsHash(length = 12)\n # Don't want to always need this as this may be difficult to compile\n require 'sha3'\n\n # Get only hash relevant options\n # Filter out paths\n toHash = @Options.reject { |i| i =~ %r{.*/.*(/|$)}i }\n\n # Reject some known keys\n toHash.delete :epoch\n\n SHA3...
[ "0.6025352", "0.5976743", "0.5860578", "0.56989706", "0.5673511", "0.5648082", "0.5637228", "0.5637228", "0.5627194", "0.5618669", "0.5614243", "0.560229", "0.55786127", "0.5540281", "0.5539108", "0.5538294", "0.5518572", "0.5518572", "0.548595", "0.54764247", "0.5474428", ...
0.54027563
25
GET /housings GET /housings.json
def index @housings = Housing.all.where("qty_places > 0 and koatuu_code like ?", "#{@area}%") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @single_housings = SingleHousing.all\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n @housing_details = HousingDetail.all\n e...
[ "0.72184384", "0.69409096", "0.68730587", "0.6570598", "0.6463594", "0.6412317", "0.633493", "0.6255237", "0.6245763", "0.6229301", "0.6134877", "0.61184716", "0.6114121", "0.61117554", "0.609381", "0.6090281", "0.60653454", "0.60526013", "0.60477334", "0.6046236", "0.6044382...
0.0
-1
GET /housings/1 GET /housings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @single_housings = SingleHousing.all\n end", "def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end", "def index\n @housing_details = HousingDetail.all\n e...
[ "0.71079093", "0.68046117", "0.6716135", "0.6650596", "0.6404722", "0.6327322", "0.62871194", "0.6276337", "0.62570685", "0.62201107", "0.61907303", "0.61881375", "0.610159", "0.60972506", "0.6077421", "0.6076925", "0.6076923", "0.6076868", "0.6029456", "0.6010803", "0.599898...
0.0
-1
POST /housings POST /housings.json
def create @housing = Housing.where(:koatuu_code => housing_params[:koatuu_code], :house_id => housing_params[:house_id]).first if @housing @housing.update(housing_params) else @housing = Housing.new(housing_params) end respond_to do |format| if @housing.save format.html { redirect_to housings_url , notice: 'Housing was successfully created.' } format.json { render :show, status: :created, location: @housing } else format.html { render :new } format.json { render json: @housing.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @housing = Housing.new(housing_params)\n\n respond_to do |format|\n if @housing.save\n format.html { redirect_to @housing, notice: 'Housing was successfully created.' }\n format.json { render :show, status: :created, location: @housing }\n else\n format.html { rend...
[ "0.7066327", "0.6766323", "0.6497598", "0.6463957", "0.6310048", "0.62845093", "0.62830687", "0.62143266", "0.6122061", "0.6091794", "0.6059089", "0.5954079", "0.5917823", "0.58958465", "0.58664143", "0.5843103", "0.5832009", "0.5755843", "0.57505983", "0.5688007", "0.5679139...
0.6391086
4
PATCH/PUT /housings/1 PATCH/PUT /housings/1.json
def update respond_to do |format| if @housing.update(housing_params) format.html { redirect_to housings_url, notice: 'Housing was successfully updated.' } format.json { render json: {}, status: :ok } else format.html { render :edit } format.json { render json: @housing.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html { redirect_to @housing, notice: 'Housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing }\n else\n format.html { render :edit }\n format.json {...
[ "0.68700236", "0.6813215", "0.64628065", "0.63875824", "0.63406414", "0.619106", "0.61232316", "0.60918397", "0.60552204", "0.6036555", "0.5990109", "0.5954635", "0.59215117", "0.5906282", "0.58812267", "0.5864161", "0.5857906", "0.58420086", "0.5813014", "0.57948154", "0.579...
0.691849
0
DELETE /housings/1 DELETE /housings/1.json
def destroy @housing.destroy respond_to do |format| format.html { redirect_to housings_url, notice: 'Housing was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @single_housing.destroy\n respond_to do |format|\n format.html { redirect_to single_housings_url, notice: 'Single housing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @housing = Housing.find(params[:id])\n @housing.destroy\...
[ "0.755772", "0.7230298", "0.7212756", "0.7181153", "0.7154327", "0.706801", "0.6935938", "0.6924718", "0.69001913", "0.68715066", "0.6855303", "0.6813186", "0.6803862", "0.67891985", "0.6761317", "0.6760997", "0.6751623", "0.6739302", "0.6725464", "0.6720256", "0.67103523", ...
0.7375651
2
Use callbacks to share common setup or constraints between actions.
def set_area @area = current_user.area || '-1' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def housing_params params.require(:housing).permit(:koatuu_code, :house_id, :qty_places, :qty_work, :has_school, :has_kgarden) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
Accessor for the defaul database file for event storage :api: public
def default_database_file_path @default_database_file_path ||= 'config/event_storage.yml' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end", "def db_file\n self.class.db_root.join(id) if id\n end", "def file\n TestIds.database_file(id)\n end", "def db_path\n @db\n end", "def current_data\n db_file.data\n e...
[ "0.7000626", "0.682587", "0.6778511", "0.6620623", "0.65521973", "0.63954616", "0.6360361", "0.6232324", "0.6232324", "0.61483806", "0.6142642", "0.6060355", "0.6060355", "0.60186106", "0.59805727", "0.5944416", "0.5934935", "0.59028554", "0.5882658", "0.58720076", "0.5864766...
0.75086784
0
Set the default file path for event storage database :api: puiblic
def default_database_file_path=(file_path) @default_database_file_path = file_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_database_file_path\n\t\t\t@default_database_file_path ||= 'config/event_storage.yml'\n\t\tend", "def default_file\n \"default_data_store.csv\"\n end", "def default_file\n \"#{Dir.home()}/.calendar/calendar-events\"\nend", "def file_path\n PATH_USER_DEFAULTS\n end", "def dat...
[ "0.82553446", "0.6502418", "0.64735174", "0.64683473", "0.6409266", "0.63304013", "0.62342846", "0.6189944", "0.6097308", "0.60664415", "0.60510397", "0.6030726", "0.6002471", "0.6002418", "0.6000513", "0.6000302", "0.59982723", "0.59978426", "0.59383553", "0.5919511", "0.591...
0.74923456
1
Set the default orm which will be used for event storage for example: DataMapper, ActiveRecord :api: public
def default_orm=(orm) @default_orm = orm end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orm\n @orm || self.class.default_orm\n end", "def orm\n @orm || self.class.default_orm\n end", "def orm\n @orm ||= :none\n end", "def default_orm\n\t\t\t@default_orm ||= :in_memory\n\t\tend", "def orm\n if @orm\n return @orm\n else\n self.orm = ENV['ORM']...
[ "0.7589215", "0.7589215", "0.75708133", "0.7504772", "0.7285401", "0.6821647", "0.65716386", "0.6424155", "0.62406355", "0.6104561", "0.589393", "0.5881726", "0.5763401", "0.57331145", "0.56570256", "0.54835", "0.5476469", "0.5476469", "0.5476469", "0.5472961", "0.5387449", ...
0.8160965
0
Accessor for the default orm for event storage :api: public
def default_orm @default_orm ||= :in_memory end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orm\n @orm ||= :none\n end", "def orm\n @orm || self.class.default_orm\n end", "def orm\n @orm || self.class.default_orm\n end", "def orm; end", "def orm\n if @orm\n return @orm\n else\n self.orm = ENV['ORM']\n end\n @orm\n end", "def orm\n...
[ "0.72191226", "0.70545983", "0.70545983", "0.66793704", "0.6501707", "0.6143802", "0.60349303", "0.6034526", "0.59520125", "0.5771679", "0.57458115", "0.57088935", "0.56711555", "0.5445319", "0.5413695", "0.53862387", "0.53808063", "0.53387743", "0.53144675", "0.53037494", "0...
0.65018606
4
The "main loop". Repeat the step method over and over and over until the user quits.
def go catch(:quit) do loop do step end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n while 1\n if step == 1 then break end\n end\n end", "def run\n until halted?\n step\n end\n end", "def go\n catch(:quit) do\n loop do\n step\n end\n end\n end", "def go\n catch(:quit) do\n loop do\n step\n end\n ...
[ "0.7866468", "0.7645067", "0.7620442", "0.7620442", "0.7430358", "0.7328081", "0.7328081", "0.7101209", "0.69213164", "0.6903213", "0.68150705", "0.67959654", "0.679033", "0.67708087", "0.6724095", "0.67037237", "0.6662746", "0.66244173", "0.6620976", "0.6569422", "0.65501726...
0.78232384
1
Checks for collision with other towers or the path
def nice_place_for_tower? ghost @towers.collide_sprite(ghost).empty? and @the_path.collide_sprite(ghost).empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collision?(other)\n Gosu::distance(@x, @y, other.x, other.y) < @radius * @size + other.radius * other.size\n end", "def pass_path_check?(rover)\n temp = rover.coordinate.clone\n rover.command.each do |c|\n temp = Navigation.execute_move(c,temp)\n if not pass_boundary_check?(temp)\n ...
[ "0.6963386", "0.6819959", "0.6751421", "0.6730629", "0.6613538", "0.65943277", "0.6566879", "0.64797884", "0.63932735", "0.63894904", "0.6375184", "0.63698024", "0.6367088", "0.63221306", "0.63045865", "0.62677246", "0.6235533", "0.62260056", "0.6222968", "0.6212772", "0.6198...
0.65229714
7
Create a tower at the click position
def create_tower event if @money >= @tower_price ghost = GhostTower.new( Grid.screenp_to_elementp(event.pos) ) if nice_place_for_tower?(ghost) @money -= @tower_price tower = Tower.new(@event_handler, Grid.screenp_to_elementp(event.pos), @enemies) @towers << tower end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_move_from_click(x, y)\n [:spawn, {:x => x, :y => y}]\n end", "def create_tower(tower_class, position)\n tower = tower_class.new(position)\n @towers[position] = tower\n tower\n end", "def create\n @tower = Tower.new(params[:tower])\n\t\n\t#Vergabe der Koordinaten. Die Karte...
[ "0.6703844", "0.66419053", "0.6123623", "0.5912189", "0.58752793", "0.57569623", "0.5616007", "0.55817765", "0.55669844", "0.55539334", "0.5542541", "0.5494583", "0.54809177", "0.54470783", "0.54187137", "0.5409534", "0.53816617", "0.5370664", "0.533323", "0.53300506", "0.532...
0.6475587
2
Catch the mouse_moved event to set the grid highlighter below the mouse pointer and check for collision with towers and the path
def mouse_moved event pos = Grid.screenp_to_elementp(event.pos) @grid_highlighter.rect.center = pos if nice_place_for_tower? @grid_highlighter @grid_highlighter.green! else @grid_highlighter.red! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mouse_over_grid2?\n inputs.mouse.point.inside_rect?(move_and_scale_up(grid.rect))\n end", "def mouse_over_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))\n end", "def on_mouse_move(new_point)\n end", "def mouse_inside_grid?\n inputs.mouse.point.inside_rect?(scale_up(grid.rect))...
[ "0.6560073", "0.63381416", "0.6071636", "0.6061654", "0.6002149", "0.5892478", "0.58357376", "0.58232707", "0.5777662", "0.5738054", "0.5700814", "0.56836486", "0.5619804", "0.55450755", "0.5520825", "0.5514318", "0.5505819", "0.54881054", "0.54851", "0.5444451", "0.5439363",...
0.7589802
0
Create a new Clock to manage the game framerate so it doesn't use 100% of the CPU
def make_clock @clock = Clock.new() @clock.target_framerate = 30 @clock.calibrate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n @clock.calibrate\n @clock.enable_tick_events\n end", "def setup_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n\n # Adjust the assumed granularity to match the system.\n # This helps minimize CPU usage o...
[ "0.79978204", "0.70827264", "0.67077285", "0.641811", "0.63809264", "0.6365634", "0.6075456", "0.60446995", "0.597796", "0.5841524", "0.5835046", "0.5829557", "0.5829557", "0.5829557", "0.58260524", "0.5824067", "0.57991505", "0.5747886", "0.5710344", "0.57082814", "0.5699343...
0.7810915
1
Set up the event hooks to perform actions in response to certain events.
def make_event_hooks @event_handler = GlobalEventHandler.new @clock hooks = { MouseMoveTrigger.new( :none ) => :mouse_moved, InstanceOfTrigger.new(InvadingEvent) => :enemy_missed, InstanceOfTrigger.new(DeadEvent) => :enemy_defeated, InstanceOfTrigger.new(UpgradeEvent) => :tower_upgrade, :mouse_left => :create_tower, :escape => :quit, :q => :quit, QuitRequested => :quit } make_magic_hooks( hooks ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_event_hooks\n hooks = {\n :escape => :quit,\n :q => :quit,\n QuitRequested => :quit\n }\n \n make_magic_hooks( hooks )\n end", "def def_hooks(*events)\r\n events.each { |event| def_hook(event) }\r\n end", "def setup_event_hooks\n hooks = {\n :escape => :q...
[ "0.72541153", "0.7172629", "0.7144915", "0.6902892", "0.65959185", "0.6592117", "0.63046706", "0.62713045", "0.62215567", "0.61982644", "0.6168912", "0.61664885", "0.61602926", "0.61554533", "0.6150664", "0.6119477", "0.6115126", "0.60960203", "0.60914195", "0.60914195", "0.6...
0.67484117
4
Create the Rubygame window.
def make_screen @screen = Screen.new(Configuration.screen[:size], 32, [HWSURFACE, DOUBLEBUF]) @screen.title = "Towerdefence!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createWindow\r\n \r\n end", "def create\r\n super # Create the windows\r\n show(PLACEMENT_SCREEN) # Make the main window appear\r\n end", "def main_window\r\n super\r\n # Make main command window\r\n main_command_window\r\n # Make play time window\r\n @playtime_wi...
[ "0.75516486", "0.74910516", "0.73814684", "0.7204901", "0.71810746", "0.7034538", "0.7034483", "0.702892", "0.6980009", "0.69718736", "0.69565564", "0.694112", "0.69370496", "0.69194305", "0.6915036", "0.69051766", "0.6845566", "0.6801009", "0.6784766", "0.6767714", "0.672599...
0.64691246
33
Do everything needed for one frame.
def step if @game_over game_over! @event_handler.update else # background for playing field and hud @screen.fill :black @screen.fill [50,50,50], Rect.new(Configuration.screen[:hud_rect]) @event_handler.update @hud.update @clock.framerate.ceil, @round, @enemies.length, @money, @lives+1, @round_timer update_timer restock_enemies! if @restock_enemies > 0 @the_path.draw @screen # Draw the enemy path. @enemies.draw @screen # Draw the enemies. @towers.draw @screen # Draw all set towers. @grid_highlighter.draw @screen # Draw the nifty semi-transparent highlighter below the mouse. @hud.draw @screen # draw the HUD end @screen.update() # Refresh the screen. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frames; end", "def frame; end", "def initial_frame(bindings); end", "def add_frame(frame)\n end", "def c_frame?; end", "def prepare_parsed_frame frame\n end", "def run\n @main_frame.destroy\n @main_frame = TkFrame.new(@root).pack('padx'=>10, 'pady'=>10)\n self.make_header\n self.mak...
[ "0.7088079", "0.70585895", "0.646256", "0.64352036", "0.6366288", "0.63540554", "0.6266399", "0.618032", "0.61409354", "0.6112916", "0.608232", "0.6058675", "0.60146797", "0.59842044", "0.59544444", "0.5953314", "0.5882208", "0.5855278", "0.57726943", "0.57268274", "0.5704561...
0.0
-1
Used from the Homepage
def email_demo_invoice if params[:email] =~ /^([a-zA-Z0-9_\-\.&]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/ @document = Invoice.demo # HARDCODED: A Demo Invoice return if @document.nil? account = Account.demo to = params[:email] from = @app_config['system_email'] message = "This is a demo invoice that somebody sent from http://www.fluttervoice.co.za. Please let us know of any abuse." summary_url = "http://#{base_url(account)}/summary/" + "show".obfuscate + "/" + @document.id.to_s.obfuscate invoice_html = construct_email_html_for_document(@document) if DocumentMailer.deliver_invoice(to, from, "", account, @document, invoice_html, summary_url, message, @app_config) log_email("Demo", @document, to, 0) render :text => "", :status => 200 else render :text => "Can't send.", :status => 200 end else render :text => "Malformed email", :status => 200 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def home\r\n \r\n end", "def homepage\n end", "def homepage\n end", "def home; end", "def home\n\t\t# Home Page\n\tend", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def homepage\n end", "de...
[ "0.7037977", "0.7037977", "0.7027376", "0.6886675", "0.6886675", "0.68683857", "0.6839523", "0.6777875", "0.6777875", "0.6777875", "0.6777875", "0.67467785", "0.67467785", "0.67440295", "0.67440295", "0.67440295", "0.67440295", "0.67440295", "0.67440295", "0.67440295", "0.674...
0.0
-1
GET /marcacaopontos/1 GET /marcacaopontos/1.xml
def show @marcacaoponto = Marcacaoponto.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @marcacaoponto } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cuentas = Cuenta.all\n\n @cadena = getcuentasxml\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cadena }\n end\n end", "def new\n @marcacaoponto = Marcacaoponto.new\n\n respond_to do |format|\n format.html # new.htm...
[ "0.6507925", "0.6355798", "0.626392", "0.62466764", "0.6246254", "0.6231475", "0.62101877", "0.62078184", "0.6150361", "0.61473423", "0.6085836", "0.6069337", "0.6059331", "0.60569733", "0.6042903", "0.60393345", "0.60349005", "0.60255176", "0.60218775", "0.6006742", "0.60063...
0.6772232
0
GET /marcacaopontos/new GET /marcacaopontos/new.xml
def new @marcacaoponto = Marcacaoponto.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @marcacaoponto } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @promocao = Promocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @promocao }\n end\n end", "def new\n @remocao = Remocao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remocao...
[ "0.7047252", "0.7028768", "0.69980896", "0.6975223", "0.6962217", "0.6957773", "0.6952521", "0.69437766", "0.6942459", "0.69397026", "0.69379586", "0.68980426", "0.68767387", "0.68513674", "0.6850637", "0.68451303", "0.68437487", "0.682638", "0.6804079", "0.68030065", "0.6795...
0.756552
0
POST /marcacaopontos POST /marcacaopontos.xml
def create #@funcionario = Funcionario.find(params[:marcacaoponto][:funcionario_id]) #@funcionario.marcar_ponto("aowpa") #flash[:notice] = 'Ponto Criado!' #format.html { redirect_to(marcacaopontos_path) } #format.xml { head :ok } @marcacaoponto = Marcacaoponto.new(params[:marcacaoponto]) respond_to do |format| if @marcacaoponto.save flash[:notice] = 'Marcacao de Ponto criada com sucesso.' format.html { redirect_to(marcacaopontos_path) } format.xml { head :ok } else format.html { render :action => "new" } format.xml { render :xml => @marcacaoponto.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @reclamacao = Reclamacao.new(params[:reclamacao])\n\n respond_to do |format|\n if @reclamacao.save\n format.html { redirect_to(@reclamacao, :notice => 'Reclamacao was successfully created.') }\n format.xml { render :xml => @reclamacao, :status => :created, :location => @recla...
[ "0.60414606", "0.6015923", "0.58203334", "0.5773238", "0.56842154", "0.56769735", "0.56623936", "0.5623772", "0.5623749", "0.5604961", "0.55904496", "0.558184", "0.5575981", "0.5558519", "0.5521275", "0.55135226", "0.5495433", "0.5494733", "0.54803604", "0.54629236", "0.54514...
0.610947
0
PUT /marcacaopontos/1 PUT /marcacaopontos/1.xml
def update @marcacaoponto = Marcacaoponto.find(params[:id]) respond_to do |format| if @marcacaoponto.update_attributes(params[:marcacaoponto]) flash[:notice] = 'Ponto Atualizado!' format.html { redirect_to(@marcacaoponto) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @marcacaoponto.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update \t\n\t @cinema = Cinema.find(params[:id])\n\t\t@cities = City.find(:all)\n\t\t\n\t respond_to do |format|\n\t if @cinema.update_attributes(params[:cinema])\n\t \n\t update_cinemas_xml()\n\t \n\t format.html { redirect_to(@cinema, :notice => 'Kino zostało pomyślnie zaktualizowan...
[ "0.57831573", "0.5742875", "0.57174075", "0.5714749", "0.5652142", "0.56308526", "0.55922514", "0.5580831", "0.55558944", "0.5537139", "0.55140734", "0.55095416", "0.548215", "0.54403645", "0.5433243", "0.54234266", "0.5405276", "0.5401893", "0.5394445", "0.5389831", "0.53894...
0.6179786
0
DELETE /marcacaopontos/1 DELETE /marcacaopontos/1.xml
def destroy month = params[:mes] year = params[:ano] @marcacaoponto = Marcacaoponto.find(params[:id]) @funcionario = @marcacaoponto.funcionario @marcacaoponto.destroy respond_to do |format| format.html { redirect_to(:back) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev...
[ "0.6776342", "0.67257506", "0.67238146", "0.6721603", "0.66705644", "0.6627106", "0.6610462", "0.6550836", "0.65339255", "0.6532901", "0.6528476", "0.6478508", "0.6447259", "0.6441126", "0.6432749", "0.64248174", "0.6410489", "0.64097655", "0.64015675", "0.6389183", "0.638352...
0.62220216
78
Scene_Battle:Regenerate Regenerate HP/SP on defend
def regenerate hp_restore = (@active_battler.maxhp * TyRegen::Actor_HP_regen[@active_battler.id]) /100 hp_restore = (@active_battler.maxhp * TyRegen::Enemy_HP_regen[@active_battler.id]) /100 if @active_battler.is_a?(Game_Enemy) sp_restore = (@active_battler.maxsp * TyRegen::Actor_SP_regen[@active_battler.id]) /100 sp_restore = (@active_battler.maxsp * TyRegen::Enemy_SP_regen[@active_battler.id]) /100 if @active_battler.is_a?(Game_Enemy) hp_store1 = @active_battler.hp sp_store1 = @active_battler.sp @active_battler.hp += hp_restore @active_battler.sp += sp_restore hp_store2 = @active_battler.hp sp_store2 = @active_battler.sp hp_restore = hp_store2 - hp_store1 sp_restore = sp_store2 - sp_store1 @help_window.set_text("#{@active_battler.name} recovered #{hp_restore} #{$data_system.words.hp} & #{sp_restore} #{$data_system.words.sp}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_hp_regeneration\n @superman.hp_pool += @superman.hp_regen\n @batman.hp_pool += @batman.hp_regen\n end", "def apply_regen_state(state, type)\n random = state.tool_data(\"State Effect Rand Rate = \") \n random = 120 if random.nil?\n if rand(random) == 1\n battler.regenerate_hp if type...
[ "0.6554139", "0.6262687", "0.62239647", "0.6119065", "0.6021834", "0.6013211", "0.594269", "0.594269", "0.594269", "0.594269", "0.5936846", "0.5821341", "0.57636493", "0.5756815", "0.57545966", "0.5743297", "0.5688605", "0.56537277", "0.565178", "0.5649824", "0.5647486", "0...
0.752431
0
public instance methods ...................................................
def incomplete? !completed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def initialize\n\t\t\n\tend", "def instance; end", "def instance; end", "def instance; end", "def internal; end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n \n end"...
[ "0.8471986", "0.75887525", "0.75887525", "0.7408363", "0.7389037", "0.7389037", "0.7389037", "0.733222", "0.7306463", "0.7306463", "0.7306463", "0.7306463", "0.72930485", "0.7246825", "0.71916157", "0.71916157", "0.7188285", "0.7188285", "0.7188285", "0.7188285", "0.71772283"...
0.0
-1
GET /events GET /events.json
def index @events = Event.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}...
[ "0.8337294", "0.82393", "0.7943906", "0.7928331", "0.77682066", "0.77408546", "0.76701826", "0.7665501", "0.76581633", "0.7642472", "0.76212007", "0.7615658", "0.7615658", "0.7612881", "0.75687", "0.7522498", "0.7488667", "0.74813455", "0.74698067", "0.7441679", "0.74408287",...
0.0
-1
GET /events/1 GET /events/1.json
def show @event = Event.find(params[:id]) # ^^^^ + show.json.jbuilder + builder.key_format camelize: :lower in environment.rb will # convert ruby's model_properties into json's modelProperties. # Verify by viewing http://localhost:3000/events/1926.json and seeing camelcase, not snakecase. # and it replaces the code below: # respond_to do |format| # format.html # format.json { render :json => @event } # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use...
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.719221...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def event_params params.require(:event).permit(:id, :guid, :last_modified, :last_modified_utc, :row_version, :body_id, :body_name, :date, :time, :video_status, :agenda_status_id, :minutes_status_id, :location) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
See VR::ListView constructor. (exactly the same)
def initialize(cols) super() self.model = Gtk::TreeStore.new(*flatten_hash(cols).values) load_columns(cols) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(list)\n super(list.first, :view, list)\n end", "def list_items_preview\n end", "def li; self.list_item = true; self; end", "def initialize(x, y, height = window_height)\n make_item_list\n super(x, y, window_width, height)\n refresh\n @old_index = 0\n @active_index =...
[ "0.72865623", "0.6436235", "0.63395077", "0.61986715", "0.61108726", "0.6095199", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.6073", "0.607...
0.0
-1
Adds row to the model. This will return a "row" type iter that responds to column IDs (symbols). You need to provide a parent row (iter). See GtkTreeViewappend for more. The iter is a GtkTreeIter object for the parent or nil for the root of the tree. The hash argument is a Hash of values to add:
def add_row(parent, hash = {}) row = vr_row(model.append(parent)) hash.each_pair { |key, val| row[key] = val } return row end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_row(hash = {})\n row = vr_row(model.append)\n hash.each_pair { |key, val| row[key] = val }\n return row\n end", "def add_row(row)\n raise('Cannot add a row. No parameters have been set.') if rows.empty?\n\n # A quick 'deep clone' so that the input isn't modified\n row = M...
[ "0.6705847", "0.6083646", "0.5916063", "0.5857531", "0.5715465", "0.57019216", "0.5698664", "0.5599705", "0.55916786", "0.55442554", "0.5460704", "0.5448143", "0.5411198", "0.53930837", "0.5351048", "0.5331989", "0.5235684", "0.52001274", "0.5188016", "0.5084973", "0.5075559"...
0.76181024
0
accessor for t stepsize
def initialize (update_fn, step_size: 0.01, x_lims: (-5.0..5.0), y_lims: (-5.0..5.0), t_lims: (0..1), num_points: 20) @update_fn = update_fn #set update functions @x_lims = x_lims #set bounds @y_lims = y_lims @t_lims = t_lims @num_points = num_points #set number of points @step_size = step_size #set step size @time_plots = [] generate #generate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_size\n self['Step'] || 0\n end", "def step_size\n return @box_size * Math.sqrt(2)\n end", "def step_number\n @step_number ||= (@time.to_f/60.0*sign.tempo).floor\n end", "def steps\n @steps ||= 0\n end", "def tenth_frame; end", "def step_length_threshold\n @step_l...
[ "0.796391", "0.72909784", "0.66602206", "0.61142826", "0.6058459", "0.60520846", "0.60361636", "0.5956284", "0.57470006", "0.57433593", "0.5720194", "0.5706357", "0.5678366", "0.5661589", "0.5634017", "0.5606637", "0.55988914", "0.5598553", "0.55636436", "0.5542546", "0.55349...
0.0
-1
========== SIMULATING ========== initialize num_pointsmany doubles to random values within x&y bounds
def generate #create random number generator rng = Random.new @points = Array.new #num_points times, make random value in ranges @num_points.times do @points << [rng.rand(@x_lims), rng.rand(@y_lims)] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rand_point()\n \n end", "def rand_point\n return nil if @width == 0 || @height == 0\n Point.new(1 + @x + rand(@x + @width), 1 + @y + rand(@y + @height))\n end", "def random_point\n while true\n x = rand(0...@p)\n yy = (x**3 + @a*x + @b) % @p\n y = yy.sqrtmod(@p)\n if...
[ "0.6524522", "0.6396047", "0.6362196", "0.6357352", "0.63493663", "0.632429", "0.6209854", "0.620013", "0.61334074", "0.6094418", "0.60881704", "0.6070348", "0.6061945", "0.6019897", "0.6000051", "0.594463", "0.59376526", "0.592878", "0.5919226", "0.58738345", "0.5823993", ...
0.7016198
0
returns rk4 weighted sum for updating
def rk4_weight (h) weighted_sum = Array.new @points.each do |point| #terms in RK4 summation # puts point.inspect k0 = @update_fn.call(*point) k1 = @update_fn.call(point[0] + k0[0]/2.0, point[1] + h/2.0) k2 = @update_fn.call(point[0] + k1[0]/2.0, point[1] + h/2.0) k3 = @update_fn.call(point[0] + k2[0], point[1] + h) weighted_sum << [(k0[0] + 2*k1[0] + 2*k2[0] + k3[0])/6.0, (k0[1] + 2*k1[1] + 2*k2[1] + k3[1])/6.0] end # puts "\n\n" return weighted_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_total_weight\n 0\n end", "def weightedsum\n ws = 0\n @inputs.each_index { |i| ws = ws + @inputs[i]*@weights[i] }\n ws\n end", "def calculate_weight\n update_attribute :weight, votes.sum(:value)\n weight\n end", "def total_kg_ch4\n\t\t(calculations.collect(&:calc_kg_ch4).sum).rou...
[ "0.6737412", "0.66213965", "0.6487729", "0.6355496", "0.6339078", "0.61847144", "0.61082226", "0.6007703", "0.597242", "0.59690857", "0.5969014", "0.59632385", "0.59417117", "0.59412444", "0.589232", "0.58887297", "0.58872783", "0.5836133", "0.5809042", "0.5807706", "0.579140...
0.81027377
0
end instead of deleting, indicate the user requested a delete & timestamp it
def soft_delete update_attribute(:deleted_at, Time.current) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n \n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def deleted\n @is_deleted = true\n end", "def delete\n end", "def delete\n ...
[ "0.71231127", "0.6765368", "0.6763522", "0.6763522", "0.6763522", "0.6763522", "0.6763522", "0.6763522", "0.6763522", "0.6762749", "0.6747547", "0.67471266", "0.6740517", "0.67295724", "0.6704986", "0.67026883", "0.666597", "0.666597", "0.6651926", "0.66208404", "0.66102254",...
0.0
-1
ensure user account is active
def active_for_authentication? super && !deleted_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_active_user\n unless current_user && current_user.status == UserStatus::ACTIVE\n flash[:alert]= I18n.t 'auth.msg.lock_account'\n redirect_to new_user_sessions_url\n return false\n end\n end", "def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",...
[ "0.7820145", "0.73031145", "0.7296796", "0.72714067", "0.72605324", "0.7186465", "0.7184313", "0.7182273", "0.7140091", "0.70876205", "0.7038106", "0.7035326", "0.7020518", "0.699827", "0.69793344", "0.6973365", "0.6956432", "0.69559634", "0.69512725", "0.6950539", "0.6938509...
0.0
-1
provide a custom message for a deleted account
def inactive_message !deleted_at ? super : :deleted_account end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inactive_message\n \t!delete_flag ? super : :deleted_account\n end", "def inactive_message\n\t\t\t!delete_flag ? super : :deleted_account\n\t\tend", "def inactive_message\n \t!deleted_at ? super : :deleted_account\n end", "def inactive_message\n \t!deleted_at ? super : :deleted_account\n end", "d...
[ "0.7748454", "0.76111054", "0.7340721", "0.7340721", "0.7335309", "0.7303815", "0.72608256", "0.7252251", "0.72503877", "0.72373444", "0.72357714", "0.72048134", "0.69019526", "0.67021453", "0.6642065", "0.66013336", "0.6535773", "0.6467926", "0.6448776", "0.6448776", "0.6367...
0.73679733
17
GET /grupo_analises GET /grupo_analises.json
def index @grupo_analises = GrupoAnalise.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end", "def show\n render json: @grupoassunto\n end", "...
[ "0.6898312", "0.6802731", "0.67092216", "0.6535089", "0.6450298", "0.6390341", "0.6378799", "0.6349098", "0.63226354", "0.63226354", "0.6321937", "0.6265719", "0.62038016", "0.6095388", "0.6081638", "0.6071559", "0.6037998", "0.6033708", "0.6004247", "0.5997593", "0.59927404"...
0.7824852
0
GET /grupo_analises/1 GET /grupo_analises/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @grupo_analises = GrupoAnalise.all\n end", "def show\n render json: @grupoassunto\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.7491707", "0.71272445", "0.71180916", "0.7084267", "0.6874444", "0.6794788", "0.66558003", "0.66479564", "0.65816575", "0.65801704", "0.65801704", "0.6575551", "0.65722466", "0.6510061", "0.6468444", "0.6459438", "0.6426389", "0.64162415", "0.6400824", "0.6388873", "0.6340...
0.0
-1
POST /grupo_analises POST /grupo_analises.json
def create @grupo_analise = GrupoAnalise.new(grupo_analise_params) respond_to do |format| if @grupo_analise.save format.html { redirect_to @grupo_analise, notice: 'Grupo analise was successfully created.' } format.json { render :show, status: :created, location: @grupo_analise } else format.html { render :new } format.json { render json: @grupo_analise.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @grupoassunto = Grupoassunto.new(grupoassunto_params)\n\n if @grupoassunto.save\n render json: @grupoassunto, status: :created, location: @grupoassunto\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end", "def index\n @grupo_analises = Gru...
[ "0.67899764", "0.67538756", "0.6567622", "0.6491808", "0.64487964", "0.6392561", "0.63191146", "0.63026077", "0.6244676", "0.6171146", "0.6166595", "0.6137005", "0.6072715", "0.606018", "0.6050139", "0.60345733", "0.6033062", "0.60277605", "0.6021271", "0.59779125", "0.594398...
0.70513517
0
PATCH/PUT /grupo_analises/1 PATCH/PUT /grupo_analises/1.json
def update respond_to do |format| if @grupo_analise.update(grupo_analise_params) format.html { redirect_to @grupo_analise, notice: 'Grupo analise was successfully updated.' } format.json { render :show, status: :ok, location: @grupo_analise } else format.html { render :edit } format.json { render json: @grupo_analise.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @grupa = Grupa.find(params[:id])\n\n respond_to do |format|\n if @grupa.update_attributes(params[:grupa])\n format.html { redirect_to @grupa, notice: 'Grupa została zaktualizowana.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\"...
[ "0.7414936", "0.7253425", "0.72454494", "0.7123235", "0.71171296", "0.70987415", "0.709302", "0.70009494", "0.6907147", "0.6829476", "0.68163306", "0.6804269", "0.68013006", "0.67193604", "0.6681556", "0.66735405", "0.66343415", "0.66050947", "0.659151", "0.6565862", "0.65515...
0.7349972
1
DELETE /grupo_analises/1 DELETE /grupo_analises/1.json
def destroy @grupo_analise.destroy respond_to do |format| format.html { redirect_to grupo_analises_url, notice: 'Grupo analise was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @grupa = Grupa.find(params[:id])\n @grupa.destroy\n\n respond_to do |format|\n format.html { redirect_to grupy_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grupo = Grupo.find(params[:id])\n @grupo.destroy\n\n respond_to do |format|\n fo...
[ "0.7803143", "0.7583918", "0.75618994", "0.75393355", "0.74877524", "0.744965", "0.7445721", "0.7420944", "0.7410296", "0.740369", "0.73629665", "0.73462707", "0.7295896", "0.72636396", "0.72143203", "0.7154597", "0.7122088", "0.7115252", "0.71026945", "0.7081715", "0.7075787...
0.78005916
1
Use callbacks to share common setup or constraints between actions.
def set_grupo_analise @grupo_analise = GrupoAnalise.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def grupo_analise_params params.require(:grupo_analise).permit(:title, :description, :user_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Setting up allowed parameters
def order_params params.require(:order).permit(:user_id, :order_date, :expiration_date, movie_copy_ids: []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params; true; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def valid_params?; end", "def valid_params_request?; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameter...
[ "0.73358256", "0.72714645", "0.72465783", "0.7163564", "0.6834496", "0.6834496", "0.6834496", "0.6834496", "0.6834496", "0.6834496", "0.6834496", "0.6834496", "0.67249656", "0.6720008", "0.669795", "0.6664903", "0.663725", "0.66301346", "0.66207135", "0.66207135", "0.66207135...
0.0
-1
A double number is a number with an even number of digits whose leftside digits are exactly the same as its rightside digits. For example, 44, 3333, 103103, 7676 are all double numbers. 444, 334433, and 107 are not. Write a method that returns 2 times the number provided as an argument, unless the argument is a double number; double numbers should be returned asis.
def twice(num) left_side = num.to_s.chars right_side = left_side.pop(left_side.length/2) left_side == right_side ? num : num * 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twice(num)\n if num.to_s.length.even? && check_double(num.to_s.split('')) == true\n num\n else\n num * 2\n end\nend", "def double_it(number)\n array = number.to_s.split('')\n if array.size.odd?\n number * 2\n else\n half_index = array.size / 2\n if array[0...half_index] == array[half_ind...
[ "0.79292685", "0.77793485", "0.76055485", "0.75816", "0.72778535", "0.7227867", "0.7181477", "0.71550536", "0.70688057", "0.7025478", "0.7008702", "0.7007433", "0.69759935", "0.6966556", "0.69653594", "0.6915054", "0.6900765", "0.68817186", "0.68622875", "0.6860613", "0.68467...
0.68905467
17
Ajax para crear y destruir continua en config/application.rb Se invoca el archivo .js.erb Inclusion de codigo en config/application.rb
def create @usuario = Usuario.find(params[:seguido_id]) usuario_actual.seguir(@usuario) # respuesta para AJAX respond_to do |formato| formato.html { redirect_to @usuario } formato.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_js; end", "def initial_dynamic_javascript\n res = []\n # res << %(Ext.Ajax.extraParams = {authenticity_token: '#{form_authenticity_token}'}; // Rails' forgery protection)\n res << %{Ext.ns('Netzke');}\n res << %{Ext.ns('Netzke.core');}\n res << %{...
[ "0.6904683", "0.6690189", "0.65853995", "0.65307015", "0.63738", "0.63502264", "0.62832236", "0.62735564", "0.6269487", "0.62136847", "0.6213034", "0.6197119", "0.61870253", "0.6170968", "0.6146361", "0.6145448", "0.61446434", "0.61258525", "0.6091451", "0.6025741", "0.601009...
0.5711408
61