query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
PATCH/PUT /pexes/1 PATCH/PUT /pexes/1.json | def update
respond_to do |format|
if @pex.update(pex_params)
format.html { redirect_to @pex, notice: 'Pex was successfully updated.' }
format.json { render :show, status: :ok, location: @pex }
else
format.html { render :edit }
format.json { render json: @pex.errors, statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @peso = Peso.... | [
"0.6437575",
"0.636641",
"0.6160494",
"0.61081946",
"0.6092174",
"0.60906154",
"0.6024656",
"0.59818643",
"0.59791493",
"0.5974159",
"0.59613127",
"0.5957155",
"0.5956641",
"0.5956641",
"0.594715",
"0.59214604",
"0.59126216",
"0.59118927",
"0.5879623",
"0.58650607",
"0.586242... | 0.6741442 | 0 |
DELETE /pexes/1 DELETE /pexes/1.json | def destroy
@pex.destroy
respond_to do |format|
format.html { redirect_to pexes_url, notice: 'Pex was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @capex.destroy\n respond_to do |format|\n format.html { redirect_to capexes_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @examan.destroy\n respond_to do |format|\n format.ht... | [
"0.66467714",
"0.66358984",
"0.66155213",
"0.6614247",
"0.6610321",
"0.6575302",
"0.6570894",
"0.6557912",
"0.6552865",
"0.65501285",
"0.6548902",
"0.654341",
"0.65414894",
"0.65377825",
"0.6535894",
"0.65281767",
"0.6515351",
"0.65123475",
"0.64771324",
"0.6474721",
"0.64727... | 0.7254316 | 0 |
Creates the induction learning object. :callseq: InductionLearning.new > induction_learner | def initialize
@consistency_checker = ConsistencyChecker.new
@grammar_tester = GrammarTest.new
@fsf_learner = FewestSetFeatures.new
@mmr_learner = MaxMismatchRanking.new
@step_type = INDUCTION
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n # Set default values for external dependencies.\n @para_erc_learner = ParadigmErcLearning.new\n @feature_learner = FeatureValueLearning.new\n @grammar_tester = GrammarTest.new\n end",
"def new\n\t\t@itinerary = Itinerary.new\n\tend",
"def new\n @tactic = Tactic.new\n ... | [
"0.6895831",
"0.58411795",
"0.57910687",
"0.5772193",
"0.57611346",
"0.57573825",
"0.568801",
"0.56271905",
"0.5541715",
"0.5496679",
"0.5494014",
"0.54717356",
"0.54511243",
"0.5428999",
"0.5323747",
"0.5316654",
"0.53001726",
"0.52905226",
"0.52816504",
"0.5265881",
"0.5254... | 0.6382383 | 1 |
syncs inventory from Redis until I phase out | def sync_inventory
@inv = Redis::HashKey.new('inventory') if @inv.blank? # new is a "new" connection to Redis, not new :)
self.quantity = @inv[self.name] # self.quantity = inventory["#{self.name}"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_redis\n\n existing_alternatives = load_alternatives_from_redis\n sync_needed = !(existing_alternatives == @alternatives.map(&:name))\n if sync_needed\n #Delete past alternative fields for this experiment\n existing_alternatives.map{|alt_name| Alternative.new(alt_name,@name)}.... | [
"0.65781385",
"0.5884821",
"0.5870822",
"0.5748417",
"0.57356226",
"0.57206655",
"0.56956106",
"0.56956106",
"0.56956106",
"0.5650222",
"0.5625067",
"0.56043506",
"0.56043506",
"0.5575766",
"0.55571455",
"0.55548376",
"0.55025166",
"0.54742306",
"0.54611355",
"0.5417597",
"0.... | 0.76769084 | 0 |
POST /invoices POST /invoice.json | def create
@resource = Invoice.new(params[:invoice])
respond_to do |format|
if @resource.save
format.html { redirect_to invoices_url, notice: 'invoice was successfully created.' }
format.json { render json: @resource, status: :created, location: @resource }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @invoice = Invoice.new(params[:invoice])\n\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, :notice => 'Invoice was successfully created.' }\n format.json { render :json => @invoice, :status => :created, :location => @invoice }\n else\n ... | [
"0.76605165",
"0.7605382",
"0.75351375",
"0.75289583",
"0.7528314",
"0.75203025",
"0.75203025",
"0.75203025",
"0.75203025",
"0.75203025",
"0.75203025",
"0.7518339",
"0.7462044",
"0.7449191",
"0.7438959",
"0.7436879",
"0.74292946",
"0.7404565",
"0.739371",
"0.7295403",
"0.7246... | 0.76431733 | 1 |
When the server reports an "unkown command", this gets called. It's useful for implementing commands that aren't otherwise covered | def unknown_command(object, connection, command)
object
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unknown_cmd(cmd)\n\t\t\t\t\"Unknown command: #{cmd}\"\n\t\t\tend",
"def handle_missing_command( command )\n\t\terror_message \"#$0: #{command}: command not found\"\n\tend",
"def command_missing(command, args)\n write \"No such command '#{command}'\"\n end",
"def on_private_message(message, buddy,... | [
"0.6931911",
"0.64106596",
"0.62449485",
"0.621395",
"0.61763406",
"0.6158861",
"0.60701346",
"0.6036336",
"0.59968483",
"0.59706914",
"0.5865534",
"0.5838107",
"0.5832477",
"0.5801543",
"0.57630396",
"0.5758008",
"0.5722651",
"0.56861854",
"0.56841683",
"0.5658009",
"0.56352... | 0.66381717 | 1 |
fill colour to a pixel (x, y) with c | def colour(x, y, c)
x, y = x.to_i, y.to_i
unless self.bounds?(x, y)
puts "ERR: Coordinates out of bounds"
return
end
self[y, x] = c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flood_fill(x, y, color)\n x_i, y_i = pixel_to_index(x, y)\n original_color = bitmap[y_i][x_i]\n flood_fill_helper(x, y, original_color, color)\n end",
"def color_pixel(x, y, color)\n x_index = x.to_i - 1\n y_index = y.to_i - 1\n bitmap.set_pixel_to({x: x_index, y: y_index}, color)\n ... | [
"0.7568882",
"0.7448351",
"0.7332697",
"0.7276722",
"0.7202253",
"0.71703565",
"0.7165865",
"0.7137608",
"0.71147627",
"0.71084654",
"0.7020365",
"0.7000372",
"0.6980856",
"0.6902449",
"0.68960035",
"0.68247485",
"0.67595506",
"0.6744902",
"0.67321306",
"0.6688529",
"0.656121... | 0.7801804 | 0 |
GET /donations/1 GET /donations/1.json | def show
@donation = Donation.find(params[:id])
# return json object
respond_to do |format|
format.html # show.html.erb
format.json { render json: @donation.to_json }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @donation }\n end\n end",
"def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end",
"def show\n @donati... | [
"0.71723527",
"0.7157103",
"0.7071995",
"0.7007855",
"0.6877714",
"0.6877714",
"0.6877714",
"0.6877714",
"0.6877714",
"0.68565005",
"0.6799627",
"0.67002726",
"0.66956586",
"0.66749483",
"0.66732436",
"0.6599258",
"0.65928125",
"0.65834135",
"0.6528151",
"0.6485261",
"0.64493... | 0.71954095 | 0 |
Only donors are allowed to create and edit donations. | def donor_user
unless current_user.isDonor?
flash[:danger] = "Organizations cannot create or edit donations."
redirect_to(donations_path)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def donor\n user\n end",
"def donors?(other_user)\n\t\tdonors.include?(other_user)\n\tend",
"def create?\n @current_user.permission('Donor', :clerk)\n end",
"def set_donation\n @donation = Donation.find(params[:id])\n if not @donation.user.eql?(current_user)\n flash[:notice] = \"... | [
"0.6642831",
"0.6500793",
"0.64562213",
"0.6326392",
"0.6325345",
"0.6315335",
"0.6271677",
"0.617634",
"0.6164495",
"0.611722",
"0.6116033",
"0.6053914",
"0.598791",
"0.59704113",
"0.5942977",
"0.5942977",
"0.5942977",
"0.5942977",
"0.59170455",
"0.5905444",
"0.5875326",
"... | 0.705692 | 0 |
PATCH/PUT /dataunits/1 PATCH/PUT /dataunits/1.json | def update
respond_to do |format|
if @dataunit.update(dataunit_params)
format.html { redirect_to @dataunit, notice: 'Dataunit was successfully updated.' }
format.json { render :show, status: :ok, location: @dataunit }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @unit.update(unit_params)\n forma... | [
"0.6967281",
"0.6460596",
"0.6428142",
"0.64277357",
"0.63666254",
"0.6354878",
"0.6337456",
"0.6332316",
"0.623375",
"0.6188124",
"0.61728084",
"0.61641806",
"0.61471516",
"0.6130509",
"0.6113129",
"0.6092964",
"0.608475",
"0.60617924",
"0.60617924",
"0.6055947",
"0.60513735... | 0.66573805 | 1 |
DELETE /dataunits/1 DELETE /dataunits/1.json | def destroy
@dataunit.destroy
respond_to do |format|
format.html { redirect_to dataunits_url, notice: 'Dataunit was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end",
"def destroy\n @unit.destroy\n respond_to do |form... | [
"0.7130797",
"0.6991115",
"0.6981947",
"0.6980418",
"0.695317",
"0.6885436",
"0.6869985",
"0.6791055",
"0.67776453",
"0.67776453",
"0.67776453",
"0.67776453",
"0.6775295",
"0.6764876",
"0.6764876",
"0.6762301",
"0.6760874",
"0.6748367",
"0.6722311",
"0.6718045",
"0.6710809",
... | 0.72475576 | 0 |
Render a Nestable list for a `closure_tree` collection | def as_nestable_list(roots, &block)
content_tag(:div, class: 'dd') do
nestable_list_recursive(roots, block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_children(taxons_collection)\n taxons_collection.sort_by {|p| p.hierarchy}\n html_var = \"\"\n taxons_collection.each do |t|\n if not t.children.empty?\n html_var << \"<li><i class='icon-plus'> </i>\" << link_to(t.name, t) << \"<ul>\" << list_children(t.children) << \"</ul>\"\n else\n ht... | [
"0.6048013",
"0.60062546",
"0.5860563",
"0.57987285",
"0.5794418",
"0.5638422",
"0.56038594",
"0.5583392",
"0.5573195",
"0.5573195",
"0.54600817",
"0.54254055",
"0.540878",
"0.5343126",
"0.5337691",
"0.53275084",
"0.53064",
"0.5288292",
"0.52595276",
"0.5256525",
"0.5253127",... | 0.61308366 | 0 |
Return the value of an attribute, possibly as a link if it's a model | def admin_display_value(object, attribute, value)
config = object.class.admin_attributes[attribute]
return value.to_s unless config&.has_key?(:model)
model_name = config[:model_name]
unless model_name
association = object.class.reflect_on_association(attribute)
return value.to_s unless asso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_attribute_value(attribute, value)\n linked_attributes = [:member_of_collections, :decorated_numismatic_monograms]\n return link_to(value.title, solr_document_path(id: value.id)) if linked_attributes.include?(attribute)\n return catalog_link(attribute, value) if attribute == :source_metadata_i... | [
"0.73075765",
"0.6925944",
"0.68289196",
"0.67009073",
"0.6661399",
"0.6661399",
"0.6532532",
"0.6532532",
"0.64729154",
"0.6385742",
"0.63793415",
"0.6377903",
"0.63775635",
"0.6358815",
"0.6358815",
"0.6323313",
"0.6246053",
"0.6170935",
"0.61634034",
"0.61566806",
"0.61566... | 0.6929703 | 1 |
Recurse through a collection to produce a multilevel list | def nestable_list_recursive(items, block)
content_tag(:ol, class: 'dd-list') do
tags = items.map do |item|
content_tag(:li, class: 'dd-item', data: { id: item.to_param }) do
content = capture_with_haml { block.call(item) }
recurse = if item.children.empty?
''.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_collect(object, each_method, collection=nil)\n collection ||= []\n object.send(each_method) do |node|\n collection << node\n if node.respond_to?(each_method)\n recursive_collect(node, each_method, collection)\n end\n end\n collection\n end",
"def get_collections_f... | [
"0.6700137",
"0.6430465",
"0.6359691",
"0.6331331",
"0.6233309",
"0.6119146",
"0.6066243",
"0.60173833",
"0.6000828",
"0.5967674",
"0.5935482",
"0.5916534",
"0.5911591",
"0.5904547",
"0.5858627",
"0.5843823",
"0.5759093",
"0.575729",
"0.57482743",
"0.5739543",
"0.5738609",
... | 0.64414966 | 1 |
id: Integer, represents unique identifier input_products: hash that represents products with keys of product name and values of price (Float) | def initialize(id, products)
@id = id
@products = products
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPriceOfProduct\n\t\t@basket.each_with_object({}) do |item, products|\n \t\t\tproducts[item[:id]] = item[:price]\n\t\tend\n\tend",
"def find_price_by_product_id(product_id, products = Products)\n products[\"prices\"].each do |product|\n return product[\"price\"] if product[\"product_id\"]== produc... | [
"0.67458594",
"0.63981825",
"0.63640594",
"0.6336004",
"0.63209915",
"0.62899673",
"0.62532",
"0.6248568",
"0.6245567",
"0.62379485",
"0.6182492",
"0.6179402",
"0.61786926",
"0.61701",
"0.61514956",
"0.61438763",
"0.6094268",
"0.60764873",
"0.60749006",
"0.6062822",
"0.603084... | 0.6542951 | 1 |
log a creating message | def creating( msg )
@log.info "creating #{msg}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creating( msg )\n @log.info \"creating #{msg}\"\n end",
"def create_log(param); end",
"def log_message event, id, data, errors, creation_time, sender\n Log.create(event, id, data, errors, creation_time, sender)\n end",
"def create_log(content)\n @note.title = to_utf8(@name) + \" - \" + Time.... | [
"0.89155143",
"0.7678536",
"0.7372923",
"0.7284079",
"0.713208",
"0.7122957",
"0.7122957",
"0.70919836",
"0.6959673",
"0.6846764",
"0.68450814",
"0.6841965",
"0.6607398",
"0.6570183",
"0.6557434",
"0.6511764",
"0.64731365",
"0.64654505",
"0.645159",
"0.64446795",
"0.63957894"... | 0.8891862 | 1 |
define_multiple_dbs_constant Create the multiple_dbs_initializer.rb file. This file define the MultipleDbs::DBS constant and the MultipleDbs::DbConnection per database. Also delete the config/multiple_dbs folder and create the ymls files that store the database configuration | def define_multiple_dbs_constant
copy_file "initializer.rb", "config/initializers/multiple_dbs_initializer.rb"
insert_into_file "config/initializers/multiple_dbs_initializer.rb",
%Q{\tDBS=#{databases.map{|db| db.to_s.underscore.to_sym}}
run_setup\n}, after: "# Your databases.\n", verbose: false
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dbs_init\n @dbs_hash = Dir[\"#{dbs_store}/*.db\"]\n .map do |dbfile|\n File.open(dbfile){|f| JSON.parse(f.read, symbolize_names: true)}\n end\n .inject({}) do |h, db|\n h.update({\n db[:name].to_sym => LaPack::const_get(db[:clazz]).new(self, db[:params])\n })\n... | [
"0.6510325",
"0.6097392",
"0.5995275",
"0.59533477",
"0.5807893",
"0.56897783",
"0.55873525",
"0.5563518",
"0.5449866",
"0.53811854",
"0.5362926",
"0.5351586",
"0.5321951",
"0.53163195",
"0.5243001",
"0.5243001",
"0.5230141",
"0.52109665",
"0.520806",
"0.5168115",
"0.5164595"... | 0.9198253 | 0 |
create_database_config_file create the configuration yml file for the given database name if the database name is null then the default rails configuration file is Overwritten | def create_database_config_file(db = nil)
fpath = db ? "/multiple_dbs/#{db}_database.yml" : "/database.yml"
db ||= databases.first
copy_file "config_db.yml", "config#{fpath}"
insert_into_file "config#{fpath}",
%Q{#{options.development["adapter"] ? options.development["adapter"] : @@default_db_confi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_database_configuration_file\n FileUtils.cp(database_configuration_sample, database_configuration_file)\n end",
"def create_default_config_files\n create_default_database_yml\n end",
"def create_database_yml\n print_title('Creating database configuration')\n\n @database ... | [
"0.7585632",
"0.72747296",
"0.72371733",
"0.6973884",
"0.68899316",
"0.68685734",
"0.68507814",
"0.6796522",
"0.67925644",
"0.67252976",
"0.6682311",
"0.66720146",
"0.66566104",
"0.66097116",
"0.66060066",
"0.6495819",
"0.6482596",
"0.6367052",
"0.63106954",
"0.630949",
"0.63... | 0.7972209 | 0 |
POST /address_books POST /address_books.json | def create
@address_book = current_user.address_books.build(address_book_params)
respond_to do |format|
if @address_book.save
format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }
format.json { render :show, status: :created, location: @address_book }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @address_book = AddressBook.new(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n ... | [
"0.716643",
"0.6683367",
"0.6361571",
"0.620926",
"0.6190183",
"0.61205924",
"0.60666853",
"0.60666853",
"0.60666853",
"0.604391",
"0.5980682",
"0.597967",
"0.59583455",
"0.59372735",
"0.59327525",
"0.5930911",
"0.59285915",
"0.59204257",
"0.5916619",
"0.58801335",
"0.5880133... | 0.69586015 | 1 |
DELETE /address_books/1 DELETE /address_books/1.json | def destroy
@address_book.destroy
respond_to do |format|
format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: '删除完成!Address book destroyed!' }\n format.json { head :no_content }\n end\n end",
"def delete_address_book(address_book_id)\n end",
"def destroy\n @address_book = Ad... | [
"0.7303331",
"0.71942306",
"0.71695435",
"0.7138133",
"0.6975435",
"0.6975435",
"0.6975435",
"0.6975435",
"0.6936777",
"0.6810096",
"0.6809638",
"0.679322",
"0.67807364",
"0.6771209",
"0.6754308",
"0.6743724",
"0.6729169",
"0.6715116",
"0.6704836",
"0.6703558",
"0.6703558",
... | 0.74078155 | 1 |
Get authentication method name | def human_auth_method
self[:auth_method].to_human
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_auth_name\r\n method_info[:method_auth_name]\r\n end",
"def authentication_method\n @attributes[:authentication_method]\n end",
"def authentication_method\n @attributes[:authentication_method]\n end",
"def authentication_method\n @authentication_method ||= begin\n ... | [
"0.8909435",
"0.77261126",
"0.77261126",
"0.74340403",
"0.70537627",
"0.6764761",
"0.6748974",
"0.6728258",
"0.667179",
"0.66690844",
"0.66124123",
"0.6545744",
"0.6536573",
"0.6524883",
"0.64872116",
"0.6470346",
"0.6457282",
"0.64344394",
"0.6355972",
"0.6318867",
"0.631136... | 0.7975542 | 1 |
truncate Enable either the named trigger, or all triggers for this table | def enable_trigger(trigger = 'ALL')
connection.enable_trigger(table_name, trigger)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _truncate_sql(table)\n to = @opts[:truncate_opts] || OPTS\n \"TRUNCATE TABLE#{' ONLY' if to[:only]} #{table}#{' RESTART IDENTITY' if to[:restart]}#{' CASCADE' if to[:cascade]}\"\n end",
"def truncate!\n return if truncated?\n update_column :metadata, nil\n end",
"def truncat... | [
"0.60060406",
"0.59501565",
"0.59454864",
"0.5888911",
"0.5886367",
"0.5876196",
"0.5834651",
"0.5794117",
"0.57346785",
"0.5621553",
"0.56203806",
"0.55983925",
"0.54709727",
"0.5399962",
"0.5390992",
"0.5361943",
"0.5308752",
"0.5285642",
"0.52748793",
"0.51928383",
"0.5166... | 0.6139087 | 0 |
enable_trigger Disable either the named trigger, or all triggers for this table | def disable_trigger(trigger = 'ALL')
connection.disable_trigger(table_name, trigger)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_trigger(trigger = 'ALL')\n connection.enable_trigger(table_name, trigger)\n end",
"def enable_triggers(enable = true)\n triggers.each do |trigger|\n sql = \"alter trigger #{trigger.name} #{enable ? :enable : :disable}\"\n OracleTables.exec_sql sql\n end\n end",
"def disable_even... | [
"0.7684926",
"0.7647979",
"0.75794756",
"0.64353114",
"0.6295248",
"0.61833405",
"0.6052437",
"0.591902",
"0.59045005",
"0.579681",
"0.57767785",
"0.57767785",
"0.5766687",
"0.57641584",
"0.57609916",
"0.5750052",
"0.5704973",
"0.5660274",
"0.556548",
"0.5548714",
"0.5544289"... | 0.82242954 | 0 |
take a conditions hash and return an :include array | def conditions2include(conditions, original = true)
nest = false
new_include = *(conditions.inject([]) do |m, (k, v)|
if v.is_a?(Hash)
temp_v, includes_hash = conditions2include(v, false)
nest = true
m << (includes_hash ? {k => temp_v} : k)
end
m
end)
return ori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_includes\n return @extract_includes if @extract_includes\n @extract_includes = []\n query_conditions.each do |condition|\n unless condition.nil? || condition.empty?\n if(condition.is_a?(Hash) && condition[:include])\n @extract_includes << condition[:include]\n end\n... | [
"0.7614322",
"0.6996408",
"0.6572763",
"0.6478942",
"0.64646554",
"0.6448967",
"0.642911",
"0.63786405",
"0.63416404",
"0.63385695",
"0.63307935",
"0.63307935",
"0.62902707",
"0.6290041",
"0.62866646",
"0.6275244",
"0.6249966",
"0.6244132",
"0.62208647",
"0.61846024",
"0.6151... | 0.7494991 | 1 |
include_eager_conditions? in active_record/associations.rb Checks if the query order references a table other than the current model's table. | def include_eager_order?(options)
order = options[:order]
return false unless order
order.scan(/([\.\w]+)\.[\["]?\w+[\]"]?/).flatten.any? do |order_table_name|
order_table_name != table_name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def references_eager_loaded_tables?(options)\n joined_tables = joined_tables(options)\n include_eager_order?(options, nil, joined_tables) || include_eager_conditions?(options, nil, joined_tables)\n end",
"def include_eager_conditions?(options)\n # look in both sets of conditions... | [
"0.7688566",
"0.73316383",
"0.688657",
"0.68650544",
"0.64938396",
"0.6232211",
"0.6160922",
"0.61303204",
"0.60387707",
"0.60308313",
"0.59756196",
"0.5967524",
"0.595504",
"0.5882727",
"0.5828234",
"0.5795879",
"0.57953703",
"0.5763828",
"0.5743993",
"0.5740477",
"0.5721839... | 0.7510514 | 1 |
Determines the active zoneset for use when creating new zones When not set, like for a fresh switch, it will default to ASM_Zoneset | def active_zoneset
active_fc_zone || "ASM_Zoneset"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zone_setting(resource)\n resource.multi_az ? 'multi_az' : 'standard'\n end",
"def set_zone\n @zone = @stadium.zones.friendly.find(params[:id])\n end",
"def current_zone\n return @zone\n end",
"def find_climate_zone_set(clim, building_vintage)\n result = nil\n \n p... | [
"0.6843201",
"0.6239231",
"0.5910372",
"0.5804097",
"0.5766745",
"0.5699522",
"0.5699522",
"0.5639586",
"0.56166846",
"0.56166846",
"0.55979633",
"0.5562858",
"0.55592084",
"0.55534005",
"0.5550694",
"0.55342185",
"0.5525927",
"0.5460601",
"0.5399521",
"0.53721654",
"0.536685... | 0.8479271 | 0 |
function when loading add/remove component page | def load_add_component_page
#Checks if parent_id is a Product or Component based on a string value
if(params[:parent_id][0] == 'P')
@parent = Product.find(params[:parent_id][1..params[:parent_id].length])
@items_to_select = @parent.components
else
@parent = Component.find(params[:parent_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ui_add(component)\n add component\n end",
"def components\n\n end",
"def components; end",
"def on_component_added(child_component)\n end",
"def _add_component comp #:nodoc:\n end",
"def add_component(component)\n\t\t@components << component\n\tend",
"def on_after_load\n end"... | [
"0.60826105",
"0.6015754",
"0.60133296",
"0.5987888",
"0.592518",
"0.5869272",
"0.5846812",
"0.57399964",
"0.56989723",
"0.56985503",
"0.5678763",
"0.56581277",
"0.5623164",
"0.5622238",
"0.5622238",
"0.5622238",
"0.56080955",
"0.558993",
"0.55747443",
"0.5555565",
"0.5549094... | 0.6162638 | 0 |
Function when loading valuefield edit page | def load_edit_vf_page
@all_groups = Group.all
@all_properties = Property.all
@all_categories = Category.all
@all_components = Component.all
@all_products = Product.all
@all_images = Image.all
@all_datafiles = DataFile.all
@valuefield = Valuefield.find(params[:valuefield_id])
if(!@va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n load_data\n end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end",
"def edit; end... | [
"0.6653736",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"0.6534725",
"... | 0.6830227 | 0 |
Create a valuefield associated to a path | def create
@valuefield = Valuefield.new(params[:valuefield])
@valuefield.property = Property.find(Integer(params[:property_id]))
@valuefield.path = params[:path]
respond_to do |format|
if @valuefield.save
format.html { redirect_to @valuefield, notice: 'Valuefield was successfully created.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_by_path(path:, name:, value_type:, label:, value:nil)\n # Value must be [] if group or ref created (in this case method will ignore :value)\n inserted_value = value\n inserted_value = {} if %w(ref group).include? value_type\n\n param = get_by_name(path: path)\n raise \"Un... | [
"0.67755824",
"0.6525638",
"0.62878364",
"0.6237275",
"0.6095653",
"0.59932595",
"0.59318095",
"0.58790076",
"0.58790076",
"0.58790076",
"0.5873907",
"0.58498544",
"0.5845954",
"0.5810342",
"0.56877637",
"0.5662902",
"0.56619126",
"0.5646953",
"0.563198",
"0.56145453",
"0.561... | 0.69466794 | 0 |
Function to sort the categories array | def sort_categories
for cat in @all_categories
if(cat.parent_id == nil)
@all_categories_hash[0] = [cat]
else
if(@all_categories_hash[cat.parent_id] == nil)
@all_categories_hash[cat.parent_id] = []
end
@all_categories_hash[cat.parent_id].push(cat)
end
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sorted_by_frequency\n @categories.sort { |a, b| b[1] <=> a[1] }\n end",
"def sort_categories\n #loop to sort categories parents and children\n for cat in @all_categories\n #if category parent id == nill then hash = current category else if parent id of category = nil then parent id hash is ... | [
"0.761375",
"0.7130051",
"0.7029696",
"0.69886994",
"0.6346613",
"0.6344728",
"0.63308394",
"0.63182575",
"0.61756516",
"0.61135274",
"0.6098522",
"0.60832775",
"0.6079948",
"0.60704684",
"0.6025062",
"0.6020736",
"0.6010968",
"0.6002371",
"0.59963334",
"0.5985387",
"0.597224... | 0.74205506 | 1 |
fetch csv_report_job & admin obj Author: Aman Date: 18/04/2018 Reviewed By: | def fetch_details
@csv_report_job = CsvReportJob.where(id: @csv_report_job_id).first
@filters = @csv_report_job.extra_data[:filters]
@sortings = @csv_report_job.extra_data[:sortings]
@admin = Admin.get_from_memcache(@csv_report_job.admin_id)
@client_id = @csv_report_job.client_id
@client = Cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_handoff_report\n \t\tsearch_parm = search_csv(params)\n \t\tbu = search_parm[0]\n \t\tl1 = search_parm[1]\n \t\tl2 = search_parm[2]\n \t\tl3 = search_parm[3]\n\t\t\n\t\tif params[:report_include_canceled] == \"report_include_canceled\"\n \t\tinclude_cancel = true\n \telse\n \t\tinclude_c... | [
"0.6528702",
"0.64451176",
"0.63628644",
"0.63006866",
"0.62087744",
"0.6071601",
"0.60699445",
"0.59737086",
"0.59245497",
"0.59171855",
"0.59149987",
"0.58964133",
"0.5895957",
"0.5892904",
"0.5885884",
"0.5874335",
"0.58731705",
"0.5870065",
"0.58689713",
"0.58537143",
"0.... | 0.750095 | 0 |
start creating csv for kyc data and upload to s3 Author: Aman Date: 18/04/2018 Reviewed By: | def process_and_upload_csv
@has_data = get_data_from_db do |data|
formatted_data = format_data(data)
c_add formatted_data
end
if @has_data
zip_folder
upload_to_s3
delete_local_files
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_call\n s3_object = AMAZON_S3_CLIENT.bucket(bucket_name).object(renamed_filename)\n s3_object.upload_file(\n file,\n metadata: file_metadata,\n content_type: 'text/csv'\n )\n end",
"def genupload data\n CSV.open(\"update-data.csv\", \"wb\") do |csv|\n csv << @uhead\n ... | [
"0.6205992",
"0.61131734",
"0.60200894",
"0.59695196",
"0.5963",
"0.59109116",
"0.58712685",
"0.5813638",
"0.5729383",
"0.5707834",
"0.5679734",
"0.56790346",
"0.5678628",
"0.5661382",
"0.5631787",
"0.5584985",
"0.5568041",
"0.5547527",
"0.55469203",
"0.55421835",
"0.553185",... | 0.64518046 | 0 |
update status of job Author: Aman Date: 18/04/2018 Reviewed By: | def update_job_status(status)
@csv_report_job.status = status
@csv_report_job.save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end",
"def update\n @job = Job.find(params[:id])\n case params[:status]\n when \"requested\"\n @job.status :requested\n when \"printed\"\n @job.status :printed\n ... | [
"0.6934989",
"0.66008687",
"0.6507822",
"0.6472759",
"0.64377534",
"0.6377728",
"0.621932",
"0.6168233",
"0.61681515",
"0.61516476",
"0.6046061",
"0.6045899",
"0.6040737",
"0.60405886",
"0.6020661",
"0.6015531",
"0.6004653",
"0.5997235",
"0.5968465",
"0.5968465",
"0.5968465",... | 0.67390305 | 1 |
Returns siblings below the current document. Siblings with a position greater than this documents's position. | def lower_siblings
self.class.where(:position.gt => self.position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def higher_siblings\n self.class.where(:position.lt => self.position)\n end",
"def right_siblings\n siblings.where( table[tree.columns.position].gteq(position) )\n end",
"def right_sibling\n siblings.\n where( arel[position_column].gt(self[position_column]) ).\n reord... | [
"0.79719245",
"0.70342565",
"0.69711703",
"0.6837224",
"0.6807489",
"0.67987484",
"0.67778784",
"0.67778784",
"0.6772805",
"0.6757945",
"0.6757945",
"0.6757945",
"0.65625674",
"0.65460116",
"0.65319246",
"0.65158135",
"0.6474596",
"0.64670825",
"0.6465214",
"0.6454217",
"0.64... | 0.7442322 | 1 |
Returns siblings above the current document. Siblings with a position lower than this documents's position. | def higher_siblings
self.class.where(:position.lt => self.position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lower_siblings\n self.class.where(:position.gt => self.position)\n end",
"def left_siblings\n siblings.where( table[tree.columns.position].lteq(position) )\n end",
"def left_sibling\n siblings.\n where( arel[position_column].lt(self[position_column]) ).\n reorder(... | [
"0.79807675",
"0.71990496",
"0.7116287",
"0.70430243",
"0.70392585",
"0.6616844",
"0.65833753",
"0.65833753",
"0.65833753",
"0.65785384",
"0.65785384",
"0.6573936",
"0.6566633",
"0.6517949",
"0.65082973",
"0.6481455",
"0.64444035",
"0.6428719",
"0.64246863",
"0.6397213",
"0.6... | 0.7708163 | 1 |
Is this the highest sibling? | def at_top?
higher_siblings.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last?\n !right_sibling\n end",
"def at_bottom?\n lower_siblings.empty?\n end",
"def last?\n if tree.columns.counter_cache? && parent\n parent.children.size == position\n else\n !right_sibling\n end\n end",
"def left_sibling\n higher_items... | [
"0.70882976",
"0.6953541",
"0.67421925",
"0.6703095",
"0.6601578",
"0.65061784",
"0.649927",
"0.6473407",
"0.6386257",
"0.6372248",
"0.6353162",
"0.634978",
"0.6322099",
"0.627928",
"0.6237301",
"0.6217658",
"0.61957383",
"0.6188103",
"0.6182421",
"0.6173416",
"0.6171419",
... | 0.7424739 | 0 |
Move this node one position up | def move_up
return if at_top?
self.class.where(:position => self.position - 1).first.inc(:position, 1)
inc(:position, -1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end",
"def move_up\n up_tile = C[@location.first - 1, @location.second]\n move_to(up_tile)\n end",
"def move_up(n)\n self.y += n\n end",
"def move_up\n up_tile = Couple.new(@loc... | [
"0.7814212",
"0.76071584",
"0.74379367",
"0.7376021",
"0.73159933",
"0.7178453",
"0.70640796",
"0.6951926",
"0.69344044",
"0.69018316",
"0.6871524",
"0.6861499",
"0.6808316",
"0.67904156",
"0.6769382",
"0.67011607",
"0.6691867",
"0.6677573",
"0.65705264",
"0.65422994",
"0.653... | 0.78055507 | 1 |
Move this node one position down | def move_down
return if at_bottom?
self.class.where(:position => self.position + 1).first.inc(:position, -1)
inc(:position, 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_down\n\t\tmove([0,1])\n\tend",
"def move_down(n)\n self.y -= n\n end",
"def move_down\n down_tile = C[@location.first + 1, @location.second]\n move_to(down_tile)\n end",
"def move_down\n down_tile = Couple.new(@location.first + 1, @location.second)\n move_to(down_tile)\n ... | [
"0.7674315",
"0.7463769",
"0.73722583",
"0.7203318",
"0.7155335",
"0.69498116",
"0.69498116",
"0.6871529",
"0.6828859",
"0.6796505",
"0.67664635",
"0.6734918",
"0.6732094",
"0.66875184",
"0.664909",
"0.66470546",
"0.6500076",
"0.64974934",
"0.64765394",
"0.6442947",
"0.643559... | 0.7522396 | 1 |
GET /versions GET /versions.xml | def index
@active_page = :versions
respond_to do |format|
format.html
format.xml do
find_versions
@versions_count = @versions.size
@versions = @versions[ @page_limit * (@current_page - 1), @page_limit ].to_a
render :action => :index, :layout => false
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end",
"def versions(resource_uri, format = \"text/turtle\")\n log \"versions for #{resource_uri}\"\n get \"#{resource_uri}/fcr:versions\", format\n end",
"def versions\n JSON.parse(RestClient.get(\"#{VERSION_UR... | [
"0.77590895",
"0.7127307",
"0.71255463",
"0.70726216",
"0.70423454",
"0.6982472",
"0.6942755",
"0.69149536",
"0.6867684",
"0.6784745",
"0.67748886",
"0.6644692",
"0.66215354",
"0.65875834",
"0.6572606",
"0.6569138",
"0.6558688",
"0.6549174",
"0.6532059",
"0.65051425",
"0.6503... | 0.7252632 | 1 |
This method is used to approve an unapproved +node+ XHR PUT /admin/versions/2/approve.xml | def approve
respond_to do |format|
if @version.approve!(current_user)
UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor
format.xml { head :ok }
else
format.xml { head :int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disapprove\n self.approved = false\n end",
"def approve\n logger.info(\"in approvals controller: approve\")\n\n logger.info(\"in approvals controller: approve?\")\n if @changeset.approved?\n logger.info(\"in approvals controller: approve? yep!\")\n flash[:notice] = l(:approved_already)... | [
"0.6850724",
"0.66000617",
"0.6581586",
"0.6457867",
"0.6420421",
"0.641895",
"0.6374848",
"0.63410884",
"0.6290944",
"0.62351406",
"0.62335753",
"0.6233324",
"0.6228118",
"0.62270147",
"0.6220329",
"0.6197712",
"0.6189711",
"0.61809105",
"0.61209345",
"0.61169183",
"0.611059... | 0.73048496 | 0 |
This method is used to reject an unapproved +node+ XHR PUT /admin/versions/2/reject.xml | def reject
respond_to do |format|
if @version.reject!
UserMailer.rejection_notification(current_user, @version.versionable.node, @version.editor, params[:reason], :host => request.host).deliver if @version.editor
format.xml { head :ok }
else
format.xml { head :internal_server_err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end",
"def reject\n self[:status] = \"Reject\"\n save\n end",
"def disapprove\n self.approved = false\n end",
"def reject!\n return false if self.approved == true\n self.destroy\n end",
"... | [
"0.6535407",
"0.6265745",
"0.6263964",
"0.6220158",
"0.62071186",
"0.6204206",
"0.61148006",
"0.60643965",
"0.5944083",
"0.5939566",
"0.5888539",
"0.58069724",
"0.5774226",
"0.5748962",
"0.5740915",
"0.5737293",
"0.5719951",
"0.5703195",
"0.5689026",
"0.5683152",
"0.5673399",... | 0.70485824 | 0 |
get disco info for a node jid:: [Jabber::JID] node:: [String] return:: [Hash] with possible keys type:: [String] ,category:: [String],features:: [Array] of feature, nodeinformation:: [Jabber::XData] check for more infos | def get_info(jid,node)
iq = Iq.new(:get,jid)
iq.from = @stream.jid
discoinfo = Discovery::IqQueryDiscoInfo.new
discoinfo.node = node
iq.add(discoinfo)
info = {}
@stream.send_with_id(iq) do |answer|
identity = answer.query.identity
info['type'] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disco_info(node = nil)\n disco_for(:info, node)\n end",
"def discover_infos(node=nil)\n hash = {'xmlns' => Namespaces::DiscoverInfos}\n hash['node'] = node if node\n iq = connection.iq_stanza({'to'=>jid}, x('query', hash))\n send_iq_stanza_fibered iq\n end",
"def read_nod... | [
"0.72911024",
"0.6443276",
"0.5834451",
"0.58186406",
"0.56925994",
"0.56523144",
"0.56321",
"0.5574246",
"0.55609214",
"0.55609214",
"0.5551813",
"0.5549413",
"0.55006206",
"0.54978853",
"0.5496293",
"0.5445921",
"0.5390542",
"0.53649276",
"0.5314296",
"0.52965784",
"0.5292"... | 0.80643797 | 0 |
get type of node jid:: [Jabber::JID] node:: [String] | def type(jid,node)
info = get_info(jid,node)
return info['type']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n @node[\"type\"]\n end",
"def node_type() ; info[:node_type] ; end",
"def node_type() ; info[:node_type] ; end",
"def node_type\n @node_type ||= client.node_type.get_from_uri(info[:node_type]) unless info[:node_type].nil?\n end",
"def node_type\... | [
"0.7326736",
"0.7298623",
"0.7298623",
"0.71282566",
"0.709178",
"0.6942397",
"0.69197094",
"0.6911695",
"0.6911695",
"0.6886968",
"0.6610272",
"0.648258",
"0.63362765",
"0.62990826",
"0.6254251",
"0.61790055",
"0.6159037",
"0.61099666",
"0.6098468",
"0.5936506",
"0.58881086"... | 0.87329006 | 0 |
get category of node jid:: [Jabber::JID] node:: [String] | def category(jid,node)
info = get_info(jid,node)
return info['category']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_category_link(node)\n { name: get_name(node.at_css('.name')), path: get_link_path(node[:href]) }\n end",
"def category\n data['category']\n end",
"def category\n @data['category']\n end",
"def category\n if self.channel.generator == 'Twitter'\n return self.... | [
"0.68407494",
"0.63836503",
"0.63089216",
"0.62013936",
"0.61375725",
"0.61314416",
"0.60933083",
"0.605212",
"0.605212",
"0.605212",
"0.605212",
"0.605212",
"0.605212",
"0.60082036",
"0.59894645",
"0.5987262",
"0.598687",
"0.5973473",
"0.59234804",
"0.591095",
"0.59029025",
... | 0.8869419 | 0 |
Make sure we have STREAMLINED_RAILS_ROOT set will try to find it dynamically if its not set. | def set_STREAMLINED_RAILS_ROOT
if Object.const_defined?("STREAMLINED_RAILS_ROOT")
STREAMLINED_RAILS_ROOT
else
Object.const_set("STREAMLINED_RAILS_ROOT", find_STREAMLINED_RAILS_ROOT_dir)
end
raise("Must have a valid STREAMLINED_RAILS_ROOT.") unless Object.const_defined... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rails_root\n if defined?(::Rails.root)\n return ::Rails.root.to_s if ::Rails.root\n raise \"ERROR: Rails.root is nil!\"\n end\n return RAILS_ROOT.to_s if defined?(RAILS_ROOT)\n nil\n end",
"def root\n Rails.root || Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n en... | [
"0.72183746",
"0.68962425",
"0.68962425",
"0.68138",
"0.68030584",
"0.67660505",
"0.66772735",
"0.6530022",
"0.6484548",
"0.63364697",
"0.62463677",
"0.6119604",
"0.60777116",
"0.60578316",
"0.60528725",
"0.60515",
"0.60515",
"0.6023243",
"0.60009897",
"0.60005575",
"0.600037... | 0.8226965 | 0 |
Write out a file which is loaded later, so that the RAILS_GEM_VERSION gets set in the correct process | def write_rails_gem_version_file(version)
File.open(rails_gem_version_file, 'w') do |file|
file << %|RAILS_GEM_VERSION = '#{version}' unless Object.const_defined?("RAILS_GEM_VERSION")|
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write\n content = to_s\n\n File.open \"#{@gem_deps_file}.lock\", 'w' do |io|\n io.write content\n end\n end",
"def write\n File.open('Gemfile', 'w') do |f|\n f.write(content)\n end\n end",
"def write\n File.open('Gemfile', 'w') do |f|\n f.write(con... | [
"0.6865578",
"0.6657455",
"0.6657455",
"0.6624227",
"0.6281066",
"0.60297686",
"0.59963876",
"0.5987282",
"0.59820974",
"0.5865779",
"0.5766378",
"0.57543117",
"0.57420784",
"0.5667098",
"0.56536",
"0.5546756",
"0.553967",
"0.55302864",
"0.55021375",
"0.5487841",
"0.5445968",... | 0.7153641 | 0 |
GET /documentos GET /documentos.xml | def index
@documentos = @externo.documentos.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @documentos }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end",
"def service_document\n response = get(@url.to_s)\n response.body\n end",
... | [
"0.71858346",
"0.7032579",
"0.6892714",
"0.6704844",
"0.66892666",
"0.66379744",
"0.6627161",
"0.65888304",
"0.6448825",
"0.64487404",
"0.6425076",
"0.64100784",
"0.6401414",
"0.63575184",
"0.63575184",
"0.635685",
"0.6335745",
"0.6328531",
"0.6301508",
"0.62820315",
"0.62753... | 0.7215051 | 0 |
DELETE /documentos/1 DELETE /documentos/1.xml | def destroy
@documento = @externo.documentos.find(params[:id])
@documento.destroy
respond_to do |format|
format.html { redirect_to(documentos_url(@externo)) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @client.delete_document(@path)\n end",
"def destroy\n @document.d... | [
"0.75412756",
"0.741379",
"0.74120855",
"0.71811444",
"0.71562517",
"0.71535236",
"0.71535236",
"0.71535236",
"0.7149939",
"0.7149939",
"0.70999223",
"0.7079488",
"0.7049431",
"0.7014393",
"0.6995087",
"0.6973359",
"0.6968382",
"0.696007",
"0.6925395",
"0.69157964",
"0.691129... | 0.7418337 | 1 |
Find or build our singleton card model. | def default_card_model_for_spec
model = CardModel.where(short_name: "basic").first
unless model
attrs = FactoryGirl.attributes_for(:card_model, name: "SRS Collector Basic",
short_name: "basic")
model = create_default_card_model_from_attrs(attrs)
end
model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_cloze_card_model_for_spec\n model = CardModel.where(short_name: \"cloze\").first\n unless model\n attrs = FactoryGirl.attributes_for(:card_model, name: \"SRS Collector Cloze\",\n short_name: \"cloze\", cloze: true)\n model = create_default_card_model_from_a... | [
"0.65367997",
"0.6340905",
"0.6055242",
"0.604925",
"0.59937525",
"0.59937525",
"0.5916966",
"0.5916966",
"0.5897359",
"0.5862873",
"0.584363",
"0.5833724",
"0.574024",
"0.5713787",
"0.5704573",
"0.56482106",
"0.5581003",
"0.55750346",
"0.55750346",
"0.55750346",
"0.55750346"... | 0.6796862 | 0 |
Find or build our cloze card model. | def default_cloze_card_model_for_spec
model = CardModel.where(short_name: "cloze").first
unless model
attrs = FactoryGirl.attributes_for(:card_model, name: "SRS Collector Cloze",
short_name: "cloze", cloze: true)
model = create_default_card_model_from_attrs(attrs)
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_card_model_for_spec\n model = CardModel.where(short_name: \"basic\").first\n unless model\n attrs = FactoryGirl.attributes_for(:card_model, name: \"SRS Collector Basic\",\n short_name: \"basic\")\n model = create_default_card_model_from_attrs(attrs)\n end\... | [
"0.62174684",
"0.5954965",
"0.56818",
"0.56025106",
"0.55508214",
"0.55204546",
"0.54693365",
"0.54450476",
"0.54379785",
"0.5414182",
"0.5409363",
"0.54047793",
"0.5359502",
"0.5359502",
"0.5351237",
"0.53455245",
"0.53320855",
"0.53161085",
"0.52722895",
"0.52669096",
"0.52... | 0.7207928 | 0 |
GET /nxtvisits GET /nxtvisits.json | def index
@nxtvisits = Nxtvisit.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end",
"def index\r\n @visits = Visit.fetch_ordered_by_page(params[\"page\"], [], 'started_at DESC')\r\n end"... | [
"0.6610578",
"0.6581575",
"0.6388169",
"0.61742324",
"0.61404854",
"0.612855",
"0.6073676",
"0.5985716",
"0.59504163",
"0.59470075",
"0.5933417",
"0.5916322",
"0.5916322",
"0.5916322",
"0.58892375",
"0.57627386",
"0.5721888",
"0.5697072",
"0.5696667",
"0.56760997",
"0.5657586... | 0.7394193 | 0 |
POST /nxtvisits POST /nxtvisits.json | def create
@nxtvisit = Nxtvisit.new(nxtvisit_params)
respond_to do |format|
if @nxtvisit.save
format.html { redirect_to @nxtvisit, notice: 'Nxtvisit was successfully created.' }
format.json { render :show, status: :created, location: @nxtvisit }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @nxtvisits = Nxtvisit.all\n end",
"def set_nxtvisit\n @nxtvisit = Nxtvisit.find(params[:id])\n end",
"def increment\n self.visits = self.visits.to_i.next\n self.save\n end",
"def add_visit\n self.increment!(:visits, 1)\n end",
"def nxtvisit_params\n params.requi... | [
"0.6839659",
"0.65972775",
"0.6089885",
"0.60495687",
"0.5931454",
"0.5883615",
"0.57058656",
"0.56584764",
"0.5651677",
"0.56318384",
"0.55940735",
"0.5555246",
"0.55377597",
"0.5465727",
"0.5459281",
"0.5444458",
"0.5418729",
"0.540462",
"0.53848076",
"0.5351854",
"0.534815... | 0.6816959 | 1 |
PATCH/PUT /nxtvisits/1 PATCH/PUT /nxtvisits/1.json | def update
respond_to do |format|
if @nxtvisit.update(nxtvisit_params)
format.html { redirect_to @nxtvisit, notice: 'Nxtvisit was successfully updated.' }
format.json { render :show, status: :ok, location: @nxtvisit }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n if @visit.update_attributes(params[:visit])\n format.json { head :no_content }\n else\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateView p... | [
"0.6333736",
"0.6249016",
"0.6229776",
"0.62230897",
"0.59946257",
"0.59866214",
"0.59496194",
"0.59115297",
"0.59058213",
"0.59058213",
"0.5892809",
"0.58732337",
"0.58732337",
"0.58345795",
"0.58300066",
"0.5810631",
"0.5766274",
"0.57525784",
"0.5742226",
"0.5733281",
"0.5... | 0.68525404 | 0 |
DELETE /nxtvisits/1 DELETE /nxtvisits/1.json | def destroy
@nxtvisit.destroy
respond_to do |format|
format.html { redirect_to nxtvisits_url, notice: 'Nxtvisit was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @visit.destroy\n\n head :no_content\n end",
"def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_t... | [
"0.67602515",
"0.6746663",
"0.6638839",
"0.66383827",
"0.6547205",
"0.6539039",
"0.6481973",
"0.64806956",
"0.64711404",
"0.6469435",
"0.6361739",
"0.6332939",
"0.6316387",
"0.63123083",
"0.6298596",
"0.62975454",
"0.62878287",
"0.62699556",
"0.62638927",
"0.62531805",
"0.625... | 0.70948815 | 0 |
Generate number to store | def generate_number(store)
store.number = loop do
random_number = Digest::SHA1.hexdigest([Time.now, rand].join)[0..5].upcase
break random_number unless Store.exists?(number: random_number)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number\n\t\"#{Time.now.to_i}-#{rand(1_000_000)}\"\n end",
"def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end",
"def gen_num\n rand(1..100)\nend",
"def generate_number\r\n \r\n #Generate and return a random number between 1 and 1000\r\n return randomNo = 1 + rand(1000)... | [
"0.7618458",
"0.7607903",
"0.7442947",
"0.74299455",
"0.7225794",
"0.71795154",
"0.71795154",
"0.7130239",
"0.70071536",
"0.7005386",
"0.6988783",
"0.6969458",
"0.69489324",
"0.6941181",
"0.6910955",
"0.6893728",
"0.6892594",
"0.681211",
"0.6806548",
"0.6804784",
"0.6801868",... | 0.7979872 | 0 |
This method replies to the user with the availabe pants pics through telegram API. | def start
send_message('Which pants do you like, dear customer?')
@items=Item.where("itemType = ?", "pants")
@items.each do |item|
send_photo({remote: item[:remotePath],local:item[:localPath]})
end
user.reset_next_bot_command
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reply_with_image(ev, opts={})\n return false unless tweet_pics\n opts = opts.clone\n\n if ev.is_a? Twitter::Tweet\n meta = meta(ev)\n\n if conversation(ev).is_bot?(ev.user.screen_name)\n log \"Not replying to suspected bot @#{ev.user.screen_name}\"\n return false\n end\n\n... | [
"0.5953998",
"0.58992505",
"0.58500993",
"0.56245244",
"0.55141944",
"0.54764736",
"0.54178745",
"0.540852",
"0.5360755",
"0.53578323",
"0.53225034",
"0.52988726",
"0.52816963",
"0.5262138",
"0.5245382",
"0.52416605",
"0.52360153",
"0.52175224",
"0.52166706",
"0.52020556",
"0... | 0.59254336 | 1 |
delete previous results from the Scenario. This only affects POM or cb_modeled scenarios, unless all = true is passed | def delete_previous_results(all = false)
if pom?
get_scenario_type_child_element.elements.delete("#{@ns}:AnnualSavingsSiteEnergy")
get_scenario_type_child_element.elements.delete("#{@ns}:AnnualSavingsCost")
get_scenario_type_child_element.elements.delete("#{@ns}:CalculationMethod")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n course_scenarios.destroy_all\n scenario= Course::Scenario.new\n scenario.main = true\n course_scenarios << scenario\n completed_courses.destroy_all\n end",
"def remove_all_diffs_and_tests\n UiChanged::Screenshot.remove_all_diffs_and_tests\n head :ok\n end",
"def abandon... | [
"0.6680054",
"0.60822105",
"0.60767525",
"0.60279495",
"0.6002915",
"0.597655",
"0.594171",
"0.5911147",
"0.59096795",
"0.5900241",
"0.58938926",
"0.588351",
"0.58821875",
"0.58785355",
"0.5838047",
"0.57850415",
"0.57697123",
"0.5761062",
"0.574422",
"0.5741942",
"0.5695875"... | 0.79123837 | 0 |
Check that the simulation was completed successfully. We check: out.osw completed_status == 'Success' finished.job file exists failed.job file doesn't exist eplusout.end and eplusout.err files | def simulation_success?
success = true
# Check out.osw
out_osw_file = File.join(get_osw_dir, @out_osw_file_name)
if !File.exist?(out_osw_file)
OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Scenario.simulation_success?', "Scenario ID: #{xget_id}. #{out_osw_file} does not exist.")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def communicate_complete\r\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now}\" }\r\n end",
"def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now} #{@op... | [
"0.6662183",
"0.6492353",
"0.6425984",
"0.635279",
"0.62600756",
"0.6240034",
"0.6186004",
"0.6080358",
"0.6064921",
"0.60522056",
"0.6026113",
"0.5914426",
"0.5894556",
"0.5889748",
"0.58598423",
"0.5838228",
"0.5833516",
"0.58246326",
"0.5823294",
"0.5807076",
"0.5800762",
... | 0.7817617 | 0 |
Use the bsync to openstudio resources map to add results from the openstudio simulations as new ResourceUse elements and objects | def os_add_resource_uses(results)
@results_json = results
ip_map = @bsync_openstudio_resources_map['IP']
os_results = @results_json['OpenStudioResults']
# Loop through ResourceUses in the resource_use_map
ip_map['ResourceUse'].each do |resource_use_map|
ru_type = resource_use_map[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def computeResourceUpdate(app_id, run_id, rid)\n resources = nutella.f.persist.get_run_mongo_object_store(app_id, run_id, 'resources')\n\n resource = resources[rid]\n\n if resource != nil\n if resource['proximity'] != nil\n if resource['proximity']['rid'] != nil\n baseStation = resources[resource... | [
"0.5848523",
"0.5745651",
"0.5575045",
"0.553042",
"0.5461438",
"0.5458224",
"0.5413059",
"0.540081",
"0.5354277",
"0.5349823",
"0.52992076",
"0.5236419",
"0.51763344",
"0.51729846",
"0.5166049",
"0.5157098",
"0.51399577",
"0.5137339",
"0.5105351",
"0.5093586",
"0.5076589",
... | 0.7098358 | 0 |
Get source energy and source EUI from | def get_source_energy_array(eplustbl_path)
# DLM: total hack because these are not reported in the out.osw
# output is array of [source_energy, source_eui] in kBtu and kBtu/ft2
result = []
File.open(eplustbl_path, 'r') do |f|
while line = f.gets
if /\<td align=\"right\"\>Total ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n @source ||= OE_SOURCE\n end",
"def get_heating_fuel_source()\n return \"Electricity\"\n end",
"def sources\n sources = %w(UPSLoad UPSBatteryCharge UPSBatteryVoltage UPSInputVoltage UPSOutputVoltage)\n return sources\n end",
"def source_event\n return @sour... | [
"0.6160136",
"0.5787401",
"0.5548034",
"0.54990774",
"0.54431325",
"0.53333616",
"0.5325269",
"0.53020847",
"0.5280929",
"0.5280929",
"0.5280929",
"0.5280929",
"0.52461433",
"0.52427644",
"0.52427644",
"0.5190607",
"0.5187315",
"0.51596916",
"0.5143398",
"0.51250255",
"0.5118... | 0.6754398 | 0 |
Inspects the current exports and prunes them if needs be | def prune_export_archives
current_exports = Dir.entries(@export_archive_directory).select do | directory |
directory.start_with?('export-')
end
unless current_exports.length <= @max_number_of_exports
sorted_exports = current_exports.sort
number_to_delete = current_exports.length - @max_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_all\n @exported_fields = nil\n end",
"def export_none\n @exported_fields = Set.new\n end",
"def pre_export\n end",
"def disable_imports_from(name)\n Autoproj.workspace.manifest.disable_imports_from(name)\nend",
"def list_exports(db)\n db.query(\"SEL... | [
"0.5661833",
"0.5486373",
"0.54308903",
"0.5420605",
"0.5263982",
"0.51636565",
"0.51297694",
"0.51297694",
"0.51297694",
"0.51297694",
"0.51297694",
"0.51273733",
"0.51235807",
"0.5107132",
"0.50787306",
"0.5075456",
"0.5068554",
"0.49900946",
"0.498866",
"0.49881774",
"0.49... | 0.6728706 | 0 |
post: given block by Auction Edge with an array that includes several problems that the company faces. Each index includes what the user input and the expected output. Any failed normalization will print what the expected output should be. | def given_block
examples = [
[{ :year => '2018', :make => 'fo', :model => 'focus', :trim => 'blank' },
{ :year => 2018, :make => 'Ford', :model => 'Focus', :trim => nil }],
[{ :year => '200', :make => 'blah', :model => 'foo', :trim => 'bar' },
{ :year => '200', :make => 'blah',... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess\r\n debug if @debug_enabled\r\n code = []\r\n if @zero_response_code_found || @valid_colors.empty? # empty check is necessary since not receiving response yet but in the future not, since code_found will go true prior to empty\r\n #Referee::CODE_LENGTH.times { code << Referee::VALID_COLORS[... | [
"0.50172836",
"0.497815",
"0.49396443",
"0.4936747",
"0.49000233",
"0.48890498",
"0.48742494",
"0.48079136",
"0.47914225",
"0.4782862",
"0.47752255",
"0.47371057",
"0.47203222",
"0.47183958",
"0.46823075",
"0.46803856",
"0.46763757",
"0.46733344",
"0.46678072",
"0.4656107",
"... | 0.50027186 | 1 |
post: Normalize the user's input by each field. It first checks if the year is in a valid range. Then checks if the make is a short hand or invalid input. After that, it normalizes the model and trim but does not check if its a valid input due to lack of database. It will also check if the user input the trim in the mo... | def normalize_data(input)
year = input[:year].to_i
return input unless validate_year(input, year)
input[:year] = year
make = validate_make(input[:make])
input[:make] = make
model_array = input[:model].split
model = model_array[0].downcase.capitalize
inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_input\n\t\t# to remove whitespace, use \n\t\t# self.<fieldname>.strip!\n\t\tself.homephone = self.homephone.gsub(/\\D/,'') if !self.homephone.blank?\n\t\tself.workphone = self.workphone.gsub(/\\D/,'') if !self.workphone.blank?\n\t\tself.cellphone = self.cellphone.gsub(/\\D/,'') if !self.cellphone.blan... | [
"0.59154296",
"0.56730974",
"0.55480564",
"0.5425078",
"0.5327186",
"0.52617353",
"0.52590126",
"0.5253342",
"0.52438915",
"0.5236428",
"0.5207812",
"0.5203405",
"0.51981217",
"0.5172387",
"0.51715976",
"0.5170815",
"0.5163782",
"0.51539725",
"0.51182884",
"0.5106181",
"0.510... | 0.81801295 | 0 |
pre: 1900 <= year <= 2 years in the future from today post: helper method that returns boolean if the user's input for the year field is a valid input. | def validate_year(input, year)
max_year = Date.today.year + 2
year <= max_year && year >= 1900
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_advent_year?(year:)\n min_year <= year && year <= max_year\n end",
"def could_be_year?(year); end",
"def valid?(v)\n year?(v)\n end",
"def year_not_valid?\n if (@year > 1899) && (@year < 2020)\n return false\n end\n return true\n end",
"def valid_year?(y, min, max)\n ... | [
"0.83498865",
"0.833881",
"0.8250188",
"0.821629",
"0.8157212",
"0.8054855",
"0.79400057",
"0.7796594",
"0.7776304",
"0.77209824",
"0.7662456",
"0.758908",
"0.7527669",
"0.7507579",
"0.7507042",
"0.7494964",
"0.74942535",
"0.7482238",
"0.7467762",
"0.7444489",
"0.7444278",
... | 0.85743964 | 0 |
pre: car make in set post: iterate through the set to find if user's input for "make" is a short hand of a make. It takes the first find that starts with user's input and returns it. If it can't find it then returns the original "make". | def validate_make(make)
unless @car_make.include?(make)
@car_make.each do |brand_name|
return brand_name if brand_name.start_with?(make.downcase.capitalize)
end
end
make
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_recipe_name_from_user\n puts \"\\nEnter a recipe name or ingredients you want to search by:\\n \".colorize(:green).bold\n find_by_name = gets.strip.downcase\n end",
"def find_the_cheese(ingredients)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n #I originally did it this way, but th... | [
"0.5747348",
"0.5457703",
"0.54568326",
"0.54191875",
"0.53959024",
"0.53902656",
"0.53746897",
"0.53736746",
"0.5339956",
"0.5316272",
"0.53094715",
"0.5307013",
"0.5300874",
"0.52551955",
"0.5252192",
"0.5250827",
"0.5242687",
"0.5236566",
"0.52340055",
"0.52175033",
"0.520... | 0.681642 | 0 |
Public: Initialize the Subscription. name A String with the subscription's name. service Backend service to delegate remote calls (optional). | def initialize(name, service=Azure::ServiceBus::Subscriptions)
@name = name
@requires_session = false
@default_ttl = nil
@lock_duration = nil
@service = service
yield self if block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscription(name = nil, &block)\n Subscription.new(name, &block)\n end",
"def subscription(id)\n Sensit::Api::Subscription.new id, @http_client\n end",
"def subscribe subscription_name, deadline: nil, endpoint: nil\n ensure_connection!\n options = { deadline: deadline, endpoi... | [
"0.77749056",
"0.7004892",
"0.6793441",
"0.6775132",
"0.6700686",
"0.6618364",
"0.66037023",
"0.6602604",
"0.6576571",
"0.6529217",
"0.6464186",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63953596",
"0.63... | 0.70682895 | 1 |
Public: Duration of the lock in seconds. Returns an Interval or nil. | def lock_duration
Core::Utils::Interval.try_convert(@lock_duration)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_duration\n to_interval description['LockDuration']\n end",
"def lock_duration=(interval)\n @lock_duration = Core::Utils::Interval.try_convert(interval)\n end",
"def lock_interval\n get_settings[:lock_interval]\n end",
"def duration_block_in_minutes\n 180\n ... | [
"0.8273685",
"0.74518394",
"0.730241",
"0.68421364",
"0.6699462",
"0.6526851",
"0.6465335",
"0.6456042",
"0.63635004",
"0.6341106",
"0.63007647",
"0.6300491",
"0.62533164",
"0.6229294",
"0.6217519",
"0.61821985",
"0.6170936",
"0.6150182",
"0.6131242",
"0.61268157",
"0.6067022... | 0.8462583 | 0 |
Public: Set the duration of the lock in seconds. Can go from 0 (unlocked) to 5 minutes. interval An Interval, or anything that can be converted into one. Returns an Interval or nil. | def lock_duration=(interval)
@lock_duration = Core::Utils::Interval.try_convert(interval)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock_interval= value\n put_settings(get_settings.tap {|s| s[:lock_interval] = value})\n end",
"def lock_duration\n to_interval description['LockDuration']\n end",
"def lock_duration\n Core::Utils::Interval.try_convert(@lock_duration)\n end",
"def lock_interval\n g... | [
"0.6676696",
"0.6656918",
"0.65920234",
"0.6120484",
"0.60727096",
"0.5941253",
"0.58293414",
"0.57360965",
"0.5680289",
"0.56358755",
"0.5614788",
"0.5612511",
"0.56057835",
"0.5521845",
"0.5461453",
"0.5445668",
"0.5445668",
"0.5445668",
"0.5445668",
"0.5445668",
"0.5389018... | 0.8266628 | 0 |
Public: Two subscriptions are the same if they belong to the same topic and have the same name. other A Subscription. Returns true|false. | def ==(other)
!topic.nil? && topic == other.topic && name == other.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equal?(other)\n return false unless type == other.type\n return false unless power == other.power\n return false unless prefix == other.prefix\n return true\n end",
"def subscribed?\n self.subscription == :subscribed\n end",
"def ==(other)\n stream == other.stream\n ... | [
"0.6033828",
"0.5848085",
"0.57856846",
"0.5785128",
"0.5771281",
"0.5767357",
"0.5748373",
"0.57390404",
"0.5703794",
"0.5699377",
"0.5692243",
"0.5691087",
"0.56694305",
"0.5667916",
"0.5654057",
"0.5650666",
"0.5650595",
"0.5648108",
"0.5611778",
"0.55983907",
"0.5598079",... | 0.7008898 | 0 |
GET /workstations GET /workstations.json | def index
@workstations = Workstation.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @workstations }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.7790177",
"0.73271435",
"0.726396",
"0.71110666",
"0.6936685",
"0.6877755",
"0.6781886",
"0.67519385",
"0.67466265",
"0.66952085",
"0.66898125",
"0.6679216",
"0.65364486",
"0.6534216",
"0.6500872",
"0.64452654",
"0.64443094",
"0.63698804",
"0.6369308",
"0.63606614",
"0.635... | 0.77352756 | 1 |
GET /workstations/1 GET /workstations/1.json | def show
@workstation = Workstation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @workstation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @workstations = Workstation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workstations }\n end\n end",
"def get_stations\n CF::Station.get(\"/lines/#{ACCOUNT_NAME}/#{self.title.downcase}/stations.json\")\n end",
"def index\n ... | [
"0.7616481",
"0.7329848",
"0.7111427",
"0.7038997",
"0.6676401",
"0.66429186",
"0.6615144",
"0.66098005",
"0.6587659",
"0.64476323",
"0.6411208",
"0.6410492",
"0.64068043",
"0.6391976",
"0.63895315",
"0.63631666",
"0.6292228",
"0.62901884",
"0.6289301",
"0.62885594",
"0.62871... | 0.73826814 | 1 |
GET /workstations/new GET /workstations/new.json | def new
@workstation = Workstation.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @workstation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @station }\n ... | [
"0.7309713",
"0.7309713",
"0.702844",
"0.7004942",
"0.6925511",
"0.687718",
"0.6870923",
"0.6870923",
"0.6870909",
"0.674607",
"0.66477853",
"0.66477853",
"0.6606419",
"0.66029537",
"0.6596822",
"0.6562584",
"0.65402985",
"0.6510327",
"0.65102965",
"0.64983636",
"0.64902",
... | 0.77160144 | 0 |
POST /workstations POST /workstations.json | def create
@workstation = Workstation.new(params[:workstation])
respond_to do |format|
if @workstation.save
format.html { redirect_to @workstation, notice: 'Workstation was successfully created.' }
format.json { render json: @workstation, status: :created, location: @workstation }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @station = Station.new(station_params)\n\n if @station.save\n render json: @station, status: :created, location: @station\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end",
"def create\n @station = Station.new(params[:station])\... | [
"0.6577693",
"0.6495141",
"0.6495141",
"0.6488403",
"0.6437134",
"0.643401",
"0.64202684",
"0.6366867",
"0.62979025",
"0.62887174",
"0.6204057",
"0.61266756",
"0.60243237",
"0.5992539",
"0.5991795",
"0.59893954",
"0.59762585",
"0.5971325",
"0.5968816",
"0.59497005",
"0.593588... | 0.71137375 | 0 |
PUT /workstations/1 PUT /workstations/1.json | def update
@workstation = Workstation.find(params[:id])
respond_to do |format|
if @workstation.update_attributes(params[:workstation])
format.html { redirect_to @workstation, notice: 'Workstation was successfully updated.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @station = Station.find(params[:id])\n\n if @station.update(station_params)\n head :no_content\n else\n render json: @station.errors, status: :unprocessable_entity\n end\n end",
"def update\n @station = Station.find(params[:id])\n\n respond_to do |format|\n... | [
"0.67549944",
"0.671394",
"0.671394",
"0.66943085",
"0.6457186",
"0.6426797",
"0.63163215",
"0.63095206",
"0.63010937",
"0.6268631",
"0.6253986",
"0.62493",
"0.6227921",
"0.6182325",
"0.6169688",
"0.61491644",
"0.61465055",
"0.613737",
"0.6120435",
"0.61090505",
"0.6108792",
... | 0.70329523 | 0 |
DELETE /workstations/1 DELETE /workstations/1.json | def destroy
@workstation = Workstation.find(params[:id])
@workstation.destroy
respond_to do |format|
format.html { redirect_to workstations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @station = Station.find(params[:id])\n @station.destroy\n\n respond_to do |format|\n format.html { redirect_to stations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_station = LineStation.find(params[:id])\n @line_station.destroy\n\n res... | [
"0.71774465",
"0.71660256",
"0.71323186",
"0.7013532",
"0.6927045",
"0.68557394",
"0.6840181",
"0.68007755",
"0.6794842",
"0.67904633",
"0.6785621",
"0.67818105",
"0.6756424",
"0.67547315",
"0.67542773",
"0.67409515",
"0.6728088",
"0.6707863",
"0.66983163",
"0.667049",
"0.665... | 0.7635412 | 0 |
initialize all fattrs so they exist, must be initialized | def init_fattrs
fattrs.each_with_index{|a,i| send "#{a}!"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preinitialize(attrs = nil)\n @attributes = {}\n end",
"def initialize_attributes(attributes); end",
"def initialize(attrs={})\n load_attributes!(attrs)\n end",
"def internal_file_attributes=(_arg0); end",
"def set_attrs\n @rrules ||= []\n @exrules ||= []\n @rdates ||=... | [
"0.73535997",
"0.7066043",
"0.6673732",
"0.66632783",
"0.6641497",
"0.6630497",
"0.65539825",
"0.6547504",
"0.65377414",
"0.65369415",
"0.65299904",
"0.64168674",
"0.6375498",
"0.63706696",
"0.63460934",
"0.6327822",
"0.6315172",
"0.627573",
"0.6265246",
"0.6264772",
"0.62590... | 0.831908 | 0 |
convert fattrs to a hash | def to_hash
fattrs.inject({}){|h,a| h.update a => send(a)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hashify_attributes(attrs)\n Hash.new.tap{ |h| attrs.each{|a| h[a] = self.send(a)} }\n end",
"def attr_hash(attrs)\n h = {}\n attrs.each {|k,v| h[k] = v}\n h\n end",
"def hash\n @attrs\n end",
"def coerce_attributes_to_hash(attrs)\n if ::Hash === attrs\n ... | [
"0.7130456",
"0.7062353",
"0.70575064",
"0.7009371",
"0.698642",
"0.6968277",
"0.6949936",
"0.6820338",
"0.6632017",
"0.6632017",
"0.6632017",
"0.6621736",
"0.6613554",
"0.6542526",
"0.65313965",
"0.6527276",
"0.65243995",
"0.6426404",
"0.64094776",
"0.63502645",
"0.6323471",... | 0.8744307 | 0 |
PATCH/PUT /conditions/1 PATCH/PUT /conditions/1.json | def update
respond_to do |format|
if @condition.update(condition_params)
format.html { redirect_to @condition, notice: 'Condition was successfully updated.' }
format.json { render :show, status: :ok, location: @condition }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @patient_condition = PatientCondition.find(params[:id])\n\n respond_to do |format|\n if @patient_condition.update_attributes(params[:patient_condition])\n format.html { redirect_to @patient_condition, :notice => 'Patient condition was successfully updated.' }\n format.json { h... | [
"0.63121855",
"0.61450505",
"0.6128404",
"0.6053128",
"0.6028158",
"0.60174304",
"0.60166556",
"0.59858334",
"0.5982612",
"0.59638965",
"0.5910101",
"0.5887888",
"0.5882397",
"0.58672047",
"0.5836101",
"0.5822649",
"0.5822113",
"0.58206826",
"0.58062613",
"0.5792578",
"0.5781... | 0.62965584 | 1 |
POST /before_and_afters POST /before_and_afters.json | def create
@before_and_after = BeforeAndAfter.new(before_and_after_params)
respond_to do |format|
if @before_and_after.save
format.html { redirect_to edit_before_and_after_path(@before_and_after), notice: 'Before and after was successfully created.' }
format.json { render :show, status: :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @before_and_after.update(before_and_after_params)\n format.html { redirect_to edit_before_and_after_path(@before_and_after), notice: 'Before and after was successfully updated.' }\n format.json { render :show, status: :ok, location: @before_and_after }... | [
"0.57538867",
"0.5690251",
"0.53703505",
"0.53461003",
"0.52132744",
"0.5183791",
"0.5160403",
"0.5098596",
"0.50355583",
"0.50259405",
"0.49924788",
"0.49883172",
"0.4984096",
"0.49726155",
"0.4961235",
"0.4909689",
"0.48790362",
"0.48790362",
"0.48741737",
"0.48628664",
"0.... | 0.70562947 | 0 |
PATCH/PUT /before_and_afters/1 PATCH/PUT /before_and_afters/1.json | def update
respond_to do |format|
if @before_and_after.update(before_and_after_params)
format.html { redirect_to edit_before_and_after_path(@before_and_after), notice: 'Before and after was successfully updated.' }
format.json { render :show, status: :ok, location: @before_and_after }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api... | [
"0.6111679",
"0.57828575",
"0.573637",
"0.5716403",
"0.56926185",
"0.56167865",
"0.56093097",
"0.5599894",
"0.5599894",
"0.5566443",
"0.5520212",
"0.55035096",
"0.5479664",
"0.5439667",
"0.542712",
"0.542009",
"0.5419549",
"0.5409688",
"0.53907543",
"0.53907543",
"0.535062",
... | 0.660983 | 0 |
DELETE /before_and_afters/1 DELETE /before_and_afters/1.json | def destroy
@before_and_after.destroy
respond_to do |format|
format.html { redirect_to before_and_afters_url, notice: 'Before and after was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.6661735",
"0.6406601",
"0.62212056",
"0.61819077",
"0.6145998",
"0.6141862",
"0.6135341",
"0.6114309",
"0.60968804",
"0.6065508",
"0.6065508",
"0.60641533",
"0.6047775",
"0.6022128",
"0.6012945",
"0.6012945",
"0.6008146",
"0.5983801",
"0.59800017",
"0.5971788",
"0.59703743... | 0.6883874 | 0 |
GET /goal_ints GET /goal_ints.json | def index
@goal_ints = GoalInt.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @performed_goal_ints = PerformedGoalInt.all\n end",
"def index\n @projection_goal_ints = ProjectionGoalInt.all\n end",
"def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end",
"def inde... | [
"0.72204006",
"0.70801824",
"0.6494995",
"0.64922506",
"0.64858246",
"0.64454675",
"0.6412546",
"0.63374424",
"0.63217956",
"0.63077885",
"0.6293822",
"0.6216855",
"0.6216855",
"0.6216855",
"0.6216855",
"0.62070453",
"0.62055296",
"0.6142451",
"0.61173064",
"0.6098777",
"0.60... | 0.76579136 | 0 |
POST /goal_ints POST /goal_ints.json | def create
@goal_int = GoalInt.new(goal_int_params)
respond_to do |format|
if @goal_int.save
format.html { redirect_to @goal_int, notice: 'Goal int was successfully created.' }
format.json { render :show, status: :created, location: @goal_int }
else
format.html { render :new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @performed_goal_int = PerformedGoalInt.new(performed_goal_int_params)\n\n respond_to do |format|\n if @performed_goal_int.save\n format.html { redirect_to @performed_goal_int, notice: 'Performed goal int was successfully created.' }\n format.json { render :show, status: :creat... | [
"0.7234217",
"0.6678514",
"0.65555114",
"0.65201336",
"0.64975226",
"0.6345851",
"0.6332334",
"0.6215046",
"0.6202753",
"0.6152702",
"0.6117541",
"0.6105778",
"0.6104483",
"0.6065691",
"0.6052665",
"0.6036286",
"0.6036286",
"0.602497",
"0.6024231",
"0.6001516",
"0.59573746",
... | 0.7376378 | 0 |
PATCH/PUT /goal_ints/1 PATCH/PUT /goal_ints/1.json | def update
respond_to do |format|
if @goal_int.update(goal_int_params)
format.html { redirect_to @goal_int, notice: 'Goal int was successfully updated.' }
format.json { render :show, status: :ok, location: @goal_int }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end",
"def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attribute... | [
"0.7232825",
"0.6950684",
"0.68911546",
"0.6843126",
"0.6791363",
"0.67033976",
"0.664426",
"0.664426",
"0.664426",
"0.664426",
"0.664426",
"0.6615463",
"0.65996605",
"0.6591455",
"0.65883034",
"0.6569425",
"0.6538077",
"0.653237",
"0.6498296",
"0.6493168",
"0.6492347",
"0.... | 0.72415304 | 0 |
DELETE /goal_ints/1 DELETE /goal_ints/1.json | def destroy
@goal_int.destroy
respond_to do |format|
format.html { redirect_to goal_ints_url, notice: 'Goal int was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end",
"def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end",
"def... | [
"0.72845185",
"0.71682394",
"0.7160317",
"0.7160317",
"0.704592",
"0.7015976",
"0.70091176",
"0.7003234",
"0.69924057",
"0.6946934",
"0.6906167",
"0.6871505",
"0.68407613",
"0.6824434",
"0.6786316",
"0.6760621",
"0.6760621",
"0.6760621",
"0.6760621",
"0.6760621",
"0.6760621",... | 0.7403773 | 0 |
SELL_IN DECREASE BY 1 EACH | def decrease_sell_in(item)
item.sell_in -= 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def single_sell_in_day_remover(item)\r\n item.sell_in -= 1\r\n end",
"def snooze\n # puts \"inside snooze\"\n @min += 1\n end",
"def up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n #@oldindex = @current_index if num > 10\n @current_index -= num\n #unless is_visible... | [
"0.59560764",
"0.5747966",
"0.5593629",
"0.5592725",
"0.55175006",
"0.5465213",
"0.54501885",
"0.54424226",
"0.5425862",
"0.5412313",
"0.5407995",
"0.53988826",
"0.53833455",
"0.535728",
"0.5344444",
"0.53325844",
"0.5315813",
"0.53114885",
"0.5303417",
"0.5300324",
"0.527644... | 0.61193997 | 0 |
QUALITY INCREASE BY 1 EACH | def increase_quality_by1(item)
item.quality += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality(factor=0.8)\n @quality = factor\n end",
"def quality\n base.quality\n end",
"def decrease_quality_by1(item)\n if item.quality > @min_quality # ENSURE QUALITY NEVER NEGATIVE\n item.quality -= 1\n end\n end",
"def update_quality(item)\n item.quality = 0 if item.quali... | [
"0.7054123",
"0.6993219",
"0.6822578",
"0.67219925",
"0.6653123",
"0.6618555",
"0.6592288",
"0.6530273",
"0.65247995",
"0.65101624",
"0.6498926",
"0.64848703",
"0.6400935",
"0.62907463",
"0.62851703",
"0.6235163",
"0.6227098",
"0.6196463",
"0.6192559",
"0.6187258",
"0.6150564... | 0.7131647 | 0 |
QUALITY DECREASE BY 1 EACH | def decrease_quality_by1(item)
if item.quality > @min_quality # ENSURE QUALITY NEVER NEGATIVE
item.quality -= 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_quality_by1(item)\n item.quality += 1\n end",
"def quality(factor=0.8)\n @quality = factor\n end",
"def quality\n base.quality\n end",
"def update_quality(item)\n item.quality = 0 if item.quality < 0\n item.quality = 50 if item.quality > 50\n end",
"def update_e_fact... | [
"0.6996854",
"0.6870985",
"0.6769688",
"0.6688951",
"0.6523381",
"0.6510225",
"0.6490442",
"0.64014775",
"0.64010394",
"0.632908",
"0.63181925",
"0.62784785",
"0.6257436",
"0.6199227",
"0.6182658",
"0.61362934",
"0.6118675",
"0.6113451",
"0.6078159",
"0.6058448",
"0.6001818",... | 0.7253094 | 0 |
only one of our metrics requires pluralization, the :warning metric. Take care of this in the function below. | def pluralize(num, item)
if item == :warning && num != 1
"#{num} Warnings"
else
"#{num} #{item.capitalize}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluralize( name )\n warn_nyi( \"support for pluralization guides in pluralize()\" )\n return name.pluralize\n end",
"def default_pluralizer(count)\n count == 1 ? :one : :other\n end",
"def pluralize\n self[-1] == 's' ? \"#{self}es\" : \"#{self}s\"\n end",
"def plu... | [
"0.64491963",
"0.63392675",
"0.6293652",
"0.6247277",
"0.6247003",
"0.6219405",
"0.6182249",
"0.61819786",
"0.61777186",
"0.61582696",
"0.6099383",
"0.6024957",
"0.60110766",
"0.6007834",
"0.60035664",
"0.6003027",
"0.5986212",
"0.5959274",
"0.5945813",
"0.5940589",
"0.593985... | 0.73473656 | 0 |
Public: Overwrite default to_json to User Model, so that devise includes OAuth Joins arg any: field from devise, unused | def to_json(arg = nil)
self.as_json(include: [:authentications]).to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options={})\n super(include: :user)\n end",
"def to_json(options={})\n options[:except] ||= ConfigCenter::User::ExcludedJsonAttributes\n super(options)\n end",
"def user_hack\n user.as_json\n end",
"def to_json(options={})\n\t\toptions[:except] ||= [:hashed_password, :salt]\n\t\tsu... | [
"0.71341866",
"0.70808053",
"0.7068627",
"0.68600327",
"0.6815716",
"0.6815716",
"0.6595745",
"0.6571075",
"0.6504977",
"0.6501174",
"0.6470743",
"0.6451938",
"0.6425361",
"0.6421217",
"0.6420748",
"0.6406589",
"0.6406589",
"0.6397526",
"0.63963795",
"0.63810474",
"0.6375172"... | 0.7097229 | 1 |
Public: import user's friends from facebook fb_user_info Hash: OAuth Facebook data | def add_fb_friends(fb_user_info)
friend_ids = self.friends.pluck(:id)
(fb_user_info ||= []).each do |index, friend|
auth = UserAuthentication.find_by(provider: "facebook", uid: friend['id'])
user_friend = auth.user if auth
if user_friend && !(friend_ids.include? user_friend.id)
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_facebook_friends(facebook_user)\n #facebook_user.friends.collect(&:id).each do |friend_id|\n # unless self.facebook_friends.collect(&:facebook_id).include?(friend_id.to_s)\n # self.facebook_friends.create!(:facebook_id => friend_id)\n # end\n #end\n end",
"def get_friends(id)\n ... | [
"0.71848625",
"0.65524864",
"0.6412855",
"0.6394703",
"0.634335",
"0.6287951",
"0.62119144",
"0.6190483",
"0.6183542",
"0.61683387",
"0.611211",
"0.6107078",
"0.6083405",
"0.6080898",
"0.60692286",
"0.6063512",
"0.60008925",
"0.59932965",
"0.5979073",
"0.5976988",
"0.59743214... | 0.7482905 | 0 |
Instantiates a Vector2d Vector2d(2, 3) => Vector2d(2,3) | def Vector2d(*args)
Vector2d.parse(*args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector2 xopr = [0, 0], y = nil\n\tVec2d.new xopr, y\nend",
"def * ( *vector_or_number ); v = Vector2d::new( vector_or_number ); Vector2d.new( @x * v.x, @y * v.y ); end",
"def soustraction( vector2 )\n i = vector2.i - @i\n j = vector2.j - @j\n pt = Point2D.new(i, j)\n vectorSoust = Vector2D.new(... | [
"0.80237746",
"0.73888063",
"0.7224675",
"0.7145091",
"0.71065575",
"0.6752302",
"0.6635237",
"0.6612807",
"0.6470295",
"0.6329261",
"0.62708586",
"0.61228967",
"0.6099283",
"0.6086593",
"0.6043272",
"0.6031019",
"0.601888",
"0.59616774",
"0.59468424",
"0.5932164",
"0.5927229... | 0.748991 | 1 |
Ajax call from view to local domains records from wmap data file | def load_file
data = ''
#@file = Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('data', 'domains')
@file = Rails.root.join('shared','data','domains')
file = File.open(@file, 'r')
file.each_line { |line| data += line }
file.close
render plain: data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_domains\n render json: dme.show_domains\n end",
"def client_outlets\n @entries = Outlet.where(location_id: params[:location]) if request.xhr? \n end",
"def ajax_find_by_ln\n \t@listing = Listing.where(:LN => params[:ln]).first\n \tputs @listing.inspect\n \t\n \t# get gmap for the property loc... | [
"0.5459551",
"0.533052",
"0.5327",
"0.5320967",
"0.52777284",
"0.5267851",
"0.5267831",
"0.52113396",
"0.5203158",
"0.5202309",
"0.52016014",
"0.5175697",
"0.5167001",
"0.51462406",
"0.5121233",
"0.5112054",
"0.51080155",
"0.50791824",
"0.5057891",
"0.50374365",
"0.5036552",
... | 0.5560331 | 0 |
Save the properties back to file | def save
file = File.new(@file, 'w+')
@properties.each { |key, value| file.puts "#{key}=#{value}\n" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\n file.close\n end",
"def save\n file = File.new(@file,\"w+\")\n @properties.each {|key,value| file.puts \"#{key}=#{value}\\n\" }\nend",
"def save filename\n File.open(filename, 'w') { |fi... | [
"0.8441881",
"0.8173245",
"0.80819947",
"0.7161865",
"0.7098612",
"0.7059542",
"0.70456755",
"0.7007282",
"0.6993434",
"0.6984136",
"0.6939637",
"0.67711157",
"0.67557836",
"0.67557836",
"0.6670473",
"0.6650842",
"0.6626342",
"0.6620851",
"0.65961033",
"0.6574523",
"0.6572990... | 0.8571951 | 0 |
GET /props/1 GET /props/1.xml | def show
@prop = Prop.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @prop }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def propfind\n unless(resource.exist?)\n NotFound\n else\n unless(request_document.xpath(\"//#{ns}propfind/#{ns}allprop\").empty?)\n properties = resource.properties\n else\n check = request_document.xpath(\"//#{ns}propfind\")\n if(check && !check.empty?)\n... | [
"0.65769917",
"0.62314904",
"0.61853576",
"0.61818063",
"0.6178109",
"0.6120502",
"0.6090912",
"0.6084077",
"0.60582423",
"0.60559237",
"0.6045813",
"0.6043409",
"0.60164976",
"0.59388036",
"0.59353125",
"0.59200543",
"0.5894036",
"0.58256835",
"0.57761514",
"0.57730675",
"0.... | 0.6643167 | 0 |
GET /props/new GET /props/new.xml | def new
@prop = Prop.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @prop }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @prop = Prop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prop }\n end\n end",
"def new\n @property = Property.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @property }\n end... | [
"0.7073214",
"0.6908684",
"0.6853301",
"0.68134475",
"0.6657807",
"0.6604376",
"0.643892",
"0.6366629",
"0.63599616",
"0.63599616",
"0.63599616",
"0.63599616",
"0.63599616",
"0.63300335",
"0.631822",
"0.6312281",
"0.62574273",
"0.6227013",
"0.62264663",
"0.62051904",
"0.62041... | 0.75010633 | 0 |
POST /props POST /props.xml | def create
@prop = Prop.new(params[:prop])
respond_to do |format|
if @prop.save
format.html { redirect_to(@prop, :notice => 'Prop was successfully created.') }
format.xml { render :xml => @prop, :status => :created, :location => @prop }
else
format.html { render :action => ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @prop = Prop.new(prop_params)\n\n respond_to do |format|\n if @prop.save\n format.html { redirect_to @prop, notice: \"Prop was successfully created.\" }\n format.json { render :show, status: :created, location: @prop }\n else\n format.html { render :new, status: :u... | [
"0.6160132",
"0.5856861",
"0.5836709",
"0.57504433",
"0.5737928",
"0.5737696",
"0.57074213",
"0.5699474",
"0.56149",
"0.56014514",
"0.55869925",
"0.5565783",
"0.55633545",
"0.5550407",
"0.551221",
"0.5485533",
"0.5467124",
"0.546324",
"0.54623747",
"0.54615444",
"0.54462284",... | 0.63385546 | 0 |
PUT /props/1 PUT /props/1.xml | def update
@prop = Prop.find(params[:id])
respond_to do |format|
if @prop.update_attributes(params[:prop])
format.html { redirect_to(@prop, :notice => 'Prop was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xm... | {
"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 relationship_set_props id, data\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n 'Content-Type' => 'application/json',\n }\n\n put_request '... | [
"0.6554309",
"0.61925215",
"0.61655366",
"0.6137877",
"0.6130674",
"0.6121985",
"0.611876",
"0.60821706",
"0.607247",
"0.59993976",
"0.5960221",
"0.5932568",
"0.5905189",
"0.5895808",
"0.5895808",
"0.5895808",
"0.5895808",
"0.5895808",
"0.58244616",
"0.58094925",
"0.5787585",... | 0.6588616 | 0 |
DELETE /props/1 DELETE /props/1.xml | def destroy
@prop = Prop.find(params[:id])
@prop.destroy
respond_to do |format|
format.html { redirect_to(props_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @prop = Prop.find(params[:id])\n @prop.destroy\n\n respond_to do |format|\n format.html { redirect_to props_url }\n format.json { head :no_content }\n end\n end",
"def del_property( propname )\n resp = conn.delete('/users/'+name+'/props/'+propname+'/')\n \n case resp... | [
"0.69108087",
"0.6645465",
"0.6638766",
"0.6620467",
"0.6549761",
"0.6502345",
"0.6496814",
"0.644634",
"0.6333346",
"0.6329927",
"0.6264069",
"0.62566876",
"0.62515366",
"0.6250383",
"0.6236447",
"0.6220132",
"0.61992085",
"0.6178911",
"0.6163325",
"0.61156076",
"0.61019534"... | 0.73558015 | 0 |
GET /consumos/1 GET /consumos/1.json | def show
@consumo = Consumo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @consumo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end",
"def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { r... | [
"0.7344974",
"0.7049484",
"0.67957336",
"0.66045916",
"0.6503398",
"0.6468972",
"0.64247805",
"0.63227403",
"0.6301885",
"0.6298565",
"0.6265127",
"0.6235962",
"0.6222219",
"0.6192751",
"0.61885494",
"0.6185857",
"0.6175878",
"0.61412615",
"0.6128821",
"0.6128499",
"0.611804"... | 0.71508497 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.