query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Get accounting stats from financial statements at the vendor for the business provided Get accounting stats from financial statements at the vendor for the business provided
def get_accounting_stats_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AccountingApi.get_accounting_stats ...' end # resource path local_var_path = '/accounting/report' # query parameters query_params = {} query...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_financial_statement(statements, status)\n statements.each { |statement|\n if statement.status == status\n return statement\n end\n }\n #Return default financial data if required stetement was not found\n Struct.new('We', :count, :price, :price_with_vat, :status)\n return Str...
[ "0.60361004", "0.5932578", "0.5889367", "0.57683384", "0.5745986", "0.5648901", "0.5642072", "0.56405514", "0.56369054", "0.5630468", "0.5616505", "0.56086147", "0.5602049", "0.55658555", "0.55486965", "0.55355704", "0.5532896", "0.55184907", "0.5507413", "0.5489956", "0.5489...
0.61885965
0
Update supplier in Nucleus for a given nucleus_contact_id Update supplier in Nucleus for a given nucleus_contact_id
def update_accounting_supplier(nucleus_contact_id, opts = {}) data, _status_code, _headers = update_accounting_supplier_with_http_info(nucleus_contact_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n get_supplier\n @supplier_phone = @supplier.phones.find(params[:id])\n @supplier_phone.update_attributes(params[:supplier_phone])\n end", "def update\n @supplier = Supplier.find(params[:id])\n \n if @supplier.update_attributes(params[:supplier])\n respond_to do |format|\n ...
[ "0.6916474", "0.67098117", "0.6688903", "0.666973", "0.63982576", "0.6394731", "0.6394731", "0.6394731", "0.6394731", "0.6394731", "0.6394731", "0.6394731", "0.6394731", "0.6382703", "0.63796866", "0.6358038", "0.6347596", "0.6324387", "0.6304836", "0.62983847", "0.6294463", ...
0.7108853
0
Set a custom url path class config/initializers/alchemy.rb Alchemy::Page.url_path_class = MyPageUrlPathClass
def url_path_class=(klass) @_url_path_class = klass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_page_class_name\n if page.present?\n self.page.class_name = page.class_name || 'ShopProductPage'\n end\n end", "def assign_page_class_name\n if page.present?\n self.page.class_name = page.class_name || 'ShopCategoryPage'\n end\n end", "def url_path\n self.class.url_path_...
[ "0.63178205", "0.6311935", "0.61768764", "0.59461474", "0.5829369", "0.57789874", "0.5745727", "0.5568125", "0.5560452", "0.5547274", "0.54812443", "0.5465498", "0.5440397", "0.5437063", "0.54017884", "0.5389625", "0.5358776", "0.53532755", "0.53410614", "0.533329", "0.532432...
0.7579254
0
Used to store the current page id previewed in the edit page template.
def current_preview=(page) RequestStore.store[:alchemy_current_preview] = page&.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview_id\n @attributes[:preview_id]\n end", "def set_preview_context\n @preview_context = PreviewContext.find params[:id]\n end", "def set_preview\n @preview = Preview.find(params[:id])\n end", "def current_preview\n RequestStore.store[:alchemy_current_preview]\n end...
[ "0.67150974", "0.6405866", "0.62093097", "0.6196405", "0.61772186", "0.614419", "0.59355366", "0.5849209", "0.58432335", "0.5827826", "0.5787416", "0.57863194", "0.5779347", "0.5719056", "0.5703549", "0.5672318", "0.5672318", "0.5662091", "0.5605621", "0.5592914", "0.556283",...
0.78242314
0
Creates a copy of given source. Also copies all elements included in source. === Note: It prevents the element auto generator from running.
def copy(source, differences = {}) transaction do page = Alchemy::Page.new(attributes_from_source_for_copy(source, differences)) page.tag_list = source.tag_list if page.save! copy_elements(source, page) page end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(source)\n copy(source, true)\n end", "def from(*source)\n clone(:from => source)\n end", "def initialize(source)\n @source = source.dup\n end", "def initialize_copy(source)\n super\n\n @files = {}\n @directories = {}\n @parent = nil\n\n source.di...
[ "0.6489423", "0.62433845", "0.61325", "0.60422075", "0.6037967", "0.6029389", "0.5999448", "0.5986094", "0.57879573", "0.5696795", "0.5692167", "0.5623541", "0.5600012", "0.55929697", "0.557926", "0.5569235", "0.5562207", "0.55606365", "0.5532361", "0.55290866", "0.5499998", ...
0.63079756
1
Aggregates the attributes from given source for copy of page.
def attributes_from_source_for_copy(source, differences = {}) source.attributes.stringify_keys! differences.stringify_keys! attributes = source.attributes.merge(differences) attributes.merge!(DEFAULT_ATTRIBUTES_FOR_COPY) attributes["name"] = new_name_for_copy(differences["name"],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copied_attributes\n\t\tattrs = {}\n\t\tattrs[:year] = self.year\n\t\tattrs[:age] = self.age\n\t\tattrs[:amount] = self.amount\n\t\tattrs[:rate] = self.rate\n\n\t\tattrs\n\tend", "def copy(source, differences = {})\n transaction do\n page = Alchemy::Page.new(attributes_from_source_for_copy(sou...
[ "0.63700694", "0.6149112", "0.61212695", "0.59918267", "0.59823406", "0.59228224", "0.58575296", "0.5772124", "0.5772124", "0.57684827", "0.57280076", "0.57208675", "0.56919163", "0.5605797", "0.55020505", "0.54436356", "0.54430944", "0.5437504", "0.5417985", "0.54162776", "0...
0.66441697
0
Returns a new name for copy of page. If the differences hash includes a new name this is taken. Otherwise +source.name+
def new_name_for_copy(custom_name, source_name) return custom_name if custom_name.present? "#{source_name} (#{Alchemy.t("Copy")})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @name ||= source.name\n end", "def original_name\r\n return @name\r\n end", "def name\n @name.clone\n end", "def upname\n \tself.source_name = self.source_name.upcase\n end", "def attributes_from_source_for_copy(source, differences = {})\n source.attributes.stringify...
[ "0.62377965", "0.609232", "0.6018692", "0.60186195", "0.5994464", "0.5923436", "0.58274156", "0.5813075", "0.57940453", "0.5774666", "0.57576585", "0.5702031", "0.5624507", "0.5620286", "0.55903786", "0.5584971", "0.5584971", "0.5564892", "0.54984874", "0.54984874", "0.548480...
0.71177393
0
Instance methods Returns elements from pages public version. You can pass another page_version to load elements from in the options.
def find_elements(options = {}) finder = options[:finder] || Alchemy::ElementsFinder.new(options) finder.elements(page_version: options[:page_version] || public_version) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_versions\n list_versions_for(latest_version_of(@item.path))\n end", "def versions\n @page = ComatosePage.find params[:id]\n @version_num = (params[:version] || @page.versions.length).to_i\n @version = @page.find_version(@version_num)\n end", "def page(name, version = 'master')\n @pa...
[ "0.64767647", "0.6454186", "0.6333384", "0.6178069", "0.6140352", "0.6098897", "0.5997208", "0.5994317", "0.59845227", "0.5934784", "0.5887084", "0.58763844", "0.5855618", "0.58485055", "0.5804902", "0.57932746", "0.57721734", "0.56735915", "0.5668044", "0.5644814", "0.561458...
0.65555024
0
The page's view partial is dependent from its page layout == Define page layouts Page layouts are defined in the +config/alchemy/page_layouts.yml+ file name: contact elements: [contactform] ... == Override the view Page layout partials live in +app/views/alchemy/page_layouts+
def to_partial_path "alchemy/page_layouts/#{layout_partial_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_layout\n @user = User.current\n @blocks = @user.pref.my_page_layout\n end", "def partial(page, locals={})\n haml page, {:layout => false}, locals\n end", "def partial(page, options={})\n erb page, options.merge!(:layout => false)\n end", "def partial(page, options={})\n erb page, o...
[ "0.68671227", "0.683717", "0.6765029", "0.6765029", "0.67537457", "0.6736274", "0.6675654", "0.6532869", "0.6484138", "0.6484138", "0.6470523", "0.63357574", "0.6316716", "0.63060987", "0.62769455", "0.62694854", "0.6193108", "0.61812276", "0.61190146", "0.61190146", "0.60914...
0.6986314
0
Locks the page to given user
def lock_to!(user) update_columns(locked_at: Time.current, locked_by: user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_locking(current_user)\n if can_toggle_locking?(current_user)\n is_locked? ? unlock : lock(current_user.id) # TODO: raise exception or report error here?\n end\n end", "def unlock\n # fetching page via before filter\n @page.unlock!\n flash[:notice] = _t(:unlocked_page, ...
[ "0.656494", "0.6553101", "0.6543564", "0.65061235", "0.6367455", "0.63638264", "0.63221437", "0.63168275", "0.62339306", "0.60583335", "0.6035887", "0.5999522", "0.5996983", "0.59776926", "0.5966594", "0.5926712", "0.5919051", "0.59157383", "0.5831697", "0.58061796", "0.57819...
0.6700269
0
Returns the first published child
def first_public_child children.published.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_published_post\n posts.each do | post|\n if post.status == \"Published\"\n return post\n end\n end \n return nil \n end", "def first_child\n child 0\n end", "def first\n @children[0]\n end", "def child\n chil...
[ "0.72001415", "0.7087167", "0.6989696", "0.6948108", "0.67552274", "0.67024744", "0.65992314", "0.6485597", "0.64689666", "0.64450854", "0.62672186", "0.6251821", "0.6245374", "0.62377244", "0.6223599", "0.61639726", "0.6117876", "0.6106231", "0.61027944", "0.610012", "0.6039...
0.89237976
0
Sets the public_on date on the published version Builds a new version if none exists yet. Destroys public version if empty time is set
def public_on=(time) if public_version && time.blank? public_version.destroy! # Need to reset the public version on the instance so we do not need to reload self.public_version = nil elsif public_version public_version.public_on = time elsif time.present? versio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n self.public_at = nil\n end\n end", "def set_public_at\n if self.public? && self.public_at.nil?\n self.public_at = Time.now.to_date\n elsif !self.public?\n sel...
[ "0.7654538", "0.7654538", "0.7376827", "0.71672946", "0.6759312", "0.6756351", "0.6741109", "0.66955733", "0.66626424", "0.6596834", "0.65870017", "0.65870017", "0.6581012", "0.6525983", "0.65073943", "0.6447395", "0.64353955", "0.63897586", "0.6368077", "0.6304413", "0.62880...
0.8409115
0
Holds an instance of +FixedAttributes+
def fixed_attributes @_fixed_attributes ||= FixedAttributes.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes\n @attributes ||= {}.freeze\n end", "def class_attributes; end", "def settled_attributes\n instance_vars = self.instance_variables.map do |attr|\n attr.to_s[1..-1].to_sym\n end\n\n instance_vars & attributes\n end", "def initialize(attrs)\n @attributes = I...
[ "0.61845446", "0.61409813", "0.6066345", "0.6010968", "0.6010968", "0.60074425", "0.6007382", "0.59944797", "0.59909993", "0.5954049", "0.5952789", "0.5931509", "0.5930745", "0.5915691", "0.58780503", "0.58634305", "0.58634305", "0.58634305", "0.58634305", "0.58634305", "0.58...
0.785498
0
True if given attribute name is defined as fixed
def attribute_fixed?(name) fixed_attributes.fixed?(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caprese_is_attribute?(attribute_name)\n false\n end", "def has_attribute?(name)\n attribute_names.include?(name.to_str)\n end", "def attribute?(name)\n @attrs.has_key(name)\n end", "def attribute?(name)\n name[0] != ?_ && property?(name)\n end", "def ha...
[ "0.77255386", "0.7605714", "0.7589221", "0.75322187", "0.7531403", "0.7513595", "0.7513595", "0.7438593", "0.73766994", "0.73662615", "0.7361207", "0.7349379", "0.73150325", "0.7288607", "0.72822624", "0.72586626", "0.7247673", "0.7225438", "0.71603906", "0.71603906", "0.7145...
0.89569926
0
Checks the current page's list of editors, if defined. This allows us to pass in a user and see if any of their roles are enable them to make edits
def editable_by?(user) return true unless has_limited_editors? (editor_roles & user.alchemy_roles).any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def editor?(user)\n editors.member?(user)\n end", "def edited_by?(user)\n return true if editors.include?(user)\n false\n end", "def collection_has_editor(collection)\n project = collection.projects.first\n \n project.collaborators.each do |user|\n if ( user.user_id == current_user )\n...
[ "0.75160897", "0.74991405", "0.71535784", "0.7131423", "0.7118275", "0.7059466", "0.6983058", "0.69151217", "0.6844842", "0.67994696", "0.67953134", "0.67781925", "0.673566", "0.67277944", "0.67156863", "0.6712933", "0.6687338", "0.6681788", "0.6675318", "0.6663415", "0.66611...
0.7640376
0
Returns the value of +public_on+ attribute from public version If it's a fixed attribute then the fixed value is returned instead
def public_on attribute_fixed?(:public_on) ? fixed_attributes[:public_on] : public_version&.public_on end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def public_until\n attribute_fixed?(:public_until) ? fixed_attributes[:public_until] : public_version&.public_until\n end", "def public_on=(time)\n if public_version && time.blank?\n public_version.destroy!\n # Need to reset the public version on the instance so we do not need to reloa...
[ "0.67897606", "0.67349315", "0.66378784", "0.6513875", "0.63136464", "0.627814", "0.62405765", "0.6131895", "0.61221635", "0.6103644", "0.6103644", "0.5997213", "0.589068", "0.5831883", "0.58299226", "0.5815698", "0.5815698", "0.57469136", "0.5745179", "0.5734458", "0.5722871...
0.90320736
0
Returns the value of +public_until+ attribute If it's a fixed attribute then the fixed value is returned instead
def public_until attribute_fixed?(:public_until) ? fixed_attributes[:public_until] : public_version&.public_until end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_until\n get_info[:validUntil]\n end", "def public_on\n attribute_fixed?(:public_on) ? fixed_attributes[:public_on] : public_version&.public_on\n end", "def resolve_valid_until(resource)\n debug \"resolve_valid_until: resource: #{resource}\"\n return resource[:valid_until] = ...
[ "0.6893849", "0.6098756", "0.5830909", "0.56158406", "0.55611265", "0.5496933", "0.54936826", "0.540121", "0.5216866", "0.5216866", "0.52110165", "0.52110165", "0.5146405", "0.5098727", "0.5038938", "0.5011367", "0.5010264", "0.5008094", "0.5005111", "0.49547377", "0.49539053...
0.8529538
0
Returns the name of the last updater of this page. If no updater could be found or associated user model does not respond to +name+ it returns +'unknown'+
def updater_name updater.try(:name) || Alchemy.t("unknown") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updater\n @page_updater = User.find_by_id(updater_id)\n return _('unknown') if @page_updater.nil?\n @page_updater.name\n end", "def updater\n @page_updater = User.find_by_id(updater_id)\n return I18n.t('unknown') if @page_updater.nil?\n @page_updater.name\n end", "def last_updat...
[ "0.80433184", "0.7876233", "0.62195295", "0.61605436", "0.6080669", "0.60787225", "0.60733217", "0.6007834", "0.6006277", "0.59200984", "0.58931834", "0.5867114", "0.58505857", "0.5818562", "0.5818562", "0.5818562", "0.5818562", "0.58119565", "0.58054644", "0.5798645", "0.576...
0.7877929
1
Returns the name of the user currently editing this page. If no locker could be found or associated user model does not respond to +name+ it returns +'unknown'+
def locker_name locker.try(:name) || Alchemy.t("unknown") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_name\n name = self.le_user.nil? ? '' : self.le_user.name\n end", "def name\n @name || _('An unauthenticated user')\n end", "def name\n userName\n end", "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "def get_current_user_name\n return @na...
[ "0.70155305", "0.7012854", "0.6893756", "0.6887038", "0.68668264", "0.67299306", "0.6717222", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6716576", "0.6683593", "0.6683593", "0.6682703", "0.66596454",...
0.7211911
0
Key hint translations by page layout, rather than the default name.
def hint_translation_attribute page_layout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}.#{key}\", :scope => [:devise, :mailer], :default => key)\n end", "def apphelp_view_hint( hint_name, ctrl = controller, substitutions = {} )\n t( \"uk.org.pond.canvass.controllers.#{ ctrl.controller_name }.view_#{ hint_name }\", substitutions )\n ...
[ "0.62252426", "0.6145918", "0.6067172", "0.6056949", "0.59577864", "0.5896714", "0.587898", "0.58236665", "0.5787386", "0.5772704", "0.5763071", "0.5761801", "0.57566047", "0.5741479", "0.57239693", "0.5716337", "0.57159877", "0.57153463", "0.57010025", "0.5697198", "0.569719...
0.7309011
0
Menus (aka. root nodes) this page is attached to
def menus @_menus ||= nodes.map(&:root) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @root_menus = @system_config.menus.root_menus\n end", "def refinery_menu_pages\n Menu.new Page.fast_menu\n end", "def menu_root\n @menu_root ||= MenuNode.new do |root|\n root.add 'Home', url: url_for(action: \"index\")\n root.add 'Schedule', url: url_for(action: \...
[ "0.6964384", "0.6796254", "0.66790295", "0.664301", "0.64903283", "0.6482555", "0.6475326", "0.6472297", "0.6415325", "0.6415325", "0.6411869", "0.6287548", "0.62856853", "0.62831676", "0.6274305", "0.62559664", "0.62494963", "0.624628", "0.62175506", "0.6182194", "0.61783415...
0.7123732
0
PATCH/PUT /quiz_multiple_choice_questions/1 PATCH/PUT /quiz_multiple_choice_questions/1.json
def update respond_to do |format| if @question.update(question_params) @question_link = QuizQuestion.find_by_id(@question.questionid) @question_link.update(:points => params[:points]) @quiz = Quiz.find_by_id(@question_link.quizid) format.html { redirect_to admin_quiz_path(@quiz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfull...
[ "0.736242", "0.6936948", "0.6890847", "0.688008", "0.68256766", "0.6815529", "0.6756819", "0.6733929", "0.6727278", "0.6586325", "0.6581918", "0.6553987", "0.6552667", "0.65370405", "0.6533065", "0.6525286", "0.6510321", "0.65052205", "0.6499161", "0.64880884", "0.6459723", ...
0.71815974
1
DELETE /quiz_multiple_choice_questions/1 DELETE /quiz_multiple_choice_questions/1.json
def destroy @question_link = QuizQuestion.find_by_id(@question.questionid) @quiz = Quiz.find_by_id(@question_link.quizid) @question_link.destroy @question.destroy respond_to do |format| format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz.destroy\n ...
[ "0.78792524", "0.7532525", "0.7521668", "0.751602", "0.7417398", "0.7406101", "0.73827904", "0.7334691", "0.7331358", "0.7328529", "0.73278326", "0.7316886", "0.7280812", "0.72758335", "0.7273897", "0.727367", "0.726339", "0.7261726", "0.72251266", "0.72121465", "0.7211477", ...
0.7907844
0
Returns or caches the available voice regions
def voice_regions return @voice_regions unless @voice_regions.empty? regions = JSON.parse API.voice_regions(token) regions.each do |data| @voice_regions[data['id']] = VoiceRegion.new(data) end @voice_regions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend", "def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n ...
[ "0.6775678", "0.6685593", "0.62437755", "0.619041", "0.6139659", "0.6082175", "0.6072002", "0.60448253", "0.6022499", "0.6019206", "0.5952056", "0.5898279", "0.5894086", "0.5730845", "0.567495", "0.56162184", "0.55507034", "0.5473398", "0.5472908", "0.5456544", "0.54537153", ...
0.77316046
0
Gets a member by both IDs, or `Server` and user ID.
def member(server_or_id, user_id) server_id = server_or_id.resolve_id user_id = user_id.resolve_id server = server_or_id.is_a?(Server) ? server_or_id : self.server(server_id) return server.member(user_id) if server.member_cached?(user_id) LOGGER.out("Resolving member #{server_id} on serv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member(token, server_id, user_id)\n request(\n __method__,\n :get,\n \"#{api_base}/guilds/#{server_id}/members/#{user_id}\",\n Authorization: token\n )\n end", "def resolve_member(auth, server_id, user_id)\n MijDiscord::Core::API.request(\n :guilds_sid_members_uid,\n ...
[ "0.72594756", "0.686706", "0.6729871", "0.672679", "0.6711131", "0.6621117", "0.6584951", "0.6455718", "0.6379317", "0.6345187", "0.63284385", "0.63175076", "0.63135874", "0.61799014", "0.6137547", "0.60375476", "0.6004297", "0.60027647", "0.5984856", "0.59706724", "0.5943229...
0.693345
1
Ensures a given server object is cached and if not, cache it from the given data hash.
def ensure_server(data, force_cache = false) if @servers.include?(data['id'].to_i) server = @servers[data['id'].to_i] server.update_data(data) if force_cache server else @servers[data['id'].to_i] = Server.new(data, self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache( object = nil )\n return @cache unless object\n @cache[ object.id ] = object\n end", "def server_cache\n Facebooker::ServerCache.new(self)\n end", "def cache(data); end", "def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource...
[ "0.63391256", "0.61904895", "0.61516976", "0.6084806", "0.591721", "0.591721", "0.591721", "0.591721", "0.5889638", "0.58278745", "0.58011234", "0.5747833", "0.57383215", "0.5737154", "0.57313097", "0.5729357", "0.57159406", "0.57159406", "0.5710005", "0.5708734", "0.569502",...
0.67514664
0
Requests member chunks for a given server ID.
def request_chunks(id) @gateway.send_request_members(id, '', 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(user_id, chunk_id)\n \n end", "def request_guild_members(guild_id, query: nil, limit: 0, presences: nil,\n user_ids: nil, nonce: nil)\n opts = {\n guild_id: guild_id, query: query, limit: limit, presences: presences,\n user_ids: user_i...
[ "0.67297196", "0.5935182", "0.5888311", "0.5851953", "0.56471986", "0.56325835", "0.55518836", "0.543624", "0.53857666", "0.52964747", "0.5235238", "0.5217931", "0.518333", "0.5137657", "0.51309", "0.51022714", "0.5034936", "0.5034657", "0.50299704", "0.5021689", "0.4997468",...
0.7844438
0
Creates a new task source. API Key Scope: task_sources / create
def create_task_source_with_http_info(task_id, task_source_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TaskSourcesApi.create_task_source ...' end # verify the required parameter 'task_id' is set if @api_client.config.client_side_validati...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format....
[ "0.6784525", "0.67588407", "0.66404086", "0.6482472", "0.64441854", "0.6370203", "0.6196401", "0.6181525", "0.6179155", "0.6138338", "0.6109671", "0.60585856", "0.60565895", "0.599766", "0.59529155", "0.59504783", "0.5896084", "0.58745515", "0.58633024", "0.5860383", "0.58236...
0.70160913
0
Destroys a specific task source. API Key Scope: task_sources / destroy
def destroy_task_source(task_id, task_source_id, opts = {}) destroy_task_source_with_http_info(task_id, task_source_id, opts) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n return false if @label.to_s.empty?\n\n response = delete(\"/2.0/accounts/#{@account_id}/sources/#{@label}\")\n @label = '' if response['success']\n \n response['success']\n end", "def destroy\n @event_source = EventSource.find(params[:id])\n @event_source.destroy\n...
[ "0.6977131", "0.68544036", "0.6789122", "0.6789072", "0.6789072", "0.6787399", "0.6751036", "0.67202884", "0.6683494", "0.6683494", "0.6683494", "0.6683494", "0.66551274", "0.660641", "0.66001546", "0.6440729", "0.6427046", "0.6422421", "0.63787097", "0.6362758", "0.63618135"...
0.69371974
1
Lists all task sources. API Key Scope: task_sources / index
def index_task_sources(task_id, opts = {}) data, _status_code, _headers = index_task_sources_with_http_info(task_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sources = Source.all\n end", "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def get_sources\n response = execute_get(\"/reference/source\")\n Source.from_array(decode(r...
[ "0.7424208", "0.7080254", "0.68709004", "0.6794779", "0.6778247", "0.6724634", "0.666995", "0.66604537", "0.664931", "0.66478497", "0.662744", "0.66093487", "0.6602365", "0.66022897", "0.6527574", "0.648083", "0.6377649", "0.632348", "0.632257", "0.6320935", "0.6278621", "0...
0.72208977
1
Displays a specific task source. API Key Scope: task_sources / show
def show_task_source(task_id, task_source_id, opts = {}) data, _status_code, _headers = show_task_source_with_http_info(task_id, task_source_id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_task_source_with_http_info(task_id, task_source_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TaskSourcesApi.show_task_source ...'\n end\n # verify the required parameter 'task_id' is set\n if @api_client.config.client_side_vali...
[ "0.70183414", "0.6798049", "0.6619528", "0.6573884", "0.64321417", "0.64104146", "0.63749737", "0.63749737", "0.6264216", "0.62203485", "0.6208217", "0.6201767", "0.6147212", "0.6144776", "0.6144776", "0.6144776", "0.6144714", "0.61270815", "0.6084895", "0.60792375", "0.60431...
0.71730334
0
Displays a specific task source. API Key Scope: task_sources / show
def show_task_source_with_http_info(task_id, task_source_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TaskSourcesApi.show_task_source ...' end # verify the required parameter 'task_id' is set if @api_client.config.client_side_validation && ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_task_source(task_id, task_source_id, opts = {})\n data, _status_code, _headers = show_task_source_with_http_info(task_id, task_source_id, opts)\n data\n end", "def show\n @source = Source.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso...
[ "0.71712816", "0.67994714", "0.66205925", "0.65756875", "0.6431385", "0.6408236", "0.6376368", "0.6376368", "0.6265064", "0.62209696", "0.62095064", "0.62036186", "0.61485523", "0.61448425", "0.61432177", "0.61432177", "0.61432177", "0.61284286", "0.6086214", "0.6079957", "0....
0.7017478
1
Updates a specific task source. API Key Scope: task_sources / update
def update_task_source_with_http_info(task_id, task_source_id, task_source_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: TaskSourcesApi.update_task_source ...' end # verify the required parameter 'task_id' is set if @api_client.config.clie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_d_b_source(project_name, source_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:path]['SourceName'] = source_name\n\t\targs[:pattern] = '/projects/[ProjectName]/sources/[SourceName]'\n\t\targs[:query]['Action'] = '...
[ "0.6856491", "0.6846927", "0.6735561", "0.6549854", "0.6531449", "0.6531449", "0.6504166", "0.6504166", "0.6467782", "0.6461945", "0.6423678", "0.63436157", "0.6297604", "0.62509614", "0.6210546", "0.6210546", "0.6184272", "0.6060195", "0.6048151", "0.60389763", "0.6026645", ...
0.7085713
0
GET /concerts/1 GET /concerts/1.json
def show @concerts = Concert.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @concerts = Concert.all\n end", "def index\n @concerts = Concert.all\n end", "def index\n @concerts = Concert.all\n end", "def index\n @concerts = Concert.all\n end", "def certs\n request :get, '/certs'\n end", "def certificates\n http_path = \"http://localhost:8081/auth/...
[ "0.6857539", "0.6857539", "0.6857539", "0.6857539", "0.6825751", "0.67012244", "0.6318154", "0.61634624", "0.59816915", "0.5932119", "0.59091085", "0.58440334", "0.58393615", "0.57711065", "0.57711065", "0.57711065", "0.57711065", "0.57711065", "0.57711065", "0.5736703", "0.5...
0.7190634
0
POST /concerts POST /concerts.json
def create @concert = Concert.new(concert_params) respond_to do |format| if @concert.save format.html { redirect_to @concert, notice: 'Concert was successfully created.' } format.json { render :show, status: :created, location: @concert } else format.html { render :new } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_cert(cert)\n request :post, '/certs', cert\n end", "def create\n # TODO 既存 team を含めて保存する場合は認証に対応させる\n @concert = Concert.new(concert_savable_params)\n\n if @concert.save\n render :show, status: :created\n else\n render json: @concert.errors, status: :unprocessable_entity\n ...
[ "0.6379571", "0.63145715", "0.6294899", "0.6169793", "0.6153657", "0.6069918", "0.6063982", "0.5986319", "0.5906802", "0.58581847", "0.58420223", "0.5798164", "0.56369495", "0.56087816", "0.5593731", "0.55853546", "0.55670136", "0.5561726", "0.5550109", "0.5547926", "0.553714...
0.681669
1
PATCH/PUT /concerts/1 PATCH/PUT /concerts/1.json
def update respond_to do |format| if @concert.update(concert_params) format.html { redirect_to @concert, notice: 'Concert was successfully updated.' } format.json { render :show, status: :ok, location: @concert } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @concert = Concert.find(params[:id])\n\n respond_to do |format|\n if @concert.update_attributes(concert_params)\n format.html { redirect_to(@concert, :notice => 'Concert was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action =...
[ "0.6276455", "0.6220938", "0.61208", "0.6054474", "0.60281694", "0.60104424", "0.5969815", "0.5855968", "0.5810671", "0.5791783", "0.57803196", "0.5757534", "0.5748286", "0.5741153", "0.5737101", "0.57072324", "0.5691785", "0.56869584", "0.566978", "0.5667018", "0.5656302", ...
0.6587158
1
DELETE /concerts/1 DELETE /concerts/1.json
def destroy @concert.destroy respond_to do |format| format.html { redirect_to concerts_url, notice: 'Concert was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @concert = Concert.find(params[:id])\n @concert.destroy\n\n respond_to do |format|\n format.html { redirect_to(concerts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin...
[ "0.7223166", "0.71298605", "0.70841265", "0.7025099", "0.68171394", "0.6724928", "0.67232484", "0.6663174", "0.66484755", "0.6646611", "0.66279274", "0.6626104", "0.6593298", "0.6581772", "0.6552484", "0.6550841", "0.6522856", "0.6493245", "0.64927566", "0.64902675", "0.64724...
0.7286112
1
Update a location passing the survivor ID and locations params
def update survivor = Survivor.find(params[:survivor_id]) if survivor.location.update(location_params) status = 'SUCCESS' data = { location: survivor.location } code = 200 else status = 'ERROR' data = { message: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n @location = Location.find(params[:id])\n @location.update_attributes(params[:location])\n end", "def update_location(location={})\n\t\tclient.update(location)\...
[ "0.7864647", "0.75537753", "0.7513022", "0.74589866", "0.74088013", "0.74088013", "0.74088013", "0.73278177", "0.7314253", "0.7303085", "0.72513926", "0.7250999", "0.72506726", "0.72506726", "0.72493535", "0.7247539", "0.72156376", "0.7192631", "0.7133309", "0.705359", "0.705...
0.83560354
0
should accept anIngredient instance as an argument, and create a new Allergy instance for this User and the given Ingredient
def declare_allergy(ingredient) Allergy.new(self, ingredient) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def declare_allergy(ingredient)\n Allergy.new(self, ingredient)\n end", "def declare_allergy(ingredient)\n new_allergy = Allergy.new(ingredient, self)\n end", "def initialize(user_obj, ingredient_obj)\n @user = user_obj\n @ingredient = ingredient_obj\n self.class.all << self\n end...
[ "0.7298249", "0.72922474", "0.6973227", "0.67246425", "0.66941124", "0.66941124", "0.66941124", "0.66844887", "0.6672038", "0.6654216", "0.6587144", "0.65647405", "0.653361", "0.64527476", "0.6431332", "0.6362358", "0.6308599", "0.628028", "0.6279714", "0.6272156", "0.6265288...
0.7321128
0
should return the top three highest rated recipes for this user.
def top_three_recipes top_three = RecipeCard.all.select {|atr| atr.user == self} top_three.sort_by {|atr| atr.rating}.reverse top_three[0..2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_three_recipes\n\t\trecipes.select { |recipe| recipe.rating }.sort_by { |recipe| recipe.rating }.last(3)\n\tend", "def top_three_recipes\n recipe_cards.max_by(3) {|recipe_cards| recipe_cards.rating}\n end", "def top_three_recipes\n self.recipes.sort_by {|info| info.rating}.pop(3)\n end",...
[ "0.8499759", "0.82924527", "0.8261789", "0.8228288", "0.81715804", "0.80814767", "0.7960795", "0.7916239", "0.7819016", "0.7121356", "0.6858638", "0.68250215", "0.6426967", "0.6369836", "0.6271192", "0.6261815", "0.6221157", "0.62033117", "0.61783266", "0.61571604", "0.611675...
0.84139
1
Usermost_recent_recipe should return the recipe most recently added to the user's cookbook.
def most_recent_recipe most_recent_recipe = RecipeCard.all.select {|atr| atr.user.name == self.name} most_recent_recipe.sort_by {|atr| atr.date}.reverse[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_recent_recipe\n recipes.last\n # should return the recipe most recently added to the user's cookbook.\n end", "def most_recent_recipe\n recent_recipe_array = get_user_recipes.collect do |recipe_card|\n recipe_card.recipe\n end\n recent_recipe_array[-1]\n ...
[ "0.90544057", "0.8129733", "0.8013537", "0.7768915", "0.77528435", "0.77128524", "0.7670974", "0.76212656", "0.737122", "0.73588014", "0.7195698", "0.71950734", "0.71848965", "0.6933137", "0.6606357", "0.6539404", "0.5980259", "0.597509", "0.59241074", "0.5915716", "0.5555785...
0.82149893
1
Wraps the rendered content in a replace statement according to your +Apotomo.js_framework+ setting. Received the same options as render plus an optional +selector+ to change the selector. Example (with Apotomo.js_framework = :jquery): def hungry replace will render the current state's view and wrap it like "$(\"mouse\"...
def replace(*args) wrap_in_javascript_for(:replace, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace(options={})\n content = render(options)\n Apotomo.js_generator.replace(options[:selector] || self.name, content)\n end", "def js_replace_element(element, content)\n rjs_method :replace_element, :element => element, :content => content\n end", "def replace_html(id, *options_for_rend...
[ "0.784593", "0.63438386", "0.60297877", "0.59759146", "0.58772886", "0.5541985", "0.5521747", "0.53994393", "0.5314778", "0.5306125", "0.5281053", "0.5277792", "0.5156386", "0.5112908", "0.50518495", "0.5047453", "0.5008409", "0.49989828", "0.4993827", "0.4993827", "0.4984967...
0.6665707
1
The object is initialized using a type and a payload, which is set inside a hash in the attachment property
def initialize(type:, payload:) @attachment = { type: type, payload: payload } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_stream_proxy_item_with_attachment(type)\n item = ActivityStreamProxy.new\n item.updated = item.created = Time.now.to_i\n item.message = 'blah blah'\n item.attachment_type = type\n item.activity_type = 'post'\n item\n end", "def initialize(object)\n @createdAt = DateTime.iso86...
[ "0.6750955", "0.67469454", "0.66503114", "0.6507464", "0.6500773", "0.6479913", "0.6419734", "0.64136535", "0.6407179", "0.63271993", "0.6286492", "0.62552685", "0.623999", "0.6207276", "0.6191753", "0.6179171", "0.6175682", "0.61215854", "0.6089303", "0.60810816", "0.6023432...
0.859428
0
transfer data in read direction Option `transfer_until` can be (higher to lower priority): :eof => transfer until channel is closed false => transfer only one block The method does nothing if a transfer is already pending, but might raise the transfer_until option, if the requested priority is higher than the pending t...
def read( transfer_until: ) if !@pending_read @pending_read = true @transfer_until = transfer_until Fiber.schedule do connect begin begin # 140 bytes transfer is required to trigger an error in spec "can cancel a query", when get_last_error doesn't wait for readability between PQ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write( transfer_until: )\n\t\t\tif !@pending_write\n\t\t\t\t@pending_write = true\n\t\t\t\t@transfer_until = transfer_until\n\n\t\t\t\tFiber.schedule do\n\t\t\t\t\tconnect\n\n\t\t\t\t\t# transfer data blocks of up to 65536 bytes\n\t\t\t\t\t# until the observed connection is writable again or\n\t\t\t\t\t# no da...
[ "0.5212248", "0.5005712", "0.49220267", "0.48687926", "0.477549", "0.477549", "0.4757391", "0.47440568", "0.47286245", "0.4728019", "0.4728019", "0.46795863", "0.46637052", "0.46637052", "0.46462226", "0.4591133", "0.4591133", "0.4587344", "0.4577589", "0.45359576", "0.453448...
0.6370746
0
transfer data in write direction Option `transfer_until` can be (higher to lower priority): :eof => transfer until channel is closed :wouldblock => transfer until no immediate data is available IO object => transfer until IO is writeable The method does nothing if a transfer is already pending, but might raise the tran...
def write( transfer_until: ) if !@pending_write @pending_write = true @transfer_until = transfer_until Fiber.schedule do connect # transfer data blocks of up to 65536 bytes # until the observed connection is writable again or # no data left to read loop do len = 65536 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(data)\n timeout = false\n loop do\n result = @socket.write_nonblock(data, :exception => false)\n return result unless result == :wait_writable\n\n raise TimeoutError, \"Write timed out after #{@write_timeout} seconds\" if timeout\n\n timeout = true unless...
[ "0.5430953", "0.5355041", "0.53184587", "0.5309113", "0.52889735", "0.5275679", "0.52229613", "0.52188647", "0.51343244", "0.5092202", "0.49986386", "0.49986386", "0.49598667", "0.4948288", "0.49450463", "0.49375948", "0.49345404", "0.49214482", "0.49214482", "0.49214482", "0...
0.76560706
0
Rewrite the hostname to verify that address resolution goes through the scheduler.
def address_resolve(hostname) if hostname =~ /\Ascheduler-(.*)/ hostname = $1 end super(hostname) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_hostname_dns_reverse_lookup\n my_fqdn = %x{hostname -f}.chomp\n if !$?.success?\n opoo \"You can't run 'hostname -f'!? I can't check your hostname dns reverse lookup.\"\n elsif %x{traceroute -m 2 \"#{my_fqdn}\" 2>/dev/null}.chomp.lines.to_a.size != 1 || !$?.success?\n # Actually, passi...
[ "0.7163982", "0.6837461", "0.6661046", "0.6562709", "0.6546474", "0.6545229", "0.6535204", "0.6486924", "0.6417481", "0.64047587", "0.63340783", "0.62741894", "0.6247572", "0.6207228", "0.6206379", "0.62054837", "0.6203127", "0.6182045", "0.6166929", "0.61304015", "0.60852796...
0.769199
0
Option tags for the minimum version dropdown.
def minimum_version_options possible_versions = versions.decorate.reverse h.options_from_collection_for_select(possible_versions, :id, :name, minimum_version_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versions_for_select(unit_member)\n static_options = [['Most Recent','']]\n dynamic_options = package_branch.packages.map {|p| [p.version, p.id]}\n static_options + dynamic_options\n end", "def option_tag(text); end", "def versions_for_select(unit_member)\n static_options = [['Most Recent',...
[ "0.65655965", "0.6291781", "0.6222346", "0.60295516", "0.5924578", "0.5909116", "0.5897947", "0.5897947", "0.5879712", "0.5859709", "0.5830446", "0.581878", "0.57722145", "0.5749543", "0.56881016", "0.5679693", "0.56513363", "0.5644557", "0.56415504", "0.56415504", "0.5611603...
0.784608
0
The BSON type for false values is the general boolean type of 0x08.
def bson_type Boolean::BSON_TYPE end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean\n Util.from_bytes :boolean, value\n end", "def literal_false\n BOOL_FALSE\n end", "def to_bool() false end", "def boolean_type\n 'Boolean'\n end", "def typecast_value_boolean(value)\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i, /\\Ano?\\z/...
[ "0.7261198", "0.7150541", "0.7115581", "0.70078063", "0.694105", "0.68126124", "0.67763114", "0.6692453", "0.66675454", "0.66515124", "0.65711933", "0.6522068", "0.6522068", "0.6510498", "0.63982844", "0.6395816", "0.63822234", "0.6377016", "0.6376157", "0.63702166", "0.63640...
0.81063634
0
store data for self and replicas of the next 2 nodes
def replicate_data_before_registration sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second} sorted_hash_keys << @@my_key sorted_hash_keys = sorted_hash_keys.sort hash = Hash[sorted_hash_keys.map.with_index.to_a] nodes_to_be_replicated = [] nodes_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicas; end", "def next_replica\n return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]\n end", "def write_our_node_info\n # Since more than one AppController could write its data at the same \n # time, get a lock before we write to it.\n ZKInterface....
[ "0.6573782", "0.5976313", "0.5968842", "0.56824005", "0.5649531", "0.5620887", "0.5620887", "0.5620887", "0.55597156", "0.55150265", "0.54775417", "0.5420685", "0.5368126", "0.53628385", "0.53515214", "0.5318112", "0.5316111", "0.5288605", "0.5259841", "0.5241547", "0.5241532...
0.6228513
1
replicate key and it's values with vector clocks
def replicate_key_values key, value unless @@key_value_storage[key] @@key_value_storage[key] = value else existing_vector_clocks = @@key_value_storage[key] value.select { |k, _v| !k.in?(existing_vector_clocks)}.each { |vector_clock, vector_clock_data| @@key_value_storage[key][vector_clock] = v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(key, value, timestamp)\n \n end", "def set(key, value, timestamp)\n @hsh[key] ||= [] \n @hsh[key].push([timestamp,@hsh[key].size,value])\n end", "def fill_schedule\n @schedule.each do |key,value|\n (6..20).each { |n| @schedule[key][\"#{n}:30 - #{n+1}:30\"] = \"0\" }\n e...
[ "0.55555815", "0.5536153", "0.54727256", "0.54425293", "0.5378288", "0.5374871", "0.5360332", "0.53587556", "0.53352726", "0.5334153", "0.530024", "0.52600235", "0.5246585", "0.52032", "0.5194444", "0.5194444", "0.519048", "0.5158899", "0.5148195", "0.5141811", "0.5141811", ...
0.78857225
0
return all nodes responsible for replications of given key
def get_responsible_nodes key responsible_hash_keys = [] if @@dynamo_nodes.size <= ENV['REPLICATION'].to_i return @@dynamo_nodes end responsible_node_key = 0 previous = 0 sorted_hash_keys = @@dynamo_nodes.sort_by { |_k,v| v.first.second.to_i}.map {|_k,v| v.first.second} sorted_hash_k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node(key); end", "def search_key key\n node = self.head\n while node\n return node if node.key == key\n nc = node.child \n while nc\n return nc if nc.key == key\n ncs = nc.sibling\n while ncs \n return ncs if ncs.key == key\n ncs = ncs.siblin...
[ "0.66248137", "0.6287788", "0.605348", "0.604606", "0.5989856", "0.58627766", "0.5781069", "0.570788", "0.5687022", "0.5650456", "0.56468624", "0.56168175", "0.55851215", "0.54908645", "0.54837656", "0.5474841", "0.5400134", "0.5344645", "0.5342906", "0.53392947", "0.5325718"...
0.66238743
1
Looks up the specified option representing a date format and returns the evaluated the result. This is used inside the Markaby template. For example, we have an option :header_label which represents the content at the top of the calendar that outputs the month name and year by default, like "October 2009". Inside the t...
def evaluate_date_format_option(option, *args) value = self.send(option) case value when String args.first.strftime(value) when Symbol args.first.send(value) when Proc value.call(*args) else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calendar_date_select_process_options(options)\r\n calendar_options = {}\r\n callbacks = [:before_show, :before_close, :after_show, :after_close, :after_navigate]\r\n for key in [:time, :valid_date_check, :embedded, :buttons, :format, :year_range, :month_year, :popup, :hidden, :minute_interval] +...
[ "0.6111591", "0.61101574", "0.57468975", "0.5701966", "0.5671247", "0.563973", "0.56349176", "0.540329", "0.53684866", "0.5334197", "0.5309169", "0.52678305", "0.5258425", "0.5245269", "0.51605695", "0.5099747", "0.5096127", "0.50923777", "0.5084644", "0.5055674", "0.49919403...
0.82558006
0
Returns an array of week objects which contain date objects for every day that this calendar displays. It may contain a few days from the previous and next months. The EventCalendar::Week class inherits from Array. For example: puts EventCalendar.new(2009, 10).weeks.inspect [ [Sun, 27 Sep 2009, Mon, 28 Sep 2009, Tue, 2...
def weeks days_in_month = Time.days_in_month(month, year) starting_day = date.beginning_of_week() -1.day + beginning_of_week.days ending_day = (date + days_in_month).end_of_week() -1.day + beginning_of_week.days (starting_day..ending_day).to_a.in_groups_of(7).collect { |week| Week.new(week, events) } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weeks\n @weeks ||= days.slice_when do |day|\n Date::DAYNAMES[day.wday] == LAST_DAY_OF_THE_WEEK\n end.to_a\n end", "def week\n first_day_of_week = @date.monday\n \n days_of_week = []\n 7.times do |time|\n days_of_week << day_and_types(first_day_of_week + time.days)\n en...
[ "0.73919064", "0.71244943", "0.7060845", "0.69115925", "0.68312347", "0.6690439", "0.66887707", "0.66845447", "0.6633913", "0.6609287", "0.65209407", "0.6400425", "0.6387638", "0.6370599", "0.6363179", "0.6354335", "0.6284688", "0.62646174", "0.62606645", "0.62249756", "0.620...
0.7381316
1
Reads the template file specified in options[:template] and evaluates it with Markaby, passing this EventCalendar instance as the event_calendar local variable.
def render_with_markaby Markaby::Builder.new(:event_calendar => self, :template => File.exists?(template) ? File.read(template) : template) { eval(template) }.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_template!\n feed = self\n eval(File.read(@file))\n end", "def erubis_template template_filename, *args\n require 'erubis'\n template = Erubis::Eruby.new File.read(template_filename)\n text = template.result *args\n text\nend", "def template_source\n @template_sour...
[ "0.6094496", "0.5925259", "0.59024906", "0.57770765", "0.57595277", "0.57585204", "0.5723875", "0.5656277", "0.56531215", "0.56531215", "0.5652995", "0.56508285", "0.56458557", "0.56267565", "0.56214136", "0.5579688", "0.55674654", "0.55658466", "0.5550441", "0.552171", "0.54...
0.68115604
0
GET /favorite_quotes GET /favorite_quotes.json
def index @favorite_quotes = FavoriteQuotes.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @favorite_quotes = FavoriteQuotes.find params[:id]\n end", "def index\n @favorite_quotes = FavoriteQuote.all\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to ...
[ "0.72462803", "0.71826196", "0.67924684", "0.6663253", "0.65299594", "0.6522242", "0.6467721", "0.6465894", "0.64267486", "0.64203054", "0.6241006", "0.62381554", "0.62215537", "0.6219564", "0.6217631", "0.6208107", "0.619769", "0.61876327", "0.6185558", "0.61689633", "0.6159...
0.7224131
1
GET /favorite_quotes/1 GET /favorite_quotes/1.json
def show @favorite_quotes = FavoriteQuotes.find params[:id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @favorite_quotes = FavoriteQuotes.all\n end", "def index\n @favorite_quotes = FavoriteQuote.all\n end", "def set_favorite_quote\n @favorite_quote = FavoriteQuotes.find(params[:id])\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond...
[ "0.7068197", "0.70113015", "0.67967796", "0.6791812", "0.6652004", "0.6570249", "0.65064317", "0.6489125", "0.6485078", "0.6452935", "0.64184445", "0.6394263", "0.6387746", "0.63523906", "0.63523906", "0.63523906", "0.62890726", "0.62786096", "0.62594074", "0.62575746", "0.62...
0.7344033
0
POST /favorite_quotes POST /favorite_quotes.json
def create @favorite_quotes = FavoriteQuotes.new(favorite_quote_params) respond_to do |format| if @favorite_quotes.save format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' } format.json { render action: 'show', status: :created, location: @favorit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favorite_quote_params\n params.require(:favorite_quote).permit(:quote_id, :user_id)\n end", "def create\n @favorite_quote = FavoriteQuote.where(quote_id: favorite_quote_params[:quote_id], user_id: favorite_quote_params[:user_id]).first\n @present = @favorite_quote.present?\n if !@present\n ...
[ "0.6770589", "0.674791", "0.6584967", "0.65183365", "0.6434018", "0.64014703", "0.62974006", "0.6260733", "0.62450284", "0.62349504", "0.621467", "0.6208406", "0.6149613", "0.6057188", "0.60201186", "0.6017307", "0.6008431", "0.5939574", "0.5939574", "0.5908833", "0.59071416"...
0.760315
0
PATCH/PUT /favorite_quotes/1 PATCH/PUT /favorite_quotes/1.json
def update respond_to do |format| if @favorite_quotes.update(favorite_quote_params) format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @favorite_quote.update(favorite_quote_params)\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_quote }\n else\n format.html { re...
[ "0.7239706", "0.64053166", "0.6399559", "0.63990206", "0.63990206", "0.63952893", "0.6328645", "0.6328645", "0.6328645", "0.6328645", "0.6328645", "0.6328645", "0.6328645", "0.6323964", "0.63146555", "0.6242834", "0.62257504", "0.6225597", "0.62140584", "0.62085044", "0.62085...
0.74708974
0
DELETE /favorite_quotes/1 DELETE /favorite_quotes/1.json
def destroy @favorite_quotes.destroy respond_to do |format| format.html { redirect_to favorite_quotes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n ...
[ "0.7081407", "0.7044832", "0.7043572", "0.7043572", "0.7043572", "0.70319635", "0.69949263", "0.6921032", "0.6868703", "0.68162894", "0.6793876", "0.6780971", "0.6753304", "0.6753304", "0.67384213", "0.6728234", "0.67271227", "0.6720535", "0.6720535", "0.6720535", "0.6720535"...
0.7744233
0
Determines if the output file is uptodate with respect to the input file.
def up_to_date?(outputdir) f = effective_output_path(outputdir) Puppet::FileSystem::exist?(f) && (Puppet::FileSystem::stat(@path) <=> Puppet::FileSystem::stat(f)) <= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uptodate?(path)\n fileutils.uptodate?(path, to_a)\n end", "def destination_file_up_to_date?\n return false unless compilation_context.incremental_build?\n\n source_db = compilation_context.source_file_database\n target_db = compilation_context.target_file_database\n\n ...
[ "0.7453442", "0.71965396", "0.7051112", "0.69580364", "0.68328726", "0.6602327", "0.6579406", "0.65590996", "0.65590996", "0.65590996", "0.6530201", "0.6502647", "0.6458627", "0.6444288", "0.6379151", "0.6324333", "0.63078916", "0.6291455", "0.62136084", "0.6212185", "0.60696...
0.7395101
1
Sets the path to the output file.
def output_path=(path) @output_path = path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(value)\n @output_file = value\n end", "def output_dir(pathname)\n @output_dir = pathname\n end", "def setOutdir(dir)\r\n @context.outdir = dir\r\n end", "def output_file=(new_output_file)\n @output_file = File.new(new_output_file.respond_to?(:path) ? new_output...
[ "0.73445785", "0.71677786", "0.6938625", "0.69192547", "0.691595", "0.6894891", "0.6869853", "0.684968", "0.6826659", "0.68003535", "0.6664824", "0.6604574", "0.6586205", "0.6541733", "0.64977574", "0.64963555", "0.64486027", "0.6433607", "0.64183754", "0.63901585", "0.633683...
0.85513866
0
Returns the outputpath to use given an outputdir that may be nil If outputdir is not nil, the returned path is relative to that outpudir otherwise determined by this input.
def effective_output_path(outputdir) outputdir ? File.join(outputdir, output_name) : output_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_dir\n @output_dir\n end", "def output_dir\n output_dir = @output_dir.nil? ? Dir.getwd : @output_dir\n FileUtils.mkdir_p(output_dir) unless ::File.directory?(output_dir)\n output_dir\n end", "def output_dir\n @args.options[:output_dir]\n end", "def output_dir_path\n ...
[ "0.69500035", "0.6931714", "0.6928832", "0.6870395", "0.6809846", "0.6809846", "0.6604852", "0.647857", "0.647857", "0.64342636", "0.6433701", "0.64082795", "0.64067245", "0.6386228", "0.6328593", "0.62349045", "0.6227137", "0.6210103", "0.61163205", "0.6043085", "0.6009847",...
0.7989197
0
Check if the list of items currently includes the product we're adding: if it does then increment the quantity by 1, if it doesn't then `build` a new line item.
def add_product(product) current_item = line_items.find_by(product_id: product.id) # find the current item in the line items. find_by() returns an existing LineItem or nil. if current_item # if the current item is present... current_item.quantity += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_product(product)\n current_item = line_items....
[ "0.72568995", "0.7205166", "0.71707654", "0.7121318", "0.7110793", "0.7105055", "0.7057212", "0.70511305", "0.704573", "0.70263726", "0.6994935", "0.6983436", "0.6979192", "0.6970833", "0.6929807", "0.6915847", "0.68899655", "0.6868626", "0.68369174", "0.66633385", "0.6646727...
0.72328687
1
notifiable path defaults to nil, subject to override
def notifiable_path event, key nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n nil\n end", "def path; super; end", "def notification_link(n)\n url_for get_root(n.notifiable)\n end", "def notifiable_url\n\t\tif [\"Reblog\", \"Like\", \"Comment\"].include?(self.notification_type)\n\t\t\t\"posts/#{notification_id}\"\n\t\telse\n\t\t\t\"blogs/#{notification_id}\"\n\t\tend...
[ "0.62088656", "0.61896706", "0.6167832", "0.6119965", "0.60685927", "0.5874951", "0.5874951", "0.5874951", "0.5861587", "0.58129966", "0.5796131", "0.579061", "0.57497805", "0.5728434", "0.5720119", "0.5717543", "0.5717543", "0.5714112", "0.5714112", "0.5714112", "0.5714112",...
0.7604133
0
Act on a Shared event by adding the entity to the collection of the user shared with Return a string reporting on the action
def act notification, options={} sharee.collect shared I18n.t 'notification.user.shared_event.act', shared: shared.decorate.title end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_shared_case _user, the_case, _team\n data = {\n category: 'Cases',\n action: 'Shared a Case',\n label: the_case.case_name,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end", "def show\n @share = Share.find(...
[ "0.63199276", "0.6080797", "0.6004273", "0.5902167", "0.5844354", "0.5690635", "0.56877756", "0.5661828", "0.561443", "0.5608959", "0.55690444", "0.55511165", "0.5546395", "0.55316454", "0.551506", "0.5489173", "0.547799", "0.5463534", "0.5453765", "0.5441472", "0.54288423", ...
0.7023812
0
Identifies the set of requesting entities on whose behalf the requester is acting. Used to communicate the chain of requesters when proxying occurs.
def requester_ids @requester_ids ||= [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def owner_request_ids\n Request.by_owner.pluck(:id).sort\n end", "def friend_requests\n inverse_friendships.map{|friendship| f...
[ "0.6379794", "0.6379794", "0.6379794", "0.6113816", "0.6027116", "0.5965354", "0.5965354", "0.5870252", "0.58090097", "0.58090097", "0.57914853", "0.5784318", "0.5777849", "0.5718557", "0.5658669", "0.56404227", "0.56281275", "0.5595359", "0.5563848", "0.5552292", "0.5547178"...
0.70885617
0
Construct an XML fragment representing the scoping
def to_xml(xml=Builder::XmlMarkup.new) attributes = {} attributes['ProxyCount'] = proxy_count if proxy_count xml.tag!('samlp:Scoping', attributes) { xml << idp_list.to_xml if idp_list requester_ids.each { |requester_id| xml << requester_id.to_xml } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml\n Builder.new(owner, grants).to_s\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n xml.tag!('saml:AuthnContext') {\n xml.tag!('saml:AuthnContextClassRef', class_reference) unless class_reference.nil?\n xml.tag!('saml:AuthnContextDecl', context_declaration) unless co...
[ "0.5577516", "0.5316032", "0.52901775", "0.52876824", "0.5279696", "0.52443534", "0.5231008", "0.5151386", "0.51359373", "0.51277447", "0.5117666", "0.5112889", "0.5086575", "0.5077508", "0.5046558", "0.5043996", "0.50414675", "0.50414675", "0.50414675", "0.50414675", "0.5041...
0.5523067
1
Marks all notifications from other messages in this message's post as read
def read_notifications # Update post notification post_notification = @message.sender .notifications_unread .where("origin_type = ? AND origin_id = ?", 'Post', @post.id) .first post_notification.update_attributes(read: true) unless post_notification.nil? # Update post's messages notificatio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_notification_as_read!\n notification = User.find(@userid).notifications\n @received_msg.each do |notify|\n notification.update(notify['id'], :checked => true);\n end\n end", "def set_to_read\n\t\t#We find all the messages in the current conversation\n\t\t@conversation_messages = PersonalM...
[ "0.76421946", "0.7591705", "0.7411796", "0.7147109", "0.7122754", "0.70629156", "0.7049509", "0.7016717", "0.6981583", "0.6934102", "0.69249743", "0.6899472", "0.6876121", "0.68712413", "0.68712413", "0.68542117", "0.6831344", "0.6796928", "0.67030245", "0.669732", "0.6693599...
0.787555
0
Generates notifications for the post sender and senders of all other messages in the post
def generate_notifications notification = "New Reply to '#{@post.content}'" Notification.create(content: notification, user_id: @post.sender.id, user_type: @post.sender.class.name, origin_type: 'Message', origin_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_notifications\n send_new_post_to(:sender) if self.sender.notify_on_comment_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_comment_received\n end", "def send_post_notification(post)\n @post = post\n @post = post\n @poster = post.poster\n if @post.post_...
[ "0.7554275", "0.7070978", "0.693667", "0.68602484", "0.68598044", "0.6527385", "0.6418056", "0.63515574", "0.61589366", "0.608584", "0.6058324", "0.6041351", "0.6030287", "0.600314", "0.5989574", "0.5961543", "0.59549814", "0.5916699", "0.5887705", "0.58654064", "0.58397955",...
0.82324815
0
Deletes all the notifications created by this message
def delete_notifications Notification.where(origin_type: 'Message', origin_id: @message.id).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_notifications\n Notification.where(actor_id: id).destroy_all\n end", "def destroy\n @notification.destroy\n end", "def deleteUserNotifications(u)\n @ns = getUserNotifications(u)\n @ns.each do |n|\n n.destroy\n end\n redirect_to \"/notifications\", notice...
[ "0.7831528", "0.69103575", "0.684473", "0.68241733", "0.6698235", "0.6557572", "0.6532985", "0.64705175", "0.6457546", "0.64340276", "0.63348544", "0.63290614", "0.63246185", "0.62585264", "0.62550646", "0.62157744", "0.6124335", "0.6091518", "0.60877657", "0.60693455", "0.60...
0.8510159
0
Updates the number of unread messages from the post's course
def update_course_unread @course.update_attributes(unread: find_unread_from_course(@course)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_unread_message_count\n self.unread_messages = 1\n end", "def should_update_inbox_unread_count!\n i = mailbox.inbox.unread(self).pluck(\"distinct conversations.id\").size\n update_attributes(inbox_unread_count: i) if i != inbox_unread_count\n end", "def unread_count\n @status = Messenger.i...
[ "0.69035935", "0.68209493", "0.67975634", "0.6781684", "0.6687337", "0.66185856", "0.6603144", "0.6521681", "0.64845574", "0.64769536", "0.64212084", "0.63990456", "0.6243325", "0.6219799", "0.6142102", "0.61296296", "0.6124331", "0.6122542", "0.6108387", "0.6084206", "0.6082...
0.73119307
0
Return a route_descriptor_ar of all liverunning routes.
def live_route_ar route_descriptor_ar(ActionController::Routing::Routes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_descriptor_ar(routeset)\n routeset.routes.collect do |route|\n name = routeset.named_routes.routes.index(route).to_s\n verb = route.conditions[:method].to_s.upcase\n path = route.segments.inject(\"\") { |str,s| str << s.to_s }\n path.chop! if path.length > 1\n { :name=>name, :verb=>verb, ...
[ "0.6866789", "0.66316754", "0.66316754", "0.66043854", "0.6534461", "0.6520758", "0.6508582", "0.6504848", "0.6418776", "0.64057064", "0.64037836", "0.6356126", "0.63087004", "0.6296855", "0.6284363", "0.6217241", "0.6193909", "0.6162267", "0.6162267", "0.6150826", "0.6143963...
0.6752707
1
Return a route_descriptor_ar of all routes generated by an actual call to ActionController::Routing::RouteSetresources(...)
def genuine_rails_resources_route_ar(*args) temp_routes = ActionController::Routing::RouteSet.new temp_routes.draw {|map| map.resources(*args) } route_descriptor_ar(temp_routes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def route_descriptor_ar(routeset)\n routeset.routes.collect do |route|\n name = routeset.named_routes.routes.index(route).to_s\n verb = route.conditions[:method].to_s.upcase\n path = route.segments.inject(\"\") { |str,s| str << s.to_s }\n path.chop! if path.length > 1\n { :name=>name, :verb=>verb, ...
[ "0.7859249", "0.7302301", "0.7089654", "0.70323205", "0.69529617", "0.6748385", "0.6711443", "0.6664264", "0.66534805", "0.66531897", "0.660075", "0.6540162", "0.65062416", "0.6499077", "0.6484103", "0.64179385", "0.64179385", "0.64056253", "0.63909304", "0.637105", "0.637105...
0.7855417
1
runs should_have_collec_refer_classics and should_have_collec_named_classics, without passing a block.
def should_have_collec_classics(singular, plural, options={}) should_have_collec_refer_classics singular, plural, options should_have_collec_named_classics singular, plural, options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover:...
[ "0.51922816", "0.51492953", "0.5114626", "0.510954", "0.5085699", "0.50757587", "0.49667674", "0.49412054", "0.49276024", "0.49249285", "0.48320246", "0.48029396", "0.4787395", "0.47777817", "0.4738731", "0.46949497", "0.46726587", "0.46366835", "0.4634765", "0.46289808", "0....
0.7278013
0
Deletes all files associated with an import from the application S3 bucket. This should be done before a new batch is uploaded. Responds to `POST /imports/:id/delete_all_files`
def delete_all_files @import.delete_all_files head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3_delete_files\n return unless S3_ENABLED\n s3 = AWS::S3.new\n bucket = s3.buckets[s3_bucket_name]\n bucket.objects.with_prefix(\"#{id}/\").each do |obj|\n obj.delete\n end\n end", "def delete_remaining_s3_assets\n # This gets up to 1000 objects.\n # If the user has over 1000 obje...
[ "0.65903336", "0.62915355", "0.6160649", "0.6137025", "0.6104057", "0.6061183", "0.60458076", "0.5976717", "0.5976717", "0.58216095", "0.5788567", "0.5683097", "0.5638799", "0.5607674", "0.55751145", "0.5552275", "0.55318415", "0.5516909", "0.55101055", "0.55101055", "0.55101...
0.78641427
0
Returns content for the "upload package" form. Responds to `GET /imports/:id/edit` (XHR only)
def edit render partial: "imports/upload_package_form" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file\n @site_mapping = SiteMapping.new\n @site_mapping.parent_id = params[:site_mapping_id]\n \n @chunk = Chunk.new\n @chunk_version = ChunkVersion.new\n \n render :update do |page|\n page.replace_html 'content', :partial => 'upload'\n page.show 'content'...
[ "0.5997949", "0.5821813", "0.57742816", "0.5730904", "0.56763494", "0.558191", "0.5517668", "0.5469231", "0.54390067", "0.54184127", "0.54125154", "0.53693277", "0.53506833", "0.53503954", "0.52851397", "0.52589756", "0.5237663", "0.52260196", "0.5214016", "0.52065986", "0.52...
0.754743
0
Returns content for the createimport form. Responds to `GET /imports/new` (XHR only)
def new authorize Import @import = Import.new render partial: "imports/import_form" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end", "def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n...
[ "0.71821064", "0.71821064", "0.70066434", "0.6983878", "0.69395477", "0.68609446", "0.6853397", "0.6770554", "0.6705284", "0.67012495", "0.6694073", "0.6683068", "0.6676232", "0.6631467", "0.6616033", "0.6590757", "0.6555501", "0.6521699", "0.645444", "0.6388569", "0.6346248"...
0.7286799
0
Receives a file uploaded via the "Edit Import" a.k.a. "Upload Package" form, writing it to a temporary location on the file system. (It may be a compressed file that will need to get unzipped). The request must include an `XFilename` header containing the filename of the uploaded file. Responds to `POST /imports/:id/up...
def upload_file filename = request.headers['X-Filename'] if filename.blank? render plain: "X-Filename header not provided", status: :bad_request and return end input = request.env['rack.input'] input.rewind input.set_encoding(Encoding::UTF_8) @import.save_file(file: input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def upload_file\n file = google_session.upload_from_file(file_params[:file].tempfile,\n file_params[:fil...
[ "0.6676131", "0.6425689", "0.6304452", "0.62192106", "0.6211437", "0.6201775", "0.61791986", "0.61317736", "0.61317366", "0.6117935", "0.61041415", "0.60932565", "0.6059522", "0.6057997", "0.60557497", "0.6009718", "0.6007346", "0.5980719", "0.5947489", "0.586694", "0.586694"...
0.7349998
0
Method wich represent a step of the vertical down_to_top_traversal It just gather items
def down_to_top_traversal_step(current_branch=@current_branch, vertical_cursor=@vertical_cursor) current_branch << vertical_cursor.item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def down_to_top_traversal(current_branch=@current_branch, vertical_cursor=@vertical_cursor)\n @vertical_cursor = vertical_cursor\n while @vertical_cursor != nil and @vertical_cursor.item != nil\n down_to_top_traversal_step(current_branch)\n @vertical_cursor = @vertical_cursor.parent...
[ "0.69690025", "0.61180013", "0.6053168", "0.6053168", "0.5991114", "0.5901524", "0.58669037", "0.58380634", "0.5795634", "0.57261217", "0.5711309", "0.5656257", "0.56524855", "0.5603405", "0.55487365", "0.5533268", "0.54865205", "0.5482268", "0.54663086", "0.5458029", "0.5456...
0.76982266
0
genera el icono y las listas de enlaces, tanto para el menu de escritorio como el de escritorio, que en mobilize son distintas utiliza el helper nav_link
def nav_mobile_menu(items) nav_mobile = link_to raw('<i class="material-icons">menu</i>'), "#", data: {activates: "mobile-nav"}, class: "button-collapse" nav_mobile += content_tag :ul, class: "right hide-on-med-and-down" do items.collect { |item| concat( nav_link( item[:text], item[:path]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def navi(rel_pos=\"/~kunolab/\")\n puts \"<ul class='menuBar'>\"\n puts \"<li><a href=\\\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\\\">Mini-Workshop</a>\"\n puts \"<li><a href=\\\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\\\">久野研カレンダー(KunoLabCalendar)</a>\...
[ "0.6320277", "0.6256632", "0.6228642", "0.61563516", "0.60137343", "0.60079354", "0.5985385", "0.59555143", "0.5872472", "0.5871536", "0.5863167", "0.58442616", "0.58413494", "0.5837355", "0.5811948", "0.5811948", "0.5786483", "0.5774866", "0.5760256", "0.5718805", "0.5717987...
0.6584801
0
List resource types. If no feed_id is given all types are listed
def list_resource_types(feed_id = nil) if feed_id.nil? ret = http_get('/resourceTypes') else the_feed = hawk_escape_id feed_id ret = http_get("/feeds/#{the_feed}/resourceTypes") end ret.map { |rt| ResourceType.new(rt) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end", "def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end", "def all_of_t...
[ "0.6747361", "0.6478818", "0.5784769", "0.5751445", "0.57156724", "0.5696157", "0.56948453", "0.56015205", "0.55798286", "0.5578228", "0.5567356", "0.55189735", "0.5498159", "0.54917777", "0.54577816", "0.5437827", "0.5415736", "0.5405836", "0.5375221", "0.53674704", "0.53530...
0.87672144
0
Return all resources for a feed
def list_resources_for_feed(feed_id, fetch_properties = false, filter = {}) fail 'Feed id must be given' unless feed_id the_feed = hawk_escape_id feed_id ret = http_get("/feeds/#{the_feed}/resources") to_filter = ret.map do |r| if fetch_properties p = get_config_data_for_resour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end", "def fetch_urls_from_feedly\n yaml = YAML.load_file('env.yaml')\n client = Feedlr::Client.new(oauth_access_token: yaml['account']['feedly']['access_token'])\n client.user_subscriptions.map{|m|\n # puts m.id\n hotentries = clie...
[ "0.694163", "0.67687327", "0.6669733", "0.6617677", "0.66145897", "0.6590459", "0.65596694", "0.65566", "0.65566", "0.65566", "0.65566", "0.65566", "0.6553178", "0.6549279", "0.64841145", "0.6412598", "0.640462", "0.639967", "0.6391477", "0.6334518", "0.6334518", "0.6334518...
0.7551703
0
Obtain a list of relationships for the passed feed
def list_relationships_for_feed(feed_id, named = nil) the_feed = hawk_escape_id feed_id query_params = { sort: '__targetCp' } query_params[:named] = named unless named.nil? query = generate_query_params query_params ret = http_get("/feeds/#{the_feed}/relationships#{query}") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_relationships\n end", "def rels(node)\n @batch_inserter.getRelationships(node)\n end", "def relationships\n return [] unless has_comments?\n\n comments.relationships\n end", "def relationships\n model.relationships(repository.name)\n end", "def feed\n\t\tfollo...
[ "0.70255035", "0.68981326", "0.68509734", "0.6773391", "0.6687331", "0.66199356", "0.6583598", "0.65422904", "0.6440938", "0.641142", "0.6368076", "0.63656485", "0.63282144", "0.63282144", "0.63155246", "0.62066317", "0.6200043", "0.6192747", "0.6192451", "0.6159977", "0.6131...
0.76395684
0
Retrieve a single entity from inventory by its canonical path
def get_entity(path) c_path = path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path) http_get("path#{c_path}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entity_for_path(path)\n local_entities_list.find do |e|\n path[0, e.path.length] == e.path\n end\n end", "def find(item_name)\n @inventory.find(item_name)\n end", "def get_catalog_item(name, item_type, catalog_name)\n raise ObjectNotFoundError, \"Catalog item name cannot be nil\" unles...
[ "0.67025465", "0.65864456", "0.6199979", "0.6132059", "0.60356915", "0.60123295", "0.5945221", "0.5924386", "0.5872195", "0.58577657", "0.576353", "0.5731744", "0.5726543", "0.5719775", "0.5625599", "0.5599479", "0.5592318", "0.55869687", "0.55867153", "0.5537688", "0.5528475...
0.6613026
1
Delete the feed with the passed feed id.
def delete_feed(feed_id) the_feed = hawk_escape_id feed_id http_delete("/feeds/#{the_feed}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feed_delete(id, opts = {})\n feed_delete_with_http_info(id, opts)\n nil\n end", "def destroy\n \n @feed = @user.feeds.find(params[:id])\n \n unless @feed.nil?\n @feed.destroy\n flash[:notice] = 'Feed was successfully deleted.'\n end\n ...
[ "0.8272848", "0.7540702", "0.7508183", "0.74440444", "0.7181367", "0.71082425", "0.70816636", "0.7023949", "0.7023949", "0.7023949", "0.69799656", "0.69150466", "0.69020134", "0.6890984", "0.6840224", "0.6832713", "0.68152887", "0.6793724", "0.6732894", "0.6732894", "0.666068...
0.88271886
0
Create a new resource type
def create_resource_type(feed_id, type_id, type_name) the_feed = hawk_escape_id feed_id type = create_blueprint type[:id] = type_id type[:name] = type_name begin http_post("/feeds/#{the_feed}/resourceTypes", type) rescue HawkularException => error # 409 We already e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end", "def create\n\t\t@resource_type = ResourceType.new(resource_type_params)\n\n\t\tif @resour...
[ "0.7876298", "0.76471454", "0.7392785", "0.7367073", "0.7337644", "0.7285984", "0.7200305", "0.7060213", "0.7045855", "0.6988477", "0.697892", "0.69403636", "0.69217193", "0.69054174", "0.6876458", "0.68625975", "0.6786997", "0.6780288", "0.67237735", "0.6716588", "0.6706996"...
0.7987066
0
Create a new metric type for a feed
def create_metric_type(feed_id, metric_type_id, type = 'GAUGE', unit = 'NONE', collection_interval = 60) the_feed = hawk_escape_id feed_id metric_kind = type.nil? ? 'GAUGE' : type.upcase fail "Unknown type #{metric_kind}" unless %w(GAUGE COUNTER AVAILABILITY').include?(metric_kind) mt = build_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_type_on_metric_def_if_needed\n unless Hawkular::Metrics::MetricDefinition.respond_to? :type\n Hawkular::Metrics::MetricDefinition.class_eval do\n def type\n return @type\n end\n\n def type= (t)\n @type = t\n end\n end\n end\n end", "def cr...
[ "0.66087735", "0.6341207", "0.62955934", "0.61839145", "0.60558826", "0.6018166", "0.58629686", "0.5810912", "0.58090466", "0.5803072", "0.56647485", "0.56350446", "0.5432833", "0.5393098", "0.53854495", "0.53759146", "0.53449064", "0.5330069", "0.5293671", "0.5270597", "0.52...
0.7810987
0
List operation definitions (types) for a given resource type
def list_operation_definitions(resource_type_path) parsed_path = CanonicalPath.parse(resource_type_path.to_s) feed_id = parsed_path.feed_id resource_type_id = parsed_path.resource_type_id ret = http_get("/feeds/#{feed_id}/resourceTypes/#{resource_type_id}/operationTypes") ret.map { |ot| ot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_operation_definitions_for_resource(resource_path)\n resource = get_resource(resource_path.to_s, false)\n list_operation_definitions(resource.type_path)\n end", "def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::R...
[ "0.7328684", "0.70613", "0.69497824", "0.67765903", "0.63407457", "0.6337261", "0.6212867", "0.61436105", "0.6109785", "0.60344124", "0.6025917", "0.59594303", "0.58638316", "0.58635944", "0.5824533", "0.5814017", "0.5810978", "0.5801613", "0.5767757", "0.57382745", "0.573285...
0.80881226
0
List operation definitions (types) for a given resource
def list_operation_definitions_for_resource(resource_path) resource = get_resource(resource_path.to_s, false) list_operation_definitions(resource.type_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_operation_definitions(resource_type_path)\n parsed_path = CanonicalPath.parse(resource_type_path.to_s)\n feed_id = parsed_path.feed_id\n resource_type_id = parsed_path.resource_type_id\n ret = http_get(\"/feeds/#{feed_id}/resourceTypes/#{resource_type_id}/operationTypes\")\n ret.m...
[ "0.79146796", "0.6780799", "0.67030597", "0.6671006", "0.6611993", "0.63566625", "0.6254795", "0.62262267", "0.6020025", "0.58826226", "0.58674014", "0.5840362", "0.57620424", "0.5741462", "0.57159734", "0.56940556", "0.56653285", "0.5655728", "0.5626547", "0.5609208", "0.560...
0.814538
0
Create a Metric and associate it with a resource.
def create_metric_for_resource(metric_type_path, resource_path, metric_id, metric_name = nil) type_path = metric_type_path.is_a?(CanonicalPath) ? metric_type_path : CanonicalPath.parse(metric_type_path) feed_id = type_path.feed_id res_path = resource_path.is_a?(CanonicalPath) ? resource_path : Canonic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end", "def create_metric name, description: nil, filter: nil\n ensure_connection!\n resp = connection.create_metric name, description, filter\n if resp.success?\n Metric.from_gapi resp.data, connec...
[ "0.7391366", "0.6740937", "0.66856635", "0.65902334", "0.653276", "0.6393245", "0.63270694", "0.62708634", "0.62664735", "0.6228757", "0.60761523", "0.60749483", "0.60478616", "0.5982733", "0.5967282", "0.5952051", "0.59341973", "0.59341973", "0.59323156", "0.58904815", "0.58...
0.7648406
0
PATCH/PUT /projects/:id Should be accessible to owner role only
def update if @project if ProjectUser.verify_role(current_user.id, @project, 'owner') if @project.update(project_params) render @project.to_json(include: :project_detail), status: 200 else render json: @project.errors, status: :unprocessable_entity end else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n project_params[:owner_id] = current_user[:id] if project_params[:owner_id].nil? or not current_user.is_admin?\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to projects_url, notice: 'Project was successfully updated.' }\n format.json { h...
[ "0.7679442", "0.7449957", "0.74090236", "0.7327059", "0.7253366", "0.7229559", "0.71605563", "0.715795", "0.7152605", "0.7139821", "0.7083659", "0.7039251", "0.70046836", "0.70017904", "0.6976267", "0.6942685", "0.6903762", "0.6878506", "0.6858911", "0.6827668", "0.68232536",...
0.78762907
0
POST /projects/:id/users Accessible only to the project owner Limited to owner listed in project, to prevent accidental demotion of self from owner.
def add_users if @project.user_id == current_user.id success = [] errors = [] @users.each do |user| new_user = create_user(user, @project) new_user.valid? ? success << new_user : errors << new_user.errors end if errors.empty? success.each { |user| user.save } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_users\n request :user\n end", "def create\n @project = Project.new(project_params)\n @project.users << current_user\n if @project.save\n redirect_to root_url, notice: 'Project was successfully created.' \n else\n render :new\n end\n end", "def create\n @project ...
[ "0.67069155", "0.6591763", "0.6536375", "0.6348086", "0.6337271", "0.6302611", "0.62822086", "0.6257236", "0.62411624", "0.61946493", "0.6178325", "0.6176522", "0.6130356", "0.6124844", "0.6116013", "0.6109492", "0.61086565", "0.6090009", "0.6069297", "0.6069297", "0.606781",...
0.731729
0
PATCH /projects/:id/users Accessible only to the project owner Limited to owner listed in project, to prevent accidental demotion of self from owner.
def update_users if @project.user_id == current_user.id success = [] errors = [] @users.each do |user| extract_user = extract_user_id(user) if extract_user.nil? errors << { error: 'User does not exist' } else project_user = ProjectUser.find_user_in_proje...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n redirect_to @project, notice: 'Project was successfully updated.' and return\n else\n params['project']['user_projects_attributes'].each{|i, p| p['_destroy'] = false}\n render :edit\n end\n end", "def update\n if @project\n if Pro...
[ "0.66993666", "0.65431446", "0.6540748", "0.65403754", "0.65203744", "0.6394645", "0.63566506", "0.6333681", "0.6314754", "0.6290088", "0.6238811", "0.61943483", "0.6192777", "0.61613244", "0.61500305", "0.6145625", "0.614093", "0.6131924", "0.61316013", "0.6130871", "0.61263...
0.66107804
1
DELETE /projects/1 Accessible only to the project owner Limited to owner listed in project, to maintain highest level of integrity possible.
def destroy if @project.user_id == current_user.id @project.destroy else render json: { error: 'Only the project owner can delete the project' }, status: :unauthorized end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project = @client.projects.find(params[:id])\n\n begin\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_projects_url(@client), notice: 'Project was deleted.') }\n format.xml { head :ok }\n end\n rescue ActiveRecord::DeleteRestric...
[ "0.77977556", "0.7761071", "0.7735213", "0.77246827", "0.766281", "0.7624342", "0.75813395", "0.75671387", "0.7566734", "0.753428", "0.7526888", "0.7495393", "0.7458235", "0.7457766", "0.7451951", "0.74401546", "0.7438931", "0.7435225", "0.7434007", "0.7433371", "0.74312454",...
0.79301375
0
Extract id from passed user object, or lookup by passed email address, cache results and return nil if not found
def extract_user_id(params) User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_lookup(email, id = false)\n if id\n send_req({act: :user_lookup, unique_id: email})\n else\n send_req({act: :user_lookup, cloudflare_email: email})\n end\n end", "def query_id_for_github_email(email)\n User.by_any_email(email).pluck(:id).first\n end", "def f...
[ "0.7172946", "0.70831084", "0.701362", "0.69093245", "0.6869344", "0.686075", "0.6776377", "0.6659783", "0.66142565", "0.65248454", "0.65245086", "0.6520394", "0.650299", "0.6477776", "0.6450251", "0.6448837", "0.64332205", "0.64318144", "0.6382285", "0.63596034", "0.6353983"...
0.74888414
0
=== Methods === find persons by regexp, if blank than find me
def find_persons(regx = "") return nil if regx.nil? res = [] if regx == "" return [me_id] else regx = enc_cmd(regx) res = people.select{|id, login| login.mb_chars.downcase =~ /#{regx.mb_chars.strip.downcase}/i} end if !res.empty? res.map &:first else say "no p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_match(nominee)\n names = []\n pname = nominee[:name]\n names << pname\n names << pname.sub(%r{ [A-Z]\\. }, ' ') # drop initial\n personname = ASF::Person.find(nominee[:id]).public_name\n names << personname if personname\n list = names.uniq.map{|name| Regexp.escape(name)}.join('|')\n # N.B. \\b ...
[ "0.65620536", "0.6080699", "0.60148495", "0.59131056", "0.5871207", "0.5871207", "0.5833617", "0.58173054", "0.58173054", "0.5734518", "0.56614447", "0.5627075", "0.55305445", "0.5410971", "0.5402013", "0.53983694", "0.5390445", "0.53706217", "0.53691757", "0.53621775", "0.53...
0.65211827
1
Normalize, on create, the new record with: Setting Associations Rename attributes Exclusion of attributes
def normalize_before_create(hash, assocs = {}) hash = include_associations( hash, @associations, assocs ) hash = exclude_attrs( hash, @exclude_attrs_on_create, @must_exclude_attrs, @associations.keys ) hash =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_before_save(record, hash, associations = {})\n if record\n hash = normalize_before_update(hash, associations)\n\n record.assign_attributes(hash)\n\n record\n else\n hash = normalize_before_create(hash, associations)\n\n @model.new(hash)\n ...
[ "0.68524575", "0.66626275", "0.63134664", "0.61135554", "0.6102823", "0.607581", "0.6057107", "0.59680307", "0.5963753", "0.5963753", "0.592009", "0.59177524", "0.5903774", "0.5865509", "0.5864898", "0.5864689", "0.5850143", "0.58425736", "0.58207715", "0.58094555", "0.57964"...
0.7634833
0
Normalize, on update, the new record with: Setting Associations Rename attributes Exclusion of attributes
def normalize_before_update(hash, assocs = {}) hash = include_associations( hash, @associations, assocs ) hash = exclude_attrs( hash, @exclude_attrs_on_update, @must_exclude_attrs, @associations.keys ) hash =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_before_create(hash, assocs = {})\n hash = include_associations(\n hash,\n @associations,\n assocs\n )\n\n hash = exclude_attrs(\n hash,\n @exclude_attrs_on_create,\n @must_exclude_attrs,\n @associations.keys\n ...
[ "0.69538873", "0.6639366", "0.6497347", "0.6357567", "0.6275971", "0.62283635", "0.62283635", "0.60222423", "0.60157", "0.60078365", "0.60061467", "0.59957194", "0.59914976", "0.5988173", "0.59825516", "0.59627753", "0.59613675", "0.5960245", "0.5935711", "0.59257025", "0.591...
0.75212914
0
Includes associations and its value to the record hash only include if the associations was set by the user.
def include_associations(hash, associations, assocs) associations.each do |name, attrs| instance = assocs[name.to_sym] foreign_key = attrs[:foreign_key] # for cases where instance is: # - association is empty (nil) # - association is present # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associations_hash\n @associations_hash ||= {\n has_many: [],\n belongs_to: []\n }\n end", "def included_associations(include = [])\n include += [:hostgroup, :compute_resource, :operatingsystem, :environment, :model ]\n include += [:fact_values] if User.current.user_facts.any?...
[ "0.609334", "0.60892314", "0.59283215", "0.5885481", "0.5878996", "0.57971245", "0.57870954", "0.57383454", "0.568574", "0.5651024", "0.5610486", "0.5609205", "0.56090814", "0.5604654", "0.5603525", "0.5602148", "0.5550773", "0.5550574", "0.55395275", "0.55348456", "0.5515532...
0.75483143
0
Create a compile task for an Ember package. This task will compute dependencies and output a single JS file for a package.
def compile_package_task(input, output=input) js_tasks = SproutCore::Compiler::Preprocessors::JavaScriptTask.with_input "packages/#{input}/lib/**/*.js", "." SproutCore::Compiler::CombineTask.with_tasks js_tasks, "#{SproutCore::Compiler.intermediate}/#{output}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile\n Milkrun.say \"Cleaning and assembling a new #{task} build\"\n `./gradlew clean assemble#{task}`\n @assembled = true\n Milkrun.say \"Package built to #{path}\"\n path\n end", "def setup_tasks\n namespace(:npm) do\n desc 'Build package.json from template'\n ta...
[ "0.697818", "0.6870791", "0.62542814", "0.61437416", "0.60732716", "0.60211736", "0.602032", "0.5952942", "0.5939074", "0.59302217", "0.5912614", "0.5847383", "0.5825102", "0.5793357", "0.57778645", "0.5767963", "0.57624817", "0.5752981", "0.57512665", "0.57376504", "0.571343...
0.7757529
0