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 |
|---|---|---|---|---|---|---|
Returns the content description for building a content. 1. It looks in the element's contents description 2. It builds a description hash from essence type, if the the name key is not present | def content_description(element, essence_hash)
essence_hash.stringify_keys!
# No name given. We build the content from essence type.
if essence_hash['name'].blank? && essence_hash['essence_type'].present?
content_description_from_essence_type(element, essence_hash['essence_type'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end",
"def description\n return {} if element.nil? or element.content_descriptions.nil?\n ... | [
"0.77958477",
"0.7436956",
"0.7392278",
"0.7310024",
"0.7229824",
"0.722587",
"0.7033766",
"0.70027167",
"0.6887653",
"0.6740992",
"0.6528336",
"0.651121",
"0.6500961",
"0.6474051",
"0.64018965",
"0.6367252",
"0.63440955",
"0.6260909",
"0.623556",
"0.6213252",
"0.6188391",
... | 0.8284185 | 0 |
Returns a hash for building a content from essence type. | def content_description_from_essence_type(element, essence_type)
{
'type' => essence_type,
'name' => content_name_from_element_and_essence_type(element, essence_type)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_definition_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end",
"def hash\n\t\t(language + type + klass + thing).hash\n\tend",
"def hash\n [ data, ty... | [
"0.74021894",
"0.6699435",
"0.65669703",
"0.6477308",
"0.6271651",
"0.62293464",
"0.6138441",
"0.61168486",
"0.6030077",
"0.6025322",
"0.60214335",
"0.6005596",
"0.58988315",
"0.58712846",
"0.58502895",
"0.58315",
"0.5828687",
"0.58101785",
"0.5809049",
"0.5785308",
"0.577888... | 0.7140074 | 1 |
A name for content from its essence type and amount of same essences in element. Example: essence_picture_1 | def content_name_from_element_and_essence_type(element, essence_type)
essences_of_same_type = element.contents.where(essence_type: normalize_essence_type(essence_type))
"#{essence_type.classify.demodulize.underscore}_#{essences_of_same_type.count + 1}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_description_from_essence_type(element, essence_type)\n {\n 'type' => essence_type,\n 'name' => content_name_from_element_and_essence_type(element, essence_type)\n }\n end",
"def content_definition_from_essence_type(element, essence_type)\n {\n 'typ... | [
"0.71933603",
"0.71113056",
"0.65124255",
"0.6335268",
"0.6307188",
"0.58309793",
"0.5773666",
"0.57632476",
"0.5745741",
"0.57351565",
"0.5715605",
"0.56285834",
"0.5442997",
"0.5436257",
"0.54141855",
"0.53965896",
"0.53815836",
"0.5379749",
"0.5360881",
"0.53572696",
"0.53... | 0.8285629 | 1 |
Returns the content description hash from element. It first uses the normal content description described in the +elements.yml+ +contents+ array. If the content description could not be found it tries to load it from +available_contents+ array. | def content_description_from_element(element, name)
element.content_description_for(name) ||
element.available_content_description_for(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n return {} if element.nil? or element.content_descriptions.nil?\n element.content_descriptions.detect { |c| c['name'] == self.content.name } || {}\n end",
"def content_description_for(content_name)\n if content_descriptions.blank?\n log_warning \"Element #{self.nam... | [
"0.6210891",
"0.6051284",
"0.6032567",
"0.5991266",
"0.59829277",
"0.59794676",
"0.59772605",
"0.59560263",
"0.5893565",
"0.5891129",
"0.58809966",
"0.58598936",
"0.5721566",
"0.5669537",
"0.56397694",
"0.5636007",
"0.56188446",
"0.56168675",
"0.55757695",
"0.55506754",
"0.55... | 0.62684584 | 0 |
Returns all content descriptions from elements.yml | def descriptions
Element.descriptions.collect { |e| e['contents'] }.flatten.compact
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_descriptions\n return nil if description.blank?\n description['contents']\n end",
"def content_descriptions\n return nil if definition.blank?\n definition['contents']\n end",
"def descriptions\n if ::File.exists? \"#{::Rails.root}/config/alchemy/elements.yml\"\n ... | [
"0.75444865",
"0.73952186",
"0.72706515",
"0.725854",
"0.70734763",
"0.70090723",
"0.6845667",
"0.6794899",
"0.6790442",
"0.6719457",
"0.6667728",
"0.65636176",
"0.6535613",
"0.6531282",
"0.6495377",
"0.6491458",
"0.6485071",
"0.64366806",
"0.6391138",
"0.63480014",
"0.629059... | 0.7668952 | 1 |
Returns a normalized Essence type Adds Alchemy module name in front of given essence type unless there is a Class with the specified name that is an essence. | def normalize_essence_type(essence_type)
essence_type = essence_type.classify
return essence_type if is_an_essence?(essence_type)
"Alchemy::#{essence_type}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def essence_class\n (essence_type || Content.normalize_essence_type(definition[\"type\"])).constantize\n end",
"def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end",
"def essence_class(type = nil)\n Content.normalize_essence_type(typ... | [
"0.6928682",
"0.68985933",
"0.6833396",
"0.6497258",
"0.59919596",
"0.58787775",
"0.58787775",
"0.58698183",
"0.5750265",
"0.57347554",
"0.5694976",
"0.5640596",
"0.560522",
"0.55942565",
"0.55565727",
"0.55561715",
"0.5529584",
"0.5446075",
"0.5416031",
"0.5383443",
"0.53651... | 0.7825047 | 2 |
end class methods Instance Methods Returns the description hash from +elements.yml+ file. | def description
if element.blank?
log_warning "Content with id #{self.id} is missing its Element."
return {}
end
Content.content_description_from_element(element, name) || {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end... | [
"0.8090134",
"0.7178595",
"0.7133156",
"0.7133156",
"0.67329913",
"0.67216116",
"0.6669087",
"0.64167565",
"0.6411929",
"0.63861424",
"0.63471437",
"0.63282114",
"0.6276081",
"0.6276081",
"0.62750065",
"0.6269788",
"0.6252658",
"0.6252658",
"0.62450475",
"0.62244564",
"0.6191... | 0.6459263 | 7 |
Creates essence from description. If an optional type is passed, this type of essence gets created. | def create_essence!(type = nil)
self.essence = essence_class(type).create!(prepared_attributes_for_essence)
self.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_essence!(description)\n essence_class = self.class.normalize_essence_type(description['type']).constantize\n attributes = {\n :ingredient => default_text(description['default'])\n }\n if description['type'] == \"EssenceRichtext\" || description['type'] == \"EssenceText\"\n ... | [
"0.78051805",
"0.7677013",
"0.7086594",
"0.6676211",
"0.6399988",
"0.6296492",
"0.6151227",
"0.6002307",
"0.5941078",
"0.573827",
"0.57081807",
"0.56647956",
"0.5470817",
"0.5406903",
"0.5346387",
"0.5346387",
"0.53385884",
"0.53089505",
"0.530048",
"0.52967817",
"0.5236582",... | 0.76771885 | 1 |
Returns a class constant from description's type field. If an optional type is passed, this type of essence gets constantized. | def essence_class(type = nil)
Content.normalize_essence_type(type || description['type']).constantize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def essence_class(type = nil)\n Content.normalize_essence_type(type || definition['type']).constantize\n end",
"def constantized_type\n @constantized_type ||= begin\n constantized = klass.get_discriminator_mapping(type) || constantize(type)\n\n # Check if the class is a Document ... | [
"0.6815076",
"0.6687589",
"0.64250803",
"0.6358563",
"0.633951",
"0.63331604",
"0.619358",
"0.6156101",
"0.6123586",
"0.6085561",
"0.60430837",
"0.60318226",
"0.60211843",
"0.5994334",
"0.59805554",
"0.59530014",
"0.59428644",
"0.59413135",
"0.5940107",
"0.5899553",
"0.585396... | 0.7083883 | 0 |
Prepares the attributes for creating the essence. 1. It sets a default text if given in +elements.yml+ | def prepared_attributes_for_essence
attributes = {
ingredient: default_text(description['default'])
}
attributes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepared_attributes_for_essence\n attributes = {\n ingredient: default_text(definition['default'])\n }\n attributes\n end",
"def pre_execute\n\n @node['atts'] = []\n end",
"def use_default_attributes\n self.name = \"element#{column}\"\n self.units = ''\n self.default_m... | [
"0.66988754",
"0.6012592",
"0.5932437",
"0.5904717",
"0.5839869",
"0.5829158",
"0.575019",
"0.5716449",
"0.5690441",
"0.5626508",
"0.5624486",
"0.5621992",
"0.5589652",
"0.5579654",
"0.5568456",
"0.55602074",
"0.55438054",
"0.5523974",
"0.55086535",
"0.5503863",
"0.54089737",... | 0.6771289 | 0 |
Default vaules for arguments | def default_args(a,b,c=1)
puts "\nValues of variables: ",a,b,c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default _args\n \"default _args;\" \n end",
"def default_args\n args.select &:default\n end",
"def defaultArguments (x = 22, y = x + 20, z = 50)\n puts \"x = \" + x.to_s\n puts \"y = \" + y.to_s\n puts \"z = \" + z.to_s\n end",
"def arguments=(_arg0); end",
"... | [
"0.78734386",
"0.7371773",
"0.7289391",
"0.7187405",
"0.7001331",
"0.69773114",
"0.69285154",
"0.69285154",
"0.69285154",
"0.68992424",
"0.6773884",
"0.67551154",
"0.67551154",
"0.67551154",
"0.67551154",
"0.67551154",
"0.67155325",
"0.670283",
"0.670283",
"0.670283",
"0.6702... | 0.7509507 | 1 |
Order of parameters and arguments | def mixed_args(a,b,*c,d)
puts "\nArguments:"
p a,b,c,d
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order=(_arg0); end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arg_order(*args)\n if args.size > 0\n begin\n args = args.uniq\n args.each do |x|\n __doodle__.handle_error :arg_order, ArgumentError, \"#{x} not a Symbol\", Doodle::Util... | [
"0.73288155",
"0.7008551",
"0.7008551",
"0.7008551",
"0.6931688",
"0.68859166",
"0.6869446",
"0.6869446",
"0.6698249",
"0.6657472",
"0.6657472",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66568214",
"0.66183573",
"0.66... | 0.6227152 | 67 |
TODO move logic to a background worker | def new_client
user_params = params[:user]
new_client = User.new
new_client.role = "client"
new_client.email = user_params[:email]
temp_password = Devise.friendly_token.first(8)
new_client.password = temp_password
new_client.password_confirmation = temp_password
#TODO Send mail to new re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run() end",
"def running; end",
"def running; end",
"def thread; end",
"def thread; end",
"def thread; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end... | [
"0.68930656",
"0.6844638",
"0.6844638",
"0.67075616",
"0.67075616",
"0.67075616",
"0.6621894",
"0.6621894",
"0.6621894",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.65741915",
"0.6554338",
"0.6546333",
"0.... | 0.0 | -1 |
GET /institutions GET /institutions.json | def check_privilege(institution)
unless current_user.institution == @institution
redirect_to welcome_index_path
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'applic... | [
"0.79272056",
"0.77259904",
"0.7252765",
"0.69552505",
"0.69063497",
"0.69063497",
"0.67578834",
"0.6611987",
"0.65452427",
"0.648086",
"0.6465456",
"0.6464098",
"0.64571357",
"0.6444813",
"0.63845617",
"0.6334052",
"0.6330156",
"0.62656885",
"0.62276524",
"0.6150121",
"0.611... | 0.0 | -1 |
GET /institutions GET /institutions.json | def search
@institutions = Institution.order(:nome).where("nome ilike ?", "%#{params[:term]}%")
render json: @institutions.map{|institution| {:label => institution.nome, :value => institution.id}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'applic... | [
"0.79272056",
"0.77259904",
"0.7252765",
"0.69552505",
"0.69063497",
"0.69063497",
"0.67578834",
"0.6611987",
"0.65452427",
"0.6465456",
"0.6464098",
"0.64571357",
"0.6444813",
"0.63845617",
"0.6334052",
"0.6330156",
"0.62656885",
"0.62276524",
"0.6150121",
"0.6114119",
"0.60... | 0.648086 | 9 |
GET /institutions/1 GET /institutions/1.json | def show
if current_user.type != 'Administrator'
check_privilege(@institution)
end
@campus = Campu.where(institution_id: @institution.id).find_each
@campu = Campu.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def institutions(pageIndex=0, options={})\n options.merge!({:query => {:pageIndex => pageIndex}})\n self.class.get(\"/Institutions.json\", options)\n end",
"def get_institutions\r\n # Prepare query url.\r\n _path_url = '/institutions'\r\n _query_builder = Configuration.get_base_uri\r\n ... | [
"0.73840606",
"0.7286049",
"0.71233416",
"0.71233416",
"0.6982147",
"0.691304",
"0.688314",
"0.6787256",
"0.67385817",
"0.6691514",
"0.6679087",
"0.6622589",
"0.64964294",
"0.64018685",
"0.63874114",
"0.63370776",
"0.62976146",
"0.6257077",
"0.62363815",
"0.6204932",
"0.62034... | 0.0 | -1 |
POST /institutions POST /institutions.json | def create
@institution = Institution.new(institution_params)
respond_to do |format|
if @institution.save
format.html { redirect_to @institution, notice: 'Instituição cadastrada com sucesso.' }
format.json { render :show, status: :created, location: @institution }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @institution = current_user.institutions.new(institution_params)\n\n if @institution.save\n render :show, status: :created\n else\n render json: @institution.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @one_reg_institution.institution_id ... | [
"0.7291733",
"0.67325234",
"0.67197955",
"0.67197955",
"0.6673974",
"0.65303195",
"0.64795274",
"0.6473473",
"0.625068",
"0.61106586",
"0.6094738",
"0.60886306",
"0.6083806",
"0.6068993",
"0.60682595",
"0.6013215",
"0.5988667",
"0.5986374",
"0.59598637",
"0.59416246",
"0.5934... | 0.6646293 | 5 |
PATCH/PUT /institutions/1 PATCH/PUT /institutions/1.json | def update
respond_to do |format|
if @institution.update(institution_params)
format.html { redirect_to @institution, notice: 'Instituição atualizada com sucesso.' }
format.json { render :show, status: :ok, location: @institution }
else
format.html { render :edit }
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to(@institution, :notice => 'Institution was successfully updated.') }\n format.xml { head :ok }\n format.json {re... | [
"0.6688653",
"0.657614",
"0.65370816",
"0.6461901",
"0.642117",
"0.635045",
"0.6344537",
"0.63197863",
"0.6258921",
"0.6217157",
"0.6182376",
"0.61377233",
"0.6133963",
"0.6121836",
"0.6116916",
"0.6112635",
"0.61020315",
"0.60730284",
"0.60678965",
"0.6061148",
"0.6057935",
... | 0.61573786 | 11 |
DELETE /institutions/1 DELETE /institutions/1.json | def destroy
@institution.destroy
respond_to do |format|
format.html { redirect_to institutions_url, notice: 'Institution deletada com sucesso.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @one_reg_institution = OneRegInstitution.find(params[:id])\n @one_reg_institution.destroy\n\n respond_to do |format|\n format.html { redirect_to one_reg_institutions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @institution = Institution.find(param... | [
"0.7285626",
"0.7173043",
"0.71103877",
"0.70918524",
"0.69288975",
"0.68833745",
"0.6876366",
"0.6865835",
"0.68426985",
"0.6822752",
"0.6816554",
"0.6763527",
"0.67336565",
"0.67256993",
"0.6721798",
"0.670704",
"0.6670279",
"0.6650756",
"0.6650578",
"0.6650107",
"0.6648286... | 0.69337094 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_institution
@institution = Institution.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def institution_params
params.require(:institution).permit(:nome, :cnpj, :logradouro, :numero, :bairro, :cep, :cidade, :estado, :tel, :organizacao_academica, :categoria_administrativa, :site, :avatar)
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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def payment_params
params.require(:payment).permit(:custid, :payment_amount)
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 |
initializes with a species | def initialize(species)
@species = species
#is initialized with a pets attribute as a hash with 3 keys
@pets = {:fishes => [], :dogs => [], :cats => []}
#keeps track of the owners that have been created
@@owners << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(species)\n @species = species\n @@all << self\n @pets = {fishes: [], dogs: [], cats: []}\n end",
"def initialize(species)\n @species = species\n @pets = {fishes: [], cats: [], dogs: []}\n @name = name\n @@all << self \n end",
"def initialize species, name=nil\n\n # go i... | [
"0.7714453",
"0.75028056",
"0.74939793",
"0.7416047",
"0.7341853",
"0.7268634",
"0.7268634",
"0.7055479",
"0.6833998",
"0.68307877",
"0.67734057",
"0.6773343",
"0.66505164",
"0.6649406",
"0.6560231",
"0.6521497",
"0.64565206",
"0.64520854",
"0.6433007",
"0.6411387",
"0.639033... | 0.7005821 | 8 |
can say its species | def say_species
"I am a #{species}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def species; end",
"def species\n @species\n end",
"def name\n self.species\n end",
"def species\n return \"human\"\n end",
"def species\n return text_get(1, id)\n end",
"def species\n # taxonomy sentence:\n # TODO: this assumes perfect coverage of A1 and A2 for all ... | [
"0.84190065",
"0.7744776",
"0.75514287",
"0.74733233",
"0.7355666",
"0.7302519",
"0.72231865",
"0.71760464",
"0.6984552",
"0.6973812",
"0.6934181",
"0.69275105",
"0.6919332",
"0.68672186",
"0.6851043",
"0.68190217",
"0.6774306",
"0.67444944",
"0.6736337",
"0.668365",
"0.66716... | 0.64362246 | 33 |
can buy a fish that is an instance of the Fish class | def buy_fish(name)
#knows about its fishes
pets[:fishes] << Fish.new(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_fish(name)\n new_fish = Fish.new(name)\n if new_fish.class == Fish\n @pets[:fishes] << new_fish\n end \n end",
"def buy_fish(name) # expect(owner.pets[:fishes].count).to eq(0)\n new_fish = Fish.new(name) # owner.buy_fish(\"Bubbles\")\n self.pets[:fishes] << new_fish # owner.pets[:f... | [
"0.7967161",
"0.78944397",
"0.77852994",
"0.75455475",
"0.75455475",
"0.7482519",
"0.7419028",
"0.7349827",
"0.70923173",
"0.649563",
"0.62074906",
"0.613948",
"0.61235803",
"0.6082435",
"0.60732806",
"0.60732806",
"0.60732806",
"0.60732806",
"0.60732806",
"0.60732806",
"0.60... | 0.7594734 | 3 |
can buy a cat that is an instance of the Cat class | def buy_cat(name)
#knows about its cats
pets[:cats] << Cat.new(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_cat(name)\n Cat.new(name, self)\nend",
"def buy_cat(name)\n Cat.new(name,self)\n end",
"def buy_cat(name)\n new_cat = Cat.new(name, self)\nend",
"def buy_cat(cat)\n new_cat = Cat.all.find do |cat_instance|\n cat_instance.name == cat \n end\n if new_cat \n Cat.new(new_cat.name,... | [
"0.8031626",
"0.80213755",
"0.7957559",
"0.7927969",
"0.78073686",
"0.78073686",
"0.78073686",
"0.78073686",
"0.77966946",
"0.76843864",
"0.767793",
"0.7645743",
"0.7633575",
"0.75818765",
"0.7540874",
"0.7491801",
"0.73057586",
"0.6704045",
"0.6449017",
"0.63298976",
"0.6223... | 0.74742305 | 16 |
can buy a dog that is an instance of the Dog class | def buy_dog(name)
#know sabout its dogs
pets[:dogs] << Dog.new(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def buy_dog(name)\n Dog.new(name,self)\n end",
"def buy_dog(name)\n new_dog = Dog.new(name,self)\n end",
"def buy_dog(name)\n Dog.new(name, self)\n end",
"def buy_dog(name)\n Dog.new(name, self)\n end",
"def buy_dog(name)\n dog = Dog.new(name, self)\n end",
"def buy_dog(dog_name)\n ... | [
"0.8285269",
"0.81746185",
"0.8170991",
"0.8170991",
"0.8115555",
"0.8005482",
"0.7780977",
"0.7758128",
"0.7733242",
"0.75769824",
"0.75739086",
"0.74389356",
"0.7396316",
"0.7341653",
"0.64403903",
"0.63818246",
"0.6367875",
"0.6319512",
"0.6287678",
"0.62735015",
"0.625314... | 0.7331838 | 14 |
plays with the cats | def play_with_cats
#makes each of the cat's moods happy when played with
pets[:cats].each do |cat|
cat.mood = "happy"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\r\n\t\t[FOLD]\r\n\tend",
"def play\n beats = list.to_string\n `say -r #{rate} -v #{voice} #{beats}`\n end",
"def play\r\n while !over?\r\n turn\r\n end\r\n if won?\r\n puts \"Congratulations #{winner}!\"\r\n elsif draw?\r\n puts \"Cats Game!\"\r\n e... | [
"0.6562972",
"0.6517804",
"0.6494751",
"0.6459916",
"0.645332",
"0.64387316",
"0.6408507",
"0.6405676",
"0.6341371",
"0.63349265",
"0.63340354",
"0.6321883",
"0.6296843",
"0.627868",
"0.6232409",
"0.6215172",
"0.6202884",
"0.6199298",
"0.6199298",
"0.6199298",
"0.6199298",
... | 0.60856956 | 32 |
can sell all its pets | def sell_pets
#this makes them all nervous
pets.each do |species, animals|
animals.each do |animal|
animal.mood = "nervous"
end
animals.clear
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_sell?\n inventory.any? { |inv| inv.price > 0 }\n end",
"def sell_pets\n pets.each {|kind, moods|\n moods.each {|pets| pets.mood=(\"nervous\")}\n moods.clear\n }\n end",
"def sell\n \t\t\n \tend",
"def sell_pets\n all_owner_pets = self.dogs + self.cats\n \n all_ow... | [
"0.6725362",
"0.65979195",
"0.6569477",
"0.6442688",
"0.6432307",
"0.6421552",
"0.6413916",
"0.6410542",
"0.6361342",
"0.6285658",
"0.6207327",
"0.61855274",
"0.6183451",
"0.61679745",
"0.61597633",
"0.61535054",
"0.6153486",
"0.6132886",
"0.61115587",
"0.6104465",
"0.6102162... | 0.557549 | 81 |
can list off its pets | def list_pets
"I have #{pets[:fishes].count} fish, #{pets[:dogs].count} dog(s), and #{pets[:cats].count} cat(s)."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pets\n\t\t@pets_list\n\tend",
"def pets\n @pets\n end",
"def index\n @shelter = Shelter.first\n @pets = Pet.get_available_pets.order(:pet_type)\n if (!@cart)\n set_cart\n end\n @selectedPets = @cart.selected_pets\n end",
"def pets #stores all of the owners pets\n @pets #ex... | [
"0.7696536",
"0.7180371",
"0.6440963",
"0.64260787",
"0.6226749",
"0.6151779",
"0.61307096",
"0.61043394",
"0.60310346",
"0.60158753",
"0.59042734",
"0.59042734",
"0.5897309",
"0.5894113",
"0.5891176",
"0.58812946",
"0.58645076",
"0.58613664",
"0.58613664",
"0.5797106",
"0.57... | 0.6023061 | 10 |
+xml_file+ : full path to taxonomy.xml | def initialize(xml_file)
doc_taxonomies = LonelyPlanet::Doc.load xml_file
taxonomies_fragement = doc_taxonomies.css 'taxonomy > node'
@continents = []
set_continents(taxonomies_fragement)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_taxonomy\n\n parser = XML::Parser.file(@taxonomy_file_full_path, :encoding => XML::Encoding::UTF_8)\n taxonomy_document = parser.parse\n\n # root node\n root_node = taxonomy_document.find_first('//taxonomy_name')\n @taxonomy.add_node('0', root_node.content, nil)\n @logger.debug \"Root:... | [
"0.7329939",
"0.7010682",
"0.6454225",
"0.63374114",
"0.62953806",
"0.6126629",
"0.5947982",
"0.58975494",
"0.583087",
"0.5774107",
"0.5698248",
"0.55799836",
"0.554681",
"0.5523157",
"0.54865974",
"0.54788697",
"0.5470004",
"0.54077315",
"0.5382756",
"0.5376184",
"0.5344505"... | 0.6785587 | 2 |
set up all the continents trees from the top(continent) level of nodes +taxonomies_fragement+ : the taxonomies fragement doc | def set_continents(taxonomies_fragement)
taxonomies_fragement.each { |taxonomy|
continent = build_tree(taxonomy)
@continents << continent
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_taxonomies\n @document.xpath('.//taxonomy').each do |taxonomy_node|\n taxonomy_name = taxonomy_node.at_xpath('.//taxonomy_name')\n tax_node = insert_node(SecureRandom.uuid, taxonomy_name.content, @root_node)\n @taxonomies << tax_node\n add_node(taxonomy_node, tax_node, ski... | [
"0.6192606",
"0.6052458",
"0.5556622",
"0.5433875",
"0.5337591",
"0.52480006",
"0.51918113",
"0.5172413",
"0.51446563",
"0.508069",
"0.50770134",
"0.5075848",
"0.5064033",
"0.50601155",
"0.5044692",
"0.50421494",
"0.50010604",
"0.5000898",
"0.49971154",
"0.49739376",
"0.49156... | 0.8426066 | 0 |
build tree from +nodes_fragement+ doc | def build_tree(nodes_fragement)
nodes_element = LonelyPlanet::Node.new nodes_fragement
node = LonelyPlanet::TreeNode.new(nodes_element.name, nodes_element.id)
if nodes_element.has_child?
nodes_element.children.all? { |child_frag|
node << build_tree(child_frag)
}
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate(array)\n @root = Node.new({type: :document}, [], nil, 0)\n @total_nodes += 1\n @max_depth = 0\n current_node = @root\n current_depth = 0\n array.each do |hash|\n # opening tag - create new node\n if NODE_DOWN.include? hash[:type]\n #if <> depth += 1\n new_node... | [
"0.6759299",
"0.61817175",
"0.6109053",
"0.6109053",
"0.6109053",
"0.6047327",
"0.5995407",
"0.59610176",
"0.58842117",
"0.58841145",
"0.5881897",
"0.5864456",
"0.5863683",
"0.5860872",
"0.58446574",
"0.58124137",
"0.57991546",
"0.57841784",
"0.5776693",
"0.5776693",
"0.57558... | 0.72364736 | 0 |
< gives access to all columns of Business define the attribute accessor method | def eventable_attr_accessor(*attribute_array)
attribute_array.each do |att|
define_method(att) do
event.send(att)
end
define_method("#{att}=") do |val|
event.send("#{att}=",val)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_columns\n @attr_columns\n end",
"def attribute_values\n # call Array#map on SQLObject::columns, call send on the instance to \n # get the value\n self.class.columns.map { |attribute| self.send(attribute) }\n end",
"def define_accessors\n columns.each do |column|\n ... | [
"0.73409235",
"0.7117606",
"0.7098941",
"0.6887798",
"0.68810153",
"0.68259585",
"0.6808558",
"0.6766901",
"0.6765925",
"0.6759795",
"0.6680784",
"0.667382",
"0.662865",
"0.662865",
"0.662865",
"0.662865",
"0.662865",
"0.662865",
"0.662865",
"0.6557244",
"0.6557244",
"0.654... | 0.0 | -1 |
when create new dose we put in parameters (description, ingredient_id and ingredient) no cocktail_id as that's coming from the backend and user doesn't provide input | def dose_params
params.require(:dose).permit(:description, :ingredient_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dose_params\n params.require(:dose).permit(:description, :ingredient_id, :cocktail_id)\n end",
"def dose_params\n params.require(:dose).permit(:description, :cocktail_id, :ingredient_id)\n end",
"def cocktail_params\n # params.require(:cocktail).permit(:name)\n params.require(:cocktail)... | [
"0.7574941",
"0.73232037",
"0.7245146",
"0.7237917",
"0.7225594",
"0.697426",
"0.68656313",
"0.6838586",
"0.6781766",
"0.6727858",
"0.6709891",
"0.670512",
"0.6620719",
"0.6545459",
"0.65405416",
"0.65087956",
"0.6503689",
"0.64813715",
"0.64708596",
"0.64682966",
"0.64666355... | 0.72071385 | 6 |
PUT /containers/1 PUT /containers/1.json | def update
@container = Container.find(params[:id])
respond_to do |format|
if @container.update_attributes(params[:container])
format.html { redirect_to @container, notice: 'Container was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @container.update(container_params)\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { render :show, status: :ok, location: @container }\n else\n format.html { render :edit }\n for... | [
"0.66836345",
"0.65470034",
"0.64823234",
"0.6460558",
"0.6404556",
"0.6371154",
"0.63334733",
"0.61593586",
"0.59945625",
"0.59945625",
"0.5972793",
"0.5943352",
"0.59177345",
"0.5867174",
"0.58667505",
"0.5823491",
"0.58164847",
"0.5776682",
"0.5775518",
"0.5684361",
"0.568... | 0.68049645 | 0 |
DELETE /containers/1 DELETE /containers/1.json | def destroy
@container = Container.find(params[:id])
@container.destroy
respond_to do |format|
format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containervie... | [
"0.77225286",
"0.7483382",
"0.733286",
"0.72302747",
"0.71350247",
"0.7011121",
"0.6998195",
"0.68595165",
"0.68256927",
"0.68032837",
"0.67667943",
"0.6749357",
"0.66991055",
"0.6698833",
"0.6677833",
"0.6663417",
"0.66421056",
"0.66407144",
"0.65907025",
"0.6587319",
"0.653... | 0.7655 | 1 |
checks players decks to determine type of round being played if any deck is < 3, game is killed and that player loses. | def type
if (@player1.deck.cards.count < 3 || @player2.deck.cards.count < 3)
if @player1.deck.cards.count < 3
@player1.has_lost?(true)
else
@player2.has_lost?(true)
end
else
if @player1.deck.cards[0].rank != @player2.deck.cards[0].rank
:basic
elsif
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_round()\n d = value(@dealer)\n puts \"--- Check Round --- \"\n puts \"Dealers' cards are #{@dealer.join(',')} for a value #{d}\"\n\n # Iterate over all players who are still in the game,\n # as in they haven't lost in the initial round doing 'hits'\n #\n # Precondition: forall p in p... | [
"0.6359215",
"0.62601",
"0.6201466",
"0.61949444",
"0.61614084",
"0.61271816",
"0.61099106",
"0.6093914",
"0.6077148",
"0.60691386",
"0.6024081",
"0.601893",
"0.59970665",
"0.59806776",
"0.59377235",
"0.5935702",
"0.59234667",
"0.5918509",
"0.59153736",
"0.59054524",
"0.59051... | 0.6743641 | 0 |
identifies winner based on type of round | def winner(returned_type)
if returned_type == :basic
if @player1.deck.cards[0].rank > @player2.deck.cards[0].rank
@player1
else
@player2
end
elsif returned_type == :war
if @player1.deck.cards[2].rank > @player2.deck.cards[2].rank
@player1
else
@playe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n win_hash = { basic: basic_winner,\n war: war_winner,\n mutually_assured_destruction: \"No Winner\"\n }\n win_hash[type]\n end",
"def winner\n if type == :basic\n basic_winner\n elsif type == :war\n war_winner\n elsif type =... | [
"0.7793069",
"0.77480507",
"0.7488251",
"0.744985",
"0.7447646",
"0.7440452",
"0.7262125",
"0.72125286",
"0.718163",
"0.7165421",
"0.7119723",
"0.7117874",
"0.71061313",
"0.7105146",
"0.709743",
"0.70863456",
"0.7062522",
"0.7038047",
"0.7022531",
"0.702059",
"0.7018634",
"... | 0.7344108 | 6 |
removes staked cards from player deck sends staked cards to spoils_of_war | def pile_cards
if type == :basic
@spoils_of_war << @player1.deck.cards[0]
@spoils_of_war << @player2.deck.cards[0]
@player1.deck.cards.shift
@player2.deck.cards.shift
elsif type == :war
@spoils_of_war << @player1.deck.cards[0]
@spoils_of_war << @player1.deck.cards[1]
@s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end",
"def reset_di... | [
"0.74004495",
"0.73050904",
"0.7286182",
"0.7221042",
"0.7168238",
"0.707717",
"0.7063359",
"0.70390224",
"0.6973399",
"0.69510406",
"0.6898719",
"0.68520296",
"0.6847112",
"0.6835678",
"0.68330723",
"0.68236184",
"0.6817077",
"0.68075806",
"0.6785336",
"0.6770736",
"0.676251... | 0.6223062 | 78 |
sends spoils_of_war to winners deck clears spoils_of_war for next turn | def award_spoils(winner)
if winner == @player1
@spoils_of_war.each do |card|
@player1.deck.add_card(card)
end
elsif winner == @player2
@spoils_of_war.each do |card|
@player2.deck.add_card(card)
end
else
p "NO WINNER. ALL SPOILS."
end
@spoils_of_war = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def award_spoils(winner)\n while !@spoils_of_war.empty?\n card = @spoils_of_war.pop\n winner.deck.add_card(card)\n end\n end",
"def award_spoils\n if @turn_winner\n @turn_winner.deck.cards << @spoils_of_war.shuffle \n @turn_winner.deck.cards = @turn_winner.deck.cards.flatten\n en... | [
"0.7989136",
"0.79856783",
"0.76493084",
"0.6606085",
"0.6522562",
"0.6490399",
"0.6322059",
"0.63137263",
"0.629386",
"0.62434965",
"0.62399834",
"0.6235189",
"0.62285966",
"0.6209173",
"0.6191874",
"0.6185417",
"0.6176588",
"0.61627334",
"0.615147",
"0.61152387",
"0.6110302... | 0.7811694 | 2 |
GET /foodvendors/1 GET /foodvendors/1.xml | def show
@foodvendor = Foodvendor.includes(:nutritionals).find(params[:id])
respond_to do |format|
format.html
format.xml { render :xml => @foodvendor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml {... | [
"0.65514237",
"0.65514237",
"0.65514237",
"0.6262186",
"0.6147516",
"0.60391116",
"0.59719956",
"0.5912476",
"0.5868273",
"0.5859781",
"0.58541846",
"0.58537924",
"0.58441746",
"0.58174586",
"0.5809936",
"0.58011174",
"0.5797672",
"0.5784592",
"0.57832646",
"0.57800424",
"0.5... | 0.624399 | 4 |
GET /foodvendors/new GET /foodvendors/new.xml | def new
@foodvendor = Foodvendor.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @foodvendor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n end\n end",
"def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vendor }\n e... | [
"0.7166079",
"0.7166079",
"0.71598727",
"0.69522274",
"0.69026744",
"0.6828908",
"0.6820713",
"0.66991085",
"0.66991085",
"0.66991085",
"0.66702574",
"0.6605199",
"0.66041684",
"0.66003835",
"0.6586549",
"0.65826076",
"0.657608",
"0.6572374",
"0.65672255",
"0.6566757",
"0.654... | 0.74291027 | 0 |
POST /foodvendors POST /foodvendors.xml | def create
@foodvendor = Foodvendor.new(foodvendor_params)
respond_to do |format|
if @foodvendor.save
flash[:notice] = 'Foodvendor was successfully created.'
format.html { redirect_to(@foodvendor) }
format.xml { render :xml => @foodvendor, :status => :created, :location => @foodv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vendor = Vendor.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully created.') }\n format.xml { render :xml => @vendor, :status => :created, :location => @vendor }\n else\n for... | [
"0.58914214",
"0.58914214",
"0.57690305",
"0.57387394",
"0.57287925",
"0.5709256",
"0.56650716",
"0.5649667",
"0.56273067",
"0.5591811",
"0.5558824",
"0.5555467",
"0.5544654",
"0.542685",
"0.5385678",
"0.5345973",
"0.5342413",
"0.5330707",
"0.5323066",
"0.52958447",
"0.527125... | 0.6501686 | 0 |
PUT /foodvendors/1 PUT /foodvendors/1.xml | def update
@foodvendor = Foodvendor.find(params[:id])
respond_to do |format|
if @foodvendor.update(foodvendor_params)
flash[:notice] = 'Foodvendor was successfully updated.'
format.html { redirect_to(@foodvendor) }
format.xml { head :ok }
else
format.html { render :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</... | [
"0.6276035",
"0.6030101",
"0.5951974",
"0.5951974",
"0.5881572",
"0.5718258",
"0.5716824",
"0.5696827",
"0.5661306",
"0.5661306",
"0.56028277",
"0.5549509",
"0.5526597",
"0.55257094",
"0.5505324",
"0.5505324",
"0.5465129",
"0.5440048",
"0.5428179",
"0.5428179",
"0.54099256",
... | 0.6437302 | 0 |
allow users to update their accounts without passwords | def update_without_current_password(params, *options)
params.delete(:current_password)
if params[:password].blank? && params[:password_confirmation].blank?
params.delete(:password)
params.delete(:password_confirmation)
end
result = update_attributes(params, *options)
clean_up_passwords
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_without_password(params, *options); end",
"def update_with_password(params, *options); end",
"def update_resource(resource, params)\n if params[\"password\"]&.present? or params[\"email\"]&.present?\n return super\n else\n resource.update_without_password(params.except(\"current_pass... | [
"0.77665645",
"0.7309094",
"0.71718764",
"0.7104889",
"0.70890087",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.70554173",
"0.7014014",
"0.7005517",
"0.700447",
"0.7002106",
"0.69960284",
"0.... | 0.64902127 | 79 |
Returns the language as reported by the HTTP client. | def language
if !block_given?
return @j_del.java_method(:language, []).call()
end
raise ArgumentError, "Invalid arguments when calling language()"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def language\n @grpc.language\n end",
"def get_lang_from_headers\n\t\t\t@env['HTTP_ACCEPT_LANGUAGE'].to_s[0, 2]\n\t\tend",
"def language\n return @language\n end",
"def language\n fetch('nation.language')\n end",
"def language\n @language ||= Lan... | [
"0.79275894",
"0.78630966",
"0.774996",
"0.763481",
"0.75697213",
"0.74921197",
"0.7480894",
"0.7476675",
"0.74477047",
"0.73808897",
"0.7352768",
"0.7340096",
"0.72298646",
"0.72244525",
"0.72244525",
"0.72244525",
"0.72244525",
"0.721546",
"0.71767336",
"0.71767336",
"0.717... | 0.6809053 | 53 |
Returns the country as reported by the HTTP client. | def country
if !block_given?
return @j_del.java_method(:country, []).call()
end
raise ArgumentError, "Invalid arguments when calling country()"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country\n ISO3166::Country[@country_code]\n end",
"def country\n data['country']\n end",
"def country\n RAILS_DEFAULT_LOGGER.debug(\"profile.country -- returning #{setting(:company_country)}\")\n \n setting(:company_country).to_s\n end",
"def country\n 'United Kingdom'\n ... | [
"0.79101694",
"0.7850603",
"0.7815305",
"0.77775955",
"0.7724138",
"0.7642468",
"0.7615027",
"0.7606179",
"0.7601508",
"0.75596166",
"0.7522739",
"0.7517659",
"0.7453556",
"0.7448401",
"0.7440457",
"0.74026144",
"0.73998547",
"0.7368711",
"0.7275662",
"0.7275027",
"0.7223354"... | 0.71875936 | 23 |
Returns the variant as reported by the HTTP client. | def variant
if !block_given?
return @j_del.java_method(:variant, []).call()
end
raise ArgumentError, "Invalid arguments when calling variant()"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variant\n self.class.variant\n end",
"def variant\r\n return nil if variants?\r\n variants.first\r\n end",
"def variant; end",
"def variant; end",
"def variant\n return nil if variants?\n variants.first\n end",
"def result_variant\n custom_result_variant? ? custom_result_... | [
"0.7293755",
"0.6976324",
"0.6937698",
"0.6937698",
"0.69355714",
"0.62715393",
"0.5941457",
"0.58998424",
"0.58715093",
"0.58378416",
"0.5807799",
"0.5795691",
"0.57241064",
"0.57078874",
"0.57078874",
"0.56420225",
"0.5597744",
"0.5595913",
"0.5570064",
"0.5568805",
"0.5555... | 0.59694105 | 6 |
In the previous exercise, we developed a recursive solution to calculating the nth Fibonacci number. In a language that is not optimized for recursion, some (not all) recursive methods can be extremely slow and require massive quantities of memory and/or stack space. Ruby does a reasonably good job of handling recursio... | def fibonacci(n, num1=1, num2=1)
return 1 if n <= 2
(n - 2).times do
num1, num2 = num2, num1 + num2
end
num2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nthFibonacci(n)\r\n if n == 1\r\n return 1\r\n\r\n elsif n == 2\r\n return 1\r\n\r\n else n > 2\r\n n = nthFibonacci(n-1) + nthFibonacci(n-2)\r\n end\r\nend",
"def fib(n)\n if n == 0 || n == 1\n return n\n else\n fib(n-1) + fib(n-2)\n end\nend",
"def fib(n)\n return 0... | [
"0.85162926",
"0.84584576",
"0.8449039",
"0.84365934",
"0.8417097",
"0.8397812",
"0.8395192",
"0.8393697",
"0.8388913",
"0.838095",
"0.8380568",
"0.8376776",
"0.8376623",
"0.83753824",
"0.83729166",
"0.8372365",
"0.83718103",
"0.83632404",
"0.8362587",
"0.8360072",
"0.8360072... | 0.0 | -1 |
times complexity: O(n!). Increasing one letter would increase the number of combinations by a factor if the total number of letters in string | def second_anagram?(str1, str2)
return false unless str1.length == str2.length
str2_arr = str2.chars
str1_copy = str1.dup.chars
str1.chars.each_with_index do |letter, idx|
return false unless str2_arr.include?(letter)
str2_arr.delete_at(str2_arr.index(letter)) if str2_arr.include?(letter)
end
true
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rampant_repeats(string, hash)\n new_str = \"\"\n string.each_char do |char| \n if hash[char]\n hash[char].times { new_str += char }\n else\n new_str += char\n end\n end\n new_str\nend",
"def lexical_combinations(strings)\n l = []\n if strings.length ==... | [
"0.7041091",
"0.69983584",
"0.6995064",
"0.69941944",
"0.6987236",
"0.69822466",
"0.6966957",
"0.6936604",
"0.6925985",
"0.6900158",
"0.6896553",
"0.6879707",
"0.6862617",
"0.68618906",
"0.68446636",
"0.6809561",
"0.67533654",
"0.6738742",
"0.67109346",
"0.66958284",
"0.66742... | 0.0 | -1 |
time complexity: O(n^2) Assuming that Arrayindex is O(n) since it iterates through the array of n elements to find the index value | def third_anagram?(str1, str2)
str1.chars.sort == str2.chars.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def find_element_index(array, value_to_find)\n array.length.times do |index|... | [
"0.76936775",
"0.76405734",
"0.7598911",
"0.7491657",
"0.7457418",
"0.73879373",
"0.73876333",
"0.73775446",
"0.73423237",
"0.7314086",
"0.72672254",
"0.72628343",
"0.72334456",
"0.7212229",
"0.71682715",
"0.71651036",
"0.7160097",
"0.7143638",
"0.71259207",
"0.70957476",
"0.... | 0.0 | -1 |
time complexity: O(n^2) or O(nlogn) for average/best case if ruby uses quicksort since avearage and best case are a lot better than second method, third is slightly better | def fourth_anagram?(str1, str2)
hash_1 = Hash.new(0)
hash_2 = Hash.new(0)
str1.chars.each do |letter|
hash_1[letter] += 1
end
str2.chars.each do |letter|
hash_2[letter] += 1
end
hash_1 == hash_2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_quick_sort(arr)\r\n if arr.length < 2\r\n return arr #Base case: arrays with 0 or 1 element are already “sorted.”\r\n else\r\n pivot = arr[0] #Recursive case\r\n less = arr[(1...arr.length)].select{|x| x <= pivot} #Sub-array of all the elements less than the pivot\r\n greater = arr[(... | [
"0.684919",
"0.6805209",
"0.67857414",
"0.6746708",
"0.67374927",
"0.6715681",
"0.6706067",
"0.67055213",
"0.66810817",
"0.66353905",
"0.66278857",
"0.6626826",
"0.6613694",
"0.6597561",
"0.65968776",
"0.65596324",
"0.65003526",
"0.6494324",
"0.6487843",
"0.64789873",
"0.6474... | 0.0 | -1 |
time complexity: O(n). Time taken to iterate through one array depends on size of array: n. Doing this a fixed number times still results in O(n). BONUS | def fourth_anagram_bonus?(str1, str2)
hash = Hash.new(0)
str1.chars.each do |letter|
hash[letter] += 1
end
str2.chars.each do |letter|
hash[letter] -= 1
end
hash.values.all? { |v| v == 0 }
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 find_missing(array, n)\n i = 0\n\n (1..n).each { |number| i = i ^ number }\n array.each { |number| i = i ^ number }\n\n i\nend",
"def naive(array)\n max = -10000\n ... | [
"0.6822312",
"0.6779808",
"0.67635864",
"0.6642449",
"0.66346014",
"0.6612032",
"0.6534354",
"0.6510438",
"0.64791",
"0.6464567",
"0.6436358",
"0.6422412",
"0.6422141",
"0.63889235",
"0.6339677",
"0.6314298",
"0.6305751",
"0.62965363",
"0.6279386",
"0.6275939",
"0.627577",
... | 0.0 | -1 |
Method call to require f5icontrol after chef_gem has had a chance to run | def load_dependencies
require 'f5-icontrol'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend",
"def _monkey_patch_old_chef!\n ... | [
"0.55694366",
"0.54253983",
"0.5415826",
"0.5322679",
"0.5308375",
"0.53036255",
"0.5302987",
"0.52542716",
"0.51947176",
"0.51940125",
"0.5183185",
"0.5179463",
"0.51720065",
"0.5168565",
"0.5144749",
"0.5132236",
"0.5041891",
"0.4918058",
"0.4871463",
"0.48664063",
"0.48571... | 0.71074486 | 0 |
Interfaces to load from F5 icontrol | def interfaces
[
'LocalLB.Monitor',
'LocalLB.NodeAddressV2',
'LocalLB.Pool',
'LocalLB.VirtualServer',
'Management.DeviceGroup',
'System.ConfigSync',
'System.Failover',
'System.Inet'
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interface(filename, _hue = 0)\n if interface_exist?(filename_with_language = filename + ($options&.language || 'en')) ||\n interface_exist?(filename_with_language = filename + 'en')\n filename = filename_with_language\n end\n load_image(@interface_cache, filename, Interface_Path, ... | [
"0.64096326",
"0.63061947",
"0.6176119",
"0.6064492",
"0.6064492",
"0.5966546",
"0.59491605",
"0.59491605",
"0.59329134",
"0.593005",
"0.58747005",
"0.58747005",
"0.58747005",
"0.58694535",
"0.58694535",
"0.58519673",
"0.58460045",
"0.58311874",
"0.5830217",
"0.572757",
"0.57... | 0.0 | -1 |
Retrieve/Create load balancer from list of load balancers for a resource | def load_balancer # rubocop:disable AbcSize
raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?
@@load_balancers ||= []
add_lb(@new_resource.f5) if @@load_balancers.empty?
add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.nil?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_balancer_data(balancer = nil)\n params = Smash.new(\"Action\" => \"DescribeLoadBalancers\")\n if balancer\n params[\"LoadBalancerNames.member.1\"] = balancer.id || balancer.name\n end\n result = all_result_pages(nil, :body,\n ... | [
"0.6786377",
"0.6424232",
"0.63619214",
"0.6209401",
"0.6137494",
"0.61038476",
"0.6097971",
"0.60865533",
"0.6055986",
"0.60113305",
"0.5921425",
"0.5921425",
"0.5898267",
"0.5793097",
"0.5780654",
"0.573337",
"0.57300085",
"0.5679276",
"0.56469196",
"0.56383497",
"0.5638228... | 0.7323493 | 0 |
Add new load balancer to list of load balancers | def add_lb(hostname)
@@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n add_lb(@new_resource.f5) if @@load_balancers.find { |lb| lb.name == @new_resource.f5 }.n... | [
"0.76427525",
"0.6864852",
"0.67095643",
"0.6671662",
"0.64470446",
"0.6313913",
"0.6298787",
"0.6191413",
"0.6124943",
"0.60588956",
"0.6013395",
"0.6004589",
"0.59690684",
"0.5958809",
"0.58974504",
"0.58777463",
"0.5851733",
"0.5808511",
"0.57558787",
"0.57458675",
"0.5714... | 0.7469247 | 1 |
Create icontrol binding for load balancer | def create_icontrol(hostname) # rubocop:disable AbcSize
load_dependencies
f5_creds = chef_vault_item(node['f5-bigip']['credentials']['databag'], node['f5-bigip']['credentials']['item'])
if node['f5-bigip']['credentials']['host_is_key']
f5_creds = f5_creds[hostname]
else
f5_creds ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_lb(hostname)\n @@load_balancers << LoadBalancer.new(hostname, create_icontrol(hostname))\n end",
"def createCLB(elbv1, sg_tcp_80_lb, pub_net1_id, pub_net2_id)\n # TODO: Remove CLB by name if create fails to fully create\n\n # Create CLB\n response = elbv1.create_load_balancer(load_balancer_nam... | [
"0.6057085",
"0.6052836",
"0.60487896",
"0.59759474",
"0.59470844",
"0.58999246",
"0.58211786",
"0.5680339",
"0.5628128",
"0.5596356",
"0.5559735",
"0.5538085",
"0.5515246",
"0.5471533",
"0.5413277",
"0.5388682",
"0.5278211",
"0.5201725",
"0.5198034",
"0.5177107",
"0.5143525"... | 0.5968214 | 4 |
Cookbook Name:: newvolume Provider:: mount | def whyrun_supported?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_mount(local_dir, container_dir)\n local_dir = File.expand_path(local_dir, reference_dir)\n volumes << VolumeMount.new(local_dir, container_dir)\n end",
"def mount_kvm_volume(name)\n dev = available_dev\n enable_netblockdev(name, dev)\n vol_grp = lvm_volume_g... | [
"0.7274043",
"0.7244567",
"0.6742136",
"0.6604199",
"0.64959526",
"0.64927846",
"0.647494",
"0.63748556",
"0.6353995",
"0.63412315",
"0.63412315",
"0.6325103",
"0.6315395",
"0.6313523",
"0.630274",
"0.62794125",
"0.62475336",
"0.624153",
"0.62185115",
"0.61277425",
"0.6126445... | 0.0 | -1 |
Register a new account on the Box website with the given details. | def register(email, password)
response = @api.register_new_user(email, password)
cache_info(response['user']) # cache account_info, saving an extra API call
authorize_token(response['token'])
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"def register(email, password)\n response = Backendless.register email, password\n if response\n 'Registration sucessful'\n el... | [
"0.6740523",
"0.6643598",
"0.65756273",
"0.6503163",
"0.64915055",
"0.6485263",
"0.64017016",
"0.63647807",
"0.63517463",
"0.6324614",
"0.6300395",
"0.6288673",
"0.6265915",
"0.62102497",
"0.62102497",
"0.6203484",
"0.62019813",
"0.6180216",
"0.61717594",
"0.61654186",
"0.616... | 0.6166097 | 19 |
Log out of the account and invalidate the auth token. | def logout
begin
@api.logout
cache_token(nil)
rescue Api::NotAuthorized
# already logged out, or never logged in
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_out\n forget(current_account)\n session.delete(:account_id)\n @current_account = nil\n end",
"def log_out\n current_user\n @current_user.auth_token = nil\n @current_user.save!\n @current_user = nil\n end",
"def log_out\n session.delete(:account_id)\n @current_account = nil\... | [
"0.821151",
"0.81235284",
"0.7975725",
"0.7906774",
"0.78901416",
"0.784827",
"0.78261095",
"0.7783701",
"0.7742981",
"0.7724344",
"0.7722526",
"0.77141136",
"0.76949817",
"0.7641492",
"0.76273924",
"0.7621429",
"0.7607319",
"0.7599153",
"0.75990176",
"0.75990176",
"0.7599017... | 0.0 | -1 |
Return the account details. A cached copy will be used if avaliable, and requested if it is not. | def info(refresh = false)
return @info if @info and not refresh
begin
cache_info(nil) # reset existing info
info = @api.get_account_info['user']
cache_info(info)
rescue Api::NotAuthorized, Api::InvalidInput
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account\n @details ||= fetch_details\n @details[:account]\n end",
"def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end",
"def account; Account.get(self.account_id); end",
"def account; Account.get(self.account_id); end",
... | [
"0.7986961",
"0.75285757",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.73939353",
"0.72027194",
"0.72027194",
"0.72025144",
"0.71372306",
"0.70754194",
"0.6999638",
"0.69236183",
"0.6848963",
... | 0.6842744 | 21 |
Gets a folder object by id. | def folder(id)
Box::Folder.new(@api, nil, :id => id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_folder(folder_id)\n @folders[folder_id]\n end",
"def get_folder(folder_id)\n @folders[folder_id]\n end",
"def get_folder_by_id(folder, grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'Folder deletion was successful.'\n grafana_options[:unknow... | [
"0.81134176",
"0.81134176",
"0.7628282",
"0.7498639",
"0.7029335",
"0.6885151",
"0.6885151",
"0.6885151",
"0.6885151",
"0.6885151",
"0.6877237",
"0.6877237",
"0.68733954",
"0.6845419",
"0.68386984",
"0.6740533",
"0.67352784",
"0.66821885",
"0.66677874",
"0.6596925",
"0.658083... | 0.82084125 | 0 |
Gets a file object by id. | def file(id)
Box::File.new(@api, nil, :id => id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_get(id)\n response = get('FileService.getFile', id)\n end",
"def file_by_id(id)\n api_result = execute!(\n :api_method => self.drive.files.get,\n :parameters => { \"fileId\" => id })\n return wrap_api_file(api_result.data)\n end",
"def get_fil... | [
"0.82761115",
"0.8262397",
"0.80007535",
"0.7975726",
"0.7940402",
"0.7895157",
"0.78921235",
"0.7697132",
"0.73923326",
"0.7353733",
"0.7186633",
"0.7107002",
"0.68929726",
"0.68832725",
"0.68475956",
"0.6827918",
"0.67729527",
"0.6762245",
"0.6749288",
"0.66803324",
"0.6670... | 0.78469175 | 7 |
Get the cached ticket or request a new one from the Box api. | def ticket
@ticket ||= @api.get_ticket['ticket']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def get_ticket_granting_ticket\n if tgt_expired?\n # It's expired, so we're going to start this process by resetting the state\n clear_ticket_state\n\n response = RestClient.post(Rails.configuration.x.umls.... | [
"0.6820765",
"0.66867214",
"0.6212103",
"0.6116002",
"0.6027578",
"0.59860164",
"0.595101",
"0.59500253",
"0.5874329",
"0.5694371",
"0.56858766",
"0.56752783",
"0.5672891",
"0.56657857",
"0.564651",
"0.56278133",
"0.5618555",
"0.561479",
"0.56141216",
"0.5598916",
"0.5591676"... | 0.7126073 | 0 |
Provides an easy way to access this account's info. | def method_missing(sym, *args, &block)
super unless authorized?
# TODO: Use symbols instead of strings
str = sym.to_s
return @info[str] if @info.key?(str)
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_info()\n response = @session.do_get build_url(\"/account/info\")\n parse_response(response)\n end",
"def me\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/account/info').info\n end",
"def accoun... | [
"0.86357933",
"0.845718",
"0.7932781",
"0.79001653",
"0.7893318",
"0.7884873",
"0.7884873",
"0.76671207",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75741",
"0.75089264",
"0.74885845",
"0.7429516",
"0.739255",
"0.... | 0.0 | -1 |
The url the user needs to visit in order to grant this application permission to use their account. This requires a ticket, which is either pulled from the cache or requested. | def authorize_url(ticket = nil)
ticket = self.ticket unless ticket
"#{ api.base_url }/auth/#{ ticket }"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def request_url(requirelogin=false, requireuserinfo=false, expirationdays=30, notifyonupload=false)\n end",
"def get_access_url\n @request_token = @client.request_token\n token = @request_toke... | [
"0.651323",
"0.6467971",
"0.6085203",
"0.59566504",
"0.5899129",
"0.5825089",
"0.5794034",
"0.5776688",
"0.5722772",
"0.5674709",
"0.56465447",
"0.55992997",
"0.55683047",
"0.553173",
"0.55183744",
"0.551487",
"0.5508205",
"0.5488246",
"0.5488153",
"0.5484821",
"0.5438981",
... | 0.6891978 | 0 |
Attempt to authorize this account using the given auth token. This will only succeed if the auth token has been used before, and be done to make login easier. | def authorize_token(auth_token)
cache_token(auth_token)
info(true) # force a refresh
authorized?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorize\n\n @token = ::RequestToken.find_by_token params[:oauth_token]\n\n unless @token\n render :action=>\"authorize_failure\"\n return\n end\n\n unless @token.invalidated?\n if request.post?\n if params[:authorize] == '1'\n @token.authorize!(current_person)\n ... | [
"0.70520884",
"0.6610563",
"0.65867585",
"0.65845394",
"0.65703416",
"0.6561077",
"0.65509355",
"0.65281504",
"0.65196365",
"0.65196365",
"0.6414323",
"0.63977224",
"0.63831234",
"0.6379087",
"0.63499117",
"0.6337506",
"0.6337222",
"0.6332776",
"0.6331907",
"0.63183427",
"0.6... | 0.73615277 | 0 |
Use and cache the given auth token. | def cache_token(auth_token)
@api.set_auth_token(auth_token)
@auth_token = auth_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_auth_token_cache(auth_token, raw_token)\n Authentication::RedisStore.instance.set(auth_token, raw_token)\n end",
"def token\n Rails.cache.read(AUTH_TOKEN_CACHE_KEY) || retrieve_token!\n end",
"def set_auth_token\n return if auth_token.present?\n self.auth_token = generate_auth_tok... | [
"0.7587781",
"0.7410928",
"0.71381605",
"0.68264896",
"0.677596",
"0.677596",
"0.6774903",
"0.6589374",
"0.6571285",
"0.65105957",
"0.647515",
"0.6462262",
"0.6458529",
"0.63769907",
"0.63555425",
"0.63260573",
"0.63242763",
"0.6307539",
"0.63012147",
"0.62695444",
"0.6237305... | 0.85959214 | 0 |
Cache the account info. | def cache_info(info)
@info = info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_to_cache(account)\n {\n 'account_id' => account.id,\n 'roles' => account.roles\n }\n end",
"def set_account_cache(account, raw_token)\n Authentication::RedisStore.instance.json_set(raw_token, data_to_cache(account))\n return {raw_token => data_to_cache(account)}... | [
"0.7620492",
"0.69963676",
"0.6739897",
"0.6624775",
"0.64881957",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.6463984",
"0.62779063",
"0.6267239",
"0.62649065",
"0.62329227",
"0.62329227",
"0.6191175... | 0.63648206 | 15 |
Callbacks On incoming data | def receive_data(data)
$logger.warn("receive_data() not implemented")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receiving(data); end",
"def receiving(data); end",
"def on_data( &block )\n @on_data = block\n end",
"def on_data(&callback)\n @data_callback = callback\n end",
"def callback\n\n end",
"def on_data(&callback)\n @stream_callbacks[STREAM_DATA] = callback\n end",
... | [
"0.7567193",
"0.7567193",
"0.74723434",
"0.7456011",
"0.7373754",
"0.7364486",
"0.7350643",
"0.7350643",
"0.72663444",
"0.725553",
"0.7184824",
"0.7122478",
"0.7074236",
"0.707278",
"0.6990108",
"0.6975837",
"0.6948497",
"0.6921626",
"0.6914666",
"0.6866215",
"0.6800907",
"... | 0.66950446 | 24 |
On successful connection establishment | def connection_established(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection_successful\n @authenticating = false\n opened!\n\n exec_callback_yielding_self(:connect)\n end",
"def connection_successful\n @connection_deferrable.succeed\n end",
"def connection_status_done; end",
"def connection_completed\n\tend",
"def connec... | [
"0.7878011",
"0.77779573",
"0.76348627",
"0.74665606",
"0.7425495",
"0.73892796",
"0.73615265",
"0.72682375",
"0.72295976",
"0.72072816",
"0.71174484",
"0.70884895",
"0.70503557",
"0.70247155",
"0.70052207",
"0.69945323",
"0.689107",
"0.6842626",
"0.6842626",
"0.6816603",
"0.... | 0.7356374 | 7 |
def swap_elements(array) array1 = array[1] array2 = array[2] array[1] = array2 array[2] = array1 return array end | def swap_elements(array, index = 1, destination_index = 2)
array[index], array[destination_index] = array[destination_index], array[index]
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap_elements(array)\n temp = array[1]\n array[1] = array[2]\n array[2] = temp\n return array\nend",
"def swap_elements(array)\n array = array[0], array[2], array[1]\n return array\nend",
"def swap_elements (array)\n array[1], array[2] = array[2], array[1]\n array\nend",
"def swap_elements(array)... | [
"0.9521888",
"0.9507391",
"0.9497504",
"0.9486975",
"0.9486447",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483732",
"0.9483569",
"0.9405365",
"0.93969345",
"0.9394488",
"0.9394488",
"0.9302397",
"0.9296401",
... | 0.8469318 | 29 |
GET /users GET /users.json | def index
@users = User.all.order('first_name asc')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n para... | [
"0.82109934",
"0.7873764",
"0.7860689",
"0.78108346",
"0.78067017",
"0.7678852",
"0.76586664",
"0.76318866",
"0.7582366",
"0.75291824",
"0.7487637",
"0.74485743",
"0.7439024",
"0.7437192",
"0.7427442",
"0.73978853",
"0.73978853",
"0.73978853",
"0.73978853",
"0.7377353",
"0.73... | 0.0 | -1 |
this needs to be combined with below method using Toggle | def deactivate
@user.update(:active => false)
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle\n\t\t@toggle ||= Toggle.new(self)\n\tend",
"def toggle\n @toggle ||= toggle_class.new(self)\n end",
"def toggle\n set_switch(!self.switch) if @switch\n end",
"def toggle\n if on?\n off\n else\n on\n end\n end",
"def toggle\n fire\n end",
"def... | [
"0.76255506",
"0.73305845",
"0.72737694",
"0.7165745",
"0.7128444",
"0.7029895",
"0.6981776",
"0.6943167",
"0.68726975",
"0.6820564",
"0.68165356",
"0.68004084",
"0.6775494",
"0.6759539",
"0.6745529",
"0.6723509",
"0.67088306",
"0.6707334",
"0.66026723",
"0.65608585",
"0.6517... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_calorie_consumption
@calorie_consumption = CalorieConsumption.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def calorie_consumption_params
params.require(:calorie_consumption).permit(:name, :amount, :date)
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 |
The Cloud KMS encryption key that will be used to protect the table. For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d` The default value is `nil`, which means default encryption is used. | def kms_key
@gapi.kms_key_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend",
"def... | [
"0.78088367",
"0.74418074",
"0.73942816",
"0.7083248",
"0.6965555",
"0.6747416",
"0.6747416",
"0.6510257",
"0.64306766",
"0.62275136",
"0.62206054",
"0.6198979",
"0.6198979",
"0.6191083",
"0.61812335",
"0.6163843",
"0.6163843",
"0.60637015",
"0.60606915",
"0.6040697",
"0.6037... | 0.61019737 | 17 |
Set the Cloud KMS encryption key that will be used to protect the table. For example: `projects/a/locations/b/keyRings/c/cryptoKeys/d` The default value is `nil`, which means default encryption is used. | def kms_key= new_kms_key_name
frozen_check!
@gapi.kms_key_name = new_kms_key_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryptionKey=(value)\n\t\t\t@encryptionKey = value\n\t\tend",
"def encryption_key\n @encryption_key ||= @keys.last.tap do |key|\n key.public_tags.encrypted_data_key_id = key.id if ActiveRecord::Encryption.config.store_key_references\n end\n\n @encryption_key\n end",
"def... | [
"0.7589235",
"0.6931097",
"0.6407276",
"0.6348768",
"0.63178056",
"0.6158208",
"0.6145513",
"0.60508466",
"0.59998685",
"0.59998685",
"0.59998685",
"0.5870334",
"0.5859805",
"0.5859805",
"0.58280116",
"0.58280116",
"0.58108246",
"0.5732082",
"0.5721759",
"0.569891",
"0.568685... | 0.60824543 | 7 |
Sauvegarde un ensemble de challenges | def sauvegarder()
res_json = JSON.generate(@challenges)
fd = File.open(@pwd, "w")
fd.write(res_json)
fd.close()
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def challenges; end",
"def phase_one\r\n # start with empty elimination array\r\n council_elimination = []\r\n # loop 8 times (game mechanics)\r\n 8.times do\r\n # tribe which has lost the challenge\r\n loosing_tribe = @borneo.immunity_challenge\r\n # tribal council for the loosing tribe will elimin... | [
"0.6592503",
"0.6181148",
"0.5926964",
"0.57579315",
"0.56257474",
"0.55437696",
"0.5535676",
"0.5531853",
"0.5506152",
"0.55029285",
"0.55029285",
"0.55029285",
"0.55029285",
"0.55029285",
"0.54960084",
"0.54687876",
"0.5464706",
"0.5463565",
"0.543911",
"0.54365885",
"0.543... | 0.0 | -1 |
Execute gsub multiple times | def gsubs(replacements)
str = self.dup
replacements.each do |r|
str = str.gsub(r[0],r[1])
end
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gsub(*)\n self\n end",
"def gsub!(*args, &block)\n str = self.gsub(*args, &block)\n if str != self\n self.replace(str)\n self\n else\n nil\n end\n end",
"def gsub(pattern, replace)\n lambda do |rec, acc|\n acc.collect! { |v| v.gsub(pattern, replace) }\n ... | [
"0.7450984",
"0.72409743",
"0.70312864",
"0.6864702",
"0.6831023",
"0.674454",
"0.66314614",
"0.65569",
"0.6530583",
"0.65216374",
"0.6475867",
"0.639347",
"0.6262387",
"0.62111574",
"0.62111574",
"0.61799383",
"0.6167272",
"0.6150557",
"0.6150557",
"0.6150557",
"0.6150557",
... | 0.65265185 | 9 |
Get forwarding table from tier1 Get forwarding table from tier1 | def get_tier1_forwarding_table(tier_1_id, opts = {})
data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.... | [
"0.6995687",
"0.67749655",
"0.67727995",
"0.6321426",
"0.63078696",
"0.6258341",
"0.6248698",
"0.5563339",
"0.55142957",
"0.54832894",
"0.5469994",
"0.5459869",
"0.5386865",
"0.5375805",
"0.5344651",
"0.53374344",
"0.53162974",
"0.5313677",
"0.52874166",
"0.52423817",
"0.5209... | 0.71132946 | 0 |
Get forwarding table from tier1 Get forwarding table from tier1 | def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table ...'
end
# verify the required parameter 'tier_1_id' i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(ti... | [
"0.7113474",
"0.6995871",
"0.6773197",
"0.63217103",
"0.63080585",
"0.62584335",
"0.6248738",
"0.55633235",
"0.5514428",
"0.5482819",
"0.5469531",
"0.5459894",
"0.5386955",
"0.5376278",
"0.5343992",
"0.5336821",
"0.5315308",
"0.5313424",
"0.52876216",
"0.52416444",
"0.5208858... | 0.67754143 | 2 |
Get forwarding table from tier1 Get forwarding table from tier1 | def get_tier1_forwarding_table_0(tier_1_id, opts = {})
data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logg... | [
"0.7113474",
"0.67754143",
"0.6773197",
"0.63217103",
"0.63080585",
"0.62584335",
"0.6248738",
"0.55633235",
"0.5514428",
"0.5482819",
"0.5469531",
"0.5459894",
"0.5386955",
"0.5376278",
"0.5343992",
"0.5336821",
"0.5315308",
"0.5313424",
"0.52876216",
"0.52416444",
"0.520885... | 0.6995871 | 1 |
Get forwarding table from tier1 Get forwarding table from tier1 | def get_tier1_forwarding_table_0_with_http_info(tier_1_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_0 ...'
end
# verify the required parameter 'tier_1_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_0(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_0_with_http_info(ti... | [
"0.71132946",
"0.6995687",
"0.67749655",
"0.6321426",
"0.63078696",
"0.6258341",
"0.6248698",
"0.5563339",
"0.55142957",
"0.54832894",
"0.5469994",
"0.5459869",
"0.5386865",
"0.5375805",
"0.5344651",
"0.53374344",
"0.53162974",
"0.5313677",
"0.52874166",
"0.52423817",
"0.5209... | 0.67727995 | 3 |
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format. | def get_tier1_forwarding_table_csv(tier_1_id, opts = {})
data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'\n end\n # verify the required parame... | [
"0.7411211",
"0.73354864",
"0.7312457",
"0.6424258",
"0.6279351",
"0.6236259",
"0.62193143",
"0.61991376",
"0.6177326",
"0.61690235",
"0.61520094",
"0.60460424",
"0.6045946",
"0.5967651",
"0.5710281",
"0.57012516",
"0.56104255",
"0.5588531",
"0.55537957",
"0.5548589",
"0.5546... | 0.7500307 | 0 |
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format. | def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv ...'
end
# verify the required parameter 'tier... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_clie... | [
"0.7501166",
"0.73362494",
"0.73132205",
"0.6424593",
"0.6279723",
"0.6238052",
"0.6221068",
"0.6200105",
"0.6178392",
"0.6168175",
"0.61543816",
"0.6048137",
"0.60450304",
"0.5966902",
"0.5710236",
"0.57012016",
"0.5610148",
"0.5587682",
"0.555284",
"0.5548864",
"0.5545675",... | 0.7411981 | 1 |
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format. | def get_tier1_forwarding_table_csv_0(tier_1_id, opts = {})
data, _status_code, _headers = get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client... | [
"0.7501166",
"0.7411981",
"0.73362494",
"0.6424593",
"0.6279723",
"0.6238052",
"0.6221068",
"0.6200105",
"0.6178392",
"0.6168175",
"0.61543816",
"0.6048137",
"0.60450304",
"0.5966902",
"0.5710236",
"0.57012016",
"0.5610148",
"0.5587682",
"0.555284",
"0.5548864",
"0.5545675",
... | 0.73132205 | 3 |
Get forwarding table from tier1 in CSV format Get forwarding table from tier1 gateway in CSV format. | def get_tier1_forwarding_table_csv_0_with_http_info(tier_1_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysRoutingForwardingTableApi.get_tier1_forwarding_table_csv_0 ...'
end
# verify the required parameter '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tier1_forwarding_table_csv(tier_1_id, opts = {})\n data, _status_code, _headers = get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts)\n data\n end",
"def get_tier1_forwarding_table_csv_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client... | [
"0.7500307",
"0.7411211",
"0.7312457",
"0.6424258",
"0.6279351",
"0.6236259",
"0.62193143",
"0.61991376",
"0.6177326",
"0.61690235",
"0.61520094",
"0.60460424",
"0.6045946",
"0.5967651",
"0.5710281",
"0.57012516",
"0.56104255",
"0.5588531",
"0.55537957",
"0.5548589",
"0.55460... | 0.73354864 | 2 |
GET /protocol_drugs GET /protocol_drugs.json | def index
@protocol_drugs = ProtocolDrug.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend",
"def get_gdpr_requests_with_http_info(opts = {})\n if @api_client.co... | [
"0.6083534",
"0.5529922",
"0.54482985",
"0.54143727",
"0.5394134",
"0.53941214",
"0.5389429",
"0.5381269",
"0.53785396",
"0.53672487",
"0.53242886",
"0.52991337",
"0.52722",
"0.5271619",
"0.5182331",
"0.5175179",
"0.51739705",
"0.51604325",
"0.5157284",
"0.51530826",
"0.51526... | 0.6723771 | 0 |
GET /protocol_drugs/1 GET /protocol_drugs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @protocol_drugs = ProtocolDrug.all\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render jso... | [
"0.6471411",
"0.60211474",
"0.5700465",
"0.551893",
"0.5500407",
"0.54537416",
"0.54525906",
"0.54347014",
"0.5418249",
"0.5398395",
"0.5374502",
"0.5337369",
"0.53373367",
"0.5336355",
"0.5305261",
"0.5305261",
"0.5303837",
"0.5299168",
"0.5291861",
"0.5261096",
"0.5195701",... | 0.0 | -1 |
POST /protocol_drugs POST /protocol_drugs.json | def create
@protocol_drug = ProtocolDrug.new(protocol_drug_params)
respond_to do |format|
if @protocol_drug.save
format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully created.' }
format.json { render :show, status: :created, location: @protocol_drug }
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def protocol_drug_params\n params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id)\n end",
"def post_gdpr_requests_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: GeneralDataProtectionRegula... | [
"0.61437654",
"0.5386075",
"0.53488016",
"0.53340554",
"0.5272529",
"0.51993316",
"0.5165713",
"0.51535004",
"0.514137",
"0.49960467",
"0.4969755",
"0.4957309",
"0.49340117",
"0.491641",
"0.49078697",
"0.49070337",
"0.490129",
"0.48646334",
"0.48455867",
"0.48304892",
"0.4822... | 0.6559209 | 0 |
PATCH/PUT /protocol_drugs/1 PATCH/PUT /protocol_drugs/1.json | def update
respond_to do |format|
if @protocol_drug.update(protocol_drug_params)
format.html { redirect_to @protocol_drug, notice: 'Protocol drug was successfully updated.' }
format.json { render :show, status: :ok, location: @protocol_drug }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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' => 'P... | [
"0.645087",
"0.643234",
"0.61955035",
"0.61928195",
"0.60806614",
"0.59464073",
"0.59197",
"0.59162",
"0.59144986",
"0.59131646",
"0.59094465",
"0.5887465",
"0.58089113",
"0.57955873",
"0.57641745",
"0.5759859",
"0.57338107",
"0.5733762",
"0.57299155",
"0.57292885",
"0.572140... | 0.6256689 | 2 |
DELETE /protocol_drugs/1 DELETE /protocol_drugs/1.json | def destroy
@protocol_drug.destroy
respond_to do |format|
format.html { redirect_to protocol_drugs_url, notice: 'Protocol drug was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers:... | [
"0.6857248",
"0.6800307",
"0.6694651",
"0.66367346",
"0.6627667",
"0.6617208",
"0.6617208",
"0.6617208",
"0.6617208",
"0.6590581",
"0.6586723",
"0.6561991",
"0.65597034",
"0.65325916",
"0.65125406",
"0.65041286",
"0.6470497",
"0.6464604",
"0.646328",
"0.64567184",
"0.64563775... | 0.69589293 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_protocol_drug
@protocol_drug = ProtocolDrug.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def protocol_drug_params
params.require(:protocol_drug).permit(:dose, :additional_analgesic, :drug_id, :protocol_id)
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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
make this accessible to all view files | def current_user
User.find session[:user_id] if user_signed_in?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _view; end",
"def view_paths; end",
"def view_paths; end",
"def view_paths; end",
"def view; end",
"def view_assigns; end",
"def view_assigns; end",
"def view_only!\n @view_only = true\n end",
"def loc_view\n \n end",
"def view\n end",
"def view\n @_view\n end",... | [
"0.71266097",
"0.6915637",
"0.6915637",
"0.6915637",
"0.6754148",
"0.66057515",
"0.66057515",
"0.6520682",
"0.6515265",
"0.6501024",
"0.6385135",
"0.62490714",
"0.62169075",
"0.6191492",
"0.61852765",
"0.61470014",
"0.61097497",
"0.6105058",
"0.60991913",
"0.6084089",
"0.6084... | 0.0 | -1 |
yearly play chart data for use with BarCharts from React Recharts library | def yearly_play_chart_data
self.yearly_play_data.map do |year, times_played|
{name: year, plays: times_played}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getchart()\n # The data for the bar chart\n data0 = [100, 125, 156, 147, 87, 124, 178, 109, 140, 106, 192, 122]\n data1 = [122, 156, 179, 211, 198, 177, 160, 220, 190, 188, 220, 270]\n data2 = [167, 190, 213, 267, 250, 320, 212, 199, 245, 267, 240, 310]\n labels = [\"Jan\", \... | [
"0.64036924",
"0.6374439",
"0.6243383",
"0.62304205",
"0.61026794",
"0.60294443",
"0.5888575",
"0.58581614",
"0.57543343",
"0.5751292",
"0.571961",
"0.5706173",
"0.5690917",
"0.5660797",
"0.5650061",
"0.563823",
"0.55949",
"0.55937713",
"0.55884516",
"0.5571072",
"0.55633646"... | 0.7856646 | 0 |
returns an array of [year, times_played] for the year with the highest of occurrences | def calculate_most_common_year
self.calculate_plays_by_year.sort_by{ |year, times_played| times_played }.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_least_common_year\n self.calculate_plays_by_year.select{ |year,times_played| times_played > 0 }.sort_by{ |year, times_played| times_played }.first\n end",
"def most_popular_group_per_year\n sql = <<-SQL\n WITH mp AS (\n SELECT show_year,\n guest_group,\n COUNT(id)... | [
"0.68647105",
"0.6307935",
"0.6296469",
"0.62223",
"0.61982477",
"0.6165472",
"0.6069974",
"0.5998808",
"0.5993957",
"0.595596",
"0.59293747",
"0.588681",
"0.5848773",
"0.5830429",
"0.58126086",
"0.5768919",
"0.57469505",
"0.5743014",
"0.57253355",
"0.5717104",
"0.5709718",
... | 0.80797416 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.