query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
GET /efemerides GET /efemerides.json | def index
@efemerides = Efemeride.all
end | [
"def index\n @efimerides = Efimeride.all\n end",
"def show\n @evemt = Evemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evemt }\n end\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /efemerides POST /efemerides.json | def create
@efemeride = Efemeride.new(efemeride_params)
respond_to do |format|
if @efemeride.save
format.html { redirect_to @efemeride, notice: 'Efemeride ha sido creada.' }
format.json { render :show, status: :created, location: @efemeride }
else
format.html { render :new }... | [
"def create\n @efemeride = Efemeride.new(efemeride_params)\n\n respond_to do |format|\n if @efemeride.save\n format.html { redirect_to @efemeride, notice: \"Efemeride was successfully created.\" }\n format.json { render :show, status: :created, location: @efemeride }\n else\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /efemerides/1 PATCH/PUT /efemerides/1.json | def update
respond_to do |format|
if @efemeride.update(efemeride_params)
format.html { redirect_to @efemeride, notice: 'Efemeride ha sido actualizada.' }
format.json { render :show, status: :ok, location: @efemeride }
else
format.html { render :edit }
format.json { render... | [
"def update\n respond_to do |format|\n if @efemeride.update(efemeride_params)\n format.html { redirect_to @efemeride, notice: \"Efemeride was successfully updated.\" }\n format.json { render :show, status: :ok, location: @efemeride }\n else\n format.html { render :edit, status: :un... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /efemerides/1 DELETE /efemerides/1.json | def destroy
@efemeride.destroy
respond_to do |format|
format.html { redirect_to efemerides_url, notice: 'Efemeride ha sido eliminada.' }
format.json { head :no_content }
end
end | [
"def destroy\n @efemeride.destroy\n respond_to do |format|\n format.html { redirect_to efemerides_url, notice: \"Efemeride was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ephem.destroy\n respond_to do |format|\n format.html { redirect... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /empresas_grandes GET /empresas_grandes.json | def index
@empresas_grandes = EmpresasGrande.all
end | [
"def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end",
"def returnGrupoEmpresas\n\t\tempresas_array = Array.new\n\t\t@grupo = Grupo.find(params[:id])\n\t\t@grupo.empresas.each do |item|\n\t\t\tempresas_array << item\n\t\tend\n \t\trender :json => (empresas_array.sort!).to_js... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /empresas_grandes POST /empresas_grandes.json | def create
@empresas_grande = EmpresasGrande.new(empresas_grande_params)
respond_to do |format|
if @empresas_grande.save
format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully created.' }
format.json { render :show, status: :created, location: @empresas_gran... | [
"def create\n @gran_unidad = GranUnidad.new(gran_unidad_params)\n\n respond_to do |format|\n if @gran_unidad.save\n format.html { redirect_to @gran_unidad, notice: 'Gran unidad was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gran_unidad }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /empresas_grandes/1 PATCH/PUT /empresas_grandes/1.json | def update
respond_to do |format|
if @empresas_grande.update(empresas_grande_params)
format.html { redirect_to @empresas_grande, notice: 'Empresas grande was successfully updated.' }
format.json { render :show, status: :ok, location: @empresas_grande }
else
format.html { render :... | [
"def update\n respond_to do |format|\n if @grupo_demandas.update(grupo_demandas_params)\n format.html { redirect_to @grupo_demandas, notice: 'Grupo demandas was successfully updated.' }\n format.json { render :show, status: :ok, location: @grupo_demandas }\n else\n format.html { re... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /empresas_grandes/1 DELETE /empresas_grandes/1.json | def destroy
@empresas_grande.destroy
respond_to do |format|
format.html { redirect_to empresas_grandes_url, notice: 'Empresas grande was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emprestimo = Emprestimo.find(params[:id])\n @emprestimo.destroy\n\n respond_to do |format|\n format.ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
walks all files and converts them all to the new format | def transform_files!(files, type)
files.each do |file|
@file = file
@type = type
parsed = ""
@dirnames = Base.get_namespace(file,type) # directories after the app/type/ directory
namespaces = LANGUAGES.collect do |lang|
if type == 'views'
n... | [
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\n end",
"def git_convert_all!\n Dir[\"#{@path}/**/*.erb\"].each do... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dumps the translation strings into yml files | def dump_yaml!(filepath,translations)
return if translations.blank?
FileUtils.mkdir_p(@dirpath) unless File.exists?(@dirpath)
File.open(filepath, 'w+') { |f| YAML::dump(translations, f) }
end | [
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(template_file,'w+'){ |f| YAML::dump(@translations, f) } \n end",
"def dump_yaml!\n FileUtils.mkdir_p LOCALE_DIR\n File.open(STANDARD_LOCALE_FILE,'w+') { |f| YAML::dump(@translations, f) } \n end",
"def yml_to_po\r\nDir.glob(Rai... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Render the html rows for the given records and an optional named partial. Returns HTML string or nil | def render_response_html(records, partial: 'row', locals: {} )
output = render_to_string(partial: partial, locals: { records: records }.merge(locals))
# if the query has no results, it will return a string which causes jquery to crash
output = nil unless records.any?
output
... | [
"def render_record_from_config(record, renderer = record_select_config.label)\n case renderer\n when Symbol, String\n # return full-html from the named partial\n render :partial => renderer.to_s, :locals => {:record => record}\n\n when Proc\n # return an html-cleaned descriptive string\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
TeleSign RestClient, useful for making generic RESTful requests against the API. +customer_id+ Your customer_id string associated with your account. +api_key+ Your api_key string associated with your account. +rest_endpoint+ (optional) Override the default rest_endpoint to target another endpoint. +timeout+ (optional) ... | def initialize(customer_id,
api_key,
rest_endpoint: 'https://rest-api.telesign.com',
proxy: nil,
timeout: 10)
@customer_id = customer_id
@api_key = api_key
@rest_endpoint = rest_endpoint
@http = Net::HTTP::Persistent.n... | [
"def get_testrail_api(credentials)\n client = TestRail::APIClient.new(TESTRAIL_URL)\n client.user = credentials[\"testrail_username\"]\n client.password = credentials[\"testrail_password\"]\n\n return client\n end",
"def api\n RestClient::Resource.new(@delicious[:api],\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic TeleSign REST API POST handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the POST request with, as a hash. | def post(resource, **params)
execute(Net::HTTP::Post, 'POST', resource, **params)
end | [
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end",
"def post(resource, params)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic TeleSign REST API GET handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the GET request with, as a hash. | def get(resource, **params)
execute(Net::HTTP::Get, 'GET', resource, **params)
end | [
"def send_get_request(resource, params)\n api_resource = 'https://api.twitter.com/1.1'\n uri = URI(api_resource + resource) \n uri.query = URI.encode_www_form(params) # add parameters to resource\n #send HTTPS GET request\n response = Net::HTTP.start(uri.hostname, uri.port,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic TeleSign REST API PUT handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the PUT request with, as a hash. | def put(resource, **params)
execute(Net::HTTP::Put, 'PUT', resource, **params)
end | [
"def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def send_put(resource, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic TeleSign REST API DELETE handler. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the DELETE request with, as a hash. | def delete(resource, **params)
execute(Net::HTTP::Delete, 'DELETE', resource, **params)
end | [
"def delete(resource, body = nil, params = {})\n connection(:delete, resource, body, params)\n end",
"def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end",
"def delete(path, params = {}, env = {})\n request(path, env.mer... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generic TeleSign REST API request handler. +method_function+ The net/http request to perform the request. +method_name+ The HTTP method name, as an upper case string. +resource+ The partial resource URI to perform the request against, as a string. +params+ Body params to perform the HTTP request with, as a hash. | def execute(method_function, method_name, resource, **params)
resource_uri = URI.parse("#{@rest_endpoint}#{resource}")
encoded_fields = ''
if %w[POST PUT].include? method_name
request = method_function.new(resource_uri.request_uri)
if content_type == "application/x-www-form-urlencode... | [
"def method_missing(method_name, *arguments, &block)\n if method_name.to_s =~ /(post|get|put|patch|delete)/\n request($1.to_sym, *arguments, &block)\n else\n super\n end\n end",
"def custom_method(resource, target, name, http_verb, http_path); end",
"def rest(connection, endpoint, http_metho... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /thresholds GET /thresholds.json | def index
@thresholds = Threshold.all
end | [
"def query_distance_thresholds(options={}) path = \"/api/v2/distancethresholds\"\n get(path, options, AvaTax::VERSION) end",
"def collect_thresholds_for(threshold)\n active_thresholds = Array.new()\n threshold.indicators.each_value { |value| \n active_thresholds << value ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /thresholds POST /thresholds.json | def create
@threshold = Threshold.new(threshold_params)
respond_to do |format|
if @threshold.save
format.html { redirect_to thresholds_path, notice: 'Threshold was successfully created.' }
format.json { render :show, status: :created, location: @threshold }
else
format.html ... | [
"def create\n @threshold = Threshold.new(params[:threshold])\n\n respond_to do |format|\n if @threshold.save\n format.html { redirect_to @threshold, notice: 'Threshold was successfully created.' }\n format.json { render json: @threshold, status: :created, location: @threshold }\n else\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /thresholds/1 PATCH/PUT /thresholds/1.json | def update
respond_to do |format|
if @threshold.update(threshold_params)
format.html { redirect_to thresholds_path, notice: 'Threshold was successfully updated.' }
format.json { render :show, status: :ok, location: @threshold }
else
format.html { render :edit }
format.jso... | [
"def update\n @threshold = Threshold.find(params[:id])\n\n respond_to do |format|\n if @threshold.update_attributes(params[:threshold])\n format.html { redirect_to @threshold, notice: 'Threshold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /thresholds/1 DELETE /thresholds/1.json | def destroy
@threshold.destroy
respond_to do |format|
format.html { redirect_to thresholds_url, notice: 'Threshold was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @threshold = Threshold.find(params[:id])\n @threshold.destroy\n\n respond_to do |format|\n format.html { redirect_to thresholds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @measurement_threshold.destroy\r\n\r\n respond_to do |format|\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Method for search the surgery term | def find_surgery_term surgeryterm
# Search the surgery terms
Surgery.where(user_type: "admin").any_of({ :name => /^#{surgeryterm}/i })
end | [
"def search_surgery\n\t\t# Searching for surgery as per user entered term\n\t\tif Surgery.where(user_type: \"admin\").any_of({ :name => /^#{params[:term]}/i }).present?\n\t\t\t# if search show from the admin then the search term from surgery of admin\n\t\t\tsurgeries = Surgery.where(user_type: \"admin\").any_of({ :... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Renames the Service type from "type" to "service_type" to avoid conflicts | def rename_service_type(hash)
hash["service_type"] = hash["type"]
hash.delete("type")
hash
end | [
"def service_type=(value)\n @service_type = value\n end",
"def service_type_value=(value)\n value = ServiceTypeValue[value] unless value.kind_of?(ServiceTypeValue) \n self.service_type_value_name = value.name \n end",
"def _service_type\n self.class.service_type\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instantiate an instance of +klass+ and pass +output+ | def respond_with(klass, output)
klass.new(self, output)
end | [
"def output_from new_output\n return @output = new_output.new(self) if Class === new_output\n\n klass =\n case new_output.to_s\n when /^(Player::)?benchmark$/i then Benchmark\n when /^(Player::)?stream$/i then Stream\n when /^(Player::)?suite$/i then Suite\n else\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method is responsible for receiving the exchange_rate of a specific currency to the GBP from an API. | def find_rate()
uri_string = "https://free.currconv.com/api/v7/convert?q=GBP_"\
"#{@currency}&compact=ultra&apiKey=2d46a9b5b650dca0dbb1"
uri = URI(uri_string)
res = Net::HTTP.get_response(uri)
return(JSON.parse(res.body)["GBP_#{@currency}"]/100.0)
end | [
"def exchange_rate(to_currency)\n self.bank.exchange(self.base_currency, to_currency)\n end",
"def conv_exchange_rate\n currency_exchange.exchange_rate\n end",
"def fetch_exchange_rates(currency)\n resp = client.get('exchange-rates', { currency: currency })\n\n case resp.status\n wh... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get a diff that can be stored as a JSON string, persisted and retrieved to apply (by default, Diff::LCS::Changeas_json isn't very useful) | def persistable_diff(a, b)
diff = Diff::LCS.diff a, b
reify_diff_element(diff).as_json
end | [
"def to_json\n diff.to_json\n end",
"def to_diff\n # see Grit::Commit#show\n patch = to_patch\n\n # discard lines before the diff\n lines = patch.split(\"\\n\")\n while !lines.first.start_with?(\"diff --git\") do\n lines.shift\n end\n lines.pop if ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a Revision using revised content compared to base content | def revise_from_content(base_content, revised_content)
revisions.build(diffs: generate_diff_hash(base_content, revised_content))
end | [
"def make_revision()\n rev = self.revisions.create()\n rev.value_proposition = self.business_plan.plan_parts.find_by_title(\"Value Proposition\").content\n rev.revenue_streams = self.business_plan.plan_parts.find_by_title(\"Revenue Streams\").content\n rev.cost_structure = self.business_plan.plan_part... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=begin my_basket is configured to the current user =end | def my_basket
@user = current_user
end | [
"def basket\n \t#if the user doesn't have a basket\n \t#give them an empty one\n \tif session[:basket].nil?\n \t#basket is an empty list\n \t#using set because we don't want to add the same thing twice\n \tsession[:basket]= Set.new\n end\n #actually give them the basket\n session[:basket]\n end",
"def b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=begin add_to_basket includes an if statement. If the users basket already exists it adds the book details Else it will create the basket =end | def add_to_basket
if Basket.exists?(user_id: params[:user_id], book_id: params[:book_id])
@basket = Basket.find_by(user_id: params[:user_id], book_id: params[:book_id])
@basket.increment!(:amount)
else
Basket.create(user_id: params[:user_id], book_id: params[:book_id], amou... | [
"def add_to_basket\n item = Item.find(params[:id])\n basket = current_basket\n if basket.items.include? item\n redirect_to items_path, warning: 'Item already present in the basket' and return\n else\n basket.order_items.build({item: item})\n basket.valid?\n basket.save!\n sessio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
=begin Remove basket allows the user to clear down their basket by destroying it for the given user. it then redirects them to an empty basket =end | def remove_from_basket
@basket = Basket.find_by(user_id: params[:user_id], book_id: params[:book_id])
@basket.destroy
redirect_to my_basket_path(params[:user_id])
end | [
"def destroy\n # Check if the quantity of the basket item the user wants to remove from their\n # basket is greater than 1. If so, reduce the quantity by 1.\n if @basket_item.quantity > 1\n @basket_item.update_attribute(:quantity, @basket_item.quantity - 1)\n else\n # Otherwuse, destroy the li... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Remove a listening channel, the LiveQuery will automatically remove itsself from the pool when there are no channels. | def remove_listener(collection, query)
live_query = @volt_app.live_query_pool.lookup(collection, query)
live_query.remove_channel(@channel)
end | [
"def remove_listener(collection, query)\n live_query = @@live_query_pool.lookup(collection, query)\n live_query.remove_channel(@channel)\n end",
"def remove_channel(channel_name)\r\n @channels.delete(channel_name.downcase)\r\n end",
"def close!\n live_queries = @@channel_live_queries[@channel]\n\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes a channel from all associated live queries | def close!
live_queries = @volt_app.channel_live_queries[@channel]
if live_queries
live_queries.each do |live_query|
live_query.remove_channel(@channel)
end
end
@volt_app.channel_live_queries.delete(@channel)
end | [
"def close!\n live_queries = @@channel_live_queries[@channel]\n\n if live_queries\n live_queries.each do |live_query|\n live_query.remove_channel(@channel)\n end\n end\n\n @@channel_live_queries.delete(@channel)\n end",
"def remove_channel( channel )\n @channel_map.delete ch... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Tracks that this channel will be notified from the live query. | def track_channel_in_live_query(live_query)
channel_live_queries = @volt_app.channel_live_queries
channel_live_queries[@channel] ||= []
channel_live_queries[@channel] << live_query
end | [
"def track_channel_in_live_query(live_query)\n @@channel_live_queries[@channel] ||= []\n @@channel_live_queries[@channel] << live_query\n end",
"def track_channel_in_live_query(live_query)\n @@channel_live_queries[@channel] ||= []\n @@channel_live_queries[@channel] << live_query\n end",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /company_businesses/1 DELETE /company_businesses/1.json | def destroy
@company_business.destroy
respond_to do |format|
format.html { redirect_to company_businesses_url }
format.json { head :no_content }
end
end | [
"def destroy\n @company = Company.find(params[:id])\n @company.destroy\n \n render json: @company, status: :ok \n end",
"def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @biz_company = BizCompany.find(params[:i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Grabs all of the yaml files found in /pages, and loads them as Page objects. | def find_all
Dir["#{pages_dir}**/*.yml"].map {|f| new f }
end | [
"def find_and_load_pages\n\t\t\tPathname.glob( @sourcedir + '**/*.page' ).each do |pagefile|\n\t\t\t\tpath_to_base = @sourcedir.relative_path_from( pagefile.dirname )\n\n\t\t\t\tpage = Manual::Page.new( self, pagefile, @layoutsdir, path_to_base )\n\t\t\t\thierpath = pagefile.relative_path_from( @sourcedir )\n\n\t\t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a collection that represents the instances belonging to this Auto Scaling group. You can use this collection to further refine the instances you are interested in: group.ec2_instances.filter('availabilityzone', 'useast1a').each do |i| puts instance.id end | def ec2_instances
instances = EC2::InstanceCollection.new(:config => config)
instances.tagged('aws:autoscaling:groupName').tagged_values(name)
end | [
"def instances\n instance_ids = ey_instances(@cloud_info.env_name)\n if instance_ids.empty?\n instances = []\n else\n group_id = aws_group_for_instance_id(instance_ids.first)\n instances = instances_in_group(group_id)\n instances\n end\n end",
"def auto_scaling_i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Suspends processes for this Auto Scaling group. suspend two processes by name auto_scaling_group.suspend_processes 'Launch', 'AZRebalance' | def suspend_processes *processes
client_opts = {}
client_opts[:auto_scaling_group_name] = name
client_opts[:scaling_processes] = processes.flatten
client.suspend_processes(client_opts)
nil
end | [
"def suspend_processes(auto_scaling_group_name, options = {})\n if scaling_processes = options.delete('ScalingProcesses')\n options.merge!(AWS.indexed_param('ScalingProcesses.member.%d', [*scaling_processes]))\n end\n request({\n 'Action' => 'SuspendPro... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resumes processes for this Auto Scaling group. resume two processes by name auto_scaling_group.suspend_processes 'Launch', 'AZRebalance' | def resume_processes *processes
client_opts = {}
client_opts[:auto_scaling_group_name] = name
client_opts[:scaling_processes] = processes.flatten
client.resume_processes(client_opts)
nil
end | [
"def resume_processes(auto_scaling_group_name, options = {})\n if scaling_processes = options.delete('ScalingProcesses')\n options.merge!(AWS.indexed_param('ScalingProcesses.member.%d', [*scaling_processes]))\n end\n request({\n 'Action' => 'ResumeProce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Resumes all processes for this Auto Scaling group. | def resume_all_processes
resume_processes
end | [
"def resume_processes(auto_scaling_group_name, options = {})\n if scaling_processes = options.delete('ScalingProcesses')\n options.merge!(AWS.indexed_param('ScalingProcesses.member.%d', [*scaling_processes]))\n end\n request({\n 'Action' => 'ResumeProce... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Enables all metrics collection for the Auto Scaling group. | def enable_all_metrics_collection
enable_metrics_collection
end | [
"def enable_metrics_collection(auto_scaling_group_name, granularity, options = {})\n if metrics = options.delete('Metrics')\n options.merge!(AWS.indexed_param('Metrics.member.%d', [*metrics]))\n end\n request({\n 'Action' => 'EnableMetricsCollection',\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Disables all metrics collection for the Auto Scaling group. | def disable_all_metrics_collection
disable_metrics_collection
end | [
"def enable_all_metrics_collection\n enable_metrics_collection\n end",
"def update_metrics(group, disable, enable)\n @aws.disable_metrics_collection({\n auto_scaling_group_name: group.name,\n metrics: disable\n })\n @aws.enable_metrics_collection({\n aut... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Update one or more attributes on the Auto Scaling group. | def update options = {}
group_opts = group_options(options)
# tags must be updated using a separate request from the
# other attributes, *sigh*
if tags = group_opts.delete(:tags)
tags.map(&:to_hash).each do |tag|
tag[:resource_type] = 'auto-scaling-group'
... | [
"def update_auto_scaling_group(auto_scaling_group_name, options = {})\n if availability_zones = options.delete('AvailabilityZones')\n options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))\n end\n request({\n 'Action' =>... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Removes all tags from this Auto Scaling group. | def delete_all_tags
delete_tags(self.tags)
nil
end | [
"def delete_all_tags\n for tag in tags\n tag.reload\n tag.unlink\n end\n tags.clear\n end",
"def clear_tags\n\t\tif @tags\n\t\t\t@tags.each { |tag, __unused| self.class.remove_object_with_tag(self, tag) }\n\t\t\t@tags.clear\n\t\tend\n\t\treturn self\n\tend",
"def clear_all_instance_tags\r\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes the Auto Scaling group. If you pass +:force+ as true then all the instances associated with this group will also be terminated. | def delete options = {}
client_opts = {}
client_opts[:force_delete] = options[:force] == true
client_opts[:auto_scaling_group_name] = name
client.delete_auto_scaling_group(client_opts)
nil
end | [
"def delete_auto_scaling_group(auto_scaling_group_name)\n request({\n 'Action' => 'DeleteAutoScalingGroup',\n 'AutoScalingGroupName' => auto_scaling_group_name,\n :parser => Fog::Parsers::AWS::AutoScaling::Basic.new\n })\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /course_proposal_questions GET /course_proposal_questions.json | def index
@course_proposal_questions = CourseProposalQuestion.all
end | [
"def questions\n self.class.get('/2.2/questions', @options)\n end",
"def index\n authorize CourseProposal\n @course_proposals = CourseProposal.all\n end",
"def manage_questions\n @course = Course.find(params[:course_id])\n @questions = @course.questions.order(\"id\")\n end",
"def questions\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /course_proposal_questions POST /course_proposal_questions.json | def create
@course_proposal_question = CourseProposalQuestion.new(course_proposal_question_params)
respond_to do |format|
if @course_proposal_question.save
format.html { redirect_to @course_proposal_question, notice: 'Course proposal question was successfully created.' }
format.json { ren... | [
"def index\n @course_proposal_questions = CourseProposalQuestion.all\n end",
"def create\n @course = Course.find(params[:course_id])\n @question = @course.questions.build(params[:question])\n @question.save\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @cou... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /course_proposal_questions/1 PATCH/PUT /course_proposal_questions/1.json | def update
respond_to do |format|
if @course_proposal_question.update(course_proposal_question_params)
format.html { redirect_to @course_proposal_question, notice: 'Course proposal question was successfully updated.' }
format.json { render :show, status: :ok, location: @course_proposal_questio... | [
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /course_proposal_questions/1 DELETE /course_proposal_questions/1.json | def destroy
@course_proposal_question.destroy
respond_to do |format|
format.html { redirect_to course_proposal_questions_url, notice: 'Course proposal question was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @question_course = QuestionCourse.find(params[:id])\n @question_course.destroy\n\n respond_to do |format|\n format.html { redirect_to question_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @question = @exam.questions.find(params[:id])\n @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set a default Chef environment name for our chef_search calls. | def chef_env(env)
chef_scope :chef_environment, env
end | [
"def chef_environment_name(export)\n if chef_environment_parameter?\n name = export[:stack][:options][:parameters][options[:chef_environment_parameter]]\n end\n name || DEFAULT_CHEF_ENVIRONMENT\n end",
"def default_environment=(env); end",
"def set_default_env(name, value)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the first packet in +dump+ | def packet dump
Capp.offline(dump).loop.first
end | [
"def packet\n @packet ||= nil\n end",
"def first()\n return from(network().host_address.add(@ip_bits.host_ofs), @prefix)\n end",
"def first_hop()\n @hops.find { |hop| !hop.ip.nil? && hop.ip != \"0.0.0.0\" }\n end",
"def read_packet\n return @packets.pop unless @packets.empty?\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Reads /proc/mounts and finds all tmpfs. It returns a Hash But if the info isn't available or /proc/mounts is not readable, it will return an empty Hash. | def tmpfs
ret = {}
mounts.each { |x|
ret.merge!({x.split[1] => x}) if x.start_with?('tmpfs '.freeze)
}
ret
end | [
"def read_mounts\n begin\n mountfh = File.open(\"/proc/mounts\", NONBLOCK)\n mounts = mountfh.read\n mountfh.close\n rescue\n return nil\n end\n\n mntpoint = {}\n\n # Read all entries in /proc/mounts. The second column is the\n #... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:callseq: scale_bilinear(width, height) Scales the image using the bilinear interpolation method. Bilinear interpolation calculates the color values in the resulting image by looking at the four nearest pixels for each pixel in the resulting image. This gives a more accurate representation than nearestneighbor interpol... | def scale_bilinear(*args)
@source = BilinearScaler.new(@source, *args)
self
end | [
"def resample_bilinear!(new_width, new_height); end",
"def bilinear_gray(image, scale_x, scale_y)\n interpolated_img = Imgrb::Image.new((image.width*scale_x).round,\n (image.height*scale_y).round,\n [0]*image.channels)\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:callseq: scale_nearest(width, height) Scales the image using the nearestneighbor interpolation method. Nearestneighbor interpolation selects the value of the nearest pixel when calculating colors in the scaled image. == Example i = Axon::JPEG('test.jpg') i.scale_nearest(50, 75) i.width => 50 i.height => 75 | def scale_nearest(*args)
@source = NearestNeighborScaler.new(@source, *args)
self
end | [
"def resample_nearest_neighbor!(new_width, new_height); end",
"def resample_nearest_neighbor!(new_width, new_height)\n steps_x = steps(width, new_width)\n steps_y = steps(height, new_height)\n\n pixels = Array.new(new_width * new_height)\n i = 0\n for y in steps_y\n for... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:callseq: jpeg_file(path [, options]) Writes the image to a new file at +path+ as compressed JPEG data. Returns the number of bytes written. If the image has an alpha channel it will be stripped. See Axonjpeg for a description of +options+. == Example Axon.png_file("image.png") do |image| image.jpeg_file("image.jpg") s... | def jpeg_file(path, *args)
File.open(path, 'wb') do |f|
jpeg(f, *args)
end
end | [
"def convert_to_jpeg input_file, output_file\n begin\n puts \"Opening temp file '#{input_file.path}'...\"\n imagick = MiniMagick::Image.open input_file.path\n if imagick.type == \"JPEG\"\n puts \"Skipping JPEG recompression. Image ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
:callseq: png_file(path) Writes the image to a new file at +path+ as compressed PNG data. Returns the number of bytes written. == Example Axon.jpeg_file("image.jpg") do |image| image.png_file("image.png") saves the image to "image.jpeg" end | def png_file(path, *args)
File.open(path, 'wb') do |f|
png(f, *args)
end
end | [
"def jpeg_file(path, *args)\n File.open(path, 'wb') do |f|\n jpeg(f, *args)\n end\n end",
"def png(file)\n file.write PNG_HEADER\n\n # Make sure IEND is actually at the end (Ruby 1.9).\n iend = @chunks.delete 'IEND'\n @chunks['IEND'] = iend\n\n @chunks.each do |type, d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font name of cell | def change_font_name(new_font_name = 'Verdana')
validate_worksheet
font = get_cell_font.dup
font.set_name(new_font_name)
update_font_references(font)
end | [
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font size of cell | def change_font_size(font_size = 10)
validate_worksheet
raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
font = get_cell_font.dup
font.set_size(font_size)
update_font_references(font)
end | [
"def change_font_size(font_size=10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_column_font_size(col=0, font... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font color of cell | def change_font_color(font_color = '000000')
validate_worksheet
Color.validate_color(font_color)
font = get_cell_font.dup
font.set_rgb_color(font_color)
update_font_references(font)
end | [
"def text_color=(color)\n @subtable.cells.text_color = color\n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_co... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font italics settings of cell | def change_font_italics(italicized = false)
validate_worksheet
font = get_cell_font.dup
font.set_italic(italicized)
update_font_references(font)
end | [
"def change_font_italics(italicized=false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font bold settings of cell | def change_font_bold(bolded = false)
validate_worksheet
font = get_cell_font.dup
font.set_bold(bolded)
update_font_references(font)
end | [
"def change_font_bold(bolded=false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def enter_bold_mode\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes font underline settings of cell | def change_font_underline(underlined = false)
validate_worksheet
font = get_cell_font.dup
font.set_underline(underlined)
update_font_references(font)
end | [
"def change_font_underline(underlined=false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_row_underline(row=0, underlined=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Endpoint /images exists on both v1 and v2 API The attribute 'visibility' is used to detect if the call has been made on v1 or v2 In case of v2 we have all the needed information, but in case of v1 we don't and we have to call /images/detail to get full details | def get_all_images(env)
images_json = get(env, "#{@session.endpoints[:image]}/images")
images = JSON.parse(images_json)['images']
return images if images.empty?
is_v1 = false
unless images[0].key? 'visibility'
is_v1 = true
images_json = get(env, "#{@session.... | [
"def describe_images(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeImages'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a new method called encrypt_file | def encrypt_file(filename)
#open the file by passing it the name and ..
input = File.open(filename, 'r')
#this is a string now so
contents = input.read
encrypted_contents = encrypt_string(contents)
input.close
output = File.open(filename + '.encrypted', 'w')
output.write(encrypte... | [
"def encrypt(file_name, password); end",
"def encrypt_file(path, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n cipher = cipher(aes_key, iv)\n hmac = OpenSSL::HMAC.new(mac_key, OpenSSL::Digest::SHA256.new)\n new_path ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /idea_events/1 GET /idea_events/1.json | def show
@idea_event = IdeaEvent.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @idea_event }
end
end | [
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /idea_events/new GET /idea_events/new.json | def new
@idea_event = IdeaEvent.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @idea_event }
end
end | [
"def new\n @create_event = CreateEvent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_event }\n end\n end",
"def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /idea_events POST /idea_events.json | def create
@idea_event = IdeaEvent.new(params[:idea_event])
respond_to do |format|
if @idea_event.save
format.html { redirect_to @idea_event, notice: 'Idea event was successfully created.' }
format.json { render json: @idea_event, status: :created, location: @idea_event }
else
... | [
"def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event.to_json, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /idea_events/1 PUT /idea_events/1.json | def update
@idea_event = IdeaEvent.find(params[:id])
respond_to do |format|
if @idea_event.update_attributes(params[:idea_event])
format.html { redirect_to @idea_event, notice: 'Idea event was successfully updated.' }
format.json { head :ok }
else
format.html { render action... | [
"def update\n event = event.find(params[\"id\"]) \n event.update_attributes(event_params) \n respond_with event, json: event\n end",
"def update\n #TODO params -> strong_params\n if @event.update(params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /idea_events/1 DELETE /idea_events/1.json | def destroy
@idea_event = IdeaEvent.find(params[:id])
@idea_event.destroy
respond_to do |format|
format.html { redirect_to idea_events_url }
format.json { head :ok }
end
end | [
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @atfal_event = AtfalEvent.find(params[:id])\n @atfal_event.destroy\n\n respond_to do |format|\n format.html { redirect_to atfal_events_url }\n format.json { head... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Convert the freebase ID for a type into an API endpoint ID | def to_endpoint id
t=id.split('/')
domain = t[1..-2].join('_')
type = t[-1]
"freebase_tsv_#{domain}__#{type}"
end | [
"def type_id(type)\n type.to_name_s('_')\n end",
"def to_global_id(type_name, id)\n Base64.strict_encode64(\"#{type_name}-#{id}\")\n end",
"def base_type_id(node)\n fixed_type_id(node).split(/[^#A-Za-z0-9_-]/).last\n end",
"def freebase_id\n to_nil _response_entity.fetch(\"fre... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
downloads csv of all grant data to users computer | def get_grant_data
if GrantsData.exists?
@grant_data = GrantsData.all_csv
respond_to do |format|
format.html
format.csv do
send_data @grant_data, filename: "all_grants_data_#{Time.now.to_s(:db)}.csv"
end
end
else
flash[:notice] = 'Grant Data Table Empty'... | [
"def export_csv\n # Find all user with the stored restrictions\n users = EsUser.find :all, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"users_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" })... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
passes all Users research_individual page | def research_individual
@users = Array.new()
User.all.each do |u|
if !u.admin?
@users.push(u)
end
end
end | [
"def search_users\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '1'\n flash[:authority_error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n empty_user_id\n return\n end\n end\n empty_user_id\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
passes all Users grant_individual page | def grants_individual
@users = Array.new()
User.all.each do |u|
if !u.admin?
@users.push(u)
end
end
end | [
"def grant_all\n @_granted = all_permissions\n end",
"def grant_all!\n @all_permissions=true\n end",
"def grant\n @grant \n end",
"def index\n @manage_grants = Manage::Grant.all\n end",
"def grant\n @grant\n end",
"def admin_grant_permissions\n @user = User.includes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
checks wether a specific client exists | def exists?(username)
perform_request({:action => 'client-checkexists', :username => username})
statusmsg.match /client exists/i
end | [
"def exists?\n if Client.exists?(name: self.name)\n true\n else\n false\n end\n end",
"def has_client?\n @has_client ||= false\n end",
"def exists?(username)\n perform_request(action: 'client-checkexists', username: username)\n !!statusmsg.match(/Client exis... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the conversationId property value. Unique ID of the conversation. Readonly. | def conversation_id
return @conversation_id
end | [
"def conversation_id\n return @conversation_id\n end",
"def conversation_id=(value)\n @conversation_id = value\n end",
"def conversation_thread_id\n return @conversation_thread_id\n end",
"def conversation_id=(conversationId)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the conversationId property value. Unique ID of the conversation. Readonly. | def conversation_id=(value)
@conversation_id = value
end | [
"def conversation_id=(conversationId)\n @conversation_id = conversationId\n end",
"def conversation_thread_id=(value)\n @conversation_thread_id = value\n end",
"def conversation_id\n return @conversation_id\n end",
"def conversation_id\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the conversationThreadId property value. Unique ID of the conversation thread. Readonly. | def conversation_thread_id
return @conversation_thread_id
end | [
"def conversation_thread_id=(value)\n @conversation_thread_id = value\n end",
"def conversation_id\n return @conversation_id\n end",
"def conversation_id\n return @conversation_id\n end",
"def thread_id\n return @thread_id\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the conversationThreadId property value. Unique ID of the conversation thread. Readonly. | def conversation_thread_id=(value)
@conversation_thread_id = value
end | [
"def conversation_id=(value)\n @conversation_id = value\n end",
"def conversation_thread_id\n return @conversation_thread_id\n end",
"def thread_id=(value)\n @thread_id = value\n end",
"def conversation_id=(conversationId)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the from property value. The from property | def from=(value)
@from = value
end | [
"def from=(value)\n @from = value\n end",
"def from= (v)\n add_attribute('from', v.to_s)\n end",
"def set_FromPath(value)\n set_input(\"FromPath\", value)\n end",
"def set_FromPath(value)\n set_input(\"FromPath\", value)\n end",
"def from_term=(value)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the inReplyTo property value. Readonly. Supports $expand. | def in_reply_to
return @in_reply_to
end | [
"def in_reply_to\n envelope[:in_reply_to]\n end",
"def in_reply_to\n headers['In-Reply-To']\n end",
"def reply_to\n address_list_fetch('reply-to')\n end",
"def in_reply_to=(value)\n @in_reply_to = value\n end",
"def set_InReplyTo(value)\n set_input(\"In... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the inReplyTo property value. Readonly. Supports $expand. | def in_reply_to=(value)
@in_reply_to = value
end | [
"def set_InReplyTo(value)\n set_input(\"InReplyTo\", value)\n end",
"def in_reply_to=( *idstrs )\n set_string_array_attr 'In-Reply-To', idstrs\n end",
"def reply_to=(value)\n @reply_to = value\n end",
"def reply_to=(replyTo)\n @reply_to = replyTo\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the newParticipants property value. Conversation participants that were added to the thread as part of this post. | def new_participants
return @new_participants
end | [
"def new_participants=(value)\n @new_participants = value\n end",
"def participants_added # :nodoc:\n @properties[ADDED].map { |id| @context.users[id] }\n end",
"def getParticipants\r\n\t\t\t\t\treturn @participants\r\n\t\t\t\tend",
"def participants\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the newParticipants property value. Conversation participants that were added to the thread as part of this post. | def new_participants=(value)
@new_participants = value
end | [
"def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend",
"def participants=(value)\n @participants = value\n end",
"def participants=(value)\n @participants = value\n end",
"def new_participants\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the receivedDateTime property value. Specifies when the post was received. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def received_date_time
return @received_date_time
end | [
"def received_date_time\n return @received_date_time\n end",
"def message_received_date_time\n return @message_received_date_time\n end",
"def received_at\n request_datetime\n end",
"def received_at\n Time.parse(params['payment_date'])\n end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the receivedDateTime property value. Specifies when the post was received. The DateTimeOffset type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def received_date_time=(value)
@received_date_time = value
end | [
"def received_date_time=(receivedDateTime)\n @received_date_time = receivedDateTime\n end",
"def message_received_date_time=(value)\n @message_received_date_time = value\n end",
"def sent_date_time=(sentDateTime)\n @sent_date_time = sentDateTime\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Config pagination header manually | def set_pagination_header(name, options = {})
scope = instance_variable_get("@#{name}")
request_params = request.query_parameters
url_without_params = request.original_url.slice(0..(request.original_url.index("?")-1)) unless request_params.empty?
url_without_params ||= request.original_url
page = {... | [
"def set_pagination_header(resource,resource_name)\n #print current page\n headers[\"x-page\"] = page\n #print records per page\n headers[\"x-per-page\"] = per_page\n #print total records\n headers[\"x-total\"] = resource.total_count\n #print next page url\n headers[\"next_page\"] = eval \"a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /character/geo_positions/1 GET /character/geo_positions/1.json | def show
@character_geo_position = Character::GeoPosition.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @character_geo_position }
end
end | [
"def new\n @character_geo_position = Character::GeoPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @character_geo_position }\n end\n end",
"def index\n @fundamental_character_positions = Fundamental::CharacterPosition.all\n\n respond_to d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /character/geo_positions/new GET /character/geo_positions/new.json | def new
@character_geo_position = Character::GeoPosition.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @character_geo_position }
end
end | [
"def new\n @map_position = MapPosition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_position }\n end\n end",
"def create\n @character_geo_position = Character::GeoPosition.new(params[:character_geo_position])\n\n respond_to do |format|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /character/geo_positions POST /character/geo_positions.json | def create
@character_geo_position = Character::GeoPosition.new(params[:character_geo_position])
respond_to do |format|
if @character_geo_position.save
format.html { redirect_to @character_geo_position, notice: 'Geo position was successfully created.' }
format.json { render json: @charact... | [
"def create\n @fundamental_character_position = Fundamental::CharacterPosition.new(params[:fundamental_character_position])\n\n respond_to do |format|\n if @fundamental_character_position.save\n format.html { redirect_to @fundamental_character_position, notice: 'Character position was successfully... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /character/geo_positions/1 PUT /character/geo_positions/1.json | def update
@character_geo_position = Character::GeoPosition.find(params[:id])
respond_to do |format|
if @character_geo_position.update_attributes(params[:character_geo_position])
format.html { redirect_to @character_geo_position, notice: 'Geo position was successfully updated.' }
format.j... | [
"def update\n @fundamental_character_position = Fundamental::CharacterPosition.find(params[:id])\n\n respond_to do |format|\n if @fundamental_character_position.update_attributes(params[:fundamental_character_position])\n format.html { redirect_to @fundamental_character_position, notice: 'Characte... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /character/geo_positions/1 DELETE /character/geo_positions/1.json | def destroy
@character_geo_position = Character::GeoPosition.find(params[:id])
@character_geo_position.destroy
respond_to do |format|
format.html { redirect_to character_geo_positions_url }
format.json { head :ok }
end
end | [
"def destroy\n @geo = Geo.find(params[:id])\n @geo.destroy\n\n respond_to do |format|\n format.html { redirect_to geos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geolocation.destroy\n respond_to do |format|\n format.html { redirect_to geolocations_url ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
We are going to avoid indexing of README.md when there is also an index.md in the same directory, to keep behavior consistent with the display logic | def skip_index?(file)
if file.end_with? 'README.md'
dir = File.dirname file
File.exist? "#{dir}/index.md"
else
false
end
end | [
"def should_be_index?(readme); end",
"def should_be_index?(readme)\n return false unless readme\n\n !dir_has_index? File.dirname(readme.url)\n end",
"def readme\n \"#{app_path}/readme.md\"\n end",
"def show_readme\n readme \"README\"\n end",
"def help\n path = D... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of repository names which match `regexp` | def repository_names
list_repos
.select { |repo| repo["name"] =~ regexp }
.map { |repo| repo["name"] }
end | [
"def find_aliases(regexp)\n aliases = find(regexp,:object=>:alias,:find_mode=>:partial)\n return [] if aliases==[nil]\n aliases\n end",
"def get_all(regexp)\n Kitchen::Collection.new(__getobj__.select { |i| i.name =~ regexp })\n end",
"def project_names\n repositories.map { |s| s.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /resume_responses POST /resume_responses.json | def create
@resume_response = ResumeResponse.new(params[:resume_response])
@resume = Resume.find(params[:id])
@resume_response.resume = @resume
@resume_response.sender = @current_user
@resume_response.recipient = @resume.user
respond_to do |format|
if @resume_response.save
format.h... | [
"def create\n # puts \"params: #{params}\"\n @resume = Resume.new(resume_params)\n header_build(@resume)\n education_build(@resume)\n work_experience_build(@resume)\n skills_build(@resume)\n if @resume.save\n render json: @resume, status: :created, location: api_v1_resumes_url(@resume)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /resume_responses/1 PUT /resume_responses/1.json | def update
@resume_response = ResumeResponse.find(params[:id])
respond_to do |format|
if @resume_response.update_attributes(params[:resume_response])
format.html { redirect_to @resume_response, notice: 'Resume response was successfully updated.' }
format.json { head :no_content }
el... | [
"def update\n @resume = Resume.find(params[:id])\n\n if @resume.update(resume_params)\n head :no_content\n else\n render json: @resume.errors, status: :unprocessable_entity\n end\n end",
"def update\n user = demo? ? demo_user : current_user\n @resume = user.resumes.find(params[:id])\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /resume_responses/1 DELETE /resume_responses/1.json | def destroy
@resume_response = ResumeResponse.find(params[:id])
@resume_response.destroy
respond_to do |format|
format.html { redirect_to resume_responses_url }
format.json { head :no_content }
end
end | [
"def delete\n RestClient.delete \"#{@uri}/api/requests/request/#{@data['requestId']||@data['id']}\"\n puts ' Deleted request: '.red + \"#{@data['requestId']||@data['id']}\".light_blue\n end",
"def destroy\n @resume.destroy\n respond_to do |format|\n format.html { redirect_to resumes_url }\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the edge connecting the two specified nodes, if it exists Note that our edges are undirected, so the order of the parameters `one` and `two` is not meaningful. | def find_edge(one, two)
edges.find do |e|
(e.one == one && e.two == two) || (e.two == one && e.one == two)
end
end | [
"def find_edge(node_1, node_2)\n @edges[node_1][node_2] if @edges[node_1]\n end",
"def find_or_add_edge(one, two)\n edge = find_edge(one, two)\n if edge\n edge.weight += 1\n edge\n else\n edges << Edge.new(one: one, two: two, weight: 1)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the maximum edge weight in the graph | def max_edge_weight
edges.map(&:weight).max
end | [
"def maximum_weight\n max = 0\n self.configuration.shipping_costs.each do |sc|\n max = sc[:weight_max] if sc[:weight_max] > max\n end\n return max.to_f\n end",
"def weight_max\r\n 251\r\n end",
"def weighted_max_score\n max_score * weight\n end",
"def get_edge_weight(source, de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Add nodes and edges for a given gap This function adds nodes and edges to the graph for a given size of sliding window. | def add_nodes_for_gap(gap)
analyzer = Frequency.call(
dataset: dataset,
ngrams: gap,
num_blocks: 1,
split_across: true,
progress: ->(p) { progress&.call((p.to_f / 100 * 33).to_i + 33) }
)
ngrams = analyzer.blocks[0]
ngr... | [
"def add_nodes_for_gap(gap)\n words.each_cons(gap).each_with_index do |gap_words, i|\n # Get the stemmed words to go with the un-stemmed words\n gap_words_stem = words_stem[i, gap]\n\n # Update progress meter\n if progress\n val = (i.to_f / (words.si... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find an edge and increment its weight, or add it if needed | def find_or_add_edge(one, two)
edge = find_edge(one, two)
if edge
edge.weight += 1
edge
else
edges << Edge.new(one: one, two: two, weight: 1)
edges.last
end
end | [
"def increase_weight(node, dw)\n node = find(node)\n node.update_weight(node.weight + dw) unless node.nil?\n end",
"def weight_node(node, weight)\n @edges.each do |source, dests|\n dests.each do |dest, _|\n if dest == node\n @edges[source][dest] = weight\n end\n end\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of items which have a paid quantity greater than zero. That is, any items which have nonbonus components. | def candidate_items
sku_items.select {|i| i.paid_quantity > 0}
end | [
"def paid_quantity\n components.reject {|c| c.kind == 'bonus'}.map(&:quantity).sum\n end",
"def unpaid_items\n reis = registrant_expense_items.joins(:registrant).where(registrants: {deleted: false})\n reis.free.select{ |rei| !rei.registrant.reg_paid? } + reis.where(free: false)\n end",
"def total_ite... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.