query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Update Shipping Update existing shipping for an existing orden | def orders_update_shipping_with_http_info(id, shipping_id, shipping_request, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ShippingsApi.orders_update_shipping ...'
end
# verify the required parameter 'id' is set
if @api_client.config.client_side_validation && id.nil?
fail ArgumentError, "Missing the required parameter 'id' when calling ShippingsApi.orders_update_shipping"
end
# verify the required parameter 'shipping_id' is set
if @api_client.config.client_side_validation && shipping_id.nil?
fail ArgumentError, "Missing the required parameter 'shipping_id' when calling ShippingsApi.orders_update_shipping"
end
# verify the required parameter 'shipping_request' is set
if @api_client.config.client_side_validation && shipping_request.nil?
fail ArgumentError, "Missing the required parameter 'shipping_request' when calling ShippingsApi.orders_update_shipping"
end
allowable_values = ["es", "en"]
if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/orders/{id}/shipping_lines/{shipping_id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)).sub('{' + 'shipping_id' + '}', CGI.escape(shipping_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])
# HTTP header 'Content-Type'
content_type = @api_client.select_header_content_type(['application/json'])
if !content_type.nil?
header_params['Content-Type'] = content_type
end
header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body] || @api_client.object_to_http_body(shipping_request)
# return_type
return_type = opts[:debug_return_type] || 'ShippingOrderResponse'
# auth_names
auth_names = opts[:debug_auth_names] || ['bearerAuth']
new_options = opts.merge(
:operation => :"ShippingsApi.orders_update_shipping",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ShippingsApi#orders_update_shipping\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @shipping.update_attributes(shipping_params)\n redirect_to edit_store_shipping_path(@shipping), notice: 'Dados de envio atualizado com sucesso.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @shipping.update(shipping_params)\n for... | [
"0.7307689",
"0.71168953",
"0.7059553",
"0.70098263",
"0.69675195",
"0.6962991",
"0.69517213",
"0.69398296",
"0.68618286",
"0.6843204",
"0.68355924",
"0.68347645",
"0.6826014",
"0.6821768",
"0.68176854",
"0.6810061",
"0.67972344",
"0.6794585",
"0.6787215",
"0.6765721",
"0.672... | 0.0 | -1 |
Returns a hash of the current conditions set. | def conditions
mass_conditions.clone.merge(@conditions)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n @__set.to_a.hash\n end",
"def conditions_hash(response_set)\n hash = {}\n self.dependency_conditions.each{|dc| hash.merge!(dc.to_hash(response_set))}\n return hash\n end",
"def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n ... | [
"0.6881591",
"0.66794544",
"0.622319",
"0.6193841",
"0.6142576",
"0.6142576",
"0.6116031",
"0.6111094",
"0.60532",
"0.60302705",
"0.6020765",
"0.60194767",
"0.59962445",
"0.5995801",
"0.59723306",
"0.59605765",
"0.5932094",
"0.5912776",
"0.589513",
"0.5891938",
"0.58831376",
... | 0.5873624 | 21 |
Accepts a hash of conditions. | def conditions=(values)
values.each do |condition, value|
# if a condition name ends with "(1i)", assume it's date / datetime
if condition =~ /(.*)\(1i\)$/
date_scope_name = $1
date_parts = (1..6).to_a.map do |idx|
values.delete("#{ date_scope_name }(#{ idx }i)")
end.reject{|s| s.blank? }.map{|s| s.to_i }
# did we get enough info to build a time?
if date_parts.length >= 3
values[date_scope_name] = Time.zone.local(*date_parts)
end
end
end
values.each do |condition, value|
mass_conditions[condition.to_sym] = value
value.delete_if { |v| ignore_value?(v) } if value.is_a?(Array)
next if ignore_value?(value)
# value = Time.zone.parse(value) if value =~ /[\d\/.-]{10}/
@current_scope = @current_scope.send(condition, value)
send("#{condition}=", value)
@conditions[condition.to_sym] = value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conditions_hash\n params[\"conditions\"].grep(HashWithIndifferentAccess).reduce(:merge).merge(clr_hash)\n rescue\n Rails.logger.error(\"**** S3 policy generation error, invalid params ***\")\n return nil\n end",
"def conditions(conditions={})\n @options[:conditions].merge!(condition... | [
"0.78783137",
"0.7780859",
"0.7128728",
"0.70242393",
"0.6823186",
"0.6819429",
"0.6783496",
"0.6742024",
"0.6742024",
"0.67355925",
"0.6722544",
"0.67193305",
"0.67050654",
"0.66948605",
"0.66889006",
"0.66773474",
"0.66541207",
"0.6627958",
"0.66055375",
"0.6589462",
"0.657... | 0.5968543 | 87 |
Delete a condition from the search. Since conditions map to named scopes, if a named scope accepts a parameter there is no way to actually delete the scope if you do not want it anymore. A nil value might be meaningful to that scope. | def delete(*names)
names.each do |name|
@conditions.delete(name.to_sym)
mass_conditions.delete(name)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n if @search_condition.destroy\n flash[:notice] = t('views.message.destroy.success')\n else\n flash[:alert] = SearchConditionDecorator.flash(@search_condition, flash)\n end\n redirect_to search_conditions_url\n end",
"def dbdelete(table, condition, condition_name)\n if condi... | [
"0.60789156",
"0.58686775",
"0.559896",
"0.54057276",
"0.54057276",
"0.53469676",
"0.53075194",
"0.52736014",
"0.5225442",
"0.52157444",
"0.521547",
"0.5195342",
"0.51028395",
"0.5086312",
"0.50590277",
"0.50509256",
"0.5033894",
"0.50289255",
"0.5013008",
"0.501136",
"0.5009... | 0.5828718 | 2 |
Returns the column we are currently ordering by | def ordering_by
order && order.to_s.gsub(/^(ascend|descend)_by_/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_order_by\n @@column_order_by\n end",
"def column\n @__col\n end",
"def sort_column\n nil\n end",
"def order_by_column\n return clazz.clustering_columns[0].name if clazz.clustering_columns.length > 0\n clazz.key_columns[0].name\n end",
"def order_by_colu... | [
"0.80256915",
"0.7419264",
"0.741779",
"0.7395961",
"0.7299071",
"0.7299071",
"0.72070307",
"0.71862274",
"0.7120649",
"0.70978904",
"0.7054949",
"0.7036428",
"0.69262826",
"0.69164914",
"0.6905746",
"0.68978494",
"0.6885913",
"0.68339384",
"0.680257",
"0.680257",
"0.6795841"... | 0.0 | -1 |
This is here as a hook to allow people to modify the order in which the conditions are called, for whatever reason. | def conditions_array
@conditions.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conditionally(*) end",
"def conditionally(*) end",
"def conditions; end",
"def conditions; end",
"def order; end",
"def order; end",
"def hook_order\n self.class.options[:hook_order]\n end",
"def order=(_arg0); end",
"def entry_order=(_arg0); end",
"def order(env, rule_condition, ... | [
"0.61551684",
"0.61551684",
"0.590753",
"0.590753",
"0.58771694",
"0.58771694",
"0.5834362",
"0.57794976",
"0.5757396",
"0.5756492",
"0.5739383",
"0.5731235",
"0.57198584",
"0.5712197",
"0.5690209",
"0.5627574",
"0.5627574",
"0.56097007",
"0.5526205",
"0.55024165",
"0.5498005... | 0.0 | -1 |
Creates a submit button with the given name with a cancel link Accepts two arguments: Form object and the cancel link name | def submit_or_cancel(form, name='Cancel')
form.submit + ' or ' + link_to(name, 'javascript:history.go(-1);', :class => 'cancel')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_or_cancel(form, name='Cancel')\n form.submit + \" or \" +\n link_to(name, root_path, :class => \"for_black_font_link\")\n #link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end",
"def cancel_button(destination_path)\n @template.link_to I18n.t('form.cancel'), destin... | [
"0.77373576",
"0.71044046",
"0.7081496",
"0.70169985",
"0.7013821",
"0.67628133",
"0.6726173",
"0.66924304",
"0.6668361",
"0.66563666",
"0.664586",
"0.66083974",
"0.6605293",
"0.64865655",
"0.6477404",
"0.64724475",
"0.6471831",
"0.6418879",
"0.6400651",
"0.6386676",
"0.63765... | 0.78651035 | 0 |
Lazy loading init root categories | def init_root_categories
@root_categories ||= Category.top_level
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @categories = Category.roots\n end",
"def set_root_category\n @root_category = RootCategory.find(params[:id])\n end",
"def load_categories\n q = @db.query(\"select t.term_id, t.name, t.slug\n from wp_terms as t join wp_term_taxonomy as x\n on t.term_id... | [
"0.6949701",
"0.6787816",
"0.6774641",
"0.66941875",
"0.6564169",
"0.6558355",
"0.6531142",
"0.65163857",
"0.648208",
"0.64733726",
"0.64710826",
"0.6402716",
"0.63853484",
"0.6384639",
"0.6380366",
"0.6377847",
"0.62981206",
"0.6283126",
"0.624251",
"0.6225904",
"0.6148474",... | 0.8541223 | 0 |
Get last visit products by user | def last_visit_products
session[:last_visit_products] ||= Product.last_visit_products.to_a()
@last_visit_products = session[:last_visit_products]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_session\n user_exams.order('updated_at DESC').first\n end",
"def most_recent\n Visit.all.sort_by{|visit| visit.timestamps}.last\n end",
"def session_last_user_activity\n session[:last_activity]\n end",
"def last_updates_viewed\n self.user.extend(Montage::User).last_login\n end",
"d... | [
"0.6042002",
"0.59727806",
"0.5968946",
"0.5929836",
"0.5875671",
"0.5774009",
"0.5771977",
"0.5722273",
"0.5656226",
"0.56520206",
"0.56516325",
"0.562241",
"0.5603189",
"0.55911964",
"0.5577283",
"0.5555471",
"0.554567",
"0.5526966",
"0.5521797",
"0.55077064",
"0.5480779",
... | 0.7445514 | 0 |
Add to user last visit product collection | def add_to_last_visit_product(product)
# Check input parameters
if product.nil?
return
end
# Change last visit products
last_visit_products = session[:last_visit_products]
if last_visit_products.nil?
last_visit_products = Array.new
last_visit_products << product
else
if last_visit_products.include?(product)
index = last_visit_products.index(product)
last_visit_products.insert(0, last_visit_products.delete_at(index))
else
if last_visit_products.length > 3
last_visit_products.delete_at(last_visit_products.length - 1)
end
last_visit_products.unshift(product)
end
end
session[:last_visit_products] = last_visit_products
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_visit_products\n session[:last_visit_products] ||= Product.last_visit_products.to_a()\n @last_visit_products = session[:last_visit_products]\n end",
"def show\n Recent.append(current_user,@product) if user_signed_in?\n end",
"def save_viewer_info\n recent_product_ids = cookies[:recent_... | [
"0.70360476",
"0.6251941",
"0.61787534",
"0.59512055",
"0.5899244",
"0.5892158",
"0.57789415",
"0.57419276",
"0.5717511",
"0.5702797",
"0.56612563",
"0.56058073",
"0.55789506",
"0.55625683",
"0.55308694",
"0.5520169",
"0.550929",
"0.54691195",
"0.54542965",
"0.5453798",
"0.54... | 0.7443324 | 0 |
Add product to shopping cart | def add_to_shopping_cart(product, quantity)
shopping_cart.add_product_to_cart(product, quantity)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_cart(product)\n @products << product\n @sub_total += product.base_price\n @total_price += product.total_price\n puts \"Added to cart!\"\n end",
"def add_product_to_cart(name, base_price)\n product = Products.new_product(name, base_price)\n shopping_cart << product\n end",
"def ad... | [
"0.8529047",
"0.85008925",
"0.83134174",
"0.82831126",
"0.8246591",
"0.822705",
"0.81379807",
"0.8127519",
"0.8078862",
"0.8041427",
"0.80168265",
"0.79497135",
"0.79452884",
"0.7933084",
"0.7923508",
"0.7919952",
"0.7905724",
"0.7885143",
"0.7866546",
"0.7780568",
"0.7773053... | 0.8464974 | 2 |
gets the github api token for interacting with repos out of the environment | def apiKey()
return ENV['HOMEBREW_PIPELINE_API_TOKEN']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_token\n @token ||= `git config --get github.token`.strip\n @token ||= ENV[:GITHUB_TOKEN].strip\n end",
"def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\... | [
"0.79415953",
"0.7761587",
"0.76550007",
"0.7487645",
"0.7451443",
"0.7413331",
"0.7413331",
"0.73994446",
"0.7356528",
"0.7342627",
"0.72848004",
"0.727338",
"0.7232905",
"0.7228967",
"0.7205889",
"0.7193022",
"0.71764517",
"0.7172094",
"0.6923835",
"0.68233734",
"0.6811071"... | 0.0 | -1 |
gets the github repo name out of the environment | def repoSlug()
return ENV['HOMEBREW_PIPELINE_FORMULA_REPO'].split('/')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_name\n return unless @url\n @repo_name ||= Octokit::Repository.from_url(@url).to_s.chomp('.git')\n end",
"def github_repo\n build.repo_name.delete_prefix(\"github_\").tr(\"_\", \"/\")\n end",
"def repo_name\n unless @repo_name\n url = config[\"remote.#{name}.... | [
"0.8138449",
"0.80991906",
"0.7874561",
"0.7805998",
"0.7785541",
"0.77649903",
"0.7717524",
"0.76644295",
"0.76508015",
"0.7626004",
"0.75908625",
"0.7551987",
"0.75095814",
"0.75025684",
"0.7488205",
"0.7464124",
"0.73949933",
"0.73764884",
"0.73338807",
"0.7320889",
"0.724... | 0.6953615 | 31 |
gets the hostname of the github instance that homebrewpipeline should assume that the formula repo lives | def githubAPIEndpoint()
domain = 'api.github.com' unless ENV['HOMEBREW_PIPELINE_GITHUB_DOMAIN']
return "https://#{domain}/"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupon_path(repo)\n github = \"github.groupondev.com\"\n ENV[\"INTERNAL_GEMS_OVER_SSH\"] ? \"git@#{github}:#{repo}.git\" : \"https://#{github}/#{repo}.git\"\nend",
"def hostname\n ssh.exec!(\"hostname\").chomp\n end",
"def hostname\n @hostname ||= `hostname`.chomp\n end",
"def host... | [
"0.69352806",
"0.65793025",
"0.6521777",
"0.65068865",
"0.6476102",
"0.64486164",
"0.64356744",
"0.6434716",
"0.64313006",
"0.64211404",
"0.6389601",
"0.63696545",
"0.6324857",
"0.6289928",
"0.62825453",
"0.6278432",
"0.6257193",
"0.62254244",
"0.6218911",
"0.6212428",
"0.620... | 0.0 | -1 |
creates the client to interface with the github API | def setupClient!()
@octo_client = Octokit::Client.new(
:access_token => apiKey(),
:api_endpoint => githubAPIEndpoint(),
:web_endpoint => githubWebEndpoint()
)
@octo_client.auto_paginate = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_client\n Octokit::Client.new(:login => username, :oauth_token => token)\n end",
"def client\n @client ||= Github::ApiProxy.new(@options[:access_token])\n end",
"def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET]... | [
"0.8109655",
"0.81096065",
"0.77841306",
"0.77752006",
"0.77427834",
"0.7718981",
"0.7564445",
"0.74820304",
"0.7465831",
"0.7419202",
"0.7279888",
"0.7279888",
"0.72758436",
"0.71793526",
"0.7168643",
"0.71620166",
"0.69507265",
"0.68814844",
"0.68608075",
"0.6771986",
"0.67... | 0.7109484 | 16 |
forks the existing formula tap and opens a new PR with a new formula in it | def createNewFormula(name)
odie('No formula name provided!') unless name
setupClient!
#odie("Formula with name #{name} doesn't exist!") unless (name in @octo_client.all_repositories)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n end",
"def updateExistingFormula(name)\n odie('No formula name provided!') unless name\n\n ... | [
"0.5901761",
"0.57424897",
"0.57000375",
"0.5507329",
"0.54772896",
"0.54761744",
"0.5475604",
"0.5453818",
"0.53458",
"0.534571",
"0.5281578",
"0.52638835",
"0.5256729",
"0.5251874",
"0.52098566",
"0.51980865",
"0.5196564",
"0.5194984",
"0.518302",
"0.51749015",
"0.5068135",... | 0.5756603 | 1 |
forks the existing formula tap and opens a new PR with a modified version of the existing formula in it | def updateExistingFormula(name)
odie('No formula name provided!') unless name
setupClient!
ohai("Fetching repo data")
user_repos = @octo_client.repositories(getUserName())
user_repo_names = user_repos.map(&:name)
if !user_repo_names.include?(name)
odie("Formula with name #{name} doesn't exist!")
end
ohai("Cloning #{githubWebEndpoint}#{repoSlug.join('/')}")
remaining_args = ARGV[2..ARGV.length]
# Formula.initialize(name,
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_patch(repo_path, patch)\n `(cd \"#{repo_path}\" && echo #{patch} | git am)`\n end",
"def execute\n current = GitHub::PullRequest.current\n\n if current\n cli.say \"Opening Pull Request #{current.number}\"\n cli.open current.pull_request.html_url\n end\n e... | [
"0.5822282",
"0.5806016",
"0.5746242",
"0.57277215",
"0.56033415",
"0.55866057",
"0.5399509",
"0.5387756",
"0.538596",
"0.53549355",
"0.53368694",
"0.5330339",
"0.5300031",
"0.5245417",
"0.5227646",
"0.51942474",
"0.5193702",
"0.5184063",
"0.5175291",
"0.51330215",
"0.5131766... | 0.5935501 | 0 |
validate that we are running from within homebrew's environment | def homebrew!()
abort("Runtime error: Homebrew is required. Please start via `#{bin} ...`") unless defined?(HOMEBREW_LIBRARY_PATH)
%w[fileutils pathname tempfile formula utils].each { |req| require(req) }
extend(FileUtils)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_brew?\n have_command? :brew\n end",
"def install_homebrew\n print \"Found \"\n system %Q{which brew}\n unless $?.success?\n puts \"Installing homebrew and packages...\"\n system %Q{ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\"}\n system %... | [
"0.7450473",
"0.64097327",
"0.637929",
"0.6362873",
"0.6335791",
"0.63056546",
"0.629445",
"0.6240465",
"0.6204301",
"0.6193868",
"0.61477166",
"0.60499316",
"0.6011787",
"0.600535",
"0.60018724",
"0.59994996",
"0.59684473",
"0.59247696",
"0.5909571",
"0.59033316",
"0.5896869... | 0.6363787 | 3 |
primary driver of the command | def run()
homebrew!
# parse the argsuments
command = ARGV.first
formula_name = ARGV[1]
case command
when 'new'
createNewFormula(formula_name)
when 'update'
updateExistingFormula(formula_name)
else
onoe "Unknown command `#{command}`!" unless command.nil?
abort `brew pipeline --help`
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_name; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def driver _args\n \"driver _args;\" \n end",
"def cmd; end",
"def driver; end",
"def command\n raise NotImplementedError\n end",
... | [
"0.69908625",
"0.69820046",
"0.69820046",
"0.69820046",
"0.69820046",
"0.69820046",
"0.69820046",
"0.6882051",
"0.6848354",
"0.6792676",
"0.66004515",
"0.6562596",
"0.6523938",
"0.6475648",
"0.64068437",
"0.6401319",
"0.63853925",
"0.6349515",
"0.6340359",
"0.6339924",
"0.633... | 0.0 | -1 |
GET /phone_types GET /phone_types.json | def index
@phone_types = PhoneType.order(:id).all.paginate(page: params[:page], per_page: 15)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @phone_types = PhoneType.all\n end",
"def index\n @phones_types = PhonesType.all\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def show\n @phone_type = PhoneType.find(params[:id])\n end",
"def booking_phone_types_get(opts = {})\n ... | [
"0.7131327",
"0.67954206",
"0.65413904",
"0.64408946",
"0.6389445",
"0.63120466",
"0.6298989",
"0.62550765",
"0.61547256",
"0.6141524",
"0.60234",
"0.6000197",
"0.5983664",
"0.59773135",
"0.59766006",
"0.596061",
"0.5946826",
"0.5946622",
"0.59345007",
"0.5909166",
"0.5900937... | 0.6455531 | 3 |
GET /phone_types/1 GET /phone_types/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @phone_type = PhoneType.find(params[:id])\n end",
"def index\n @phone_types = PhoneType.all\n end",
"def index\n @phones_types = PhonesType.all\n end",
"def set_phone_type\n @phone_type = PhoneType.find(params[:id])\n end",
"def set_phone_type\n @phone_type = PhoneType.find(... | [
"0.7061173",
"0.6995145",
"0.6750825",
"0.65329015",
"0.6530536",
"0.63849944",
"0.63584995",
"0.626968",
"0.62026936",
"0.61625224",
"0.6138586",
"0.6138586",
"0.6105192",
"0.6036846",
"0.60295105",
"0.6026348",
"0.60134023",
"0.60012877",
"0.59628195",
"0.59458596",
"0.5929... | 0.0 | -1 |
POST /phone_types POST /phone_types.json | def create
@phone_type = PhoneType.new(phone_type_params)
respond_to do |format|
if @phone_type.save
format.html { redirect_to @phone_type, notice: 'Tipo Telefone criado com sucesso.' }
format.json { render :show, status: :created, location: @phone_type }
else
format.html { render :new }
format.json { render json: @phone_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @phones_type = PhonesType.new(phones_type_params)\n\n respond_to do |format|\n if @phones_type.save\n format.html { redirect_to @phones_type, notice: 'Phones type was successfully created.' }\n format.json { render :show, status: :created, location: @phones_type }\n else\... | [
"0.6860139",
"0.6833591",
"0.6775467",
"0.6656267",
"0.63824886",
"0.631619",
"0.63075256",
"0.62562245",
"0.6214917",
"0.6146547",
"0.59782434",
"0.59703344",
"0.59693986",
"0.59189266",
"0.59189266",
"0.59153414",
"0.5903977",
"0.5869228",
"0.5869228",
"0.58554184",
"0.5847... | 0.66525507 | 4 |
PATCH/PUT /phone_types/1 PATCH/PUT /phone_types/1.json | def update
respond_to do |format|
if @phone_type.update_attributes(phone_type_params)
format.html { redirect_to @phone_type, notice: 'Tipo Telefone atualizado com sucesso.' }
format.json { render :show, status: :ok, location: @phone_type }
else
format.html { render :edit }
format.json { render json: @phone_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\n @phone_types = PhoneType.all\n @phone_type = PhoneType.find(params[:id])\n\n @phone_type.update_attributes(phone_type_params)\n\n=begin\n respond_to do |format|\n if @phone_type.update(phone_type_params)\n format.html { redirect_to @phone_type, notice: 'Phone type was success... | [
"0.7156784",
"0.7146596",
"0.680524",
"0.6739406",
"0.6661707",
"0.65971524",
"0.6552286",
"0.640179",
"0.6394604",
"0.63680494",
"0.63667333",
"0.6299574",
"0.62883914",
"0.6231933",
"0.6224471",
"0.618034",
"0.61786884",
"0.61442053",
"0.6128491",
"0.6125948",
"0.6125948",
... | 0.69749427 | 2 |
DELETE /phone_types/1 DELETE /phone_types/1.json | def destroy
@phone_type.destroy
respond_to do |format|
format.html { redirect_to phone_types_url, notice: 'Tipo Telefone excluído com sucesso.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @phones_type.destroy\n respond_to do |format|\n format.html { redirect_to phones_types_url, notice: 'Phones type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phone_number_type = PhoneNumberType.find(params[:id])\n @phone_n... | [
"0.7596647",
"0.7398935",
"0.73255056",
"0.7213117",
"0.7075729",
"0.7075729",
"0.70305204",
"0.70201373",
"0.70157945",
"0.69369465",
"0.6887167",
"0.6871836",
"0.6838341",
"0.68070513",
"0.68065834",
"0.6804906",
"0.6804906",
"0.67464817",
"0.67394614",
"0.6719436",
"0.6686... | 0.766174 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_phone_type
@phone_type = PhoneType.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def phone_type_params
params.require(:phone_type).permit(:description)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
time complexity is O(n). | def reverse_in_place(str)
idx = 0
while idx < str.length / 2
# swapped = str[str.length-1-idx]
# str[str.length-1-idx] = str[idx]
# str[idx] = swapped
str[idx], str[str.length-1-idx] = str[str.length-1-idx], str[idx]
idx += 1
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.7016016",
"0.69942594",
"0.65269506",
"0.6384262",
"0.6370624",
"0.6341264",
"0.63219965",
"0.63170004",
"0.62952095",
"0.62839",
"0.6256282",
"0.6249511",
"0.6239411",
"0.62316364",
"0.623157",
"0.6230082",
"0.6167426",
"0.61640114",
"0.61557215",
"0.61435366",
"0.6133958... | 0.0 | -1 |
GET message_url(:id => 1) | def show
@post = Post.find(params[:id])
# find and return a specific message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @message = Message.find_by_url(params[:id])\n @message = Message.find(params[:id]) unless @message\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def url\n channel_path(params[:message][:channel_id], anchor: \... | [
"0.74126774",
"0.7225466",
"0.72150594",
"0.72150594",
"0.7194709",
"0.7137053",
"0.69967955",
"0.69585353",
"0.6917538",
"0.6909045",
"0.6908507",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0.69083905",
"0... | 0.0 | -1 |
GET edit_message_url(:id => 1) | def edit
# return an HTML form for editing a specific message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n message = Message.find(params[:id])\n end",
"def edit\n \t@message = Message.find(params[:id])\n end",
"def edit\n # return an HTML form for editing a specific message\n end",
"def show\n @message = Message.find(params[:id])\n end",
"def show\n @message = Message.find(para... | [
"0.8427521",
"0.83718234",
"0.7639003",
"0.68426615",
"0.68426615",
"0.67805725",
"0.6671852",
"0.66133493",
"0.6583983",
"0.65668076",
"0.65660214",
"0.6540229",
"0.6533553",
"0.6513025",
"0.6510979",
"0.65037435",
"0.6497212",
"0.6484901",
"0.64791256",
"0.6457379",
"0.6451... | 0.7454045 | 4 |
PUT message_url(:id => 1) | def update
# find and update a specific message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end",
"def update\n @messag... | [
"0.6835996",
"0.6511208",
"0.64995027",
"0.64991796",
"0.6434694",
"0.6415988",
"0.64149237",
"0.63620216",
"0.6352291",
"0.6341407",
"0.63057655",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119",
"0.6278119"... | 0.0 | -1 |
DELETE message_url(:id => 1) | def destroy
# delete a specific message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @message = Message.find_by_url(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n message = Mess... | [
"0.8346229",
"0.82973",
"0.81442654",
"0.7999072",
"0.79981416",
"0.795102",
"0.79378766",
"0.79335666",
"0.79153645",
"0.7897253",
"0.7872078",
"0.78351754",
"0.78286135",
"0.7797024",
"0.7796096",
"0.7784771",
"0.7763299",
"0.77572703",
"0.7754708",
"0.7754708",
"0.7754708"... | 0.77460396 | 45 |
Return style instance based on name | def retrieve(name)
self.all.detect{|style| style.name == name}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup(name)\n @@loaded_styles\n .find { |style| style.name.to_sym == name }\n .tap { |style| raise InvalidFrameStyleName, name if style.nil? }\n end",
"def style\n Style.new(self)\n end",
"def style\n @style ||= Style.new(attributes[:style])\n ... | [
"0.71352255",
"0.6732487",
"0.6650991",
"0.6626241",
"0.65031654",
"0.6395099",
"0.633895",
"0.62743974",
"0.6194587",
"0.61610764",
"0.6122599",
"0.6114659",
"0.6111049",
"0.6105318",
"0.60962695",
"0.6024725",
"0.5993573",
"0.5993501",
"0.5988522",
"0.593453",
"0.5895804",
... | 0.79038376 | 0 |
Check if style/brewery exists yet | def exist?(name)
self.all.any?{|style| style.name == name}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists?(style_name = default_style)\n filesystem.exists?(style_name)\n end",
"def exists?(style_name = default_style)\n filesystem.exists?\n end",
"def has_style?(style)\n @styles.include? style\n end",
"def use_style?\n end",
"def exists?(style_name = default_style)\n ... | [
"0.72820175",
"0.71881115",
"0.67792696",
"0.6708067",
"0.67015314",
"0.65240616",
"0.6485661",
"0.6485661",
"0.6485661",
"0.63362634",
"0.6278134",
"0.6236061",
"0.6189469",
"0.6173068",
"0.6135597",
"0.6129348",
"0.6116214",
"0.6100273",
"0.6016238",
"0.6004595",
"0.6004595... | 0.6422912 | 9 |
GET /my/group_comments/1 GET /my/group_comments/1.xml | def show
@my_group_comment = My::GroupComment.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @my_group_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @my_group_comment = My::GroupComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_group_comment }\n end\n end",
"def show\n @comic = Comic.find_by_alias_or_id(params[:comic_id])\n @comments = @comic.comments.find(:all, :group =... | [
"0.66780573",
"0.6634201",
"0.6279285",
"0.6204133",
"0.60638857",
"0.6001346",
"0.5993461",
"0.59788054",
"0.59601915",
"0.59588563",
"0.59588563",
"0.58845353",
"0.5882808",
"0.58475196",
"0.58475196",
"0.58475196",
"0.58412915",
"0.5811461",
"0.5803826",
"0.5803826",
"0.58... | 0.73256916 | 0 |
GET /my/group_comments/new GET /my/group_comments/new.xml | def new
@my_group_comment = My::GroupComment.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @my_group_comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end",
"def new\n @comment = Comment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\... | [
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040642",
"0.7040446",
"0.7024628",
"0.6907179",
"0.6888246",
"0.68454224",
"0.68454224",
"0.68454224",
"0.68454224",
"0.68454224"... | 0.7810339 | 0 |
POST /my/group_comments POST /my/group_comments.xml | def create
@my_group_comment = GroupComment.new(params[:group_comment])
@my_group_comment.group_member = GroupMember.where(:user_id => current_user.id, :group_id => @my_group_comment.group_id).first
@group = Group.find @my_group_comment.group_id
respond_to do |format|
if @my_group_comment.save
format.html { redirect_to([:my, @group], :notice => 'Kommentar gespeichert.') }
format.xml { render :xml => @my_group_comment, :status => :created, :location => @my_group_comment }
else
format.html { redirect_to([:my, @group]) }
format.xml { render :xml => @my_group_comment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @group_comment = GroupComment.new(group_comment_params)\n\n if @group_comment.save\n render json: @group_comment, status: :created, location: @group_comment\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def new\n @my_group_comment... | [
"0.63659054",
"0.63446665",
"0.6225103",
"0.60854596",
"0.5759481",
"0.569063",
"0.5631375",
"0.5631375",
"0.56274676",
"0.56207263",
"0.55976474",
"0.5578397",
"0.5563904",
"0.55177164",
"0.5470117",
"0.54361254",
"0.5392441",
"0.5392441",
"0.5362666",
"0.5348349",
"0.534834... | 0.63873816 | 0 |
PUT /my/group_comments/1 PUT /my/group_comments/1.xml | def update
@my_group_comment = My::GroupComment.find(params[:id])
respond_to do |format|
if @my_group_comment.update_attributes(params[:my_group_comment])
format.html { redirect_to(@my_group_comment, :notice => 'Group comment was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @my_group_comment.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @group_comment = GroupComment.find(params[:id])\n\n if @group_comment.update(group_comment_params)\n head :no_content\n else\n render json: @group_comment.errors, status: :unprocessable_entity\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_t... | [
"0.6343247",
"0.60995847",
"0.5988938",
"0.59779316",
"0.58910185",
"0.5785352",
"0.57831854",
"0.57105964",
"0.5679642",
"0.5667793",
"0.5623897",
"0.5595702",
"0.55559015",
"0.5555462",
"0.5550037",
"0.55448776",
"0.5542692",
"0.5542692",
"0.55423373",
"0.55244064",
"0.5517... | 0.6895828 | 0 |
DELETE /my/group_comments/1 DELETE /my/group_comments/1.xml | def destroy
@my_group_comment = My::GroupComment.find(params[:id])
@my_group_comment.destroy
respond_to do |format|
format.html { redirect_to(my_group_comments_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @group_comment.destroy\n\n head :no_content\n end",
"def test_set3_04b_delete_group()\n group = \"test_group\"\n user = \"test_user\"\n \n @test_acl.create_principal(user)\n @test_acl.create_group(group, [\"ALL\"], [user])\n \n query = \"doc(\\\"#{@col_path}Principals.xm... | [
"0.70006746",
"0.6517219",
"0.64835113",
"0.6478542",
"0.64409894",
"0.6427604",
"0.63687503",
"0.62976503",
"0.62665564",
"0.62624544",
"0.6252516",
"0.6213403",
"0.6201857",
"0.62008184",
"0.6162226",
"0.61619806",
"0.6158364",
"0.61480457",
"0.61480457",
"0.61426824",
"0.6... | 0.7377661 | 0 |
Send a start session command | def session
response = Stanza::Iq.new :set
response.to = @to
response << (sess = XMPPNode.new('session', response.document))
sess.namespace = SESSION_NS
@stream.send response
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end",
"def start\n ucommand(:start)\n end",
"def start_session(s)\r\n # callback to remove the session from play\r\n end_session_timer = Timer(\r\n Justbot::Session::DURATION,\r\n ... | [
"0.6682552",
"0.6566606",
"0.6408692",
"0.6367928",
"0.63088506",
"0.6273884",
"0.62193424",
"0.62179947",
"0.6192208",
"0.6187633",
"0.6171346",
"0.6145647",
"0.61340684",
"0.611936",
"0.60701126",
"0.60701126",
"0.60701126",
"0.60498947",
"0.60495275",
"0.59676313",
"0.5951... | 0.0 | -1 |
called by main program at the beginning | def login(user, password)
@@user = user
password2 = password.to_s.gsub(/./, '*')
debug "login called for user=#{user} pass=#{password2}"
# trash and recreate cookie
saveCookie(nil)
cookie = getLoginCookie(user, password)
if cookie
saveCookie(cookie)
else
debug "no cookie from login"
end
# get the current (set of) cookie(s) and pretend that login was successful
return cookie
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def startup\n end",
"def startup\nend",
"def starting; end",
"def start\n\t\tinit\n\t end",
"def startup_hook; end",
"def main; end",
"def run_main\n end",
"def main\n\n end",
"def run_init_script; end",... | [
"0.72075",
"0.72075",
"0.72075",
"0.7171804",
"0.711891",
"0.7078539",
"0.70526844",
"0.69517404",
"0.6932939",
"0.6922339",
"0.6830581",
"0.6801954",
"0.6798542",
"0.6778832",
"0.6730958",
"0.6730958",
"0.6730958",
"0.6730958",
"0.6730958",
"0.6730958",
"0.6730958",
"0.673... | 0.0 | -1 |
obfuscate cookie so nobody can use it | def hideCookie(cookie)
hcookie = cookie.to_s.split(/; */).map{ |c|
if c =~ /(__RequestVerificationToken|gspkauth|ASP.NET_SessionId)=([\w-]{5})([\w-]+)([\w-]{5})/
"#{$1}=#{$2}[#{$3.length}]#{$4}"
else
c
end
}.compact.join("; ")
return hcookie
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_cookie(data)\n Base64.strict_encode64(Firebug.encrypt(Firebug.serialize(data)))\n end",
"def decrypt_cookie(data)\n data.nil? ? {} : Firebug.unserialize(Firebug.decrypt(Base64.strict_decode64(data)))\n end",
"def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.yea... | [
"0.69744676",
"0.6967118",
"0.69304425",
"0.6899111",
"0.6834367",
"0.6829932",
"0.6829932",
"0.6829932",
"0.6829932",
"0.66667384",
"0.66549623",
"0.66458434",
"0.6630849",
"0.65897155",
"0.65897155",
"0.65446347",
"0.65394753",
"0.6420432",
"0.6396754",
"0.638846",
"0.63597... | 0.6798055 | 9 |
Cookbook Name:: janitor Provider:: directory Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. An lwrp for cleaning up directories | def whyrun_supported?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_dirs; end",
"def new_dirs; end",
"def clean_directory(path, types=nil, run_context=nil)\n raise 'clean_directory path must be a non-empty string!' if path.nil? or path.empty?\n types ||= [\n Chef::Resource::File,\n Chef::Resource::Link,\n Chef::Resource::CookbookFile,\n Chef::Resource::R... | [
"0.614639",
"0.60250705",
"0.5921608",
"0.58186215",
"0.57758164",
"0.562644",
"0.5573042",
"0.55075634",
"0.55027336",
"0.5472602",
"0.5472602",
"0.53948027",
"0.53812146",
"0.53812146",
"0.53722495",
"0.5338509",
"0.5338509",
"0.53357345",
"0.5315434",
"0.5299231",
"0.52935... | 0.0 | -1 |
of class << self Initialize a model by passing it a unique id value. Override this to set initial values for your column attributes. | def initialize(id=nil)
@model_status = :unknown
@model_id = id
@alerts = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(model_class, id)\n @attributes = { model_class.primary_key.to_sym => id }\n @columns = model_class.column_names\n @columns.each do |column|\n case column\n when 'created_at', 'updated_at'\n @attributes[column.to_sym] = Time.now\n when 'created_on', 'updat... | [
"0.7212005",
"0.66710734",
"0.64934236",
"0.64757115",
"0.6445186",
"0.63982147",
"0.6382898",
"0.63743424",
"0.63048434",
"0.6275867",
"0.6236417",
"0.62137634",
"0.61879116",
"0.6187046",
"0.61752987",
"0.6163212",
"0.614667",
"0.614667",
"0.61443454",
"0.61256385",
"0.6122... | 0.5667715 | 83 |
Syntactic sugar; same as self.class.interface, which returns the interface instance. | def interface; self.class.interface; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as(interface)\n # interface must be a class\n raise InterfaceError, \"#{interface} is not a class\" unless interface.is_a?(Class)\n\n # check if object already is an instance of interface\n return self if self.kind_of?(interface)\n\n # check if interface is really an interface\n i... | [
"0.6865034",
"0.6383601",
"0.6141308",
"0.59698796",
"0.5964586",
"0.5964586",
"0.58295023",
"0.5769465",
"0.5734502",
"0.555918",
"0.5545026",
"0.55285084",
"0.5507062",
"0.54783905",
"0.5450278",
"0.54319537",
"0.5302292",
"0.5260674",
"0.5250469",
"0.5244277",
"0.5224738",... | 0.7661069 | 0 |
Return the list of alerts. We don't use attr_reader for this because it won't protect an array from external changes. | def alerts; @alerts.dup; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alerts\n return @alerts\n end",
"def alerts\n @alerts ||= []\n end",
"def alerts\n response = self.class.get(\"/#{self.class.account}/activities.xml\")\n response['alerts'].map { |alert| ScoutScout::Alert.new(alert) }\n end",
"def list_alerts(opts = {})\n data, _... | [
"0.81790566",
"0.81413203",
"0.7472968",
"0.7325077",
"0.6887138",
"0.68583775",
"0.67063785",
"0.6633272",
"0.65769476",
"0.65025204",
"0.65025204",
"0.65025204",
"0.6364785",
"0.6213122",
"0.6188055",
"0.6168086",
"0.5924579",
"0.5924579",
"0.5917565",
"0.59042495",
"0.5850... | 0.68171823 | 6 |
Clear down the alerts. Note that we set model_status to :okay. Theoretically it might need to be :unknown or :deleted, but if you are calling clear_alerts before a call to `read` or after a call to `delete`, then you have more problems than I can solve. | def clear_alerts
@alerts = []
@model_status = :okay
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n if in_alert?\n self.status = 'clear_new'\n log('info', 'Asq alert has cleared')\n elsif operational_error?\n self.status = 'clear_new'\n log('info', 'Asq operational error has cleared')\n else\n self.status = 'clear_still'\n # self.result = ''\n self.related_... | [
"0.6246481",
"0.57763934",
"0.57743543",
"0.5657204",
"0.5597182",
"0.5535062",
"0.54305345",
"0.54010874",
"0.53216684",
"0.53216684",
"0.52223974",
"0.5155422",
"0.51543385",
"0.51054674",
"0.5091263",
"0.50859296",
"0.50704056",
"0.5053031",
"0.50527394",
"0.5038206",
"0.5... | 0.8727118 | 0 |
Raise a Pod4 exception for the model if any alerts are status :error; otherwise do nothing. Note the alias of or_die for this method, which means that if you have kept to the idiom of CRUD methods returning self, then you can steal a lick from Perl and say: MyModel.new(14).read.or_die | def raise_exceptions
al = @alerts.sort.first
raise ValidationError.from_alert(al) if al && al.type == :error
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def or_raise!\n self.value\n self\n end",
"def read\n r = interface.read(@model_id)\n\n if r.empty?\n add_alert(:error, \"Record ID '#@model_id' not found on the data source\")\n else\n map_to_model(r)\n run_validation(:read)\n @model_status = :okay if @mod... | [
"0.5536394",
"0.5493178",
"0.54806876",
"0.5446737",
"0.53984296",
"0.53743076",
"0.53112334",
"0.52996594",
"0.52737683",
"0.52530646",
"0.52530646",
"0.52530646",
"0.5240644",
"0.52153003",
"0.5213825",
"0.5212703",
"0.51814216",
"0.517893",
"0.5176238",
"0.5175406",
"0.517... | 0.54628736 | 3 |
GET /dashboard/sms_accounts/1 GET /dashboard/sms_accounts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sms_alerts = @account.sms_alerts\n end",
"def index\n @accounts = current_user.person.phone_accounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @accounts }\n end\n end",
"def index\n @smsusers = Smsuser.all\n end",
"def ... | [
"0.672636",
"0.64328045",
"0.622091",
"0.6183966",
"0.6049861",
"0.60276455",
"0.6021464",
"0.60197806",
"0.60071087",
"0.6005656",
"0.59807265",
"0.59721243",
"0.59702694",
"0.59322697",
"0.58868146",
"0.58794415",
"0.5862548",
"0.5853221",
"0.5834786",
"0.58286625",
"0.5822... | 0.0 | -1 |
context is an array of characters (bytes) which are keystrokes previously typed (in a chain of keystrokes) | def process_keystroke( context = [], mode = 'edit', ch = nil )
ch ||= @modes[ mode ].window.getch
return if ch.nil?
c = ch.ord
# UTF-8
if 194 <= c && c <= 244
if 194 <= c && c <= 223
# 2-byte character
byte_array = [c, @modes[mode].window.getch.ord]
elsif 224 <= c && c <= 239
# 3-byte character
byte_array = [
c,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
]
elsif 240 <= c && c <= 244
# 4-byte character
byte_array = [
c,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
]
end
char = byte_array.pack('C*').force_encoding('utf-8')
type_character char, mode
return
end
if @capturing_keychain
capture_keychain c, context
elsif @capturing_mapping
capture_mapping c, context
else
if context.empty? && typeable?( c )
type_character ch, mode
# Handle X windows paste
s = ""
loop do
ch = nil
begin
Timeout::timeout( 0.02 ) do
ch = @modes[ mode ].window.getch
end
rescue Timeout::Error => e
break
end
break if ch.nil?
c = ch.ord
# UTF-8
if 194 <= c && c <= 244
if 194 <= c && c <= 223
# 2-byte character
byte_array = [c, @modes[mode].window.getch.ord]
elsif 224 <= c && c <= 239
# 3-byte character
byte_array = [
c,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
]
elsif 240 <= c && c <= 244
# 4-byte character
byte_array = [
c,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
@modes[mode].window.getch.ord,
]
end
char = byte_array.pack('C*').force_encoding('utf-8')
s << char
elsif typeable?( c )
s << c
elsif c == ENTER && mode == 'edit'
s << "\n"
else
break
end
end
if ! s.empty?
case mode
when 'edit'
buffer_current.paste s, Buffer::TYPING
when 'input'
@readline.paste s
end
end
if ch
process_keystroke( [], mode, ch )
end
return
end
keychain_pressed = context.concat [ c ]
function_and_args = (
@modes[mode].keymap_after[@function_last].get_leaf( keychain_pressed ) ||
@modes[mode].keymap.get_leaf( keychain_pressed )
)
if function_and_args
function, args = function_and_args
@function_last = function
if mode != 'input' && ! @settings[ "context.combined" ]
set_iline
end
if args
to_eval = "#{function}( #{args} )"
else
to_eval = function
end
if @macro_history
@macro_history.push to_eval
end
begin
if buffer_current.search_area? && ! ( /^(?:find|readline)/ === to_eval )
buffer_current.search_area = nil
end
eval to_eval, nil, "eval"
@functions_last << to_eval unless to_eval == "repeat_last"
if ! @there_was_non_movement
@there_was_non_movement = !( /^((cursor|page|scroll)_?(up|down|left|right)|find|seek)/i === to_eval )
end
rescue Exception => e
debug_log e.message
debug_log e.backtrace.join( "\n\t" )
show_exception e
end
else
partial_keychain = @modes[ mode ].keymap.get_node( keychain_pressed )
if partial_keychain
if mode != 'input'
set_iline( keychain_str_for( keychain_pressed ) + "..." )
end
process_keystroke keychain_pressed, mode
elsif mode != 'input'
set_iline "Nothing assigned to #{keychain_str_for( keychain_pressed )}"
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_key_context!\n self.each do |tone| \n tone.tone = (tone.tone + key.index) #% 12\n tone.letter_index = (tone.letter_index + key.letter_index) % 7\n end\n true\n end",
"def add_context(context)\n return unless context.present?\n @current_context ||= []\n @current_context <... | [
"0.55382127",
"0.55286855",
"0.545728",
"0.53766114",
"0.536536",
"0.536536",
"0.533604",
"0.5291734",
"0.5252403",
"0.51608956",
"0.51401573",
"0.51224995",
"0.51165587",
"0.51150435",
"0.5102517",
"0.509856",
"0.5098008",
"0.50825685",
"0.5079421",
"0.50790614",
"0.5070464"... | 0.7218228 | 0 |
Creates a connection per standard JMS 1.1 techniques from the Oracle AQ JMS Interface | def create_connection(*args)
# Since username and password are not assigned (see lib/jms/connection.rb:200)
# and connection_factory.create_connection expects 2 arguments when username is not null ...
if args.length == 2
@username = args[0]
@password = args[1]
end
# Full Qualified name causes a Java exception
#cf = oracle.jms.AQjmsFactory.getConnectionFactory(@url, java.util.Properties.new)
cf = AQjmsFactory.getConnectionFactory(@url, java.util.Properties.new)
if username
cf.createConnection(@username, @password)
else
cf.createConnection()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_connection\n cf = oracle.jms.AQjmsFactory.getConnectionFactory(@url, java.util.Properties.new)\n if username\n cf.createConnection(@username, @password)\n else\n cf.createConnection()\n end\n end",
"def new_connection(config)\n username = nil\n\n ... | [
"0.7518159",
"0.6412511",
"0.6305679",
"0.6162421",
"0.6145013",
"0.61258996",
"0.6098792",
"0.59670204",
"0.5945539",
"0.587308",
"0.5784494",
"0.57196057",
"0.56816816",
"0.5661487",
"0.5655747",
"0.5651431",
"0.5604235",
"0.559",
"0.55778676",
"0.55479896",
"0.55192494",
... | 0.7164278 | 1 |
The size of this blob in bytes Returns Integer | def bytesize
@bytesize ||= @jrepo.open(@jblob).get_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n blob.size\n end",
"def size_in_byte\n return @size_in_byte\n end",
"def size\n read.bytesize\n end",
"def size\n @data.bytesize\n end",
"def size\n @content.bytesize\n end",
"def size\n @contents.bytes.size\n ... | [
"0.9028869",
"0.8359017",
"0.8217857",
"0.8217665",
"0.80556595",
"0.80269086",
"0.8018935",
"0.8004119",
"0.78297865",
"0.77908254",
"0.77850306",
"0.77850306",
"0.77774805",
"0.7764081",
"0.77581793",
"0.77370924",
"0.7643786",
"0.7643106",
"0.76044565",
"0.76044565",
"0.75... | 0.8170644 | 4 |
The binary contents of this blob. Returns String | def data
@data ||= RJGit::Porcelain.cat_file(@jrepo, @jblob)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bytes\n contents.bytes\n end",
"def bytes\n contents.bytes\n end",
"def to_blob\n @blob\n end",
"def to_blob\n File.binread(path)\n end",
"def content\n \"\".b\n end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def to_s... | [
"0.766183",
"0.766183",
"0.7520236",
"0.7140918",
"0.7097169",
"0.7060255",
"0.7060255",
"0.7060255",
"0.6995133",
"0.699026",
"0.6982421",
"0.6839042",
"0.6820097",
"0.6819061",
"0.6776971",
"0.6767077",
"0.6767077",
"0.6731013",
"0.673068",
"0.6689799",
"0.6689799",
"0.66... | 0.0 | -1 |
The mime type of this file (based on the filename) Returns String | def mime_type
Blob.mime_type(self.name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mimetype\n mtype = MIME::Types.of(@filename).first\n if (mtype)\n mimetype = MIME::Type.simplified(mtype)\n end\n mimetype\n end",
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def mime_type\n type = MIME::Types.type_for(self.filename)\n type... | [
"0.87401414",
"0.87277645",
"0.86620045",
"0.8545134",
"0.85387313",
"0.8522565",
"0.84851974",
"0.83263665",
"0.829792",
"0.8241816",
"0.81959236",
"0.8127555",
"0.8127555",
"0.8127555",
"0.81272465",
"0.8122742",
"0.8122655",
"0.8104091",
"0.8053675",
"0.80270153",
"0.80222... | 0.78175414 | 31 |
Called by the Cycler. Any error raised will be logged as a warning. | def remove!(package)
Logger.info "Removing backup package dated #{ package.time }..."
remote_path = remote_path_for(package)
resp = connection.get_bucket(bucket, :prefix => remote_path)
keys = resp.body['Contents'].map {|entry| entry['Key'] }
raise Errors::Storage::S3::NotFoundError,
"Package at '#{ remote_path }' not found" if keys.empty?
connection.delete_multiple_objects(bucket, keys)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circuit_breaker; end",
"def run_warned; end",
"def after_cycle; end",
"def diagnostic; end",
"def bye; end",
"def notifier; end",
"def notifier; end",
"def warning_state\n super\n end",
"def call(_rc)\n raise NotImplementedError\n end",
"def continued_exception; end",
"d... | [
"0.6078745",
"0.57796437",
"0.5739082",
"0.56894124",
"0.56644523",
"0.5620342",
"0.5620342",
"0.558649",
"0.55650353",
"0.5538159",
"0.550938",
"0.54868186",
"0.5423684",
"0.54037637",
"0.5402257",
"0.5389975",
"0.5356541",
"0.5300433",
"0.5300433",
"0.5300433",
"0.52969325"... | 0.0 | -1 |
we only accept positive integers as ids | def id=(id)
raise IdError, "#{id} less than 0" if id < 0
@id = id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_id?(value)\n digits_only?(value)\n end",
"def valid_id_number; end",
"def check_id_or_raise(id)\n id_number = Integer(id, 10)\n raise \"'id' parameter with value '#{id}' should be a positive integer\" if id_number < 0\n end",
"def handle_integer_conversion(id) \n (Intege... | [
"0.6827927",
"0.6805297",
"0.67636245",
"0.66173315",
"0.6591848",
"0.6532349",
"0.65074104",
"0.62917775",
"0.6195933",
"0.6175027",
"0.6157829",
"0.6042199",
"0.6041396",
"0.6039123",
"0.60109377",
"0.60074914",
"0.5998296",
"0.5959096",
"0.59401685",
"0.59279937",
"0.59279... | 0.5558365 | 60 |
only objects of the same class are comparable | def <=>(other)
if self.class != other.class then
return nil
# raising an ArgumentError is very inefficent since this method
# is called rather often during compilation
# raise ArgumentError,
# "#{self.class.inspect} != #{other.class.inspect} " \
# "when calling <=>"
end
self.id <=> other.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n\t\t\t\tif self.class == other.class\n\t\t\t\t\tself.eql?(other)\n\t\t\t\telsif other.kind_of? self.class\n\t\t\t\t\tself.to_a.sort == other.to_a.sort\n\t\t\t\telse\n\t\t\t\t\tsuper\n\t\t\t\tend\n\t\t\tend",
"def comparable? = super && index.comparable?",
"def comparable?\n left.cla... | [
"0.68285143",
"0.6694272",
"0.6622817",
"0.6615025",
"0.64901763",
"0.6412174",
"0.6401421",
"0.6300101",
"0.6300101",
"0.6289605",
"0.6289605",
"0.6275607",
"0.62637",
"0.6237412",
"0.62241167",
"0.62131673",
"0.6187967",
"0.6173647",
"0.6173647",
"0.6146978",
"0.6146978",
... | 0.0 | -1 |
Equality for attributes is defined over their class their name | def ==(other)
self.class == other.class and
self.name == other.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_attributes?(spec)\n @@attributes.all? {|name, default| self.send(name) == spec.send(name) }\n end",
"def attr_equal?(o)\n self == o and\n self.instance_variables_compare(o).empty? and\n self.attributes == o.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n ... | [
"0.7368525",
"0.7241398",
"0.70935816",
"0.7081307",
"0.69510454",
"0.69355166",
"0.6916379",
"0.6898191",
"0.6831946",
"0.6825099",
"0.6819728",
"0.67905664",
"0.6775736",
"0.6753744",
"0.6734955",
"0.6733488",
"0.6732576",
"0.67269707",
"0.67058927",
"0.67058927",
"0.670589... | 0.63869625 | 31 |
Add exception class e to the list of exceptions to be translated. | def translate_exception(e)
exception_translator.register_exception e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_exception(e)\n @exceptions << e\n end",
"def add_error(e)\n plan_exception = e.to_execution_exception\n if @additional_errors\n # We are currently propagating exceptions. Gather new ones in\n # @additional_errors\n @additiona... | [
"0.7158582",
"0.63793945",
"0.5598404",
"0.55800444",
"0.52967143",
"0.5277523",
"0.5277523",
"0.5273456",
"0.5261465",
"0.5234473",
"0.51777565",
"0.51653457",
"0.5119497",
"0.51148045",
"0.5047027",
"0.5012087",
"0.49685854",
"0.49430284",
"0.48532626",
"0.48112687",
"0.481... | 0.7199206 | 0 |
run method for this class | def run
ngen_auth
@validate = Validator.new
stack = EcoSystem.new
@instanceparameters = stack.yaml_reader(config[:yaml])
stack.validate = @validate
config[:action] = 'create'
stack.options = config
stack.supress_output ='1'
stack.instanceparameters = @instanceparameters
inst_result = stack.opt_parse
ho_hum
inst_result.each do |server|
config[:inst] = server['server']['display_name']
instance = {}
# puts chef_attrs = server['server']['userdata'].at(0)['chef']
chef_attrs = server['server']['userdata'].at(0)['chef'] if !server['server']['userdata'].at(0)['chef'].nil?
chef_attrs.each do |attr, value|
instance[attr] = value
end
chef_node_configuration(instance)
config[:chef_node_name] = config[:inst]
inst_details = AttrFinder.new(server)
inst_details.options = config
inst_details.validate = @validate
inst_details.function = 'server'
inst = InstanceClient.new
inst.validate = @validate
inst.options = config
inst.supress_output ='1'
inst.instanceparameters = @instanceparameters
ssh_host = inst.list_instance_ip(inst_details.compartment, inst_details.instance).at(1)
bootstrap_for_linux_node(ssh_host).run
node_attributes(ssh_host, 'IaaS')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n end",
"def run\n end",
"def run\n end",
"def run() end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run; end",
"def run... | [
"0.87692636",
"0.87692636",
"0.874483",
"0.8648881",
"0.8594726",
"0.8594726",
"0.8594726",
"0.8594726",
"0.8594726",
"0.8594726",
"0.8594726",
"0.8389053",
"0.8373542",
"0.83663183",
"0.83663183",
"0.83663183",
"0.83663183",
"0.83663183",
"0.83663183",
"0.83663183",
"0.83663... | 0.0 | -1 |
This evaluates the +during+ block, returning the result. | def now?(t=@time)
#
# Use the cache if we've already worked out what happens at time t.
#
return @now_cache[t] if @now_cache.has_key?(t)
#
# Store the test time in an instance variable so the test knows what time
# we're testing against.
#
@test_time = t
#
# Store the answer in our cache and return.
#
@now_cache[t] = (instance_eval(&@during) ? true : false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n until halted?\n step\n end\n end",
"def skip_during; end",
"def skip_during; end",
"def step\t\n\t\t@tick += 1\n\t\t\n\t\tif @tick == @interval\n\t\t\t@block.call\n\t\t\treset\n\t\tend\n\tend",
"def run_when(&blk)\n raise(\"A block is needed to evaluate for run_when\") unless blo... | [
"0.5848229",
"0.5408197",
"0.5408197",
"0.51440626",
"0.5129599",
"0.511037",
"0.50504047",
"0.50007117",
"0.49788284",
"0.49579358",
"0.4942761",
"0.488352",
"0.48745292",
"0.48651513",
"0.48275852",
"0.48152816",
"0.48063833",
"0.480024",
"0.47577143",
"0.47475293",
"0.4732... | 0.0 | -1 |
This finds the next occurance of the +during+ block evaluating to true. It returns nil if an occurence cannot be found within the next 8 days. | def find_next(after = 0)
t = @time+after
#
# If the condition is true after x seconds, return the time in x seconds.
#
return t if self.now?(t)
#
# Otherwise calculate when the condition is next true.
#
step = 3600
while t <= @time + 8.days
#
# If we're currently OK, and we won't be OK after the next step (or
# vice-versa) decrease step size, and try again
#
if false == self.now?(t) and true == self.now?(t+step)
#
# Unless we're on the smallest step, try a smaller one.
#
if step == 1
t += step
break
end
step /= 60
next
end
#
# Decrease the time by the step size if we're currently OK.
#
t += step
end
return t if self.now?(t)
nil # never again
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_next date\n loop do \n \treturn date if include?(date)\n \t# puts \"#{@resolution} : #{date}\"\n \tdate = beginning_of_next @resolution, date\n end\n end",
"def next_occurrence(after = Time.now.utc)\n return nil unless recurrence\n\n occurrence = after.cha... | [
"0.6235299",
"0.62297904",
"0.6135068",
"0.60758144",
"0.6038424",
"0.60167605",
"0.5982372",
"0.59759957",
"0.58563673",
"0.5839071",
"0.58260757",
"0.5820837",
"0.5806091",
"0.577258",
"0.57414407",
"0.57087535",
"0.5657887",
"0.5652442",
"0.56438303",
"0.5633711",
"0.55890... | 0.64331716 | 0 |
Test to see if a people_list is empty. NB this is just evaluated at the time that the DuringRunner is set up with. | def no_one_in(people_list)
return true unless Configuration.current.people[people_list].respond_to?(:people)
@test_time = @time if @test_time.nil?
#
# This is cached by itself, since calendar calls are rounded to the
# nearest minute. However this cache expires with the during runner,
# which isn't so insane..
#
test_time = @test_time - @test_time.sec
@no_one_in_cache ||= Hash.new{|h,k| h[k] = Hash.new}
return @no_one_in_cache[people_list][test_time] if @no_one_in_cache[people_list].has_key?(test_time)
@no_one_in_cache[people_list][test_time] = Configuration.current.people[people_list].people(test_time).empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty?\n @list.empty?\n end",
"def empty?\n @tenants.length == 0\n end",
"def empty?\n @exact.empty? && @list.empty?\n end",
"def empty?\n @json_data['family_members'].empty?\n end",
"def empty?\n @lists.empty? && @notices.empty?\n end",
"def empty?\n @members.e... | [
"0.6549601",
"0.64264977",
"0.6344573",
"0.6302858",
"0.61570394",
"0.61182946",
"0.6115515",
"0.606192",
"0.60517496",
"0.6018526",
"0.59909314",
"0.5964906",
"0.5919218",
"0.5919218",
"0.5917723",
"0.59165585",
"0.588548",
"0.588088",
"0.5868348",
"0.58253735",
"0.5822228",... | 0.65909743 | 0 |
Returns true if the current hour is in the list of hours given. | def hours_in_day(*hours)
@test_time = @time if @test_time.nil?
x_in_list_of_y(@test_time.hour, Configuration.parse_range(hours).flatten)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_hour?\n add_hours_array.include?(minutes)\n end",
"def hour?\n at_match[2].present?\n end",
"def hours?\n @name == :hourly\n end",
"def is_hh_show_time?\n # Monday through Friday\n if (1..5).to_a.include?(DateTime.now().wday)\n # 05:00-08:59 (Central Time)\n if... | [
"0.70245594",
"0.678478",
"0.67646873",
"0.67515004",
"0.6750141",
"0.6659442",
"0.65696216",
"0.64587873",
"0.6340953",
"0.6182011",
"0.6106015",
"0.60263115",
"0.59643155",
"0.59550065",
"0.5935507",
"0.5931962",
"0.5918366",
"0.5890419",
"0.58443063",
"0.58292484",
"0.5823... | 0.59072936 | 17 |
Returns true if the current day is in the list of days given | def days_in_week(*days)
@test_time = @time if @test_time.nil?
x_in_list_of_y(@test_time.wday, Configuration.parse_range(days,0...7).flatten)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def includes?(date)\n @days.include?(date.day)\n end",
"def contains_day?(day)\n (self.start_day <= day) and (day < self.start_day + 7.days)\n end",
"def same_day_for_datetimes?\n\t\tdays[start_datetime.wday] == days[end_datetime.wday]\n\tend",
"def check_day_of_week\n if (selected_days.size -... | [
"0.7469961",
"0.72366625",
"0.69501275",
"0.6904736",
"0.6683074",
"0.66655874",
"0.66157854",
"0.65586966",
"0.6552459",
"0.6537995",
"0.65227485",
"0.6495703",
"0.64867383",
"0.6475991",
"0.6428585",
"0.64122903",
"0.63733095",
"0.634694",
"0.62882334",
"0.6261452",
"0.6259... | 0.0 | -1 |
Tests if the alert has not been acknowledged within a certain time. | def unacknowledged(seconds)
@test_time = @time if @test_time.nil?
@alert &&
@alert.raised? &&
!@alert.acknowledged? &&
(@test_time - @alert.raised_at) >= seconds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_alert_time\n false\n end",
"def in_alert?\n return true if status == 'alert_new' || status == 'alert_still'\n false\n end",
"def raised_for(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n (@test_time - @alert.raised_at) >= secon... | [
"0.6813977",
"0.64924705",
"0.6319581",
"0.6292229",
"0.6197516",
"0.6143043",
"0.6124766",
"0.6098233",
"0.600737",
"0.5995512",
"0.5945098",
"0.59308714",
"0.59308714",
"0.58482474",
"0.5846231",
"0.58385736",
"0.58283746",
"0.5803997",
"0.5791398",
"0.5787429",
"0.5773676"... | 0.7882186 | 0 |
Tests if the alert has raised for a certain time. | def raised_for(seconds)
@test_time = @time if @test_time.nil?
@alert &&
@alert.raised? &&
(@test_time - @alert.raised_at) >= seconds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_passed?(_event, time)\n Time.now > time\n end",
"def unacknowledged(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n !@alert.acknowledged? &&\n (@test_time - @alert.raised_at) >= seconds\n end",
"def next_alert_time\n fal... | [
"0.7024555",
"0.70078075",
"0.68761915",
"0.655317",
"0.65145755",
"0.64528704",
"0.64514697",
"0.64514697",
"0.637072",
"0.6349409",
"0.62644213",
"0.6193199",
"0.61751115",
"0.61326164",
"0.60525954",
"0.5994768",
"0.5979743",
"0.5942879",
"0.59361136",
"0.59327865",
"0.592... | 0.8055992 | 0 |
Checks to see if x is contained in y | def x_in_list_of_y(x,y)
y.any? do |range|
if range.respond_to?("include?")
range.include?(x)
else
range == x
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(x, y)\n\t\tcontains_x(x) && contains_y(y)\n\tend",
"def include?(x, y)\n # assume a rectangular shape by default\n contain?(x, y)\n end",
"def contains_x?(x)\n\t\t(self.left..self.right).include?(x);\n\tend",
"def contains?(x, y)\n x >= @x && x <= (@x + @width) && y... | [
"0.78168875",
"0.6698291",
"0.6599395",
"0.6575608",
"0.65115184",
"0.65115184",
"0.65115184",
"0.6510978",
"0.64869213",
"0.6457762",
"0.6405818",
"0.63507664",
"0.63507664",
"0.63507664",
"0.6345542",
"0.63269126",
"0.63104224",
"0.63049924",
"0.62844026",
"0.6255451",
"0.6... | 0.7650201 | 1 |
Test to see if we're in working hours. See Timeworking_hours? | def working_hours?
@test_time = @time if @test_time.nil?
@test_time.working_hours?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def working_day?\n !week_end?\n end",
"def working_time?(date_time)\n return false unless working_day?(date_time)\n work_time = to_work_time(date_time)\n work_day = @days[to_day_num(date_time)]\n return work_day.includes?(work_time)\n end",
"def hours?\n @name == :hourly\n end",
... | [
"0.7133858",
"0.7124501",
"0.7047491",
"0.695826",
"0.6947614",
"0.6915278",
"0.68683517",
"0.6856339",
"0.67873853",
"0.67346436",
"0.67102623",
"0.6669205",
"0.6665568",
"0.66444004",
"0.66033",
"0.65691",
"0.6441318",
"0.63068575",
"0.6288968",
"0.6252098",
"0.61203325",
... | 0.8550486 | 0 |
Return true if today is a bank holiday | def bank_holiday?
@test_time = @time if @test_time.nil?
@test_time.bank_holiday?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def business_day?\n !holiday?\n end",
"def holiday?\n @holiday\n end",
"def today_holiday?(issue)\n day = Date.today\n check_holiday(day, issue)\n end",
"def is_a_2014_bank_holiday?(date)\nend",
"def is_a_2014_bank_holiday?(date)\nend",
"def public_holiday?\n HOLIDAYS.in... | [
"0.855552",
"0.8305238",
"0.8291053",
"0.82627356",
"0.82627356",
"0.82282513",
"0.7929481",
"0.7765088",
"0.76510817",
"0.7644211",
"0.7623641",
"0.7588453",
"0.7500833",
"0.7449157",
"0.7435101",
"0.7315883",
"0.72496295",
"0.7241624",
"0.7224743",
"0.71323586",
"0.7118673"... | 0.833002 | 1 |
Test to see if we're in the dead zone. See Timedead_zone? | def dead_zone?
@test_time = @time if @test_time.nil?
@test_time.dead_zone?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone?\n false\n end",
"def time_zone?\n !time_zone.blank?\n end",
"def has_floating_timezone?\n false\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end",
"def has_timezone?\n md = self.to_s.match(GRAMMAR)\n md && !!md[2]\n end... | [
"0.765415",
"0.7329306",
"0.6992992",
"0.69528025",
"0.69528025",
"0.69528025",
"0.67849034",
"0.671917",
"0.6623285",
"0.63887703",
"0.6388241",
"0.6383733",
"0.63118863",
"0.6305167",
"0.62934506",
"0.6260012",
"0.62561285",
"0.62521404",
"0.62490606",
"0.6163551",
"0.61416... | 0.87038106 | 0 |
Return true if we're in daytime_hours. See Timedaytime_hours? | def daytime_hours?
@test_time = @time if @test_time.nil?
@test_time.daytime_hours?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_hh_show_time?\n # Monday through Friday\n if (1..5).to_a.include?(DateTime.now().wday)\n # 05:00-08:59 (Central Time)\n if (5..8).to_a.include?(DateTime.now().hour)\n return true\n end\n end\n false\n end",
"def hours?\n @name == :hourly\n end",
"def working_ho... | [
"0.78301615",
"0.7820109",
"0.7601252",
"0.74306154",
"0.7277169",
"0.7141259",
"0.7099284",
"0.6953043",
"0.68823904",
"0.6755578",
"0.6668445",
"0.6599875",
"0.6594648",
"0.65779155",
"0.65112406",
"0.64297235",
"0.6415644",
"0.63651836",
"0.631014",
"0.6309788",
"0.630938"... | 0.8951152 | 0 |
Set up a new notification | def initialize(*usernames)
@usernames = usernames.flatten.collect do |u|
if u.respond_to?(:username)
u.username
else
u.to_s
end
end.flatten
@during = nil
@every = nil
@level = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_notification; end",
"def notification_on_create\n create_notification(:create)\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n e... | [
"0.76567006",
"0.74488324",
"0.73402536",
"0.73402536",
"0.7188538",
"0.7186254",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
"0.71465117",
... | 0.0 | -1 |
Push a notification on to the queue for this alert. The Mauve::Notifier will then pop it off and do the notification in a separate thread. | def notify(alert, already_sent_to = [], during_runner = nil)
if usernames.nil? or usernames.empty?
logger.warn "No usernames found for notification #{list}"
return
end
# Set up a during_runner
during_runner ||= DuringRunner.new(Time.now, alert, &self.during)
# Should we notify at all?
return already_sent_to unless during_runner.now?
people.collect do |person|
case person
when PeopleList
person.people(during_runner.time)
when Person
person
else
nil
end
end.flatten.compact.uniq.each do |person|
#
# A bit of alert de-bouncing.
#
unless already_sent_to.include?(person.username)
person.send_alert(level, alert)
already_sent_to << person.username
end
end
return already_sent_to
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue notification\n @notification_queue.unshift notification\n end",
"def notify\n return if destroy_if_old\n\n increase_busy_counter\n\n create_push\n end",
"def notify(msg)\n @room_queue.push(msg)\n end",
"def pop_notification\n notification_queue.shift\n ... | [
"0.71204287",
"0.6682724",
"0.6657915",
"0.63366675",
"0.6323496",
"0.6281069",
"0.6276261",
"0.62438405",
"0.61818624",
"0.613976",
"0.6123577",
"0.61078674",
"0.61065364",
"0.60920423",
"0.60837215",
"0.6072038",
"0.6061017",
"0.5993227",
"0.5955485",
"0.59485126",
"0.59212... | 0.0 | -1 |
Work out when this notification should next get sent. Nil will be returned if the alert is not raised. | def remind_at_next(alert, during_runner = nil)
#
# Don't remind on acknowledgements / clears.
#
return nil unless alert.raised?
#
# Never remind if every is not set.
#
return nil unless every
# Set up a during_runner
during_runner ||= DuringRunner.new(Time.now, alert, &self.during)
if during_runner.now?
return during_runner.find_next(every)
else
return during_runner.find_next()
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alerted?\n !alert_sent.nil?\n end",
"def next_alert_time\n false\n end",
"def reminder_sent\n end",
"def in_alert?\n return true if status == 'alert_new' || status == 'alert_still'\n false\n end",
"def send_email_changed_notification?; end",
"def notify?\n @notify == true\n... | [
"0.6396789",
"0.6247191",
"0.6005784",
"0.59941787",
"0.5797242",
"0.5703413",
"0.5699544",
"0.5699544",
"0.5657051",
"0.5638771",
"0.56143475",
"0.5612191",
"0.55697554",
"0.55547386",
"0.5549947",
"0.5539013",
"0.5522682",
"0.55083925",
"0.5470202",
"0.5470202",
"0.5465144"... | 0.0 | -1 |
Unused in 4 corners risk where all areas border each other. | def set_border(area1, area2 = nil)
@borders.push(area1)
area1.borders.push(self)
if area2 != nil
@borders << area2
area2.borders << self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cornerable? board\n corners_avail = CORNERS.select{|a| board.cells[a] == ' '}\n if corners_avail.empty?\n nil\n else\n corners_avail\n end\n\n end",
"def empty_corner\n corners = [1,3,7,9]\n corners.select! {|corner| @game... | [
"0.65513986",
"0.633815",
"0.6289529",
"0.62510353",
"0.6214829",
"0.62073654",
"0.6089863",
"0.6084649",
"0.60830265",
"0.60707486",
"0.6069605",
"0.6063581",
"0.604847",
"0.6036213",
"0.6031672",
"0.6017451",
"0.6003303",
"0.5970479",
"0.59506786",
"0.59330374",
"0.593184",... | 0.0 | -1 |
Unused in 4 corners risk where all areas border each other. | def check_border(area)
#check_border(Area) boolean to test borders between itself and the passed neighbor.
@borders.each do |my_neighbor|
return true if my_neighbor == area
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cornerable? board\n corners_avail = CORNERS.select{|a| board.cells[a] == ' '}\n if corners_avail.empty?\n nil\n else\n corners_avail\n end\n\n end",
"def empty_corner\n corners = [1,3,7,9]\n corners.select! {|corner| @game... | [
"0.65513986",
"0.633815",
"0.6289529",
"0.62510353",
"0.6214829",
"0.62073654",
"0.6089863",
"0.6084649",
"0.60830265",
"0.60707486",
"0.6069605",
"0.6063581",
"0.604847",
"0.6036213",
"0.6031672",
"0.6017451",
"0.5970479",
"0.59506786",
"0.59330374",
"0.593184",
"0.58894867"... | 0.6003303 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_campaign
@campaign = authorize Campaign.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def campaign_params
params.require(:campaign).permit(:name, :use_x_letters, :requires_authorization, campaign_users_attributes: [:id, :user_id, :is_gm, :_destroy])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
hack helper...don't use this, use application_helper instead | def short_display_time
self.timestamp.strftime("%b %d %-l:%M %p") + (self.is_full? ? " (Waitlist)" : "")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_application_helpers; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def application_helpers\n copy_file \"app/helpers/layout_helper.rb\"\n copy_file \"app/helpers/retina_image_helper.rb\"\n copy_file \"app/helpers/meta_tag_helper.rb\"\nend",
"def helper\n @helper ||= App... | [
"0.72558075",
"0.67613715",
"0.67613715",
"0.67613715",
"0.6592752",
"0.6553464",
"0.64825845",
"0.64825845",
"0.63772166",
"0.63772166",
"0.6363174",
"0.62761086",
"0.62363863",
"0.6235901",
"0.62145275",
"0.6187956",
"0.6178355",
"0.61060137",
"0.6097055",
"0.6097055",
"0.6... | 0.0 | -1 |
Cap waitlist when reserved seats = number of seats + waitlist_seats | def is_waitlist_full?
self.is_full? && (!self.show.waitlist || self.reserved_seats >= self.show.total_seats)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seats_waitlisted_same_user_same_tour\n waitlist_same_user_same_tour ? waitlist_same_user_same_tour.num_seats : 0\n end",
"def enroll_from_waitlist_as_needed\n\n # Very dumb lock\n @@currently_enrolling = true\n\n # Get tour that some booking was just destroyed for\n tour = self.tour\n\n # ... | [
"0.68716216",
"0.6592834",
"0.6439878",
"0.64184564",
"0.6379083",
"0.6238212",
"0.61092824",
"0.59658146",
"0.5954947",
"0.58572406",
"0.5786327",
"0.5685795",
"0.5669656",
"0.562973",
"0.56144667",
"0.5584954",
"0.5561362",
"0.55123854",
"0.5476143",
"0.5464137",
"0.5435554... | 0.60748047 | 7 |
Take all reservations and divide them into a Reserved list and a Waitlist ordered by signup time. | def prepare_guest_lists
confirmed = []
waitlist = []
num_total = 0
reservations.order(:created_at).each do |r|
if num_total >= show.seats
# We're already past capacity. All people join the waitlist.
waitlist << r
num_total += r.num
elsif (num_total + r.num) > show.seats
# This group puts us past capacity. Split it and waitlist the excess #.
seats_available = (show.seats - num_total)
r_waitlisted = r.dup
r.num = seats_available
r_waitlisted.id = r.id # having the same id referent is important
r_waitlisted.num -= seats_available
confirmed << r
waitlist << r_waitlisted
num_total += (r.num + r_waitlisted.num)
else
# We're still within capacity.
confirmed << r
num_total += r.num
end
end
[
confirmed.sort_by{ |r| r.lname.downcase },
waitlist # waitlist stays in order reserved
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upcoming_reservations\n upcoming = []\n reservations.each do |r|\n if r.schedule.start_at >= Time.now\n upcoming.push(r)\n end\n end\n upcoming.sort_by { |r| r.schedule.start_at }\n end",
"def time_slots\n\n # you can book by the hour, and you can stay for an hour\n reserv... | [
"0.64940995",
"0.6469047",
"0.6299528",
"0.6298791",
"0.62772614",
"0.61738116",
"0.61669403",
"0.61545",
"0.6142366",
"0.61402375",
"0.61129296",
"0.6082825",
"0.6021464",
"0.5969409",
"0.595296",
"0.59107083",
"0.5900283",
"0.5890549",
"0.58693415",
"0.5868753",
"0.58441275... | 0.7456098 | 0 |
Exponent takes two numbers, Power Number and Base Number using For loop to do exponent method | def pow(base_num, pow_num)
result = 1
pow_num.times do
result = result * base_num
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def power(base,exponent)\n i=1\n output = base\n while i<exponent\n output = output*base\n i += 1\n end\n return output\nend",
"def power(base,exponent)\n i = 0\n output = 1\n while i < exponent\n output = output * base\n i += 1\n end\n return output\nend... | [
"0.8085276",
"0.80068654",
"0.7762604",
"0.7754206",
"0.7730065",
"0.7655977",
"0.7647581",
"0.7646512",
"0.76341105",
"0.7625796",
"0.7580856",
"0.7523129",
"0.7510366",
"0.74643683",
"0.7453895",
"0.74057126",
"0.7366823",
"0.7247771",
"0.721702",
"0.7190379",
"0.7170705",
... | 0.71209025 | 25 |
Syntactical sugar for making GET requests via the API. | def get(path: nil, headers: {}, query: {}, auth_method: nil)
execute(method: :get, path: path, query: query, headers: headers, auth_method: auth_method)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def get(params = {})\n request! do\n api[url.path + to_query(params)].get(API_HEADERS)\n end\n end",
"def get\n url = prefix + \"get\"\n return response(url)\n end",
"def get\n url = prefix + \"get\"\n return response(ur... | [
"0.82137483",
"0.7791845",
"0.7787397",
"0.7787397",
"0.77300435",
"0.77026826",
"0.76736295",
"0.76736295",
"0.7615225",
"0.75617135",
"0.74935484",
"0.74678963",
"0.744396",
"0.7432315",
"0.7432315",
"0.74058133",
"0.74056226",
"0.7381087",
"0.73519206",
"0.7322047",
"0.730... | 0.0 | -1 |
Syntactical sugar for making POST requests via the API. | def post(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)
execute(
method: :post,
path: path,
headers: headers,
query: query,
payload: payload,
auth_method: auth_method
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post!\n request! :post\n end",
"def post\n resource.post(request, response)\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(*args)\n request(:post, *args)\n end",
"def pos... | [
"0.76595324",
"0.76349956",
"0.76160145",
"0.7474272",
"0.7462206",
"0.7455741",
"0.7450422",
"0.7426665",
"0.7363044",
"0.73492044",
"0.73483527",
"0.7305558",
"0.7277547",
"0.72249526",
"0.71867025",
"0.7172917",
"0.715154",
"0.7138013",
"0.7138013",
"0.70957565",
"0.705834... | 0.0 | -1 |
Syntactical sugar for making PUT requests via the API. | def put(path: nil, payload:, headers: {}, query: {}, auth_method: nil)
execute(
method: :put,
path: path,
headers: headers,
query: query,
payload: payload,
auth_method: auth_method
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put!\n request! :put\n end",
"def put(*args)\n request :put, *args\n end",
"def put(*args)\n request(:put, *args)\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",... | [
"0.835454",
"0.79464114",
"0.7827894",
"0.7540452",
"0.7540452",
"0.75071394",
"0.7495125",
"0.746886",
"0.74226993",
"0.73766273",
"0.73636514",
"0.7356299",
"0.73495704",
"0.7313444",
"0.7305742",
"0.72998106",
"0.72663254",
"0.7211427",
"0.7193286",
"0.7192958",
"0.718138"... | 0.6735814 | 95 |
Syntactical sugar for making DELETE requests via the API. | def delete(path: nil, payload: nil, headers: {}, query: {}, auth_method: nil)
execute(
method: :delete,
path: path,
headers: headers,
query: query,
payload: payload,
auth_method: auth_method
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete!\n request! :delete\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url =... | [
"0.81242996",
"0.81242996",
"0.8076634",
"0.80705446",
"0.80705446",
"0.8053687",
"0.7997748",
"0.7997748",
"0.7997748",
"0.7997748",
"0.7929745",
"0.7913089",
"0.78521913",
"0.7845529",
"0.7765275",
"0.77513826",
"0.77385753",
"0.7707836",
"0.7707836",
"0.7667785",
"0.766655... | 0.0 | -1 |
TODO: separate send_create_new_battle_on_client into two methods | def send_create_new_battle_on_client(units, shared_data, mana_data)
write_data [SEND_CREATE_NEW_BATTLE_ON_CLIENT_ACTION, @latency, @id, units, shared_data, mana_data]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @battle = Battle.new(params[:battle])\n \n @ship1 = Ship.find(@battle.ship1_id)\n @ship2 = Ship.find(@battle.ship2_id)\n @character = Character.find(1)\n @finished = Battle.battle(@ship1,@ship2)\n \n respond_to do |format|\n if @battle.save\n flash[:notice] = 'B... | [
"0.66827875",
"0.6512144",
"0.6492725",
"0.6480496",
"0.64231",
"0.63703966",
"0.6366254",
"0.6315017",
"0.62277615",
"0.60494065",
"0.59116274",
"0.5811809",
"0.5811809",
"0.5811809",
"0.5775837",
"0.5765413",
"0.57086754",
"0.57085747",
"0.5703278",
"0.56995887",
"0.5699588... | 0.7789467 | 0 |
remove unwanted api data fields and rename 24h_volume_usd | def get_crypto_attrs(obj)
props = obj.except('id', '24h_volume_usd', 'max_supply')
props['daily_volume_usd'] = obj['24h_volume_usd']
props
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_data\n # https://developer.fcoin.com/en.html\n ticker = data['ticker'].dup\n self.data['ticker'] = {\n \"latest_price\" => ticker[0],\n \"most_recent_trade_vol\" => ticker[1],\n \"max_buy_price\" ... | [
"0.56655",
"0.5164315",
"0.50644726",
"0.504781",
"0.5043813",
"0.50317943",
"0.49736974",
"0.49698362",
"0.49698046",
"0.49242547",
"0.49048173",
"0.48899695",
"0.48411977",
"0.48351586",
"0.4831701",
"0.4828681",
"0.48126334",
"0.48002136",
"0.47892824",
"0.4765382",
"0.472... | 0.5525298 | 1 |
checks if the monitor is present in the set | def contains?(monitor_instance_id)
@monitors.key?(monitor_instance_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dpms_screen_is_on?\n if ENV['DISPLAY'].nil? or ENV['DISPLAY'].empty?\n ENV['DISPLAY'] = default_display\n end\n\n begin\n result = `xset -q 2>&1`\n rescue Errno::ENOENT\n return :unknown\n end\n if ($?.exitstatus != 0)\n return :unknown\n end\n ... | [
"0.59312046",
"0.57680255",
"0.57451886",
"0.5714831",
"0.5686949",
"0.55322963",
"0.5527216",
"0.54992366",
"0.5376559",
"0.53489244",
"0.53437656",
"0.533081",
"0.5325731",
"0.5300796",
"0.52922904",
"0.52807385",
"0.527276",
"0.5265704",
"0.52573496",
"0.52401173",
"0.5230... | 0.72363913 | 0 |
adds or updates the monitor | def add_or_update(monitor)
@monitors[monitor.monitor_instance_id] = monitor
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor; end",
"def add(key, object)\n if not @monitor.has_key?(key)\n @monitor[key] = @block.call(object)\n @monitor[key].on_update { |value| collection_updated(object, value) }\n collection_updated(object, @monitor[key].cur) # FIXME: First notification should be auto... | [
"0.67051864",
"0.66927576",
"0.6671513",
"0.6407853",
"0.62925494",
"0.61874294",
"0.61030084",
"0.60797894",
"0.6035",
"0.5921005",
"0.58348477",
"0.56503046",
"0.56499004",
"0.564233",
"0.56289625",
"0.5614923",
"0.5607448",
"0.55885464",
"0.555176",
"0.55043507",
"0.550282... | 0.7695912 | 0 |
gets the monitor given the monitor instance id | def get_monitor(monitor_instance_id)
@monitors[monitor_instance_id] if @monitors.key?(monitor_instance_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_existing_monitor_by_name(mon_name)\n get_monitors.each do |mon|\n return mon if mon['name'] == mon_name\n end\n nil\n end",
"def instance\n Monitor.instance\n end",
"def get_instance_by_id(id)\n get_instances_description.select {|a| a.instance_id == id}[0] rescue n... | [
"0.698466",
"0.6308036",
"0.6299409",
"0.6229585",
"0.6202389",
"0.6114228",
"0.6106636",
"0.60733783",
"0.60500914",
"0.5921282",
"0.5869464",
"0.58578366",
"0.5797908",
"0.5753863",
"0.57388705",
"0.5702917",
"0.5601799",
"0.55635285",
"0.5517286",
"0.55075973",
"0.54793626... | 0.85805374 | 0 |
deletes a monitor from the set | def delete(monitor_instance_id)
if @monitors.key?(monitor_instance_id)
@monitors.delete(monitor_instance_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(object)\n @monitor.delete(object.key)\n object.unsubscribe(self)\n super(object)\n end",
"def delete_monitor monitor_name\n response = RestClient.delete(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/#{monitor_name}\",\n :conte... | [
"0.65935796",
"0.65329325",
"0.62150276",
"0.61967015",
"0.59672207",
"0.59464556",
"0.5918642",
"0.58169776",
"0.56985456",
"0.56537336",
"0.5635681",
"0.5635681",
"0.5593601",
"0.55688846",
"0.5547637",
"0.5534933",
"0.5529455",
"0.5525273",
"0.5502367",
"0.5495311",
"0.544... | 0.66417974 | 0 |
gets the size of the monitor set | def get_size
@monitors.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_winsize\n str = [0, 0, 0, 0].pack('SSSS')\n if STDIN.ioctl(TIOCGWINSZ, str) >= 0\n rows, cols, xpixels, ypixels = str.unpack(\"SSSS\")\n #rows, cols, xpixels, ypixels\n cols\n end\nend",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.... | [
"0.6527957",
"0.6483731",
"0.6483731",
"0.6483731",
"0.6393004",
"0.63664556",
"0.63647866",
"0.6301",
"0.6225243",
"0.6196168",
"0.6191555",
"0.6148615",
"0.6118776",
"0.6118776",
"0.6037349",
"0.60253584",
"0.6019358",
"0.59973216",
"0.598264",
"0.595272",
"0.59491146",
"... | 0.765319 | 0 |
gets the map of monitor instance id to monitors | def get_map
@monitors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_monitor(monitor_instance_id)\n @monitors[monitor_instance_id] if @monitors.key?(monitor_instance_id)\n end",
"def get_monitors\n if @monitors.nil?\n @monitors = @dog.get_all_monitors(group_states: 'all')\n logger.info \"Found #{@monitors[1].length} existing monitors in DataDog\... | [
"0.6984628",
"0.6924931",
"0.66280586",
"0.6083631",
"0.60604006",
"0.6058856",
"0.5921466",
"0.58326",
"0.58100706",
"0.57240343",
"0.5707552",
"0.57065225",
"0.5620585",
"0.5543206",
"0.55340624",
"0.55160534",
"0.545842",
"0.54108953",
"0.5346088",
"0.5255483",
"0.5228345"... | 0.7520822 | 0 |
GET /patrollers GET /patrollers.json | def index
@patrollers = Patroller.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {... | [
"0.6679969",
"0.6306296",
"0.6247395",
"0.60922104",
"0.6083654",
"0.60081416",
"0.5986423",
"0.5909015",
"0.58906317",
"0.5882652",
"0.5876074",
"0.58702505",
"0.58613634",
"0.58375156",
"0.5831154",
"0.58278614",
"0.58259946",
"0.5814678",
"0.5810802",
"0.58097047",
"0.5798... | 0.73528343 | 0 |
GET /patrollers/1 GET /patrollers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @patrollers = Patroller.all\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @patent = Patent.find(params[:id])\n\n respond_to do |format|\... | [
"0.7050504",
"0.6747388",
"0.6618043",
"0.66078305",
"0.61322147",
"0.6092223",
"0.60815585",
"0.60609215",
"0.598526",
"0.5981989",
"0.59780383",
"0.595057",
"0.5947758",
"0.59433305",
"0.5935566",
"0.5928948",
"0.5920207",
"0.59179306",
"0.59176767",
"0.59176767",
"0.591767... | 0.0 | -1 |
POST /patrollers POST /patrollers.json | def create
@patroller = Patroller.new(patroller_params)
respond_to do |format|
if @patroller.save
format.html { redirect_to @patroller, notice: 'Patroller was successfully created.' }
format.json { render :show, status: :created, location: @patroller }
else
format.html { render :new }
format.json { render json: @patroller.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @patent = Patent.new(params[:patent])\n\n respond_to do |format|\n if @patent.save\n format.html { redirect_to @patent, notice: 'Patent was successfully created.' }\n format.json { render json: @patent, status: :created, location: @patent }\n else\n format.html { r... | [
"0.6078824",
"0.59661126",
"0.596199",
"0.57533175",
"0.5715988",
"0.5703816",
"0.56008667",
"0.5575711",
"0.5572612",
"0.5552776",
"0.55451584",
"0.55286115",
"0.5491944",
"0.5464441",
"0.5442169",
"0.5430957",
"0.5386765",
"0.5382745",
"0.53628445",
"0.53480685",
"0.5333164... | 0.6617986 | 0 |
PATCH/PUT /patrollers/1 PATCH/PUT /patrollers/1.json | def update
respond_to do |format|
if @patroller.update(patroller_params)
format.html { redirect_to @patroller, notice: 'Patroller was successfully updated.' }
format.json { render :show, status: :ok, location: @patroller }
else
format.html { render :edit }
format.json { render json: @patroller.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {}... | [
"0.654354",
"0.63602835",
"0.6197182",
"0.60255843",
"0.60116816",
"0.59925246",
"0.59910536",
"0.59634185",
"0.5959776",
"0.5959776",
"0.5954027",
"0.5937745",
"0.5926187",
"0.5889002",
"0.5883972",
"0.5874787",
"0.5864981",
"0.58630294",
"0.5848771",
"0.5848771",
"0.5847844... | 0.63355315 | 2 |
DELETE /patrollers/1 DELETE /patrollers/1.json | def destroy
@patroller.destroy
respond_to do |format|
format.html { redirect_to patrollers_url, notice: 'Patroller was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @patent = Patent.find(params[:id])\n @patent.destroy\n\n respond_to do |format|\n format.html { redirect_to patents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patrocinio = Patrocinio.find... | [
"0.6861569",
"0.68262553",
"0.67926997",
"0.6749691",
"0.6715772",
"0.66721684",
"0.6650296",
"0.6616987",
"0.6604421",
"0.65958244",
"0.65851974",
"0.6581026",
"0.6565337",
"0.6558221",
"0.65558785",
"0.6543777",
"0.65307343",
"0.6529023",
"0.6526245",
"0.6509853",
"0.650026... | 0.6870176 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.