query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "a9497c4d2b51349b74e719358584d896", "score": "0.0", "text": "def update!(**args)\n @hw_version = args[:hw_version] if args.key?(:hw_version)\n @manufacturer = args[:manufacturer] if args.key?(:manufacturer)\n @model = args[:model] if args.key?(:model)\n @sw...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
cbbe4067c33f86a0c3e045a8c81337a6
selects and returns the secret word
[ { "docid": "262bb58c6eed50a0046b504310afd363", "score": "0.7294317", "text": "def pick_secret_word\n\t\tFile.read(\"5desk.txt\").lines.select {|word| (4..9).cover?(word.size)}.sample.strip\n\tend", "title": "" } ]
[ { "docid": "73b5207d115d753782c97bcd3b1da7f9", "score": "0.7981048", "text": "def pick_secret_word\n @word = dictionary.sample\n word\n end", "title": "" }, { "docid": "011a2e6a9b3287de42f76215fd6dc714", "score": "0.7892703", "text": "def pick_secret_word\n\t\t@secret_word = @...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "04f3e040217c061d4dd135bd5eb01fbc", "score": "0.0", "text": "def set_country\n @country = Country.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60328794", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6017492", "text": "de...
17e910ae7d0517ea85c8c7f8898fc93d
This function takes in the hash and returns the value assosciated with the key :total cah which is in turn assosciated with the :admin key
[ { "docid": "8ee8b4d7663a7a54754a1ca5771cf9c9", "score": "0.74872816", "text": "def total_cash(pet_shop_hash)\n return pet_shop_hash[:admin][:total_cash]\nend", "title": "" } ]
[ { "docid": "dc1ced7af3478a6c6cf99c36a7bb6977", "score": "0.7330216", "text": "def total_cash(sum)\n return sum[:admin][:total_cash]\nend", "title": "" }, { "docid": "19e2b7070e72d9f88348a489a60b9c8f", "score": "0.73117876", "text": "def total_cash(cash)\n return cash[:admin][:tot...
0fb3fdd96631dc07c11c011c82299aee
POST /covers POST /covers.json
[ { "docid": "94d327d76359bd5698459f25b69c60a8", "score": "0.56014794", "text": "def create\n if params[:cover][:special_attribute] == 'covershot'\n @current_user_cover_pics = current_user.covers.where(upload_type: 'cover')\n @current_user_cover_pics.each do |s|\n if s.special_attribut...
[ { "docid": "70a8009b3279bd36e4a957bd49d69916", "score": "0.71079063", "text": "def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n params[:covers]['path'].each do |cover|\n @movie.covers.create!(:path => cover, :movie_id => @movie.id)\n ...
ff5f51496f76295a2432b0f34640de57
Sets default values and creates empty collections Initialization happens in the first frame only
[ { "docid": "d8fb72523486a33af29882052c28b83f", "score": "0.0", "text": "def defaults args\n args.state.notes ||= []\n args.state.click_feedbacks ||= []\n args.state.current_level ||= 1\n args.state.times_wrong ||= 0 # when game starts, user hasn't guessed wrong yet\nend", "title": "" } ]
[ { "docid": "dd832715d087664c104e1470c759b051", "score": "0.7833542", "text": "def initvars\n @value_collection = ValueCollection.new\n end", "title": "" }, { "docid": "3ebf242570ffb6cc7159a5c74b0f3cb2", "score": "0.75053644", "text": "def initialize_defaults\n end", "t...
149f0534bee1d55177f244839abd5261
POST /effect/resource_effects POST /effect/resource_effects.json
[ { "docid": "7fa492fafa2a1dc73744a7e43785beaa", "score": "0.7661754", "text": "def create\n @effect_resource_effect = Effect::ResourceEffect.new(params[:effect_resource_effect])\n\n respond_to do |format|\n if @effect_resource_effect.save\n format.html { redirect_to @effect_resource_eff...
[ { "docid": "88ecb8195a9a6047f5493bf6ab368f13", "score": "0.7413265", "text": "def create\n @effect = Effect.new(effect_params)\n\n if @effect.save\n render json: @effect, status: :created, location: @effect\n else\n render json: @effect.errors, status: :unprocessable_entity\n end\n...
625575cc4896d9e464f996f3f608b5a0
The king can attack to the castle on the queen side
[ { "docid": "4342d6cc01ad65adc10eac05d3d47e95", "score": "0.0", "text": "def castling_queenside?(x, y)\n x == 2 && y == y_position && castling_rook_queenside && castling_rook_queenside.castling_never_moved? && \\\n castling_rook_queenside.blocked?(4, y_position) == false\n end", "title": "" ...
[ { "docid": "35f1c8a528ac72749baaa896ba961de4", "score": "0.703023", "text": "def check_castle\n @can_castle_kingside = false\n @can_castle_queenside = false\n\n if !@moved && !@attacked\n row = (@side == :white) ? \"1\" : \"8\"\n # Check kingside castle\n piece = @board.get(\"h#{...
20d30acc30c3b38463603afaf6d24c42
PUT /comprobantecreditos/1 PUT /comprobantecreditos/1.xml
[ { "docid": "cfa4fe6cddc70be535318355a1216613", "score": "0.6278014", "text": "def update\n respond_to do |format|\n if @comprobantecredito.update_attributes(params[:comprobantecredito])\n format.html { redirect_to([@cliente, @comprobantecredito], :notice => t('flash.actions.update.notice'...
[ { "docid": "c16e8da224c52c856a9283b7f7c163e0", "score": "0.6315815", "text": "def update\n @comptype = Comptype.find(params[:comptype][:id])\n\n respond_to do |format|\n if @comptype.update_attributes(params[:comptype])\n format.xml { head :ok }\n end\n end\n end", "title...
9d0e8fadd486c322af1c065a6bdacaaa
Set header value from their native type Params: val Typed header value
[ { "docid": "4d89fff287b942088bf480815e5d569d", "score": "0.0", "text": "def set(val)\n @value = val\n @http_value = nil\n self\n end", "title": "" } ]
[ { "docid": "0c406557409031d34420f5377891ff57", "score": "0.6947531", "text": "def set_header(header, value)\n @lunetas_headers[header.to_s] = value\n end", "title": "" }, { "docid": "cb545b7ed475dce2196c23ec8015a79c", "score": "0.67802024", "text": "def header= h\n @head...
03ab0719d08c9180f980a59af9af1aae
Does the rule value contain a forbidden lowercase or ?
[ { "docid": "996ad6d9d69a55340aed1b8b2260dc1c", "score": "0.7353953", "text": "def contains_lowercase_or?\n !@value[/ or /].nil?\n end", "title": "" } ]
[ { "docid": "da379bf105c8d63e4acfb7741b4a95e7", "score": "0.7802055", "text": "def case_sensitive?\n !rule.casefold?\n end", "title": "" }, { "docid": "da379bf105c8d63e4acfb7741b4a95e7", "score": "0.7802055", "text": "def case_sensitive?\n !rule.casefold?\n end", "...
6842906e7d3481ad4e19dda85eb654e9
POST /vods POST /vods.json
[ { "docid": "a7db80f3898bd247a67f56451385a143", "score": "0.55291104", "text": "def create\n @vod = Vod.new(vod_params)\n #@vod.push_to_elaine if @vod.elaineid.zero?\n\n respond_to do |format|\n if @vod.save\n format.html { redirect_to @vod, notice: 'Vod was successfully created.' }\...
[ { "docid": "49cf1d25ae99c8905f7e89a02b80c453", "score": "0.60455334", "text": "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "title": "" }, { "docid": "386d94a7740d...
5c5e765b2c2a2d57438ab64dc7790be5
POST /student_forms POST /student_forms.json
[ { "docid": "02faf6164170d8255a753aeb1fe3df74", "score": "0.7351373", "text": "def create\n @student_form = StudentForm.new(student_form_params)\n\n respond_to do |format|\n if @student_form.save\n format.html { redirect_to @student_form, notice: 'Student form was successfully created.'...
[ { "docid": "140a723a7210f45fbf776dcd6aa4cdb7", "score": "0.7280514", "text": "def create\n @studentform = Studentform.new(studentform_params)\n\n respond_to do |format|\n if @studentform.save\n format.html { redirect_to @studentform, notice: 'Studentform was successfully created.' }\n ...
ddf4c0f02fe274f88a107b8be59f812e
Tell if the current system is a descedent of +system+
[ { "docid": "a470f6c8fcad09395d402e50c8197d54", "score": "0.7067402", "text": "def of?(system)\n # Maybe self is system.\n if (self == system) then\n # Yes, consider it is adescendent of system.\n return true\n else\n # Look in...
[ { "docid": "c17f7cc69dbd553257aaa5c1e1637428", "score": "0.7449838", "text": "def system?\n @system\n end", "title": "" }, { "docid": "977835363aeb0c0c51350d765f99db01", "score": "0.7447236", "text": "def system?\n not @system.nil?\n end", "title": "" }, {...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fec958f4306c3285fcc2ceca38c0a6bb", "score": "0.0", "text": "def set_template\n @template = Template.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61642385", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60448", "text": "def action_hook; ...
757f510381779660e0271225dc8587e7
Create a function that takes two numbers as arguments and return the LCM of the two numbers. Examples
[ { "docid": "cd0872427c0f76b1601ccee769b5f997", "score": "0.8193886", "text": "def lcm(num1, num2)\n num1.lcm(num2)\nend", "title": "" } ]
[ { "docid": "cca75684fb26be58d9ab342b335cfc45", "score": "0.8379715", "text": "def LCM(a, b)\n tmp = a.gcd(b)\n return a*b/tmp\nend", "title": "" }, { "docid": "a12d6d15b13c9dbb59387a89e01647b6", "score": "0.78563803", "text": "def findlcm(a,b)\n a.lcm(b)\nend", "title": "" }...
a12b8c453b17fdf77c7c02343cc638d0
escape hash values Takes a hash and converts the values to the URL encoded forms hash a nonembeded hash
[ { "docid": "f892a98ddd440f3d1568cfe21d98a154", "score": "0.7891844", "text": "def escape_hash(hash) \n encoded_hash = {}\n hash.each do |key,value|\n if value.class == String #non string values can be passed into the parameters. The encoding only needs to be performed on Sting objects. \n ...
[ { "docid": "ef97794e6c9a3c47f541b884c1602d46", "score": "0.7958597", "text": "def encode_hash(hash)\n URI.encode_www_form hash\n end", "title": "" }, { "docid": "722857dc47fa7b7bad8db08b3663a89f", "score": "0.766635", "text": "def cgi_escape_hash(hash)\n hash.inject({}) do |...
d8e68758c91f3005c0e2531d3041316b
Generate a string from an array of service_characteristics TODO: translate strings for special code cases
[ { "docid": "ae69753601b4a9d06b4215fa81179f32", "score": "0.6448087", "text": "def service_characteristics_group_to_s(group)\n translated = group.map do |m|\n translate_service_characteristic_map m\n end\n\n translated.join \" AND \"\n end", "title": "" } ]
[ { "docid": "955a91423584f7a7a5426eaa8e57fdd7", "score": "0.6214107", "text": "def service_code\n \"#{shipment_mode_code}#{service_type_code}#{services_code}\"\n end", "title": "" }, { "docid": "715c55811b370fc66a54f2e285aaba51", "score": "0.6052542", "text": "def generate_service...
6b018dba67dc971538d9ca46cf58aa8d
obj true or false Compares two objects based on the receiver's method, returning true if it returns a value less than or equal to 0.
[ { "docid": "fbdf1664f60cc8d0d295494099439711", "score": "0.0", "text": "def <= other\n #This is a stub, used for indexing\n end", "title": "" } ]
[ { "docid": "59ddcc6d91dc7e68bbd248b9e64f3dfe", "score": "0.7158029", "text": "def ==(obj_)\n (self <=> obj_) == 0\n end", "title": "" }, { "docid": "605a19affcd17707c13ac5479851889e", "score": "0.67004603", "text": "def negative?\n return self < 0\n end", "title": "" ...
6d137d176667e837ac2737c7bde34bdc
Parses keynumerichashes into arrays and converts special modelstrings into actual models.
[ { "docid": "70dff63e68ad6316e17ae20adff41014", "score": "0.0", "text": "def parse_args(arg)\n if arg.is_a?(Hash) and Knj::ArrayExt.hash_numeric_keys?(arg)\n arr = []\n \n arg.each do |key, val|\n arr << val\n end\n \n return self.parse_args(arr)\n elsif arg.is_...
[ { "docid": "8e716e32f37bb514d1608c411cd2a690", "score": "0.6358381", "text": "def parse_key(keys)\n keys.tr(\"^a-zA-Z0-9 \", \" \").squeeze(\" \").strip.split(\" \")\n end", "title": "" }, { "docid": "007887ef31ced973079a4005a6bcf993", "score": "0.57684386", "text": "def parse_ke...
f23ee5b9c69f6c07994cd3e84b05fb24
really this should be its own controller, but I'm so lazy
[ { "docid": "9ad00a20b943e82e15e27bffe4fa1865", "score": "0.0", "text": "def df\n render text: `#{Rails.application.secrets.db_df_command}`\n end", "title": "" } ]
[ { "docid": "77c80309c9604e96c8868ed9ff3be3f0", "score": "0.72828585", "text": "def controller(controller); end", "title": "" }, { "docid": "40f7f9a8053cda5781e8cf27340a2d71", "score": "0.7170561", "text": "def controller; end", "title": "" }, { "docid": "40f7f9a8053cda578...
85448dcf0315ad86cb520fb59e1a91c9
Update email text field at view from user select
[ { "docid": "38f53149757fc4208772e2bf0b08b87b", "score": "0.67485845", "text": "def update_email_textfield_from_user\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # update_company_textfield_from_office.html.erb does not exist! JSON only\n format.json { ...
[ { "docid": "11acdf7965d10c015df2bd18d4f71af9", "score": "0.7302852", "text": "def set_NewEmail(value)\n set_input(\"NewEmail\", value)\n end", "title": "" }, { "docid": "1ff28b36894ed376841f4a059921f7fd", "score": "0.72250235", "text": "def set_UserEmail(value)\n ...
fd6f01e5988e910924f273373258b3d3
PATCH/PUT /factura_items/1 PATCH/PUT /factura_items/1.json
[ { "docid": "d5a0d8484ce52e81054b8cfc664d3d8a", "score": "0.69793755", "text": "def update\n respond_to do |format|\n authorize @factura_item\n if @factura_item.update(factura_item_params)\n format.html { redirect_to @factura_item, notice: 'Item de factura asociado con factura.' }\n ...
[ { "docid": "ac8170756bc8f64ecb6760da8a2845f5", "score": "0.7212477", "text": "def update\n respond_to do |format|\n if @item_factura.update(item_factura_params)\n format.html { redirect_to @factura, notice: 'Item factura was successfully updated.' }\n format.json { render :show, st...
2e26765dcd953490914633c2fdaa5b2d
POST /yahoolists POST /yahoolists.json
[ { "docid": "651e6803424befcb2a7c60f2d1432a22", "score": "0.7311648", "text": "def create\n @yahoolist = Yahoolist.new(params[:yahoolist])\n\n respond_to do |format|\n if @yahoolist.save\n format.html { redirect_to @yahoolist, notice: 'Yahoolist was successfully created.' }\n for...
[ { "docid": "d8bad367ff32c644733dd8cab761c9cf", "score": "0.6891439", "text": "def postList(listName, idBoard)\n\tresponse = RestClient.post(\n\t\t'https://api.trello.com/1/lists',\n\t\t:name => listName, \n\t\t:idBoard => idBoard,\n\t\t:key=>$key,\n\t\t:token=>$token\n\t)\n\tresponse = JSON.parse(respon...
360b81fb88247c4761191cdcb4473e41
Split the segment at the given value of t
[ { "docid": "311179792c626df3c799976835800531", "score": "0.75204766", "text": "def split(t)\n raise NotImplementedError, \"Implementors of SegmentLike must implement #split\"\n end", "title": "" } ]
[ { "docid": "41ddae938c6f306c2a14725667f0dbcd", "score": "0.61737573", "text": "def split_segment(source_segment)\n start_obj = source_segment.start_obj\n end_obj = source_segment.end_obj\n mid_obj = start_obj.midpoint_to(end_obj)\n segment1 = FlightSegment.new(start_obj, mid_obj)\n segmen...
6ce08bcec76d36fe99be7d04ce29b00d
controller action for the challenge show3 page retrieves the appropriate ChallengeLevel record
[ { "docid": "41d774934d681fc7fa2f491524961ce2", "score": "0.78870964", "text": "def show3\n node = ChallengeLevel.find(params[:id])\n respond_to do |format|\n format.html { render :show3, locals: { node: node } }\n end\n end", "title": "" } ]
[ { "docid": "cb8262f9d5494887673bf3bfbb115ca4", "score": "0.7373688", "text": "def show33\n node = ChallengeLevel.find(params[:id])\n respond_to do |format|\n format.html { render :show33, locals: { node: node } }\n end\n end", "title": "" }, { "docid": "476...
dfaec49a2b22907c167f34326f879901
`run` action for `poise_service_test`. Create all test services.
[ { "docid": "b9729d13647a94bf5166d74d11150717", "score": "0.5246821", "text": "def action_run\n notifying_block do\n create_script\n create_noterm_script\n create_user\n create_tests\n end\n end", "title": "" } ]
[ { "docid": "1bd92be9d2e457e507a6505cb35821a7", "score": "0.64217776", "text": "def create_service\n service_template(run_file, 'dummy.json.erb')\n end", "title": "" }, { "docid": "bfc090e07b1355a42f6e78a4616c74a7", "score": "0.6373865", "text": "def test_service_create\n\...
21677aa3c2ffa22749059b3398f8d630
Compose a GNU style string representation
[ { "docid": "7ba8327e5d089e16ea28f75030bd772c", "score": "0.0", "text": "def to_s\n \"%d:%d: %s\" % [line + 1, column + 1, message]\n end", "title": "" } ]
[ { "docid": "9e9dd9c496924dce039ce6ff1aeb6a3e", "score": "0.63838977", "text": "def to_s\n \"<%s, %g>\" % parts\n end", "title": "" }, { "docid": "9787ccf690596ebd958663645a57daa4", "score": "0.62810445", "text": "def to_s format = :long\n s = ''\n\n s << \"#{compone...
16c24559e8695d02e48d9fc1f0f23bf3
generates a url to the new down level
[ { "docid": "84e7363501e9a6dc46d429a6408b0437", "score": "0.0", "text": "def url_to_lower_level(hcfg, set, tl_x, tl_y, br_x, br_y)\n @logger.msgdebug('KMLHandler:url_to_lower_level:' + sprintf('url_to_lower_level(%g,%g) -> (%g,%g)', br_x.to_f, br_y.to_f, tl_x.to_f, tl_y.to_f))\n sprintf(hcfg['url']...
[ { "docid": "a9d25704d8b594eab315819fe45e95cc", "score": "0.71945727", "text": "def new_nested_object_url(*args); new_nested_object_route('url', args.extract_options!); end", "title": "" }, { "docid": "acaadf8897c815fbcc782cc6e35d0a2e", "score": "0.70948875", "text": "def full_url_gen...
02d368a8fda2ddce6ec8b8649a328768
Most of the input will be in USASCII, but an encoding can be set per buffer for the input. For just about all purposes, UTF8 should be what you want to input, and it's what Tk can handle best.
[ { "docid": "6dcc9e4c75ed2807bb5d5b03fa0d211a", "score": "0.0", "text": "def string(text)\n common_string(text, text.event.unicode)\n end", "title": "" } ]
[ { "docid": "dd9fcfbfa58232fb4850d24ac8a531d9", "score": "0.6207397", "text": "def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.g...
544876e733c53199ca3c262568e65bc4
POST /fundings POST /fundings.json
[ { "docid": "0f8a7b1cc4d0189a7312072e239aecf2", "score": "0.69469965", "text": "def create\n @funding = Funding.new(funding_params)\n\n respond_to do |format|\n if @funding.save\n format.html { redirect_to @funding, notice: 'Funding was successfully created.' }\n format.json { re...
[ { "docid": "98226c93b8e057460ac6b4dc86879a4e", "score": "0.6961431", "text": "def create\n @funding = Funding.new(params[:funding])\n\n respond_to do |format|\n if @funding.save\n format.html { redirect_to @funding, notice: 'Funding was successfully created.' }\n format.json { r...
50bd6ff999f4fd3a293b43f07f528f53
Excerpted from "A CommonSense Guide to Data Structures and Algorithms, Second Edition", published by The Pragmatic Bookshelf. Copyrights apply to this code. It may not be used to create training material, courses, books, articles, and the like. Contact us if you are in doubt. We make no guarantees that this code is fit...
[ { "docid": "58ebc40620b94c3f47a10608515208bc", "score": "0.0", "text": "def status_code_meaning(number)\r\n if number == 200\r\n return \"OK\"\r\n elsif number == 301\r\n return \"Moved Permanently\"\r\n elsif number == 401\r\n return \"Unauthorized\"\r\n elsif number == 404\r\n return \...
[ { "docid": "54daf6b93940e3e4e685ffea5be30ead", "score": "0.5888452", "text": "def alg; end", "title": "" }, { "docid": "b2bf34b4d9f079aafc5e624689e76050", "score": "0.5728346", "text": "def algorithms; end", "title": "" }, { "docid": "b2bf34b4d9f079aafc5e624689e76050", ...
28ea27d670868273ad5d085a8d21b2a9
PUT /next_steps/1 PUT /next_steps/1.json
[ { "docid": "14d31ed64105b034662000fa4b164301", "score": "0.75372356", "text": "def update\n @next_step = NextStep.find(params[:id])\n\n respond_to do |format|\n if @next_step.update_attributes(params[:next_step])\n format.html { redirect_to :back, notice: 'Next step was successfully up...
[ { "docid": "c5ea13c1be245c35633b8393c702cb65", "score": "0.7438796", "text": "def update\n respond_to do |format|\n if @next_step.update(next_step_params)\n format.html { redirect_to @next_step, notice: 'Next step was successfully updated.' }\n format.json { render :show, status: :...
f240384d91f291ce6cf0f61e25290420
validates all attributes defined by validation_regex
[ { "docid": "fcb7e4f8a26d4ee646abeea9e0fc33cc", "score": "0.7747577", "text": "def validate_string_attributes\n validation_regex.each_key do |m|\n t = valid_string_match?(\n send(m).to_s,\n validation_regex[m][:regex],\n validation_regex[m][:mandatory]\n ...
[ { "docid": "bfb5f4abe1b9ea861e3de46fd2ca02c8", "score": "0.74174297", "text": "def validation_regex\n /\\s*validates(?:\\s+|_\\w+\\s+)(?:\\S|\\s)+/\n end", "title": "" }, { "docid": "c84b10e149119b1014ad5c102accc19a", "score": "0.70974386", "text": "def validate\n ...
5aecc2e068193de3c9ede50e068cabc8
Check if a user is an admin user
[ { "docid": "931397556d7310f4a8270af2b906de20", "score": "0.0", "text": "def admin_user?\n \treturn self.user_category == \"admin\"\n end", "title": "" } ]
[ { "docid": "15495e5c6c5dc8bfcde20bac9825e64e", "score": "0.8741846", "text": "def is_admin?(user)\n user.admin > 0\n end", "title": "" }, { "docid": "4b20ca02efa66f3ec5acefd16b5f7d89", "score": "0.87209845", "text": "def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend", ...
7e7c1c36b95109c8e376504ece70a53e
Create Elasticsearch index, mapping, and river (river first) Elastic needs a little napping, so there is 3 sleeps
[ { "docid": "1f7a955f8d93a9d62333f691604db463", "score": "0.0", "text": "def delete_elasticsearch(service)\n\n if service.storage =~ /Couch/\n delete_elasticsearch_couchdb_river(service)\n sleep(3)\n end\n\n # delete es mapping or gone with index delete?\n\n ...
[ { "docid": "ade5b1abc7f3b224ebc8372f0262c189", "score": "0.77419275", "text": "def create_index(es_index, es_type)\n Tire.index es_index do\n if not exists?\n create :mappings => {\n es_type.to_sym => {\n :properties => {\n :date => { :type => 'date'},\n ...
494453cc8b597e87c648eaf3a611df97
Public: WEBrick GET request handler request the HTTP request response the HTTP response returns HTTP response
[ { "docid": "e4a9f427ab892ff676f0e21cc44238b8", "score": "0.73177314", "text": "def do_GET (request, response)\n @request = request\n @response = response\n logger.info(\"GET #{@request.path} hit\")\n\n if @request.path.downcase.include?('/top')\n handle_top_request\...
[ { "docid": "8144550fb07660bd26f73f877a99f134", "score": "0.7441351", "text": "def do_GET(request, response)\n\t\t\t\tstatus = 400\n\t\t\t\tcontent_type = body = ''\n\t\t\t\tif not trusted(request)\n\t\t\t\t\tstatus = 403\n\t\t\t\telse\n\t\t\t\t\tpath = (request.path[-1,1] == '/' ? request.path.chop : re...
d51fa10a0f33b377b18ae4d601bc8528
Evaluates winner and loser of each game.
[ { "docid": "19f2df76e6086dd25c1d628f345114fc", "score": "0.0", "text": "def check_scores(game)\n if game[:home_score] > game[:away_score]\n winner = game[:home_team]\n loser = game[:away_team]\n else\n loser = game[:home_team]\n winner = game[:away_team]\n end\n return [winner, loser]...
[ { "docid": "5f5e6688392936725fda3a62f50fc022", "score": "0.744749", "text": "def evaluate_board_for_results\n player1_move_positions = self.moves_by_player[:player1].map{|move| [move.row, move.column]}\n player2_move_positions = self.moves_by_player[:player2].map{|move| [move.row, move.column]}\n ...
b6b9cd199dfaed08c4c534812e0ac109
Check to see if the all the properties in the model are valid
[ { "docid": "298a69fd66898bb0ba8dee9ba5e81d60", "score": "0.0", "text": "def valid?\n api_billing_period_type_validator = EnumAttributeValidator.new('String', ['BUY', 'CHARGE', 'CANCEL'])\n return false unless api_billing_period_type_validator.valid?(@api_billing_period_type)\n payment_met...
[ { "docid": "162d0e63d65b0cd6795543bab63498f2", "score": "0.78992486", "text": "def validate_properties\n true\n end", "title": "" }, { "docid": "162d0e63d65b0cd6795543bab63498f2", "score": "0.78992486", "text": "def validate_properties\n true\n end", "title": "" ...
71c8f73035ce2e1056ce801962ddf68b
def sticky?(path) path = File::Private.to_path_str(path) stat = File::Stat.new(path) rescue nil stat.sticky? end
[ { "docid": "5092647780e4805ed94267dec4649872", "score": "0.0", "text": "def symlink?(path)\n path = File::Private.to_path_str(path)\n FileTest.is_type?(path, APR::Filetype::APR_LNK)\n end", "title": "" } ]
[ { "docid": "5bab477ff183709343ff68e6c77d1d6f", "score": "0.7669222", "text": "def sticky?(_path)\n false\n end", "title": "" }, { "docid": "3955159afb6c367ef1e5a709c3e7a452", "score": "0.73400205", "text": "def file_locked?\n Puppet::FileSystem.exist? @file_path\n end...
e311e10e5172d09b65500667ca9ae655
Function to retrieve date in a string format
[ { "docid": "79bb13abb77e82b818a8d52bd93b9d7c", "score": "0.0", "text": "def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self....
[ { "docid": "bfc98693dcfe5195e00c96b7c8fc1957", "score": "0.7753836", "text": "def date_str d\n Util::date(d)\n end", "title": "" }, { "docid": "67254cbbce02e5a5d3636b52352a3fc0", "score": "0.7740103", "text": "def format_date\n chars = @date.split('')\n chars....
4197355a18ea8b1846db40bcbdcbe789
Public: Get the Ganglia cluster name for a given host. So, if you're still reading this and you use Chef, I recognize that you may not store the Ganglia cluster name as a node attribute. If you do, it's probably not called 'cluster_name'... host The name of the host whose Ganglia cluster name we need to look up. Return...
[ { "docid": "d1166c1ba18059b5c9953e7ae8fd5bad", "score": "0.85801125", "text": "def get_cluster_name_for_host(host)\n return nil unless load_knife_config\n query = Chef::Search::Query.new\n # we're only expecting a single node to be returned --> make sure it's the case!\n chef...
[ { "docid": "52ed872c8dbea11ed434c62d74c3ea1f", "score": "0.7008089", "text": "def cluster_name\n return false if Cassandra.VERSION.to_f < 0.7\n\n @cluster_name ||= client.describe_cluster_name()\n end", "title": "" }, { "docid": "009d4c2b7c8f39fcc086d3f799cee782", "score": "0.6707...
70d625db9e8bdf8c3787cabfd0a5b64d
set_time_stamp_units configures the global logging time_stamp_units If the default keyword is specified and set to true, then the configuration is defaulted using the default keyword. The default keyword option takes precedence over the enable keyword if both options are specified.
[ { "docid": "4e2a0842420806bc5ea1e53782a086e2", "score": "0.730716", "text": "def set_time_stamp_units(opts = {})\n unit_map = {\n 'traditional' => ' traditional',\n 'seconds' => ' traditional',\n 'high-resolution' => ' high-resolution',\n 'milliseconds' => ' hi...
[ { "docid": "2b85934ce0eccd20f7d791c8d2c8f0af", "score": "0.62939095", "text": "def time_unit=(unit)\n Log.time_unit=(unit)\n end", "title": "" }, { "docid": "9b7188c2d105a59ea68e6eb2e5b1ec9b", "score": "0.6181393", "text": "def time_unit=(unit)\n @log.time_unit = unit\n end",...
975a830017e0ab4ceeaa88a427ee27fb
Constructs a new instance.
[ { "docid": "5e623d9f64380a21fa3b83b7a4c6d044", "score": "0.0", "text": "def initialize(value, unknown = nil)\n super(self.class.binding_type, value, unknown)\n end", "title": "" } ]
[ { "docid": "e2b31d60b2b5b380040a867c381a1b70", "score": "0.8045547", "text": "def new\n \n end", "title": "" }, { "docid": "e2b31d60b2b5b380040a867c381a1b70", "score": "0.8045547", "text": "def new\n \n end", "title": "" }, { "docid": "e2b31d60b2b5b380040a867c381a1b70...
e35779d3510e05522d86bd8ff2542944
board is the first M columns of an NxN board, and is valid so far. piece is a proposed piece for the M+1th row of the board. returns true if piece is a valid placement, false otherwise
[ { "docid": "8d8adbe74de24f374ac9ab4bea891382", "score": "0.7181739", "text": "def safe board, piece\n board.each_with_index do |c, r|\n return false if c == piece # same column\n # they're on the same diagonal if the distance in columns == the distance in rows\n rdist = board.size - r\n cd...
[ { "docid": "99df3cb801792795e08837113ffca39b", "score": "0.76177275", "text": "def is_possible(row, col, piece)\r\n\tup_piece = nil\r\n\tleft_piece = nil\r\n\tif row > 0 and row < 4\r\n\t\tup_piece = LAYOUT[row-1][col]\r\n\tend\r\n\tif col > 0 and col < 4\r\n\t\tleft_piece = LAYOUT[row][col-1]\r\n\tend\...
72a9d1a13098fbed2cc611e305c58ab2
== [2, 4, 4, 6, 8, 8, 12, 16] Multiline version
[ { "docid": "7ab826d4713b26fd895d57723fa5b398", "score": "0.0", "text": "def multiply_all_pairs(arr1, arr2)\n arr1.map do |num1| \n arr2.map { |num2| num1 * num2 }\n end.flatten.sort\nend", "title": "" } ]
[ { "docid": "e07cde061089780c9e5480ac09f2e70d", "score": "0.6137481", "text": "def lines\n 2 * @size + 3\n end", "title": "" }, { "docid": "ab5acd3a0c95ec80583ae34b745a3d6a", "score": "0.60089654", "text": "def example\n display [1, 3, 2, 4, 3, 4, 2 , 4, 1]\n end", "ti...
0a68224f7f27bc9b5b199f939f78aeac
Moves roles to the specified role config group.\n\nThe roles can be moved from any role config group belonging\nto the same service. The role type of the destination group\nmust match the role type of the roles.\n\nAvailable since API v3.
[ { "docid": "0d493d108e7e2df03a4f12ee8d708e2d", "score": "0.0", "text": "def api_v11_clusters_cluster_name_services_service_name_role_config_groups_role_config_group_name_roles_put_with_http_info(role_config_group_name, service_name, cluster_name, opts = {})\n if @api_client.config.debugging\n ...
[ { "docid": "91d1481734686a19ec80af73b3550126", "score": "0.5824422", "text": "def remove_role_assignments_from_group_members_if_needed\n if entity.type == 'Group'\n Rails.logger.tagged \"RoleAssignment #{id}\" do\n # Tell trigger_sync! to ignore any requests it receives - we'll just put i...
247bb382481dec97d0912ec0357706f0
by default use columns with same names in both tables
[ { "docid": "3879cfc7cd0d6417d0c8125c233e43be", "score": "0.6143708", "text": "def set_default_column_names\n if !columns_to_compare.empty?\n columns_to_compare.scan(/([^,:=~]+)([=~])([^,:=~]+)/).each do |from, operator, to|\n weight = operator.eql?('=') ? 1 : 0\n left.add_c...
[ { "docid": "61ad1d14fd2e3fff08b8fd9bd91e3bd9", "score": "0.6692572", "text": "def column_alias_for(keys)\n if keys.respond_to? :name\n keys = \"#{keys.relation.name}.#{keys.name}\"\n end\n\n table_name = keys.to_s.downcase\n table_name.gsub!(/\\*/, 'all')\n table_name.gsu...
202851a13b406e3290ef0b286a3b4b35
Whether or not the status is set to 404. Returns nil if status not yet set.
[ { "docid": "ab1464c6263b3e5ec872df3aee4caa97", "score": "0.7263873", "text": "def not_found?\n @status == 404 if @status\n end", "title": "" } ]
[ { "docid": "0b0950091844388c897ff3593b01901a", "score": "0.69450986", "text": "def missing?\n status == 404\n end", "title": "" }, { "docid": "ca439195f18528711b94bd2d66c5d18e", "score": "0.69232446", "text": "def status_not_found\n @status = 404\n @e.er...
753674b202a0eef1a7ef0a34f89c5dd7
These are refined by subclasses Returns true iff it is executable. Keywords like `end` are not executable, but literals like `42` are executable.
[ { "docid": "7d74dd517b3f6ab0817a54289aced862", "score": "0.5653209", "text": "def executable?\n true\n end", "title": "" } ]
[ { "docid": "769f78c7c31b6d8595ecb99b68793466", "score": "0.64566654", "text": "def executable_real?() end", "title": "" }, { "docid": "d601c020efe6aee9ef799390a24e99b6", "score": "0.6332738", "text": "def executable?() end", "title": "" }, { "docid": "668b95f535e591ab4284...
4c255b144b7bbd84b3acdc2e2f9f460e
NOTE(yu): `send` is a Ruby object variable we don't want to override
[ { "docid": "a36d8200fefdc33edf98f921733d5af1", "score": "0.0", "text": "def delv(message)\n data = message\n data = data.payload unless data.is_a? String\n data = data.to_pkt unless data.is_a? String\n\n puts \"-> data: #{data.unpack(\"b*\").first}\"\n socket.puts data\n end", "title...
[ { "docid": "512a0a7f27061e8658ad3021502a1307", "score": "0.78183323", "text": "def __send__(symbol, *args, &block)\n ### *** TODO *** ###\n end", "title": "" }, { "docid": "8aa5614cd9400feb19439318935116a5", "score": "0.73164856", "text": "def safe_send(obj, method, *args, &block...
3b03b3a7e3bf2ce8c1b1dace103a8681
Enumerates the hill programs ordered by rank. The yielded value +rank+ is the 0based ranking. If a block is not provided, returns an array of program names ordered by ranking (best first).
[ { "docid": "966755281ee5009eefdc37bf1d64b30c", "score": "0.5943246", "text": "def ranking # :yields: rank, prog, points, score\n return @ranking unless block_given?\n @ranking.each_with_index do |prog, rank|\n yield rank, prog, @points[@progs[prog]], @scores[prog]\n end\n end", "title...
[ { "docid": "8a0a22b10ed84b06516699bdfbdf7144", "score": "0.5836565", "text": "def rank(prog); @ranks[prog]; end", "title": "" }, { "docid": "3966a2988f840113180f0c64f8f526c4", "score": "0.55124885", "text": "def each_module_ranked(opts = {}, &block)\n demand_load_modules\n\n se...
73bf348d3a2f678fedc9adf8808244d2
Relative links in markdown files are broken when they're displayed in our docs because the path doesn't exist in the docs site but rather in our github repo. This method creates a temporary copy of the README file and fixes all the relative links to include a github.com URL prefix. It also fixes up some attributes that...
[ { "docid": "dd1782730d090e05f8619e810b8c8c7e", "score": "0.8448241", "text": "def copy_readme_and_fix_relative_links(readme_file, github_file_prefix, github_raw_file_prefix, module_name)\n # Find the relative path of the README so we update the URL prefix accordingly\n relative_readme_pathname = Pathn...
[ { "docid": "73fb6b6d684b24d9b469d78539c3e5dd", "score": "0.8156775", "text": "def copy_readme_and_fix_relative_links(readme_file, github_file_prefix, github_raw_file_prefix)\n # Find the relative path of the README so we update the URL prefix accordingly\n relative_readme_pathname = Pathname.new(readm...
bf375a71fc53b9a4562cd5d7259a3de0
Input: + Logged in as PU admin. + Check editable for the setting which is created by him Output: return true
[ { "docid": "ffabd63e04ea592e786120181f64096a", "score": "0.0", "text": "def test_ut_t2_ars_arc_018\n # pj admin\n current_user = User.find_by_id(PJ_ADMIN_ID)\n # pj ars\n pj_id = PrivilegesUsers.find_all_by_user_id(current_user.id)[0].pj_id\n pu_id = Pj.find_by_id(pj_id).pu\n ars = Pj....
[ { "docid": "adb96c514a00f9fa6adfc453e36b9f8c", "score": "0.72910553", "text": "def editable?\n admin?\n end", "title": "" }, { "docid": "f49ed6dad9a9249505603741abb5746b", "score": "0.7170365", "text": "def can_edit_admin?\n return false unless is_admin? && !is_last_admin?\n ...
7e808f288e1e0aa27e306f2cd6a3ee96
PATCH/PUT /expenditures/1 PATCH/PUT /expenditures/1.json
[ { "docid": "1abf0639ea9e66c79286d676bb4f9782", "score": "0.6305207", "text": "def update\n respond_to do |format|\n if @expenditure.update(expenditure_params)\n format.html { redirect_to expenditures_path, notice: 'Expenditure was successfully updated.' }\n format.json { render :sh...
[ { "docid": "2a8476933dd3d9f02760129c8af4d2bf", "score": "0.62379736", "text": "def update\n @expenditure = Expenditure.find(params[:id])\n\n respond_to do |format|\n if @expenditure.update_attributes(params[:expenditure])\n format.html { redirect_to @expenditure, notice: 'Expenditure w...
8d9a7c823e852cbbe0300561b943c5c5
GET /score_courses/1 GET /score_courses/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "de0cb7c89317589d4b9cba4ed3c6cc42", "score": "0.7275255", "text": "def index\n @score_courses = ScoreCourse.all\n end", "title": "" }, { "docid": "ac29ec1c64f22e52fd6ae72b9fdecd55", "score": "0.72134304", "text": "def get_courses\n @prof = Professor.find(params[:pro...
65801c355c1a13412c67b2d3e13db0fd
Perform request, retrying on errors gracefully handle rate limiting
[ { "docid": "ef150556b046477b1acf5e854c825abd", "score": "0.6531742", "text": "def request(method, uri, options={})\n options.deep_merge!(@auth_options)\n\n puts \"* requesting #{method.upcase} #{uri}\"\n response = self.class.send(method, uri, options)\n json = JSON.parse(response.body)\n\n ...
[ { "docid": "35b37f1f2a88695e62c3ddc46225fb77", "score": "0.7373863", "text": "def with_rate_limit\n return yield unless rate_limiting_enabled?\n\n request_count_counter.increment\n\n raise_or_wait_for_rate_limit unless requests_remaining?\n\n begin\n yield\n r...
f297398ca21e6667176e9831ea3acc8c
PATCH/PUT /trade_types/1 PATCH/PUT /trade_types/1.json
[ { "docid": "797a056911bdf0612f8ce2013f29de32", "score": "0.7044611", "text": "def update\n respond_to do |format|\n if @trade_type.update(trade_type_params)\n format.html { redirect_to @trade_type, notice: 'Trade type was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "50891a3bc04272c7f91fd07308d31834", "score": "0.66279626", "text": "def update\n @market_type = MarketType.find(params[:id])\n respond_to do |format|\n if @market_type.update(market_type_params)\n format.json { render json: @market_type, status: :ok }\n else\n format.json { ...
47a6c9a589eb0f1e04cabc17fab40a5a
POST /profiles POST /profiles.json
[ { "docid": "c7e72048852c045c51d5a0e0d63ac90e", "score": "0.0", "text": "def create\n @profile = Profile.new(profile_params)\n @requisition = Requisition.new\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @requisition.new, notice: 'Los datos se actualizaron...
[ { "docid": "443f7ac6eb20f4026d28d4e500090204", "score": "0.7567471", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n f...
8a87f4d7d61d32c793a7c4be87b2c2a4
define method for changing the color but naming spray_paint instead of just using the attr_accessor functionality.
[ { "docid": "31b7102cd7bc5284b7e0bc2b82cc499d", "score": "0.7852506", "text": "def spray_paint(color)\n self.color = color\n puts \"My car is now #{color}!\"\n end", "title": "" } ]
[ { "docid": "e13d9e40608b485c6c36adbeed8f08fe", "score": "0.839693", "text": "def spray_paint(color)\n self.color = color\n end", "title": "" }, { "docid": "cbb182bf08a94f0bcc4db1a414ef8703", "score": "0.8239147", "text": "def spray_paint(color) ...
d2bd370a56893b34ef66bc3683df53e8
Uses the session information to merge the URI into either a relative or absolute format depending on the the relation the URL has to the session URI.
[ { "docid": "657df6853ddbaa0741bb3aa14f352517", "score": "0.56572527", "text": "def merge_uri_with_page(uri)\n unless uri.start_with?(\"../\")\n uri = Addressable::URI.parse(uri).normalize unless uri.is_a?(Addressable::URI)\n end\n return session.relative_to(final_uri.join(uri).norm...
[ { "docid": "abd4aa800656702837b5044162e00609", "score": "0.60337794", "text": "def join_uri(scheme, userinfo, host, port, registry, path, opaque, query, fragment); end", "title": "" }, { "docid": "abd4aa800656702837b5044162e00609", "score": "0.60337794", "text": "def join_uri(scheme,...
fcc60679e757e4113862c47b635827b5
POST /in_shopping_carts POST /in_shopping_carts.json
[ { "docid": "1d1f839f1b90bb20ff2b1d1eb39de90d", "score": "0.76991224", "text": "def create\n @in_shopping_cart = InShoppingCart.new(in_shopping_cart_params)\n\n if @in_shopping_cart.save\n render :show, status: :created, location: @in_shopping_cart\n else\n render json: @in_shopping_ca...
[ { "docid": "26e9c561b83a708cbbce79d770253528", "score": "0.7093825", "text": "def in_shopping_cart_params\n params.require(:in_shopping_cart).permit(:product_id, :cart_id)\n end", "title": "" }, { "docid": "6fde0326f933993929330fc3a46c64e6", "score": "0.6878241", "text": "def...
593cb7c55528d2f114fe9ffcb6921c9e
Get the parent elements of all elements on the collection
[ { "docid": "22385a27f958e97e2c7b7194d630a023", "score": "0.82243586", "text": "def parent\n map do |q|\n q.get_parent_element\n end\n end", "title": "" } ]
[ { "docid": "860169adf4fbf73f04ce3044b16222a4", "score": "0.75559187", "text": "def parents\n collections\n end", "title": "" }, { "docid": "57f64249d01efc5b74fde85cc71f83bc", "score": "0.74278957", "text": "def parents\n Document.traverse self, 'parentNode', nil, true\n end",...
62feacf64699334b6d161132556e750a
POST /qxes POST /qxes.xml
[ { "docid": "e03fd1e8545fb8d17691771516c31327", "score": "0.6349135", "text": "def create\n @qx = Qx.new(params[:qx])\n\n respond_to do |format|\n if @qx.save\n format.html { redirect_to(@qx, :notice => 'Qx was successfully created.') }\n format.xml { render :xml => @qx, :status...
[ { "docid": "449fca18051de18a19a3ddb3a63b8bf9", "score": "0.6481086", "text": "def send_request( xml )\n write( xml )\n read\n end", "title": "" }, { "docid": "2b999e7b951ff545cd9f3dc6628afa3b", "score": "0.6466284", "text": "def send(xml)\n msg = <<EOL\n<?xml versio...
11aab486af6a64929c018df7598e4f59
ok, that args is actually pointless, we can just do this:
[ { "docid": "e4653d151a3d93a41e5b5a89cdb23414", "score": "0.0", "text": "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "title": "" } ]
[ { "docid": "8e80f7d7312d2b6382297808db215e34", "score": "0.78169453", "text": "def args=(_); end", "title": "" }, { "docid": "8e80f7d7312d2b6382297808db215e34", "score": "0.78169453", "text": "def args=(_); end", "title": "" }, { "docid": "8e80f7d7312d2b6382297808db215e34...
78279fac38f02661f7e5735b1b354433
GET /pomodoros/1 GET /pomodoros/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "76bd9a3030fbe32fedfb45b54bdc7f35", "score": "0.71235687", "text": "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "title": "" }, { "docid": "902a8fd8...
bef2b609dae9d1efc464f6d1e1419bb6
GET /solvents GET /solvents.json
[ { "docid": "8143d09836fad4fbeea1e1ceee04cdb5", "score": "0.7207926", "text": "def index\n @solvents = Solvent.all\n end", "title": "" } ]
[ { "docid": "f2202802c1618e13bd2bf9c05dd0e2ce", "score": "0.6597842", "text": "def get_events\n api_request \"https://api.github.com/events\"\n end", "title": "" }, { "docid": "dea52b3fd19b7d835242cb95bf7ab326", "score": "0.6516472", "text": "def index\n # curl http://local...
77cd68afc432558bfcc1543135e1c4a1
GET /books GET /books.json
[ { "docid": "a8c37ed7d0e4ce1d27858a363886dbbc", "score": "0.0", "text": "def index\n @books = Book.all\n end", "title": "" } ]
[ { "docid": "0dcef7df140be07467764e06d44a75c9", "score": "0.7966849", "text": "def index\n @books = get_books()\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "title": "" }, { "docid": "60973656e5d53c2355cc3aaa79...
c2c54feeff898c5be038212b902c414c
Write your code here. batch_maker method receives a name and creates a return message return message is "Hello, my name is X"
[ { "docid": "e9ab8a554ec711957d037d534d900293", "score": "0.0", "text": "def badge_maker(speaker)\n \"Hello, my name is #{speaker}.\"\nend", "title": "" } ]
[ { "docid": "f4c923f2e7bebcaab8a7317145954a22", "score": "0.6690669", "text": "def batch_badge_creator(names)\n names.map {|name| \"Hello, my name is #{name}.\"}\nend", "title": "" }, { "docid": "6afa04fb187f777027bc2cd9e8bd3d74", "score": "0.6577674", "text": "def batch_badge_crea...
df65d718e1524f58ed838e23d5d292b0
============== == Defaults == ==============
[ { "docid": "b564004a7016c8b34eaee8cad7ce67e3", "score": "0.0", "text": "def default_font; \"example.font\"; end", "title": "" } ]
[ { "docid": "de19c51c3af8f2b7f87d063f19e973fb", "score": "0.829697", "text": "def defaults; end", "title": "" }, { "docid": "de19c51c3af8f2b7f87d063f19e973fb", "score": "0.829697", "text": "def defaults; end", "title": "" }, { "docid": "de19c51c3af8f2b7f87d063f19e973fb", ...
cac408894b6f63642a419cc81897466b
Compare this node to another node.
[ { "docid": "35ab894ec2e6f13dd0657162eb2f5836", "score": "0.6214451", "text": "def ==(node)\n @node_address == node.node_address\n end", "title": "" } ]
[ { "docid": "e6d7b46568604c14280d6eed8b9a8f41", "score": "0.75985533", "text": "def compare_node(node1, node2)\n node1.value <=> node2.value\n end", "title": "" }, { "docid": "66c64818fbb563c3e7a987122f48c05c", "score": "0.750113", "text": "def eql? other_node\n self.class ==...
3a3c5f4e3ece483a00e05c573a356070
Set the page description
[ { "docid": "6131936bf0a796e72e4f34a81c1ed701", "score": "0.0", "text": "def page_description\n if content_for?(:description)\n \"#{yield_content(:description)}\"\n else\n \"Capra is a design agency based in Ottawa, Canada run by husband and wife team Ollie and Kat Kavanagh. Our focus is ...
[ { "docid": "37c861ee5849a4297367760e73f4c975", "score": "0.7750188", "text": "def set_page_description(*values)\n opt = { sanitize: false } # Sanitization occurs in #emit_meta_tag.\n replace_page_meta_tags(description: normalized_list(values, **opt))\n end", "title": "" }, { "docid": ...
0e2de0558d2d6c71a6b15faff0c7a084
PATCH/PUT /centros_de_custo/1 PATCH/PUT /centros_de_custo/1.json
[ { "docid": "14ea03fadd8b8d4baf54f4dd301e0197", "score": "0.70293057", "text": "def update\n respond_to do |format|\n if @centro_de_custo.update(centro_de_custo_params)\n addlog(\"Atualizou um centro de custo\")\n format.html { redirect_to @centro_de_custo, notice: 'Centro de custo ...
[ { "docid": "b83ce814ab42fb4549b2e8b10e7e2a72", "score": "0.71233934", "text": "def update\n respond_to do |format|\n if @centro_custo.update(centro_custo_params)\n format.html { redirect_to @centro_custo, notice: 'Centro custo atualizado com sucesso.' }\n format.json { render :show...
2f0337a5287073287ed9503ca7e071c0
Used where a field can either be a Topic Id or a Topic Name (the Subscribe and Unsubscribe packet types)
[ { "docid": "232908457bd6c000197fb90ee299a245", "score": "0.63157165", "text": "def encode_topic\n case topic_id_type\n when :normal\n topic_name\n when :short\n if topic_name.nil?\n topic_id\n else\n topic_name\n end\n ...
[ { "docid": "f4666c3524b8aa7604128cb075d14d5b", "score": "0.67304605", "text": "def parse_topic(topic)\n case topic_id_type\n when :normal\n self.topic_name = topic\n when :short\n self.topic_name = topic\n self.topic_id = topic\n when :predefined\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f4f4f03f73e29703ba9910bf1cf3727d", "score": "0.0", "text": "def litter_box_params\n params.require(:litter_box).permit(:price, :capacity, :description, :city, :state,\n :address_line_1, :address_line_2, :zip, :number_of_adults,\n :number_of_children, :number_of_pets, :name...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
d5ce0650ae4e0787a5b2c6a4c53cb00c
scans the price list and wraps the restaurant object for easy manipulation of restaurant properties(id, price, item label)
[ { "docid": "7b955950878440da64feb9f309c355b4", "score": "0.6605602", "text": "def build_restaurants\n\t @price_list =[]\n\t raise RestaurantError.new(\"DataError: Price List cannot be Empty\") if CSV.read(@price_list_file).empty? \n\t CSV.foreach(@price_list_file) do |row|\n\t \tnext if row.empty? #...
[ { "docid": "9176cffe8c778b89c83506da0040b804", "score": "0.6702676", "text": "def store_item_info(rest_id,price,data)\n rest = @available_restaurants[rest_id] || Restaurant.new\n rest.value_meals << ValueMeal.new(data,price.to_f)\n @available_restaurants[rest_id]=rest\n end", "title": "" ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "55a8ee5f5ac3af6d7cea6eb62440822b", "score": "0.0", "text": "def budget_debt_params\n params.require(:budget_debt).permit(:budget_account_id, :amount, :comment)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943033", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69584733", "text": "def permitted_params\n params.permit!\n end", "title"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "33cebcd5d97925d83050efaa07e55b55", "score": "0.0", "text": "def set_bulb\n @bulb = Bulb.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6032574", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015663", "text": "def...
723c6c35340b6bd9d7ce15674ec25541
PUT /search/1 PUT /search/1.xml
[ { "docid": "f77e9d5485a7d9a3978ea452c54c8b8a", "score": "0.6352389", "text": "def update\n respond_to do |format|\n if @search.update_attributes(params[:search])\n flash[:notice] = 'Search was successfully updated.'\n format.html { redirect_to(@search) }\n format.xml { head...
[ { "docid": "569bc26cc5a6fc1266d1952ad6d7710f", "score": "0.6627307", "text": "def update_search(id, params = {})\n put(\"/searches/#{id}\", params)\n end", "title": "" }, { "docid": "b251edde12e7a63e573038b5a1e7e29a", "score": "0.63825876", "text": "def update\n @searc...
0292e5f27dab7e14435164a383b55358
Sets this widget's parent. This method should only be called by +Panel+ and +Composite+. parent:: the widget's new parent
[ { "docid": "3dab559ba59eae811fb38023f436376c", "score": "0.6870062", "text": "def setParent(parent)\n oldParent = @parent\n @parent = parent\n\n if parent.nil?\n # Remove from parent\n onDetach() if oldParent and oldParent.isAttached\n elsif parent.isAttached\n onAttach()\n ...
[ { "docid": "10f5271fcbd6d47767d067893780567c", "score": "0.7371926", "text": "def set_parent(parent)\n @parent = parent\n\n self\n end", "title": "" }, { "docid": "2ba02c8c2245f221942dd47dd641aafd", "score": "0.72046375", "text": "def set_parent(parent)\n @parent = ...
8bd6d2956bff1f226a5ec1ff10acf502
Returns the "On Sale" tab.
[ { "docid": "b8103c38fef63ee0f2522db9d04cfbaa", "score": "0.6289944", "text": "def on_sale_tab\n $tracer.trace(__method__)\n # unit_test_no_generate: on_sale_tab, a.className(create_ats_regex_string(\"ats-onsale-tab\"))\n tag = ToolTag.new(a.className(create_ats_regex_string(\"ats-onsale-tab\"))...
[ { "docid": "2f68106afc82c40c567855d4a3c9af38", "score": "0.6306465", "text": "def customer_tabs\n {\n 'tickets': 'Manage Tickets',\n 'new_ticket': 'Raise Ticket'\n }\n end", "title": "" }, { "docid": "c5a2712cd19f452e6e28d010f64a56f9", "score": "0.6206788", "text": "...
3f04bd4ea4e50c387de5cf7624bec57e
Verify if max global is first and is duplicated
[ { "docid": "856cc95e0c8b84ff3be62d54b1ebe3f9", "score": "0.71449876", "text": "def first_max_is_duplicated?\n @index_max_height.zero? && @buildings[1..-1].max == @max_height\n end", "title": "" } ]
[ { "docid": "909d9ce6f5c841dbf817c0853c2b0699", "score": "0.6233679", "text": "def is_best_permutation\n @groups[0].values[0] == @groups.min_by{|group| group.values[0]}.values[0]\n end", "title": "" }, { "docid": "65aff3468b95c06c7f91b539a8edca1b", "score": "0.59334934", "text": "...
7860a290d82b9258481cd5a60a9b3655
Evidence should be array size 2 containing numeric or the undefined value
[ { "docid": "640cbcc185851eda97c949960bff03c8", "score": "0.0", "text": "def evidence=(evidence)\r\n evidence, errmsg = validate_evidence(evidence)\r\n raise ArgumentError, errmsg if errmsg\r\n \r\n if evidence != @evidence\r\n @evidence = evidence \r\n evidence_chang...
[ { "docid": "180f72466143781cd39060bf10becf8d", "score": "0.6570471", "text": "def missingNumber(array)\n # your magic\nend", "title": "" }, { "docid": "65905a6f2703806c92d27536bb4d0cc5", "score": "0.6529926", "text": "def expected_as_array; end", "title": "" }, { "docid"...
23c34666f34b4fd2a1e80e7d3c63afa7
Returns [monthName, day, year, month]
[ { "docid": "72eb45cc9b96d6bb727c72ba09d0c946", "score": "0.0", "text": "def dateToFriendlyDate(date)\n return [Date::MONTHNAMES[date.slice(5, 2).to_i], date.slice(8, 2).to_i.to_s, date.slice(0, 4).to_i.to_s, date.slice(5, 2).to_i]\nend", "title": "" } ]
[ { "docid": "3e5e75e1d2c3de8c4053f7f825c5d051", "score": "0.74848884", "text": "def inspect\n \"the month is \" +\n humanize_list(@parts) { |m| Date::MONTHNAMES[m] }\n end", "title": "" }, { "docid": "4d3dd90547d7eb507c41d956f1a498a8", "score": "0.7338795", "text": "def...
29184ace39bdc086eecdb38a18cfb52d
sum the integer values of array contents
[ { "docid": "4755be8b28d1b44ad22dbb7bd1915f89", "score": "0.0", "text": "def int_sum\n self.inject(0){|sum,i| sum+i.to_i}\n end", "title": "" } ]
[ { "docid": "b7c4df6bcf49727b265d4849b9fdde0a", "score": "0.82042044", "text": "def array_sum(array)\n sum =0 \n array.each do |elm|\n sum += elm.to_i\n end\n\n return sum\nend", "title": "" }, { "docid": "25e120c69f701a3ab3fc22aa139a06ab", "score": "0.820118", "text": "def sum...
432594f11976ceb11c948f71e27419ce
Read a &39;firmware.MswitchDescriptor&39; resource.
[ { "docid": "2f20bce327556efc6c826b4399b60fa9", "score": "0.55083066", "text": "def get_firmware_mswitch_descriptor_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FirmwareApi.get_firmware_mswitch_descriptor_by_moid ......
[ { "docid": "0a3eac27eaf0b61f6c25aa0f3aaf3a74", "score": "0.5780244", "text": "def get_firmware_mswitch_descriptor_by_moid(moid, opts = {})\n data, _status_code, _headers = get_firmware_mswitch_descriptor_by_moid_with_http_info(moid, opts)\n data\n end", "title": "" }, { "docid":...
5b4bd9d39e633fad1904162b070972f5
Renew A Customer's AMC
[ { "docid": "cdbaf9c5d6dd4b0be9562ad73f348617", "score": "0.63629735", "text": "def update\n begin\n @customer = Customer.find(params[:customer][:id])\n @customer.update_attributes(params[:customer]) ? session[:customer_id] = @customer.id : render( customer_amc_expiry_report_path )\n resc...
[ { "docid": "0b43bde4ccc2ad9f55b44dee019f1bfa", "score": "0.78324723", "text": "def renew_customer\n begin\n @customer = Customer.find(params[:id])\n @customer.contract_date = @customer.contract_date + 1.year\n @customer.contract_amount = 0\n rescue\n end\n end", "title": "" ...
b6be7bead09b23bd5d90425acb5ea845
DELETE /plates/1 DELETE /plates/1.json
[ { "docid": "6d44296a6e130fe2a30621a1c1192297", "score": "0.76971424", "text": "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to plates_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "fda247da7733fe02e5055c04152c861b", "score": "0.75282127", "text": "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to plates_url, notice: 'Plate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
1cbd192fbf71cf4d070466d21472a325
GET /rates/new GET /rates/new.json
[ { "docid": "402c3458a27f01da09c58bd3179d85b0", "score": "0.72696346", "text": "def new\n @rateable, @name = find_polymorphic\n @rate = Rate.new\n @title = @name.titleize + \" Rate\"\n @cpt_codes = CodesCpt.without_status :deleted, :archived\n @newedit = true\n\n respond_to do |format|\...
[ { "docid": "4f51a41483730ccce0243eb1ad2961de", "score": "0.8132524", "text": "def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rate }\n end\n end", "title": "" }, { "docid": "4f51a41483730ccce0243eb1ad2961de"...
9ab16286ed6dd8d74238e942a2753191
Accepts a DataWrangler::Book::Sheet instance
[ { "docid": "0b95b9df6e1b3c6ddd110eecbdb40097", "score": "0.0", "text": "def run(sheet)\n validate(sheet)\n end", "title": "" } ]
[ { "docid": "3be1938077af78e0a9c6ee854d81fa31", "score": "0.7526003", "text": "def sheet; end", "title": "" }, { "docid": "21784056a2a4325b9f837e7dfd1ae933", "score": "0.71175617", "text": "def data_sheet=(_arg0); end", "title": "" }, { "docid": "728cf9f7f338ff8cb5d58605de...
d05f8d4d932077e0734898f1a82b14fd
DELETE /search_phrases/1 DELETE /search_phrases/1.json
[ { "docid": "d2b1aec3cb4fbd92d0700e926ed47f53", "score": "0.7799092", "text": "def destroy\n @search_phrase = SearchPhrase.find(params[:id])\n @search_phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to search_phrases_url }\n format.json { head :ok }\n end\n end",...
[ { "docid": "a8f73cde70a254a919cca7cd83c03745", "score": "0.75603664", "text": "def destroy\n @phrase = Phrase.find(params[:id])\n @phrase.destroy\n\n respond_to do |format|\n format.html { redirect_to phrases_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
8c6f5f26259e53a666066abebc50ead7
The host that the direct server is running on
[ { "docid": "31abc4e194ca92b2154860042ccd1f5c", "score": "0.82315063", "text": "def server_host\n AgileProxy.config.server_host\n end", "title": "" } ]
[ { "docid": "443cd1a48301cfa1aa3152907a8d39e2", "score": "0.84988356", "text": "def server_host\n Socket.gethostname\n end", "title": "" }, { "docid": "ea88a33442b3c120fce7d1e883cb1e5b", "score": "0.83799535", "text": "def get_host\n @host\n end", "title": "" }, ...
bbc0b886a7f98b3c7ce12eadcc22a437
catch and redirect response_url fo rsearch_inside
[ { "docid": "9060ad76db36f445df700f72b7627111", "score": "0.65790886", "text": "def response_url(service_type, submitted_params)\n if ( ! (service_type.service_type_value.name == \"search_inside\" ))\n return super(service_type, submitted_params)\n else\n base = service_type.service_respo...
[ { "docid": "00c19894975f65c38e03d5dda2f9cd89", "score": "0.72341484", "text": "def response_url(service_response, submitted_params)\n if ( ! (service_response.service_type_value.name == \"search_inside\" ))\n return super(service_response, submitted_params)\n else\n # search inside!\n ...
38e19c9a27d9777a99c3ae60f7f5f425
score descending is the default sorting. for identical scores we sort alphabetically on name
[ { "docid": "4b522af43846d493ca87c36ba873d2b6", "score": "0.7280753", "text": "def sort_query\n {\n _score: { order: 'desc' },\n name: { order: 'asc' }\n }\n end", "title": "" } ]
[ { "docid": "8db38b79151e107ca4403601b91cd8df", "score": "0.7935198", "text": "def sort_scores()\r\n\t\tscores = {\r\n\t\t\t:anita_borg => { :name => \"Anita Borg\", :score => @anita_borg.length },\r\n\t\t\t:radia_perlman => { :name => \"Radia Perlman\", :score => @radia_perlman.length },\r\n\t\t\t:grace...
756eea21a383e66a740816a4ba9155fe
Returns the userid of the user that owns the file, or +nil+ if that information is not available. If an :owner key exists, but not a :uid key, the Etc module will be used to reverse lookup the id from the name. This might fail on some systems (e.g., Windows). source://netsftp//lib/net/sftp/protocol/01/attributes.rb160
[ { "docid": "9589a37ea6ab8992ed1b2a9f87d99085", "score": "0.0", "text": "def uid; end", "title": "" } ]
[ { "docid": "12a79b210778652738dcdef84919e53c", "score": "0.7707894", "text": "def uid\n if attributes[:owner] && !attributes.key?(:uid)\n require 'etc'\n attributes[:uid] = Etc.getpwnam(attributes[:owner]).uid\n end\n attributes[:uid]\n end", "title": "" }, { ...
3226f29bcc20df408cd3a5b7f35e7803
Ensures the screen has all the lines that the terminal has to move freely without needing to create more lines.
[ { "docid": "27304567c0982fc6fc5136bcd30dc3f4", "score": "0.6685263", "text": "def prepare_screen\n # Ensure we restore mode bedore setting to no_echo\n # otherwise we lose context and cannot go back\n @h.restore_mode rescue\n print :erase_line\n @h.output_rows.times do\n print :newli...
[ { "docid": "8bb22a3fc423432fb86e5011e2e23c47", "score": "0.65325516", "text": "def clear_console()\n\tif ($verbose)\n\t\treturn\n\tend\n\n\tprint \"\\r\" # move to start of line\n\t(1..$erasable_lines).each do\n\t\tprint \"\\e[A\" # move up\n\tend\n\tprint \"\\e[J\" # clear until end\n\t$erasable_lines ...
799d7e28fb697de7d89409b17d218baf
setting session id for connection with przelewy24
[ { "docid": "ec151083aa755330e293a71a53abf016", "score": "0.0", "text": "def set_session_id\n self.session_id = <%= class_name %>.generate_session_id\n self.id_sprzedawcy = SELLER_ID\n self.kraj = COUNTRY\n self.language = LANGUAGE\n end\n\n class <%= class_name %>Tools\n\n # Generate a ...
[ { "docid": "5a8bda6360e21ea4ca76125ff86c78db", "score": "0.7683292", "text": "def new_sessionid!\n self.sessionid = \"commandsession-#{id}\"\n end", "title": "" }, { "docid": "3725efec984530bdeddf746dd61ae537", "score": "0.76014173", "text": "def session_id=(value)\n ...
1a51b0bd186893a53ffc8a48db148e9c
Test live api handling valid workflow through primary email client
[ { "docid": "a972f7440c16e668fe5b60747e9e29fd", "score": "0.74364877", "text": "def test_live_api_primary_ok\n mock_clients nil, bad_req_code\n name = ENV['TEST_NAME']\n email = ENV['TEST_EMAIL']\n\n assert !name.nil?\n assert !email.nil?\n\n email_addr = EmailAddress.new(name, em...
[ { "docid": "8b1d426073d958630a8fda92abeda608", "score": "0.70994407", "text": "def test_live_api_secondary_ok\n mock_clients bad_req_code, nil\n name = ENV['TEST_NAME']\n email = ENV['TEST_EMAIL']\n\n assert !name.nil?\n assert !email.nil?\n\n email_addr = EmailAddress.new(name, ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "15bab199943ad51e32a10998ff47beb2", "score": "0.0", "text": "def vargesso_params\n params.require(:vargesso).permit(:user_id, :ano, :profundidade, :areaAplicacao, :teorCalcio)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
81fb17e91956966cd9f4c96484b143f1
method to set the keyword for this Constaint (subclasses)
[ { "docid": "cf0f8cf47d41d00f5dcf041fe10f3047", "score": "0.7293255", "text": "def contraint_keyword(k)\n @key = k\n end", "title": "" } ]
[ { "docid": "ff7e8d82a947d0a3d30c19655fd9f01f", "score": "0.75424594", "text": "def contraint_keyword(keyword)\n @key = keyword\n end", "title": "" }, { "docid": "f493e95dad559b7d9a2d7ca17f3430c3", "score": "0.6641423", "text": "def add_keyword_constraint(keyword, type, **...