query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f0f09946dae13d8fa7dbd161c5691b5f
Start or restart the task passed to the constructor
[ { "docid": "61dae7422b8048520f35839ed04c3a79", "score": "0.5985489", "text": "def start_task\n @dynflow = ProxyAPI::ForemanDynflow::DynflowProxy.new(:url => @smart_proxy.url)\n # https://github.com/theforeman/smart_proxy_remote_execution_ssh#usage\n action_input = {\n \"t...
[ { "docid": "5d886bc5a7e661b38c6946cd8f0e0209", "score": "0.7143794", "text": "def start(task)\n @tasks[task].start\n end", "title": "" }, { "docid": "36b3dae901ea277a2c1748349236e802", "score": "0.7117066", "text": "def restart!\n stop! if running?\n start...
3d6368771a085d7f7e50c1be854bc544
Implement the calculate_word_frequency() method to: calculate the maximum number of times a single word appears within provided content and store that in the highest_wf_count attribute. identify the words that were used the maximum number of times and store that in the highest_wf_words attribute.
[ { "docid": "030eae2307c9891401cc4c9cd6199129", "score": "0.7114597", "text": "def calculate_word_frequency\n puts \"calculate_word_frequency called\"\n#Ok, tänkte att göra det i en hash table. initiera till 1 om hittar ett ord som inte redan finns annars plussa med ett.\n\n#sedan hitta ordet med högs...
[ { "docid": "a64a76d070886194a32a10db5b29cc93", "score": "0.80292493", "text": "def calculate_word_frequency\n # not a class method, it is used to poulate what are essentially properties on an instance of the class\n #word_frequency = @content.split(\" \").each_with_object(Hash.new(0)) {|word,count...
2918a75608cf5a4a1e622e1fce62c045
PUT /shoppings/1 PUT /shoppings/1.json
[ { "docid": "a773567ba5d3f88194185d0ecd25f50f", "score": "0.6959751", "text": "def update\n @shopping = Shopping.find(params[:id])\n\n respond_to do |format|\n if @shopping.update_attributes(params[:shopping])\n format.html { redirect_to shoppings_url, notice: 'Shopping was successfully...
[ { "docid": "1361562d590e71045160c1f541144553", "score": "0.70315415", "text": "def update\n if @shop.update(shop_params)\n render json: @shop\n else\n render json: @shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "e4d0b44d4c05043b141ab85...
7e682460d654777b82a888d109882afa
Build our strategies from the configuration file
[ { "docid": "4673014877f0f0407499282c35ec5cd4", "score": "0.6311587", "text": "def build_strategies\n @dial_strategies = Array.new\n @config[\"dial_strategies\"].each do |strategy|\n instructions = \"send_dtmf=\" + strategy[\"send_dtmf\"].to_s\n instructions = instructions + \"|before_del...
[ { "docid": "17a0b3e7986320f67436ea286d8357c4", "score": "0.6145646", "text": "def load_strategies_from(dir_name)\n glob_exprs = [File.join(\"#{dir_name}**/**\", \"*.str\"), File.join(\"#{dir_name}**/**\", \"*.str.rb\")]\n glob_exprs.each do |expr|\n Dir.glob(expr).entries.each do |f|\n ...
3b8851753abace78ac7d99f7e44b39b2
Method filter issues, that belong only specified tag range
[ { "docid": "7b175cd469874ccac07551187e46df20", "score": "0.0", "text": "def delete_by_time(issues, hash_key = \"actual_date\", older_tag = nil, newer_tag = nil)\n # in case if not tags specified - return unchanged array\n return issues if older_tag.nil? && newer_tag.nil?\n\n older_tag = e...
[ { "docid": "b55981055485b49c158f7622a24758e5", "score": "0.76319796", "text": "def filter_issues_for_tags(newer_tag, older_tag); end", "title": "" }, { "docid": "a46fc653d73e09ea82f1965e4b7536f7", "score": "0.6896141", "text": "def filter_by_tag(issues, newer_tag = T.unsafe(nil)); en...
d3509cc7b1750684a5bb43fb5cf26660
returns the number of vertices in the graph
[ { "docid": "6be13ca39e76564d00f1a28a80c7416a", "score": "0.77106804", "text": "def size\n @vertices.size\n end", "title": "" } ]
[ { "docid": "bffd13109cd2ce714dd9c81352fb819d", "score": "0.8984958", "text": "def vertex_count\n vertices.size\n end", "title": "" }, { "docid": "ab513a263864af1bc7b11f7f7e43100f", "score": "0.89652455", "text": "def vertex_count\n @vertices.size\n end", "title": "" ...
ac47ebe23dfce07ec244cee4c709eb23
Parse directory for todo items.
[ { "docid": "c8bf9a85085efb9c253e8ccc8554e866", "score": "0.5595213", "text": "def parse_dir(dir)\n Dir[\"#{dir == '.' ? '.' : dir}/**/*\"].each do |file|\n parse_file(file) if File.file?(file)\n end\n end", "title": "" } ]
[ { "docid": "53757340ad5aadd85531a9fd4fcedc16", "score": "0.64303666", "text": "def parse_todo\n return unless todo_comment?\n\n list_obj = @kram_obj.detect {|obj| obj.type == :ul }.children\n # list_obj.first.children[0].children[0].value.chomp\n list_obj.each do |obj|\n title...
cc87eaab813e181234ca08560387c71b
POST /toeic_logs POST /toeic_logs.json
[ { "docid": "9b1d1adf8f60327af7d1edc8f984859d", "score": "0.67085296", "text": "def create\n @user = current_user;\n @toeic_log = ToeicLog.new(params[:toeic_log])\n\n respond_to do |format|\n if @toeic_log.save\n format.html { redirect_to @toeic_log, notice: 'Toeic log was successful...
[ { "docid": "de0d6a812487e0c6d9ed65c7880b7616", "score": "0.6571892", "text": "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "title": "" }, { "docid": "e2f6b610107effa2a185a79573b9e81a", "score": "0.65565777", "text": "def create\n # If th...
e3b91edef95f86b8d7cb683f41edf7e0
POST /admin/sponsors POST /admin/sponsors.xml
[ { "docid": "7f8f921bac109885c753b0474afe8b4c", "score": "0.67508113", "text": "def create\n @sponsor = Sponsor.new(params[:sponsor])\n\n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to(admin_sponsor_path(@sponsor), :notice => 'Sponsor was successfully created.') }...
[ { "docid": "a12893e8459da35c004431b16d028a7a", "score": "0.689313", "text": "def create\n @sponsor = @event.sponsors.build(params[:sponsor])\n \n respond_to do |format|\n if @sponsor.save\n format.html { redirect_to([@event, @sponsor], :notice => 'Sponsor was successfully created.')...
8dd32c3a40549d516e388b853be57bc0
Repeated Number Ranges Given a list of numbers, give the start and end indices each time a number shows up multiple times in a row.
[ { "docid": "3c6b84ec65fd027fb0d7fd5cc8218a89", "score": "0.76679415", "text": "def repeated_number_ranges(numbers)\n result = []\n current = numbers[0]\n first_idx = 0\n\n numbers.each_with_index do |num, idx|\n next if idx == 0\n\n if num != current\n result << [first_idx, idx - 1] if id...
[ { "docid": "dcee432aef0924424f4afac24d1f2da9", "score": "0.82497436", "text": "def repeated_number_ranges(numbers)\n ranges = []\n start_index = nil\n numbers.each_index do |i|\n if numbers[i] == numbers[i + 1]\n start_index = i unless start_index\n elsif start_index\n ranges.push([st...
d0df87b1bea9b55706b1c7c4184cdaba
PATCH/PUT /posts/1 PATCH/PUT /posts/1.json
[ { "docid": "d74e90efa32778b0b355a95a18ea95ba", "score": "0.0", "text": "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: t('.notice') }\n format.json { render :show, status: :ok, location: @post }\n else\n for...
[ { "docid": "34c10c4557f689baa30ce671828a8692", "score": "0.7020792", "text": "def update\n @api_v1_post = Post.find(params[:id])\n params[:post].delete :created_at\n params[:post].delete :updated_at\n respond_to do |format|\n if @api_v1_post.update_attributes(params[:post])\n for...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "a6d788c48dbab4e69ba30b42bbf86d7c", "score": "0.0", "text": "def coin_params\n params.require(:coin).permit(:coin_api_id, :name, :symbol)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
559ab8fd087281864c135e26ef33a626
PUT /aadts/1 PUT /aadts/1.json
[ { "docid": "015a1aa59de621a9ee9c7c83a6265201", "score": "0.66078204", "text": "def update\n @aadt = Aadt.find(params[:id])\n\n respond_to do |format|\n if @aadt.update_attributes(params[:aadt])\n format.html { redirect_to @aadt, notice: 'Aadt was successfully updated.' }\n forma...
[ { "docid": "7cbcb2cda6e100042f124dacd474f3be", "score": "0.6234819", "text": "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "010282a631a3a4255ebda1499e856c98", "score": "0.6222629", "text": "def update\n ...
361334103642d99e6d29ff17c0987249
A Batch is considered complete when no jobs are pending or the only pending jobs have already failed. Any child batches must have also completed.
[ { "docid": "ea124d56cb4e22a875cf6a7de8b4dbd2", "score": "0.65507245", "text": "def complete?\n pending == failures && (child_count == 0 || child_count == @completed)\n end", "title": "" } ]
[ { "docid": "08bb0bb5b22ea7a701bf59425bcf1090", "score": "0.6182194", "text": "def batch_finished\n end", "title": "" }, { "docid": "94031429ba448187cc1152cf335a9c63", "score": "0.61481744", "text": "def complete\n # check that is not already complete\n if self.state != COM...
c0c6f2a390a0e53becf97e6a94fd2b3d
Mark order as rejected
[ { "docid": "56a1f353bd4b474eb747269520b3c73c", "score": "0.6968169", "text": "def reject#!(user = nil)\n run_callbacks :rejection do\n # self.rejected_at = Time.now\n # self.rejecter = user if user\n self.status = 'rejected'\n save!\n # order_items.each(&:reject!)\n # de...
[ { "docid": "c340b5858ce07fd1954d22123941a41f", "score": "0.7306152", "text": "def request_mark_as_rejected\n begin\n self.status = MARK_REJECTED\n self.rejected_on = Time.now.to_date\n self.save!\n rescue\n return false\n end\n return true\n end", "title": "" }, ...
a134246016d4070b794ab43f48e340e0
GET /hairstyles or /hairstyles.json
[ { "docid": "500017856099a71cd59253eb043ef5d9", "score": "0.7320118", "text": "def index\n @hairstyles = Hairstyle.all\n end", "title": "" } ]
[ { "docid": "86e4bc8c8f937dc888d5f5d77f3a362c", "score": "0.7182205", "text": "def show\n @hairstyle = Hairstyle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hairstyle }\n end\n end", "title": "" }, { "docid": "2d...
7bb1e081c66ec0b48516c606d4b0a961
Take a coeff and an exponent and return the string representation, ignoring the sign of the coefficient.
[ { "docid": "d0a16521e42d15a7fdcd3d7ee7c45134", "score": "0.8418949", "text": "def term_to_str(coef, exp)\n ret = \"\"\n\n # Show coeff, unless it's 1 or at the right\n coef = coef.abs\n ret = coef.to_s unless coef == 1 && exp > 0\n ret += \"x\" if exp > 0 ...
[ { "docid": "34061a4ddecf8e3c439401c1d678f0df", "score": "0.7611728", "text": "def to_s\n output =''\n\n exponent = @coefficients.size-1\n\n @coefficients.each do |coefficient|\n new_term = Polynomial.render_term(coefficient, exponent)\n\n if !new_term.blank? # skip empty terms\n ...
85d985f32c5cee1d00ff0100d142f7cd
Goes through (at most) 20 most recent receipts and returns top 5 search tags or however many are available.
[ { "docid": "3fe0f7d6a655e3427e815836302c48fb", "score": "0.6466921", "text": "def recommended_search_tags(id)\n receipts = Receipt.where(buyer_id: id).order(\"created_at DESC\").limit(20)\n search_tags = {}\n receipts.each do |receipt|\n receipt.item_tags.each do |tag|\n if search_t...
[ { "docid": "8ea0ec5d7ee10153e16f82529b90706c", "score": "0.6496072", "text": "def get_top_items(n: 10)\n items = Item.all.sort_by { |item| [item.rating * (item.reviews.length > 2 ? 1 : 0), item.reviews.length] }\n items.reverse!\n items[0..n]\n end", "title": "" }, { "docid": "22c0...
f6ebea78355a10c22d75e43078a25221
Get the tags associated with this model class This can be chained such as User.documents.tags
[ { "docid": "5193ba0aa6f580a08968be52a86525cf", "score": "0.6482609", "text": "def tags(options = {})\n # Grab the current scope\n self_ids = self.select(:id)\n\n # Grab table name\n table_name = self.to_s\n\n # Make sure that our context will be an array.\n cont...
[ { "docid": "36bdb481d6be054bd773cd960d3c2a46", "score": "0.7861059", "text": "def tags\n return @tags\n end", "title": "" }, { "docid": "36bdb481d6be054bd773cd960d3c2a46", "score": "0.7861059", "text": "def tags\n return @tags\n end...
39c65900759e53ef8ab6178f780bed27
convert ruby to JS, sending results to target Controller
[ { "docid": "c1f4f40c962a1401286a5163c6624eac", "score": "0.0", "text": "def convert()\n return unless targets.size > 0 and @rubyEditor and defined? Ruby2JS\n parsed = document.getElementById('parsed')\n filtered = document.getElementById('filtered')\n\n parsed.style.display = 'none' if parse...
[ { "docid": "e60eb0254422373ae81045fb07cb283b", "score": "0.71799606", "text": "def to_js; end", "title": "" }, { "docid": "e60eb0254422373ae81045fb07cb283b", "score": "0.71799606", "text": "def to_js; end", "title": "" }, { "docid": "b2f005eb509f963461cad66c0e6b41bc", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "37d574c20393d3d12b45517f82ba927d", "score": "0.0", "text": "def line_item_params\n params.require(:line_item).permit(:quantity, :listing_id).merge(:cart_id => @cart.id)\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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "991c65f11c44b9542d376f7ab432d23f", "score": "0.0", "text": "def portal_attachment_params\n params.require(:portal_attachment).permit(:filename, :guid)\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...
4011e6ef70a1f3872a2b1efaf4de1681
Takes a hash of defaults and a hash of requirements, and assigns them to the segments. Any unused requirements (which do not correspond to a segment) are returned as a hash.
[ { "docid": "f89e33c64c2da6c0d6bc7fd3bdb8a5cd", "score": "0.7292791", "text": "def assign_route_options(segments, defaults, requirements)\n route_requirements = {} # Requirements that do not belong to a segment\n\n segment_named = Proc.new do |key|\n segments.detect { |segment| seg...
[ { "docid": "3b34b27d8a0d80b5ebdc954d43b8a607", "score": "0.7447838", "text": "def defaults\n @defaults ||= returning({}) do |hash|\n segments.each do |segment|\n next unless segment.respond_to? :default\n hash[segment.key] = segment.default unless segment.default.ni...
7e8cb4e624f487695ec4702399ac2838
GET /batch_histograms GET /batch_histograms.json
[ { "docid": "f68af2392259424d0ddf3feb5855554a", "score": "0.7958057", "text": "def index\n @batch_histograms = BatchHistogram.all\n end", "title": "" } ]
[ { "docid": "d797a2dbb63208e493b50d71e98dbd79", "score": "0.800471", "text": "def request_histograms; end", "title": "" }, { "docid": "ea5f239f010b97eb0dc33c37e5350bc7", "score": "0.7155529", "text": "def histograms( category, extra_params = {})\n params = { \"categoryId\" => TOP_L...
b2135831ec0e164206cafd655e483de4
GET /groups/1 GET /groups/1.json
[ { "docid": "fd96893720254ab2c177cdfcc1ce6087", "score": "0.0", "text": "def show\n @group\n end", "title": "" } ]
[ { "docid": "7761dcbf8079fbe8d9838f059e843811", "score": "0.80147827", "text": "def groups\n @page = 'groups'\n respond_to do |format|\n format.html {\n @groups = Group.find(:all)\n }\n format.json { }\n end\n end", "title": "" }, { "docid": "1f843b01e13360c014...
2da99cfb372f2c54fce43dc5390409ee
We always want this Task to try to turn the Equipment on
[ { "docid": "a1373f80f20111b52d20aac7301d53fe", "score": "0.5336541", "text": "def state=(s)\n raise ArgumentError, 'The state of TurnOnTasks is always \\'ON\\'' unless s.casecmp('ON').zero?\n super\n end", "title": "" } ]
[ { "docid": "9a598b47400832415744933103065a5b", "score": "0.6222809", "text": "def turn_on!\n set_power!(:on)\n end", "title": "" }, { "docid": "1db40096da5f9243a3a3dfd28db78c09", "score": "0.6183459", "text": "def enable!\n @active = true\n change_status(:wait)\...
d54cac78080005ff6baa790cc70ce529
returns all the sessions at the current school
[ { "docid": "8291c4827c46fc915d960ceabe1de221", "score": "0.8054499", "text": "def all_sessions\n @the_sessions = []\n teachers = Teacher.where(school_id: current_teacher.school_id)\n teachers.each do |the_teacher|\n some_sessions = Session.where( session_teacher: the_teacher)\n ...
[ { "docid": "1779aa6020f615a5985ff6335eebcf1f", "score": "0.80677307", "text": "def get_sessions_to_be_used_by_school(school)\n sessions = []\n if school[\"sessions\"].nil? or school[\"sessions\"].size == 0\n parent = get_parent_for_school(school)\n while !parent.nil? and sessions.size ==...
6d8320d7a1fe550f9e23bc14ac1159fc
Public: Return all divs for this segment. Returns ActiveRecord::Relation.
[ { "docid": "3220e9685a1d0457756c281881764359", "score": "0.64797395", "text": "def divs\n Div.where(\"chromosome = ? and position between ? and ?\",\n chromosome, start, stop)\n .order(\"position ASC\")\n end", "title": "" } ]
[ { "docid": "52e99bef67313c8dfc6fb79d4db9b302", "score": "0.626987", "text": "def segments\n Management::Segment.all(self)\n end", "title": "" }, { "docid": "235d4bf1dcacc4e117792dad0a6ac565", "score": "0.60739934", "text": "def show_divs\r\n divs = Document.new(sel...
3c859271a2a9fd63d8bab316f2221179
Initializes rest of framework and loads extensions. This can only be called once.
[ { "docid": "8a069ec9a6fe9a2e68990bf2db509dfa", "score": "0.0", "text": "def startup\n\t\treturn if @started\n\t\t@started = true\n\t\t\n\t\t@res_man = Eggtooth::ResourceManager.new()\n\t\t@svc_man.add(@res_man, @cfg_help['resolver.manager'])\n\n\t\t@dispatcher = Eggtooth::Dispatcher.new\n\t\t@action_man...
[ { "docid": "e126900e38b215fc48f71ef3f0837cb4", "score": "0.75190955", "text": "def initialize_framework\n end", "title": "" }, { "docid": "1e4be1e2ebd9ca3b6b09b0ca0214a155", "score": "0.75137967", "text": "def initialize_framework\n end", "title": "" }, { "docid":...
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "fb6dcd01d02d85d02a8bb25964e86189", "score": "0.0", "text": "def decline\n ChangeRequestMailer.decline(ChangeRequest.first, User.first, \"http://localhost:3000\")\n end", "title": "" } ]
[ { "docid": "f4f01bf0c4f6341760a71d13d7b6cc72", "score": "0.7309514", "text": "def preview_email\n email = UserMailer.emailing(@emailing)\n mail_inliner = Roadie::Rails::MailInliner.new(email, Rails.application.config.roadie)\n mail = mail_inliner.execute\n\n mail.html_part.decoded.gsub /http...
5f3390f1a417131e1820e69d753198b4
aggiunge l'oro al totale
[ { "docid": "dc7cb3bde69a287b93697ff9c233af01", "score": "0.0", "text": "def gain_total_gold(n)\n @total_gold = 0 if @total_gold == nil\n @total_gold += n\n H87_Achievements.check(3)\n H87_Achievements.check(4)\n end", "title": "" } ]
[ { "docid": "aeacd6f3e5929beb898c11428de2997e", "score": "0.7414124", "text": "def totals(t)\n end", "title": "" }, { "docid": "bd26e1e8728da0de79111310b45e4343", "score": "0.7207139", "text": "def terreno_total\n\t\tsuma = 0\n\n\t\t@terreno.each do |i|\n\t\t\tsuma += i\n\t\tend\n\...
47f9464e1104a7168a22bf5f4b9e52ed
Generate the payload if stuff was provided
[ { "docid": "54282a05581ba007cc88d6d6f0a074fa", "score": "0.6671365", "text": "def generate_payload\n payload = {}\n payload[:channel] = self.channel unless self.channel.nil?\n payload[:username] = self.username unless self.username.nil?\n payload[:icon_url] = s...
[ { "docid": "29626d770ff7c4036a911ca7b1f68b22", "score": "0.6952139", "text": "def generate_payload\n if platform == \"java\" or arch == \"java\" or payload.start_with? \"java/\"\n generate_java_payload\n else\n raw_payload = generate_raw_payload\n raw_payload = add_shellco...
488cd32f1d8400e5919dbde8e50a1fac
Get node properties from the reference repo hash See also:
[ { "docid": "cdefab1a82fbf16a1b86772226284dd7", "score": "0.6350006", "text": "def get_node_properties(cluster_uid, cluster, node_uid, node)\n h = {} # ouput\n\n if node['status'] == 'retired'\n h['state'] = 'Dead'\n return h if node.size == 1 # for dead nodes, additional information is most like...
[ { "docid": "8ae8b0dac719f95ce6ac7b67aeb433aa", "score": "0.6369285", "text": "def node_properties\n @node_properties.dup\n end", "title": "" }, { "docid": "716ccb33115c31f290444a63fc76154b", "score": "0.6278039", "text": "def branch\n @data['head']['ref']\n end", "title":...
1e3636d6611e2446a949339f61d07a86
1) Michael Wang 2) Zach Barton We spent [] hours on this challenge. Bakery Serving Size portion calculator.
[ { "docid": "343689fa0c48018097f676f51125719f", "score": "0.6204536", "text": "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n# error_counter = 3\n\n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"#{item_to_mak...
[ { "docid": "04cbfbb702aa9620695a7cca6a7ab31a", "score": "0.7011357", "text": "def calculate_sizes\n @big_blocks = (@book_size.to_f/BlockDiv.to_f).ceil\n @list_blocks = (@big_blocks / ListBlocks) + 1\n @root_start = @big_blocks\n end", "title": "" }, { "docid": "e6e963840648dec998...
47b52578cc8501e4207494460a231dcf
Declaration for inplace editing plugin in_place_edit_for :story, :title Added this for implementing search functionality which currently only exists in Mobile Safari apps MM Nov 25, 2008
[ { "docid": "50ca827af174a18de7afe75e331de689", "score": "0.0", "text": "def search\n @stories = Story.find :all, :conditions => [ \"title like ? OR description like ? \", \"%#{params[:query]}%\", \"%#{params[:query]}%\"]\n respond_to do |format|\n format.html # index.html.erb\n format.x...
[ { "docid": "c0cbd6bf80bd1274a64f714e1feec7df", "score": "0.624986", "text": "def edit_title; end", "title": "" }, { "docid": "34d5dded31e55c0e78c595d3edced29d", "score": "0.60407186", "text": "def in_place_editor(field_id, options = {})\n if options[:collection]\n function = ...
88c9978b51ef0766ef19e742e45c3eab
Retrieve an agent by ID
[ { "docid": "97301f1a056d94cedade39581712e343", "score": "0.6533665", "text": "def get_agent_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AgentApi.get_agent ...\"\n end\n # verify the required parameter 'id' is set\...
[ { "docid": "2682ae18b026c6b894a6105a48383d8c", "score": "0.85101026", "text": "def find_agent(id)\n # TODO\n end", "title": "" }, { "docid": "513b67fd43ede95744b5a005d7587ce0", "score": "0.8174422", "text": "def get_agent_by_id id\n\t\t\t\t\tFreshdesk::Api::Client.convert...
0f8c2d17f69a27370bbf6634f62b5f30
Returns a specific component
[ { "docid": "646d720463c475c0e16fcebf71f89911", "score": "0.0", "text": "def get_component_by_hash(hash, opts = {})\n data, _status_code, _headers = get_component_by_hash_with_http_info(hash, opts)\n data\n end", "title": "" } ]
[ { "docid": "df8ac0222a308340661cf0e14538ad7b", "score": "0.808985", "text": "def component(component)\n @components[component]\n end", "title": "" }, { "docid": "359474617a4e26247eeff3172a882ff2", "score": "0.8080435", "text": "def get_component\n @component = Componen...
d82f53bea8a6e67af98885f2ee10a7d1
DELETE /cookie_types/1 DELETE /cookie_types/1.json
[ { "docid": "c868fdf8fbf3c37fe9126e9af49eb29b", "score": "0.8057535", "text": "def destroy\n @cookie_type.destroy\n respond_to do |format|\n format.html { redirect_to cookie_types_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "61178e12027bd7e82b9103e4fdc76c74", "score": "0.6867031", "text": "def destroy\n @cookie = Cookie.find(params[:id])\n @cookie.destroy\n\n respond_to do |format|\n format.html { redirect_to cookies_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7e89e66e8cdc8d42943232a51fa6bca3", "score": "0.0", "text": "def set_admin_question\r\n @admin_question = Admin::Question.find(params[:id])\r\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
f89acf4b0074cf3dc131e140a1ece988
POST /schedules POST /schedules.json
[ { "docid": "242fcd086ac2e2affb9cb004cf3e6c27", "score": "0.64725375", "text": "def create\n @schedule = Schedule.new(params[:schedule])\n # @schedule.start_time = Time.zone.parse(params[:schedule][:start_time])\n # @schedule.stop_time = Time.zone.parse(params[:schedule][:stop_time])\n\n resp...
[ { "docid": "edc9ba856d180fd3f81fe90f9c480c69", "score": "0.7559787", "text": "def schedule(params = {})\n post @endpoint, params\n end", "title": "" }, { "docid": "9913b3051d546a9bbf65f4c844850412", "score": "0.74831474", "text": "def schedules\n res = request('schedules...
56f7af20f52a7473e7456aeac4634252
Return the specified sidebar box. Default to the first box.
[ { "docid": "9b0e34417ecbb34ae683173b344b9596", "score": "0.80659115", "text": "def sidebar_box(index=0)\n sidebar_boxes[index]\n end", "title": "" } ]
[ { "docid": "73719c96409a9dfc0876e1ce7aecc6c3", "score": "0.69090015", "text": "def sidebar\n @sidebar ||= find_sub_page(:sidebar)\n end", "title": "" }, { "docid": "73719c96409a9dfc0876e1ce7aecc6c3", "score": "0.69090015", "text": "def sidebar\n @sidebar ||= find_sub_pag...
6ac81a4e096f09181dfe010e2e28696b
DELETE /comments/1 DELETE /comments/1.json
[ { "docid": "ac421aadb8a36d8d2a79830e1416dcf7", "score": "0.0", "text": "def destroy\n @comment.destroy\n respond_to do |format|\n format.html { redirect_to @commentable, notice: 'Comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "3e527a9d859cb967c5442cb3625a69d8", "score": "0.75341123", "text": "def destroy\n render json: comment.destroy!, status: :ok\n end", "title": "" }, { "docid": "021c3490c1e2fb25c05ca0b44b7d297d", "score": "0.7521334", "text": "def destroy\n Comment.find(params[:id])....
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e941e9fc1ce5e515e35ce1a767c411c4", "score": "0.0", "text": "def set_album\n @album = current_user.albums.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...
d2b9ba318824cdf46728ccfda49b1077
Internal functions use '__' to avoid collisions with possible userdefined data and such, though in a pinch users COULD access if they understood the internals sufficiently. Not worth the bother to prevent, really, this is just to avoid accidents.
[ { "docid": "c97fbfeebd0bdbb91c57d27bca6beda2", "score": "0.0", "text": "def __init_manual_data(data)\n @manual_data = Loki::Manual.new(data, self)\n end", "title": "" } ]
[ { "docid": "04b8031576882bce96df6dc86673d82f", "score": "0.7098029", "text": "def __; '.'; end", "title": "" }, { "docid": "76836d0259bbbaa6b4fc10e9d996d2d6", "score": "0.6313243", "text": "def eod=(_); end", "title": "" }, { "docid": "2c08e51cde9d14947b58da27972e4c7c", ...
5ffe0e935130fa75d1e7742ead23a608
Replace subgraphs by another in the plan It copies relations that are not within the keys in task_mappings and event_mappings to the corresponding task/events. The targets might be nil, in which case the relations involving the source will be simply ignored. If needed, instead of providing an object as target, one can ...
[ { "docid": "fb7b2c8545d6047e20da971023283346", "score": "0.65718764", "text": "def replace_subplan(\n task_mappings, event_mappings, task_children: true, event_children: true\n )\n new_relations, removed_relations =\n compute_subplan_replacement(task_mappings,...
[ { "docid": "e1ac7ad81e9c2b0f5600861bba2dc92b", "score": "0.6114129", "text": "def replace_subplan_by(object)\n\t super\n\n\t # Compute the set of tasks that are in our subtree and not in\n\t # object's *after* the replacement\n\t tree = ValueSet.new\n\t TaskStructure.each_root_relation do...
c546236290f5db811ee0ed549ff7b0c0
Given an item this will create the output file in the right output location.
[ { "docid": "91272dfc753e211b7cdb6c9f39102722", "score": "0.0", "text": "def create(item)\n raise 'This is a generic target. Please use a subclass.'\n end", "title": "" } ]
[ { "docid": "6bf28b443b9f41fd4b1df680798d3328", "score": "0.7482814", "text": "def write_to_file(item=nil,file_name=nil,directory_name=nil)\n\n\t\tif item == nil\n\t\t\titem = @item\n\t\tend\n\t\tif file_name == nil\n\t\t\tfile_name = @file_name\n\t\tend\t\n\t\tif directory_name == nil\n\t\t\tdirectory_n...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "18bff7ef9ba4936e927aafbe82d27cb2", "score": "0.0", "text": "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n end\n end", "title": "" } ]
[ { "docid": "8e69eb3ff3374e0db6fa9eb17958df65", "score": "0.78750724", "text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "6f74a32c6fdb67babd4a903e37b5baa4", "score": "0.77518034", "text":...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "1a21b66f10733545748afb4c36f79f45", "score": "0.0", "text": "def sub_group_params\n params[:sub_group].permit(:label,:description)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497761", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6959097", "text": "def strong_params\n params.require(:request).permit(param_white...
5157b467400d5257c20939ec9fab6e7b
Regulates by locking the dispatcher it if it's full.
[ { "docid": "617b065f136c9063272780798fa6c528", "score": "0.58087647", "text": "def regulate!\n if self.available?\n if @mutex.locked?\n @mutex.unlock\n end\n else\n @mutex.try_lock\n ...
[ { "docid": "c101c75f1d8a4c951773ccad7e0fa520", "score": "0.5763914", "text": "def conditional_reacquire\n @store.shift\n @holding_fiber = Fiber.current\n end", "title": "" }, { "docid": "55c722ae546eb185e96e6a4fc4d3b7f8", "score": "0.5678361", "text": "def append_dispatc...
961eb561bb0b9a0b6045929deda68504
PATCH/PUT /saida_produtos/1 PATCH/PUT /saida_produtos/1.json
[ { "docid": "14a19c3d36b7e31830328dfce1520126", "score": "0.68906885", "text": "def update\n respond_to do |format|\n if @saida_produto.update(saida_produto_params)\n format.html { redirect_to @saida_produto, notice: 'Saida produto was successfully updated.' }\n format.json { render...
[ { "docid": "151292d354993a2111b760424f3d593e", "score": "0.7075528", "text": "def update\n @produto.update(produto_params)\n respond_with @produto\n end", "title": "" }, { "docid": "2e966c4354b9690288d8d49c23316f45", "score": "0.7003695", "text": "def activo_update\n resp...
077791f1f9b38aef91f536301cd7b37c
List ServiceOfferings for Tag Returns an array of ServiceOffering objects
[ { "docid": "747842b6776b65b5240eedf8ca74d797", "score": "0.7335182", "text": "def list_tag_service_offerings(id, opts = {})\n data, _status_code, _headers = list_tag_service_offerings_with_http_info(id, opts)\n data\n end", "title": "" } ]
[ { "docid": "ca6d92babbcc6a807babbf12fac399d0", "score": "0.7931848", "text": "def list_service_offerings\n params = {\n 'command' => 'listServiceOfferings'\n }\n json = send_request(params)\n json['serviceoffering'] || []\n end", "title": "" }, { "docid": "1d1...
6f43ad4cbdddfba611cfb4dfe8f60809
The product identifier of the item that was purchased
[ { "docid": "3287475d1bc24a859a524bb8ff9e0116", "score": "0.78072757", "text": "def product_id\n read('product_id')\n end", "title": "" } ]
[ { "docid": "d9c96c6678e72b907dc9dccd835afeb2", "score": "0.74700755", "text": "def product_key\n return @product_key\n end", "title": "" }, { "docid": "d9c96c6678e72b907dc9dccd835afeb2", "score": "0.74700755", "text": "def product_key\n return...
90e2e88a53178b6de832be18bdaf16fe
This sweeper is going to keep an eye on the Topic model If our sweeper detects that a topic was created call this
[ { "docid": "2f0de2ef78ecb17d044e1ccc4f7f188e", "score": "0.0", "text": "def after_save(topic)\n expire_cache_for(topic)\n end", "title": "" } ]
[ { "docid": "821606caaf2e725aa0848dc38a2e1fbd", "score": "0.6924355", "text": "def topic_class\n Topic\n end", "title": "" }, { "docid": "18f20f0286413052699da38eaee2821d", "score": "0.69017553", "text": "def new\n\t\t@topic = Topic.new\n\tend", "title": "" }, { "d...
aa5028f1491df752e0efde217b1d1122
delete from order all adj with klarna fee
[ { "docid": "363489723a25e2fa51a3dd0ace33f83b", "score": "0.6666977", "text": "def remove_klarna_fee!\n if remove_klarna?\n adjustments.klarna_invoice_cost.destroy_all\n update!\n end\n end", "title": "" } ]
[ { "docid": "b48e54235f9bf7db814f4213f87e8abd", "score": "0.583115", "text": "def remove_legacy_fees\n @legacy_deletes = Fee.where(category: \"FTR\").where(\"id < 400\").delete_all\n end", "title": "" }, { "docid": "d2cda56388d0d80804e7b1e501b9448e", "score": "0.5558304", ...
c4cce46a76e2327d8fa0bf0e8bc6a5e6
Persist an assignment across different policy machines. This is used for logical relationships outside of the policy machine formalism, such as the relationship between a class of operable and a specific instance of it.
[ { "docid": "095af27b00daee083513e01cf6073290", "score": "0.0", "text": "def add_link(src_policy_element, dst_policy_element)\n assert_different_machines(src_policy_element, dst_policy_element)\n src_policy_element.link_to(dst_policy_element)\n end", "title": "" } ]
[ { "docid": "873c10de77f7fc1801fa337c2127abd6", "score": "0.64805096", "text": "def assignment\n # Create assignment\n Relationship.create(assignment_parameters)\n \n # Get human readable assignment values\n @assignment_parts = assign_parts(params)\n end", "title...
f6a545aff9b0094a57505d1fa4961cf1
Mark all notification groups as read Mark all notification groups of the current user as read
[ { "docid": "df9715a96096375b74ef5f3fd2767e1b", "score": "0.5988537", "text": "def notification_groups_mark_all_as_read_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NotificationGroupsApi.notification_groups_mark_all_as_read ...'\n...
[ { "docid": "01e634eb5ddecb6446fe1c5a20a04889", "score": "0.7631108", "text": "def mark_notifications_as_read!(user)\n self.notifications.where(read: false, user_id: user.id).update_all(read: true)\n end", "title": "" }, { "docid": "90a33aa68aead5775fb4b38d0ff2cb4f", "score": "0.75232...
81e90a6093f723b9030cd7cbf21ddc48
POST /organizations POST /organizations.xml
[ { "docid": "cd52eaafe54f4430b81add6958395bd2", "score": "0.5535099", "text": "def create\n @organization = Organization.new(params[:organization])\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @organization.valid? && @user.valid? && @organization.save && @user.save\n ...
[ { "docid": "4a75897f5755e5ca1f3989798e5b355c", "score": "0.6748992", "text": "def CreateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'POST',payload: params.to_json)\n \n end", "title": "" }, { "docid": "599e803a1868b05d448f30812559ca28", ...
05122fb8e42f540b02af50ff28ff8092
Traverses the children groups and finds the group with the given path, if exists.
[ { "docid": "ada0d295ee0d0a32fe6e59e257c81036", "score": "0.0", "text": "def [](path)\n find_subpath(path, false)\n end", "title": "" } ]
[ { "docid": "558c4bd954642c94e34375a9b8febc14", "score": "0.70641905", "text": "def find_test_group_containing(path)\n @test_groups.each do |group|\n rel = path.relative_path_from(group.real_path)\n next if rel.to_s.start_with?('..')\n\n return group\n end\n\n raise \"Could not fi...
b0a0d4a1e33e947b33247c8b099f6ead
Mostly just to ensure it runs fast enough
[ { "docid": "3b94d319528c594e121b762bef417ede", "score": "0.0", "text": "def test_edge\n @solution.input_file = 'C-test-range.in'\n @solution.compute\n assert_equal [946], @solution.output_clean\n end", "title": "" } ]
[ { "docid": "f6d4a510b1064cdde36cfabb37bc801a", "score": "0.6583471", "text": "def threadsafe; end", "title": "" }, { "docid": "0f828e39ac6c0cb39ceb456b5ed44912", "score": "0.6421717", "text": "def warmup; end", "title": "" }, { "docid": "48aa6ae56116baa2a62ba9233aa5fbd0",...
df03b3ca282e0b10ff8c7007e6212175
This checks if either the current or previous hash is valid
[ { "docid": "338145b9b70cc3b3cfda29ab41b44306", "score": "0.7188143", "text": "def check_hash block\n if @num != 0\n if @prev_line.split(\"|\")[4].split(\"\\n\")[0] != block.getPrev()\n puts \"Line #{@num}: Previous hash was #{block.getPrev()}, should be #{block.getCurr()}\"\n ...
[ { "docid": "5517ec265587454286b42a864e96397c", "score": "0.79133004", "text": "def prev_hash_check(curr_block, last_block)\r\n unless last_block.nil?\r\n return false if last_block.end_hash.unpack('*U') != curr_block.last_hash.unpack('*U')\r\n end\r\n true\r\n end", "title": "" }, ...
f2f3727054d3c4dc4a3204762a684050
Perform an incremental update of the checkout. Subclasses that want to handle incremental updating need to override this.
[ { "docid": "e4d321807f2228331e0a15be703fc3cb", "score": "0.0", "text": "def do_update\n raise NotImplementedError\n end", "title": "" } ]
[ { "docid": "91860a8a9a848493993ba237f54633c7", "score": "0.76446426", "text": "def do_update\n do_checkout\n end", "title": "" }, { "docid": "4b439763cd2ccc2b7193ad8a46ff7ef2", "score": "0.7026683", "text": "def update\n return if update_completed?\n\n execute_s...
936c18b1722022655fdc37a2208b0a15
Creates a copy of this object, with the given attributes changed (nondestructive update)
[ { "docid": "18b1507a3751b112e4fbd9b127d6b8e9", "score": "0.6537707", "text": "def with(new_attrs)\n self.class.new(to_h.merge(new_attrs))\n end", "title": "" } ]
[ { "docid": "1c5e609a6888d86949ef710e5bab5efb", "score": "0.75502366", "text": "def attributes\n # leave the original alone\n @attributes_copy ||= @attributes.dup\n end", "title": "" }, { "docid": "1c5e609a6888d86949ef710e5bab5efb", "score": "0.75502366", "text": "def attribute...
85aea61fc4e4714731c8e6d29d15264e
=begin Function to delete a Position Param 1: logged user object Return if successful: 1.execution result(true), 2.response from the server Return if unsuccessful: 1.execution result(false), 2.response code from the server, or array of validation errors 3.response message from the server =end
[ { "docid": "cbb7b52eebd23ebb4dc021ee995c1d16", "score": "0.84454226", "text": "def delete(user)\n Rails.logger.debug \"Call to position.delete\"\n reqUrl = \"/api/position/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']...
[ { "docid": "8c10f6366e2763dfcec8ce7d4dd402dd", "score": "0.7561329", "text": "def destroy\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n response = Position.find(params[:id],session[:us...
12ae104d82b08a674a11827b64cc9649
build_field_idx creates a hash table of field names to indicies in a log line
[ { "docid": "c6ac38d8ae5b977e0b66af080a7a7967", "score": "0.70689404", "text": "def get_field_idx line\n\tfield_idx = {}\n\tcount = 0\n\tfield_names = line.split(\"\\s\")\n\tfield_names.each{|field_name|\n\t\tfield_idx[field_name] = count\n\t\tcount += 1\n\t}\n\n\tfield_idx\t\t\nend", "title": "" }...
[ { "docid": "b03c74e8cbfd36af8b74b600638995be", "score": "0.6434546", "text": "def field_index(field)\n fieldIndex(field.to_s)\n end", "title": "" }, { "docid": "5f75c2cc007f57e6857b27e07a7b3ab1", "score": "0.61040884", "text": "def add_to_index(lineno, field_name, index_name, key...
bccf204ab0948c1cc40341d43e0c86da
many transactions as you may like, but you must sell before you buy again. This problem has very poor instructions attached to it. We are able to hold onto one stock at a time. We are able to sell and purchase on the same day. As such, all we need to do is sell whenever the price increases between two days.
[ { "docid": "8dade0beab7d12dfe51aab91558b40d6", "score": "0.0", "text": "def max_profit(prices)\n i = 0\n profit = 0\n while i < prices.length - 1\n if prices[i + 1] > prices[i]\n profit += prices[i + 1] - prices[i]\n end\n i += 1\n end\n profit\nend", "title": "" } ]
[ { "docid": "5d9d60a3b0f649b650ccfc9c7ec13f45", "score": "0.73807085", "text": "def stock_seller(stock_list)\n # setting up. We initialize max_profit to be the very first transaction we can make\n # this way, we can make a decision if we have to sell at a loss\n max_profit = stock_list[1] - stock_list...
ba5db0c922b86c5b9baf725b0bf26425
GET /customer_transactions/1 GET /customer_transactions/1.json
[ { "docid": "77b81e851ac2940f57a1d82a31fcf99b", "score": "0.72021765", "text": "def show\n @customer_transaction = CustomerTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_transaction }\n end\n end", "tit...
[ { "docid": "a167416e7c45fdb1f7039d016d7c20f7", "score": "0.75692296", "text": "def transactions(options = nil)\n request = Request.new(@client)\n path = \"/customers/\" + CGI.escape(@id) + \"/transactions\"\n data = {\n\n }\n\n response = Response.new(request.get(path, dat...
185123dc964f6871eedcf1813c4944d3
Sets up shopping carts that can be used to submit orders.
[ { "docid": "ab3b07e194fcfcd510664c0e2da22591", "score": "0.0", "text": "def order_submission(num_carts = 1)\n get(FinerWorks::Cart, \"/OrderSubmission\", { \"NewCart\" => num_carts })\n end", "title": "" } ]
[ { "docid": "d4b156ac642b43459e3c52337256759b", "score": "0.69964534", "text": "def set_cart\n @products = Product.all\n @cart = Cart.find_by(user: current_user)\n end", "title": "" }, { "docid": "bf7000589f81808717edbdace33d3dea", "score": "0.67013216", "text": "def create\n\t...
b10a37a2732390798535a85a50fd9ea0
slight optimization in regards to determining current_idx we know that any preceding destination index would require less than or equal to the number of jumps it will take to reach the current destination index. As such, we can start from the jump index of the previous element.
[ { "docid": "a2f99c15e260628f98cbc2ac4a487e9d", "score": "0.7765381", "text": "def find_starting_idx(destination_idx, jump_idx)\n jump_idx.length > 1 ? jump_idx[destination_idx - 1] : 0\nend", "title": "" } ]
[ { "docid": "5a9b87ea4632082ae10bb1d702de8fd1", "score": "0.6947729", "text": "def can_jump?(arr, current_idx, destination_idx)\n current_idx + arr[current_idx] >= destination_idx\nend", "title": "" }, { "docid": "e13853adbaf8d87fd336edd70fe020f7", "score": "0.6831604", "text": "def ...
7e0b5043f2e044d52020a4a330cf2a22
ask if user wants to play or not
[ { "docid": "f615995719b6822a9f5fb57d6619f768", "score": "0.0", "text": "def welcome()\n\t\tputs \"wanna play? y/n\"\n\t\tyesorno = \"\"\n\t\tyesorno = gets.chomp\n\t\tyesorno.downcase!\n\t\tif yesorno == \"y\"\n\t\t\tplayGame()\n\t\telsif yesorno == \"n\"\n\t\t\texitGame()\n\t else \n\t \tputs \"s...
[ { "docid": "6ca1fb436550f998f4641532d0d60b3e", "score": "0.81603456", "text": "def playing\n on = ask \"is_playing\"\n return false unless on\n [false, true][on.to_i]\n end", "title": "" }, { "docid": "011e14857364754ead4a053bd9a03603", "score": "0.7817206", "text":...
d12ce89cab54df3fc0a69bee8e95fcc1
write the file to the specified disk location
[ { "docid": "e2d63db9e43f4190d0d6e415c500ff7f", "score": "0.0", "text": "def publish\n unpublish\n File.open(full_xml_file_path, 'w') do |f|\n f.write self.to_xml\n end\n end", "title": "" } ]
[ { "docid": "4ab951ebf6ec098d9200f2d05447c902", "score": "0.7183728", "text": "def save_file!\n location = target\n check_file_parents(location)\n f = File.open(Pathname.new(location).expand_path, 'w')\n print \"Writing to #{location}...\"\n puts f.write(get_file!).to_s\n f....
46115744d0360335c6710f28f2514cdb
Adds a new child to the container. Assigns his depth plus one as depth to the new child. You can not add nil as new child.
[ { "docid": "cf19150e71a1e3e29a09439fe5edc1fe", "score": "0.0", "text": "def add(comment)\r\n fail \"Comment should not be nil\" if (comment.nil?)\r\n\r\n @comments.push(comment)\r\n comment.depth = self.depth+1\r\n end", "title": "" } ]
[ { "docid": "e7e0f730b9f7a497881d91716287d502", "score": "0.7527331", "text": "def add_child child\n (@children ||= []) << child\n end", "title": "" }, { "docid": "1a89bf81290f9698394349c0a00fa84c", "score": "0.7436876", "text": "def add_child(child)\n child.parent = self\n ...
37fa7a04a2340d2a1570c5acb4c41dd3
stop any action/hook and redirect right away.
[ { "docid": "dc0d0006dbcc75818f6a801d3c7bdd4e", "score": "0.0", "text": "def redirect path, status = nil\n delayed_redirect path, status\n halt\n end", "title": "" } ]
[ { "docid": "c4106a33713072c8595e136bb591941d", "score": "0.67901474", "text": "def stop\n current_user.stop\n EntretLog.stop( current_user.id )\n\n redirect_to action:\"stoped\"\n end", "title": "" }, { "docid": "e96bfafb6c32940979342aab794bbc5e", "score": "0.66481894", "te...
d46f103cb1fb8b2a1f4e63c0fda8783b
PUT /authors/1 PUT /authors/1.xml
[ { "docid": "df6d42936ab52157e3f80ec219c42ae9", "score": "0.6348718", "text": "def update\n @author = Author.find(params[:id])\n\n respond_to do |format|\n if @author.update_attributes(params[:author])\n flash[:notice] = 'Author was successfully updated.'\n format.html { redirect...
[ { "docid": "031a01369268f61e1338c112ecf3466a", "score": "0.6612991", "text": "def update_author(id, data)\n #FIXME: Author controller doesnt receive data\n return @client.raw(\"put\", \"/content/authors/#{id}\", nil, data)\n end", "title": "" }, { "docid": "27db3cd2f3e121099...
286f57b62d2ccdd59604fd8d61588dbc
Return TRUE if file could be removed
[ { "docid": "45892a7200ec494fdcb1cdd432379f94", "score": "0.0", "text": "def unlink_callback(context, path, user_data)\r\n if self.unlink(path)\r\n 1\r\n else\r\n 0\r\n end\r\n end", "title": "" } ]
[ { "docid": "e24f6c32910da83db1a20fa2f78cc9e5", "score": "0.77123946", "text": "def delete_file\n File.delete(@path)\n true\n rescue Errno::ENOENT # testing for existence would be a race condition\n false\n end", "title": "" }, { "docid": "4a279518dadaf4a5a3ea6b50620abce2", "sc...
b6bca3c8e9ed649138c538b25ccccf47
DELETE /games/1 DELETE /games/1.json
[ { "docid": "b28cf580081ad67829245eb883a38d56", "score": "0.0", "text": "def destroy\n @game.players.each do |p|\n p.destroy\n end\n\n @game.destroy\n respond_to do |format|\n format.html { redirect_to games_url, notice: 'Game was successfully destroyed.' }\n format.json { head...
[ { "docid": "fd4eb511cd5e957a76d59b08b0244ce9", "score": "0.77787167", "text": "def destroy\n @game = Game.find(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e556b38f3987e315b05021267668739...
7e1271bcdbe9bbdf07fdbc70b9f37b3a
A bit of hackey to expire the product fragment cache when a crop gets updated Crop belongs to image with touch => true enabled on save When image gets updated, it should touch each product record associated to it through the asset_resources table When an asset_resource gets updated, it should touch it's owner object. T...
[ { "docid": "0d84cb817e4ccb332693bd90673a631f", "score": "0.65934855", "text": "def expire_products_cache\n self.asset_resources.map(&:touch)\n end", "title": "" } ]
[ { "docid": "10ee7808ffbc99a484870320ec0b9191", "score": "0.5983323", "text": "def update_cache_chain\n logger.debug \"DB ********** Touching PhotoGalleryElem #{id} ********** \"\n self.touch\n self.element.try(:update_cache_chain)\n self.image_elems.each {|elem| elem.try(:update_cache_chain)...
5f9079997c54f96eb3f92ba4b981cc0d
GET /articles/new GET /articles/new.json
[ { "docid": "faac268ad589b64a4bcb44896a2d97e6", "score": "0.0", "text": "def new\n @article = Article.new\n @user = User.find_by_id(session[:user_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n \n # def uri?(atta...
[ { "docid": "488a6f94ef82456398d02b5076307b3b", "score": "0.8152177", "text": "def new\n @article = Article.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "title": "" }, { "docid": "5ebf32456940c4...
47a6c9a589eb0f1e04cabc17fab40a5a
POST /profiles POST /profiles.json
[ { "docid": "09d93391f280ea9b54cd5b2247f562f6", "score": "0.0", "text": "def create\n\n set_option_text_in_param\n @profile = current_user.build_profile(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successf...
[ { "docid": "443f7ac6eb20f4026d28d4e500090204", "score": "0.7567471", "text": "def create\n @profile = current_user.profiles.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n f...
51ede088dfe9576bc1b00a04540725f0
Trigger for building the state machine methods.
[ { "docid": "8161a636d149659bd30769682e90dd02", "score": "0.64667743", "text": "def build(&blk)\n @klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n include ::SimpleState::Mixins\n RUBY\n\n # Create an anonymous module which will be added to the state machine\n # class's inher...
[ { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4cd75075f", "score": "0.7042458", "text": "def state_machine; end", "title": "" }, { "docid": "0e3a853eb0a0b091bb7cd6e4...
ccd281fb41076f032d4d8fe497ef39c6
A hash value for the +View+ composed of the collection namespace, hash of the options and hash of the filter.
[ { "docid": "8cbcee8b588e4f1cb942648146cf703b", "score": "0.74879414", "text": "def hash\n [ collection.namespace, options.hash, filter.hash ].hash\n end", "title": "" } ]
[ { "docid": "bff06a58aa137dc5ae9384d09e343799", "score": "0.66173124", "text": "def inspect\n \"#<Mongo::Collection::View:0x#{object_id} namespace='#{collection.namespace}'\" +\n \" @filter=#{filter.to_s} @options=#{options.to_s}>\"\n end", "title": "" }, { "docid": "0f...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "6a25ad6d2cef95470b36e4d1eef03f0c", "score": "0.0", "text": "def set_artical\n @artical = Artical.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
c09a8a0b76b21528e6a293449589affe
Return the column names of the table
[ { "docid": "cdaf11b2edfd574a33c63d2e9419907b", "score": "0.85543567", "text": "def columns(table_name)\n @db.table_info(table_name).map { |info| info[\"name\"].to_sym }\n end", "title": "" } ]
[ { "docid": "739c8f999f2e26cbc79d39c0491a8639", "score": "0.8887456", "text": "def col_names\n table_builder.names\n end", "title": "" }, { "docid": "42f5b29f47ed6b049a0e74d8314c8284", "score": "0.8837578", "text": "def column_names\n @table.columns_in_order.collect { |c|...
1b045f6302aa078452b0b85895f0f388
PUT /trip_features/1 PUT /trip_features/1.json
[ { "docid": "fc6a055e62d69bea0ae87be52aa745d4", "score": "0.7450522", "text": "def update\n @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n if @trip_feature.update_attributes(params[:trip_feature])\n format.html { redirect_to @trip_feature, notice: 'Trip featu...
[ { "docid": "40e44d933d159f5d62579a1226f5f06d", "score": "0.68346107", "text": "def update\n create_update_feature(params)\n end", "title": "" }, { "docid": "9f4ac7aa843672060f2f927902a9be9d", "score": "0.67928445", "text": "def update(id, opts)\n\t\t\t\turl = \"api/v2/features/#{...
d86f4cd51da25005d56ee43bdef8c4c4
GET /honchos/1 GET /honchos/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "0b9eaf438314821b0bd1620530525766", "score": "0.69007814", "text": "def show\n @phono = Phono.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phono }\n end\n end", "title": "" }, { "docid": "2ad0d971a6d00...
f8910f754c8e6e6465fcd83cc61e5896
DELETE /users/1 DELETE /users/1.json DELETE THIS METHOD BEFORE SUBMISSION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[ { "docid": "2eddd9adb3f47191ef15abed5b616cae", "score": "0.0", "text": "def destroy\r\n end", "title": "" } ]
[ { "docid": "8e69eb3ff3374e0db6fa9eb17958df65", "score": "0.7597645", "text": "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "title": "" }, { "docid": "88435d71821df18966fc2786fe44d74a", "score": "0.73759025", "text": ...
6aee821d0a81ca31163ae2060fa35447
Insert multiple coupons Insert multiple coupon on the UltraCart account.
[ { "docid": "61f5486e0a508a1d46abf023c2f775a7", "score": "0.562356", "text": "def insert_coupons_with_http_info(coupons_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CouponApi.insert_coupons ...'\n end\n # verify the required p...
[ { "docid": "8a57a2e4ec6e96caed4743fe33e2aeb5", "score": "0.6924682", "text": "def create_coupons!()\n deal = Deal.find(self.deal.id)\n for i in (1..self.quantity)\n dc = DealCode.find(:first, :conditions => [\"deal_id = ? AND reserved = ? AND incentive = ?\", deal.id, false, false], :lock => ...
78fb0c1cc1c5c7950c17215b81c001ca
SBC A,E flags: Z 1 H C
[ { "docid": "055baacd2fb20e51f3fa2cbf4177dca2", "score": "0.5467919", "text": "def sbc_a_e\n end", "title": "" } ]
[ { "docid": "f4aab2e0b10cdc130a145ff5c34fd53c", "score": "0.5871235", "text": "def sbc_a_hl\n end", "title": "" }, { "docid": "83628f9d56a9ba9d157a4ee1e8c429d9", "score": "0.5840394", "text": "def flags; end", "title": "" }, { "docid": "f31fe3e440e166e183e6b64ab38f15d...
cded0842dcdc048c1dbec2b056de30d2
methods used to infer Itemvalue value of item as read from OS (via Facter)
[ { "docid": "2e7586297e38b1e9be76a1877c1289e8", "score": "0.59604156", "text": "def os_value\n Facter.value( @fact ) unless @fact.nil?\n end", "title": "" } ]
[ { "docid": "e3f2f58b35c53c5780091d3324597f71", "score": "0.6193306", "text": "def get(item)\n if values = @items[item]\n values[:value]\n end\n end", "title": "" }, { "docid": "b95b61f595a01c1edd8dba5a1ab6098e", "score": "0.6161818", "text": "def value\n cmd = ...
aba9ead4deccf5902045188d70a863d9
Returns whether the join conditions references the given table
[ { "docid": "0b7efe5dbd0c36332653b9f93df06f81", "score": "0.6476662", "text": "def uses?(condition, table)\n name = table.as_name.to_s\n left_name = var_name(condition[1])\n right_name = var_name(condition[2])\n (left_name == name) or (right_name == name)\n end"...
[ { "docid": "ff774773ce7bf1c45daf6591cd7af339", "score": "0.68378234", "text": "def join_table_exists?\n return true unless reflection.macro == :has_and_belongs_to_many\n subject_class.connection.tables.include?(reflection.options[:join_table].to_s)\n end", "title": "" ...
9d327e746859b524f0637885dc0ba1c4
4. Convert your driver test code from that challenge into Assert Statements
[ { "docid": "ca0df44d8b905e0fd44c1e24ba84312c", "score": "0.0", "text": "def assert\n raise \"Assertion failed!\" unless yield\nend", "title": "" } ]
[ { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.7143878", "text": "def assertions; end", "title": "" }, { "docid": "1ea0145f1766317f8875773e74bd2a56", "score": "0.7143878", "text": "def assertions; end", "title": "" }, { "docid": "0e27ed76988a692adb5cdf7709fe41...
3f11fcaf76b5a593cecb27077b1eceb4
Sample Format "Source","First Name","Last Name","Gender","Company Name","Phone Number","Address","City", "State","ZIP code","ZIP+4","database name","File Date","id","Production Date"
[ { "docid": "bc11b2e9b9153fca3de04a1d77ad7887", "score": "0.49348426", "text": "def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, ...
[ { "docid": "b979b052396152092ced4b0da7d4f9e3", "score": "0.5864022", "text": "def column_names\n\t\t@validated_gets.map{|f| f[:external]} + [\"usd_2009\", \"usd_current\", \"count\", \"min_year\", \"max_year\"]\n\tend", "title": "" }, { "docid": "bd71e0971f36358cdb02abb27e287d73", "score...
3d12337f807c1fd30680000c70fb67a2
Computes a hash with text run attributes based on em_classes
[ { "docid": "ad52e4aa71c5896679ca0f367d422ef6", "score": "0.7693296", "text": "def compute_text_run_attrs_from_em(em_classes)\n # Handle em with no classes: results in plain italics\n return { italic: true } if em_classes.empty?\n r = {}\n r[:bold] = true if em_classes.includ...
[ { "docid": "9979558224dd55f7e876d42aeb812840", "score": "0.5938382", "text": "def hash\n [text, font_name, font_size, bold, italic, color, width, height, top, left, rotation_angle, transparency, background, image, auto_align].hash\n end", "title": "" }, { "docid": "d63333ed15c27e3f75...
3fb4916120946633018a8aa8ca34a8be
PATCH/PUT /dis_generic_hepatic_imps/1 PATCH/PUT /dis_generic_hepatic_imps/1.json
[ { "docid": "a0fffeaf435dda0dd46266ad4377a133", "score": "0.7352515", "text": "def update\n respond_to do |format|\n if @dis_generic_hepatic_imp.update(dis_generic_hepatic_imp_params)\n format.html { redirect_to @dis_generic_hepatic_imp, notice: 'Dis generic hepatic imp was successfully up...
[ { "docid": "f72498bfe8bb4f554ed199bfc5b18edc", "score": "0.64352036", "text": "def update\n respond_to do |format|\n if @dynamic_iap.update(dynamic_iap_params)\n format.html { redirect_to @dynamic_iap, notice: 'Dynamic iap was successfully updated.' }\n format.json { head :no_conte...
4f74f96b0f40a3013fde62fb696963e1
end the arguments method define what happens when the measure is run
[ { "docid": "319ce3b945bd0408e4291b7249066f92", "score": "0.0", "text": "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n \n #use the built-in error checking \n if not runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\...
[ { "docid": "a2dd09cfd832ed391005833a8d9c1c5c", "score": "0.63879776", "text": "def measure(*args)\n raise RuntimeError,\n 'Ruler#measure called, but should be redefined by a real ruler.'\n end", "title": "" }, { "docid": "df1737ac90b4bc30e887a5813a4382f0", "score": "0.6341...
09ed091106a7a186ad8298dbf5bcd0d8
When passed a block, yields DeploymentInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached. source://twilioruby//lib/twilioruby/rest/serverless/v1/service/environment/deployment.rb71
[ { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.0", "text": "def each; end", "title": "" } ]
[ { "docid": "b881626835dcf87b9192ca9ea311b266", "score": "0.5969335", "text": "def deploy(&block)\n in_directory do\n self.setup!\n self.push_with_retry!\n block.call(self, api_rate_limit.call, output) if block_given?\n end\n ensure\n self.teardown!\n end", "...
016563f7300c76f4ff613591f26367dd
GET /items/1 GET /items/1.xml
[ { "docid": "50d72064aa884cea40efa8c7a0811d08", "score": "0.0", "text": "def show\n @item = Item.find_by_id_or_name(params[:id])\n\n render_404 and return unless @item\n \n @title = @item.title\n \n @comment = Comment.new(params[:comment])\n \n respond_to do |format|\n format...
[ { "docid": "9e059e4239e69f39ab00fc59f7dee61d", "score": "0.67883086", "text": "def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end", "title": ""...
f621e263961d63e2ed95298d49b2707f
allows capybara tests to use post instead of get requests
[ { "docid": "cd18d57903b339ff4f204f3aa232667b", "score": "0.7444396", "text": "def visit_via_post(path)\n page.driver.post(path)\nend", "title": "" } ]
[ { "docid": "f091fe34d4e5723725464c4c833de409", "score": "0.67283446", "text": "def post\n request_method('POST')\n end", "title": "" }, { "docid": "a556fd335f6b5d42303d0d6af1913093", "score": "0.6718397", "text": "def test_post_hello\n post '/hello'\n assert_respons...
d3fb1e8e3e0b916d43d2f0f2906e426c
Resets the context to be blank. Use this carefully! This will remove any context, include context that is automatically included with Timber.
[ { "docid": "6b57e5d193575bf495f5da50ed0268f4", "score": "0.0", "text": "def reset\n hash.clear\n expire_cache!\n self\n end", "title": "" } ]
[ { "docid": "f7055f173f7c284374ac3f06aacd7256", "score": "0.8437701", "text": "def reset_context\n @context = nil\n end", "title": "" }, { "docid": "830cedc7b05d18cbad998dfd8e436b37", "score": "0.8252196", "text": "def reset\n @context = nil\n end", "title": "" }, ...
84840720553a6d0bba097615144b5787
DELETE /matches/1 DELETE /matches/1.json
[ { "docid": "db7ed466b5229b760e775d9d48d28e3d", "score": "0.7716669", "text": "def destroy\n @match.destroy\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "2802be9a09af1633319f82c5c41f146a", "score": "0.77791023", "text": "def destroy\n @match1 = Match1.find(params[:id])\n @match1.destroy\n\n respond_to do |format|\n format.html { redirect_to match1s_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
d68fd16e20e02a8a6053d02147fabc7d
This method will need to accept more arguements when/if payment profiles supported money, credit_card, response_code, options
[ { "docid": "9239a87fb4ba763a06e9acb75857e5f8", "score": "0.59952366", "text": "def credit(money, response_code, options)\n currency = options[:currency] || options[:originator].payment.currency\n\n response = provider.refund_payment(response_code, transaction_amount(currency, money))\n\n ...
[ { "docid": "89be8d00403b7e04d1e3080981d7f02c", "score": "0.680489", "text": "def update_payment_profile(options={})\n return true if ENV['RAILS_ENV'] == 'development' || ENV['RAILS_ENV'] == 'test'\n \n logger.info(\"*** updating an existing payment profile\")\n credit_card = ActiveMerchant:...