query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
024448dd64593f4b2c4926954ff4eef9
Add l1 and l2 where the elements of each ll correspond to the digits of a number where the first node is the leftmost digit when written 500 => [5 => 0 => 0]
[ { "docid": "ebed29f07cc09a2d48314b8d54eb08c9", "score": "0.6293235", "text": "def call_backwards(l1, l2, top_level = true)\n if l1 == nil && l2 == nil\n return [nil, 0]\n elsif l1 == nil\n return [Node.new(l2.value), 0]\n elsif l2 == nil\n return [Node.new(l1.value), 0]\n end\...
[ { "docid": "c78315c840224383095faf98a2bef384", "score": "0.7379931", "text": "def add_two_numbers(l1, l2)\n (linked_list_to_array(l1).map(&:to_s).join.to_i + linked_list_to_array(l2).map(&:to_s).join.to_i).to_s.reverse.chars.map(&:to_i)\nend", "title": "" }, { "docid": "ba6975be4f477cbff6d9...
e36de8b4a8abb4f1c4d46ec6a9ac7929
Direct allocation to employee
[ { "docid": "a644546b43df18e82fcb113ee41f32f0", "score": "0.6502437", "text": "def allocate_to_employee(employee_id, count)\n records = []\n count.times do\n records << { approval_status: 'approved', inventory_release_id: id, requester_id: employee_id }\n end\n RequestAttendance.create!(...
[ { "docid": "81912fee2d7ce985ca0276b1df727663", "score": "0.66847146", "text": "def allocate_to_employee\n @inventory_release = InventoryRelease.find params[:id]\n authorize! :update, @inventory_release\n\n\n if @inventory_release.allocate_to_employee(params[:employee_id], params[:count])\n ...
135dfaaa5b01f3a50b9dc3d9c59dc136
DELETE /datos/1 DELETE /datos/1.xml
[ { "docid": "84a376884ac2968ba284b1b4c50ead15", "score": "0.70187426", "text": "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to(datos_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "e1d6f603cb5ea1e475ea71422432aeae", "score": "0.68304217", "text": "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "title": "" }, { "docid": "0edf476380e2e78b3a81b33c020e9563", "score": "0.6741617", "text": "def destroy\n @...
33206ddf1b4bc667011bded647344fee
def dish_params params.require(:dish).permit(:name, :description, :yumyuck) end
[ { "docid": "b86df1026807accc4c3314b18448944c", "score": "0.0", "text": "def find_dish\n\t\t@dish = Dish.find(params[:id])\n\tend", "title": "" } ]
[ { "docid": "c56ae77c8f6b84ce8237c749ed617ce5", "score": "0.9290358", "text": "def dish_params\n params.require(:dish).permit(:name, :desc, :ingredients, :calories, :protein, :sodium, :carbs, :price)\n end", "title": "" }, { "docid": "bcd2019fe63f72c53c69a614b4f158aa", "score": "0...
412072e8b6072d31a9d673040e1a1f40
Main Processing : Window Initialization
[ { "docid": "7520c8fd2bbdebdc22d56094e6ba5737", "score": "0.0", "text": "def main_window\r\n super\r\n # Make message window\r\n @message_window = Window_Message.new\r\n end", "title": "" } ]
[ { "docid": "2c05fe6ea5ac0b3e355fc2de9bef4244", "score": "0.73975724", "text": "def initialize(window)\n \t# all setup is done in reset so it can be reused\n reset(window)\n end", "title": "" }, { "docid": "233691e280f06ab3c2c87d10926c1b89", "score": "0.73238945", "text": "def ma...
a706008b5af03b6dddfdc258e8979431
store wiki format of itself to database
[ { "docid": "3233ce5b8ec190fcb67795157ce5345c", "score": "0.0", "text": "def reserve_format\n return unless @text && @content\n\n @text.wiki_format = @content.text.wiki_format\n Pwfmt::Context.reserve_format('content_text', @text)\n end", "title": "" } ]
[ { "docid": "2426cae39d878607e3b7b12e0171ef9a", "score": "0.6882196", "text": "def persist_wiki_format\n if Pwfmt::Context.format_for?('issue_notes')\n PwfmtFormat.persist(self, 'journal_notes', Pwfmt::Context.format_for('issue_notes'))\n elsif Pwfmt::Context.format_for?(\"journal_#{id}_...
ec2966fbf2f39803bf33fcee1555c866
start payment donation for an amount
[ { "docid": "3c377d8982904dde54bd48c3261110be", "score": "0.0", "text": "def try_donation\n render layout: false\n end", "title": "" } ]
[ { "docid": "b2cc42856a7a3ae399b1faafa62e90e3", "score": "0.71153766", "text": "def make_payment amount, day = 0\n\t\tif (amount <= principal)\n\t\t\t@available_credit += amount\n\t\t\t@principal -= amount\n\t\t\trecord_transaction(-amount, day)\n\t\tend\n\tend", "title": "" }, { "docid": "8b...
dd424794b57e885521e52fdd40801468
POST /comments POST /comments.json
[ { "docid": "d2d5f283db682ecb88e3890faab877a9", "score": "0.0", "text": "def create\n\n @comment = Comment.new(comment_params)\n @comment.user = current_user\n @comment.report = 0\n respond_to do |format|\n if @comment.save\n format.html { redirect_to post_url(@comment.post), noti...
[ { "docid": "7b0a68ee4df9cfc8f7cc619d01d2577d", "score": "0.7545618", "text": "def create\n @comment = @post.comments.create!(comment_params)\n json_response(@comment, :created)\n end", "title": "" }, { "docid": "278b898b0e96dc8518cb54546e69f368", "score": "0.7373569", "t...
c161d0db627181c86d1ab8f8de5d9b37
GET /thesis_changes/new GET /thesis_changes/new.json
[ { "docid": "2f1bc66f2683577b0b93d0c035c9de75", "score": "0.79752", "text": "def new\n @thesis_change = ThesisChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thesis_change }\n end\n end", "title": "" } ]
[ { "docid": "4305e61ed267357e99fb71089a72efc6", "score": "0.73774326", "text": "def new\n @change = Change.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @change }\n end\n end", "title": "" }, { "docid": "b80e84795d71f216af56157f62...
9a792e9537fab1d10e1d9ce6f5c8020c
This method update a message with Message Button
[ { "docid": "5ab6458c7e4c1869b30739cecdc1b76d", "score": "0.0", "text": "def chat_update(params = {})\n Rails.logger.debug(params)\n begin\n response = client.chat_update(params)\n Rails.logger.debug response.inspect\n rescue => e\n Rails.logger.error e.inspect\n ...
[ { "docid": "47b8fb6c6a086e9bc5e5b7bbd89fcece", "score": "0.7274186", "text": "def update_message(data); end", "title": "" }, { "docid": "3c999d798d4b61b56957950716306e99", "score": "0.7234116", "text": "def update\n # find and update a specific message\n end", "title": ""...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.find(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...
bed1a6adef61def4c7850f4ebcc2cdb0
(DEPRECATED) Get the raw Registry Extract Service data for a Title Data request as an object.
[ { "docid": "3504230bb3fd4496cad7b9d8096c18d3", "score": "0.0", "text": "def title_data_get_res_data_with_http_info(clientid, requestid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: TitleDataChecksRESOfficialCopyWithSummaryApi.title_data_get_re...
[ { "docid": "41504223c1197b79b78273e64937e605", "score": "0.5919056", "text": "def retrieve_title\n @got_data['titles']\n end", "title": "" }, { "docid": "c979f49a96390f1fc643b58b9f2e29cd", "score": "0.5585513", "text": "def data\n if @data.nil?\n @data = JSON.parse(@b...
2304b2414e7028ddf66a2bc17eded8ad
DOCS: Always pass in a token, if available Can pass in UID if no token API will tell you if we ran it once before already
[ { "docid": "324fa86996f421478c917780b50c6f1d", "score": "0.0", "text": "def trust_check\n @facebook_profile = FacebookProfile.update_or_create_by_token_or_facebook_id_and_app_id(params.merge(fetching_directly: true))\n if @facebook_profile.valid? and !@facebook_profile.changed? # it was saved\n\n ...
[ { "docid": "cb147201649b7f9f5383d3e9e4d8add4", "score": "0.7131991", "text": "def check_and_set_token\n generate_api_token if self.api_token.nil?\n end", "title": "" }, { "docid": "4397f2d11591902ecdae6de161812ffa", "score": "0.69273233", "text": "def add_token\n #if params[:to...
a1cb8ae48c11483d8c232aff3612a417
This method will return a normalized value for a specific questionnaire and company type/size and will return "1 / SUM of questions weights" Example: "1/37 = 0.027027027" This value will be used on the next steps of Topsis
[ { "docid": "d3e4888aa3d9149a4052bed65027c8d3", "score": "0.0", "text": "def initialize(questionnaire_driver, type_of_company)\n @questionnaire_driver = questionnaire_driver\n @type_of_company = type_of_company\n end", "title": "" } ]
[ { "docid": "70050f3553e4b3a54ab5fd956bb3bea0", "score": "0.57926583", "text": "def format_weight\n\n # if require_customs?\n # @customs_total_weight\n # else\n # '0.1'\n # end\n end", "title": "" }, { "docid": "f627a254ec1dec7805c84c1015e4b9da", "score": "0.5791579", ...
c5f716c1a36e9792af37f57b38a9c3a1
Detect data format, parse with appropriate library
[ { "docid": "3a5324ddfd706071cd39549dc66819fb", "score": "0.0", "text": "def parse_response_data\n log :debug, \"cas_server response.body:\\r\\n#{@raw_data}\"\n formatted_data = format_data\n formatted_data = formatted_data.nil? ? @raw_data : formatted_data\n log :debug, \"For...
[ { "docid": "9c4c95d93c5087ff2ae657746d252032", "score": "0.6375647", "text": "def parse(data); end", "title": "" }, { "docid": "0b83e574be0fafcc050538654e8b10da", "score": "0.6326305", "text": "def supported_formats\n # WARNING: This shit won't be documented or even properly tes...
2d392fee9d4b499a19d4fe5109d68f66
Handle exceptions gracefully so that no exception goes unhandled. Author: Kedar Date: 10/10/2017 Reviewed By: Sunil Khedar
[ { "docid": "2cbf821ed62f4696050ba1d93ce5e90f", "score": "0.72502875", "text": "def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message}\")\n ApplicationMailer.notify(\n body: {exception: {message: se.mess...
[ { "docid": "2e0f514516aa34105558207ee6c1cc6d", "score": "0.78456604", "text": "def rescue_with_handler(exception); end", "title": "" }, { "docid": "4aa22dfe53d206616edcdeb4ad0d5a32", "score": "0.7690047", "text": "def handler_for_rescue(exception); end", "title": "" }, { ...
eb2fcfec9fb97fe694f4d02d23300a2b
PATCH/PUT /backstage/articles/1 or /backstage/articles/1.json
[ { "docid": "d4adae9b5ebca55bbd871ed399eeb9d2", "score": "0.67015135", "text": "def update\n respond_to do |format|\n if @backstage_article.update(backstage_article_params)\n format.html { redirect_to @backstage_article, notice: \"Article was successfully updated.\" }\n format.json ...
[ { "docid": "127193a9b695d95bf6538bf269cb1be9", "score": "0.6563343", "text": "def update\n article = Article.find(params[:id])\n article.update(article_params)\n render json: { article: article }\n end", "title": "" }, { "docid": "7d4ed0168d526c4d37980dc3329f71c8", "score": "0....
d48d0ecbcb6889921dbe324f1b99fa66
Asserts that the session contains a +key+ with +value+.
[ { "docid": "4c235794b22ab2ddac402b16304eb6f2", "score": "0.82346994", "text": "def assert_session(key, value)\n session = last_request.env[\"rack.session\"]\n flunk \"expected session to not be nil\" if session.nil?\n flunk \"expected session to have key '#{key}'\" unless session.keys.include?(...
[ { "docid": "a20de8e34a05b9b6f06cabdf191117d4", "score": "0.7418408", "text": "def assert_session_has(key=nil, message=nil)\n response = acquire_assertion_target\n msg = build_message(message, \"<?> is not in the session <?>\", key, response.session)\n assert_block(msg) { response.ha...
e5127c20233da31c5c70d82a1e698da3
Time limit: 1.0 second Memory limit: 64 MB Calculate a + b Input: a and b Output: a + b Sample input: 1, 5 Sample output: 6
[ { "docid": "fa76cfcc2b9c32526966d2d0f3300024", "score": "0.0", "text": "def plus(a, b)\n a + b\nend", "title": "" } ]
[ { "docid": "83a8b142c0fd384bfc71e8d38a11c31b", "score": "0.6819505", "text": "def loadcpu2( num1, num2 )\n res = 0.0\n (1..1000000).each do |i|\n res = c_mul_add_add(res, num1, num2,i)\n end\n res\nend", "title": "" }, { "docid": "d7833f78da6de569e81eacf4a3d2f481", "score": "0.667...
a8a0c840b4e14c5529828b5ba24a21f3
Returns the current access type parameter for authorization_uri.
[ { "docid": "0150fea165d98daf38110d7ef7ac4236", "score": "0.7120485", "text": "def access_type\n @access_type\n end", "title": "" } ]
[ { "docid": "68bfa9758a2390e71242577d71a96301", "score": "0.6429315", "text": "def grant_type\n @grant_type ||= nil\n return @grant_type if @grant_type\n if code && redirect_uri\n \"authorization_code\"\n elsif refresh_token\n \"refresh_token\"\n elsif...
95c7bdf9d174e793f315540ad8e14c6e
Creates new Custom API object
[ { "docid": "da63d091a75bbdd7124600fb6ca4ff6d", "score": "0.62617826", "text": "def custom name, options = {}\n Diffbot::APIClient::Custom.new self, name, options\n end", "title": "" } ]
[ { "docid": "ab0ef66257351845206d84b4b563a97f", "score": "0.68814033", "text": "def create_api_instance\n facturama_user='prueba'\n facturama_password='pruebas2011'\n is_development = true # true = Modo de pruebas / sandbox, false = Modo de Produ...
a1f68a2a6a0988f38369a0e8974e7ad9
Keep track of allocated BNodes
[ { "docid": "8e3109e46c4d5ab0057325716716da79", "score": "0.0", "text": "def bnode(value = nil)\n @bnode_cache ||= {}\n @bnode_cache[value.to_s] ||= RDF::Node.new(value)\n end", "title": "" } ]
[ { "docid": "4619db082a9d1e714e1f52585e3bb457", "score": "0.67338294", "text": "def bnodes\n @graphs.inject([]) {|memo, g| memo += g.bnodes}\n end", "title": "" }, { "docid": "6b1fcd4e9abf30fc2cbd16a81eba0314", "score": "0.60487396", "text": "def bnodes(context = nil)\n b...
d3acf191584f86c4465d67e247e6f07d
Wait for flash card thread, if it is running
[ { "docid": "f0d9c8e4d30ce1a590b0fcd0723eb30d", "score": "0.86225724", "text": "def flash_card_th_wait\n\n #Terminal flash card thread, if running\n Thread.list.each {|t|\n if t[:thread_method_name].to_s == \"flash_card_th\"\n $test_logger.log(\"Waiting for flash card thread..\"...
[ { "docid": "b643e588824b95b1828c3c08742e2954", "score": "0.69354796", "text": "def flash_card_th_exit\n\n #Terminal flash card thread, if running\n Thread.list.each {|t|\n\n if t[:thread_method_name].to_s == \"flash_card_th\"\n $test_logger.log(\"Sending exit flag for flash car...
4c516016cd1d34688190ca9aedba0edd
=> return true or false if contain only one responsable
[ { "docid": "63ab71d8d2c5ef3855034d99ff6a869a", "score": "0.764446", "text": "def has_responsable?\n responsables.count == 1\n end", "title": "" } ]
[ { "docid": "47901f564738c4d584d70be15e88db8c", "score": "0.6826354", "text": "def has_responsable?\n users.count == 1\n end", "title": "" }, { "docid": "ad1fd0a7e73a9cda4cef8bb5b71b17ec", "score": "0.6785317", "text": "def multiracial?\n ethnicities.size > 1\n end", "titl...
2dc8915a19de88db0285aa55ce842ca2
Run Method for when run command is issued
[ { "docid": "49c32b52ecbd900714d4aa27a6537512", "score": "0.0", "text": "def run\n platforms = %w[docker lxc rkt].select { |p| runnable(p) }\n\n if platforms.empty?\n print_error('No container software appears to be installed or runnable by the current user')\n return\n end\n\n plat...
[ { "docid": "9be2f8fd1319de0311bbb1d849ffcc8f", "score": "0.820615", "text": "def run_command\n end", "title": "" }, { "docid": "da491ec3599548046cbe8be7dd186eb0", "score": "0.8090771", "text": "def run!\n run_commands\n end", "title": "" }, { "docid": "b5...
3f0a6f1230324a3aba3a56e12c520db2
GET /episodes/new GET /episodes/new.xml
[ { "docid": "330e069489a23deaf718a3eee396386d", "score": "0.7022624", "text": "def new\n @series=Series.find(params[:series_id])\n @season = @series.seasons.find(params[:season_id])\n @episode = @season.episodes.build\n \n p @episode\n #@episode = Episode.new\n\n respond_to do |forma...
[ { "docid": "0e47153635e9c476150728a07cb385e2", "score": "0.8036967", "text": "def new\n @episode = Episode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @episode }\n end\n end", "title": "" }, { "docid": "0e47153635e9c476150728...
d18c97d6d084f371623961b7f8f3bda3
Sets the filledAttendeesCount property value. The current number of customers in the appointment
[ { "docid": "2d2454de2444edc8cb2b429fabae94eb", "score": "0.8354363", "text": "def filled_attendees_count=(value)\n @filled_attendees_count = value\n end", "title": "" } ]
[ { "docid": "7f258425b6f9f17bd0db92e36d952beb", "score": "0.733737", "text": "def filled_attendees_count\n return @filled_attendees_count\n end", "title": "" }, { "docid": "9f7da97d4b6f52a4c083d974c94bda2c", "score": "0.6535104", "text": "def maximum_attendee...
2a0aa6b8ffd04fe3596a78859375bbf9
POST /typesobjects POST /typesobjects.xml
[ { "docid": "d08e3db1721ad241239a94e99783400f", "score": "0.59880316", "text": "def create\n\t\tfname=\"#{self.class.name}.#{__method__}\"\n\t\t#LOG.info (fname){\"params=#{params}\"}\n\t\t@typesobject = Typesobject.new(params[:typesobject])\n\t\t@objectswithtype=Typesobject.get_objects_with_type\n\t\tre...
[ { "docid": "df04787ee23ae8e96cf42dc4da113ec7", "score": "0.6262238", "text": "def create\n @object = Type.new(object_params)\n @object.save\n render json: @object\n end", "title": "" }, { "docid": "041b0c48c42a5a9a9b89b9675f0651b5", "score": "0.6175181", "text": "def create...
a3db6020ed893411904a7ab7bf72ca3f
the minimum number of units that must be enrolled in for a term
[ { "docid": "9155205f992c632424c0384edb5e2aec", "score": "0.5841277", "text": "def units_min\n @data['unitsMin'].try(:to_f)\n end", "title": "" } ]
[ { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.6539155", "text": "def numerator_units; end", "title": "" }, { "docid": "c499f6775e691da4b713085742d4d3a8", "score": "0.6539155", "text": "def numerator_units; end", "title": "" }, { "docid": "21bdaf6191cf0308c513...
d91187ee2b8d35645637be410c33320a
Checks file if exists and can be readable
[ { "docid": "c0b56476a63eb3d75ce98ba4aac22f1e", "score": "0.8053491", "text": "def can_read?(file)\n if !File.exist?(file)\n fail \"ERROR: File #{file} does not exists\"\n elsif !File.readable?(file)\n fail \"ERROR: File #{file} is not readable\"\n end\n end", "title":...
[ { "docid": "2fc4e8cd0d351fddc47e238d3a925fc2", "score": "0.78460985", "text": "def is_readable?(path)\n File.exists? path and File.readable? path\n end", "title": "" }, { "docid": "1bc11ab120901d494e0f243f1939ba25", "score": "0.78418756", "text": "def check_for fn\n File...
4a0b852b6599709bcf2a6d98af1e365f
path is expected to be a string page_title can be a String or Lambda. Lambda takes one argument, current page number
[ { "docid": "4194723b54f84ca33f801b7e4ef8902d", "score": "0.0", "text": "def paginate_posts_at path, posts, page_title=\"Blog\", feed=false\n # Make sure path starts/ends with forward slash\n path = \"/#{path[%r{\\A/?(.+?)/?\\z}, 1]}/\"\n # Atom feed path\n feed_path =...
[ { "docid": "caa9c48d77d9d74b237d5f8830a0c4f7", "score": "0.642096", "text": "def page_path(value, page = nil)\n # noinspection RubyMismatchedArgumentType\n value.is_a?(Symbol) ? page_history(value, page) : value.to_s.presence\n end", "title": "" }, { "docid": "6344beeb4c2695ccd2...
5037a1469d72ca5fdf61028913963c82
DELETE /notes/1 DELETE /notes/1.json
[ { "docid": "8c89d61adcfee039b1f148ba325c087b", "score": "0.68600225", "text": "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to house_path(@note.house_id) }\n format.json { head :no_content }\n end\n end", "tit...
[ { "docid": "b6898f57991dab97533b9ca0c7d58ac8", "score": "0.7653342", "text": "def destroy\n @note = Note.find(params[:id])\n @note.destroy\n\n respond_to do |format|\n format.html { redirect_to(notes_url) }\n format.json { head :ok }\n end\n end", "title": "" }, { "do...
ea840aa5d31fa501d14ea3446d2b221b
POST /target_journals POST /target_journals.json
[ { "docid": "d71c4d0a14a4768913746f71d25ecbaa", "score": "0.6347868", "text": "def create\n #@target_journal = TargetJournal.new(params[:target_journal])\n\n respond_to do |format|\n if @target_journal.save\n format.html { redirect_to @target_journal, notice: 'Target journal was success...
[ { "docid": "aefcae82a4958767ea5d2093c895cecc", "score": "0.6341732", "text": "def create\n # A user has many journals. A journal belongs to a user\n @journal = current_user.journals.new(journal_params)\n\n respond_to do |format|\n if @journal.save\n format.html { redirect_to journal...
335e188467814cd0486e57b5c3356397
These are for managing input
[ { "docid": "34b1e009e51d49d858af3997ab39c799", "score": "0.0", "text": "def button_down(id)\n @input_register[id].each do |item|\n item.button_down(id)\n end\n end", "title": "" } ]
[ { "docid": "a438904453beae0cf151826b1f53d33a", "score": "0.79204583", "text": "def input() end", "title": "" }, { "docid": "ca78965073c1bbd0f5ee58902ef67ca4", "score": "0.78810036", "text": "def handle_input\n end", "title": "" }, { "docid": "c9ecacac239e3d3e03e156607e55...
4b4f36c494253faa8197525f0871b34a
Computes current swimmer age
[ { "docid": "9c10b1b35047938c83500a56f2e5739f", "score": "0.7715204", "text": "def get_swimmer_age\n swimmer ? Date.today.year - swimmer.year_of_birth : 0 # this will fail the tests if association in not defined\n end", "title": "" } ]
[ { "docid": "e1527a6ad5d54a33e2627a5514a54cfa", "score": "0.8325759", "text": "def get_swimmer_age(date = Date.today)\n date.year - year_of_birth\n end", "title": "" }, { "docid": "4d8f193d6b599da12782d003b73fc760", "score": "0.81930304", "text": "def get_swimmer_age\n get_sche...
61da7da522d925fcf43fe058b6e0b141
array of all numbers in that range, exclusive.
[ { "docid": "931e11e39058b3793ac62130bf7ca1a7", "score": "0.0", "text": "def range(start_num, end_num)\n return [] if end_num < start_num || start_num == end_num\n nums = []\n nums << start_num\n nums += range(start_num + 1, end_num)\n \nend", "title": "" } ]
[ { "docid": "7400516702a249eed8e74346c5c44e2f", "score": "0.77846986", "text": "def build_array_from_range(min, max)\n (min..max).to_a\nend", "title": "" }, { "docid": "b793381069ce6e8aa45f3ec9523fd0e1", "score": "0.7710915", "text": "def get_range(range)\n val = []\n range.eac...
bf82d416d510dcbb3a8852416677a9dc
Helper method to provide a simple way of doing an MCClevel operation without the need to change credentials. Sets the value of the property that controls whether MCClevel operations are enabled or disabled. Args: value: the new value for the property (boolean)
[ { "docid": "25d769a2dad2feb318da454f5507c0d5", "score": "0.5422373", "text": "def use_mcc=(value)\n @credential_handler.use_mcc = value\n end", "title": "" } ]
[ { "docid": "7917f6955c9b76117ebc4cffdf12efcd", "score": "0.5881529", "text": "def enable(value)\n UdooNeoRest::Base.change_state UdooNeoRest::Base.axis_path_enable('Magnetometer'), value\n end", "title": "" }, { "docid": "ecf5d345bdd281c70644e3e32a987998", "score": "0.5781835", ...
ee71a4379b1e64057987d7aa8de26811
Create an offer for the cart that will not allow anyone to edit it
[ { "docid": "575c21a8d48fb36cee1c8860f9ff5828", "score": "0.6640935", "text": "def generate_for_cart(attrs)\n raise \"forget to set email? attrs:#{attrs.inspect}\" if attrs[:email].nil?\n raise \"forget to set friend? attrs:#{attrs.inspect}\" if attrs[:friend].nil?\n attrs[:item_options_list] = ...
[ { "docid": "e8b6451d827cd908546bfa669e99dc34", "score": "0.69710416", "text": "def create\n @offer = current_user.offers.build(params[:offer])\n @businesses = current_user.businesses\n \n forced_draft = !@offer.draft && @offer.credits_required > current_user.credits\n @offer.draft = force...
f1f108886240fa07ecfa7d824c67a18d
Calculates the speed of deaths per state based on pop. density and then prints
[ { "docid": "6bdc5d9e225994ea12bad05494b6e9ed", "score": "0.0", "text": "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n speed = 0.0\n\n if @population_density >= 200\n...
[ { "docid": "739f5e12d302180b3a836e692fef662f", "score": "0.82352656", "text": "def predicted_deaths_and_speed_of_spread(population_density, population, state) \n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @populati...
0f3a7b324a1dcb43eac5e68ea3588be2
!! REPLACE SCRAPE DATE WITH THIS IN QUERY AFTER ALL HAVE DATES. Indexer.where.not('scrape_date <= ?', Date.today 1.week).count Staffer.where.not('updated_at <= ?', Date.today 1.day).count indexer_status: cs_error_code
[ { "docid": "ba02dc6eb2fb915756216cb42ff71a46", "score": "0.0", "text": "def cs_starter\n # make_batched_queries\n make_standard_queries\n end", "title": "" } ]
[ { "docid": "983538e52fea46634ec1ad82a20f69a3", "score": "0.6017318", "text": "def index\n # start_day = DateTime.now.prev_month\n # populars = Like.where(\"created_at > ?\", start_day).group(:feed_id).order(\"count_feed_id desc\").count(:feed_id)\n \n search_start_time = (DateTime.now - 1).u...
556138c45208c05b38c2cc975f790991
Return a FileInfo representing a class in this ModuleInfo.
[ { "docid": "9a67619e475d650f432cd1befb496f8f", "score": "0.48811615", "text": "def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend", "title": "" }...
[ { "docid": "6da45cba83c1564c89a960987ef2ea92", "score": "0.6176132", "text": "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "title": "" }, { "docid": "2c5b5ca66c3d83c020227b7f73b0df80", "score": "0.6003271", "text": "...
b94a05b9093f180b44c2fbf0b163aac3
calculate radius and sweep
[ { "docid": "ec98cf7c6230d7a2d3f37ccf1769eef9", "score": "0.547315", "text": "def calculate_arc_parameters(begin_x, begin_y, end_x, end_y)\n distance = Math.sqrt(((begin_x - end_x)**2) + ((begin_y - end_y)**2))\n angle_b_o = Math.atan2(begin_y, -begin_x)\n angle_b_e = Math.atan...
[ { "docid": "214a5965a22453885eb95dcc894377d8", "score": "0.7384539", "text": "def calculate_circumference\n\n \t circumference = 2*3.14*@radius\n end", "title": "" }, { "docid": "5585584cc049fb6b5cb6c0258ed9ed2c", "score": "0.7030192", "text": "def c_radius \n Math.sqrt((@x*@x...
443e5f773f3e46e126d1584f9e3a8608
Unsubscribe username from pending game list observer
[ { "docid": "031b6137b7af028ff3cbda99b4ca48fe", "score": "0.6675266", "text": "def unsubscribe_user_pglist(user_name)\n @subscribed_pg_user_list.delete(user_name)\n end", "title": "" } ]
[ { "docid": "57c5a919720108cb886c704f87d43e25", "score": "0.73745316", "text": "def unsubscribe_from(username)\n action(username, 'unsubscribe')\n end", "title": "" }, { "docid": "7954b22735f27999a683d8814863646b", "score": "0.73717654", "text": "def unsubscribe(name); end", ...
23406062fab4f7f8b73b902ffe8670d1
Loads an RSA key pair from PEM strings
[ { "docid": "fecef7128cc066ced20eccc9b43b1879", "score": "0.66463524", "text": "def load_keypair(private_key, public_key)\n @private_key = private_key\n @public_key = public_key\n @private_rsa = OpenSSL::PKey::RSA.new @private_key\n @public_rsa = OpenSSL::PKey::RSA.new @public_key\n end", ...
[ { "docid": "8031ab8c446402dc82a47a9d395a381c", "score": "0.6889425", "text": "def rsa_key(key_as_string)\n OpenSSL::PKey::RSA.new key_as_string\n end", "title": "" }, { "docid": "1b11dde8c6a469de410f5f93954e9a14", "score": "0.67886555", "text": "def load_key(key_file)\n Op...
97fb2103e63eaaca5d7c827b7e2dc74f
Define the ref data codes associated with the attributes not to be cached in this model
[ { "docid": "8271580487e8f9e233f6a3d1815c7790", "score": "0.7245154", "text": "def uncached_ref_data_codes\n { full_repayment_of_ads: YESNO_COMP_KEY,\n authenticated_declaration1: YESNO_COMP_KEY,\n authenticated_declaration2: YESNO_COMP_KEY }\n end", "title": "" } ]
[ { "docid": "d258fcc54584689f9f6996b205fe1e27", "score": "0.76503974", "text": "def uncached_ref_data_codes\n { terms_and_conditions: YESNO_COMP_KEY,\n reg_company_contact_address_yes_no: YESNO_COMP_KEY,\n email_data_ind: YESNO_COMP_KEY }\n end", "title": "" }, { "docid": "805ca...
96de88c25bb18296d17196fd61331432
Add a default letter if empty
[ { "docid": "e295fdb440122f28c2a0d6bd06a0cba6", "score": "0.7235604", "text": "def add_letter\n\t\tif self.letter.nil?\n\t\t\tself.letter = self.name[0].upcase\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "dfcf385d3fab5c180c2a828163e9c6fb", "score": "0.6746092", "text": "def default_action\n insert(@char)\n end", "title": "" }, { "docid": "516e6065a765468dc1968cc4822b2bbb", "score": "0.6664875", "text": "def formatted_letter\n is_void ? '_' : letter\n end", ...
f42474c7824e8a6644bdccbee9e4c760
POST /asset_scrapping_entries POST /asset_scrapping_entries.json
[ { "docid": "adfad0ca7e34f73876c200d449bf0cc6", "score": "0.72722197", "text": "def create\n @asset_scrapping_entry = AssetScrappingEntry.new(asset_scrapping_entry_params)\n\n respond_to do |format|\n if @asset_scrapping_entry.save\n format.html { redirect_to @asset_scrapping_entry, not...
[ { "docid": "ccbe33b10f75128b636a83a4d1338467", "score": "0.6857088", "text": "def index\n @asset_scrapping_entries = AssetScrappingEntry.all\n end", "title": "" }, { "docid": "68e1858b475972de56c5ee0d4e2e8dbf", "score": "0.64057803", "text": "def asset_scrapping_entry_params\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "21b05cba6f2a2e2498eb433ff3af450e", "score": "0.0", "text": "def order_validation_params\n params.require(:order).permit(:id, :pub_id, :token)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981606", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6784227", "text": "def strong_params\n params.requi...
c7bb9b42dc7f90c64b6d290044b0ad43
DELETE /catagaries/1 DELETE /catagaries/1.json
[ { "docid": "e1fdac191421b500ebb6f1812022e894", "score": "0.72374094", "text": "def destroy\n @catagary = Catagary.find(params[:id])\n @catagary.destroy\n\n respond_to do |format|\n format.html { redirect_to catagaries_url }\n format.json { head :no_content }\n end\n end", "tit...
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.7140646", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "...
362bd43a3951d8c69b9f7299643630d2
PATCH/PUT /search_lines/1 PATCH/PUT /search_lines/1.json
[ { "docid": "e10cbf0e2f6e5fa95b7f01411ea95068", "score": "0.71736145", "text": "def update\n respond_to do |format|\n if @search_line.update(search_line_params)\n format.html { redirect_to @search_line, notice: 'Search line was successfully updated.' }\n format.json { render :show, ...
[ { "docid": "c7e0997b7e31148b7b194da874e9f723", "score": "0.6516954", "text": "def update\n @line = Line.find_by_no(params[:id])\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to @line, notice: 'Line was successfully updated.' }\n ...
57cf82b105993037acb727177cd97356
PUT /products/1 PUT /products/1.json
[ { "docid": "40b7e835e8e0ba59412ba35423fb6234", "score": "0.6542114", "text": "def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully update...
[ { "docid": "fa2eeaa45445dd76141374dc13ffab6d", "score": "0.7538245", "text": "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "title": "" }, { ...
a1818b619230d4f49f99bf47e1ac7e83
Base.base This method when included into Base provides an inheritable, overwritable configuration setting This should be a string with the base of the ldap server such as 'dc=example,dc=com', and it should be overwritten by including configuration.rb into this class. When subclassing, the specified prefix will be conca...
[ { "docid": "ed7b1ac32cfe881ac9dbbb4b1d499a41", "score": "0.670746", "text": "def base\n _base = base_inheritable\n _base = configuration[:base] if _base.nil? and configuration\n _base ||= base_inheritable(true)\n [prefix, _base].find_all do |component|\n component an...
[ { "docid": "f79f089347c55714b79e672630c637d4", "score": "0.6859359", "text": "def base_prefix\n Starter::Config.read[:prefix]\n end", "title": "" }, { "docid": "55f0c28b741e252d5650c87e7e6f1419", "score": "0.67881787", "text": "def base\n [location, Puppet[:ldapbase]].join...
f57bcf598448ca0c4d8a9893bf1bdc5b
GET /questions/new GET /questions/new.xml
[ { "docid": "08f77f5717240e1f39e91554a7a7f489", "score": "0.0", "text": "def reply\n if logged_in?\n if params[:reply]\n @reply = Question.new(params[:reply])\n @reply.correct_flag=0\n @reply.user_id = current_user.id\n @reply.save\n @user = current_user\n ...
[ { "docid": "8b6c857c015aaaaddd99492b6072ecc7", "score": "0.7706545", "text": "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @question }\n end\n end", "title": "" }, { "docid": "6cd0876445ce6081b71579...
c5d2e5a71683bf52d3a7e79610ca7b0a
POST /projects POST /projects.json
[ { "docid": "5d79c13cbf553756d6318b59ea25a848", "score": "0.0", "text": "def create\n @project = Project.new(project_params)\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: '新規プロジェクトを登録しました。' }\n format.json { render :show, status: :cre...
[ { "docid": "5b64ba9f9faea58bb5af65892c2ea3db", "score": "0.7589564", "text": "def post_new_project\n self.class.params\n options = {:body =>{:project=>\n {:title => @@params[\"title\"],\n :description => @@params[\"description\"]}}}\n self.class.post(\"/projects.json\", opti...
6189685baef7f18d138ef2a5944a1414
accept strings accepted by self, followed by strings accepted by newFA
[ { "docid": "dcd40dd2bbd0b1aa8c14bcd2bb9c6350", "score": "0.48171923", "text": "def concat! newFA\n\n iterate = 0\n\n \n while iterate < @final.keys.size\n add_transition(@final.keys[iterate], newFA.start,\"\")\n set_final(@final.keys[iterate], false)\n iterate += 1\n ...
[ { "docid": "114c89d19d7c6c37876a0fbc8eea6bb3", "score": "0.5697465", "text": "def accept_entered_text\n \n end", "title": "" }, { "docid": "a24527f661017721bc69356b3eea6e91", "score": "0.55114174", "text": "def accepts?(string)\n @final_states.include?( self << string )\n ...
63178aac5ad9bdd86da695d59f70df78
updates the book value of an asset
[ { "docid": "55e101a403aa9952629e15fa813a0211", "score": "0.65355295", "text": "def update_asset_book_value\n Rails.logger.info \"Updating book value for asset = #{object_key}\"\n\n if depreciable\n\n gl_mapping = general_ledger_mapping\n\n if depreciation_entries.count == 0 # add the ini...
[ { "docid": "8c91aec946d7de6b1e8e7e8509d0cf8b", "score": "0.66894686", "text": "def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n end", "title": "" }, { "docid": "041987f588ed5cb7ab0de0316c968a4b", "score": "0.6685153", "text": "def update\n @asset_...
87905093258b2ef2599d9daaf9fe71cc
Insert an element before or after another element in a list.
[ { "docid": "7f299a8aeca3552bdd8df49d04272788", "score": "0.0", "text": "def linsert(key, where, pivot, value); end", "title": "" } ]
[ { "docid": "d10ddbf9cee21e1ade1d0947223070c1", "score": "0.7240086", "text": "def insert_after(item)\n @succ = Element.new(@list, item, @succ)\n if @list.tail.equal?(self)\n @list.tail = @succ\n end\n end", "title": "" }, { "docid": "a08b537ff7e79a660eddd34cb4801cec"...
025de3151c9c43babcb88c1d66236936
method UI4 RegisterReceiver IP2MessageReceiver new_receiver [IN]
[ { "docid": "1c288a6e4714b3045d94d841d8423291", "score": "0.68553704", "text": "def RegisterReceiver(new_receiver)\n _invoke(14, [new_receiver], [VT_BYREF|VT_DISPATCH])\n end", "title": "" } ]
[ { "docid": "fa9e1b88c9c354a649e6f23b640fc81f", "score": "0.6781339", "text": "def RegisterReceiver(new_receiver)\n @ole._invoke(14, [new_receiver], [VT_BYREF|VT_DISPATCH])\n end", "title": "" }, { "docid": "5622156424b8bbf0dd6641f8b9fcb0b0", "score": "0.6182074", "text": "def _pu...
3f24e0fb95e22529c16a78e5384327c8
GET /base_statuses/1 GET /base_statuses/1.json
[ { "docid": "032393f3e7ea1be6ec8a1f0ea1bbe5ef", "score": "0.6283269", "text": "def show\n redirect_to base_statuses_url\n end", "title": "" } ]
[ { "docid": "d7149b0faacdf85960d261ed2a334a03", "score": "0.6884348", "text": "def get_statuses\n @statuses ||= get_request('/me/statuses')\n # I have no idea why sometimes it uses the data index and sometimes it doesn't....\n begin\n return @statuses['data']\n rescue\n return @stat...
4a114eaa48b613a05df44ce480f458ae
A helper method. All the names methods use it to interact with the named method
[ { "docid": "aabd11483a689b17b28c3bfb1cc4d217", "score": "0.0", "text": "def fetch(parent,method)\n\n\t\titem = @result[parent][method]\n\t\tif item != nil \n\t\t\treturn item\n\t\telse\n\t\t\treturn \"Error: Cannot find this field.\"\n\t\tend\n\n\tend", "title": "" } ]
[ { "docid": "3752c4796bd3e0cc6a3396ef4048c6c2", "score": "0.7236508", "text": "def method_name\n # SOME CODE\n end", "title": "" }, { "docid": "10becba3364b881dd72b1f26c66b4cdc", "score": "0.7229449", "text": "def method_name=(_); end", "title": "" }, { "docid": "1...
9f69081d68c1d5d752cca294cea96ec4
Insert a new node to the setOfNodes
[ { "docid": "360379ebcd8a69b013f982d55520e257", "score": "0.0", "text": "def visit_node(path, x, y)\n @setOfNodes << path + [[x, y]]\n end", "title": "" } ]
[ { "docid": "684b99fc0b069d2dda581e40453e5243", "score": "0.7579949", "text": "def insert(index, node)\n return if @nodes.include?(node)\n\n @nodes.insert(index, node)\n\n take_ownership(node)\n end", "title": "" }, { "docid": "d7b4840182e61ce7f0f898e3526e1747", ...
396186f9777add38a10844384ac23e76
Call the given block for each element which is yield by +each+. Return value is the sum of all block values. Pass to each block the current sum and the current element. ISO 15.3.2.2.11
[ { "docid": "755e814eec1a3fee692fe99492bd9528", "score": "0.0", "text": "def inject(*args, &block)\n raise ArgumentError, \"too many arguments\" if args.size > 2\n if Symbol === args[-1]\n sym = args[-1]\n block = ->(x,y){x.__send__(sym,y)}\n args.pop\n end\n if args.empty?\n ...
[ { "docid": "4ba07e5a640ece7bfc447187b50566dc", "score": "0.73033696", "text": "def sum_using_each(array)\n end", "title": "" }, { "docid": "7a7db426b2d83c1fb3a19ee24266ce99", "score": "0.7152341", "text": "def sum\n if block_given?\n inject(0) { |a,b| a+(yield b) }\n el...
cac9e64ad34d53d5d894e1e09c8b6f63
Build a configuration based on the resolved paths.
[ { "docid": "6cff65876ea782037fa71bb89aa2ef40", "score": "0.67464185", "text": "def configuration\n\t\t\t\tconfiguration = Configuration.new\n\t\t\t\t\n\t\t\t\tself.resolved_paths.each do |path|\n\t\t\t\t\tpath = File.expand_path(path)\n\t\t\t\t\t\n\t\t\t\t\tconfiguration.load_file(path)\n\t\t\t\tend\n\t...
[ { "docid": "316622571b7a3fce1f28985726be3497", "score": "0.63101816", "text": "def resolve\n options[:rootpath] ||= Pathname.pwd\n options[:rootpath] = Pathname.new(options[:rootpath])\n options[:encryption_key] = resolve_encryption_key(options[:encryption_key])\n options[:de...
cbf526338592ab42eea0f2c043be7288
Initialise the level 0 score for the user when first attempting a topic. As level 0 does not have any questions, a dummy record is created to grant users access to level 1.
[ { "docid": "a467a52560bbd310520db7c7761d898a", "score": "0.6858469", "text": "def initialiseScoreForTopic(topicID)\n topic = Topic.find(topicID)\n dummy = ScoreRecord.new(100, 'NULL')\n\n # Initialise the score hash for this topic \n scoresDictionary[topic.shortName] = [dummy]\n self.save...
[ { "docid": "247e6ef32d3a0818870b982d40b8079a", "score": "0.6741008", "text": "def prepareQuestions(topicID, level)\n self.currentScore = 0\n self.questionIDs = Topic.find(topicID).fetchQuestionIDsForLevel(level)\n self.save\n end", "title": "" }, { "docid": "e671b9b50ffc5d46b1d40b2...
b3d6d8268c60f2e22a5ecb254f424872
Include 'catalog' and 'hyrax/base' in the search path for views, while prefering our local paths. Thus we are unable to just override `self.local_prefixes`
[ { "docid": "22fe0e7fb897d0729e4067da56215105", "score": "0.68703467", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'hyrax/base']\n end", "title": "" } ]
[ { "docid": "52ae705d49eb819caddd4426cf2bb73d", "score": "0.6416093", "text": "def _prefixes\n @_prefixes ||= super + ['catalog', 'curation_concern/base']\n end", "title": "" }, { "docid": "e9a209128e2070269066b5b20829a01c", "score": "0.64150816", "text": "def _prefixes\n ...
de881aec7f1b72848bc18d66104799ed
n x n grid Has to be odd Input: odd integer Output: a pretty diamond made from strins Steps: 1: Defime a method that takes 1 argument (num) 2: Print out n diamons n times to start 3: print out 1 to n diamonds increasing by 2 everytime 4: print out n to 1 diamonds decreasing by 2 everytime 5: add white spaces before the...
[ { "docid": "6fc15d5e30ad5cb0c909be0dc79ecf05", "score": "0.7704144", "text": "def diamond(num)\n return puts \"*\" if num == 1\n \n counter = (num / 2)\n middle_space = 1\n \n puts \" \" * counter + \"*\"\n counter -= 1\n \n (num / 2).times do \n puts \" \" * counter + \"*\" + \" \" * middle...
[ { "docid": "850b72d8d9efee825646e3181cdf7778", "score": "0.7961012", "text": "def diamond(n)\n half_length = n/2\n diamonds_counter = 1\n spaces_counter = half_length\n \n loop do # grow diamond\n puts(\"#{' ' * spaces_counter}#{'*' * diamonds_counter}\")\n break if spaces_counter == 0\n d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6b25861a21b7be5fecdd36264fbce331", "score": "0.0", "text": "def profile_params\n params.require(:profile).permit(:user_id, :fname, :lname, :rank)\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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4f8ec6529b300584679b67c4b59dfef8", "score": "0.0", "text": "def help_params\n logger.debug(\"HelpsController.help_params: params: #{params.inspect}\")\n params.require(:help).permit(:name, :title, :description, :help_type)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981606", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6784227", "text": "def strong_params\n params.requi...
947a426fa5c5e778143536cee7c2ab31
PATCH/PUT /recommendation_types/1 PATCH/PUT /recommendation_types/1.json
[ { "docid": "613121e91e29194747f7cac8d66855a5", "score": "0.74606043", "text": "def update\n respond_to do |format|\n if @recommendation_type.update(recommendation_type_params)\n format.html { redirect_to @recommendation_type, notice: 'Recommendation type was successfully updated.' }\n ...
[ { "docid": "b27f9c98a4947a291623d43e0d3ae21e", "score": "0.65420115", "text": "def update\n @beverage = Beverage.find(params[:id])\n\n respond_to do |format|\n if @beverage.update_attributes(params[:beverage])\n #monkey patch for changing type\n type = params[params[:type].downc...
5959c57edb50561751f81210d4012f6e
Add an ingress rules to this security group. Ingress rules permit inbound traffic over a given protocol for a given port range from one or more souce ip addresses. This example grants the whole internet (0.0.0.0/0) access to port 80 over TCP (HTTP web traffic). security_group.authorize_ingress(:tcp, 80) You can specify...
[ { "docid": "b57f62f6ece2195da27a8e9e0a9371aa", "score": "0.7102832", "text": "def authorize_ingress protocol, ports, *sources\n parse_ingress_sources(sources) do |options|\n permission = IpPermission.new(self, protocol, ports, options)\n permission.authorize\n permissio...
[ { "docid": "a9683fc288fa7c9c562fb1783a435680", "score": "0.7497632", "text": "def authorize_ingress protocol, ports, *sources\n permissions = format_permission(protocol, ports, sources)\n client.authorize_security_group_ingress(\n :group_id => id,\n :ip_permissions => per...
d87f651134892200869e7106b19570ab
Get text from an article file
[ { "docid": "12fa90eb6bdf753deac1da518adf6372", "score": "0.5660038", "text": "def get_tags_n_text_from_article(article_id)\n s = resolve_redirects_n_read(article_id)\n return [[], nil] if s.nil?\n\n s = \"<article>\" + s + \"</article>\"\n reader = Nokogiri::XML::Reader(s)\n text = \"\"\n...
[ { "docid": "2f79356ff840729bda754b80234a9c42", "score": "0.7489209", "text": "def fetch_text(article_url)\n\t\trequire 'open-uri'\n\t\ttext = \"\"\n\t\tfile = open(article_url)\n\t\tcontents = file.readlines\n\t\tcontents.each do |line| \n\t\t\tif line =~ /<p[^>]*>/\n\t\t\t\tline.slice!(/<p[^>]*>/)\n\t\...
edc28b661176ac3e4275c7cb6e2b8345
PATCH/PUT /group_items/1 PATCH/PUT /group_items/1.json
[ { "docid": "c768937ab0c9d057b7a9fd581912d2b7", "score": "0.73110455", "text": "def update\n respond_to do |format|\n if @group_item.update(group_item_params)\n format.html { redirect_to @group_item, notice: 'Group item was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "c1f5f9d7a2e7772622f79a5ef8b24869", "score": "0.720279", "text": "def update\n @item_group = ItemGroup.find(params[:id])\n redirect_to root_path unless @item_group.user == request.user\n\n respond_to do |format|\n if @item_group.update_attributes(params[:item_group])\n fo...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d5c1749b0052ce3759731726bcde3464", "score": "0.0", "text": "def set_api_v1_menu\n @api_v1_menu = Menu.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;...
9c5e1595d591169719006000a783b703
aur's info rpc url for the given array of package names.
[ { "docid": "50cd3513844042713551f363c77dd02f", "score": "0.6743089", "text": "def url_for_info(terms)\n require 'cgi'\n\n 'http://aur.archlinux.org/rpc.php?type=multiinfo' +\n terms.collect { |t| '&arg[]=' + CGI::escape(t) }.join\n end", "title": "" } ]
[ { "docid": "2ad5fefad9d34016a4cb58ab9ca7c224", "score": "0.6108035", "text": "def package_info_command(*args)\n Licensed::Shell.execute(\"go\", \"list\", \"-e\", \"-json\", *Array(args)).strip\n end", "title": "" }, { "docid": "3c4beb153260476480c2a053b0695a34", "score": "0.5...
09ad74d29ce954799a41efda1b5266df
Unpacks dash +pattern+ arguments to Ruby objects.
[ { "docid": "e8617a4e40c16cc2aec7a4a7d45d3fe0", "score": "0.61829084", "text": "def dash_pattern(*pattern)\n pattern.map { |value| value.value }\n end", "title": "" } ]
[ { "docid": "f51041c67786a1fe7df74e525a1d3684", "score": "0.6296769", "text": "def unpacker(*args)\n end", "title": "" }, { "docid": "f86666f107eb67accb8a4f90a111376e", "score": "0.624185", "text": "def initialize(*patterns); end", "title": "" }, { "docid": "2a9b58ed633...
d4857d53fb4cf0bc0aa35b1ad8d6436d
This will actually build the result. It will return a filled Hash if successful, or raise an exception, An optional block passed can be used for error reporting
[ { "docid": "4312e4d1add6d01ce7626ff3b088f31c", "score": "0.0", "text": "def call\n begin\n build\n rescue => error\n raise ParseParamsError, error.message\n end\n end", "title": "" } ]
[ { "docid": "41b09dd3a9b74b25bc4e57bcfc2db550", "score": "0.681825", "text": "def create_hash(&block); end", "title": "" }, { "docid": "41b09dd3a9b74b25bc4e57bcfc2db550", "score": "0.681825", "text": "def create_hash(&block); end", "title": "" }, { "docid": "1cecf4a0f2145d...
8fa2a937ba8991b3b2ab93793735a0fb
DELETE /criterions/1 DELETE /criterions/1.json
[ { "docid": "ee369c05bbe0021420f857f6b9982908", "score": "0.68275326", "text": "def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end", "title": "" } ]
[ { "docid": "8135b87b66b7fa7568639329873b1e00", "score": "0.71683717", "text": "def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end", "ti...
51730a36359664960ed07c7836d23f47
Mock assert_nothing_raised for now See
[ { "docid": "fbbed579143eb37c52bfc84e049642ac", "score": "0.77795804", "text": "def assert_nothing_raised(*args, &block)\n yield if block_given?\nend", "title": "" } ]
[ { "docid": "af4764247d3eadaf2d731b4209ba74b6", "score": "0.8838673", "text": "def assert_nothing_raised; end", "title": "" }, { "docid": "d936b24b94f4fcd1f63d5ccadb927573", "score": "0.82557803", "text": "def assert_nothing_raised\n yield\n end", "title": "" }, { "doc...
6334fb61682a9f3aabb51ac9568de32c
Create a new instance image_id > Image to use for instance creation (img1, ami12345, etc...) create_opts > Various options that DC support for the current provider. Returns created instance, or list of created instances or all instances.
[ { "docid": "e27739106904490b2701e661bbd16c79", "score": "0.7454908", "text": "def create_instance(image_id, create_opts={})\n create_opts[:user_data] = Base64::encode64(create_opts[:user_data]) if create_opts[:user_data]\n r = create_resource :instance, create_opts.merge(\n :image...
[ { "docid": "1700ffa84ae228d95c0cb9979b50d8c5", "score": "0.7549355", "text": "def create(opts={}, &each_inst)\n raise NoAMI unless opts[:ami]\n raise NoGroup unless opts[:group]\n \n opts = {\n :size => 'm1.small',\n :min => 1,\n :max => nil\n ...
35bcb9654c9fa2f8db71731df59d8d83
Returns a Permission based on the supplied capabilities. Example: p = Permission.for :read, :write p.capabilites => [:read, :write]
[ { "docid": "783350780470ee13286d0b659fe05cd7", "score": "0.0", "text": "def for *args\n new bitmask_for(*args)\n end", "title": "" } ]
[ { "docid": "06d355ddd1246d86c8efeb56f6a67870", "score": "0.6543288", "text": "def permissions(role, capabilities)\n if capabilities.is_a?(Array)\n capabilities.map do |c|\n {\n :capability => c,\n :role => role\n }\n end\n else\n [\n {\n ...
1b46b1b343f0fee9cba64360f776ea61
Further Exploration The Arrayzip method can be used to produce an extremely compact solution to this method. Read the documentation for zip, and see if you can come up with a one line solution (not counting the def and end lines).
[ { "docid": "009f8d49264147ff3eb6d9dc2a5fe191", "score": "0.0", "text": "def multiply_list(arr, arr1)\n arr.zip(arr1).map {|a, b| a.send(:*, b)}\nend", "title": "" } ]
[ { "docid": "0ec9dcef7d7d3d3a9e189180133d1d9c", "score": "0.8158103", "text": "def zip(*arr)\n (0...arr[0].length).map do |i|\n arr.map {|arr| arr[i]}\n end\nend", "title": "" }, { "docid": "6bc1ef7869736c259a92adfd15fb827c", "score": "0.8133222", "text": "def zip(arr1, a...
ea5eeecd2355057ca9505c3de945acc7
This method is called to create a less than (<) condition for this column.
[ { "docid": "efc0cbde568638939ae0cae5f9899e2d", "score": "0.790576", "text": "def lt(value)\n SqlCondition.new(column: to_s, comparison: '<', value: value)\n end", "title": "" } ]
[ { "docid": "4b99b3e4a3f8b7df12a263a4a7c2b3a5", "score": "0.779035", "text": "def lte(value)\n SqlCondition.new(column: to_s, comparison: '<=', value: value)\n end", "title": "" }, { "docid": "4ae77ce47d9ef281012ee2854277c79d", "score": "0.76480436", "text": "def less_than(att...
c6e239ac407f8efdecba7b222eaffb2d
Getter: Builds an array of vlan forward time commands currently on the device. cli: spanningtree vlan 142 forwardtime 19 spanningtree vlan 30003700 forwardtime 13 array: [['142', '19'], ['30003700', '13']]
[ { "docid": "9e6742886fbbd9bc074f0cd4e839e57c", "score": "0.5738997", "text": "def vlan_forward_time\n config_get('stp_global', 'vlan_forward_time')\n end", "title": "" } ]
[ { "docid": "64fa9320e8e519536d53eaf56b949ecd", "score": "0.50910854", "text": "def convert_command(array_command)\n length = array_command.length\n string_command = ''\n (0..length-1).each {|i| string_command = string_command + ' ' + array_command[i]}\n string_command\nend", "title": "" }, {...
484e2c9563f4e426afa13d76effb9831
This method tails this file and yields to the given block for every new line that is read. If no block is given an array of those lines is returned instead. (In this case it's better to use a reasonable value for n or set the return_if_eof or break_if_eof attribute to a true value to stop the method call from blocking....
[ { "docid": "146b0790983a4c1796f09d210e2b8642", "score": "0.77300894", "text": "def tail(n = nil, &block) # :yields: line\n @n = n\n result = []\n array_result = false\n unless block\n block = lambda { |line| result << line }\n array_result = true\n end\n prese...
[ { "docid": "5b54d861992fedb2f6753c8df93015b3", "score": "0.7730974", "text": "def tail(n = nil, &block) # :yields: line\n @n = n\n result = []\n array_result = false\n unless block\n block = lambda { |line| result << line }\n array_result = true\n end\n preset...
39d49146902cfe3b7bb806336fa0454a
if tiles is in a hash map...
[ { "docid": "5da03dd855a8d98676d22293e69b28ca", "score": "0.0", "text": "def constant_dance(dir, new_tiles_data_structure)\n new_tiles_data_structure[dir]\nend", "title": "" } ]
[ { "docid": "2666d571fccc5e577201cb30361a3493", "score": "0.6288795", "text": "def tile_exists_at? position\n c = get_map_cell position\n c[0] >=0 and c[0] <@width-1 and c[1] >=0 and c[1] <=@height-1\n end", "title": "" }, { "docid": "e8b1711f644551b82aeeb0bdec5bc076", "score": "0....
4ce74b4b109e818f1fa22a5e74c0459b
checking difference calculated distinct sentences
[ { "docid": "ea9910b02fd31af5b22ec983eea95a9c", "score": "0.6181205", "text": "def test_sentence_similarity7\n text1 = [\"This is funny.\"] \n text2 = [\"He played the guitar.\"]\n subm_text = Array.new\n subm_text << text1\n subm_text << text2\n #setting up sentences and similarities b...
[ { "docid": "5456c212c1037aa4d3de09f361eb99de", "score": "0.65909076", "text": "def uncommon_from_sentences(a, b)\n word_counts = Hash.new(0)\n\n a_words = a.split\n b_words = b.split\n\n a_words.each do |word|\n word_counts[word] += 1\n end\n\n b_words.each do |word|\n wo...
4435b24ff7ecf76c91b73cb95fe8885a
the password must contain at least one upper case letter
[ { "docid": "5f7fdb95def9ebec5a92d7ed34ec9975", "score": "0.70263165", "text": "def test_uppercase\n\n pw1 = \"test1test\"\n pw2 = \"Test2test\"\n\n assert_equal(false, StringChecker.is_safe_pw?(pw1))\n assert_equal(true, StringChecker.is_safe_pw?(pw2))\n end", "title": "" } ]
[ { "docid": "0f149ad6c584763f3e7ccddc5656af2f", "score": "0.7706356", "text": "def is_password_password(pass)\n if pass.downcase == 'password'\n 'Sorry, password cannot be password.'\n else\n 'Yay, password is not password.'\n end\nend", "title": "" }, { "docid": "fae45dae6a17e06afd8...
17c7006a0f6da753610e27639a6cf55b
Generate Solr facet values and counts, applying sort, prefix and offset.
[ { "docid": "237cbf53a577180c9a514ccdb8348667", "score": "0.6303567", "text": "def solr_facets(facet_id = 'all')\n\n # Convert facet pagination parameters into a useful form, ensuring that\n # non-applicable parameters are *nil*. (Facets arrive in the order\n # specified by `@facet_sort == 'cou...
[ { "docid": "1f9903c55f9724110d41a125cf5fba87", "score": "0.6942282", "text": "def facet_field_aggregations\n results = super\n\n xfacet_field_names = blacklight_config.facet_fields.select { |k,v| v.xfacet }.keys\n\n results_xfacets = list_as_hash(facet_fields.select { |k,v| xfacet_field_n...
4e8bc063c38148d61f980e8d9ffef0e5
check the urls for a valid prefix, and if append http:// if necessary
[ { "docid": "b7fa9c162bb58cb9b6cdd0b4c842b41b", "score": "0.65611905", "text": "def prepend_urls \n unless check_url(self.homepage_url)\n self.homepage_url = \"http://#{self.homepage_url}\"\n end\n unless check_url(self.source_url)\n self.source_url = \"http://#{self.source_url}\"\n...
[ { "docid": "8a816669f15584035afda78ec0c80b6c", "score": "0.7565582", "text": "def url_with_prefix\n\t\t( url.blank? ) ? '' :\n\t\t\t( url.match(/^http(s)?:\\/\\//) ? url : \"http://#{url}\" )\n\tend", "title": "" }, { "docid": "6f4b5d84da4bbe154507dc6fd29f9719", "score": "0.7072627", ...
f7b168a9be3d405c33a5dfdbe6f6c37f
Instructs Vedeu to calculate x and y geometry automatically based on the centre character of the terminal, the width and the height.
[ { "docid": "042b8766a829262d1ded32780a810bb3", "score": "0.0", "text": "def centred(value)\n attributes[:geometry][:centred] = value\n end", "title": "" } ]
[ { "docid": "09099f51eb0775885e298bb72479ab1c", "score": "0.6062413", "text": "def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end", "title": "" }, { "docid": "319c8708b5e787a9035abc05b190ecdd", "score": "0.5955157"...
29c9d6069be2d73456bc36f404d05777
Returns a symbol representation of this blank node.
[ { "docid": "6b112c4d7d0f134a1572c641fc6207a4", "score": "0.0", "text": "def to_sym\n @id.to_s.to_sym\n end", "title": "" } ]
[ { "docid": "d5a59e69358a4a0e585b2c9c61c7a168", "score": "0.6847117", "text": "def to_s\n return self.symbol\n end", "title": "" }, { "docid": "7f18ad7ef3fa1f4addb166b6c04ac38a", "score": "0.671597", "text": "def to_symbol\n case node\n in SyntaxTree::Label[value...
54106d64eefa1d85340546caf677a931
Generates a Fixnum hash value from the given `args`
[ { "docid": "b9990bf7495e2a3659bdad2d265f0d27", "score": "0.5284258", "text": "def _key(*args); args.hash; end", "title": "" } ]
[ { "docid": "6f84577f92341f2c2913e2e234b41305", "score": "0.7228262", "text": "def generate_hash(*args)\n Digest::SHA3.hexdigest(args.join(''))\n\n end", "title": "" }, { "docid": "1c4c15009a8f8315b04b540af94a71d3", "score": "0.72163266", "text": "def generate_hash(*args)\n ...
827d9ef0bad8e4a522cf794f92bf70c2
Converts an Array object to a Scheme list structure.
[ { "docid": "c345a39212f857e5f4c58dfc7f2c6b73", "score": "0.66992575", "text": "def rb2scm_list(array)\n if array.nil?\n SCM_EMPTY_LIST\n else\n m = Rubeme.method(:rb2scm)\n scm_make_list(*array.map(&m))\n end\n end", "title": "" } ]
[ { "docid": "4057f6eca0e6086d5f34916b593d42ff", "score": "0.6018379", "text": "def arrayize(object)\n return [] if object.nil?\n return object.is_a?(Array) ? object : [object]\n end", "title": "" }, { "docid": "ac75ad97f5731ecaca0213dfdc895711", "score": "0.5900978", "tex...
ad8b9bc6da2d434a2550f63ccfcd46d4
PUT /survey_question_items/1 PUT /survey_question_items/1.json
[ { "docid": "5fcba6edb9ef6328613ae213c7c484e7", "score": "0.73003095", "text": "def update\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n\n respond_to do |format|\n if @survey_question_item.update_attributes(params[:survey_question_item])\n format.html { redirect_to @s...
[ { "docid": "496c2796ef049221622ff21443bd82d3", "score": "0.7179379", "text": "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = ...
c3427203280419777272f2f9f6beaf51
create a like for the current user
[ { "docid": "9e750274af15dbbb16e8e3639bf7afff", "score": "0.6804537", "text": "def create\n params[:like][:channel_id] = current_user.channel.id\n @like = Like.new(like_params)\n\n if @like.save\n render :show\n else\n render json: @like.errors.full_messa...
[ { "docid": "24443890510ab2e3161d2046be33b371", "score": "0.81205815", "text": "def like!(user)\n @like = likes.create!(user_id: user.id)\n end", "title": "" }, { "docid": "a085657e0a53a05adc0b06462a182d6b", "score": "0.8016369", "text": "def like\n like = current_user.like...
45a68ec48964f7db66be51832e3bf4c0
Internal: Return Array of Strings, where there are separators between each string.
[ { "docid": "88b74b8239ce707cc4c42a83eaa47973", "score": "0.0", "text": "def to_a\n extracted_children = children.map { |c| c.respond_to?(:to_a) ? c.to_a : c }\n extracted_children.zip(Array.new(children.length, separator)).flatten[0..-2]\n end", "title": "" } ]
[ { "docid": "c5627407566740b0e3cb5326c90082ac", "score": "0.6609526", "text": "def custom_delimiters\r\n\t\toutput = []\r\n\t\toutput << input.split(\"]\\n\").first[3..-1].split(\"][\") if input.start_with?('//')\r\n\t\toutput.flatten\r\n\tend", "title": "" }, { "docid": "a0f67e30807bc6d17d36...
ed23659ede73e93156c16bc3961db08d
provide the block that shows the URL to the resource, including the version if it is a versioned resource label is based on the application name, for example FAIRDOMHUB ID:
[ { "docid": "410b2178211871ec72a95007da81fbe8", "score": "0.0", "text": "def persistent_resource_id(resource)\n # FIXME: this contains some duplication of Seek::Rdf::RdfGeneration#rdf_resource - however not every model includes that Module at this time.\n # ... its also a bit messy handling the ver...
[ { "docid": "2fed5efefc8d965770b050ac045b437a", "score": "0.614972", "text": "def url(version_name = \"\")\n @url ||= super({})\n version_name = version_name.to_s\n return @url if version_name.blank?\n # if not version_name.in?(IMAGE_UPLOADER_ALLOW_IMAGE_VERSION_NAMES)\n # # To protected...
bb6ca3ac7623feb44352b8ed3fc7b794
DELETE /promotional_codes/1 DELETE /promotional_codes/1.xml
[ { "docid": "69420e53b69402da63dd9a835b25b6c4", "score": "0.744336", "text": "def destroy\n @promotional_code = PromotionalCode.find(params[:id])\n @promotional_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotional_codes_url) }\n format.xml { head :ok }\n ...
[ { "docid": "3a4d89abd813e8b977f0c0c21f861fba", "score": "0.67915493", "text": "def destroy\n @promotion1 = Promotion1.find(params[:id])\n @promotion1.destroy\n\n respond_to do |format|\n format.html { redirect_to(promotion1s_url) }\n format.xml { head :ok }\n end\n end", "tit...
04bede481e7704e8a76df6d6d00123f2
POST /glues POST /glues.xml
[ { "docid": "99557f796aba2136a74b2b08ecb38cb8", "score": "0.0", "text": "def create\n @glue = Glue.new(params[:glue])\n\n if @glue.save\n render :template => 'shared/close', :layout => \"fancybox\"\n else\n render :action => \"new\"\n end\n end", "title": "" } ]
[ { "docid": "1cf33a61b1585900ac001766ea661af4", "score": "0.55079067", "text": "def post!\n request = Net::HTTP::Post.new(uri)\n request.body = @params.to_json\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end", "title": "" }, { "docid": "ad...
382dd39f13f32f27984403d10e57f6ca
calcula importancia de um territorio
[ { "docid": "cf28ad283171b2cd40af58241ee14a69", "score": "0.68298036", "text": "def importancia(t)\n #fórmula para calculo de importancia\n ### quantidade de vizinhos dominados pelo inimigo + funcao impedeConquista\n ### se essa soma for 0, então usa a fórmula: \n ### (distancia do inimigo ma...
[ { "docid": "107cabf4964e388a4994d863636f5983", "score": "0.63153696", "text": "def get_importe_cancelar_hipoteca()\n \n \n cantidad_recibida = (@precio_hipoteca_base*(1+(@num_casas*0.5)+(@num_hoteles*2.5)));\n return cantidad_recibida*@@FACTORINTERESESHIPOTECA;\n \n end", "title": ""...