query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
74554266f0fb55287e63d5c4a77d3adc
Checks players life status each round, if no one is 0, game continues
[ { "docid": "e5ef464e86db4ef6213ed9d857525f25", "score": "0.69131327", "text": "def checkLife\n if (@x.life_count == 0 || @y.life_count == 0)\n winnerCheck\n puts \"#{@winner} wins with score of #{@winner_score}/3\"\n puts \" ----- GAME OVER ----- \"\n puts \"Good bye!\"\n exit(0)\n else...
[ { "docid": "4cb628b018b49f70f7eaebec77fc4fff", "score": "0.7729181", "text": "def lives_checker\n if (player_1.lives == 0 || player_2.lives == 0)\n self.game_over\n else\n puts \"------NEW ROUND------\"\n self.start_game\n end\n end", "title": "" }, { "docid": "06850...
70e7e3c27e1146f44b360d726c762934
refresh token (keeping same expires_at) if it exists
[ { "docid": "683ba2d945a4d376804da04ef64c664d", "score": "0.7508839", "text": "def refresh_token\n if remember_token?\n self.remember_token = self.class.make_token \n save(false) \n end\n end", "title": "" } ]
[ { "docid": "b903cec60cf699b348b2fda8f8b8ffa9", "score": "0.8577979", "text": "def refresh_token_if_needed\n token_timestamp = decoded_jwt['exp']\n current_timestamp = DateTime.now.to_i\n return unless token_timestamp - current_timestamp <= 0\n\n refresh_token\...
9ac5c8c5e6c4679b3256aabc99c94657
Request by server id
[ { "docid": "595a2462489ff9420a138ad1cb0707e9", "score": "0.5377942", "text": "def request server_id, module_id, msg, block\n return if @state != :state_started\n if !server = @servers[server_id]\n block.call Exception.new 'unknown server id: ' + server_id\n return\n end\n ...
[ { "docid": "1431f4eadd7d431f9afdc037b048ac21", "score": "0.7264736", "text": "def server(service_id, server_id)\n request :get, \"/services/#{service_id}/servers/#{server_id}\"\n end", "title": "" }, { "docid": "784158e6fe2fba67b9e25ccf9c7a8ecf", "score": "0.66944814", "text": "d...
4d0125e0a16032a4991a3b50f43793e2
Run a DBus loop to handle signals.
[ { "docid": "bb10c77cdedbf16026ec8859140f9466", "score": "0.79936916", "text": "def run_loop\n loop = DBus::Main.new\n loop << @object.bus\n loop.run\n end", "title": "" } ]
[ { "docid": "0c2888d5ec255906833d97c0619ba81a", "score": "0.75621474", "text": "def run\n start_listen\n\n @main_loop = DBus::Main.new\n self.on(:quit) {\n @main_loop.quit\n }\n @main_loop << @bus\n @main_loop.run\n e...
5230a4f1b17defbb5854302783f0ef20
GET /wises/1 GET /wises/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0e076005766691cc58ad305b2956da5e", "score": "0.65885335", "text": "def index\n @wises = Wise.all\n end", "title": "" }, { "docid": "31382a74a978d17fbbb1c9b352dd03c1", "score": "0.60219383", "text": "def index\n @witnesses = Witness.all\n\n respond_to do |format|...
e864bb0221cf88e94bcaaf5a6ee0d3bb
returns a human readable string
[ { "docid": "4fe0f7ca92f8e2b1126ef45febd358ea", "score": "0.0", "text": "def to_s\n return \"#{self[:name]} - #{phone_number.split(//).last(4).join unless phone_number.nil?}\"\n end", "title": "" } ]
[ { "docid": "846f2deacda09e74e1079c108f74cb65", "score": "0.743465", "text": "def to_human\n \"\"\n end", "title": "" }, { "docid": "77e9fc6141ff2660c553c381fdd89f7d", "score": "0.7289405", "text": "def to_s\n human_name\n end", "title": "" }, { "docid": "4d850aa3a...
0cd624b338ff7017c7f64970c0c58d87
Template method which must be overridden by all widget subclasses. Inside this method you call the magic element methods which emit HTML and text to the output string.
[ { "docid": "f037416a645308c8787654df7ae854ab", "score": "0.0", "text": "def content\n if @block\n instance_eval(&@block)\n end\n end", "title": "" } ]
[ { "docid": "e05b813a11491f47a323d1620b755a90", "score": "0.6699995", "text": "def render_widget(*args)\n @last_invoke = Capybara.string super\n end", "title": "" }, { "docid": "6dd92c25dbb68096a0fd2f4f8c098c8c", "score": "0.6575446", "text": "def output(*args, &block)\n ...
e125b67f2eddd8e3cf90b15302b58386
POST /ticket2s POST /ticket2s.json
[ { "docid": "ce6d74aae08e1fd44789e128478f0346", "score": "0.71783864", "text": "def create\n @ticket2 = Ticket2.new(ticket2_params)\n\n respond_to do |format|\n if @ticket2.save\n format.html { redirect_to @ticket2, notice: 'Ticket2 was successfully created.' }\n format.json { re...
[ { "docid": "ade02b583a14da0e8649c340acd8ccbb", "score": "0.6470566", "text": "def ticket2_params\n params.require(:ticket2).permit(:name, :price, :email, :tent)\n end", "title": "" }, { "docid": "510c331fb99c93f74b35e6224981c5b4", "score": "0.63127315", "text": "def create\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c110f09d542c33508d1e4ee71ab6f4f0", "score": "0.0", "text": "def set_anagram\n @anagram = Anagram.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
4854cf125337bafd3dabc4c4904fde70
Example: yd.delete('/home/graph.pdf') => true Arguments: path: path to yandex disk directory or file
[ { "docid": "5cbd9400cd001af247f9c442e902d68d", "score": "0.689998", "text": "def delete(path)\n send_request(:delete, :path => path)\n end", "title": "" } ]
[ { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.7642095", "text": "def delete(path);end", "title": "" }, { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.7642095", "text": "def delete(path);end", "title": "" }, { "docid": "f5d224a032417b9563a0db236d40...
e1e6bf89912027c5dcbe3201bb58cb55
creates catalog structure for the path
[ { "docid": "1c387d213cf4e178f08bbe197bfc3b09", "score": "0.0", "text": "def create_structure(permission=nil)\n FileManager.create_structure(self.dirname.to_s, permission)\n end", "title": "" } ]
[ { "docid": "cb568089c3e4d88878d42f501aa24893", "score": "0.7247626", "text": "def create_catalog_path!\n FileUtils.mkdir_p(@catalog_path) unless File.exists?(@catalog_path)\n end", "title": "" }, { "docid": "8c0f76a3c17ca9aedd97e7dc359c3bc4", "score": "0.64586633", "text": "...
111368d3ee771d7122d40406b313f5aa
Required because of rails 4
[ { "docid": "a538f48d6e4e29395f9bf62b7c14f6e8", "score": "0.0", "text": "def bookmark_params\n params.permit(:name, :address, :tags)\n end", "title": "" } ]
[ { "docid": "96f2aab1531c8970d41280176da865c0", "score": "0.6675213", "text": "def dependency\n super\n end", "title": "" }, { "docid": "550cd967f7e0b51604744fecefb1adbd", "score": "0.66747373", "text": "def required; end", "title": "" }, { "docid": "550cd967f7e0b5...
0319a2abfb867a59f6f5a49ddc99ce05
Add a `after_eval` hook that restores visibility after a command is eval.
[ { "docid": "7619c65bb20ab2585d834536064a6c9e", "score": "0.7579847", "text": "def _add_restore_visibility_hook\n _pry_config.hooks.add_hook :after_eval, :restore_visibility do\n terminal_settings.echo\n end\n end", "title": "" } ]
[ { "docid": "75b7d76687138a7471faf7268db5baba", "score": "0.7434356", "text": "def _add_restore_visibility_hook\n Pry.config.hooks.add_hook :after_eval, :restore_visibility do\n system(\"stty echo 2>#{ DEV_NULL }\")\n end\n end", "title": "" }, { "docid": "87c3ecb5980b26b6...
5040b9e549e03e732f57ce5e045cef78
GET /micro_array_images/1 GET /micro_array_images/1.xml
[ { "docid": "726feb364d02158d48c82a60fcbc43c6", "score": "0.6010938", "text": "def show\n @micro_array_image = MicroArrayImage.find(params[:id])\n @title = \"Micro array image\"\n\n #@micro_array_image_icode = MicroArrayImage.find(params[:icode])\n\n\n #if @micro_array_image.nil?\n # re...
[ { "docid": "6ae970456f0561628b443df6e12d6b1a", "score": "0.6793659", "text": "def index\n @images = Image.find_images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "title": "" }, { "docid": "29ada3d32df432...
7d38fd089a26e1c5d0f987fef9445f0c
PUT /posts/1 PUT /posts/1.xml
[ { "docid": "7f2cef58edd47b2d67daa2e148dd5a17", "score": "0.0", "text": "def update\n logger.debug \"Going to update post #{params[:id]}\"\n @post = Post.find_by_slug(params[:id])\n authorize! :update, @post\n respond_to do |format|\n begin\n @post.update_attributes!(params[:post]...
[ { "docid": "e631b376ae2ccb776680432bf94b01cc", "score": "0.6867673", "text": "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "title": "" }, { "docid": "c2c0b673628fdc28b1...
d012527b58be351a7f23899e985348db
GET /admin/members/1 GET /admin/members/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "d743f502b758a7352730ff7d6044c6b3", "score": "0.795104", "text": "def my_members(params = {})\n get(\"/members\", params)\n end", "title": "" }, { "docid": "2eb3a656ce97b066f36c71fd7f539be3", "score": "0.77499306", "text": "def show\n members = MemberRepo.fi...
c5f5df0e326533b4bd8654a8611cfc63
DELETE /fs/1 DELETE /fs/1.xml
[ { "docid": "22a265dbc9aff7dbb270d3305c4126bf", "score": "0.68121016", "text": "def destroy\n @f = f.find(params[:id])\n @f.destroy\n\n respond_to do |format|\n format.html { redirect_to(fs_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.72665685", "text": "def delete(path);end", "title": "" }, { "docid": "4100b1ba27a9a751bb11d54b45e1aeb1", "score": "0.72665685", "text": "def delete(path);end", "title": "" }, { "docid": "b965aa2e76649b84623ed92581...
fba1b5d9bcf428df0c78caf9eb07ebbe
Remove anything that's not a string from an array. Hint: Use the method "class" "blake".class
[ { "docid": "5f1f3d3b0a87c40f3cc6792adc623d13", "score": "0.74129075", "text": "def only_strings(array)\n array.delete_if {|element| element.is_a?(String) == false}\n end", "title": "" } ]
[ { "docid": "319fac24b38f306a7bc25b28b2e77442", "score": "0.8003608", "text": "def remove_non_strings(array)\n array.delete_if do |name|\n name.class != String\n end\nend", "title": "" }, { "docid": "556c891daabe9c4988410ac4654ed235", "score": "0.7896634", "text": "def remove_non_...
74d9fb9ccd318dd6fbd9482297f0ba93
=begin You are in the block 5 You're in the method test You are in the block 100 =end Example: 3
[ { "docid": "91d7f671bd0990784843c93d5e66198c", "score": "0.0", "text": "def test\n puts 'You are in the method'\n yield\n puts 'You are again back to the method'\n yield\nend", "title": "" } ]
[ { "docid": "7e2ad81fb87266f709039a2141e502f4", "score": "0.7073792", "text": "def test_good_check_block\n\t\tresult = @methods.check_block_number 3, 4\n\t\tassert_equal 1, result\n\tend", "title": "" }, { "docid": "1ab0057bbf0fef9d5006ca12f9aee38c", "score": "0.70047307", "text": "de...
5dac3ada08b7179c1bd0ab5480ab2b05
Wrapps parse_object to handle JSON literals and reversed properties
[ { "docid": "22285e502a58a9485839cb71bccf0bda", "score": "0.0", "text": "def emit_object(input, active_property, context, subject, predicate, **options, &block)\n if context.coerce(active_property) == '@json'\n parse_object(context.expand_value(active_property, input), active_property, co...
[ { "docid": "f82ec3d86b49a8499334def71cd4afc0", "score": "0.69803125", "text": "def parse_json_object(input)\n if defined? JSON\n JSON.parse(input)\n else\n json_objparse(input)\n end\nend", "title": "" }, { "docid": "1ca074fb4fc2e45bc387fd120ce9a997", "score": "0.68256664", ...
bb08235bddef4d2e519613bdf38d6067
Returns a list of [attr_type_name, data] for the given attribute name Nil is returned if the attribute doesn't exist in the header.
[ { "docid": "e4babbee3f29cff270a18e8f244cea42", "score": "0.68034196", "text": "def attribute_info(name)\n\t\t\t@header[name] or @header[name.to_sym]\n\t\tend", "title": "" } ]
[ { "docid": "a223efe24c8a0d2a6013be95138752f5", "score": "0.65064335", "text": "def get_attribute_type_by_name attribute_name\n return @names_and_types_of_attributes[attribute_name]\n end", "title": "" }, { "docid": "33edd9ad1700ff59004c8d7cd1c581b2", "score": "0.6471438", "text":...
67665bb5238e8f0ae6eff354b9c3e6f2
Is it likely that the socket is still connected? May return false positive, but won't return false negative.
[ { "docid": "fb78f9635b98c2b02302e52368e96760", "score": "0.0", "text": "def connected?; end", "title": "" } ]
[ { "docid": "a0ce60b6f6476cbfe5410a05b05f29a1", "score": "0.83202654", "text": "def connected?\n @connected && !(@socket.closed?) \n end", "title": "" }, { "docid": "a6d81ea859013bd3bebae054579c7ff5", "score": "0.82882404", "text": "def connected?\n !socket.closed?\n end", ...
73dcb392108599525f49f55d2e29a29d
Add condition option type for this product
[ { "docid": "8c260a873116f66341729b1d80bd267b", "score": "0.72929925", "text": "def update_condition_type()\n new_product_option_type = Spree::ProductOptionType.create :product_id => @new_product.id,\n :option_type_id => @@condition.id\n end", "title": "" } ]
[ { "docid": "c07e68448d61490c6c10e0385649150a", "score": "0.6333876", "text": "def condition_type_params\n params.require(:condition_type).permit(:name)\n end", "title": "" }, { "docid": "0191463e755af1398c191ffad3ab0539", "score": "0.6240264", "text": "def add_condition(condi...
f32fcf12d21e2e302a457f641a7b5303
Translated an arbitrary Unix timestamp to the recording timestamp. This is the function that others will call
[ { "docid": "d50890ebd6e2d49d9d72199a32b6d429", "score": "0.71273124", "text": "def translateTimestamp(timestamp)\n new_timestamp = translateTimestamp_helper(timestamp.to_f).to_f\n#\tBigBlueButton.logger.info(\"Translating #{timestamp}, old value=#{timestamp.to_f-$meeting_start.to_f}, new value=#{new_ti...
[ { "docid": "46578a06ff38d86a3f4121a84bd52d63", "score": "0.78305584", "text": "def translate_timestamp(timestamp)\n Time.at((timestamp >> 18) / 1000)\nend", "title": "" }, { "docid": "669d8628ea3982cf6f2f9b7a50fde731", "score": "0.6895527", "text": "def convert_timestamp_to_time(tim...
4e785cf25fc1109e18eaa39196206149
The apply and destroy CLI opts map from the same task opts to cli opts, share that code.
[ { "docid": "bcebdc9514bcac5b0aca5ab4f7892cef", "score": "0.0", "text": "def transcribe_to_cli(opts, dir = nil, required = [])\n cli_opts = %w[-no-color]\n cli_opts.push(*required)\n cli_opts << \"-state=#{File.expand_path(opts[:state], dir)}\" if opts[:state]\n cli_opts << \"-state-o...
[ { "docid": "031f9829da55411e8d53bb816999d40a", "score": "0.61884284", "text": "def common_options(opts); end", "title": "" }, { "docid": "24b984db33d6bbf2117afe243beb8f09", "score": "0.6040564", "text": "def cli_map\n @_cli_map ||= {}\n end", "title": "" }, { ...
2cc0ada2e2ae95b551ef4564b76545a9
Generates a Graph of all the risks by severity
[ { "docid": "ae116e98d726575d0effaa7bf08d4e07", "score": "0.76684624", "text": "def risks_by_severity_graph\n\t\t\t\t\tg = Gruff::Bar.new(GRAPH_WIDTH)\n\t\t\t\t\tg.title = \"Risks By Severity\"\n\t\t\t\t\tg.sort = false\n\t\t\t\t\tg.marker_count = 1\n\t\t\t\t\tg.theme = {\n\t\t\t\t\t\t:colors => Risu::GR...
[ { "docid": "f8c67b7efdfa9c0232e07567b8fc8568", "score": "0.6267649", "text": "def stigs_severity_graph\n\t\t\t\t\tg = Gruff::Bar.new(GRAPH_WIDTH)\n\t\t\t\t\tg.title = \"Stigs By Severity\"\n\t\t\t\t\tg.sort = false\n\t\t\t\t\tg.marker_count = 1\n\t\t\t\t\tg.theme = {\n\t\t\t\t\t\t:colors => Risu::GRAPH_...
0978baf82a7c677285dc674947a46b2d
arr = [0, 1, 5, 7] p bad_two_sum?(arr, 6) => should be true p bad_two_sum?(arr, 10) => should be false note: b_search here?
[ { "docid": "87ebea7a69e2b6ec583d36c31a2e7748", "score": "0.0", "text": "def okay_two_sum?(arr,target)\n arr = arr.sort\n\n i = 0\n j = arr.length-1\n\n until i >= j\n current_sum = arr[i] + arr[j]\n if current_sum > target\n j -= 1\n elsif current_sum == target\n return true\n ...
[ { "docid": "8437d9f4478adabe6999d577980ec32c", "score": "0.90036386", "text": "def okay_two_sum?(arr, target_sum)\n arr.each do |i|\n target = target_sum - i\n return true if bsearch(arr, target)\n end\n false\nend", "title": "" }, { "docid": "bbf051e4277b76d6f7a1cec29b9e0795", ...
66c56a2a30d247b1b83b1f09572b5c11
ASSIGN DATA FROM JSON FILE TO FILEHANDLER ATTRIBUTES
[ { "docid": "5b588dc70f5893d78ed712f08a777f8d", "score": "0.6390054", "text": "def assign_data \n\n @file.upload_data_from_file # data now stored in FileHandler attributes\n @main_menu.user_name = @file.username\n \n end", "title": "" } ]
[ { "docid": "5a55fc3a3a9c56b47432378bad790c20", "score": "0.71321976", "text": "def load_data\n @file_data = JSON.parse(@file_data)\n end", "title": "" }, { "docid": "ae080a52bb7e875a44104907c70677a8", "score": "0.700955", "text": "def setData(fileName)\n file = open(fileName...
fdd21a98b388b3549b62d29bcc686f24
Price of payment in cents
[ { "docid": "5378fb9740dcdd9b6e7a89cb34f59208", "score": "0.0", "text": "def price\n raise 'Redefine this method in your billing model.'\n end", "title": "" } ]
[ { "docid": "f1e6985b89585c3fa2603a7771fefe80", "score": "0.79933673", "text": "def price_in_cents\n\t\tInteger(price * 100 + 0.50)\n\tend", "title": "" }, { "docid": "d7c5e303cc80f33739b9af663e2df6fb", "score": "0.7914162", "text": "def payment_price\n\t\t\t\t\treturn self.price\n\t\...
4c7b3661b0b1d5d41af00adfe86840cc
Returns whether a message is spam.
[ { "docid": "f68f0456f15539e12d343d3c33f1fa67", "score": "0.8635551", "text": "def spam?(message)\n message.spam_report_score > @spamassassin_threshold\n end", "title": "" } ]
[ { "docid": "09ef03609a4313990b4a48fea85b78c5", "score": "0.80371946", "text": "def spam?\n calculate_snook_score unless already_calculated_snook\n snook_spam_status == \"spam\"\n end", "title": "" }, { "docid": "1a5bbcc4a42261100202a920f625445e", "score": "0.7878553", "t...
8858c0bc4750c02303c8790c9f96952c
Translate the key options into the required format
[ { "docid": "d0730000e365225ccf7f9e7b51da6ee6", "score": "0.77361685", "text": "def translate_key_options(key_options)\n {\n type: key_options[:type].to_s,\n offset: key_options[:offset],\n increment: key_options[:increment],\n allowUserKeys: key_options[:allow_...
[ { "docid": "eec94bcad394237076c8820608fd88b0", "score": "0.7298057", "text": "def normalize_key(key, options); end", "title": "" }, { "docid": "16973d58915c8465da32efac4f3edc60", "score": "0.7135915", "text": "def translate_options(keys, scope)\n keys.map{|k| [t(k, :scope => scope...
c35c466e21375a9c3542236d4fed0d65
convert all camelCase params (sent by Backbone to the API) to the snake_case expected by Rails from
[ { "docid": "3dfe32915b543a3887c7996447132f7c", "score": "0.0", "text": "def deep_snake_case_params(val)\n case val\n when Array\n val.map {|v| deep_snake_case_params v }\n when Hash\n val.keys.each do |k, v = val[k]|\n val.delete k\n val[k.underscore] = deep_snake_case_p...
[ { "docid": "15096488064fe938471e9d16ba09f02c", "score": "0.7725742", "text": "def snakeize_params\n params.deep_snakeize!\n end", "title": "" }, { "docid": "b6f70e69a42ec41881c56fc69bc2e525", "score": "0.76968455", "text": "def snakeize_params\n params.deep_snakeize!\n en...
3c3728c2a7ce7f53b4a82d96c84dbec9
PUT /restaurants/1 PUT /restaurants/1.xml
[ { "docid": "15908edf8a988fe387da4b117bafdbd2", "score": "0.6289083", "text": "def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was s...
[ { "docid": "e20023731438388e20cd3c0114679339", "score": "0.628367", "text": "def update\n @restaurant.update\n end", "title": "" }, { "docid": "4a5e5f935fe2393f066ca4a3de419825", "score": "0.62688464", "text": "def update\n @restaurant = Restaurant.find(params[:id])\n\n res...
4d7ecd0fa1d07ac7eb4e72331e8e23ef
Take the last chunk number received
[ { "docid": "c28051f5a73708e50f73b616292f7eaa", "score": "0.77232486", "text": "def last_chunk_number\n file_size = File.size(@put.idTransaction)\n file_size % @helo.chunkSize == 0 ? (file_size / @helo.chunkSize)-1 : file_size / @helo.chunkSize\n end", "title": "" } ]
[ { "docid": "c53cedbbc4be2f33d02d0042a4f951e7", "score": "0.72020423", "text": "def start_chunk\n return nil unless self.total_chunks\n self.chunks_received ||= []\n (1..self.total_chunks).each do |chunk_num|\n unless self.chunks_received.include?(chunk_num)\n return chunk_num\n ...
5ad2e830edb442cc000f74fbea239659
Creates a group with list of SIDs
[ { "docid": "3d99d27d8363924906aa6d229273a684", "score": "0.7655271", "text": "def create_group_with_bulk_sids(students, group)\n enter_sid_list students.map(&:sis_id).join(', ')\n click_add_sids_to_group_button\n name_and_save_group(group)\n group.members << students\n group.members.flatt...
[ { "docid": "7575e36be8b323a4c1f500e48e0c0948", "score": "0.70751816", "text": "def add_sids_to_existing_grp(students, group)\n click_add_students_button\n enter_sid_list students.map(&:sis_id).join(', ')\n click_add_sids_to_group_button\n group.members << students\n group.members.flatten!...
fd74e6888026fe8e56440e5603211f79
The db collection name for this instance's class
[ { "docid": "41684f3d5f61eb8fc3e3906104a3c805", "score": "0.0", "text": "def db_key\n\t\t\tself.class.db_key\n end", "title": "" } ]
[ { "docid": "d0521ae5774f99341e54532a1ebe1b49", "score": "0.8709912", "text": "def collection_name\n @collection_name ||= self.to_s.tableize.gsub(/\\//, '.')\n end", "title": "" }, { "docid": "999468815c92b7efbc183ed5f4bca45d", "score": "0.845652", "text": "def collection_...
840dba9597cd2412e141c0a3aa1cb3d4
determines whether or not authentication has succeeded. according to the RCON spec, when authentication fails, 1 is returned in the id field of the packet.
[ { "docid": "9ed5f7e3462e84534b16bc04a2f7076f", "score": "0.70670813", "text": "def success?\n id != AUTH_FAILURE_RESPONSE\n end", "title": "" } ]
[ { "docid": "096fe680df1015e7f32fdc8a92709017", "score": "0.69307774", "text": "def authok?\n @connection.authok\n end", "title": "" }, { "docid": "096fe680df1015e7f32fdc8a92709017", "score": "0.69307774", "text": "def authok?\n @connection.authok\n end", "title": ...
175440e4b435eccda9ac52a9e9689bf3
"Maximize" the current window using Selenium's `manage.window.resize_to`. This script does not use the window manager's "maximize" capability, but rather resizes the window. By default, it positions the window 64 pixels below and to the right of the top left corner, and sizes the window to be 128 pixels smaller both vr...
[ { "docid": "3a0c407a746844a21ea8fa471adf0a7e", "score": "0.80692774", "text": "def maximize_ish(x = 64, y = 64, w = -128, h = -128)\n if is_headless\n x = 0; y = 0; w = -2; h = -2\n end\n width = w\n height = h\n width = \"window.screen.availWidth - #{-w}\" if w <= 0\n height =...
[ { "docid": "b309d8730f83016befe85c504a111842", "score": "0.80905664", "text": "def maximize_ish(x = 64, y = 64, w = -128, h = -128)\n if is_headless\n x = 0; y = 0; w = -2; h = -2\n end\n width = w\n height = h\n width = \"window.screen.availWidth - #{-w}\" if w <= 0\n height =...
dfcdc41f758016b0d9667633c28d502a
GET /site_comments GET /site_comments.json
[ { "docid": "1b306aafd43637a6c5662af9d7559c3a", "score": "0.6994929", "text": "def index\n @site = Site.find_by(id: params[:site_id])\n redirect_to sites_url and return if @site.nil?\n redirect_to sites_url and return unless can_access_site_comment?(@site)\n @site_comments = @site.site_commen...
[ { "docid": "24a532e186cbdaffa1b75d8c6b8ffcdc", "score": "0.7717283", "text": "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comments = Comment.all \n else\n @comments = Site.find(params[:site_id]).comments \n end\n\n respond_to do |format|\n ...
9010d7fef4c20d8760d30c2c55646288
Unsupported tags: EXTXMEDIA, EXTXIFRAMESTREAMINF Unsupported attributes of EXTXSTREAMINF: AUDIO, VIDEO
[ { "docid": "fb11ad566f7d8eef7380908e01e04c6e", "score": "0.0", "text": "def attribute_string\n s = []\n s << \"PROGRAM-ID=#{ (program_id || 1).to_i }\"\n s << \"BANDWIDTH=#{ bandwidth.to_i }\"\n s << \"CODECS=\\\"#{ codecs }\\\"\" if codecs\n s << \"RESOLUTION=#{ resolution }\" ...
[ { "docid": "58cd89a51d21113deda9663003d27c3a", "score": "0.56460315", "text": "def media_option_sfp\n super\n end", "title": "" }, { "docid": "e130ad6c473ccbeab2d50bd981342617", "score": "0.56091714", "text": "def tag\n super('TagLib::MPEG::File')\n end", "title": "" ...
e91260d81a81aa47841f14b86c43e2b7
only proof of concept
[ { "docid": "cd278ba88c3be7bd5f0118be35575824", "score": "0.0", "text": "def select(*channels)\n future do\n # noinspection RubyArgCount\n Channel.select do |s|\n channels.each do |ch|\n s.take(ch) { |value| [value, ch] }\n end\n end\n ...
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.7008602", "text": "def desired; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.6763515", "text": "def anchored; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", ...
176289defc2586b7cb851643874660db
DELETE /products/1 DELETE /products/1.json
[ { "docid": "6fcbabc818c2f585e7ca60fb6ce14070", "score": "0.0", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title"...
[ { "docid": "e442cbe15cb1b95bb63528b31212142f", "score": "0.77176476", "text": "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "title": "" }, { "docid": "64fad427142859233816a0e8a205621b", "score": "0.7593208...
2396aa0cdd9ba01e3c69062f19e6af63
The default paths are primarily defined in PoolParty::Default. These are the default search paths in order: current working directory (Dir.pwd) ~/.poolparty ~/.ec2 /etc/poolparty /var/poolparty
[ { "docid": "c02b9519c5fc9d03419603b2019461b3", "score": "0.8838834", "text": "def default_paths\n [\n Dir.pwd,\n PoolParty::Default.poolparty_home_path,\n PoolParty::Default.base_keypair_path,\n PoolParty::Default.poolparty_src_path,\n PoolParty::Defau...
[ { "docid": "3416b72a5ef43fff18f33a08286302ff", "score": "0.6742671", "text": "def default_paths\n if windows?\n %w{\n C:\\HashiCorp\\Vagrant\\bin\n /c/HashiCorp/Vagrant/bin\n }\n else\n %w{\n /opt/vagrant/bin\n /usr/local/bin\n /usr/bin\n /b...
5e250c522358c7c79a8787681c8888a6
Returns true if automaton is determinstic and false if automaton is nondeterministic.
[ { "docid": "174d330755304f1a2f7d471e553cfcb0", "score": "0.73332924", "text": "def is_deterministic\n @states.each do |state|\n @alphabet.each do |symbol|\n if transition_function(state, symbol).size > 1 then return false end\n end\n end\n return true\n end", "title": "" ...
[ { "docid": "3a4bf3a6f634ea89932861d7385e9cc8", "score": "0.74621105", "text": "def deterministic?\n @states.each{|s| return false if not s.deterministic_transitions? }\n return true\n end", "title": "" }, { "docid": "a6c55f48f7866e5d0b04bebdbd1a9b16", "score": "0.744087", "tex...
4b7a2e7e890d0150e4b18ad7a1171fa0
tell the expectation it needs to call the super after the expecation execution
[ { "docid": "f229bf54536ec1925fe48c1bf0050b60", "score": "0.7834387", "text": "def super_after(&b)\n @expectation.super_after &b\n self\n end", "title": "" } ]
[ { "docid": "029a95bbe1123651e714a1863cf728ab", "score": "0.7083625", "text": "def super_before(&b)\n @expectation.super_before(&b)\n self\n end", "title": "" }, { "docid": "7b03b951425554e664a0e4eb0f6cd046", "score": "0.6526197", "text": "def inherited(base)\n base.define_m...
b27eefee068dd1889704f6738e9602f0
default children= does nothing
[ { "docid": "677dad83b1c64de34c85e0e58d03ac00", "score": "0.0", "text": "def children= (c)\n end", "title": "" } ]
[ { "docid": "701a2337c150098c264222993eb87a71", "score": "0.8523335", "text": "def children=(_arg0); end", "title": "" }, { "docid": "701a2337c150098c264222993eb87a71", "score": "0.8523335", "text": "def children=(_arg0); end", "title": "" }, { "docid": "701a2337c150098c26...
ba5535bb2a30162d55c3480993425524
below take from Umlaut's illiad service adaptor takes an existing openURL and illiadizes it. also attempts to handle the question of enumeration.
[ { "docid": "674a1cc2f41d8e065d6f3bc3910d05f9", "score": "0.0", "text": "def illiad_query_parameters(referrer:, referent:, metadata:, note:)\n qp = map_metdata(referrer: referrer, referent: referent, metadata: metadata)\n qp['notes'] = note\n\n # trim empty ones please\n qp.de...
[ { "docid": "4574d601409b3c38ff625af77ceebd62", "score": "0.5749253", "text": "def ill_openurl_from_alma(mms_id)\n options = TurboAlmaApi::Client.request_options mms_id, user_id\n options.dig('ILLIAD') || ill_request_form_url_for(mms_id)\n end", "title": "" }, { "docid": "3b36440722ef5...
a8a92b968d102d9ce3358ec088f4a8b9
Performs common validations for attachment models.
[ { "docid": "a093f65411268399ff818ab85ffe5583", "score": "0.7198389", "text": "def validates_as_attachment\n validates_presence_of :size, :content_type, :filename\n validate :attachment_attributes_valid?\n end", "title": "" } ]
[ { "docid": "fa8f8c10446a69cda2756429292295af", "score": "0.71393317", "text": "def validate\n if self.filename.nil?\n errors.add_to_base(\"You must choose an image to upload\")\n else\n [:size, :content_type].each do |attr_name|\n enum = attachment_options[attr_name]\n\n un...
2e4a10d58a846ee533698f57f6359d03
Returning the email address of the model if an email should be sent for this object (Message or Notification). If no mail has to be sent, return nil.
[ { "docid": "4889fa8bc45be046fef0c0d161395970", "score": "0.6988977", "text": "def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n return email\n #if false\n #return nil\n end", "title": "" } ]
[ { "docid": "c8430be72981dc8988feade0d02ffca2", "score": "0.74826896", "text": "def mailboxer_email(object)\n #Check if an email should be sent for that object\n #if true\n self.email\n #return \"define_email@on_your.model\"\n #if false\n #return nil\n end", "title": "" }, { "docid": "...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5a5c0d0aa1e9500f9a918402a1038f6d", "score": "0.0", "text": "def player_params\n params.require(:player).permit(:gamer_tag, :points, :participations,\n :self_assessment, :tournament_experience, :comment, :best_rank, :wins,\n :losses, :main_characters, :created_at, :updated_...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69795185", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782116", "text": "def strong_params\n params.requ...
5f85f3fda3cb4155356b2564f73b0d52
Performs a test of difference of means between classes Since the ttest is twosample, classification_variable must only have two states
[ { "docid": "4b5d3f79f550d86dab625ef934ffe62c", "score": "0.56775737", "text": "def t_test(variable)\n R.eval \"t_test <- t.test(#{variable.to_s} ~ #{classification_variable.to_s})\"\n \n t_statistic = R.pull \"t_test$statistic\"\n degrees_of_freedom = R.pull \"t_test$parameter\"...
[ { "docid": "cd4230437b49a0b46b02c1b4cf73679a", "score": "0.62911785", "text": "def testing\n\t\ttest = @test_data\n right_counter = 0\n\t\twrong_counter = 0\n\t\ttest.each do |t|\n\t\t\tclass_predicted = classify(t)\n # Screen output in order to detect predictions and assignings\n# puts \"-...
1c2840e2f76651bc5efdae3d3fae0525
chooses random word from whole list
[ { "docid": "138126f960223d076b6f7d9cece8b139", "score": "0.76777905", "text": "def choose_word\n\t@valid_words.shuffle!\n\n\t@target = @valid_words[rand(@valid_words.length-1)]\nend", "title": "" } ]
[ { "docid": "cc6892a54945efb036dfd244b21a7615", "score": "0.84993875", "text": "def pick_word\n\t\treturn @wordlist.at(rand(@wordlist.length))\n\tend", "title": "" }, { "docid": "44726dca68c2435650f7dfb4e054fb40", "score": "0.83877736", "text": "def choose_word(word_list)\n accepta...
f99feeabb0c0318113619e9490f4d420
DELETE /contacts/1 DELETE /contacts/1.json
[ { "docid": "788810506e1318e2339ca8ad25af81ce", "score": "0.0", "text": "def destroy\n @contact.destroy\n redirect_to contacts_url, notice: 'Contact was successfully deleted.'\n end", "title": "" } ]
[ { "docid": "d855d4943ce053662501096d30b3b2e5", "score": "0.7691085", "text": "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "title": "" }, { "docid": "0069ba394c5057afa1413bc6fa391114", "score": "0.7681317", "text": "def delete(contactname)\n\n end", ...
24b9ae056ac259e17c59219a15271420
NOTE: HAMLLint exits successfully even if RuboCop fails. The version 0.35.0 fixed the issue, but we continue to support older versions.
[ { "docid": "814a8e568038f42a61b40e35d7181829", "score": "0.49001092", "text": "def add_rubocop_warnings_if_exists(stderr)\n stderr.scan(/\\bcannot load such file -- [\\w-]+\\b/) do |message|\n if message.is_a? String\n add_warning message\n else\n raise \"Unexpected ...
[ { "docid": "99eacfc2cb720b48916eca7cd9e3b9a0", "score": "0.64261234", "text": "def run_rubocop(rubocop_cli, ruby_code, path) # rubocop:disable Metrics\n rubocop_status = nil\n stdout_str, stderr_str = HamlLint::Utils.with_captured_streams(ruby_code) do\n rubocop_cli.config_store.instanc...
4d3fb8c45457f5fa9736114a275f020b
Turns a string like '1m10s' into a float like '70.0', more formally, turns a time duration expressed as a string into a Float instance (millisecond count). w > week d > day h > hour m > minute s > second M > month y > year 'nada' > millisecond Some examples : Rufus.parse_time_string "0.5" => 0.5 Rufus.parse_time_string...
[ { "docid": "ece38b83f8c14c7ff3961edd1dcf6900", "score": "0.75428313", "text": "def parse_time_string(string)\n\n if m = string.match(/^(\\d*)\\.?(\\d*)([A-Za-z])(.*)$/)\n\n number = \"#{m[1]}.#{m[2]}\".to_f\n multiplier = DURATIONS[m[3]]\n\n raise ArgumentError.new(\"unknown ti...
[ { "docid": "aa9c81f27c97ea17822ee6e1e486f63d", "score": "0.8064981", "text": "def duration_to_f (s)\n return s if s.kind_of? Float\n return OpenWFE::parse_time_string(s) if s.kind_of? String\n return Float(s.to_s)\n end", "title": "" }, { ...
208350f4abe7c7dc6797331e0bb07794
Returns the entire (raw) content of the file.
[ { "docid": "e4d34bf3117fb5cc0e99e0db44cd8aa5", "score": "0.0", "text": "def content\n # TODO: this has the same drawbacks as Config.split\n @content ||= File.read path\n end", "title": "" } ]
[ { "docid": "088b9fec918a4b2b8310039c8f050474", "score": "0.83581126", "text": "def raw_content\n @raw_content ||= File.open(absolute_path, \"r:UTF-8\", &:read)\n end", "title": "" }, { "docid": "f35083a0ac91d39fe5134f451cec71d9", "score": "0.8247011", "text": "def contents\n ...
4ce49811cf2289b24ddb37f78c932648
GET /cotizesccams/1 GET /cotizesccams/1.json
[ { "docid": "eedc4403abb2fbdba61092aab6a5fd02", "score": "0.0", "text": "def show\n if params[:identificador] && params[:clavecompra]\n @identificador = params[:identificador]\n @cotizesccam = Cotizesccam.find(@identificador)\n if params[:clavecompra].to_s == @cotizesccam.clavecompra.to...
[ { "docid": "714971b110d3ffaf0c655e5f5f17e5b4", "score": "0.6466788", "text": "def set_cotizesccam\n @cotizesccam = Cotizesccam.find(params[:id])\n end", "title": "" }, { "docid": "1925657949513729e7b5c785ac558733", "score": "0.6170883", "text": "def index\n @cotiz_esc_cams = C...
6ba7cad40dbd78d774000c2ca5b07df1
If set to false, mail will go through the motions of doing a delivery, but not actually call the delivery method or append the mail object to the Mail.deliveries collection. Useful for testing. Mail.deliveries.size => 0 mail.delivery_method :smtp mail.perform_deliveries = false mail.deliver Mail::SMTP not called here M...
[ { "docid": "782d7895feb2fe3683577b48a2ffc54b", "score": "0.0", "text": "def perform_deliveries; end", "title": "" } ]
[ { "docid": "9258f3018206465bc0763d54bab1aeb3", "score": "0.7468877", "text": "def deliver!\n send(delivery_method || :net_smtp)\n end", "title": "" }, { "docid": "97112878a430b6039b763b14fccf57b7", "score": "0.742882", "text": "def deliver!(mail = @mail)\n mail.call if mai...
fb55c3dbc3523ca70fedf4da03b0160e
generates possible moves for knight
[ { "docid": "fa751349549bba49b816119736148ac1", "score": "0.6565698", "text": "def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end", "title": "" } ]
[ { "docid": "aa3d1087c6c96911cf8a1b7eb2694fdf", "score": "0.7698657", "text": "def generate_possible_moves(state)\n end", "title": "" }, { "docid": "d432cd6fbbd1aedf3eecb8d1afb71494", "score": "0.7569774", "text": "def knight_moves(position_start,position_end)\n \n\n move = [-...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1c851fbfa12939782c5d91b86eac6e53", "score": "0.0", "text": "def set_registered_user\n @registered_user = RegisteredUser.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
7badb9169432f838508f015b4dee661f
Asking the user for their move by position 19. Receiving the user input. If the move is valid, make the move. If the move is invalid, ask for a new move until a valid move is received. Display the board after the valid move has been made.
[ { "docid": "4696da7b75000c1644328eb34071ef64", "score": "0.7127336", "text": "def turn(board)\n truthy = false\n until(truthy == true)\n puts \"Please enter 1-9:\"\n spotcheck = gets.strip\n truthy = valid_move?(board, spotcheck)\n end\n\n move(board, spotcheck)\n display_board(board)\n\ne...
[ { "docid": "a3cd663bed2b7324e0d86e9b1b2c541b", "score": "0.79676265", "text": "def turn\n puts \"Please enter 1-9:\"\n position = gets.chomp\n\n while !valid_move?(position)\n puts \"Please enter 1-9:\"\n position = gets.chomp\n end\n\n move(position, player_move = current_playe...
5d68eaed1e0df51326b6f9392e0711b2
Connection to some hardware that has one or more devices via some specific protocol
[ { "docid": "eadf9ddeb9dfeef09253d0a11402f526", "score": "0.0", "text": "def connection(name, params = {})\n @connection_types ||= []\n Celluloid::Logger.info \"Registering connection '#{name}'...\"\n @connection_types << {:name => name}.merge(params)\n end", "title": "" }...
[ { "docid": "5f325600b60b902c2ee629ad6defe430", "score": "0.65166914", "text": "def connect_device\n @interface.connect_device @device_port.text\n end", "title": "" }, { "docid": "2131cbf2d1b94c6e1769f3e115a16b6e", "score": "0.649242", "text": "def connect\n raise \"Already...
d60b37f4fa137d23c216337e1177618f
Emits the literal run collected by calls to the append_literal method.
[ { "docid": "249c30ad03b421d9f3b19d537e7a4176", "score": "0.8535521", "text": "def emit_literal\n text = literal_run.join\n self.literal_run = nil\n emit(:literal, :literal, text)\n end", "title": "" } ]
[ { "docid": "706f1815064d3e70f87995f49fe84294", "score": "0.81193817", "text": "def emit_literal\n text = literal.join\n self.literal = nil\n emit(:literal, :literal, text)\n end", "title": "" }, { "docid": "bc165ddd4a4ef74024c1b7fc00955d71", "score": "0.791996", "text": "de...
3b989d8efa1ffd401bc6e076b08a0fde
GET /users/new GET /users/new.xml
[ { "docid": "2f57ac0a657d6d52be80fca8cce99ea0", "score": "0.0", "text": "def new\n # @user = User.new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "title": "" } ]
[ { "docid": "eb2f813d46891748e182b979d3bf5d7f", "score": "0.7911266", "text": "def new\n @user = @users.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "title": "" }, { "docid": "90e268258e6b050fdb473af3ee963...
983366ec6a4220e5305cca6874522381
PATCH/PUT /time_days/1 PATCH/PUT /time_days/1.json
[ { "docid": "1847b3756805f0f831cd6f9fec218634", "score": "0.6936044", "text": "def update\n respond_to do |format|\n if @time_day.update(time_day_params)\n format.html { redirect_to @time_day, notice: 'Time day was successfully updated.' }\n format.json { head :no_content }\n e...
[ { "docid": "ee914533715bde20620f2e7bdf25b6ee", "score": "0.684013", "text": "def update\n @day = Day.find(params[:id])\n\n if @day.update(params[:day])\n head :no_content\n else\n render json: @day.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "9d5485a132722e9a5a5691efea62a10f", "score": "0.0", "text": "def set_booking\n @booking = Booking.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
cbe98815245e89d3c524271ee8aea035
Enumerates the Autobuild::Package instances that are defined in this source
[ { "docid": "4e70df141c41f14838e6a108c9c3d14f", "score": "0.73369616", "text": "def each_package\n if !block_given?\n return enum_for(:each_package)\n end\n\n manifest.packages.each_value do |pkg|\n if pkg.package_set.name == name\n ...
[ { "docid": "e2575bb79064eb95c82c31019eb57f71", "score": "0.7518612", "text": "def each_autobuild_package\n return enum_for(__method__) if !block_given?\n packages.each_value { |pkg| yield(pkg.autobuild) }\n end", "title": "" }, { "docid": "bc37bf77e50c3f489bedc20...
16976cd62d178b34f85aecfcdc6f3c07
Any additional special notes, possibly multiple, for this document at this location
[ { "docid": "978ce37c7ec67e205cfb130c15985737", "score": "0.67941934", "text": "def additional_holdings_location_notes(document, location)\n location_notes = []\n\n # Law records need a link back to their native catalog\n if document && document.in_pegasus?\n location_notes << content_tag(:...
[ { "docid": "f217d8297d749e9a246f64c0f457dd7c", "score": "0.678915", "text": "def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end", "title": "" }, { "docid": "ab85cea5c8d9753dc13f3b4e7e882e30", "score": "0.66132593", "text": "def ...
1f5d97e1b07b93f853e3e94f5ae4e72b
Define generate location method
[ { "docid": "88b0c2d8c68525a125eb7220fc1af2a6", "score": "0.6635228", "text": "def generate_location(map)\r\n #Generate coordinate in map\r\n map[@x_pos][@y_pos] = @nick\r\n map\r\n end", "title": "" } ]
[ { "docid": "ae06b2cf3f88249b1a78fb50cd74fde6", "score": "0.68958664", "text": "def locations; end", "title": "" }, { "docid": "ae06b2cf3f88249b1a78fb50cd74fde6", "score": "0.68958664", "text": "def locations; end", "title": "" }, { "docid": "ae06b2cf3f88249b1a78fb50cd74fd...
d871634e3daea43a66fd876a3a32f69f
GET /serchbooknames GET /serchbooknames.json
[ { "docid": "e5b4fdb28fec320e9c3458d1a912b704", "score": "0.72233903", "text": "def index\n @serchbooknames = Serchbookname.all\n end", "title": "" } ]
[ { "docid": "4fc080cd8cea92e955b70ed40fbd3e55", "score": "0.7326784", "text": "def names\n students_for_searchbar = SearchbarHelper.names_for(current_educator)\n render json: students_for_searchbar\n end", "title": "" }, { "docid": "f79c81e55d1523d50f76f81696b05227", "score": "0.66...
8224b4ceccd5beaa6f0660c7a92d42a6
Read a bigendian unsigned integer given its size in bytes.
[ { "docid": "beba00b137519473153a0fc02b18fb76", "score": "0.78388506", "text": "def read_uint_by_size(size)\n case size\n when 1\n read_uint8\n when 2\n read_uint16\n when 3\n read_uint24\n when 4\n read_uint32\n when 6\n read_uint48\n when 8\n read_uint...
[ { "docid": "69047fd13924ac402f0b28ce0722463b", "score": "0.67386985", "text": "def to_i_from_bytes(big_endian=false)\n bs = big_endian ? bytes.reverse_each : bytes.each\n bs.with_index.inject(0) { |sum,(b,i)| (b << (8*i)) + sum }\n end", "title": "" }, { "docid": "7f05a2e8520ab0509ea9...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "b97d28ca35e073914ca6c0175672db8d", "score": "0.0", "text": "def blend_params\n params.require(:blend).permit(:name, spices: [:id, :description, :name, :img_URL, :created_at, :updated_at, :flavor])\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
d88967c8caf2861a0d68924136477eef
initialize all the java factory proxies for configuration
[ { "docid": "42a177b3c4ba2f8f9b580dbc7eedc383", "score": "0.830682", "text": "def initialize_factory_proxies\n @configuration = Ehcache::Java::Configuration.new\n @disk = Ehcache::Java::DiskStoreConfiguration.new\n @cache = Ehcache::Java::CacheConfiguration.new\n ...
[ { "docid": "dcc7c8da5f3d4a90ceee81647b37e533", "score": "0.69426703", "text": "def initialize()\n @conf ||= []\n @proxy_type = \"backend\"\n end", "title": "" }, { "docid": "8260ae0422422b4e8579c6543f8dd852", "score": "0.6660922", "text": "def initialize()\n @conf |...
bfc704cada9c2cab4131457bd8fed7c8
Operation returns the Operation named name in the Graph, or nil if no such operation is present.
[ { "docid": "8b9b1f9c49d2e4a453232447206d72ef", "score": "0.8176388", "text": "def operation(name)\n c_operation = Tensorflow::TF_GraphOperationByName(c, CString(name))\n if c_operation.nil?\n warn(\"No Operation with the name #{name} exists.\")\n nil\n else\n ...
[ { "docid": "469781cbd0d21ace11c56df5a08bc737", "score": "0.713644", "text": "def operation_by_name(name)\n \"BetfairNg::API::Operations::#{name.camelize}::Operation\".constantize.new( config: self.config )\n end", "title": "" }, { "docid": "3c81fd3aaebbba7fae2e0b34887cacb5", "sco...
f0c08e974c9ec81fd52c8ab7d9e4942c
POST /trips POST /trips.json
[ { "docid": "5c34fd739786fb128f8d92541743597a", "score": "0.6013363", "text": "def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n @new_trip_member = TravelersTrip.new(trip_id: @trip.id, traveler_id: current_traveler.id)\n @new_trip_member.save...
[ { "docid": "d98bea7f28fd596e4cdd1b81af9e0f9f", "score": "0.7396972", "text": "def create\n @trip = Trip.new(trip_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n format.any(:trips_json, :json) do\n if @trip.save\n render json: @trip, status: :crea...
59a33700137dd42761bdc87b49e7ad1b
Defines a classlevel SOAP operation.
[ { "docid": "a8e84e1a2a27c6654b04badcc37e8302", "score": "0.6861961", "text": "def define_class_operation(operation, *options)\n options = options.extract_options!\n params = prepare_params(options)\n\n class_operation_module.module_eval <<-RUBY_EVAL, __FILE__, __LINE__+1\n ...
[ { "docid": "c88440cf074390354d4996b49dbe0c70", "score": "0.67353797", "text": "def soap_action(operation)\n operation\n end", "title": "" }, { "docid": "48392a48b202209979fdae124db370c9", "score": "0.62972295", "text": "def initialize(options = {})\n @endpoint, @namespac...
5a626e6b3b16fb9748eb5ec330c47682
This function explores the 'target' path and creates a list of file paths inside of 'target'. Target is searched recursively, hence files inside subdirectories will also be included.
[ { "docid": "b225fb53dddb1dc471aec10458a1582d", "score": "0.6936461", "text": "def exploreFiles( target, results = Array[] )\n # First, check if the target is a directory\n if isDirectory( target )\n # Okay, target is a directory, get all the entries inside the\n # directory and itera...
[ { "docid": "9e91e3ce03524867fb8db76e41c94bb1", "score": "0.7785421", "text": "def list_all_files_in_dir(target)\n all = Pathname.new(target).children\n dirs = all.select { |c| c.directory? }\n dirs.each do |d|\n Puppet.debug(\"Ignoring directory #{d.to_s}\")\n end\n all.select { |...
0b06ccefac32b66e8e3f7bf9fd630a11
IGNORE_STATUS_CODES = [400, 403, 404, 405, 406, 407, 414, 415, 429, 500] functions
[ { "docid": "ec9bf2afa923b9b5a385f12340baec8b", "score": "0.0", "text": "def detect_page_not_found(target, hostname, verbose)\n conn = true\n ecode = nil\n emesg = nil\n\n uri = URI(target)\n vhost = hostname || uri.host\n resolve = Ethon::Curl.slist_append(nil, \"#{vhost}:#{uri.port}:#...
[ { "docid": "fda6545de7647450d860d9fb98f71507", "score": "0.7550205", "text": "def fallback_status_code\n super\n end", "title": "" }, { "docid": "5d21d37c6aa469ab1d43294de379bfc0", "score": "0.73264813", "text": "def remove_fallback_status_code(opts)\n opts = check_param...
0ca5a2962e660166f04467c5d2361376
This applies the given hook to a builder. This should not be called directly.
[ { "docid": "eb0df9ab21974b7a4080cdef9c678e8c", "score": "0.7256082", "text": "def apply(builder, options=nil)\n options ||= {}\n\n if !options[:no_prepend_or_append]\n # Prepends first\n @prepend_hooks.each do |klass, args, block|\n builder.insert(0, klass, *ar...
[ { "docid": "a3e48404e12779098da466435def4775", "score": "0.6709983", "text": "def hook(&blk)\n HooksDsl.new.instance_eval(&blk)\n end", "title": "" }, { "docid": "91e48a0be8261067f708cc07946db876", "score": "0.6200756", "text": "def hook(&block)\n @hook = block if block_give...
244068a68763c7bf5a43539a50e915ab
list animal names, descriptions, and cuteness levels
[ { "docid": "24a00e24a0b1128e0c595ec8fdad90c3", "score": "0.0", "text": "def print_animals(db)\n puts \"Animals\"\n animals = db[\"animals\"]\n habitats = db[\"habitats\"]\n i=1\n animals.find.each do |animal|\n puts \"#{i}) #{animal[\"name\"]}\"\n puts \" --Description: #{animal[\"descriptio...
[ { "docid": "4fcf0a61c1b38ebfda4cb82167666c73", "score": "0.66861343", "text": "def list_all_animals\n\t\tlist_animals = @animal.inject(\"\") do |all_animals, animal| \n\t\tall_animals << \"Name: #{animal.name}\\nage:#{animal.age}\\ngender:#{animal.gender}\\nspecies:#{animal.species}\\nToys:#{animal.num_...
8e5d625ba5d7dcdd17cea2a308dbe492
Update a Hostswitch Profile Modifies a specified hostswitch profile. The body of the PUT request must include the resource_type. For uplink profiles, the put request must also include teaming parameters. Modifiable attributes include display_name, mtu, and transport_vlan. For uplink teaming policies, uplink_name and po...
[ { "docid": "886ee937a3cdedd6e049d093cdf8a3eb", "score": "0.6087068", "text": "def update_host_switch_profile_with_http_info(host_switch_profile_id, base_host_switch_profile, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NetworkTransportApi.upda...
[ { "docid": "138dcb5df02fa012e04ec9f1ea869419", "score": "0.6515806", "text": "def update_chassis_profile(moid, chassis_profile, opts = {})\n data, _status_code, _headers = update_chassis_profile_with_http_info(moid, chassis_profile, opts)\n data\n end", "title": "" }, { "docid":...
0a707b9a5acfe3b686a7b94d68dce805
Write a method that takes in 2 numbers as arguments and prints their sum. Then call your method three times with different arguments passed in:
[ { "docid": "156a9fd9cc0bc3be5574ea57798a49a8", "score": "0.0", "text": "def add(a, b)\n puts \"#{a} + #{b}\"\n return a + b\nend", "title": "" } ]
[ { "docid": "7943a482f5273ff0ce3a756a70efd648", "score": "0.77757335", "text": "def sum_these_numbers (a, b)\n puts a + b\nend", "title": "" }, { "docid": "3cc9f64b8ad4a2872bd63767db94b24b", "score": "0.7763828", "text": "def two_sum(nums)\nend", "title": "" }, { "docid":...
fa1311d672dd9829788b677d3470c850
Preserve data, but generate a different column name/header
[ { "docid": "ba611c4ff6c4238093516bb19301f81b", "score": "0.0", "text": "def rename(from, to)\n write(read(from))\n end", "title": "" } ]
[ { "docid": "8e62a584377737d025ac6da60110054b", "score": "0.6699732", "text": "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n else\n ni...
b783a1e6b8d6c3efd986c6ef8bd1452f
GET /comments/:post_id?page=x GET /comments/
[ { "docid": "201b0744f0ebfe4fde76a76ec17adaaf", "score": "0.0", "text": "def show\n realtime_page_next_by_time Integer(params[:post_id]), Integer(params[:after]), Integer(params[:limit])\n end", "title": "" } ]
[ { "docid": "ee3f8e984b4b4d8ff88ac798a9d549ad", "score": "0.74009085", "text": "def show\n @page = params[:page] || \"1\"\n @comments = Comment.includes(:user).where(post_id: @post.id).paginate(page: @page, per_page: @comment_per_page)\n end", "title": "" }, { "docid": "b73f64857ac8da6...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a1e82b92c22134add90ee473ab7e7cd4", "score": "0.0", "text": "def request_log_params\n params.require(:request_log).permit(:url)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7493595", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6954758", "text": "def strong_params\n params.require(:request).permit(param_white...
7fbf701baaca625147c2102591eebc59
POST /problem_severities POST /problem_severities.xml
[ { "docid": "b0d7f8d81c52e53e8b7bc5de90b02b7f", "score": "0.58888125", "text": "def create\n @problem_severity = ProblemSeverity.new(params[:problem_severity])\n\n respond_to do |format|\n if @problem_severity.save\n format.html { redirect_to(@problem_severity, :notice => t(\"screens.no...
[ { "docid": "fe40b14984ca4ba65cd907c0eb33bdde", "score": "0.6065956", "text": "def create\n @solution = Solution.new(solution_params)\n\n if @solution.worked == 1\n @problem = Unsolved.find(@solution.topic_id)\n @problem.update_attribute('status',1)\n end\n respond_to do |format|\n ...
dd4c90fe52c2853a926eb91203d82b04
GET /acts or /acts.json
[ { "docid": "047281f8efe207d21d69dea398c68340", "score": "0.0", "text": "def index\n @acts = Act.where(book_id: @book).order(:name)\n respond_to do |format|\n format.turbo_stream { render \"shared/index\", locals: { object: Act.new, objects: @acts } }\n end\n end", "title": "" } ]
[ { "docid": "9ad0a00c54ba6d8467cb79e5ca718fd0", "score": "0.6400734", "text": "def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program ...
0013ad67b7c0676e049938df61051e46
GET /anniversaries/1 GET /anniversaries/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0e0e1d2d3e6faead2402d3a8bcf5e24c", "score": "0.723777", "text": "def index\n @anniversaries = Anniversary.all\n end", "title": "" }, { "docid": "ede692ebfbddcc47ef01c012a498b600", "score": "0.6672377", "text": "def set_anniversary\n @anniversary = Anniversary.fin...
013fdca5f807880dbcc2a7a939bc95b6
Release 1: Calculate Fibonacci Numbers
[ { "docid": "40f09d92f0eef8aa3378aa6800a89439", "score": "0.0", "text": "def fib(num)\n fib_arr = [0,1]\n # last_num = fib_arr[-1]\n # second_to_last = fib_arr[-2]\n # next_num = last_num + second_to_last\n (num - 2).times { fib_arr.push(fib_arr[-1] + fib_arr[-2]) }\n\n p fib_arr.last\n...
[ { "docid": "a4b915caa1ecad6fcaf5aca05582e520", "score": "0.8126428", "text": "def fibonacci(num)\n\t\n total = 0\n even_numbers= [1,2]\n\t\n while total <= 4000000\n\t\n total = even_numbers[-2] + even_numbers[-1]\n even_numbers.push(total)\n\t\n end\n \n i = 0\n \n while i < even_numb...
a0b9aa4185b05aecc23bfc5ea3e14a8b
Catches exceptions thrown by block
[ { "docid": "430f59e086750782a89a0aeeb894d547", "score": "0.0", "text": "def catch(task=nil, &block)\n if task.nil?\n task = block\n end\n @mutex.synchronize do\n @tasks << task\n end\n begin\n result = block.call\n @mutex.synchronize do\n @results[task]=result\n...
[ { "docid": "31e27cadcdaf72d31aafa79a6bc38bf5", "score": "0.8211976", "text": "def catch(&block); end", "title": "" }, { "docid": "31e27cadcdaf72d31aafa79a6bc38bf5", "score": "0.8211976", "text": "def catch(&block); end", "title": "" }, { "docid": "8d626201739043924256ad04...
ad28037290cb3a6303568e02fa35a00b
end of delete_employee method
[ { "docid": "ada2a145e84214433f48ad5ca8f004f2", "score": "0.0", "text": "def update_employee\r\n\t\tputs \"============================== \"\r\n\t puts \"UPDATE EMPLOYEE INFORMATION\"\r\n\t puts \"============================== \"\r\n\t\tputs \"Enter The Employee id For Which You Want To Update Details...
[ { "docid": "cbb6b4bf8a92c210fde50127a2337303", "score": "0.77717626", "text": "def destroy\n if @employee.destroy\n redirect_to employees_url, notice: 'Сотрудник удален из базы.'\n end\n end", "title": "" }, { "docid": "1fb51ee3ea2402325662334d7000a01f", "score": "0.7743467",...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5db6f78ff73765b0077cdee81435061f", "score": "0.0", "text": "def set_taskmembership\n @taskmembership = Taskmembership.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
31d9ebc7d00fe0f99ed078e481add766
stolen from team roles, probably useful, so not deleted
[ { "docid": "13ae5ef85fc7560c9c243971a221ff2a", "score": "0.0", "text": "def touch_via_cache(time=self.updated_at)\n time = time.utc\n #self.user.league_roles_last_updated_at = time unless self.user.nil?\n #self.league.league_roles_last_updated_at = time unless self.league.nil?\n return true\...
[ { "docid": "720fa5370d0bbe5d4f9363f8396f1a78", "score": "0.694944", "text": "def role; end", "title": "" }, { "docid": "720fa5370d0bbe5d4f9363f8396f1a78", "score": "0.694944", "text": "def role; end", "title": "" }, { "docid": "b52d898f6cadb8141d08990eaf506924", "scor...
13ca79c84f0f963257fbe4d3643df028
Set a value on the Dash in a Hashlike way. Only works on preexisting properties.
[ { "docid": "59b5350123ef31e3c0e6e67e90a5bce1", "score": "0.0", "text": "def []=(property, value)\n assert_property_required! property, value\n assert_property_exists! property\n super(property, value)\n end", "title": "" } ]
[ { "docid": "e81e13207df0e3b04f8feca22194f6b2", "score": "0.6916987", "text": "def hash=(value)\n @children['hash'][:value] = value\n end", "title": "" }, { "docid": "078a486599df8e22e622a5fd04b916c0", "score": "0.6704294", "text": "def []=( key, value )\n ret...
041ed6118d414c955383f7c3add41463
In a lambda type, args are contravariant and the return type is covariant
[ { "docid": "975bb4385e951b0439ac1b6aafe0d183", "score": "0.51845455", "text": "def evaluate_subtype(other, type_bindings = nil, same_parameter_types = false)\n other.is_a?(Lambda) &&\n other.args.size == args.size &&\n return_type.subtype?(other.return_type, type_bindings, same_...
[ { "docid": "f0fdd88bc9e1023985ef2e54758f5627", "score": "0.56007266", "text": "def visit_lambda(node); end", "title": "" }, { "docid": "4bd14453e3d17f05c82ea380b9b4929f", "score": "0.5573602", "text": "def to_lambda(args)\n GrammarDerivation.to_lambda(args, self)\n end", ...
0c153a03b488a97e66de403e7072c2ae
string = "Hey guys, can anyone teach me how to be cool? I really want to be the best at everything, you know what I mean? Tweeting is super fun you guys!!!!" word_substituter(string)
[ { "docid": "1849e4ad3c4b35b0757426302cd960eb", "score": "0.66497535", "text": "def bulk_tweet_shortener(tweets)\ntweets.each_with_index do |sentence, i|\n puts word_substituter(sentence)\nend\nend", "title": "" } ]
[ { "docid": "dc7fb431c3a27d54c434679e67e7b778", "score": "0.8365431", "text": "def word_substituter(string)\n shorten(string)\nend", "title": "" }, { "docid": "fd6e4daa5faaca7a8a9325e86a985017", "score": "0.79731554", "text": "def word_substituter(string)\n shortened = []\n string....
ddc1059415dc871ee7d1dc4f6f935b53
build the corresponding partyuhtg
[ { "docid": "e62720a4e063488595b9af7d87eed14a", "score": "0.0", "text": "def build_report_area\n @report = Qt::TextEdit.new('')\n add_widget(@report)\n @report.read_only = true\n end", "title": "" } ]
[ { "docid": "2fd75d7b8ee3288d7040c1985158f88d", "score": "0.62203544", "text": "def build_gems; end", "title": "" }, { "docid": "791044d9558c34b0f2b17404edcf431d", "score": "0.60357153", "text": "def build_up\n end", "title": "" }, { "docid": "d79f297ba3bdcf1af117c56903...
ab7d901d304860eb34a6c70f8c3406a5
Here's the helper method we've been using in all the RESTful routes. It just packages up a summary of the table status; along with any optional error message. This is the basic JSON packet returned to Android as a response.
[ { "docid": "ef022adba08127496b02aa538b592562", "score": "0.0", "text": "def returnPacketHelper( toastMessageString = \"\" )\n # This next line is just a bit of defensive programming; something to return\n # if the database access (read only) happens to throw some weird, unanticipated\n # exception, o...
[ { "docid": "136414abce873f769cdb080039bbd33c", "score": "0.6337504", "text": "def all_status\n\t status = Status.all\n\t return render_json_response(status, :ok)\n end", "title": "" }, { "docid": "94e603c20089f9dc443532a53bf03f80", "score": "0.63160384", "text": "def response\n ...
12902a2e6490b5d4a7854d20b93656a6
POST /developers POST /developers.json
[ { "docid": "2e5ab4db5fb4f6d67fb27017e25b59ab", "score": "0.57769805", "text": "def create\n @developer = Developer.new(developer_params)\n @developer.created_by = current_user.id\n respond_to do |format|\n if @developer.save\n format.html { redirect_to @developer, notice: \"Застройщ...
[ { "docid": "f3c2e9c29fc55400b11a7bcf4970e56b", "score": "0.64782524", "text": "def developer_params\n params.require(:developer).permit(:name, :email, :url, :tags, :work_place, :code_name, :bio, :approval_status)\n end", "title": "" }, { "docid": "523b88e1882e0a011a7f619441437451",...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a9625a8e1ca2a380771c2c0f450af598", "score": "0.0", "text": "def set_task\n @task = Task.find(params[:task_id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...