query stringlengths 7 9.5k | document stringlengths 10 1.07M | negatives listlengths 19 19 | metadata dict |
|---|---|---|---|
Extracts an archive and moves files to destination directory Supported archive types are: .tar.bz2 / .tbz .tar.gz / .tgz .zip === Parameters username(String):: account's username filename(String):: archive's path destination_path(String):: path where extracted files should be moved === Return extracted(Boolean):: true ... | def extract_files(username, filename, destination_path)
escaped_filename = Shellwords.escape(filename)
case filename
when /(?:\.tar\.bz2|\.tbz)$/
%x(sudo tar jxf #{escaped_filename} -C #{destination_path})
when /(?:\.tar\.gz|\.tgz)$/
%x(sudo tar zxf #{escaped_filename} -C #{dest... | [
"def extract\n base.say_status 'extract', @file\n if @zip_file\n base.exec(\"cd #{@temp_dir} ; unzip #{@file}\")\n else\n base.exec(\"cd #{@temp_dir} ; tar xvfpz #{@file}\")\n end\n \n # Remove the file\n base.destination_files.rm_rf(@file_path)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Calculates MD5 checksum for specified file and saves it === Parameters username(String):: account's username target(String):: path to file checksum_path(String):: relative path to checksum file destination(String):: path to file where checksum should be saved === Return nil | def save_checksum(username, target, checksum_path, destination)
checksum = Digest::MD5.file(target).to_s
temp_dir = File.join(File.dirname(target), File.dirname(checksum_path))
temp_path = File.join(File.dirname(target), checksum_path)
FileUtils.mkdir_p(temp_dir)
FileUtils.chmod_R(0771, ... | [
"def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManager.checksum(@path)\n #\t\tend\n end",
"def checksum(path)\n File.open(path, 'rb') { |f| checksum_io(f, Digest::MD5.new) }\n end",
"def file_local_digestmd5(file2md5)\n\t\tif not ::File.exi... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes owner of directories and files from given path === Parameters username(String):: desired owner's username group(String):: desired group name path(String):: path for owner changing === Return chowned(Boolean):: true if owner changed successfully | def change_owner(username, group, path)
%x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})
$?.success?
end | [
"def chown(owner, group) File.chown(owner, group, path) end",
"def chown(owner, group)\n File.chown(owner, group, @path)\n end",
"def chown( owner, group ) File.chown( owner, group, expand_tilde ) end",
"def set_owner(path, owner, group)\n @fs.setOwner(_path(path), owner, group)\n end",
"def chown(f... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /tmpdatabasaes GET /tmpdatabasaes.json | def index
@tmpdatabasaes = Tmpdatabasae.all
end | [
"def getDBData(urlInput)\n url = URI.parse(urlInput)\n server = Couch::Server.new(url.host, url.port)\n res = server.GET(urlInput)\n puts \"PARSING JSON FILE--------------\"\n json = JSON.parse(res.body)\n return json\n end",
"def get_data\n uri = URI(\"https://taskboardv2.herokuapp.com/statio... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /tmpdatabasaes POST /tmpdatabasaes.json | def create
@tmpdatabasae = Tmpdatabasae.new(tmpdatabasae_params)
respond_to do |format|
if @tmpdatabasae.save
format.html { redirect_to @tmpdatabasae, notice: 'Tmpdatabasae was successfully created.' }
format.json { render :show, status: :created, location: @tmpdatabasae }
else
... | [
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def create\n @tempdb = Tempdb.new(tempdb_params)\n\n respond_to do |format|\n if @tempdb.save\n format.html { redirect_to @tempdb, notice: 'Tempdb was successfully created.' }\n format.json { rend... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /tmpdatabasaes/1 PATCH/PUT /tmpdatabasaes/1.json | def update
respond_to do |format|
if @tmpdatabasae.update(tmpdatabasae_params)
format.html { redirect_to @tmpdatabasae, notice: 'Tmpdatabasae was successfully updated.' }
format.json { render :show, status: :ok, location: @tmpdatabasae }
else
format.html { render :edit }
... | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_pat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the name of the association that should be defined on the parent object | def parent_association_name
self.class.resolver_opts[:relation] ||
self.class.model_klass.to_s.underscore.pluralize
end | [
"def association_name\n parent_info && info.association_name(parent_info)\n end",
"def parent_association_name\n self.class.resolver_opts[:relation] ||\n self.class.entity_klass.to_s.underscore.pluralize\n end",
"def parent_association\n parent_object.names\n end",
"def name\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return the instantiated resource scope via Pundit If a parent object is defined then it is assumed that the resolver is called within the context of an association | def pundit_scope
base_scope = object ? object.send(parent_association_name) : self.class.model_klass
# Enforce Pundit control if the gem is present
# This current user must be injected in context inside the GraphqlController.
if defined?(Pundit)
self.class.pundit_scope_klass.new(current... | [
"def pundit_scope\n base_scope = object ? object.send(parent_association_name) : self.class.entity_klass\n\n # Enforce Pundit control if the gem is present\n # This current user must be injected in context inside the GraphqlController.\n if defined?(Pundit)\n self.class.pundit_scope_klass... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attach this volume to an instance | def attach(instance)
# Attach to the instance
$ec2.attach_volume(self.id, instance.id, '/dev/sdh')
# Wait for it to be attached
while true
done = false
$ec2.describe_volumes([self.id]).each do |result|
if result[:aws_attachment_status] == 'attached'
done = true
end... | [
"def attach_volume(instance=nil)\n if ebs_volume_id\n vputs \"Attaching volume #{ebs_volume_id} to the master at #{ebs_volume_device}\"\n instance = master \n ec2.attach_volume(:volume_id => ebs_volume_id, :instance_id => instance.instance_id, :device => ebs_volume_device) i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Detach this volume from any instance it may be attached to | def detach()
$ec2.describe_volumes([self.id]).each do |result|
if result[:aws_attachment_status] == 'attached'
$ec2.detach_volume(self.id)
end
end
self.attached_instance = nil
self.save()
end | [
"def detach_volume vol, instance\n puts \"Detaching volume from instance\"\n return instance.detach_volume vol.id\n end",
"def detach_volumes\n get_volume_attachments.each do |attachment|\n volume = attachment.volume\n attachment.destroy\n while (status = volume.show.status) == 'i... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check this volume is still up | def check()
# check if teh volume still exists
begin
volumes = $ec2.describe_volumes([self.id])
rescue RightAws::AwsError
if $!.errors[0][0] == "InvalidVolume.NotFound"
puts "WARN: Volume #{self.id} is not running"
delete()
return
else
p $!.code
end
... | [
"def held?\n status.queued_held?\n end",
"def still_running?\n @pids.any?{|e| e }\n end",
"def suspended?\n vlan_shutdown\n end",
"def is_available?\n count_available > 0\n end",
"def asleep?\n !awake?\n end",
"def check_volume(volume) \n # Default warning_limit\n warning... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /uniprots/1 GET /uniprots/1.json | def show
@uniprot = Uniprot.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @uniprot }
end
end | [
"def show\n @protagnist = Protagnist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @protagnist }\n end\n end",
"def index\n #binding.pry\n #@progects = Progect.find_by_user_id(current_user.id)\n @progects = Progect.all\n\n r... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /uniprots/new GET /uniprots/new.json | def new
@uniprot = Uniprot.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @uniprot }
end
end | [
"def new\n @protagnist = Protagnist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protagnist }\n end\n end",
"def new\n @pro = Pro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pro }\n en... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /uniprots POST /uniprots.json | def create
@uniprot = Uniprot.new(params[:uniprot])
respond_to do |format|
if @uniprot.save
format.html { redirect_to @uniprot, notice: 'Uniprot was successfully created.' }
format.json { render json: @uniprot, status: :created, location: @uniprot }
else
format.html { render... | [
"def create\n @protagnist = Protagnist.new(params[:protagnist])\n\n respond_to do |format|\n if @protagnist.save\n format.html { redirect_to @protagnist, notice: 'Protagnist was successfully created.' }\n format.json { render json: @protagnist, status: :created, location: @protagnist }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /uniprots/1 PUT /uniprots/1.json | def update
@uniprot = Uniprot.find(params[:id])
respond_to do |format|
if @uniprot.update_attributes(params[:uniprot])
format.html { redirect_to @uniprot, notice: 'Uniprot was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | [
"def update\n @protagnist = Protagnist.find(params[:id])\n\n respond_to do |format|\n if @protagnist.update_attributes(params[:protagnist])\n format.html { redirect_to @protagnist, notice: 'Protagnist was successfully updated.' }\n format.json { head :no_content }\n else\n forma... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /uniprots/1 DELETE /uniprots/1.json | def destroy
@uniprot = Uniprot.find(params[:id])
@uniprot.destroy
respond_to do |format|
format.html { redirect_to uniprots_url }
format.json { head :no_content }
end
end | [
"def destroy\n @protagnist = Protagnist.find(params[:id])\n @protagnist.destroy\n\n respond_to do |format|\n format.html { redirect_to protagnists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pro = Pro.find(params[:id])\n @pro.destroy\n\n respond_to do |fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reset transcript to it's original state Update Transcript update TranscriptLines delete TrancriptEdits for the transcript delete TranscriptSpeakerEdit for the transcript | def reset
ActiveRecord::Base.transaction do
reset_transcript
reset_transcript_lines
reset_transcript_edits
reset_trasncript_speaker_edits
end
end | [
"def do_reset\n\t\t\n\t\t\t# Mark state as reset\n\t\t\t@reset = true\n\t\t\t\n\t\t\t# Revert text and palette\n\t\t\tself.text = nil \n\t\t\tself.palette = @palette_normal\t\t\t\n\t\tend",
"def reset_tx\n @@code_text_attr = \"\"\n return self\n end",
"def reset_answer\n self.answer_text = '... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /test_records POST /test_records.json | def create
@test_record = TestRecord.new(test_record_params)
respond_to do |format|
if @test_record.save
format.html { redirect_to @test_record, notice: 'Test record was successfully created.' }
format.json { render :show, status: :created, location: @test_record }
else
fo... | [
"def test_should_create_status_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/status_posts.json\", :api_key => 'testapikey',\r\n :status_post => {:body => 'API Status Post 1' }\r\n assert_response :created\r\n status_post = JSON.parse(response.body)\r\n check_new_stat... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /test_records/1 PATCH/PUT /test_records/1.json | def update
respond_to do |format|
if @test_record.update(test_record_params)
format.html { redirect_to @test_record, notice: 'Test record was successfully updated.' }
format.json { render :show, status: :ok, location: @test_record }
else
format.html { render :edit }
forma... | [
"def patch(key, records, criteria)\n resp = client.patch(path(slug, key), records, \"X-Criteria\" => criteria.join(\", \"))\n\n if resp.response.code != \"202\"\n raise Reflect::RequestError, Reflect._format_error_message(resp)\n end\n end",
"def update\n respond_to do |format|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /test_records/1 DELETE /test_records/1.json | def destroy
@test_record.destroy
respond_to do |format|
format.html { redirect_to test_records_url, notice: 'Test record was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def delete_record(record_id)\n session_check!\n begin\n JSON.parse(delete(full_path(\"records/#{record_id}\"), {session_id: session_id}))\n rescue => error\n handle_request_exception(error)\n end\n end",
"def... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /roads/1 GET /roads/1.json | def show
@road = Road.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @road }
end
end | [
"def index\n @roads = Road.all\n end",
"def show\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallroad }\n end\n end",
"def show\n @roadrunner = Roadrunner.find(params[:id])\n\n respon... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /roads/new GET /roads/new.json | def new
@road = Road.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @road }
end
end | [
"def new\n @mini_map_road = MiniMapRoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def new\n @mostsmallroad = Mostsmallroad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /roads POST /roads.json | def create
@road = Road.new(params[:road])
respond_to do |format|
if @road.save
format.html { redirect_to @road, notice: 'Road was successfully created.' }
format.json { render json: @road, status: :created, location: @road }
else
format.html { render action: "new" }
... | [
"def create\n @road = Road.new(road_params)\n\n respond_to do |format|\n if @road.save\n format.html { redirect_to @road, notice: 'Road was successfully created.' }\n format.json { render :show, status: :created, location: @road }\n else\n format.html { render :new }\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /roads/1 PUT /roads/1.json | def update
@road = Road.find(params[:id])
respond_to do |format|
if @road.update_attributes(params[:road])
format.html { redirect_to @road, notice: 'Road was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.j... | [
"def update\n respond_to do |format|\n if @road.update(road_params)\n format.html { redirect_to @road, notice: 'Road was successfully updated.' }\n format.json { render :show, status: :ok, location: @road }\n else\n format.html { render :edit }\n format.json { render json: @... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /roads/1 DELETE /roads/1.json | def destroy
@road = Road.find(params[:id])
@road.destroy
respond_to do |format|
format.html { redirect_to roads_url }
format.json { head :no_content }
end
end | [
"def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to(roads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @medium_road = MediumRoad.find(params[:id])\n @medium_road.destroy\n\n respond_to do |format|\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /radio_groups POST /radio_groups.json | def create
@radio_group = RadioGroup.new radio_group_params
authorize @radio_group
flash.now[:notice] = 'Radio group was successfully created.' if @radio_group.save
respond_with @radio_group
end | [
"def create\n @radio_button_group = RadioButtonGroup.new(params[:radio_button_group])\n\n respond_to do |format|\n if @radio_button_group.save\n format.html { redirect_to @radio_button_group, notice: 'Radio button group was successfully created.' }\n format.json { render json: @radio_button... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /radio_groups/1 PUT /radio_groups/1.json | def update
if @radio_group.update radio_group_params
flash.now[:notice] =
'Radio group was successfully updated.'
end
respond_with @radio_group
end | [
"def update\n @radio_button_group = RadioButtonGroup.find(params[:id])\n\n respond_to do |format|\n if @radio_button_group.update_attributes(params[:radio_button_group])\n format.html { redirect_to @radio_button_group, notice: 'Radio button group was successfully updated.' }\n format.json {... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /radio_groups/1 DELETE /radio_groups/1.json | def destroy
@radio_group.destroy
respond_with @radio_group, location: radio_groups_path
end | [
"def destroy\n @radio_button_group = RadioButtonGroup.find(params[:id])\n @radio_button_group.destroy\n\n respond_to do |format|\n format.html { redirect_to radio_button_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @radio_group = RadioGroup.find(params[:id... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
The prefix for table names of gricer database tables. Default value is 'gricer_' | def table_name_prefix
@table_name_prefix ||= 'gricer_'
end | [
"def table_name_prefix\n \"ext_#{self.registered_name.to_s.underscore}_\"\n end",
"def roomer_full_table_name_prefix(schema_name)\n \"#{schema_name.to_s}#{Roomer.schema_seperator}\"\n end",
"def table_name_prefix(model)\n return model::Base.table_name_prefix rescue \"\"\n end... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure the prefix for admin pages paths Default value is 'gricer' | def admin_prefix
@admin_prefix.blank? ? 'gricer' : @admin_prefix
end | [
"def url_helper_prefix\n 'admin_'\n end",
"def admin_theme_path\n @admin_theme ||= '/admin/amsterdam/'\n end",
"def path_prefix\n Merb.config[:path_prefix]\n end",
"def path_prefix=(value); end",
"def prefix(prefix = nil)\n prefix ? set(:root_prefix, prefix) : settings[:root_prefix]\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure the structure of Gricer's admin menu Default value see source | def admin_menu
@admin_menu ||= [
['overview', :dashboard, {controller: 'gricer/dashboard', action: 'overview'}],
['visitors', :menu, [
['entry_pages', :spread, {controller: 'gricer/requests', action: 'spread_stats', field: 'entry_path'}],
['referers', :spread, {controller: 'gr... | [
"def config\n if @path.blank? && @items.empty?\n options = human_name\n else\n options = @options.merge(:text => human_name)\n options.merge!(:menu => @items.collect(&:config)) if @items.size > 0\n options.merge!(:handler => \"function(){ Admin.app.load(... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure page urls matching this Expression to be excluded from being tracked in Gricer statistics Default is to exclude the admin pages | def exclude_paths
@exclude_paths ||= /^#{admin_prefix}$/
end | [
"def ignore_urls\n @url_rules.reject\n end",
"def pages_to_add\n pages.reject { |page| blacklisted?(page) }\n end",
"def whitelist_pages\n return [\"/compare/\"]\n end",
"def filter_private_pages\n if @public_mode\n private_pages_path = \"/#{@site.config['private_pages_path... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure the database instance used by GeoIP Default is none GeoIP database configured | def geoip_db
@geoip_db ||= geoip_dat ? GeoIP::City.new(geoip_dat, :index, false) : nil
end | [
"def database(loc)\n @db = GeoIPCity::Database.new(loc, :filesystem)\n end",
"def configure_database db_config\n @database = Database.new @client, *db_config.values_at('name', 'user', 'password')\n @models = db_config['models']\n @namespace = db_config['namespace'] || \"Oo\"\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Configure which type of models should be used in Gricer Set to :ActiveRecord or :Mongoid Default is :ActiveRecord | def model_type
@model_type ||= :ActiveRecord
end | [
"def all_models_superclass\n ActiveRecord::VERSION::MAJOR >= 5 ? ApplicationRecord : ActiveRecord::Base\n end",
"def supported_orm\n [:datamapper, :activerecord, :mongomapper, :mongoid, :couchrest, :sequel]\n end",
"def adapter_type_for(model)\n class_name = model.connecti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
first attempt def random_select(array, n) random_array = Array.new (0...n).each do |x| random = rand(array.length) random_array.push(array[random]) end random_array end cleaner way; use times for regular loop | def random_select(array, n)
random_arr = Array.new
n.times do
random_array << array[rand(array.length)]
end
end | [
"def random_select(array, n)\n result = []\n n.times {result << array[rand(n)]}\n result\nend",
"def random_select(array, n)\n random_elements=[]\n n.times do\n i=rand(array.length)\n random_elements.push(array[i])\n end\n return random_elements\nend",
"def random_select(array, n)\n=begin\n rand_e... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
methods for hierarchical entities support | def get_hierarchy(entity_class)
content_tag(:ul,
entity_class.find(:all, :conditions => 'parent_id IS NULL or parent_id = 0', :order => 'root_id, lft').collect {|root|
get_subtree(root) }.join)
end | [
"def child_ancestry; end",
"def call_hierarchy_provider; end",
"def entitystore; end",
"def child_relation; end",
"def get_hierarchy\n # set option\n HierachyOption.can_edit = true\n # get hierachy\n categories = SkillCategory.all.map {|category| get_skill_category_node(category)}\n skills = ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns a list of fragments that have mappings in a given URI | def fragments_for kb, uri
root_fragments = kb.find(nil, Node('rdf:type'), Node('sc:Fragment')) - kb.find([], Node('sc:subfragment'), nil)
selectors = []
fragments = {}
root_fragments.each do |fragment|
fragment.sc::selector.each do |selector|
fragments[selector] = fragment
... | [
"def component_matches(component, uri)\n extracted_mappings = {}\n component_template = component_templates[component]\n if component_template\n component_url = uri.public_send(component).to_s\n unless (extracted_mappings = component_template.extract(component_url))\n # to supp... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Extracts all mappings from a fragment and returns a graph | def extract_graph fragments, options
output = RDF::Graph.new
fragments.each { |fragment| fragment.extract(options).each { |result| output << result } }
output
end | [
"def all_mappings options={}\n # Extracts all the mappings and any subfragment\n mappings(options).map do |mapping|\n node = mapping[:node]\n subfragments = mapping[:subfragments]\n doc = mapping[:doc]\n\n # Process subfragments\n consistent = true\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
this method increment the votes correspondit to the series the time is used to verify which series was last voted using that approach, all mandatory cases are satisfied moreover the app will use a coherent algorithm | def count_votes(series_id)
@vote_counter[series_id.to_sym] = [@vote_counter[series_id.to_sym].first + 1, Time.new]
end | [
"def dem_votes\n @dem_votes = @dem_votes + 1\nend",
"def next\n reset_votes\n end",
"def increment_votes\n Article.increment_vote_cache(article_id)\n end",
"def update_votes(count)\n update votes: @data[:votes] + count do |data|\n self.data = data\n end\n end",
"def set_... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use MinGW helper to find the proper host. | def mingw_host
@mingw_host ||= MinGW.mingw_host
end | [
"def get_win_default_host(options)\n if_name = get_win_default_if_name(options)\n nic_mac = get_win_if_mac(options,if_name)\n host_ip = get_win_ip_form_mac(options,nic_mac)\n return host_ip\nend",
"def get_vm_host(_pool_name, _vm_name)\n\n #for v1 virtualbox support this is all local so the hostname ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Construct a new FindIt::Asset::MapMarker instance. Parameters: [url] URL of the marker image. [params] Parameters for the marker. Returns: A FindIt::Asset::MapMarker instance. Parameters: [:height] Height of the image in pixels. (default: DEFAULT_MARKER_HEIGHT) [:width] Width of the image in pixels. (default: DEFAULT_M... | def initialize(url, params = {})
height = params[:height] || DEFAULT_MARKER_HEIGHT
width = params[:width] || DEFAULT_MARKER_WIDTH
@marker = FindIt::Asset::Image.new(url, :height => height, :width => width)
@shadow = if params[:shadow]
url_shadow = params[:shadow]
... | [
"def screenshot_marker_create(project_id, screenshot_id, params)\n path = sprintf(\"/api/v2/projects/%s/screenshots/%s/markers\", project_id, screenshot_id)\n data_hash = {}\n post_body = nil\n \n if params.present?\n unless params.kind_of?(PhraseApp::RequestParams::ScreenshotMarkerParam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns whether or not there's a Ruby gem for this repo. | def gem?
@gem
end | [
"def rubygems?\n defined?(::Gem)\n end",
"def rubygems?\n defined? ::Gem\n end",
"def ruby?\n exist? 'Gemfile'\n end",
"def gem_available?(name)\n gem name\n true\n rescue Gem::LoadError\n false\n end",
"def ruby_installed?\n !which('ruby').nil... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the public clone URL. | def clone_url
"git://github.com/#{@account}/#{name}.git"
end | [
"def clone_url\n \"git://github.com/#{owner}/#{name}.git\"\n end",
"def clone_url(repo)\n if use_private_clone_url\n repo['ssh_url']\n else\n repo['clone_url']\n end\n end",
"def clone_url\n \"https://#{url}.git\"\n end",
"def public_url\n return @public_url\... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the name of the gem file from GitHub, which is made up of the account name and the gem name. | def gem_name
"#{@account}-#{@name}"
end | [
"def file_name\n \"#{full_name}.gem\"\n end",
"def pkgname\n originurl = `git config --get remote.origin.url`.strip\n _, pkgname = originurl.match(/\\/([a-z0-9\\-_]+).git/i).to_a\n pkgname\nend",
"def gem_name\n @gem_name ||= @source_path.sub_ext(\"\").basename.to_s\n end",
"def git_filename\n F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the command to install the gem. This is a helper for your views. | def gem_install_command
"sudo gem install #{gem_name} -s http://gems.github.com"
end | [
"def install_command\n command = \"Install-Module #{@resource[:name]} -Scope AllUsers -Force\"\n command << \" -RequiredVersion #{@resource[:ensure]}\" unless [:present, :latest].include? @resource[:ensure]\n command << \" -Repository #{@resource[:source]}\" if @resource[:source]\n command << \" #{insta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIE... | def play_melody(m)
in_thread do
set_volume! 5
if defined? mybpm
use_bpm mybpm()
end
if defined? mysynth
use_synth mysynth()
end
(0..m[0].length-1).each do |i|
if m.length > 2
set_volume! m[2][i]
end
if m[0][i] != 0
play m[0][i]
end
s... | [
"def sonic_play\n melody = melody()\n if melody.respond_to?(:key)\n melody.values().each do |m|\n play_melody(m)\n end\n elsif melody.respond_to?(:length)\n play_melody(melody)\n end\nend",
"def greek_melody(pi_length, hits, beats, melody_offset = 0)\n melody = \"\"\n rhythm = EuclideanSequenc... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Plays a melody in SonicPi, optionally supporting multiple submelodies in parallel. | def sonic_play
melody = melody()
if melody.respond_to?(:key)
melody.values().each do |m|
play_melody(m)
end
elsif melody.respond_to?(:length)
play_melody(melody)
end
end | [
"def play_melody(m)\n in_thread do\n set_volume! 5\n if defined? mybpm\n use_bpm mybpm()\n end\n if defined? mysynth\n use_synth mysynth()\n end\n \n (0..m[0].length-1).each do |i|\n if m.length > 2\n set_volume! m[2][i]\n end\n if m[0][i] != 0\n play m[0][... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
All context objects have only one of type per object Target is task for object | def assemble_deps(context, object, target_class)
if target_task = object.task_find_all(target_class)
return [target_task, []] if target_task.depends_on
else
object.tasks_new << target_task = target_class.new(:object => object)
end
task_list = [target_task]
# s = Benchmark.... | [
"def context\n return @target if @target.is_a?(Module) && !@options[:class_methods]\n\n @target.singleton_class\n end",
"def context_klass; end",
"def context_type\n self.class.name.to_s\n end",
"def target_objects\n return @target_objects\n end",
"def run( context... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return value of return stack | def return_stack
return @state[:fiber][:return_stack]
end | [
"def return_value\n # return @stack_sigs[@returnValIdx][@stack_ptr-1]\n @returnValue\n end",
"def _ret_popped # ret_popped\r\n val = @stack.pop\r\n\r\n routine_return val\r\n end",
"def ret\n @pc = @stack[@sp]\n @sp -= 1\n end",
"def sret\n <<-CODE\n t1 = stack... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return current instruction pointer | def instruction_pointer
return @state[:fiber][:instruction_pointer]
end | [
"def curr_ins\n if @memory[@ip]\n @memory[@ip]\n else\n raise RuntimeError, \"Instruction is nil\"\n end\n end",
"def next\n ptr = C.LLVMGetNextInstruction(self)\n LLVM::Instruction.from_ptr(ptr) unless ptr.null?\n end",
"def next_instruction\n inst = @program[@current_inst... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return level of fiber | def level
return @state[:fiber][:level]
end | [
"def level\n @level\n end",
"def level() end",
"def level\n return @level\n end",
"def water_level\n return water_level\n end",
"def level=(level)\n @state[:fiber][:level] = level\n end",
"def level(actor)\n 99\n end",
"def current_depth\n current = F... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Set level of fiber | def level=(level)
@state[:fiber][:level] = level
end | [
"def set_level(level)\n @level = level\n end",
"def level=(value)\n @level = value\n end",
"def set_level index, value\n\t\t\t\tcheck_block index\n\t\t\t\t@bsc_blocks[index].level = value\n\t\t\tend",
"def level\n return @state[:fiber][:level]\n end",
"def level=(lv... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Check if an unloaded record exists in the database | def exists?
load!
true
rescue RecordNotFound
false
end | [
"def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end",
"def exists?\n record_limit(1).count > 0\n end",
"def reload_if_exists(record) # :nodoc:\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempt to load an unloaded record and raise an error if the record does not correspond to a row in the database | def load!
load.tap do
if transient?
raise RecordNotFound,
"Couldn't find #{self.class.name} with #{key_attributes.inspect}"
end
end
end | [
"def load record\n end",
"def load record\n id = id_for(record)\n if id\n perform_query(update_query(record))\n log.info(\"Updated #{id}\")\n else\n perform_query(insert_query(record))\n log.info(\"Inserted\")\n end\n end",
"def load reco... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Deletes an entry in events_useres table | def delete
@event = Event.find(params[:id])
@user = current_user
@event.users.delete(@user)
redirect_to reminders_path(:id => current_user.id), :notice => I18n.t(:reminders_delete)
end | [
"def remove(user)\n users.delete(user)\n # equivalents.each { |event| event.users.delete(user) }\n end",
"def destroy\n \t@event_id = params[:event_id]\n \t@user_id = params[:id]\n \t@user = User.where(event_id: + @event_id + \",\",id: +@user_id)\n \tif not @user.exists?\n \t\t render :jso... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Look at the current round and return the last card | def last_guessed_card
current_round.guesses.last.card_id
end | [
"def current_card\n @deck.cards[@round]\n end",
"def current_round\n rounds.last\n end",
"def getLast(hand)\n\t\ti = 0 #Index.\n\t\ttemp = Card.new(0, \"\") #Placeholder.\n\t\twhile i < hand.length #Finds the rightmost/last card in hand.\n\t\t\ttemp = hand.shift()\n\t\t\thand.push(temp) #Puts ev... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true/false depending on if the card exists | def card_exists?(card_to_check)
if !Card.find_by(id: card_to_check.id).nil?
return true
else
return false
end
end | [
"def has_card? test_card\r\n @card_list.has_card? test_card\r\n end",
"def has_card? test_card \n @card_list.has_card? test_card\n end",
"def has_card_account?\r\n active_card_accounts.count(:all) > 0 rescue nil\r\n end",
"def exists?(id)\n API.snd_card_load(id) == 1\n end",
"def ass... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Use base 26 here to avoid numeric codes (We want codes to be clearly distinguishable from ids) | def id_to_code(id)
(id.to_i * factor + pad).to_s(26).tr('0-9a-p', 'a-z')
end | [
"def id_code_with_out_verification_code\r\n \"#{first_four_chars}#{numaric_digit_of_id_code}\"\r\n end",
"def con10to62(id)\n\tnew_id = \"0000\"\n\tfor i in 0..3\n\t\tdiv = id / 62**(3 - i)\n\t\tif div > -1 && div < 10\n\t\t\t#0-9\n\t\t\tnew_id.setbyte(i, (div + 48))\n\t\telsif div > 9 && div < 36\n\t\t\t#A-Z... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return `true` if all the local screenshots are uploaded to App Store Connect | def verify_local_screenshots_are_uploaded(iterator, screenshots_per_language)
# Check if local screenshots' checksum exist on App Store Connect
checksum_to_app_screenshot = iterator.each_app_screenshot.map { |_, _, app_screenshot| [app_screenshot.source_file_checksum, app_screenshot] }.to_h
number_of... | [
"def is_app_uploaded?(appname)\n all_apps = get_all_apps()\n return app_list.include?(appname)\n end",
"def all_images_exist?\n return false if self.missing_images.size > 0\n return false if self.missing_reference_images.size > 0\n return true\n end",
"def upload_files_by_rsync?\n @uploa... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /regions/1 GET /regions/1.xml | def show
@region = Region.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @region }
end
end | [
"def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @region }\n end\n end",
"def regions\n client.get_stats('/stats/regions')\n end",
"def index\n @target_regions = TargetRegion.curr_ver.find(:all)\n\n respond_to do |format|\n fo... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /dishes/1 DELETE /dishes/1.json | def destroy
@dish.destroy
respond_to do |format|
format.html { redirect_to dishes_url }
format.json { head :no_content }
end
end | [
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destroy\n\n respond_to do |format|\n format.html { redirect_to dishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_dish.destroy\n end",
"def destroy\n @dish = Dish.find(params[:id])\n @dish.destr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /type_searches GET /type_searches.json | def index
@type_searches = TypeSearch.all
end | [
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def search_entity_types(request)\n start.uri('/api/entity/type/search')\n .body_handler(FusionAuth::JSONBodyHandler.new... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /type_searches POST /type_searches.json | def create
@type_search = TypeSearch.new(type_search_params)
respond_to do |format|
if @type_search.save
format.html { redirect_to @type_search, notice: 'Type search was successfully created.' }
format.json { render :show, status: :created, location: @type_search }
else
form... | [
"def index\n @type_searches = TypeSearch.all\n end",
"def search_entity_types(request)\n start.uri('/api/entity/type/search')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def create\n @search_type = SearchType.new(params[:search_t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /type_searches/1 PATCH/PUT /type_searches/1.json | def update
respond_to do |format|
if @type_search.update(type_search_params)
format.html { redirect_to @type_search, notice: 'Type search was successfully updated.' }
format.json { render :show, status: :ok, location: @type_search }
else
format.html { render :edit }
forma... | [
"def update\n @search_type = SearchType.find(params[:id])\n\n respond_to do |format|\n if @search_type.update_attributes(params[:search_type])\n format.html { redirect_to @search_type, notice: 'Search type was successfully updated.' }\n format.json { head :no_content }\n else\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /type_searches/1 DELETE /type_searches/1.json | def destroy
@type_search.destroy
respond_to do |format|
format.html { redirect_to type_searches_url, notice: 'Type search was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @search_type = SearchType.find(params[:id])\n @search_type.destroy\n\n respond_to do |format|\n format.html { redirect_to search_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advance_search.destroy\n respond_to do |format|\n format.ht... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
alphabet() Returns alphabet as string == Parameters: none | def alphabet
'abcdefghijklmnopqrstuvwxyz'
end | [
"def alphabet\n @alphabet || deduce_alphabet\n end",
"def alphabet\n read_attr :alphabet\n end",
"def alphabetical(str, alphabet = nil)\n\nend",
"def set_alphabet_letter\n self.alphabet_letter = self.name[0].upcase if !self.name.blank?\n end",
"def getAlphabets(i)\n if (i<=2... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
reverse_alphabet_maybe() reverse letters if reverse option set == Parameters: none | def reverse_alphabet_maybe
@letters.reverse! if @options[:reverse]
end | [
"def reverse_ordered_letters\n ordered_letters.reverse\n end",
"def reverse_ordered_letters?\n 1.upto(@word.length - 1) do |i|\n return false unless @word[i] <= @word[i - 1]\n end\n true\n end",
"def reverse(letter)\n if ALPHABET.include?(letter)\n ALPHABET[((@letters.index(letter... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
shuffle_alphabet_maybe() shuffle alphabet if :shuffle option defined don't shuffle if in test environment == Parameters: none | def shuffle_alphabet_maybe
unless(ENV["CW_ENV"] == "test")
@letters = @letters.split('').shuffle.join if @options[:shuffle]
end
end | [
"def shuffle\n split('').shuffle.join\n end",
"def shuffle!\r\n\t\trandomize!\r\n\tend",
"def shuffled_letters(str)\n str.split(\"\").shuffle\nend",
"def test_shuffle\n pre_shuffle = @deck.cards\n @deck.shuffle!\n assert_not_equal(@deck.cards, pre_shuffle, \"these probably shouldn't be the sam... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
include_letters() include letters if :include option defined == Parameters: none | def include_letters
if @options[:include]
@letters = @options[:include]
end
end | [
"def exclude_letters\n if @options[:exclude]\n @letters.tr!(@options[:exclude],'')\n end\n end",
"def uses_available_letters? (input, letters_in_hand)\n letters_in_hand.join.include? input\nend",
"def requested_includes\n params[:include]\n .split(',')\n .collect { |item| item.... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
exclude_letters() exclude letters if :exclude option defined == Parameters: none | def exclude_letters
if @options[:exclude]
@letters.tr!(@options[:exclude],'')
end
end | [
"def exclude?(string); end",
"def reject_words_that_contain(letter)\n change_wordlist(@words.select { |word,letters| word.word.index(letter) == nil })\n end",
"def remove_non_alpha_words\n @words.select! {|w| w.match(/^[a-zA-Z]+$/) }\n end",
"def alphafilter\n self.gsub(/[^a-zA-Z\\s]/, ''... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
generate() generate alphabet with options acted upon == Returns: alphabet or filtered alphabet | def generate
@letters = alphabet
include_letters
exclude_letters
shuffle_alphabet_maybe
reverse_alphabet_maybe
@letters.split('').join(' ')
end | [
"def alphabet\n @alphabet || deduce_alphabet\n end",
"def alphabet\n 'abcdefghijklmnopqrstuvwxyz'\n end",
"def mk_letters_choice_hashes \n choice_array = [\"A-D\",\"E-H\",\"I-L\",\"M-P\",\"Q-T\",\"U-Z\"] \n x = choice_array.map do |c|\n choice(c,(c[0]..c[2]).to_a)\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Triangle analyzes the lengths of the sides of a triangle (represented by a, b and c) and returns the type of triangle. It returns: :equilateral if all sides are equal :isosceles if exactly 2 sides are equal :scalene if no sides are equal The tests for this method can be found in about_triangle_project.rb and about_tria... | def triangle(a, b, c)
sides = [a,b,c]
validate_sides(sides)
unique_side_lengths = sides.uniq.length
case unique_side_lengths
when 1
:equilateral
when 2
:isosceles
when 3
:scalene
end
end | [
"def triangle(a, b, c)\n unless side_lengths_define_valid_triangle?(a,b,c)\n raise TriangleError, \"The specified side lengths do not define a valid triangle!\"\n end\n \n if is_equilateral?(a,b,c)\n :equilateral \n elsif is_isosceles?(a,b,c)\n :isosceles\n else\n :scalene\n end\nend",
"def t... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /item_lines/1 PUT /item_lines/1.json | def update
@item_line = ItemLine.find(params[:id])
respond_to do |format|
if @item_line.update_attributes(params[:item_line])
format.html { redirect_to @item_line, notice: 'Item line was successfully updated.' }
format.json { head :no_content }
else
format.html { render acti... | [
"def update\n @v1_item_line = V1::ItemLine.find(params[:id])\n\n if @v1_item_line.update(v1_item_line_params)\n head :no_content\n else\n render json: @v1_item_line.errors, status: :unprocessable_entity\n end\n end",
"def update\n @line_items = LineItem.find(params[:id])\n if @line_it... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /item_lines/1 DELETE /item_lines/1.json | def destroy
@item_line = ItemLine.find(params[:id])
@item_line.destroy
respond_to do |format|
format.html { redirect_to item_lines_url }
format.json { head :no_content }
end
end | [
"def destroy\n @v1_item_line = V1::ItemLine.find(params[:id])\n @v1_item_line.destroy\n\n head :no_content\n end",
"def destroy\n @line_items = LineItem.find(params[:id])\n @line_item.destroy\n if @line_item.destroy\n render json: {status: :successfully}\n else\n render json: { sta... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /ykt_sessions/1 GET /ykt_sessions/1.json | def show
@ykt_session = YktSession.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @ykt_session }
end
end | [
"def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"OAuth Sessions\")\n styled_array(sessions.map { |session|\n [session[\"description... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /ykt_sessions/new GET /ykt_sessions/new.json | def new
@ykt_session = YktSession.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @ykt_session }
end
end | [
"def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /ykt_sessions POST /ykt_sessions.json | def create
@ykt_session = YktSession.new(params[:ykt_session])
respond_to do |format|
if @ykt_session.save
format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }
format.json { render json: @ykt_session, status: :created, location: @ykt_session }
el... | [
"def new\n @ykt_session = YktSession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ykt_session }\n end\n end",
"def create\n @session = Session.new(params[:session])\n\n if @session.save\n render json: @session, status: :created, location:... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PUT /ykt_sessions/1 PUT /ykt_sessions/1.json | def update
@ykt_session = YktSession.find(params[:id])
respond_to do |format|
if @ykt_session.update_attributes(params[:ykt_session])
format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully updated.' }
format.json { head :no_content }
else
format.html {... | [
"def create\n @ykt_session = YktSession.new(params[:ykt_session])\n\n respond_to do |format|\n if @ykt_session.save\n format.html { redirect_to @ykt_session, notice: 'Ykt session was successfully created.' }\n format.json { render json: @ykt_session, status: :created, location: @ykt_session... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /ykt_sessions/1 DELETE /ykt_sessions/1.json | def destroy
@ykt_session = YktSession.find(params[:id])
@ykt_session.destroy
respond_to do |format|
format.html { redirect_to ykt_sessions_url }
format.json { head :no_content }
end
end | [
"def destroy\n @yoga_session = YogaSession.find(params[:id])\n @yoga_session.destroy\n\n respond_to do |format|\n format.html { redirect_to yoga_sessions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @session = @client.sessions.find(params[:id])\n @session.dest... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get merchant sales report | def getSalesReport(year, month)
#url = sprintf('https://market.android.com/publish/salesreport/download?report_date=%04d_%02d', year, month)
url = sprintf('https://play.google.com/apps/publish/salesreport/download?report_date=%04d_%02d&report_type=payout_report&dev_acc=%s', year, month, @dev_acc)
try_get(ur... | [
"def sales\n return FarMar::Sale.by_vendor(@id)\n end",
"def get_sales_report(year, month)\n #url = sprintf('https://play.google.com/apps/publish/salesreport/download?report_date=%04d_%02d&report_type=payout_report&dev_acc=%s', year, month, @config.dev_acc)\n url = sprintf('https://play.google.com/a... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get merchant etimated sales report | def getEstimatedSalesReport(year, month)
url = sprintf('https://play.google.com/apps/publish/salesreport/download?report_date=%04d_%02d&report_type=sales_report&dev_acc=%s', year, month, @dev_acc)
try_get(url)
return @agent.page.body
end | [
"def getSalesReport(year, month)\n #url = sprintf('https://market.android.com/publish/salesreport/download?report_date=%04d_%02d', year, month)\n url = sprintf('https://play.google.com/apps/publish/salesreport/download?report_date=%04d_%02d&report_type=payout_report&dev_acc=%s', year, month, @dev_acc)\n tr... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get order list startDate: start date (yyyymmddThh:mm:ss) end: end date (yyyymmddThh:mm:ss) state: financial state, one of followings: ALL, CANCELLED, CANCELLED_BY_GOOGLE, CHARGEABLE, CHARGED, CHARGING, PAYMENT_DECLINED, REVIEWING | def getOrderList(startDate, endDate, state = "CHARGED", expanded = false)
try_get("https://checkout.google.com/sell/orders")
@agent.page.form_with(:name => "dateInput") do |form|
form["start-date"] = startDate
form["end-date"] = endDate
if (state == "ALL")
form.delete_field!("financi... | [
"def get_order_list(start_date, end_date, state = \"CHARGED\", expanded = false)\n\n try_get(\"https://checkout.google.com/sell/orders\")\n\n @agent.page.form_with(:name => \"dateInput\") do |form|\n form[\"start-date\"] = start_date\n form[\"end-date\"] = end_date\n if state == \"ALL... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get order details page | def getOrderDetail(orderId)
try_get("https://checkout.google.com/sell/multiOrder?order=#{orderId}&ordersTable=1")
return @agent.page.body
end | [
"def order_details(order_number)\n get_request('orderDetails?'+get_url_parameters({'order_number':order_number})).body\n end",
"def order_detail\n\t\t@persona = Persona.where( :screen_name => params[:persona_id]).first\n\t\t@order = @persona.orders.find( params[:order_id] )\n\t\n\t\trespond_to do |format|... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
get application statistics CSV in zip package: package name startDay: start date (yyyyMMdd) endDay: end date (yyyyMMdd) | def getAppStats(package, startDay, endDay)
dim = "overall,country,language,os_version,device,app_version,carrier&met=daily_device_installs,active_device_installs,daily_user_installs,total_user_installs,active_user_installs,daily_device_uninstalls,daily_user_uninstalls,daily_device_upgrades"
url = "https://play... | [
"def get_appstats(package, start_day, end_day)\n #dim = \"overall,country,language,os_version,device,app_version,carrier&met=active_device_installs,daily_device_installs,daily_device_uninstalls,daily_device_upgrades,active_user_installs,total_user_installs,daily_user_installs,daily_user_uninstalls,daily_avg_ra... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
push all deliver buttons | def autoDeliver(auto_archive = false)
# access 'orders' page
try_get("https://checkout.google.com/sell/orders")
more_buttons = true
# 押すべきボタンがなくなるまで、ボタンを押し続ける
while(more_buttons)
more_buttons = false
@agent.page.forms.each do |form|
order_id = nil
order_field = form.fi... | [
"def push_button_up\n\t\t@buttons.go_up\n\tend",
"def update_buttons\n publish(event_topic_name(\"c_button\")) if data[:c] == true\n publish(event_topic_name(\"z_button\")) if data[:z] == true\n end",
"def push_button(button)\n send(\"#{button}\")\n end",
"def auto_deliver(auto_archive ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Checks for a given environment mode. | def env_mode?( mode )
return self.env_mode == mode.to_sym
end | [
"def environment?(key)\n config[:environment] == key\n end",
"def valid_mode?(mode)\n [:cooked, :fake, :raw].include?(mode)\n end",
"def verify_mode(modes)\r\n unless modes.include?(mode)\r\n error \"Error: Found #{mode} but expected #{modes.inspect}\"\r\n end\r\n\r\n m... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET request to view house bills that have been marked as "paid" | def paid
@home = Home.find params[:home_id].to_i
@bills = @home.bills.where(paid: true).all
end | [
"def show_pending_bills\n @bills = Bill.where(status: 'pending')\n end",
"def requests\n @bills = Bill.where :approved => false\n\n respond_to do |format|\n format.html # requests.html.erb\n format.json { render json: @bills }\n end\n end",
"def pay_bills\n paid_bills = Bill.pay_bills... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST request to send Paypal payment of total amount of bill from current_user to user who posted bill. Sandbox credentials. | def pay
@bill = Bill.find_by(id: params[:bill_id].to_i, home_id: params[:home_id].to_i)
@payment = Payment.new(description: @bill.name, amount: @bill.amount,
recipient_paypal_email: @bill.user.paypal)
@recipient = @payment.recipient_paypal_email
@payment.sender_paypal_email = current_user.paypal
... | [
"def create\n @bill = Bill.new(bill_params)\n @bill.status = \"pending\"\n\n\n @bill.price = total(@bill)\n @bill.save\n if (user_signed_in?)\n redirect_to admins_url\n else\n redirect_to root_url\n end\n end",
"def create\n @bill = Bill.new(bill_params)\n @bill.status = \"pe... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create or patch a Certificate Revocation List Create or patch a Certificate Revocation List for the given id. The CRL is used to verify the client certificate status against the revocation lists published by the CA. For this reason, the administrator needs to add the CRL in certificate repository as well. The CRL must ... | def create_or_patch_tls_crl_with_http_info(crl_id, tls_crl, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificationRevocationListApi.create_or_patch_tls_crl ...'
end
# verify the required parameter 'crl_id' is set
if @... | [
"def create_or_patch_tls_crl_0_with_http_info(crl_id, tls_crl, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificationRevocationListApi.create_or_patch_tls_crl_0 ...'\n end\n # verify the required parameter 'crl_id' is s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create or patch a Certificate Revocation List Create or patch a Certificate Revocation List for the given id. The CRL is used to verify the client certificate status against the revocation lists published by the CA. For this reason, the administrator needs to add the CRL in certificate repository as well. The CRL must ... | def create_or_patch_tls_crl_0_with_http_info(crl_id, tls_crl, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificationRevocationListApi.create_or_patch_tls_crl_0 ...'
end
# verify the required parameter 'crl_id' is set
... | [
"def create_or_patch_tls_crl_with_http_info(crl_id, tls_crl, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificationRevocationListApi.create_or_patch_tls_crl ...'\n end\n # verify the required parameter 'crl_id' is set\n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show CRL Data for the Given CRL id. Returns information about the specified CRL. For additional information, include the ?details&x3D;true modifier at the end of the request URI. | def get_tls_crl_with_http_info(crl_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: PolicyInfraCertificatesCertificationRevocationListApi.get_tls_crl ...'
end
# verify the required parameter 'crl_id' is set
if @api_client.config.client_side_val... | [
"def get_crl_with_http_info(crl_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.get_crl ...\"\n end\n # verify the required parameter 'crl_id' is set\n if @api_client.config.client_side_validation && crl_id.ni... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Lists books and their status | def list_books
@books.each {|book| puts "'#{book.title}' is #{book.status}." }
end | [
"def list_books\n @books.each do |book|\n puts \"#{book.title}: #{book.status}\"\n end\n end",
"def list_books\n @books.each { |book| puts book.title + \" by \" + book.author + \" is \" + book.status + \".\" }\n end",
"def list_books\n @books.each do |book|\n print book.title + ' - ' + b... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Changes the status of a book from available (the default) to "checked out" Moves the book from the library's available_books array to the borrower's borrowed_books array Prohbits user from taking more than 2 books Arugemts: user, book user is an argument for book in the Book class. book is an object of the Book class. | def check_out(user, book)
if user.borrowed_books.length == 2
puts "Sorry #{user.name}, you have already checked out two books."
return
end
if book.status == "available"
book.borrower = user
user.borrowed_books.push(book)
book.status = "checked out"
puts "#{user.name} ch... | [
"def check_out(user, book)\n \n if book.status == :available\n \n if user.user_books.size < 2\n \n book.borrower = user\n user.user_books << book\n book.status = :borrowed\n \n else\n \n puts \"Sorry, you cannot check out any more books\"\n \n... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lists out books held by borrower | def borrowed_books_list
@borrowed_books.each {|book| puts "'#{book.title}' by #{book.author}" }
end | [
"def borrowed_books_list\n @borrowed_books.each do |book|\n puts \"#{book.title} by #{book.author}\"\n end\n end",
"def borrowed_books_list\n @borrowed_books.each { |book| \n puts book.title + \" by \" + book.author + \".\"\n }\n end",
"def borrowed_books_list\n @checked_out_books.eac... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create a new bin | def create(bin_params)
@rest.post('save', bin_params)
end | [
"def setup_new_bin(bins, bin_id)\n bins[ bin_id ] = Bin.new\n bins[ bin_id ].p = []\n bins[ bin_id ].c = []\n end",
"def create_binary\n prerun\n assemble\n log.debug \"BinaryInit #{@cpu_init.object_id.to_s(16)}\"\n end",
"def create_new_bin(new_value)\n bins.each_with_index do ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
create revision for bin | def create_revision(id, bin_params)
@rest.post("#{id}/save", bin_params)
end | [
"def generate_revision_file(r)\n rev_file = Spontaneous.revision_root / 'REVISION'\n File.open(rev_file, 'w') { |f| f.write(Spontaneous::Media.pad_revision(r)) }\n end",
"def make_revision()\n rev = self.revisions.create()\n rev.value_proposition = self.business_plan.plan_parts.find_by_ti... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns :open or :closed when override is present, otherwise nil. | def overridden_status
if @override
@override.downcase.to_sym
end
end | [
"def open?\n type == 'open'\n end",
"def open?\n @open\n end",
"def open\n return nil if @open.nil?\n @open ? '1' : '0'\n end",
"def preferred?\n self.preferred\n end",
"def open_for_comments?\n case options[:open]\n when true, false: return options[:open]\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Generate train and test data indices by randomly selecting group labels. | def split(_x, _y, groups)
classes = groups.to_a.uniq.sort
n_groups = classes.size
n_test_groups = (@test_size * n_groups).ceil.to_i
n_train_groups = @train_size.nil? ? n_groups - n_test_groups : (@train_size * n_groups).floor.to_i
unless n_test_groups.between?(1, n_groups)
... | [
"def random_attribute_indexes number\n (0...@data.first.size).sort_by { rand }[0..number]\n end",
"def random_centroids(k, data)\n centroids = []\n min_max_mapper = []\n feature_index_map = []\n (0..@feature_count-1).each_with_index do |x, index|\n feature_index_map = data.map { |k| k[index] }\n ... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return a logger with the specified prefix | def with_prefix (string)
Logger.send(:new, string)
end | [
"def log_prefix\n \"[#{tag}: #{name}]\"\n end",
"def logging_prefix\n @gapi[\"logging\"][\"logObjectPrefix\"] if @gapi[\"logging\"]\n end",
"def logging_prefix\n @gapi.logging&.log_object_prefix\n end",
"def find_or_create_logger(fullname)\n Log4r::Logger[fullname.to_s... | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Yield with a temporarily incremented indent counter | def with_indent ()
thread[:indent] += 1
yield
ensure
thread[:indent] -= 1
end | [
"def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend",
"def indent\r\n @indent_level += 1\r\n newline\r\n yield\r\n @indent_level -= 1\r\n self\r\n end",
"def indented(&block)\n @indent += 1\n yield\n @indent += 1\n end",
"def next_indent... | {
"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.