query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
Sets the exchangeAlias property value. An alias assigned to the Exchange server | def exchange_alias=(value)
@exchange_alias = value
end | [
"def alias_=(value)\n @alias_ = value\n end",
"def exchange_alias\n return @exchange_alias\n end",
"def set_AccountAlias(value)\n set_input(\"AccountAlias\", value)\n end",
"def alias_\n @alias_\n end",
"def domain_mailbox_alias_set(domain, mailbox, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the exchangeConnectorType property value. The type of Exchange Connector. | def exchange_connector_type
return @exchange_connector_type
end | [
"def exchange_connector_type=(value)\n @exchange_connector_type = value\n end",
"def connector_type\n cable.connector_types[self.end - 1]\n end",
"def connector_types\n [connector_type_1, connector_type_2]\n end",
"def connector_class(connector_type)\n if VALID_CHALLENGE_T... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the exchangeConnectorType property value. The type of Exchange Connector. | def exchange_connector_type=(value)
@exchange_connector_type = value
end | [
"def exchange_connector_type\n return @exchange_connector_type\n end",
"def exchange_connectors=(value)\n @exchange_connectors = value\n end",
"def connection_type=(value)\n @connection_type = value\n end",
"def set_ConnectionType(v... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the exchangeOrganization property value. Exchange Organization to the Exchange server | def exchange_organization
return @exchange_organization
end | [
"def exchange_organization=(value)\n @exchange_organization = value\n end",
"def organization\n return @organization\n end",
"def organization_name\n return @organization_name\n end",
"def organization()\n @conf.key?(\"organiza... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the exchangeOrganization property value. Exchange Organization to the Exchange server | def exchange_organization=(value)
@exchange_organization = value
end | [
"def organization=(value)\n @organization = value\n end",
"def organization=(value)\n @organization = value\n end",
"def set_organization\n if current_user\n current_organization = Organization.find(current_user.organization_id)\n set_current_tenant(current_organiz... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the lastSyncDateTime property value. Last sync time for the Exchange Connector | def last_sync_date_time
return @last_sync_date_time
end | [
"def last_sync\n time_parser(self[:last_sync])\n end",
"def last_sync_date_time=(value)\n @last_sync_date_time = value\n end",
"def exchange_last_successful_sync_date_time\n return @exchange_last_successful_sync_date_time\n end",
"def last_sync\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the lastSyncDateTime property value. Last sync time for the Exchange Connector | def last_sync_date_time=(value)
@last_sync_date_time = value
end | [
"def exchange_last_successful_sync_date_time=(value)\n @exchange_last_successful_sync_date_time = value\n end",
"def last_sync=(value)\n @db['last_sync'] = value\n end",
"def on_premises_last_sync_date_time=(value)\n @on_premises_last_sync_date_time = value\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the primarySmtpAddress property value. Email address used to configure the Service To Service Exchange Connector. | def primary_smtp_address
return @primary_smtp_address
end | [
"def primary_smtp_address=(value)\n @primary_smtp_address = value\n end",
"def primary_email\n if self[\"gd$email\"]\n _email = self[\"gd$email\"].find { |e| e.primary == \"true\" }\n _email ? _email.address : nil\n else\n nil # no emails at all\n end\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the primarySmtpAddress property value. Email address used to configure the Service To Service Exchange Connector. | def primary_smtp_address=(value)
@primary_smtp_address = value
end | [
"def primary_smtp_address\n return @primary_smtp_address\n end",
"def primary_email_address=(email)\n if new_record?\n self.set_email = email\n return\n end\n\n old_primaries = email_addresses.select { |email| email.primary == true }\n old_primaries.each do |old_pri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the serverName property value. The name of the Exchange server. | def server_name
return @server_name
end | [
"def name\n config.server_name\n end",
"def server_name=(value)\n @server_name = value\n end",
"def server_name\n return @forwarded_server || @config[:ServerName]\n end",
"def ServerName()\r\n ret = _getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Sets the serverName property value. The name of the Exchange server. | def server_name=(value)
@server_name = value
end | [
"def set_server_name; self.name = domain; end",
"def exchange_server=(value)\n @exchange_server = value\n end",
"def connector_server_name=(value)\n @connector_server_name = value\n end",
"def name=(name)\n update_server_data(name: name)\n end",
"d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
before_action :authenticate_user! GET /cords GET /cords.json | def index
@cords = Cord.all
@cords = Cord.user_cords(current_user)
end | [
"def getdoctors\n #verify user in slug is logged in\n token_passed = params[:token] unless params[:token].nil?\n patient = Patient.find_by_slug!(params[:patient_id])\n if my_encrypt(patient.remember_token) != token_passed\n redirect_to signin_path\n else\n allows_cors\n clinic = Clinic... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /cords POST /cords.json | def create
# @cord = Cord.new(cord_params)
@cord = @racquet.cords.new(cord_params)
@cord.user = current_user
respond_to do |format|
if @cord.save
format.html { redirect_to @cord, notice: t('cords.create.success') }
format.json { render :show, status: :created, location: @cord }
... | [
"def create\n @smschongzhirecord = Smschongzhirecord.new(smschongzhirecord_params)\n\n respond_to do |format|\n if @smschongzhirecord.save\n format.html { redirect_to @smschongzhirecord, notice: 'Smschongzhirecord was successfully created.' }\n format.json { render :show, status: :created, ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /cords/1 PATCH/PUT /cords/1.json | def update
respond_to do |format|
if @cord.update(cord_params)
format.html { redirect_to @cord, notice: t('cords.update.success') }
format.json { render :show, status: :ok, location: @cord }
else
format.html { render :edit }
format.json { render json: @cord.errors, status... | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch *args\n make_request :patch, *args\n end",
"def update\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n if @clonet.update_attributes(params[:clonet])\n format.ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /cords/1 DELETE /cords/1.json | def destroy
@cord.destroy
respond_to do |format|
format.html { redirect_to cords_url, notice: t('cords.destroy.success') }
format.json { head :no_content }
end
end | [
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discord_server.d... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /qa_games POST /qa_games.json | def create
@qa_game = QaGame.new(qa_game_params)
respond_to do |format|
if @qa_game.save
format.html { redirect_to @qa_game, notice: 'Qa game was successfully created.' }
format.json { render :show, status: :created, location: @qa_game }
else
format.html { render :new }
... | [
"def create\n game = Game.create(game_params)\n render json: game, status: 201\n end",
"def create\n g = SpreadapediaGames.new(params[:spreadapedia_games])\n g.line_result(params[:spreadapedia_games][:lresult])\n g.overunder_result(params[:spreadapedia_games][:ouresult])\n g.save()\n\n respo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /qa_games/1 PATCH/PUT /qa_games/1.json | def update
respond_to do |format|
if @qa_game.update(qa_game_params)
format.html { redirect_to @qa_game, notice: 'Qa game was successfully updated.' }
format.json { render :show, status: :ok, location: @qa_game }
else
format.html { render :edit }
format.json { render json... | [
"def update\n @game.update(game_params)\n render json: @game, status: 200\n end",
"def update\n @game.update!(game_params) # anticipated possible exceptions rescued in BaseController\n render json: @game, status: 200\n end",
"def update\n @spreadapedia_game = SpreadapediaGames.find(par... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /qa_games/1 DELETE /qa_games/1.json | def destroy
@qa_game.destroy
respond_to do |format|
format.html { redirect_to qa_games_url, notice: 'Qa game was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @spreadapedia_game = SpreadapediaGames.find(params[:id])\n @spreadapedia_game.destroy\n\n respond_to do |format|\n format.html { redirect_to spreadapedia_games_url }\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def long_question (quest_arr) result_arr = [] quest_arr.each do |x| if x.length > 15 result_arr << x end end return result_arr end method2 | def long_question (quest_arr)
quest_arr.select { |question| question.size > 15 }
end | [
"def question_length_method1(num)\n questions = []\n questions << \"What is your name?\"\n questions << \"How are you?\"\n questions << \"Is that right?\"\n questions << \"Are you John?\"\n questions << \"How is everything?\"\n\n print questions.select {|n| n.length > num}\nend",
"def long_strings(a); a.se... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /donation_lines/1 GET /donation_lines/1.json | def show
@donation_line = DonationLine.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @donation_line }
end
end | [
"def new\n @donation_line = DonationLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @donation_line }\n end\n end",
"def destroy\n @donation_line = DonationLine.find(params[:id])\n @donation_line.destroy\n\n respond_to do |format|\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /donation_lines/new GET /donation_lines/new.json | def new
@donation_line = DonationLine.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @donation_line }
end
end | [
"def new\n @line = Line.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @line }\n end\n end",
"def new\n @donation_line = DonationLine.new(:donation_id => params[:donation_id])\n\n respond_to do |format|\n format.html # new.html.erb\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /donation_lines POST /donation_lines.json | def create
@donation_line = DonationLine.new(params[:donation_line])
respond_to do |format|
if @donation_line.save
format.html { redirect_to @donation_line, notice: 'Donation line was successfully created.' }
format.json { render json: @donation_line, status: :created, location: @donation... | [
"def create\n \n @donation_line = DonationLine.new(params[:donation_line])\n \n respond_to do |format|\n if @donation_line.save\n \n format.html { redirect_to @donation_line }\n format.xml { render :xml => @donation_line, :status => :created, :location => @donation... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /donation_lines/1 PUT /donation_lines/1.json | def update
@donation_line = DonationLine.find(params[:id])
respond_to do |format|
if @donation_line.update_attributes(params[:donation_line])
format.html { redirect_to @donation_line, notice: 'Donation line was successfully updated.' }
format.json { head :ok }
else
format.ht... | [
"def update\n @donation_line = DonationLine.find(params[:id])\n\n respond_to do |format|\n if @donation_line.update_attributes(params[:donation_line])\n flash[:notice] = 'DonationLine was successfully updated.'\n format.html { redirect_to request.referrer }\n format.xml { head :ok }... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /donation_lines/1 DELETE /donation_lines/1.json | def destroy
@donation_line = DonationLine.find(params[:id])
@donation_line.destroy
respond_to do |format|
format.html { redirect_to donation_lines_url }
format.json { head :ok }
end
end | [
"def destroy\n @line = Line.find_by_no(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if this type is always going to have at least as many bytes as another type on all systems we care about. If you use this fact, you should probably emit an assumption to test it. | def as_many_bytes_as?(other)
type_id.abs >= other.type_id.abs # TODO: use possible_byte_sizes
end | [
"def more_bytes_than?(other)\n possible_byte_sizes.min > other.possible_byte_sizes.max\n end",
"def bytes?\n type == \"BYTES\"\n end",
"def full?\n self.size == 63\n end",
"def has_size?\n return method(:size).owner != CommonTraits ||\n method(:length).owner != Com... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if this type is always guaranteed to have more bytes than another. | def more_bytes_than?(other)
possible_byte_sizes.min > other.possible_byte_sizes.max
end | [
"def as_many_bytes_as?(other)\n type_id.abs >= other.type_id.abs # TODO: use possible_byte_sizes\n end",
"def have?(length)\n return length <= @buffer.bytesize \n end",
"def full?\n self.size == 63\n end",
"def have?(length)\n return length <= (@buffer.size - @buffer_offset)\n end",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a format string that will perform an arbitrary write using two separate short values | def generate_fmt_two_shorts(num_printed, write_to, write_what, targ = target)
arr = Array.new
arr << [ write_what & 0xffff, write_to ]
arr << [ write_what >> 16, write_to + 2 ]
stuff = fmtstr_gen_from_array(num_printed, arr, targ)
end | [
"def write_short(value)\n write_num 2, value\n self\n end",
"def write_short( *n )\n @content << n.pack( \"n*\" )\n end",
"def short(*shorts)\n format = ( little_endian? ? 'v*' : 'n*') \n return string(shorts.pack(format)) \n end",
"def write_short(obj)\n Rubinius.pri... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates and returns an array of what/where pairs from the supplied buffer | def fmtstr_gen_array_from_buf(write_to, buffer, targ = target)
# break buffer into shorts
arr = Array.new
off = 0
if ((buffer.length % 2) == 1)
buffer << rand_text(1)
end
while off < buffer.length
# convert short to number
tb = buffer[off,2].unpack('v')[0].to_i
#print_status("%d %d %d" % [off... | [
"def get_possible(coord, buffer)\n vps = view_path_coordinates[\"LonLat\"]\n vp1 = vps[0]\n vps = vps.drop(1)\n path = [vp1]\n points = []\n while (!vps.empty?) do\n vp2 = vps[0]\n vps = vps.drop(1)\n if (onLine(vp1, vp2, buffer, coord))\n dist = getPathDistance(path+[coord])... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generates a format string from an array of value/address pairs | def fmtstr_gen_from_array(num_printed, arr, targ = target)
num_pops = targ['NumPops']
num_pad = targ['PadBytes'] || 0
# sort the array -- for optimization
arr = arr.sort { |x,y| x[0] <=> y[0] }
# build up the addrs and fmts buffers
fmts = ""
addrs = ""
num = fmtstr_count_printed(num_printed, num_pad... | [
"def c_build_format_string(mne, tokens, field_format)\n fmt_a = []\n\n tokens.each{|t|\n if (field_format.include?(t))\n fmt_a << field_format[t][0]\n else\n fmt_a << t\n end\n }\n\n fmt_s = mne\n\n if (!fmt_a.empty?)\n fmt_s += ' ' + fmt_a.join\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate a fmt that will advance the printed count by the specified amount | def fmtstr_advance_count(prec)
# no need to advance :)
return "" if prec == 0
# asumming %x max normal length is 8...
if prec >= 8
return "%0" + prec.to_s + "x"
end
# anything else, we just put some chars in...
return rand_text(prec)
end | [
"def fmt_count\n sprintf('%13s', \"(#{@current}/#{@total})\")\n end",
"def format_gen gen,num_gen\n (\"%0#{@max_gen+(@max_gen-num_gen)}d\" % gen).gsub(/0/,' \n').gsub(/1/,'X')+\"\\n\"\n end",
"def print_cnter\n print \"#{@cntr}\"\n @cntr += 1\n if @cntr > 9 then\n @cntr = 0\n end\nend",
"de... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the index of any bad characters found in the supplied buffer. (NOTE: copied from encoder.rb) | def has_badchars?(buf, badchars)
badchars.each_byte { |badchar|
idx = buf.index(badchar.chr)
if (idx != nil)
return idx
end
}
return nil
end | [
"def has_badchars?(buf, badchars)\n badchars.each_byte { |badchar|\n idx = buf.index(badchar.chr)\n\n if (idx != nil)\n return idx\n end\n }\n\n return nil\n end",
"def find_bad_keys(buf, badchars)\n # Short circuit if there are no badchars\n return super if badchars.length =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /recycling_sites/1 GET /recycling_sites/1.xml | def show
@recycling_site = RecyclingSite.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @recycling_site }
end
end | [
"def index\n @selector_sites = SelectorSite.curr_ver.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @selector_sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /recycling_sites/new GET /recycling_sites/new.xml | def new
@recycling_site = RecyclingSite.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @recycling_site }
end
end | [
"def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => sites_path }\n end\n end",
"def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @site }\n end\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /recycling_sites POST /recycling_sites.xml | def create
@recycling_site = RecyclingSite.new(params[:recycling_site])
respond_to do |format|
if @recycling_site.save
flash[:notice] = 'RecyclingSite was successfully created.'
format.html { redirect_to(@recycling_site) }
format.xml { render :xml => @recycling_site, :status => :... | [
"def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n #Xpath.create :field_name => \"ref_code\", :xpath => \"none\", :site_id=>@site.id\n #Xpath.create :field_name => \"time_crawled\", :xpath => \"none\", :site_id=>@site.id\n format.html { redirec... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /recycling_sites/1 DELETE /recycling_sites/1.xml | def destroy
@recycling_site = RecyclingSite.find(params[:id])
@recycling_site.destroy
respond_to do |format|
format.html { redirect_to(recycling_sites_url) }
format.xml { head :ok }
end
end | [
"def destroy\n @scrap_xml = ScrapXml.find(params[:id])\n @scrap_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(scrap_xmls_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @site_reference = SiteReference.find(params[:id])\n @site_reference.destroy\n\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a found (or new) collection based on the collection fields and the submitter's email. | def collection
Rails.logger.info "XXXXX COLLECTION NAME #{collection_hash['collection name']}"
@collection ||= CollectionCreator.find_or_create_collection(
collection_hash['collection name'],
collection_hash['unit name'],
collection_hash['collection description'],
submitter_... | [
"def create_collection\n self.collections.create(:name => \"#{self.login_from_email}'s collection\")\n end",
"def new_collection\n Models::Collection.new\n end",
"def collection\n return nil unless collection_member?\n @collection ||= SolrDocument.new(\n Blacklight.solr.select(\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts collection fields into a hash. Similar to fields_to_hash, but collection fields do not have corresponding api field names, nor are any of them multivalued. | def collection_hash
collection_field_pairs = collection_fields.map do |field|
[ normalize_header(field.header), field.value ]
end
Hash[ collection_field_pairs ]
end | [
"def to_h\n @collection.to_hash\n end",
"def fields_hash\n each_pair.to_h\n end",
"def to_h\n hash = {}\n fields = rendering_fields\n fields.each do |field|\n hash[field.to_s] = __send__(field)\n end\n hash\n end",
"def custom_fields_to_hash\n ba... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts media object fields into a hash. | def media_object_hash
fields_to_hash media_object_fields
end | [
"def media_object_fields\n fields.select { |field| media_object_header?(field.header) }\n end",
"def to_h\n hash = {}\n fields = rendering_fields\n fields.each do |field|\n hash[field.to_s] = __send__(field)\n end\n hash\n end",
"def fields_hash\n each_pair.to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Selects media object fields. | def media_object_fields
fields.select { |field| media_object_header?(field.header) }
end | [
"def select(sobject, id, select, field = nil)\n path = if field\n \"sobjects/#{sobject}/#{field}/#{ERB::Util.url_encode(id)}\"\n else\n \"sobjects/#{sobject}/#{ERB::Util.url_encode(id)}\"\n end\n\n path = \"#{path}?fields=#{select.join(',')}\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Converts files/instantiation fields into hashes. | def file_hashes
@file_hashes ||= file_field_sets.map do |file_field_set|
instantiation_fields, file_fields = file_field_set.partition do |field|
instantiation_header?(field.header)
end
file_hash = fields_to_hash(file_fields)
file_hash['files'] = [fields_to_hash(instantia... | [
"def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end",
"def fields_hash\n each_pair.to_h\n end",
"def actual_fields(fields)\n Hash[*fields.each do |type, fields|\n [actual_type(type), fields.map { |f| actual_field(f, record_class(t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of arrays: groups of file/instantiation fields. | def file_field_sets
@file_field_sets ||= begin
# Select only file and instantiation fields.
file_and_instantiation_fields = fields.select { |field| file_header?(field.header) || instantiation_header?(field.header) }
# Slice the selected fields into field sets for each file.
file_a... | [
"def groups\n @fields.collect { |f| f.group } .compact.uniq\n end",
"def groups\n load_index\n g_num = FFI::MemoryPointer.new(:int)\n g_ptr = ti_seqname(t_file[:idx],g_num)\n return [] if g_ptr.null? || g_num.null?\n g_ptr.get_array_of_string(0, g_num.read_int).compact\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for multivalued fields, turns them into arrays, and combines all the values for the repeatable header. | def combine_multivalued_fields(uncombined_fields)
combined_fields = {}
uncombined_fields.each do |field|
normalized_header = normalize_header(field.header)
if multivalued?(normalized_header)
combined_fields[normalized_header] ||= Field.new(field.header, [])
combined_field... | [
"def prepare_fields_and_override_hashes fields\n\n fields = fields.dup\n one_per_request_count = 0\n\n fields.each_pair do |field, setup|\n if Hash === setup\n value = setup[:value]\n case setup[:type]\n\n when OnePerRequest\n\n one_per... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
quick check to see if this looks like a dotmation config file | def is_config?(data)
data.match(/dot|xdg/)
end | [
"def valid_config_file?(config)\n file_loadable?(config)\n file_extension?(config)\n true\n end",
"def check_config_format(config_path)\n $config = YAML::load(File.open(config_path))\n \n if !$config\n p \"Nothing in configuration. Exiting...\"\n exit 2\n elsif !$config['apps']\n p \"No app... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
given a filename, a url, or a github name, will read the config file. returns self | def set_from_config!(arg)
@config_data =
if arg.include?("://")
open(arg) {|io| io.read }
elsif File.exist?(arg)
@config_filename = arg
IO.read(arg)
else
url = "https://raw.github.com/#{arg}/#{DEFAULT_CONFIG_GITHUB_REPO}/master/#{DEFAULT_CONFIG_GITHUB_PATH}"
... | [
"def load_config\n begin\n config = YAML.load_file(file_path)\n rescue Errno::ENOENT\n nil\n end\n end",
"def initialize\n @config = config_from_file || empty_config\n end",
"def githubGetConfig\n @config = YAML::load_file($configPath)\n g = @con... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Find the median of two sorted arrays | def find_median(arr1, arr2)
# determine index value of median element
median_index = ((arr1.length + arr2.length) / 2.0).round
stitched = []
# merge in order until length of the merged and sorted array is enough to
# calculate the median
while arr1.length > 0 and arr2.length > 0 and stitched.length < med... | [
"def median_sorted_arrays_dc(arr1, arr2)\n size = arr1.size\n return -1 if size <= 0\n return (arr1.first+arr2.first)/2 if size == 1\n return ([arr1.first, arr2.first].max + [arr1[1], arr2[1]].min)/2 if size == 2\n pos_med1 = arr1.size/2\n pos_med2 = arr2.size/2\n # If both are equal even though we form a ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if it is not a mti_class do what you do else let the primary shard do the saving come back and cleanup | def create
return super unless mti_class?
shard_wrangler.cascade_save
ActiveRecord::IdentityMap.add(self) if ActiveRecord::IdentityMap.enabled?
@new_record = false
self.id
end | [
"def mti_class(primary_table = nil)\n raise(EmptyEye::AlreadyExtended, \"MTI class method already invoked\") if mti_class?\n self.primary_key = \"id\"\n @shard_wrangler = EmptyEye::ShardWrangler.create(self, primary_table)\n self.table_name = @shard_wrangler.compute_view_name\n be... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if it is not a mti_class do what you do else let the primary shard do the destruction come back and cleanup | def destroy
return super unless mti_class?
shard_wrangler.destroy
if ActiveRecord::IdentityMap.enabled? and persisted?
ActiveRecord::IdentityMap.remove(self)
end
@destroyed = true
freeze
end | [
"def delete\n return super unless mti_class?\n shard_wrangler.class.cascade_delete_all(:id => id)\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def mti_class(primary_table = nil)\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
if it is not a mti_class do what you do else let the primary shard do the deletion come back and cleanup | def delete
return super unless mti_class?
shard_wrangler.class.cascade_delete_all(:id => id)
if ActiveRecord::IdentityMap.enabled? and persisted?
ActiveRecord::IdentityMap.remove(self)
end
@destroyed = true
freeze
end | [
"def destroy\n return super unless mti_class?\n shard_wrangler.destroy\n if ActiveRecord::IdentityMap.enabled? and persisted?\n ActiveRecord::IdentityMap.remove(self)\n end\n @destroyed = true\n freeze\n end",
"def remove_content_shard content_shard, connection\n suc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
multi array ops on ruby arrays with same sizes | def multi_array_op(func, *args)
elem = args[0]
if elem.is_a?(Array)
elem.each_with_index.collect do |_item, index|
indexed_args = args.collect { |a| a = a.is_a?(Array) ? a : [a]; a[index] }
multi_array_op(func, *indexed_args)
end
else
func.ca... | [
"def cross_array(*enumerables)\n # return to_a.product(*enumerables.map{|e| e.to_a})\n enumerables.unshift self\n result = [[]]\n while !enumerables.empty?\n t, result = result, []\n b, *enumerables = enumerables\n t.each do |a|\n b.each do |n|\n result << a + [n]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
SF OpenData don't have rating for food trucks. We give random ratings for display purposes. | def rating
rand(40..140).to_s
end | [
"def rating; 7; end",
"def recommend\n @movies.reject(&:viewed?).sort_by { |m| [-m.rating * rand, m.class::WEIGHT * rand] }.first(5).each(&:description)\n end",
"def rating\n rating_calculator.rate(raters)\n end",
"def rating\n @rating ||= Elo.config.default_rating\n end",
"def r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /book_editions/1 GET /book_editions/1.json | def show
@book_edition = BookEdition.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @book_edition }
end
end | [
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def index\n @editions = Edition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @editions }\n end\n end",
"def start\n @editions = Edition.all\n\n respond_to do |... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /book_editions/new GET /book_editions/new.json | def new
@book_edition = BookEdition.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @book_edition }
end
end | [
"def new\n @project = Project.find_by_slug(params[:project_id])\n @edition = @project.editions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @edition }\n end\n end",
"def new\n @election = Election.new\n\n respond_to do |format|\n form... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /book_editions POST /book_editions.json | def create
@book_edition = BookEdition.new(params[:book_edition])
respond_to do |format|
if @book_edition.save
format.html { redirect_to @book_edition, notice: 'Book edition was successfully created.' }
format.json { render json: @book_edition, status: :created, location: @book_edition }
... | [
"def get_editions(params = {})\n get_json(get_editions_url(params))\n end",
"def start\n @editions = Edition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @editions }\n end\n end",
"def index\n @editions = Edition.all\n\n respond_to do |... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /book_editions/1 PUT /book_editions/1.json | def update
@book_edition = BookEdition.find(params[:id])
respond_to do |format|
if @book_edition.update_attributes(params[:book_edition])
format.html { redirect_to @book_edition, notice: 'Book edition was successfully updated.' }
format.json { head :no_content }
else
format.... | [
"def update\n @book_step = BookStep.find(params[:id])\n\n respond_to do |format|\n if @book_step.update_attributes(params[:book_step])\n format.html { redirect_to @book_step, notice: 'Book step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /book_editions/1 DELETE /book_editions/1.json | def destroy
@book_edition = BookEdition.find(params[:id])
@book_edition.destroy
respond_to do |format|
format.html { redirect_to book_editions_url }
format.json { head :no_content }
end
end | [
"def destroy\n @book_step = BookStep.find(params[:id])\n @book_step.destroy\n\n respond_to do |format|\n format.html { redirect_to book_steps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, @book_edition\n @book_edition.destroy\n respond_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /injurylocations POST /injurylocations.json | def create
@injurylocation = Injurylocation.new(injurylocation_params)
respond_to do |format|
if @injurylocation.save
format.html { redirect_to injurylocations_path, notice: 'Injurylocation was successfully created.' }
format.json { render :show, status: :created, location: @injurylocatio... | [
"def create\n @investigationinjurylocation = Investigationinjurylocation.new(investigationinjurylocation_params)\n\n respond_to do |format|\n if @investigationinjurylocation.save\n format.html { redirect_to @investigationinjurylocation.investigation, notice: 'Investigationinjurylocation was succes... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /injurylocations/1 PATCH/PUT /injurylocations/1.json | def update
respond_to do |format|
if @injurylocation.update(injurylocation_params)
format.html { redirect_to @injurylocation, notice: 'Injurylocation was successfully updated.' }
format.json { render :show, status: :ok, location: @injurylocation }
else
format.html { render :edit ... | [
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update\n respond_to do |format|\n if @investigationinjurylocation.update(investigationinjurylocation_params)\n format.html { redirect_to @investigationinjurylocation.investigation, notice: 'Investigati... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /injurylocations/1 DELETE /injurylocations/1.json | def destroy
@injurylocation.destroy
respond_to do |format|
format.html { redirect_to injurylocations_url, notice: 'Injurylocation was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @investigationinjurylocation.destroy\n respond_to do |format|\n format.html { redirect_to investigationinjurylocations_url, notice: 'Investigationinjurylocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = Location.fi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /run_types GET /run_types.json | def index
@run_types = RunType.all
end | [
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def types\n get(\"/project/types\")[\"types\"]\n end",
"def show\n @run_type = RunType.find(params[:id])\n\n respond_to do |f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /run_types POST /run_types.json | def create
@run_type = RunType.new(run_type_params)
respond_to do |format|
if @run_type.save
format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }
format.json { render :show, status: :created, location: @run_type }
else
format.html { render :new... | [
"def create\n @run_type = RunType.new(params[:run_type])\n\n respond_to do |format|\n if @run_type.save\n format.html { redirect_to @run_type, notice: 'Run type was successfully created.' }\n format.json { render json: @run_type, status: :created, location: @run_type }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /run_types/1 PATCH/PUT /run_types/1.json | def update
respond_to do |format|
if @run_type.update(run_type_params)
format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }
format.json { render :show, status: :ok, location: @run_type }
else
format.html { render :edit }
format.json { render... | [
"def update\n @run_type = RunType.find(params[:id])\n\n respond_to do |format|\n if @run_type.update_attributes(params[:run_type])\n format.html { redirect_to @run_type, notice: 'Run type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /run_types/1 DELETE /run_types/1.json | def destroy
@run_type.destroy
respond_to do |format|
format.html { redirect_to run_types_url, notice: 'Run type was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def delete_type(id)\n delete(\"/types/#{id}\")\n end",
"def destroy\n @runtype =... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a request to the transaction search endpoint of the API | def transaction_search(transaction_type, location)
result = transaction_request(transaction_type, location)
Responses::Transaction.new(JSON.parse(result.body))
end | [
"def transaction_request(transaction_type, location)\n result = @client.connection.get (PATH +\n ERB::Util.url_encode(transaction_type) + '/search'), location\n Error.check_for_error(result)\n result\n end",
"def search(params = {})\n commit('SearchTransactions'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Make a request to the transaction endpoint of the API The endpoint requires a format of /v3/transaction_search so the primary request parameter is concatenated. After getting the response back it's checked to see if there are any API errors and raises the relevant one if there is. | def transaction_request(transaction_type, location)
result = @client.connection.get (PATH +
ERB::Util.url_encode(transaction_type) + '/search'), location
Error.check_for_error(result)
result
end | [
"def transaction_search(transaction_type, location)\n result = transaction_request(transaction_type, location)\n Responses::Transaction.new(JSON.parse(result.body))\n end",
"def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n retu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get the list of target branches | def get_target_branches
unless @target_branches
fetch_all
base = @config['branches']['production']
allowed_branches = @config['branches'].values
allowed_branches << @config['prefixes']['release'] if @config['prefixes']['release']
banned_branches = ['HEAD']
target_br... | [
"def branches(target = nil)\n puts 'deploy.branches'\n @_branch_cache ||= {}\n if target == nil\n targets.flat_map do |target|\n branches(target)\n end\n else\n @_branch_cache[target] ||= deployer.branches(target)\n end\n end",
"def branches(ctx)\n output, status = ctx... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Waits for the variable called +name+ to be modified. | def variable(name)
Tk.execute_only(:tkwait, :variable, name)
end | [
"def assign_variable(value)\n name = value\nend",
"def change_name(new_name)\n\t\t@name = new_name\n\tend",
"def change_waiter_by_name(new_waiter_name)\n old_waiter = self.waiter\n new_waiter = Waiter.find_by(name: new_waiter_name)\n self.update(waiter_id: new_waiter.id )\n puts \"#... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Takes the +name+ of a window and waits for a change in its visibility state (as indicated by the arrival of a VisibilityNotify event). Typically used to wait for a newlycreated window to appear on the screen before taking some action. | def visibility(name)
Tk.execute_only(:tkwait, :visibility, name)
end | [
"def window(name)\n Tk.execute_only(:tkwait, :window, name)\n end",
"def open_dialog_with_click(win_name)\n wait_start\n click\n wait_for_window_shown(win_name)\n end",
"def wait_for_window(input, wait_time = 30)\n begin\n Timeout::timeout(wait_time) do\n loop do\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This method takes the name of a window as argument and waits until the window is destroyed. It is typically used to wait for a user to finish interacting with a dialog box before using the result of that interaction. | def window(name)
Tk.execute_only(:tkwait, :window, name)
end | [
"def close_dialog(dialog_name)\n wait_start\n opera_desktop_action(\"Cancel\")\n wait_for_window_close(dialog_name)\n end",
"def wait_for_popup window_id, timeout\r\n command 'waitForPopUp', window_id||'null', timeout\r\n end",
"def close_window_with_click(win_name)\n wait_start\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grue_room : string player_room : string edges : array of arrays each element has the form [room1, room2, direction] | def grue_path(grue_room, player_room, edges)
shortest_path = []
edges_to_check = edges.select do |arr|
arr.first == grue_room
end
unchecked_edges = edges - edges_to_check
edges_to_check.each do |e|
path = [e]
if e[1] != player_room
ne... | [
"def traverse room, direction\n case direction.to_sym\n when :right\n return @graph[room.coords[:y]][room.coords[:x] + 1] unless room.is_right?\n when :left\n return @graph[room.coords[:y]][room.coords[:x] - 1] unless room.is_left?\n when :up\n return @graph[room.coords[:y] - 1][room.coor... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the link tags for the css | def css_tags
css.map do |url|
"<link href=\"#{url}\" media=\"all\" rel=\"stylesheet\" type=\"text/css\" />"
end.join("\n")
end | [
"def link_tag_urls\n urls 'link', 'href'\n end",
"def sub_file_stylesheet_locs\n \"<link href=\\\"#{bootstrap_cdn}\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"../css/styles.css\\\" rel=\\\"stylesheet\\\">\n <link href=\\\"../css/rubyhighlights.css\\\" rel=\\\"stylesheet\\\">\"\n end",
"def ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns an array of all css files that should be included. | def css
css_files = []
@assets.each do |type, path|
case type
when :folder
# Don't import any css/scss files that start with an underscore, so scss partials
# aren't imported by default:
# http://sass-lang.com/guide
css_files += Dir["#{path}... | [
"def css_included\n res = \"\"\n \n singleton_methods(false).include?(\"include_css\") && include_css.each do |path|\n f = File.new(path)\n res << f.read << \"\\n\"\n end\n\n res\n end",
"def all_stylesheet_paths\n all_paths = []\n all_paths += @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
are we in the development environment? | def development?
env == 'development'
end | [
"def dev?\n @env == 'development'\n end",
"def dev_env?\n env == 'development'\n end",
"def in_dev?\n [:development, :dev, :test, :ci].include? environment\n end",
"def development?\n environment == :development\n end",
"def dev_or_test?\n development? || test?\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true if environment is development? or test? | def dev_or_test?
development? || test?
end | [
"def in_dev?\n [:development, :dev, :test, :ci].include? environment\n end",
"def development?\n env == 'development'\n end",
"def dev_env?\n env == 'development'\n end",
"def dev?\n @env == 'development'\n end",
"def development?\n environment == :development\n end",
"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
add custom configs before other things start | def setup(configs = nil)
return if @setup
@setup = true
@custom_configs = configs || []
end | [
"def setup_config\n # To be Extended\n end",
"def configure_extra(config)\n\nend",
"def config_hook\n end",
"def before_configuration_tasks \n end",
"def start_configuration; end",
"def post_configure\n # noop\n end",
"def before_configure(&block)\n _config_builder_class.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Obtain hash with access_token and refresh_token | def hash
return {} unless access_token && refresh_token
return {
'access_token' => access_token,
'refresh_token' => refresh_token
}
end | [
"def at_hash\n sha256 = Digest::SHA256.new\n token = @access_token.token\n hashed_token = sha256.digest(token)\n first_half = hashed_token[0...hashed_token.length / 2]\n Base64.urlsafe_encode64(first_half).tr('=', '')\n end",
"def build_token_hash\n { 'access_token... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /joineds GET /joineds.json | def index
@joineds = Joined.all
end | [
"def index\n @joinings = Joining.all\n end",
"def get_joined_rooms(**params)\n query = {}\n query[:user_id] = params.delete(:user_id) if protocol?(:AS) && params.key?(:user_id)\n\n request(:get, client_api_latest, '/joined_rooms', query: query)\n end",
"def index\n @joiners = Joiner.all\n end"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /joineds POST /joineds.json | def create
@joined = Joined.new(joined_params)
respond_to do |format|
if @joined.save
format.html { redirect_to @joined, notice: 'Joined was successfully created.' }
format.json { render :show, status: :created, location: @joined }
else
format.html { render :new }
fo... | [
"def create\n @joined_user = JoinedUser.new(joined_user_params)\n\n respond_to do |format|\n if @joined_user.save\n format.html { redirect_to @joined_user, notice: 'Joined user was successfully created.' }\n format.json { render :show, status: :created, location: @joined_user }\n else\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /joineds/1 PATCH/PUT /joineds/1.json | def update
respond_to do |format|
if @joined.update(joined_params)
format.html { redirect_to @joined, notice: 'Joined was successfully updated.' }
format.json { render :show, status: :ok, location: @joined }
else
format.html { render :edit }
format.json { render json: @jo... | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n # this action is not provided for partyroles\n end",
"def jsonapi_update\n _persist do\n jsonapi_resource.persist_with_relationships \\\n deserialized_params.meta,\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /joineds/1 DELETE /joineds/1.json | def destroy
@joined.destroy
respond_to do |format|
format.html { redirect_to joineds_url, notice: 'Joined was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @join = Join.find(params[:id])\n @join.destroy\n\n respond_to do |format|\n format.html { redirect_to joins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orphan.destroy\n respond_to do |format|\n format.html { redirect_to orphans_url }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /sales_forecasts POST /sales_forecasts.json | def create
@sales_forecast = SalesForecast.new(sales_forecast_params)
respond_to do |format|
if @sales_forecast.save
format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully created.' }
format.json { render :show, status: :created, location: @sales_forecast }
... | [
"def create\n @forecast = Forecast.new(params[:forecast])\n\n respond_to do |format|\n if @forecast.save\n format.html { redirect_to @forecast, notice: 'Forecast was successfully created.' }\n format.json { render json: @forecast, status: :created, location: @forecast }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /sales_forecasts/1 PATCH/PUT /sales_forecasts/1.json | def update
respond_to do |format|
if @sales_forecast.update(sales_forecast_params)
format.html { redirect_to @sales_forecast, notice: 'Sales forecast was successfully updated.' }
format.json { render :show, status: :ok, location: @sales_forecast }
else
format.html { render :edit ... | [
"def update\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n if @forecast.update_attributes(params[:forecast])\n format.html { redirect_to @forecast, notice: 'Forecast was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /sales_forecasts/1 DELETE /sales_forecasts/1.json | def destroy
@sales_forecast.destroy
respond_to do |format|
format.html { redirect_to sales_forecasts_url, notice: 'Sales forecast was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @forecast = Forecast.find(params[:id])\n @forecast.destroy\n\n respond_to do |format|\n format.html { redirect_to forecasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @forecast = Forecast.find(params[:id])\n @forecast.destroy\n\n respond_to... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The opposite of Arrayinclude i.e. return true if self appears in the array splatted into +first+ and +rest+. | def in? first, *rest
(first.is_a?(Array) ? first : [first].concat(rest)).include? self
end | [
"def include_any?(*array)\n array = array[0] if array.size == 1 && array[0].is_a?(Array)\n !array.nil? && (array.empty? || !(self & array).empty?)\n end",
"def include_any?(arr, arr2)\n #good for large sets w/ few matches\n # Set.new(self).intersection(arr).empty?\n arr2.any? {|e| arr.includ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return self unmodified after logging the output of inspect, along with the point at which +tapp+ was called. | def tapp
tap { puts "#{File.basename caller[4]}: #{self.inspect}" }
end | [
"def tapp\n Babushka::LogHelpers.deprecated! '2017-09-01'\n tap { STDOUT.puts \"#{File.basename caller[2]}: #{self.inspect}\" }\n end",
"def tapp\n tap { puts \"#{File.basename caller[2]}: #{self.inspect}\" }\n end",
"def inspect!\n $stderr.puts(self.inspect)\n end",
"def taph\n tap {\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Log and return unmodified in the same manner as tapp, but escape the output to be HTML safe and easily readable. For example, becomes <Object:0x00000100bda208> | def taph
tap {
puts "<pre>" +
"#{File.basename caller[2]}: #{self.inspect}".gsub('&', '&').gsub('<', '<') +
"</pre>"
}
end | [
"def escape_output(data)\n (data && defined?(ERB::Util.h) && Rabl.configuration.escape_all_output) ? ERB::Util.h(data) : data\n end",
"def log\n @log_output.string\n end",
"def contents\n log_string.dup\n end",
"def format_body_for_log_output(obj)\n output = ''\n if o... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The absolute path to the artifact's release directory. | def release_path
::File.join(install_path, artifact_name, artifact_version)
end | [
"def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end",
"def release_path\n @config[:remote_path] + '/' + release_dir\n end",
"def release_dir\n @config[:releases_dir] + '/' + @config[:version_name]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /image_paths/new GET /image_paths/new.xml | def new
@image_path = ImagePath.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @image_path }
end
end | [
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @flat_image }\n end\n end",
"def new\n @image = @site.images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end",
"def ne... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /image_paths POST /image_paths.xml | def create
@image_path = ImagePath.new(params[:image_path])
respond_to do |format|
if @image_path.save
flash[:notice] = 'ImagePath was successfully created.'
format.html { redirect_to(@image_path) }
format.xml { render :xml => @image_path, :status => :created, :location => @image... | [
"def upload_image_file(args = {}) \n post(\"/files.json/captiveportal/images\", args)\nend",
"def upload_floor_plan(args = {}) \n post(\"/files.json/floorplan/images\", args)\nend",
"def post_image(image)\n prefix = data.page.images.basepath rescue ''\n [prefix, image].join(\"/\").sub(/^\\//,'')\n end",
... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /image_paths/1 PUT /image_paths/1.xml | def update
@image_path = ImagePath.find(params[:id])
respond_to do |format|
if @image_path.update_attributes(params[:image_path])
flash[:notice] = 'ImagePath was successfully updated.'
format.html { redirect_to(@image_path) }
format.xml { head :ok }
else
format.html... | [
"def update_paths\n nodes = Node.all\n helpers.update_paths(nodes)\n render :json => {'result' => 'updated paths was called'}\n end",
"def put(path, params={}); make_request(:put, host, port, path, params); end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /image_paths/1 DELETE /image_paths/1.xml | def destroy
@image_path = ImagePath.find(params[:id])
@image_path.destroy
respond_to do |format|
format.html { redirect_to(image_paths_url) }
format.xml { head :ok }
end
end | [
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n @image.delete_img(@image.name)\n \n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\"... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Helper method to ensure wait time with additional buffer | def wait_until_with_buffer(args, &block)
original_timeout = args[:timeout] || ENV['WAIT_TIMEOUT'].to_i
args_buffered = args.dup
args_buffered[:timeout] = 60
start_time = Time.now
Frank::Cucumber::WaitHelper.wait_until(args_buffered) { block.call() }
end_time = Time.now
delta = end_time - start_time
p... | [
"def wait_readable_or_timeout; end",
"def wait_writable_or_timeout; end",
"def wait_for_rx\n sleep ROOMBA_DATA_REFRESH_RATE + @latency\n end",
"def test_get_waking_up_sleeping_thread\n buffer = SynchronisedBuffer.new(1)\n buffer.put(\"item 1\")\n thread = Thread.new(buffer) { |buffer|\n bu... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Expected options: :output_dir: A folder to dump filtered sql files into. This folder will be emptied before running the dump. :mysql_options: Command line options to pass mysql (e.g. u root some_db_name). :db_connection: An active record connection to the database to dump. :column_filters: A hash of column types to fil... | def initialize(options = {})
self.output_dir = options[:output_dir]
self.mysql_options = options[:mysql_options]
self.db_connection = options[:db_connection]
self.column_filters = (options[:column_filters] || {}).stringify_keys!
self.table_filters = (options[:table_filters] || []).map(&:to... | [
"def sink(options={})\n MysqlFileSink.new(@db,\n @schema_table.table_name,\n load_columns(options[:exclude]),\n mysql_options(options))\n end",
"def dump_table(table, opts = {})\n limit = opts[:limit]\n ret = [table]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Execute the mysqldump command for the given table. Any column or table filters will be applied. | def dump_table(table)
conditions = conditions_for(table)
cmd = "mysqldump #{ mysql_options } --tables #{ table }"
cmd += " \"--where=#{ conditions }\"" if conditions.present?
if post_dump_command
cmd += "| #{post_dump_command}"
end
cmd += " > #{ output_dir }/#{ table }#{fi... | [
"def mysqldump\n \"#{ mysqldump_utility } #{ credential_options } #{ connectivity_options } \" +\n \"#{ user_options } #{ db_name } #{ tables_to_dump } #{ tables_to_skip }\"\n end",
"def dump_table(table, opts = {})\n limit = opts[:limit]\n ret = [table]\n ret << \"--where '#{limit}'... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Any conditions that should be used to filter table based on type | def column_filter_conditions_for(table, type)
values = column_filters[type].join(', ')
foreign_key = type.singularize.foreign_key
if table == type
"\\`id\\` in (#{ values })"
elsif columns_for(table).include?(foreign_key)
"\\`#{ foreign_key }\\` in (#{ values })"
end
e... | [
"def add_filters(type, sql)\n @filter_opts.each do |opt, arg|\n case opt\n when :css\n sql += \"AND lower(css.name) LIKE lower('#{arg}') \"\n when :partition\n sql += \"AND lower(rp.name) LIKE lower('#{arg}') \"\n when :pattern\n sql += \"AND lower(pattern) LIKE lower('#{arg}') \"\n w... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A list of all tables in the db | def tables
db_connection.select_values("show tables")
end | [
"def tables()\n t = []\n mysql(\"use #{@dbName};show tables;\").split(\"\\n\").each do |line|\n t << $1 if line =~ /^\\S+\\:\\s+(\\S+)/\n end\n return t\n end",
"def tables_from(db=current_database)\n result = execute(\"SHOW TABLES FROM #{identifier(db)}\")\n normalize_result(resul... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
A list of all columns for table | def columns_for(table)
db_connection.select_values("show columns from `#{ table }`")
end | [
"def list_columns\n columns\n end",
"def col_names\n table_builder.names\n end",
"def table_columns\n table_builder.columns\n end",
"def get_table_column_names(table)\r\n @db[table].columns\r\n end",
"def columns\n @columns ||= []\n end",
"def columns( table )\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /married_statuses GET /married_statuses.json | def index
@married_statuses = MarriedStatus.all
end | [
"def index\n @marital_statuses = MaritalStatus.all\n end",
"def statuses\n out = [ \"any\" ]\n ListingStatus.statuses.each do |t|\n out << t\n end\n render json: out\n end",
"def index\n @marital_statuses = MaritalStatus.page params[:page]\n end",
"def update\n respon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /married_statuses POST /married_statuses.json | def create
@married_status = MarriedStatus.new(married_status_params)
respond_to do |format|
if @married_status.save
format.html { redirect_to @married_status, notice: 'Married status was successfully created.' }
format.json { render :show, status: :created, location: @married_status }
... | [
"def create\n @marital_statuses = MaritalStatus.all\n @marital_status = MaritalStatus.create(marital_status_params)\n end",
"def index\n @married_statuses = MarriedStatus.all\n end",
"def create\n @marital_status = MaritalStatus.new marital_status_params\n\n if @marital_status.save\n redir... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /married_statuses/1 PATCH/PUT /married_statuses/1.json | def update
respond_to do |format|
if @married_status.update(married_status_params)
format.html { redirect_to @married_status, notice: 'Married status was successfully updated.' }
format.json { render :show, status: :ok, location: @married_status }
else
format.html { render :edit ... | [
"def update\n respond_to do |format|\n if @current_statuses.update(current_statuses_params)\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_statuses }\n else\n format... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /married_statuses/1 DELETE /married_statuses/1.json | def destroy
@married_status.destroy
respond_to do |format|
format.html { redirect_to married_statuses_url, notice: 'Married status was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @status = current_user.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end",
"def delete_status(id)\n delete(\"/statuses/#{id}\")\n end",
"def delete_status(id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.