query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
3a9e62083d51beb9058ce61141bd94ad
squared_numbers = [] array.each do |number| squared_numbers << number2 end return squared_numbers end
[ { "docid": "b7e1f516ba22cb9e0f971da142aba6a2", "score": "0.8598372", "text": "def square_array(array)\n squared_numbers = []\n array.each { |number| squared_numbers << number**2 }\n squared_numbers\nend", "title": "" } ]
[ { "docid": "6ddf6fc0200069e09a364ae9d6ac169b", "score": "0.86767524", "text": "def square_array(array)\n squared_numbers = []\n array.each do |num|\n squared_numbers << num ** 2\nend\n squared_numbers\nend", "title": "" }, { "docid": "e201fea99690b8fa0a274c9e556814ad", "score": "0....
2aac57e12dc4bd015b45c34621f8fe65
returns bulk insert statement
[ { "docid": "ae6f32b3a01881b8eae1e80d65f7bc66", "score": "0.0", "text": "def statement(records, column_names)\n column_names.map!(&:to_s)\n # if a primary key column wasn't specified, add it manually\n add_primary_key = column_names.exclude?(@primary_key_name)\n column_names <...
[ { "docid": "acf9d044c528372c0e637cb071770c00", "score": "0.78376913", "text": "def to_bulk_insert_script\n s = TRANSACTION_START[db_type].dup\n s << \"\\n\"\n insert_command = rows.first.bulk_insert_str\n\n rows.each_slice(500) do |sliced_rows|\n s << insert_command\n s << sliced_r...
2a7276ef29c914a294526dca99382278
Override rumx bean method
[ { "docid": "e45e81a3422b6c39ff8ae17cd41d0de6", "score": "0.0", "text": "def bean_attributes_changed\n super\n @manager.save_persist_state\n end", "title": "" } ]
[ { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.6126166", "text": "def override; end", "title": "" }, { "docid": "ac9ee4121a1546c6a7ad6b006e0fa06e", "score": "0.6124353", "text": "def apply\n\t\tsuper\n\tend", "title": "" }, { "docid": "1821da9f950c9bd854b78bb7...
18d649b10437e38a16dc14db1615dca3
Show all attributes for the configuration. The same options allowed by the +show+ method are also supported by this method.
[ { "docid": "ecd8b592c7eef6dd56a90cc2ff54bd17", "score": "0.7771665", "text": "def show_all( opts = {} )\n show_attribute(nil, opts)\n end", "title": "" } ]
[ { "docid": "643bef927170d96a3606e7ad6620f866", "score": "0.74064976", "text": "def show_attributes\n show_and_table_attributes\n end", "title": "" }, { "docid": "acab4cba4ec0d146d9ff3af6521bda72", "score": "0.70911217", "text": "def show_configurations\n SysConfig.read...
a12b19719fd5133a98a847cb9050e587
Downloads a file to disk from the configured Nexus server.
[ { "docid": "65cc46210b65bf4fe502c0c95f377c70", "score": "0.0", "text": "def retrieve_from_nexus(source, destination_dir)\n remote.pull_artifact(source, destination_dir)\n end", "title": "" } ]
[ { "docid": "6c30bff09919e878603b0dd48631264f", "score": "0.70988905", "text": "def fetch\n @file = download(@url)\n end", "title": "" }, { "docid": "11024054ab5a7d3926272d96eb6d316d", "score": "0.6795794", "text": "def download\n URI.open(download_url, \"rb\")\n ...
92817f7a94154d1a6debe0f425e3cf99
Shows the predictions of a user
[ { "docid": "0e7115abd79ce9d542ea66b21fa0baa1", "score": "0.67171544", "text": "def predictions\n fetch_matches\n @user_predictions = @user.user_locked_predictions_in_phase(@phase.id) if @phase\n end", "title": "" } ]
[ { "docid": "7346a1a8a222fbcc0a5d4e65269d2751", "score": "0.68991554", "text": "def show\n #render :json => current_user.predictions.first\n end", "title": "" }, { "docid": "6d8d034ccff7fe0a6c41b9cfaa5d1dcf", "score": "0.6820471", "text": "def show\n if not @user\n render ...
1aa50be6abe60a8e9ac21a5837a60f23
DELETE /carga_dentals/1 DELETE /carga_dentals/1.json
[ { "docid": "ead0e9cca3e45968a273e6ce749c31b3", "score": "0.73144794", "text": "def destroy\n @carga_dental.destroy\n respond_to do |format|\n format.html {redirect_to carga_dentals_url, notice: 'Carga dental eliminado correctamente.'}\n format.json {head :no_content}\n end\n end", ...
[ { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.70563453", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "e86ed56db2ca4991de1f41b08bb870d3", "score": "0.70458645", "text": "def dest...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "67a9ceb90bcbc85cdb70e6e11ee2f870", "score": "0.0", "text": "def set_product\n @product = Product.all.with_associations(:proxy, :category, :subcategories, :studies => [:country_origin, :country_consumption, :resource]).find(Product.from_param(params[:id]))\n end", "title": "" } ...
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6031952", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015048", "text": "def...
45d4fe41c5447dbc18067ee5a9c9a86d
Creates a project out of an STIG XCCDF
[ { "docid": "02cebfaaa031e8732694c34bac02bc22", "score": "0.67369527", "text": "def upload_project_stig_xccdf(file, current_user)\n xccdf = File.read(file.path)\n xccdf_tool = InspecTools::XCCDF.new(xccdf)\n project_json = xccdf_tool.to_inspec\n upload_project_inspec_json(project_json, curren...
[ { "docid": "68ee2dc472b23e86869b18b6a80b7e1c", "score": "0.6514097", "text": "def create_project prince, name, path=File.expand_path('')\n @doc = Document.new\n @doc << XMLDecl.new\n @doc.add_element \"Project\", {\"name\" => name, \"path\" => \"#{path}/#{name}.cproj\"}\n @doc.root.add_eleme...
a2e3b0d968e79eaf169685fe9630af4e
Picks next requested floor from current when moving up, and previous to current/next from current when moving down.
[ { "docid": "624f9d5624825393a5dd4f65ec97e7f1", "score": "0.71852005", "text": "def next_floor_in_current_direction\n current = elevator_state[:floor]\n if direction == 1\n # We can use bsearch because requests array is sorted.\n requests.bsearch { |x| x > current }\n elsif d...
[ { "docid": "41282d52294d1fe6fa87275df1ddd59d", "score": "0.69020456", "text": "def go_up\n\t\t@current_floor + (@current_floor += @input_floor) = floor", "title": "" }, { "docid": "d22a62c01fb6d801bee4ca05d9040b27", "score": "0.6829791", "text": "def go_down\n\t\t@current_floor - (@c...
0460bdc4ceb732a0d2be9c0f6d8c8c1b
PATCH/PUT /images/setdescription?description=...&auth_token=... PATCH/PUT /images/setdescription.json?description=...&auth_token=...
[ { "docid": "768f56e2d29c9ee1f1a6630356adab19", "score": "0.7655823", "text": "def setdescription\n @user = User.find_by_authentication_token(params[:auth_token])\n\n update_attrs = {description: params[:description]}\n @image = Image.where({user_id: @user.id, id: params[:id]}).first\n if (!@image.ni...
[ { "docid": "e1769896adf7c2813ad6f9c324328b72", "score": "0.69434536", "text": "def set_image_description\n @image_description = ImageDescription.find(params[:id])\n end", "title": "" }, { "docid": "de9c99341e06b5d151748d9d63bb9120", "score": "0.6889463", "text": "def update\n...
cf6759b08c754b561b93fe09ba7e23fd
POST /tvcabinets POST /tvcabinets.json
[ { "docid": "4a5096d9700d885f4a29172feedf39d7", "score": "0.72398597", "text": "def create\n @tvcabinet = Tvcabinet.new(tvcabinet_params)\n\n respond_to do |format|\n if @tvcabinet.save\n format.html { redirect_to @tvcabinet, notice: 'Tvcabinet was successfully created.' }\n form...
[ { "docid": "d22a74cc6e3c579f21ffb58ca09d3679", "score": "0.68947726", "text": "def index\n @tvcabinets = Tvcabinet.all\n end", "title": "" }, { "docid": "2836958b505195c41c74561aadf4f1c6", "score": "0.6461619", "text": "def set_tvcabinet\n @tvcabinet = Tvcabinet.find(params[...
36f3432fffb1a09e29274ac7a44d61ea
Internal: Calculates the typical fuel input of one plant of this type. Used for variable costs: fuel costs and CO2 emissions costs DEBT: move to another file when cleaning up Node API Returns the typical fuel input of one plant in MJ.
[ { "docid": "8565eeeed253dda12849ba5aa17b49ed", "score": "0.59576184", "text": "def typical_input\n fetch(:typical_input) { input_capacity * capacity_to_demand_multiplier * full_load_hours }\n end", "title": "" } ]
[ { "docid": "5885fb0f583ec1833d7a943c2a8f261f", "score": "0.64896256", "text": "def ore_to_fuel(filename)\n\n book = Formulas.new(filename)\n formula = book.rewrite(\"FUEL\").react.react\n puts \"###############\"*10\n puts formula\n puts \"###############\"*10\n puts\n\n stock = 1000000000000\n ...
c8deb64b2d19d11092e60a1557a08e82
This is the prompt where players type their commands. It displays the current room name and sends commands to the evaluate method
[ { "docid": "c19fe21a2cd57ffc47f5612651a7b42b", "score": "0.8243285", "text": "def prompt\n include Commands\n print \"[#{$current_room.name}]:>\"\n command = gets.chomp.downcase\n # split the command so we have seperate word and params\n command = command.split(' ')\n # grab the first word and def...
[ { "docid": "943bca575a4b10d7bae58d8f5ed32c1f", "score": "0.6689363", "text": "def player_prompt\n while true\n if !@player.alive\n puts @defeat_text\n @player.user_dies\n if !game_restart(:prompt)\n break\n end\n end\n if @player.location == @rooms[...
b43967cec1df54bf6c9273458e838db7
returns an array of writers
[ { "docid": "b76b21c866cff9d9b173c405d312a535", "score": "0.52829325", "text": "def writer\n\t\t#[\"Mike Judge\"]\n\t\telements = page_info_tags.select{|x| text_clean(x.search(\"h5\").text()) =~ %r(^writer)}\n\t\tif elements.first\n\t\t\telements.first.search(\"a\").select{|z| !z.inner_html.include?('(WG...
[ { "docid": "399aa6b1e5e493fab16622dd4e8113f0", "score": "0.77944547", "text": "def writers\n handle(@client.get(\"writers\")) { |result| result[\"writers\"] }\n end", "title": "" }, { "docid": "491625708c2c5d9d41300f2144a85260", "score": "0.73516303", "text": "def writers...
6474f3482e851f490eca3ddda56258d1
Validar que solo un administrador peuda acceder a ciertas vistas de recursos descargables.
[ { "docid": "73cd56504fbcd17a60b0663d55317587", "score": "0.63380814", "text": "def validate_category # :doc:\n if !current_user.is_admin?\n redirect_to root_path, alert: \"Sólo un administrador puede operar los recursos.\"\n end \n end", "title": "" } ]
[ { "docid": "2ed7ccfb489cb3ff1023d71b61840500", "score": "0.6160568", "text": "def assegure_uma_permanencia_de_admin\n if Usuario.count.zero?\n raise Error.new \"Não é permitido deletar o último usuário\"\n end\n end", "title": "" }, { "docid": "ac9a46ec7687cca6695551305e4...
5b1422366a829ec072b5a364f3e38e9c
both geo entity and taxon concept present
[ { "docid": "e40a7b762d871edca0f6c90bd284902e", "score": "0.0", "text": "def geo_entity_and_taxon_concept_rows_to_insert_sql\n sql = <<-SQL\n SELECT all_rows_in_table_name.* FROM (\n #{all_rows_sql}\n ) all_rows_in_table_name\n JOIN taxon_concepts ON splus_taxon_concept_id = taxo...
[ { "docid": "9884e2dd64f63a0bde1a82dfabb8ea74", "score": "0.6433942", "text": "def taxon\n\n end", "title": "" }, { "docid": "554d3367b2b472bb4f9836f5ff5d7c9f", "score": "0.6218457", "text": "def territory; end", "title": "" }, { "docid": "78e06f7a2207982e2111e709093591...
d22e07b5d89d6dad833cc2c362f810ac
Domain for accessing supercoreapi (i.e., api.fanforce.com) for current environment
[ { "docid": "de134b0b1258000fdf15e72855aeb063", "score": "0.6928145", "text": "def api_domain\n 'api.' + base_domain\n end", "title": "" } ]
[ { "docid": "7bb715f2e9a25931d87fcd5cc7affc2a", "score": "0.65242577", "text": "def coreApiEP\n\t\tCORE_API_URL_83\n\tend", "title": "" }, { "docid": "aa991888b13859727d5142443219babc", "score": "0.64781594", "text": "def application\n 'api.your-domain.com'\nend", "title": "" }...
e4825fedccaa976395284f739a162bb8
Scrape the definition of a tag, and the link to the tag's page
[ { "docid": "356576d15c97eaba62bc460d32183267", "score": "0.63154995", "text": "def tag_item li, tagtype=nil\n entity_link = li.search('a').first\n scrape entity_link if recur\n tagname = entity_link.text.strip\n if tagtype\n # Dishes and ingredients are downcased\n tagname = tagnam...
[ { "docid": "723bbd9141385bb95753b0b0fddcabfb", "score": "0.690678", "text": "def scrape_tag_link tag\n links = @data.css(tag)\n if @data.css('a/@href').count > 0 && links != nil\n links.each do |i|\n puts links.css('a/@href')\n end\n else\n puts 'no ' + tag +...
fe4dace8061adba7756974fea5ca6d1b
Verifies that the end date matches test data
[ { "docid": "c40f7bb19487bf2e1388d7ed9d8037df", "score": "0.84818196", "text": "def verify_end_date(test_data)\n verify_values_match(test_data[UseOfCollections::END_DATE.name], element_value(end_date_input))\n end", "title": "" } ]
[ { "docid": "fce6393af6077680e9629c63ee529b1d", "score": "0.8507463", "text": "def verify_end_date(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::END_DATE.name], element_value(end_date_input))\n end", "title": "" }, { "docid": "2ac21862405fc32baf3539ffa13883d2", ...
d3e4063b5627b9d628363aeab6330024
GET /aid_offers/1 GET /aid_offers/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1f457d94fb40ca893044e28195a3d80a", "score": "0.75254464", "text": "def index\n @aid_offers = AidOffer.all\n end", "title": "" }, { "docid": "6fbebc207c48b2392c7c3a51f167c271", "score": "0.7372754", "text": "def index\n @offers = Offer.all\n\n render json: @offer...
36d3d7af03fa87186b08d8a5837e34e5
We assume that each gram of carb is equal to 4 kcal
[ { "docid": "7493f2d8f9f496c78b431f491d7fbef4", "score": "0.61242193", "text": "def get_energia_carbs\n\t\t\t\t@carbs * 4\n\t\t\tend", "title": "" } ]
[ { "docid": "27786f1396a514bb6aba9fedf2278e95", "score": "0.69891775", "text": "def grams\n gram_equivalent / amount\n end", "title": "" }, { "docid": "4bea3f7a258bd3ae5e32a702f0b2ebb6", "score": "0.67355853", "text": "def kcalglucidos\n\t\t\t@carbohidratos * 4\n\t\tend", "tit...
db13572e33b1b6ef634da02a4831a8c7
Specifies if this is a html document node
[ { "docid": "9def7d7ef613b1ecd975b18ccc8da9fa", "score": "0.7886674", "text": "def html_doc?\n node_type == HTML_DOCUMENT_NODE\n end", "title": "" } ]
[ { "docid": "6f84904a81c9f1c1bfa9b70977be6d0c", "score": "0.7738777", "text": "def html?\n type == HTML_DOCUMENT_NODE\n end", "title": "" }, { "docid": "ac7de4c625525e8aa2fc8d47c9404f34", "score": "0.7142115", "text": "def document?\n node_type == DOCUMENT_NODE\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "92fe66947f1c41fe16903a264d4f3a99", "score": "0.0", "text": "def set_colectort\n @colectort = Colectort.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...
5d26adc3ea1fd0d13272aefeabc49b2a
The number of days that automatic cluster snapshots are retained
[ { "docid": "702561b0386a0bc95f57979af277e476", "score": "0.79455274", "text": "def automated_snapshot_retention_period\n @cluster.automated_snapshot_retention_period\n end", "title": "" } ]
[ { "docid": "e79be8be2920a90458c9bffdd610aa92", "score": "0.7119997", "text": "def vol_retention_days\n vol_retention / 1.day.to_i\n end", "title": "" }, { "docid": "1d6ce5a0115f4f8a978daeae61eba396", "score": "0.67039794", "text": "def job_retention_days\n job_retention / DAY_...
e5a3584a0663cd176e6f6c9ce3e4d4c9
Define a function to overcome Capybara's inability to process some HTTP verbs
[ { "docid": "ddb2b0bf68d3543051b6503bc1d040d5", "score": "0.0", "text": "def put_path(somepath)\n current_driver = Capybara.current_driver\n Capybara.current_driver = :rack_test\n page.driver.submit :put, somepath\n Capybara.current_driver = current_driver\nend", "title": "" } ]
[ { "docid": "db470493186acd7fae2d40d5766dc3b4", "score": "0.63962895", "text": "def conditional_requests; end", "title": "" }, { "docid": "db470493186acd7fae2d40d5766dc3b4", "score": "0.63962895", "text": "def conditional_requests; end", "title": "" }, { "docid": "31b669db...
90ca32750ff9ec3645b4fc10a5f070ec
Algorithm and GUI notification calls Player resign a game player: instance of PlayerOnGame reason: :abandon or :disconnection
[ { "docid": "5adae9f224fe47b6ab798c7ae14338a7", "score": "0.70861775", "text": "def alg_player_resign(player, reason)\r\n return if super(player, reason)\r\n if @segno_state == :end\r\n return :not_allowed\r\n end\r\n @log.info \"alg_player_resign: giocatore perde la partita\"\r\n if ...
[ { "docid": "b6750ed34f1c1100ff31c59daf927c2e", "score": "0.73651063", "text": "def resign_status(game)\n user_session.current_user.id == game.player1_id ? Game::P1_FORFEIT : Game::P2_FORFEIT\n end", "title": "" }, { "docid": "ed939ab5978fff0bcc6d6999228577dd", "score": "0.72094995", ...
c37b4d6498ac2bb8c6306d16d1f6cdde
Helper method to build an op for batch call See
[ { "docid": "17d137118cd52dfe4c3b00680e860e20", "score": "0.54688764", "text": "def batch_op(method, mapped_external_entity, id, connec_entity_name)\n Maestrano::Connector::Rails::ConnectorLogger.log('info', @organization, \"Sending #{method.upcase} #{connec_entity_name}: #{mapped_external_entity} to ...
[ { "docid": "327d1c930374f26955b759741857d460", "score": "0.65564394", "text": "def build_request(ary)\n { batch: ary }\n end", "title": "" }, { "docid": "237a8e3c32f16564fe4e9ce823016442", "score": "0.6275783", "text": "def git_batch_generator__from git_operation\n [\n ...
e29f1e70043c39658b02a1c165d12e8a
please only call this inside hold block
[ { "docid": "fa0cd1a7d778c3dc38ad51dd96ce54dc", "score": "0.0", "text": "def trash_current!\n t = Thread.current\n conn = owned_resource(t)\n return unless conn\n\n @delete_proc.call conn if @delete_proc\n sync { @allocated.delete(t) }\n nil\n end", "title": "" } ]
[ { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.6939014", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "score": "0.6939014", "text": "def lock; end", "title": "" }, { "docid": "fb127afb655b22988cea794c54e71aff", "sc...
5b443f3b297b8f366a4a2606de9a1c3a
User avatar wrapper to serve Gravatar if an avatar is not uploaded
[ { "docid": "346fb02b4ed34b6b2f46775cb70ea6f0", "score": "0.7097569", "text": "def avatar_uri(user, options={})\n if user.avatar\n user.avatar.attachment.url(:thumb)\n else\n gravatar_uri(user.email, options)\n end\n end", "title": "" } ]
[ { "docid": "bc72f6b2cd969e4497d753b8250e381a", "score": "0.7864762", "text": "def render_profile_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.url, class: 'img-responsive img-rounded').html_safe\n else\n image_tag('fallback/default.gif', class: 'img-responsive img-rounded')....
78549bf00e434ef46d7b94d62d63c64e
POST /todos POST /todos.json
[ { "docid": "414c3f5134488b62f45e92a74dd83bd9", "score": "0.72165036", "text": "def create\n @todo = Todo.new(todo_params)\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to @todo, notice: 'Todo was successfully created.' }\n format.json { render :show, status...
[ { "docid": "38197400f519c568668059985d5c7af9", "score": "0.77191365", "text": "def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end", "title": "" }, { "docid": "1a161d591cd3dce6ba415b6023a0962c", "score": "0.7682156", "text": "def create\n @tod...
b42ae3d16fbbb467fee11a45d08ec18d
DELETE /labgroups/1 DELETE /labgroups/1.json
[ { "docid": "78732864ce183a3c74bc5ab6ca2e695a", "score": "0.782342", "text": "def destroy\n @labgroup.destroy\n respond_to do |format|\n format.html { redirect_to labgroups_url, notice: 'Labgroup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "titl...
[ { "docid": "a750bc07fec48f71041fd47e304de4bd", "score": "0.77217954", "text": "def destroy\n @lab_group = LabGroup.find(params[:id])\n @lab_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(lab_groups_url) }\n format.xml { head :ok }\n end\n end", "title": ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "583dbdd70e4a7e5069d1138e2b0fde2d", "score": "0.0", "text": "def wallet_params\n params.require(:wallet).permit(:btc_balance, :inr_balance,:user_id)\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...
d2f057fdd5753610dd03bb7f8bf50779
Return true if the difference between two colors matches the W3C recommendations for readability See
[ { "docid": "a8123139530db04862edf5da839daf7a", "score": "0.85845613", "text": "def colors_diff_ok?(color_1, color_2)\n cont, bright = find_color_diff color_1, color_2\n (cont > 500) && (bright > 125) # Acceptable diff according to w3c\n end", "title": "" } ]
[ { "docid": "de0630f53c97382daea42e6371c850b8", "score": "0.7659483", "text": "def colors_close_enough( c1, c2 )\n r1 = c1[ 1..2 ]\n r2 = c2[ 1..2 ]\n g1 = c1[ 3..4 ]\n g2 = c2[ 3..4 ]\n b1 = c1[ 5..6 ]\n b2 = c2[ 5..6 ]\n\n diff = ( r1.to_i - r2.to_i ).abs + ( g1.to_i - g2.to_i ).ab...
20153107b711389021d3e1971de6e050
if state == :error
[ { "docid": "53e981a1a26490501597bacf22b9c8cc", "score": "0.0", "text": "def initialize(&block)\n super(state: :waiting, result: nil, error: nil)\n block.call.to_promise.then do |result|\n mutate!(state: :success, result: result)\n end.error do |error|\n mutate!(state: :error...
[ { "docid": "35e656d4fad77dd50d33bcadb33322d8", "score": "0.79904836", "text": "def failed?; state == 'failed'; end", "title": "" }, { "docid": "35e656d4fad77dd50d33bcadb33322d8", "score": "0.79904836", "text": "def failed?; state == 'failed'; end", "title": "" }, { "docid...
89bf428b3c339d45fcd3b4f00682cb44
Test 4: Populated group, empty title, empty date, empty time, populated location, populated description
[ { "docid": "53f7d6ee2b5ecc3af84a9031c61be99b", "score": "0.5219015", "text": "def test04_EmptyTDTiPopGLDe\n\t\t\tlogin $user_1_email, $master_password\n\t\t\t$browser.goto($patch_event)\n\t\t\tsleep 2\n\t\t\t\n\t\t\tassert $post_pick_group.exists?\n \t\t\trepostGroupPop\n \t\t\t$post_event_location.set(...
[ { "docid": "3b9758d072df4e89c89810252e27808b", "score": "0.62513524", "text": "def test_01_empty_on_empty_group\n\t\tprintTestHeader \"Test #empty on already-empty JointGroup\"\n\t\tassert_nothing_raised {\n\t\t\t@group.empty\n\t\t}\n\tend", "title": "" }, { "docid": "b0bfcdf3005716fabf28dfa...
c9bbc58acb6eb23429826320ac9dca67
initializes with a date and a doctor adds an Appointment has many doctors through appointments
[ { "docid": "b51be8fbcfc614ce1494c002addc9fb0", "score": "0.8379373", "text": "def initialize(date, doctor)\n @date = date\n @doctor = doctor\n doctor.add_appointment(self)\n end", "title": "" } ]
[ { "docid": "da86ccaf42b61504a042e0ef330d1c6d", "score": "0.8678659", "text": "def initialize(date, doctor)\n @date = date\n @doctor = doctor\n doctor.appointments << self\n end", "title": "" }, { "docid": "9d19ba01c5538c82256242edab87a3e8", "score": "0.8396922", "text": "de...
4304f6253ddbbd78fc707daf9e42ed9f
adds a target to an existing target collection
[ { "docid": "bc59edcb2e69eb727efd8f71f3c8ac5b", "score": "0.62271214", "text": "def addTarget(tcId, target)\n path = @@PATH_ADD_TARGET.dup\n path[@@PLACEHOLDER_TC_ID] = tcId\n return sendHttpRequest(target, \"POST\", path)\n end", "title": "" } ]
[ { "docid": "714c8a7c808bac8eecdbdf9d13a1c394", "score": "0.6912853", "text": "def addTarget(target, result, usableItems)\n t = self[target]\n if t.nil?\n t = Target.new(target.to_s)\n (@targets ||= []) << t\n @targets.sort!\n end\n t.addResult(result, usableItems...
03f17f49bf96437441f0e16b753464ec
Overrides: Helps to keep the templates simple by using inspect on the options.
[ { "docid": "ea8a9b48c6948187ffa238d386324498", "score": "0.0", "text": "def compose_message(type, options)\n super type, options.transform_values { |value|\n value.is_a?(Array) ? value.map(&:inspect).join(', ') : value.inspect\n }\n end", "title": "" } ]
[ { "docid": "427d827ed562ffde44f0eebc4b43ab2c", "score": "0.66070247", "text": "def _render_template(options); end", "title": "" }, { "docid": "cb1a6b31c0ae08df0bfec61a1ac1929e", "score": "0.643061", "text": "def render options\n render_template(options[:template])\nend", "title"...
e882e947008626507dfbf50a6019b2be
Returns the value of attribute supported_options. source://bootsnap//lib/bootsnap/compile_cache/yaml.rb19
[ { "docid": "e9590c5afc98dd97148e84048c9ec06c", "score": "0.67465574", "text": "def supported_options; end", "title": "" } ]
[ { "docid": "edccedc0105bab06f85adf1b968474d3", "score": "0.67075616", "text": "def supported\n attributes.fetch(:supported)\n end", "title": "" }, { "docid": "17eda51e1c920483aac6155303826995", "score": "0.665461", "text": "def supports_options?\n return true\...
d09b918bfb8a3d9658b84c3c1ae25a18
DELETE /menus/1 DELETE /menus/1.json
[ { "docid": "ffac79adc2a1e87b39e77cfd9cf89178", "score": "0.7365948", "text": "def destroy\n @admin_menu.destroy\n respond_to do |format|\n format.html { redirect_to admin_menus_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "1f535c7ab40ec4fde40bc1948c49af8a", "score": "0.7708654", "text": "def delete_menu()\n res = get(\"menu/delete\")\n return MultiJson.load(res.body)\n end", "title": "" }, { "docid": "e95ed7f830e8ce570b17b4e72ec84931", "score": "0.759346", "text": "def destroy\...
356dc0fe632c81aba2f5a74ad145c906
Datacenters For internal use. Must be called with cache lock held Returns with the cache lock held must be unlocked by caller.
[ { "docid": "59d5697c770707002a78501ca13dda5d", "score": "0.76910335", "text": "def datacenters_locked\n raise \"datacenters_locked: cache lock not held\" unless @cacheLock.sync_locked?\n return(@datacenters) if @datacenters\n\n logger.info \"MiqVimInventory.datacenters_locked: loading Datacente...
[ { "docid": "3f59797f021021d842868f7fd3d2efab", "score": "0.75163496", "text": "def datacenters\n self['datacenters'].collect{ |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data['name'])}\n end", "title": "" }, { "docid": "9a640f28d9cf7c0c0dd97986cd2547d9", "...
e138dd9c3fc7634c259a9a93838aa058
Within the form's block you can get good buttons with: You can have save, cancel, edit and delete buttons. Each one takes an optional label. For example: 'Update' %> See the documentation for the +button+ method for the options you can use. You could call the button method directly, e.g. , but then your button would no...
[ { "docid": "37bfed243ba913ffa73f2700500bb5ee", "score": "0.6344417", "text": "def buttons(&block)\n concat '<div class=\"buttons\">', block.binding\n yield self\n concat '</div>', block.binding\n end", "title": "" } ]
[ { "docid": "c9b029e31fce0d4cc9917cbc28e35965", "score": "0.7253325", "text": "def commit_button(*args)\n options = args.extract_options!\n text = options.delete(:label) || args.shift\n\n if @object && (@object.respond_to?(:persisted?) || @object.respond_to?(:new_record?))\n ...
21f0b0db1147ac70d1d8bd676c4ff5df
initializes attributes of each instance of a planet
[ { "docid": "8c6f3a169ce8b3244534bc035858d12e", "score": "0.7127703", "text": "def initialize(planet_hash)\n @name = planet_hash[:name]\n @moons = planet_hash[:moons]\n @orbit = planet_hash[:orbit]\n @distance_from_sun = planet_hash[:distance_from_sun]\n end", "title": "" } ]
[ { "docid": "ed50d4336ce3c90f553014b6b1004c9a", "score": "0.7829746", "text": "def initialize(planet_info)\n planet_info.each do |category, attributes|\n @planet_name = planet_info[:planet_name]\n @year_length = planet_info[:year_length]\n @distance_from_the_sun = planet_info[:distance_fr...
5d1d090fb19fdfefee95a43698c6fcf5
Generates an array of elements, where each of the elements is generated by `element_generator`. Shrinks to shorter arrays (with shrunken elements). >> Generators.array(Generators.positive_integer).sample(5, size: 10, rng: Random.new(42)) => [[10, 5, 1, 4], [5, 9, 1, 1, 11, 8, 4, 9, 11, 10], [6], [11, 11, 2, 2, 7, 2, 6,...
[ { "docid": "94efac2e1cc6361d4f8f5aa61929a267", "score": "0.7024096", "text": "def array(element_generator)\n nonnegative_integer.bind do |generator|\n generators = (0...generator).map do\n element_generator.clone\n end\n\n tuple(*generators)\n end\n end", "...
[ { "docid": "7a99c05f2fbc0fad86a1264575a14ff8", "score": "0.6515611", "text": "def random_element(array)\n array.sample\nend", "title": "" }, { "docid": "03a76bd16ef4951ae31870ce388fda9b", "score": "0.63157886", "text": "def rand_array(size)\n # New array of size elements\n numbers ...
617f6ee538a1bb99e883d74e456846bb
it calls two instance methods from within the VirusPredictor class.
[ { "docid": "64f88476a66d3ef81ce462a3ab90a0c0", "score": "0.5356754", "text": "def virus_effects\r\n predicted_deaths #(@population_density, @population, @state)\r\n speed_of_spread #(@population_density, @state)\r\n end", "title": "" } ]
[ { "docid": "8d98784726e5f1931eb31fb826fe0529", "score": "0.6425551", "text": "def virus_effects #HINT: What is the SCOPE of instance variables? Instance variables are available to all methods of the instance. There is no need to pass the instance variables into the instance methods.\n\n predicted_...
1e31ef43032fd3a84ce5f1bb7a94738e
This is the method that formats the data output.
[ { "docid": "ac22edc24b044c749139e8994e62cd01", "score": "0.0", "text": "def encrypt(record)\n begin\n # encrypt JSON format record\n jwe = JSON::JWE.new(record.to_json)\n # choose block cipher algorithm\n jwe.enc = @block_cipher_alg.to_sym\n # choose cipher algori...
[ { "docid": "cd1ae0442b1595d57063aa3a6ebe8a50", "score": "0.70624423", "text": "def format_data(formatting)\n\t\treq_length = (@data.max { |a, b| a.length <=> b.length }).length\n\t\t\n\t\tfor i in (0...@data.length)\n\t\t\tlength_diff = req_length - @data[i].length\n\t\t\t\n\t\t\tnext if length_diff == ...
4961c9dedc5be2b6d83e5990ab1e96bf
select all entity columns which list_rank value greater than 0
[ { "docid": "bee254aed8ce6ac49388c4925ec06737", "score": "0.7707936", "text": "def list_columns\n self.entity_columns.where(\"list_rank > 0\").order(\"list_rank asc\")\n end", "title": "" } ]
[ { "docid": "187606b989bbb3b2b7c7596032e5dff6", "score": "0.5570733", "text": "def export_columns\n self.entity_columns.select(\"name, description, ref_type, ref_name, col_type\").where(\"list_rank > 0 and name not in ('domain_id', 'creator_id', 'updater_id', 'created_at', 'updated_at')\").order(\"lis...
d9dd57a180b6e52e25a67e35f29ef0b3
POST /player_answers POST /player_answers.xml
[ { "docid": "6a7d564795ede8792bd22bd200654f3d", "score": "0.58397186", "text": "def create\n\n\t@player_answers = params[:player_answers].values.collect { |player_answer| PlayerAnswer.new(player_answer) }\n\n\n\n\t@sum=0\n\ts=\"check_box_\"\n\tfor i in 1..25\n\t s=s+i.to_s\n\t if(!params[s.to_sym].nil?...
[ { "docid": "f933bd3e726a98b2dee64c14b556e2c1", "score": "0.6378107", "text": "def player_answer_params\n puts \">>>\"\n puts params\n puts \">>>\"\n params.require(:player_answer).permit(:survey_id, :question_id, :answer_number, :player_answer)\n end", "title": "" }, { ...
ac8b9b3cad68c396f98e254bda32ccc8
Returns the list of targets as an array of TargetHost instances, them to account for ranges embedded in the target name.
[ { "docid": "35f6022ed8be0bc703199efda2ec14e9", "score": "0.81459063", "text": "def targets\n return @targets unless @targets.nil?\n\n expanded_urls = []\n @split_targets.each do |target|\n expanded_urls = (expanded_urls | expand_targets(target))\n end\n @targets = expande...
[ { "docid": "57662dba3329f5e22886541fa6812db3", "score": "0.730129", "text": "def target_get_all()\n\t\t\tbegin\n\t\t\t\tstatus, status_text, resp = omp_request_xml(\"<get_targets/>\")\n\n\t\t\t\tlist = Array.new\n\t\t\t\tresp.elements.each('//get_targets_response/target') do |target|\n\t\t\t\t\ttd = Has...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "46791145b743e9c50e42701149905393", "score": "0.0", "text": "def admin_table_params\n params.require(:admin_table).permit(:name, :lastmodified)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74964964", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957765", "text": "def strong_params\n params.require(:request).permit(param_whit...
9cbd96d28a3e51779831e2a60dd449d5
sends each token value to it's respective attribute
[ { "docid": "421699dc1f358da1db8f0702184fd2bf", "score": "0.0", "text": "def initialize(topts = {})\n topts.each { |key, val| send \"#{key}=\", val }\n end", "title": "" } ]
[ { "docid": "e49ae5fbaf7e66b8c10a29da9f84e2f4", "score": "0.67846173", "text": "def token=(t)\n\t\twrite_attribute(:token, t)\n\tend", "title": "" }, { "docid": "dbae3ce531821d20a512557616c14049", "score": "0.6632719", "text": "def emit(token)\n self.attr_state.attr_token = token...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "02f290376b61598340c4750940a90d85", "score": "0.0", "text": "def set_add_car\n @add_car = AddCar.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...
dd8b7a861797732212cc26b8bdcb38e7
i/p: 2, 1, 3, 5, 6 o/p: 4
[ { "docid": "cde925159610fb75713ddd6b55318e55", "score": "0.0", "text": "def missing_element(array)\n\n loop do \n swaped = false\n\n (array.length - 1).times do |i|\n if array[i] > array[i+1]\n array[i], array[i+1] = array[i+1], array[i]\n end\n ...
[ { "docid": "6997d8f85cd7b381b73d42b081431245", "score": "0.61984724", "text": "def sequential?; @before.values.map(&:count).uniq.count == count end", "title": "" }, { "docid": "c1c0c0c33195e59c8b9840c4cefa573d", "score": "0.5848027", "text": "def last_ids(number); end", "t...
26027fd2731e28e772785bc0ae774e79
Prints the list of all events.
[ { "docid": "0ed5f10cae6ff162335e796cf715f495", "score": "0.78548115", "text": "def listOfEvents\r\n puts (@BetESS.fDisplayEvents)\r\n end", "title": "" } ]
[ { "docid": "329997d47f5760388298169abc9be1bd", "score": "0.8257416", "text": "def print_events(events)\n events.each do |name, description|\n puts \"Event: #{name}\"\n puts \"Description: #{description} \\n\\n\"\n end\n end", "title": "" }, { "docid": "fe1cc221c150034469d3a4...
6af621cb24bd4e3a608d0fa21ba56572
Complexity is O(1), if a Set is used as adjacency list. Otherwise, complexity is O(out_degree(v)).
[ { "docid": "dc497fe0c12bb254153aea75f5c5c459", "score": "0.0", "text": "def has_edge?(u, v)\n has_vertex?(u) && @vertices_dict[u].include?(v)\n end", "title": "" } ]
[ { "docid": "1d3d57e29124db6c07f02eea0de3d7d2", "score": "0.70356905", "text": "def out_degree(v)\n @adjacencies[v].size\n end", "title": "" }, { "docid": "e0a430ed696434ea70a4ff04533bcd38", "score": "0.64024746", "text": "def out_degree(v) adjacent(v, :direction => :out).size; en...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "17b6970321d1f441a24bc79a63a8cecf", "score": "0.0", "text": "def set_photo\n @photo = Photo.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...
d79d73433042bdb619392c47c705d5c5
Server bind to port 2000
[ { "docid": "4a1c12979982bb0ffe8296dff643d9f0", "score": "0.0", "text": "def parse_method_path_params(client)\n line = client.gets\n method, path_and_params, _ = line.split\n path, params = path_and_params.split(\"?\")\n [method, path, params]\nend", "title": "" } ]
[ { "docid": "f740860e39f443cb38f75f3b5bb597a1", "score": "0.74738413", "text": "def start_server!; @server = TCPServer.open($port) end", "title": "" }, { "docid": "a8bb232e609170307bdc540395c7251a", "score": "0.72343135", "text": "def server(port = 9319)\r\n puts \"- Starting server ...
f8674a136783481217da32cf73da7d44
DELETE /containers/1 DELETE /containers/1.json
[ { "docid": "cd76fbbe2d5cf4eaf7dc87ddc1c73c13", "score": "0.77145255", "text": "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url }\n format.json { head :ok }\n end\n end",...
[ { "docid": "1288a23e10add80a6094da03fb46f8b3", "score": "0.7896052", "text": "def destroy\n @container.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "41bb80e7b6d3846daf6eda6c87dc462f", "score": "0.7823363", ...
884bf3502b506f8a6c283540fda4fbc6
Converts the raw plist test structure into something that's easier to enumerate
[ { "docid": "a0e693371335a330d80b03402af8a52c", "score": "0.5060342", "text": "def unfold_tests(data)\n # `data` looks like this\n # => [{\"Subtests\"=>\n # [{\"Subtests\"=>\n # [{\"Subtests\"=>\n # [{\"Duration\"=>0.4,\n # \"TestIdentifier\"=>\"Unit/tes...
[ { "docid": "3d792e5591604ab26737c1e519f9c22a", "score": "0.60980004", "text": "def general_test\n Plist4r.new\n\n Plist4r::Config[:raise_any_failure] = true\n # Plist4r::Config[:backends].replace [\"haml\",\"libxml4r\",\"ruby_cocoa\"]\n # Plist4r::Config[:backends].replace [\"osx_plist\"]\n Plist4r...
49757c3faaa74049f46309e89276b079
POST /uploads POST /uploads.json
[ { "docid": "818971bfb5dc346560bdd90b5a4e31f3", "score": "0.0", "text": "def create\n @upload = Upload.new(params[:upload])\n\n @position = if Upload.all(:select => :position).collect(&:position).max\n Upload.all(:select => :position).collect(&:position).max\n else\n 0\n end\n\n ...
[ { "docid": "457f589782dd14d0823d6e5557b2563d", "score": "0.730404", "text": "def upload_image_file(args = {}) \n post(\"/files.json/captiveportal/images\", args)\nend", "title": "" }, { "docid": "dd38ec2b448fc01e27a276005273287f", "score": "0.7131191", "text": "def upload_floor_plan(...
fd5ef0570dca850fe7ab8ee66d8d01de
after_filters can be defined in the same way
[ { "docid": "b5bd445fffc1b334e46be5b465010b0a", "score": "0.5795558", "text": "def after( controller )\n\n end", "title": "" } ]
[ { "docid": "cfa95811c46b45b090c05e6e210d4eca", "score": "0.8381047", "text": "def after_filter; end", "title": "" }, { "docid": "ceb4a60af8c8722a05f8c9489b69da27", "score": "0.7756484", "text": "def after_filter(&block)\n @after_filter = block\n end", "title": "" },...
365edb54803364fd4a462f71de3f4ca8
Use configured facet partial name for facet or fallback on 'catalog/facet_limit'
[ { "docid": "7de4a844ba7bf7073991ac8f42f3115f", "score": "0.81394887", "text": "def advanced_search_facet_partial_name(display_facet)\n facet_configuration_for_field(display_facet.name).try(:partial) || \"catalog/facet_limit\"\n end", "title": "" } ]
[ { "docid": "1250ed398446d61358f2395eb778c9a7", "score": "0.82973593", "text": "def facet_partial_name(facet = nil)\n cfg = facet_configuration_for_field(facet.name)\n cfg&.partial || (cfg&.pivot ? 'facet_pivot' : 'facet_limit')\n end", "title": "" }, { "docid": "1f6b3f665b38e3d4e8424b...
a0d4268ce22a45f58a8f266d0f48d865
Create or replace a custom column
[ { "docid": "89397163d2d4c0c1bb0e0b76cd67c7f8", "score": "0.0", "text": "def importation_save_custom_column_with_http_info(store_id, execution_id, column_id, request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ImportationCatalogInfoApi.import...
[ { "docid": "e7c3d49038719df5efcd8bbe33eecc4c", "score": "0.7330862", "text": "def add_column\n self.name = generate_column_name if name.blank?\n connection.add_column(table_name, name, column_type, column_options)\n klass.reset_column_information\n klass.serialize_custom_fields!\n end", ...
d3d0727e18d5732467e13ff104cc004f
removes vertical tabs from string
[ { "docid": "8b21622b348b6a4bfdc5dbb3cb5895fe", "score": "0.55601037", "text": "def remove_crap(myString)\n\treturn myString.gsub(/\\v/, '/')\nend", "title": "" } ]
[ { "docid": "999b073a528600598359991887f7f0a3", "score": "0.78019756", "text": "def detab( str, tabwidth=TabWidth )\n\t\t\tre = str.split( /\\n/ ).collect {|line|\n\t\t\t\tline.gsub( /(.*?)\\t/ ) do\n\t\t\t\t\t$1 + ' ' * (tabwidth - $1.length % tabwidth)\n\t\t\t\tend\n\t\t\t}.join(\"\\n\")\n\n\t\t\tre\n\...
d344720700db8158ce7439b47d70bfd0
block is passed in reduce to use inject method
[ { "docid": "22884f811ae29bd183a630ba7537fbd8", "score": "0.8191302", "text": "def my_inject(&block)\n reduce(&block)\n end", "title": "" } ]
[ { "docid": "aeeb59e6733409fd5e350a890151db4e", "score": "0.7189839", "text": "def _reduce_18(val, _values, result)\n result = self.block_append val[0], val[2]\n \n result\nend", "title": "" }, { "docid": "aeeb59e6733409fd5e350a890151db4e", "scor...
7bf1910386d61e00cd19bf45ad4dfaff
Initialize the instance vars
[ { "docid": "d4a82d715def0b9461cf5a0f4156dd6e", "score": "0.0", "text": "def initialize\n @regions = nil\n @kommuns = nil\n @business_categories = nil\n @address_factory = AddressFactory.new(regions, kommuns)\n end", "title": "" } ]
[ { "docid": "70bf8cb295fdc2050998983b54d334dd", "score": "0.83459467", "text": "def init\n end", "title": "" }, { "docid": "73d8fd895a75b55a07597cbfe0ea1c7c", "score": "0.8279069", "text": "def init\n \n end", "title": "" }, { "docid": "73d8fd895a75b55a075...
d5907a53b080298ccfd0d672f2eb2774
Public Methods callseq: Kconv.kconv(str, out_code, in_code = Kconv::AUTO) Convert str to out_code. out_code and in_code are given as constants of Kconv. Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want to decode them, use NKF.nkf.
[ { "docid": "a1db015dfb7cb06c3737832e782d1540", "score": "0.81049734", "text": "def kconv(str, out_code, in_code = AUTO)\n opt = '-'\n case in_code\n when ::NKF::JIS\n opt << 'J'\n when ::NKF::EUC\n opt << 'E'\n when ::NKF::SJIS\n opt << 'S'\n when ::NKF::UTF8\n opt ...
[ { "docid": "e09b8ecc47abd87dd072f774693ecb27", "score": "0.6672627", "text": "def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend", "title": "" }, { "docid": "a43b880dc1be4b6da96776d3e91873...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8eede7d2c1b1116a5caaf95e4a0ac15d", "score": "0.0", "text": "def visitor_params\n params.require(:visitor).permit(:user_id, :user_name, :user_code, \n :station_id, \n :station_name, :merchant, :ip, \n ...
[ { "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...
1005b9fd9b83e3b333f1dfa172280994
private by default methods have public scope
[ { "docid": "fccaed8d3333ccfca1dd78d752a921e1", "score": "0.0", "text": "def return_counter\n @@counter # return keyword is optional....last result will be returned\n end", "title": "" } ]
[ { "docid": "d129cc756661d2db1b6e7ead9a68728c", "score": "0.81486833", "text": "def in_private; end", "title": "" }, { "docid": "bf55bc7eaf18d56cb23fc1d7b4ba7bed", "score": "0.80894893", "text": "def public; end", "title": "" }, { "docid": "6a6ed5368f43a25fb9264e65117fa7d1...
08bed2abacea7298b8f132573e69f469
Sets the passcodeMinimumCharacterSetCount property value. The number of character sets required in the password.
[ { "docid": "23a24ddffe76c2eb81b0b67600e815f4", "score": "0.842087", "text": "def passcode_minimum_character_set_count=(value)\n @passcode_minimum_character_set_count = value\n end", "title": "" } ]
[ { "docid": "2cd63a42089a714c4ee65e793c185e03", "score": "0.82646304", "text": "def password_minimum_character_set_count=(value)\n @password_minimum_character_set_count = value\n end", "title": "" }, { "docid": "2cd63a42089a714c4ee65e793c185e03", "score": "0.8264...
4bd50f8c450a925ee801814e539fdc4d
This method is meant to return a runtime component instance
[ { "docid": "bb02c094569f996490b35c2d58cf19be", "score": "0.0", "text": "def build(**)\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "467c6c1d3bad8e61d84afcff9267848a", "score": "0.8132674", "text": "def component_instance\n return component.new(component_options)\n end", "title": "" }, { "docid": "65f764e4870bd4703396be0177f860de", "score": "0.7118843", "text": "def _component\n raise ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7c05e5e70e2044dab006da7b3684a157", "score": "0.0", "text": "def player_params\n params.require(:player).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" } ]
[ { "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...
fa1113519d3f75a28e011b2d80813a51
tests if the line string is closed
[ { "docid": "d02303e7f9e426985f1dcc82de91f21f", "score": "0.0", "text": "def closed?\n # a bit naive...\n @points.first == @points.last\n end", "title": "" } ]
[ { "docid": "c405909ff0ea38dfa9c870be4098adb1", "score": "0.7201484", "text": "def end_of_line?\n @data[@position] == ?\\n if @position >= @data.length\n end", "title": "" }, { "docid": "a4b5a9a93fe97961874c21e6243c75e0", "score": "0.71363974", "text": "def has_closing_break?\n ...
b94b86a5d426a3d5c93419bc16b3dbf5
GET /systems/new GET /systems/new.json
[ { "docid": "c52e49b8483d1a60db89f3419a9b46f4", "score": "0.8028254", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @system }\n end\n end", "title": "" } ]
[ { "docid": "5825ebdb373d0c7b32ad5a6974f535ad", "score": "0.81231254", "text": "def new\n @system = System.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system }\n end\n end", "title": "" }, { "docid": "30758fe722aac5caadfe577...
d865dfd427ba422ec2c248bfc76b88c6
GET /administration/profiles/1 GET /administration/profiles/1.xml
[ { "docid": "5928826a0b76ae3360ac83886af7bfe1", "score": "0.71053696", "text": "def show\n @administration_profile = Administration::Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration_profile }\n end\n end"...
[ { "docid": "a6f53e408a2076f75db363f33215b44b", "score": "0.7024868", "text": "def profile\n get('/my/profile')\n end", "title": "" }, { "docid": "458b16634acf1757c22a212867e5e763", "score": "0.6909586", "text": "def profiles= profiles_xml\n params, headers = req('POS...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "655d491ff2a4f2f3492eba44b237c56f", "score": "0.0", "text": "def pa_request_params\n params.require(:pa_request).permit(:prescription_id, :form_id, :urgent, :state, :sent, :cmm_token, :cmm_link, :cmm_id, :cmm_workflow_status)\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...
19e529bbb6bacce6fd9fabf17131d7fe
DELETE /response_codes/1 DELETE /response_codes/1.json
[ { "docid": "f47e014e7c52b85a5b54f816298dc314", "score": "0.8056298", "text": "def destroy\n @response_code = ResponseCode.find(params[:id])\n @response_code.destroy\n\n respond_to do |format|\n format.html { redirect_to response_codes_url }\n format.json { head :no_content }\n end\...
[ { "docid": "47de0c8ac14703b52ecdbed9fd1d383d", "score": "0.7460088", "text": "def destroy\n @status_code.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "44f01025cd2e31f57947fe78a35a389d", "score": "0.7287846", "text": "def destroy\n @code.destroy\n respon...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "18793af727c752d66bd42c54901afbc9", "score": "0.0", "text": "def detail_invoice_params\n params.require(:detail_invoice).permit(:name_project, :quantity, :description, :value)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
81e1a7c9a1a0fa62b3f8110f5dbe624c
==== Description Set the read method. +val+ :: MUST be either :flock or :normal. :flock will set the file to be opened exclusively locked(LOCK_EX).
[ { "docid": "07a3f4245709635ec7680a64413d2437", "score": "0.7848456", "text": "def read_method=(val)\n @read_method = val if %w(:flock :normal).include?(val)\n end", "title": "" } ]
[ { "docid": "90e362be5ccf21fccad42741a75a55c0", "score": "0.6145627", "text": "def []=(key, value)\n with_lock(File::LOCK_EX) { super }\n end", "title": "" }, { "docid": "90e362be5ccf21fccad42741a75a55c0", "score": "0.6145627", "text": "def []=(key, value)\n with_lock(Fil...
2c7a2d20701adaec64f72fe58eac3194
xml adapter, allowing xml.get and xml.post methods
[ { "docid": "9569b8f36fcbe561c833fe3fed84f6d2", "score": "0.63766223", "text": "def xml\n return @adapters[:xml] if @adapters[:xml]\n require 'oauth_client/adapters/xml'\n @adapters[:xml] = OAuthClient::Adapters::Xml.new(self)\n end", "title": "" } ]
[ { "docid": "baacc66695a2e04f7909d2b07dfd1442", "score": "0.6709918", "text": "def xml; end", "title": "" }, { "docid": "950fb8b671b17ac05fb0d817540763e2", "score": "0.66817284", "text": "def api_xml(path,method=:get,options={})\n xml_message(amee,\"/data\"+path,method,options)\n ...
329dff264e5529528782e55c00ad2b63
def index respond_to do |format| format.html show.html.erb end end
[ { "docid": "f5fd319d54e9d083949e5eafa8992e4a", "score": "0.0", "text": "def show\n @date_range = grab_date_range\n @stat = params[:id]\n\n @options = add_filter_options({:date_range=>@date_range})\n\n if @stat == 'entered_state_count'\n state = params[:state].to_sym\n prev_state = ...
[ { "docid": "6e34d6f90bad9bd049cd44f452f385ec", "score": "0.90503633", "text": "def index\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "4c5af7679995a3a25b40247f10d616e8", "score": "0.9009822", "text": "def index\n respond_to do |format|...
a4fbe1cd8295896a1db944f11622fd61
Creates a new Job Creates a new Job
[ { "docid": "4c4157cfead7e854994742f7e8d82260", "score": "0.0", "text": "def create_job(project_id, job, opts = {})\n data, _status_code, _headers = create_job_with_http_info(project_id, job, opts)\n return data\n end", "title": "" } ]
[ { "docid": "de4217b86e47aa951d7303c0928aaf42", "score": "0.8577342", "text": "def create\n create_job_with job_params\n end", "title": "" }, { "docid": "1536a3def2b8e899741bbb394dbdbe53", "score": "0.81416786", "text": "def create\n @job = Job.new(job_params)\n end", "tit...
f9eab13c130c227c4ec7510760f5686c
POST /chords POST /chords.xml
[ { "docid": "6658782bc65bde3819d270f9e51889b4", "score": "0.5922675", "text": "def create\n @chord = Chord.new(params[:chord])\n \n logger.info \">>\"\n logger.info params[:chord].inspect\n\n respond_to do |format|\n if @chord.save\n format.html { redirect_to(chord_path(@chord....
[ { "docid": "ecd526d57ffc746ee872ed3f70d59e0f", "score": "0.5446002", "text": "def create\n @chord = Chord.new(chord_params)\n\n respond_to do |format|\n if @chord.save\n format.html { redirect_to @chord, notice: 'Chord was successfully created.' }\n format.json { render :show, s...
55cd69a586a56cd7f00a1e01d7322e6e
Internal: File digest key The digest for a given file won't change if the path and the stat time hasn't changed We can save time by not recomputing this information and storing it in the cache Returns a String.
[ { "docid": "2866152fc3b0aea75f4cb4137d96ed5f", "score": "0.82797617", "text": "def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end", "title": "" } ]
[ { "docid": "077cc0980604ffdae468d71d1d90aa94", "score": "0.7901916", "text": "def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end", "title": "" }, { "docid": "fbdf5458644bf502b6ec9f1bd9ba8993", "score": "0.78766096", "text"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4aaffe14cb120447010a9d2aed7426e6", "score": "0.0", "text": "def set_monthly_statistic\n @monthly_statistic = MonthlyStatistic.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...
5059ae30d56b3140df7864e2c8484f3f
When the canideploy command uses any of the `to` options (eg. `toenvironment ENV` or `to TAG`) we need to create the inferred selectors for the pacticipant versions in that environment/with that tag/branch. eg. if A > B, and the CLI command is `canideploy pacticipant A version 3434 toenvironment prod`, then we need to ...
[ { "docid": "5cfa8011ad917006b552f0e3249d0ba9", "score": "0.0", "text": "def resolve_inferred_selectors(resolved_specified_selectors, resolved_ignore_selectors, integrations, options)\n all_pacticipant_names = integrations.collect(&:pacticipant_names).flatten.uniq\n specified_names = re...
[ { "docid": "4b9fa36f2a8bb15aeba36dd749f8f38d", "score": "0.47293726", "text": "def permutations\n [{ cmdline: \"-t #{TOKEN} -E #{ENDPOINT}\",\n token: TOKEN,\n endpoint: ENDPOINT },\n\n { cmdline: \"-c #{CF}\",\n token: CF_VAL['default']['token'],\n endpoint: C...
b9bfab4e7b6ddc70e335303fda2a5ac2
then an array of valid substrings (your dictionary) as the second argument. It should return a hash listing each substring (case insensitive) that was found in the original string and how many times it was found.
[ { "docid": "8e621671735f3699c8fa4084b91ec3be", "score": "0.80465204", "text": "def substrings (words, array)\n\n\t#makes the hash, makes the string case insensitive, and then splits the string \n\t#into an array of the individual words\n\toccurances = Hash.new 0\n\twords.downcase!\n\tword_list = words.s...
[ { "docid": "9b8b173971fa88b78b0d546f34683631", "score": "0.80950785", "text": "def substrings(string, dictionary)\n hash = Hash.new(0)\n string.split(\" \")\n .map { |sub| get_all_unique_substrings(sub.downcase) }\n .flatten\n .each { |sub| hash[sub] += 1 if dictionary.include? su...
c649ac8a5b94f13239c286bfd6cba0b6
Package data for visualization using JQuery Flot
[ { "docid": "a7a69ac2952c418aaacac504d418a131", "score": "0.62616944", "text": "def to_flot\n [\n { label: \"Pageviews\", data: pageviews }\n ]\n end", "title": "" } ]
[ { "docid": "627368d6d97ac437f9914b31c2dec5b2", "score": "0.6982013", "text": "def to_flot\n [\n { label: \"Pageviews\", data: pageviews },\n { label: \"Downloads\", data: downloads }\n ]\n end", "title": "" }, { "docid": "630e663a21f22be69d24f888dca2d8ca", "score": "0....
df8d63f2e290a90553e140ce1e75d387
=begin BankAccount should allow a user to deposit money into either their checking or saving account =end
[ { "docid": "3520144b868dac0ea55eb7b35009def9", "score": "0.0", "text": "def deposit_checking(amt)\n\t\t@checking += amt\n\t\tself\n\tend", "title": "" } ]
[ { "docid": "9ef1e7af4f890405a53ac955ad4a8444", "score": "0.7732881", "text": "def deposit(amt, acct)\r\n \tif acct == 'checking'\r\n \t\t@checking += amt\r\n \t\treturn\r\n \telsif acct == 'savings'\r\n \t\t@savings += amt\r\n \t\treturn\r\n \tend\r\n\tputs 'Error, no account selected!'\r\n \tself\r\n e...
5cc5df9ba038ec2226b9101ebb098068
Unpin Unpins the comment from the top.
[ { "docid": "53ecf90859183029e5bc4d0309aa1d60", "score": "0.47624743", "text": "def unpin_with_http_info(space_id, id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TransactionInvoiceCommentService.unpin ...\"\n end\n # verify the requ...
[ { "docid": "cd7907145fdee1cc66a5a182ba62377b", "score": "0.6069966", "text": "def off(pin=@pin)\n super(pin)\n end", "title": "" }, { "docid": "0e6142325c5573fc679b48982f4a39c3", "score": "0.5776545", "text": "def unpin(connection = nil)\n @pinned_server = nil\n @pi...
996d46959db7c402dadb6c1af6b6c1b4
Test that our database is getting cleaned after every test. (Necessary for the other tests to work)
[ { "docid": "3a248367d7b64032069e4e180dea474f", "score": "0.7468183", "text": "def test_clean_db\n assert_equal 0, Changeset.find(:all).size\n assert_equal 0, Foo.find(:all).size\n assert_equal 0, FooHistory.find(:all).size\n end", "title": "" } ]
[ { "docid": "6ad8e127d3118a9c12aed343e843a546", "score": "0.8353222", "text": "def teardown\n File.delete(DB_NAME) if File.exist?(DB_NAME)\n end", "title": "" }, { "docid": "6544d2d58d9350d821723efb1c0360e2", "score": "0.80603516", "text": "def teardown\n @db.disconnect\n...
8b07b775f50e7696c1b3b46ac2aa8b83
A hash representation of this Message
[ { "docid": "7fcf8783efb3efbab7458e9eb96a758c", "score": "0.0", "text": "def to_h\n extensions = {\n \"code\" => code,\n \"nodeName\" => node_name\n }.tap { |h| h[\"typeName\"] = type_name unless type_name.nil? }\n\n super.merge({\n \"extensions\" => extens...
[ { "docid": "5d9fabd9b092d56e6dc7990e0a54d384", "score": "0.8157448", "text": "def get_hash\n msg.hash\n end", "title": "" }, { "docid": "c99e1d0fad6c674e18db6fddbdb0503b", "score": "0.77058506", "text": "def hash\n self.to_s.hash\n end", "title": "" }, { "...
377aa08923be9e9b02a85dda95ba488d
GET /converters/1 GET /converters/1.json
[ { "docid": "1094bb939eab15e2c4f9ab1f8e8ef469", "score": "0.6990224", "text": "def show\n @converter = Converter.find(params[:id])\n\n render json: @converter\n end", "title": "" } ]
[ { "docid": "04cbb3ea396a942a7ba551d364cd2783", "score": "0.76763", "text": "def index\n @converters = Converter.all\n\n render json: @converters\n end", "title": "" }, { "docid": "6599e25696e9bc66a79cb448b25335a5", "score": "0.6715277", "text": "def converters\n @converters...
44b50c08c417fbf60fe0b53b7c036af5
A Hash (strategy => IndividualGameExecutionResult), sorted by descending payoff
[ { "docid": "4c4af881b28f092b0eebff7785fdff6a", "score": "0.64086944", "text": "def sorted_results\n individual_results.sort {|x,y| y[1].total_payoff <=> x[1].total_payoff }\n end", "title": "" } ]
[ { "docid": "dbd03f9d23c7a65d318c8466cda67390", "score": "0.6245245", "text": "def sortByResult hash\n\tarrResult = Array.new\n\thash.each do |k, v|\n\t\tarrResult<<[k, calculatorScore(v)]\n\tend\n\t#arrResult.sort_by{|i|i[1]}.reverse\n\tarrResult.sort_by!{|i|i[1]}.reverse!\n\treturn arrResult\nend", ...
07c33c43b8379ed5c2c4317757cb59e2
GET /players/1 GET /players/1.json
[ { "docid": "177489f9b5ae0d194daddff7c7fd0d8b", "score": "0.0", "text": "def show\n @player = Player.find(params[:id])\n end", "title": "" } ]
[ { "docid": "2cad2e02ba3ff9a3533a13dac197a8a2", "score": "0.78661966", "text": "def show\n @players = Player.find(params[:id])\n render json: @players.to_json\nend", "title": "" }, { "docid": "4c832775b9124dbf3a6c1e7a3aa47090", "score": "0.77292967", "text": "def players\n @playe...
966c4e98f638826337af96f2497041a1
not sure what this one is
[ { "docid": "2cd9a4546b2469aa8cba78f64fb7bd87", "score": "0.0", "text": "def po_num\n unescape params['x_po_num']\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7568441", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.7020164", "text": "def probers; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", ...
1aa2286083f8e0d7654d17f0464e74bd
whether manage attributes should be shown, dont show if editing (rather than new or managing)
[ { "docid": "2c6f53d7bf00662cc7f71027179a7b22", "score": "0.7709334", "text": "def show_form_manage_specific_attributes?\n !(action_name == 'edit' || action_name == 'update' || action_name == 'update_paths') # TODO: Figure out a better check here...\n end", "title": "" } ]
[ { "docid": "dfeef0c2bbc37fffe9189c8f296ae6bc", "score": "0.6515409", "text": "def can_show?\n can_edit?\n end", "title": "" }, { "docid": "7e069caac0ec3360b082db35fa58163f", "score": "0.6387302", "text": "def showable_attributes\n return attributes if permitted_to?...
1dd35d36d6d03d5988214bf99091c5eb
Constructor (default parameter removed for clarity)
[ { "docid": "7b05a401525e8c50c8f72c80c5d9550b", "score": "0.0", "text": "def initialize(start)\n\t\tif start.kind_of?(Integer)\n\t\t\t@start = start\n\t\t\t@current = start\n\t\t\t@seq = {}\n\t\t\t@count = 0\n\n\t\t\t# Force computation\n\t\t\tcompute\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "700c042555d8ebc7c4de252bf9ffc0af", "score": "0.8295443", "text": "def constructor; end", "title": "" }, { "docid": "8e3629bb42b471c640e3e1bd665bf3b2", "score": "0.82269007", "text": "def initialize(*) end", "title": "" }, { "docid": "8e3629bb42b471c640e3e1bd66...
283577f66d5a0f326716aca0beb8577e
Get formatted line (with Bootstrap 'badges') to display in datatable
[ { "docid": "26ed8c51330323b1f8227d699145a193", "score": "0.0", "text": "def parsed_description\n begin\n new_description = description.dup\n\n Todo::project_regexp.match(self.description) do |match|\n new_description.gsub! ' +' + match[1], ''\n new_description += \" <a href='#...
[ { "docid": "1b91c7523899c92d5273e6dfa0e44574", "score": "0.64244527", "text": "def format_row(row)\n row.map {|v| v ? \"#\" : \".\" }.join\nend", "title": "" }, { "docid": "922046fccc2e9a90d7414181008d76a6", "score": "0.6351001", "text": "def quality_gate_table_header(badge)\n ...