query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Retrieves available mixins of a specified type or all available mixins if the type wasn't specified. Mixins are returned in the form of mixin identifiers. | def get_mixins(type = nil)
if type
# is type valid?
raise "Unknown mixin type! #{type}" unless @mixins.has_key? type.to_sym
# return mixin of the selected type
@mixins[type.to_sym]
else
# we did not get a type, return all mixins
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_mixin(name, type = nil, describe = false)\n\n Occi::Log.debug(\"Looking for mixin #{name} + #{type} + #{describe}\")\n\n # is type valid?\n if type\n raise \"Unknown mixin type! [#{type}]\" unless @mixins.has_key? type.to_sym\n end\n\n # TODO: extend... | [
"0.6220817",
"0.6093635",
"0.5246576",
"0.5061629",
"0.50506806",
"0.5022578",
"0.49531978",
"0.49368724",
"0.481214",
"0.47991818",
"0.47848308",
"0.47665864",
"0.47330073",
"0.4672994",
"0.4659485",
"0.4655962",
"0.45904776",
"0.45505047",
"0.45398846",
"0.44896248",
"0.448... | 0.8676375 | 0 |
Retrieves available mixin types. Mixin types are presented in a shortened format (i.e. not as type identifiers). | def get_mixin_types
@mixins.keys.map { |k| k.to_s }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mixins(type = nil)\n if type\n # is type valid?\n raise \"Unknown mixin type! #{type}\" unless @mixins.has_key? type.to_sym\n\n # return mixin of the selected type\n @mixins[type.to_sym]\n else\n # we did not get a type, return all mi... | [
"0.71516925",
"0.66711587",
"0.56752825",
"0.5498893",
"0.5451157",
"0.5315886",
"0.5297385",
"0.5184562",
"0.51687837",
"0.5104759",
"0.5085771",
"0.50241375",
"0.49645305",
"0.4962468",
"0.49435604",
"0.49228716",
"0.4891364",
"0.48911783",
"0.4879527",
"0.48722428",
"0.486... | 0.8134472 | 0 |
Retrieves available mixin type identifiers. | def get_mixin_type_identifiers
identifiers = []
get_mixin_types.each do |mixin_type|
identifiers << 'http://schemas.ogf.org/occi/infrastructure#' + mixin_type
end
identifiers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mixin_types\n @mixins.keys.map { |k| k.to_s }\n end",
"def get_mixins(type = nil)\n if type\n # is type valid?\n raise \"Unknown mixin type! #{type}\" unless @mixins.has_key? type.to_sym\n\n # return mixin of the selected type\n @mixins... | [
"0.80996203",
"0.66814935",
"0.5944612",
"0.5617854",
"0.56126696",
"0.528932",
"0.52736497",
"0.5213063",
"0.5212991",
"0.52109706",
"0.5203591",
"0.5188573",
"0.51802635",
"0.5156073",
"0.5111223",
"0.50855166",
"0.5084374",
"0.505663",
"0.49910834",
"0.49840686",
"0.497432... | 0.7986701 | 1 |
Retrieves descriptions for available resources specified by a type identifier or resource location. If no type identifier or location is specified, all available resources in all available resource types will be described. | def describe(resource_type_identifier=nil)
# convert type to type identifier
resource_type_identifier = @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.first.type_identifier if @model.kinds.select {
|kind| kind.term == resource_type_identifier
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_resources(resource_descr, resource_type, authorizer)\n debug \"find_resources: descr: '#{resource_descr.inspect}'\"\n if resource_descr.kind_of? Hash\n can_handle = eval(\"OMF::SFA::Model::#{resource_type.classify}\").respond_to? :handle_rest_get_resource\n if can_handle\n ... | [
"0.6783209",
"0.65141547",
"0.6345092",
"0.6174524",
"0.6174524",
"0.5971894",
"0.5926456",
"0.5900285",
"0.5882157",
"0.5881542",
"0.58698535",
"0.58470976",
"0.58366823",
"0.58180326",
"0.58154243",
"0.57796943",
"0.5745785",
"0.56759906",
"0.56659013",
"0.56436163",
"0.559... | 0.74328613 | 0 |
Deploys a compute resource based on an OVF/OVA descriptor available on a local file system. | def deploy(location)
media_types = self.class.head(@endpoint).headers['accept'].to_s
raise "File #{location} does not exist" unless File.exist? location
file = File.read(location)
if location.include? '.ovf'
if media_types.include? 'application/ovf'
he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend",
"def deploy_ovf\n... | [
"0.5762656",
"0.56625205",
"0.5618709",
"0.56102574",
"0.5570687",
"0.55029815",
"0.5497632",
"0.5478713",
"0.54700017",
"0.545718",
"0.5423394",
"0.5391553",
"0.5349144",
"0.5340445",
"0.53124243",
"0.52754676",
"0.5273615",
"0.5273008",
"0.5272535",
"0.5266649",
"0.5237224"... | 0.57692736 | 0 |
Triggers given action on a specific resource. | def trigger(resource_type_identifier, action)
# TODO: not tested
if @model.kinds.select { |kind| kind.term == resource_type }.any?
type_identifier = @model.kinds.select {
|kind| kind.term == resource_type_identifier
}.first.type_identifier
location ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_action\n raise \"Action for resource #{self.class} is nil!\" if @action.nil?\n\t\t\tif (self.respond_to? @action)\n\t\t\t\tself.send(@action)\n\t\t\tend\n\t\tend",
"def resource_action(resource)\n resource.action if resource.respond_to?(:action)\n end",
"def trigger(resource_type_ide... | [
"0.72843325",
"0.68376297",
"0.66839916",
"0.6670168",
"0.6620549",
"0.63868994",
"0.6315961",
"0.6310027",
"0.6249608",
"0.61784345",
"0.6167657",
"0.611064",
"0.6110357",
"0.6109257",
"0.61065155",
"0.6082767",
"0.6062792",
"0.6048649",
"0.60390425",
"0.60064507",
"0.595970... | 0.6943681 | 1 |
Refreshes the Occi::Model used inside the client. Useful for updating the model without creating a new instance or reconnecting. Saves a lot of time in an interactive mode. | def refresh
# re-download the model from the server
set_model
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh\n if new_model?\n return WscSdk::Errors.model_does_not_exist(self.endpoint)\n else\n return self.endpoint.refresh(self)\n end\n end",
"def reload!\n ensure_service!\n @gapi_json = service.get_model dataset_id, model_id\n @reference = nil\n ... | [
"0.72774494",
"0.69155174",
"0.6836855",
"0.6687198",
"0.6518902",
"0.6508058",
"0.64933074",
"0.6480971",
"0.6407291",
"0.6396982",
"0.6396982",
"0.63861495",
"0.6360549",
"0.6360549",
"0.6346192",
"0.6346192",
"0.6329491",
"0.623688",
"0.6203208",
"0.6203208",
"0.62001175",... | 0.82634836 | 0 |
Performs POST requests and returns URI locations. Resource data must be provided in an Occi::Collection instance. | def post(path, collection)
# remove the leading slash
path = path.gsub(/\A\//, '')
headers = self.class.headers.clone
headers['Content-Type'] = @media_type
response = case @media_type
when 'application/occi+json'
self.class.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, collection)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = @media_type\n\n response = case @media_type\n when 'application/occi+json'\n self.class.post(@... | [
"0.6200585",
"0.5874095",
"0.58321387",
"0.56579345",
"0.5649235",
"0.5547596",
"0.5384626",
"0.5366917",
"0.5357277",
"0.5171335",
"0.5162472",
"0.51528513",
"0.5135156",
"0.50979334",
"0.5093289",
"0.5046608",
"0.50332016",
"0.50166285",
"0.50048697",
"0.50016797",
"0.50004... | 0.6008173 | 1 |
Checks whether the given endpoint URI is valid and adds a trailing slash if necessary. | def prepare_endpoint(endpoint)
raise 'Endpoint not a valid URI' if (endpoint =~ URI::ABS_URI).nil?
@endpoint = endpoint.chomp('/') + '/'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_url_ends_with_slash(url)\n return \"#{url}/\" unless url.end_with?(\"/\")\n\n return url\n end",
"def valid_endpoint(ep)\n if ep == nil\n raise ArgumentError, \"Request: An endpoint must be set\", caller\n elsif not ep.is_a? String\n raise TypeError, \"Request: An ... | [
"0.6731609",
"0.67035586",
"0.6083759",
"0.5896076",
"0.5839203",
"0.5778053",
"0.5755815",
"0.5754997",
"0.57444066",
"0.5742326",
"0.5742126",
"0.5670484",
"0.5648423",
"0.5637107",
"0.56367683",
"0.55857885",
"0.55705106",
"0.55676526",
"0.55026746",
"0.545672",
"0.5445191... | 0.6924188 | 0 |
Sets media type. Will choose either application/occi+json or text/plain based on the formats supported by the server. | def set_media_type
media_types = self.class.head(@endpoint).headers['accept']
Occi::Log.debug("Available media types: #{media_types}")
@media_type = case media_types
when /application\/occi\+json/
'application/occi+json'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end",
"def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end",
... | [
"0.7306967",
"0.7081636",
"0.6980447",
"0.69575226",
"0.69351524",
"0.6924226",
"0.68415236",
"0.68415236",
"0.68244916",
"0.6807563",
"0.6763445",
"0.6716374",
"0.66997755",
"0.6679754",
"0.66793036",
"0.6673945",
"0.66519827",
"0.66429466",
"0.6641115",
"0.66336405",
"0.662... | 0.88380545 | 0 |
GET /employees_courses GET /employees_courses.json | def index
@employees_courses = EmployeesCourse.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do |format|\n format.json { render json: @courses }\n end\n end",
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\t... | [
"0.7282056",
"0.7093469",
"0.6999676",
"0.6976667",
"0.68742204",
"0.68742204",
"0.6874116",
"0.6848213",
"0.68420035",
"0.68248683",
"0.68147564",
"0.68008804",
"0.6742614",
"0.6714613",
"0.66907656",
"0.66861355",
"0.66812384",
"0.66668737",
"0.66541517",
"0.6651596",
"0.66... | 0.73660785 | 0 |
POST /employees_courses POST /employees_courses.json | def create
@employees_course = EmployeesCourse.new(employees_course_params)
respond_to do |format|
if @employees_course.save
format.html { redirect_to @employees_course, notice: 'Employees course was successfully created.' }
format.json { render :show, status: :created, location: @employe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # render plain: params[:courses].inspect\n @courses = Courses.new(courses_params)\n\n respond_to do |format|\n if @courses.save\n format.html { redirect_to @courses, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @cour... | [
"0.6910871",
"0.6702445",
"0.6649024",
"0.65967023",
"0.6588424",
"0.65450495",
"0.6512265",
"0.6501965",
"0.6476073",
"0.647102",
"0.64575523",
"0.64249516",
"0.64211714",
"0.64192003",
"0.64189523",
"0.64103806",
"0.6395128",
"0.6394402",
"0.63934445",
"0.63852435",
"0.6381... | 0.740562 | 0 |
PATCH/PUT /employees_courses/1 PATCH/PUT /employees_courses/1.json | def update
respond_to do |format|
if @employees_course.update(employees_course_params)
format.html { redirect_to @employees_course, notice: 'Employees course was successfully updated.' }
format.json { render :show, status: :ok, location: @employees_course }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @people_course.update(people_course_params)\n format.html { redirect_to @people_course, notice: 'People course was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_course }\n else\n format.html { render ... | [
"0.6617335",
"0.65584505",
"0.6534825",
"0.64913106",
"0.6380788",
"0.63575864",
"0.6347183",
"0.63464504",
"0.6316902",
"0.630994",
"0.6300922",
"0.62957674",
"0.6293419",
"0.6285283",
"0.628249",
"0.6281093",
"0.627873",
"0.6277494",
"0.6276635",
"0.6276635",
"0.6276635",
... | 0.7268662 | 0 |
DELETE /employees_courses/1 DELETE /employees_courses/1.json | def destroy
@employees_course.destroy
respond_to do |format|
format.html { redirect_to employees_courses_url, notice: 'Employees course was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @lab_course = LabCourse.find(params[:id])\n @lab_course.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_course.destroy\n respond_to do |format|\n format.html { r... | [
"0.7250819",
"0.716362",
"0.7140621",
"0.7129735",
"0.7129735",
"0.7129735",
"0.7129735",
"0.71178794",
"0.71085334",
"0.71012354",
"0.70828307",
"0.70738924",
"0.70675176",
"0.7064452",
"0.706285",
"0.7058525",
"0.7053691",
"0.7052165",
"0.70478106",
"0.7047593",
"0.7047593"... | 0.74800825 | 0 |
==========Validating book, with unique UUID================================================= | def validate_books
csv_text = open(file.url)
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
book_hash = Book.new
book_hash.title = row["Book title"]
book_hash.author = Author.find_or_create_by(name: row["Book author"])
book_ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_uuid_format?(uuid)\n !!(uuid =~ /^[A-Za-z0-9_\\-]{16,}$/)\n end",
"def uuid?(uuid)\n uuid_regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/\n uuid_regex.match?(uuid.to_s.downcase)\nend",
"def test_unique_book_isbn\n \n book = Book.new(:title =>... | [
"0.67580456",
"0.6702425",
"0.6605779",
"0.6515341",
"0.6489125",
"0.6405775",
"0.63885117",
"0.6324985",
"0.62857693",
"0.6285451",
"0.6285451",
"0.62851685",
"0.62572175",
"0.62572175",
"0.6249086",
"0.6175638",
"0.616393",
"0.6134245",
"0.5933415",
"0.5877097",
"0.5877097"... | 0.69789755 | 0 |
INSTANCE METHODS Returns the date the last email of a specified category was sent | def email_sent_at(category)
emails = self.email_logs.select {|e| e.category == category}
emails.collect {|e| e.created_at}.sort.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emails_sent_at(category)\r\n emails = self.email_logs.select {|e|e.category == category}\r\n emails.collect {|e| e.created_at}.sort\r\n end",
"def last_contacted\n object.channels.where(is_private: true).first.last_message_time\n end",
"def last_delivered_date_time\n return @last_... | [
"0.6987794",
"0.6244684",
"0.60381854",
"0.60023266",
"0.59639037",
"0.59062535",
"0.58860993",
"0.58854175",
"0.57728815",
"0.5771505",
"0.5694127",
"0.5636091",
"0.5574436",
"0.5558278",
"0.55399436",
"0.54809076",
"0.5477554",
"0.5466854",
"0.54450583",
"0.5421657",
"0.540... | 0.80622375 | 0 |
Returns an array of the dates the email of a specified category was sent | def emails_sent_at(category)
emails = self.email_logs.select {|e|e.category == category}
emails.collect {|e| e.created_at}.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_sent_at(category)\r\n emails = self.email_logs.select {|e| e.category == category}\r\n emails.collect {|e| e.created_at}.sort.last\r\n end",
"def emails(category = nil)\r\n return category ? self.email_logs.select {|e| e.category == category} : self.email_logs\r\n end",
"def get_mails\n ... | [
"0.8045334",
"0.7213177",
"0.59212357",
"0.5675265",
"0.56417847",
"0.5412332",
"0.53950673",
"0.5337325",
"0.5273472",
"0.527337",
"0.52124107",
"0.52004474",
"0.51962835",
"0.5196167",
"0.5133509",
"0.50920033",
"0.5091613",
"0.5084544",
"0.5077146",
"0.5075498",
"0.5065847... | 0.8071173 | 0 |
Returns all emails or all emails of a specified category (if given) | def emails(category = nil)
return category ? self.email_logs.select {|e| e.category == category} : self.email_logs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_sent_at(category)\r\n emails = self.email_logs.select {|e| e.category == category}\r\n emails.collect {|e| e.created_at}.sort.last\r\n end",
"def index\n @emails = Email.where(\"category=?\", current_user.id%2).paginate(:page => params[:page])\n # @emails = Email.where(\"category=?\", curr... | [
"0.62495255",
"0.61910415",
"0.6139023",
"0.6003403",
"0.56699127",
"0.5651843",
"0.5591714",
"0.55803734",
"0.54984456",
"0.5470508",
"0.5468105",
"0.5408793",
"0.53955835",
"0.53639007",
"0.5339856",
"0.5300101",
"0.52669877",
"0.52366275",
"0.5226064",
"0.5197954",
"0.5150... | 0.8209447 | 0 |
Public: Deposit Money in a pot amount The amount to deposit, in pennies. source_account_id The account_id of the account to withdraw from. dedupe_id (optional) A random string, to prevent duplicate deposits. Returns self: a single Monzo::Pot | def deposit!(amount, source_account_id, dedupe_id = SecureRandom.uuid)
data = {
amount: amount,
source_account_id: source_account_id,
dedupe_id: dedupe_id,
}
response = Monzo.client.put("/pots/#{@id}/deposit", data)
parsed_response = parse_response(response)
update... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def withdraw!(amount, destination_account_id, dedupe_id = SecureRandom.uuid)\n data = {\n amount: amount,\n destination_account_id: destination_account_id,\n dedupe_id: dedupe_id,\n }\n\n response = Monzo.client.put(\"/pots/#{@id}/withdraw\", data)\n parsed_response = parse... | [
"0.63066536",
"0.54378045",
"0.52988845",
"0.5282323",
"0.5272958",
"0.52329355",
"0.5188685",
"0.51588774",
"0.5135322",
"0.5135322",
"0.5124892",
"0.50152",
"0.49326217",
"0.4913594",
"0.49131262",
"0.49029785",
"0.48937592",
"0.4889848",
"0.48779532",
"0.4859872",
"0.48578... | 0.78251565 | 0 |
Public: Withdraw Money from a pot amount The amount to withdraw, in pennies. destination_account_id The account_id of the account to deposit into. dedupe_id (optional) A random string, to prevent duplicate deposits. Returns self: a single Monzo::Pot | def withdraw!(amount, destination_account_id, dedupe_id = SecureRandom.uuid)
data = {
amount: amount,
destination_account_id: destination_account_id,
dedupe_id: dedupe_id,
}
response = Monzo.client.put("/pots/#{@id}/withdraw", data)
parsed_response = parse_response(respo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deposit!(amount, source_account_id, dedupe_id = SecureRandom.uuid)\n data = {\n amount: amount,\n source_account_id: source_account_id,\n dedupe_id: dedupe_id,\n }\n\n response = Monzo.client.put(\"/pots/#{@id}/deposit\", data)\n parsed_response = parse_response(respons... | [
"0.70585525",
"0.5388718",
"0.5341916",
"0.5332373",
"0.51238686",
"0.51234907",
"0.51031196",
"0.5100767",
"0.5096095",
"0.50661516",
"0.50661516",
"0.50245917",
"0.49921238",
"0.49921238",
"0.498018",
"0.49618948",
"0.495959",
"0.49303898",
"0.48987123",
"0.48985964",
"0.48... | 0.7733153 | 0 |
Private: Update the Pot instance variables parsed_response a hash whose keys exactly match the instance variables for Monzo::Pot. Returns self (an instance of Monzo::Pot) | def update_self(parsed_response)
instance_variables.each do |iv|
instance_variable_set(iv, parsed_response[iv.to_s[1..-1].to_sym])
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pot\n @pot = Pot.find(params[:id])\n end",
"def set_pot\n @pot = Pot.find(params[:pot_id])\n end",
"def parse_response(response)\n response = sanitize_response_keys(response.parsed_response)\n end",
"def update\n pot = Pot.find_by(game_id: params[:id])\n\n player... | [
"0.5730362",
"0.5544215",
"0.5327246",
"0.5315911",
"0.53124005",
"0.5204266",
"0.51660633",
"0.51212996",
"0.50939006",
"0.5052703",
"0.50027585",
"0.49511257",
"0.49487406",
"0.4944145",
"0.4937013",
"0.4935006",
"0.49239412",
"0.4900529",
"0.48654515",
"0.48588693",
"0.485... | 0.6521878 | 0 |
Initializes a FSEvent worker and adds a watcher for each directory passed to the adapter. | def init_worker
FSEvent.new.tap do |worker|
worker.watch(@directories.dup, :latency => @latency) do |changes|
next if @paused
@mutex.synchronize do
changes.each { |path| @changed_dirs << path.sub(LAST_SEPARATOR_REGEX, '') }
end
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_worker\n worker = FChange::Notifier.new\n @directories.each do |directory|\n watcher = worker.watch(directory, :all_events, :recursive) do |event|\n next if @paused\n @mutex.synchronize do\n @changed_dirs << File.expand_path(event.watcher.path)\n ... | [
"0.8124498",
"0.78232884",
"0.7797833",
"0.7709866",
"0.73683584",
"0.73361504",
"0.7202465",
"0.7145659",
"0.6529733",
"0.65076244",
"0.6358155",
"0.61851114",
"0.6147244",
"0.61304307",
"0.6000078",
"0.5930538",
"0.58909774",
"0.58385676",
"0.58384943",
"0.5820677",
"0.5814... | 0.7931124 | 1 |
GET /providers/1 GET /providers/1.json | def show
@provider = current_company.providers.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n for... | [
"0.7272243",
"0.71885544",
"0.7069674",
"0.7069674",
"0.7021322",
"0.7003939",
"0.6984918",
"0.69745284",
"0.6815935",
"0.68077725",
"0.6729551",
"0.663642",
"0.6533136",
"0.6529574",
"0.649691",
"0.649691",
"0.6464657",
"0.6430917",
"0.6402912",
"0.63958097",
"0.634581",
"... | 0.72955817 | 0 |
GET /providers/new GET /providers/new.json | def new
@provider = current_company.providers.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @provider }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\... | [
"0.8272507",
"0.80500466",
"0.80500466",
"0.7682416",
"0.7482539",
"0.74049795",
"0.7310524",
"0.7274704",
"0.7225364",
"0.7138865",
"0.71240705",
"0.70831877",
"0.70654607",
"0.7050149",
"0.6999865",
"0.6998997",
"0.694804",
"0.6858532",
"0.6855384",
"0.68447495",
"0.6811392... | 0.8236406 | 1 |
POST /providers POST /providers.json | def create
@provider = current_company.providers.new(params[:provider])
respond_to do |format|
if @provider.save
format.html { redirect_to @provider, notice: 'Provider was successfully created.' }
format.json { render json: @provider, status: :created, location: @provider }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n ... | [
"0.7196066",
"0.6896307",
"0.6886106",
"0.6805139",
"0.67927444",
"0.6713015",
"0.6592217",
"0.65495884",
"0.64063054",
"0.63403493",
"0.6326314",
"0.63182",
"0.6274265",
"0.62492526",
"0.6234781",
"0.6211055",
"0.6205681",
"0.618968",
"0.61692774",
"0.61692774",
"0.6157692",... | 0.69564795 | 1 |
PUT /providers/1 PUT /providers/1.json | def update
@provider = current_company.providers.find(params[:id])
respond_to do |format|
if @provider.update_attributes(params[:provider])
format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @provider = Provider.find(params[:id])\n\n if @provider.update(provider_params)\n head :no_content\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |r... | [
"0.69004023",
"0.6817214",
"0.6646538",
"0.6624912",
"0.6624912",
"0.6613555",
"0.6586571",
"0.644157",
"0.64100003",
"0.63752437",
"0.6365661",
"0.63542736",
"0.6322013",
"0.6146228",
"0.61225057",
"0.6073541",
"0.6050184",
"0.6047935",
"0.60016364",
"0.5998813",
"0.5991263"... | 0.68262064 | 1 |
it can start if all requests are valid | def validate_can_start
if aasm_states_to_check
cannot_start! if requests_have_notices?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_requests\n if requests.empty?\n errors.add('requests', 'there were no requests')\n return\n end\n\n requests.each do |request|\n next if request.valid?\n\n request.errors.each do |k, v|\n errors.add(k, v)\n end\n end\n ... | [
"0.6673162",
"0.61371994",
"0.60237217",
"0.5910861",
"0.5910861",
"0.58853775",
"0.58444864",
"0.58149236",
"0.5792667",
"0.5693341",
"0.56818587",
"0.5677432",
"0.5666639",
"0.5664971",
"0.5627509",
"0.5614598",
"0.5600875",
"0.5568299",
"0.5568299",
"0.5558949",
"0.5557413... | 0.6370992 | 1 |
Is the passed candidate a better match than any of the current matches? ARG: `other` another Candidate instance to check against the current set | def better_match?( other )
return true if prefers?( other ) && free?
preference_index = preferences.index other
match_preference_indexes = matches.map { | match | preferences.index match }
preference_index and match_preference_indexes.any? { |i| i > preference_index }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than a... | [
"0.68644595",
"0.6494814",
"0.6171067",
"0.61165327",
"0.6103533",
"0.60148656",
"0.59837264",
"0.59695625",
"0.59534496",
"0.5951573",
"0.5924914",
"0.591324",
"0.5906214",
"0.5900777",
"0.5891475",
"0.58822894",
"0.5877805",
"0.5814154",
"0.58112717",
"0.5763609",
"0.574657... | 0.7467674 | 0 |
Have all possible preferences been cycled through? | def exhausted_preferences?
preference_position >= preferences.size - 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_options_main?\n no_preference_options.none? && not_counted_options.none?\n end",
"def has_pref?(preference)\n !prefs[preference].to_s.empty?\nend",
"def all_present?(values, preferences)\n values.map { |v| preferences.present?(key, v) }.inject(&:&)\n end",
"def check_if_all_donors_ready\n ... | [
"0.6566466",
"0.62994796",
"0.6233791",
"0.5991729",
"0.5973898",
"0.59432155",
"0.5911168",
"0.58726835",
"0.58512074",
"0.577376",
"0.5747453",
"0.57448065",
"0.5718785",
"0.567215",
"0.5671604",
"0.5659553",
"0.5609859",
"0.5583733",
"0.5580997",
"0.55703056",
"0.55646974"... | 0.7163214 | 0 |
Delete the leastpreferred candidate from the matches array | def free!
return false if matches.empty?
match_preference_indexes = matches.map { | match | preferences.index match }
max = match_preference_indexes.max # The index of the match with the lowest preference
candidate_to_reject = preferences[ max ]
# Delete from bot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trim(leaderboard, spectrum, n)\n lb_map = {}\n leaderboard.each do |peptide|\n linear_score = cyclopeptide_scoring_linear(peptide, spectrum)\n lb_map[peptide] = linear_score\n end\n sorted = lb_map.sort_by {|k,v| v}.reverse\n #puts sorted.join(\" \")\n for j in n..leaderboard.size-1\n if sorted[... | [
"0.6545749",
"0.60591125",
"0.5935808",
"0.59275573",
"0.5898502",
"0.58506805",
"0.5818517",
"0.5804726",
"0.57909524",
"0.5759192",
"0.5740732",
"0.56597257",
"0.56142044",
"0.5611859",
"0.55642396",
"0.55610824",
"0.55266535",
"0.55067164",
"0.5456877",
"0.5454079",
"0.544... | 0.772396 | 0 |
Match with another Candidate ARG: `other` another Candidate instance to match with | def match!( other )
return false unless prefers?( other ) && !matched?( other )
matches << other
other.matches << self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than a... | [
"0.6603004",
"0.6441187",
"0.6122854",
"0.6087162",
"0.6007609",
"0.5985993",
"0.5949671",
"0.58849823",
"0.58587086",
"0.57798433",
"0.570371",
"0.56930345",
"0.5680121",
"0.56729513",
"0.5651722",
"0.55331445",
"0.55325097",
"0.55183464",
"0.5515873",
"0.5504669",
"0.549498... | 0.6870588 | 0 |
If no argument is passed: Do we have at least as many matches as available `match_positions`? If another Candidate is passed: Is that candidate included in the matches? ARG: `other` [optional] another Candidate instance | def matched?( other = nil )
return full? if other.nil?
matches.include? other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than a... | [
"0.6844583",
"0.60324234",
"0.59679455",
"0.5843598",
"0.5828867",
"0.57141393",
"0.57013077",
"0.5695834",
"0.5681551",
"0.56805193",
"0.5590659",
"0.55807596",
"0.55698407",
"0.5568948",
"0.5542452",
"0.55119556",
"0.5470464",
"0.5466821",
"0.5452096",
"0.5418991",
"0.54105... | 0.6479525 | 1 |
Increment `preference_position` and return the preference at that position | def next_preference!
self.preference_position += 1
preferences.fetch preference_position
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_preference(name, value); end",
"def add_preference(name, value); end",
"def increment_position\n return unless in_list?\n # in_collection.where(:pos => my_position).\n adjust!(position_key => 1) \n save!\n end",
"def set_preference\n @preference = @user.preferenc... | [
"0.5632839",
"0.5632839",
"0.55967325",
"0.54378754",
"0.5403117",
"0.53960943",
"0.5393127",
"0.53751713",
"0.5368596",
"0.5325805",
"0.5211627",
"0.5195549",
"0.51651406",
"0.51442546",
"0.5065651",
"0.49772644",
"0.4976477",
"0.4962286",
"0.4920744",
"0.49167368",
"0.49121... | 0.81344205 | 0 |
Is there a preference for the passed Candidate? ARG: `other` another Candidate instance | def prefers?( other )
preferences.include? other
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than a... | [
"0.7430928",
"0.636545",
"0.6227747",
"0.62044257",
"0.61707366",
"0.6098413",
"0.60582626",
"0.6042046",
"0.5794268",
"0.5698413",
"0.5522648",
"0.5522648",
"0.5487993",
"0.54670405",
"0.5453134",
"0.54225063",
"0.54152876",
"0.5410544",
"0.5353254",
"0.5337093",
"0.53259563... | 0.686246 | 1 |
Track that a proposal was made then ask the other Candidate to respond to a proposal ARG: `other` another Candidate instance | def propose_to( other )
proposals << other
other.respond_to_proposal_from self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def respond_to_proposal_from( other )\n case\n # Is there a preference for the candidate?\n when !prefers?( other )\n false\n\n # Are there available positions for more matches?\n when free?\n match! other\n\n # Is the passed Candidate a better match than a... | [
"0.7188241",
"0.6226746",
"0.6129741",
"0.5652433",
"0.557418",
"0.5371597",
"0.5369692",
"0.5364737",
"0.53149235",
"0.5302787",
"0.5280947",
"0.52681935",
"0.5231875",
"0.52081865",
"0.51805854",
"0.51798797",
"0.5179091",
"0.517543",
"0.51699144",
"0.51572734",
"0.5151744"... | 0.7088853 | 1 |
Given another candidate, respond properly based on current state ARG: `other` another Candidate instance | def respond_to_proposal_from( other )
case
# Is there a preference for the candidate?
when !prefers?( other )
false
# Are there available positions for more matches?
when free?
match! other
# Is the passed Candidate a better match than any other match?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chosen(already, owner, other)\n\t\tif already && already.owner_id == owner.id && current_user\n\t\t\t\"chosen\"\n\t\telse\n\t\t\tother\n\t\tend\n\tend",
"def ==(other)\n @candidate == other.candidate\n end",
"def candidate\n @candidate\n end",
"def absorb other\n self.about = other.about if se... | [
"0.58686155",
"0.56267965",
"0.54296243",
"0.5399437",
"0.5344745",
"0.5316683",
"0.531268",
"0.52848715",
"0.5253057",
"0.523432",
"0.5177804",
"0.51527923",
"0.5124434",
"0.511018",
"0.511018",
"0.50795925",
"0.5076306",
"0.50705546",
"0.50595284",
"0.50595284",
"0.50595284... | 0.68670064 | 0 |
GET /tcm_patient_infos GET /tcm_patient_infos.json | def index
@tcm_patient_infos = TcmPatientInfo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patients\n patients = User.patients\n render json: { status: 200, data: patients }\n end",
"def show\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient }\n end\n end",
"def show\n @patient = Pat... | [
"0.70554125",
"0.67892295",
"0.67892295",
"0.67892295",
"0.67364836",
"0.66602945",
"0.66163933",
"0.6597303",
"0.6548129",
"0.6547083",
"0.65153813",
"0.6514795",
"0.65094537",
"0.64854074",
"0.64829165",
"0.6451389",
"0.6451389",
"0.64378923",
"0.6431249",
"0.6373956",
"0.6... | 0.7402122 | 0 |
POST /tcm_patient_infos POST /tcm_patient_infos.json | def create
@tcm_patient_info = TcmPatientInfo.new(tcm_patient_info_params)
respond_to do |format|
if @tcm_patient_info.save
format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully created.' }
format.json { render :show, status: :created, location: @tcm_pati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @patient = Patient.new(patient_params)\n if @patient.save\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n sex: @patient.sex,\n birthday: @patient.birthday,\n ... | [
"0.7071312",
"0.6810582",
"0.6775352",
"0.67720807",
"0.6768563",
"0.67647874",
"0.6763522",
"0.6763522",
"0.6763522",
"0.6752355",
"0.6729753",
"0.67196226",
"0.6707423",
"0.67057556",
"0.66948557",
"0.66915494",
"0.6676042",
"0.66522706",
"0.6624962",
"0.6589317",
"0.658829... | 0.76556325 | 0 |
PATCH/PUT /tcm_patient_infos/1 PATCH/PUT /tcm_patient_infos/1.json | def update
respond_to do |format|
if @tcm_patient_info.update(tcm_patient_info_params)
format.html { redirect_to @tcm_patient_info, notice: 'Tcm patient info was successfully updated.' }
format.json { render :show, status: :ok, location: @tcm_patient_info }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @patient = @client.patients.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient])\n format.html { redirect_to @patient, notice: 'Patient was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render a... | [
"0.725539",
"0.7012029",
"0.6971339",
"0.6951263",
"0.6946573",
"0.69266677",
"0.6917158",
"0.6913407",
"0.6913407",
"0.68744105",
"0.6867139",
"0.68494684",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
"0.6809252",
... | 0.7417913 | 0 |
DELETE /tcm_patient_infos/1 DELETE /tcm_patient_infos/1.json | def destroy
@tcm_patient_info.destroy
respond_to do |format|
format.html { redirect_to tcm_patient_infos_url, notice: 'Tcm patient info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @patient.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @patient = @client.patients.find(params[:id]) unless current_user.admin?\n @patient = Patient.find(params[:id]) if current_user.admin?\n if @patient.deleted_at.blank?\n ... | [
"0.74712026",
"0.724691",
"0.7223435",
"0.72109574",
"0.72109574",
"0.72109574",
"0.72109574",
"0.7210253",
"0.7210253",
"0.7210253",
"0.7210253",
"0.72084016",
"0.7202416",
"0.7188496",
"0.7169685",
"0.7144111",
"0.7080055",
"0.7076126",
"0.7060444",
"0.7043352",
"0.70326054... | 0.7604018 | 0 |
Gets three tweets from the passed in user. GET /api/getThreeTweets | def getThreeTweets
render json: TwitterAPI.get_top_3_tweets(params[:twitter_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\tuser = User.find_by(id: params[:user_id])\n\t\tif user.present?\n\t\t\tfollower_ids = user.followers.pluck(:id)\n\t\t\ttweets = Tweet.where(\"user_id IN (?)\", follower_ids).order(\"updated_at DESC\")\n\t\t\trender json: {:status=>\"success\", :code=>200, :message=>\"List of tweets from the users yo... | [
"0.62984455",
"0.62487525",
"0.62227035",
"0.616522",
"0.60715705",
"0.6037786",
"0.6032513",
"0.6025714",
"0.599853",
"0.5938325",
"0.59228003",
"0.58438045",
"0.5835036",
"0.5819893",
"0.58130115",
"0.57984716",
"0.57883453",
"0.57881767",
"0.57866645",
"0.5759745",
"0.5749... | 0.8384098 | 0 |
GET /api/getMatchCount Gets the number of matches | def getMatchCount
render json: Match.count(:user1 => params[:twitter_id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matched_count\n @results[MATCHED_COUNT]\n end",
"def return_count\n return @matchedCount\n end",
"def count\n Jhead.call(\"-c\", @match, @pattern).split(\"\\n\").size\n end",
"def total\n #use group matches instead of numFound for grouped response\n if response[:numFound].nil? \... | [
"0.7811867",
"0.73680633",
"0.6772427",
"0.6696992",
"0.6686159",
"0.6679146",
"0.6644658",
"0.6642344",
"0.659905",
"0.65537834",
"0.6549743",
"0.6533666",
"0.65194166",
"0.6441293",
"0.6402503",
"0.6402503",
"0.6402503",
"0.63880044",
"0.63629204",
"0.63445127",
"0.63402873... | 0.7972879 | 0 |
The list of rsync server resources in the resource collection | def rsync_resources
::ObjectSpace.each_object(::Chef::Resource).select do |resource|
resource.resource_name == :rsync_serve
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rsync_resources\n run_context.resource_collection.select do |resource|\n resource.is_a?(Chef::Resource::RsyncServe)\n end\n end",
"def all_servers\n Infrataster::Server.defined_servers.map { |i| server(i.name) }\nend",
"def resources\n @resources ||= []\n end",
"def l... | [
"0.8124576",
"0.6612449",
"0.65967375",
"0.6571224",
"0.6555147",
"0.6550174",
"0.64710927",
"0.63614774",
"0.63614774",
"0.63614774",
"0.63580257",
"0.63524985",
"0.6347986",
"0.63440347",
"0.63440347",
"0.63204473",
"0.6296061",
"0.6217164",
"0.61819506",
"0.6160323",
"0.61... | 0.7518149 | 1 |
PATCH/PUT /http_requests/1 PATCH/PUT /http_requests/1.json | def update
respond_to do |format|
if @http_request.update(http_request_params)
format.html { redirect_to @http_request, notice: 'Http request was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update!(**args)\n ... | [
"0.66446257",
"0.657836",
"0.6403797",
"0.6403797",
"0.6403797",
"0.6403797",
"0.64008933",
"0.631353",
"0.6285412",
"0.6282243",
"0.616621",
"0.6133736",
"0.6131959",
"0.6127629",
"0.6119125",
"0.60907555",
"0.60907555",
"0.6090604",
"0.6081874",
"0.60616857",
"0.605691",
... | 0.67752284 | 0 |
DELETE /http_requests/1 DELETE /http_requests/1.json | def destroy
@http_request.destroy
respond_to do |format|
format.html { redirect_to http_requests_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_co... | [
"0.72902673",
"0.72698855",
"0.72698855",
"0.72698855",
"0.7269352",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7248202",
"0.7142104",
"0.7133003",
"0.71133417",
"0.7000527",
"0.69743675",
"0.6964436",
"0.69609666",
"0.69480914",
"0.69298136",
"0.6928... | 0.76185346 | 1 |
Obtain a latex representation of the matrix | def latex_matrix
if @type == "controlled"
@matrix.map { |value, matrix| [value, latex_matrix_for(matrix)] }
else
latex_matrix_for @matrix
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latex_matrix(matrix)\n output = \"\\\\begin{tabular}{|#{'r|' * matrix.first.length}}\\n\"\n output << \"\\\\hline\\n\"\n output << matrix.map { |line| line.join(' & ') }.join(\"\\\\\\\\\\n\\\\hline\\n\")\n output << \"\\\\\\\\\\n\"\n output << \"\\\\hline\\n\"\n output << \"\\\\end{tabular}\\n\"\n outpu... | [
"0.8290379",
"0.71012217",
"0.68977416",
"0.6761417",
"0.6572086",
"0.65711564",
"0.6568459",
"0.65282416",
"0.6520839",
"0.65132385",
"0.6478552",
"0.63378495",
"0.62582946",
"0.624844",
"0.6235852",
"0.6088534",
"0.60782826",
"0.60709083",
"0.6010628",
"0.59935045",
"0.5988... | 0.8112606 | 1 |
GET /invoice_taxes/new GET /invoice_taxes/new.json | def new
@invoice_tax = InvoiceTax.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @invoice_tax }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @invoice_tax = InvoiceTax.new(params[:invoice_tax])\n\n respond_to do |format|\n if @invoice_tax.save\n format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully created.' }\n format.json { render json: @invoice_tax, status: :created, location: @invoice_tax... | [
"0.72811353",
"0.70327747",
"0.70327747",
"0.70283765",
"0.70208365",
"0.7017731",
"0.6928569",
"0.67786777",
"0.6765665",
"0.6748932",
"0.66771334",
"0.6674354",
"0.6673623",
"0.65672815",
"0.6561808",
"0.6487727",
"0.64467657",
"0.64467657",
"0.6436855",
"0.6417992",
"0.640... | 0.7654911 | 0 |
PUT /invoice_taxes/1 PUT /invoice_taxes/1.json | def update
@invoice_tax = InvoiceTax.find(params[:id])
respond_to do |format|
if @invoice_tax.update_attributes(params[:invoice_tax])
format.html { redirect_to @invoice_tax, notice: 'Invoice tax was successfully updated.' }
format.json { head :no_content }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_taxes\n @taxes = Tax.find(params[:id])\n end",
"def send_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/send_tax_invoice\").body)\n @attributes = response['items']\n true\n end",
"def request_tax_invoice\n response = JSON.parse(@client.patch(\"items/#{... | [
"0.72690123",
"0.65473086",
"0.65402716",
"0.65395427",
"0.6468368",
"0.6318023",
"0.62615436",
"0.6212539",
"0.61819965",
"0.61819965",
"0.61725813",
"0.6153089",
"0.61297953",
"0.61141306",
"0.60911906",
"0.6081959",
"0.60586464",
"0.6055749",
"0.6048677",
"0.6023475",
"0.6... | 0.68349093 | 1 |
DELETE /invoice_taxes/1 DELETE /invoice_taxes/1.json | def destroy
@invoice_tax = InvoiceTax.find(params[:id])
@invoice_tax.destroy
respond_to do |format|
format.html { redirect_to invoice_taxes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end",
"def destroy\n authorize @incoming_service_tax\n\n @incoming_service_tax.destroy\n respond_to do |format|\n format.html { redirect_to incoming_service_taxes_url }\n format.json { head :no_content }\n end\n e... | [
"0.78110135",
"0.707769",
"0.69402087",
"0.6878605",
"0.68302184",
"0.6818329",
"0.6697505",
"0.6692188",
"0.66610616",
"0.6653193",
"0.6630542",
"0.6627586",
"0.6627586",
"0.6627586",
"0.6627586",
"0.66273725",
"0.6596463",
"0.6591103",
"0.6579143",
"0.6578022",
"0.65642375"... | 0.7698269 | 1 |
Notify all connection listeners, that a notice message was received. | def handle(context)
# Notify all connection listeners by calling their on_server_response method.
super(context)
# Notify all connection listeners by calling their on_notice method.
notify(context) do |connection_listener|
connection_listener.on_notice(contex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(context)\n \n context.connection_listeners.each do |connection_listener|\n yield connection_listener\n end\n \n end",
"def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed ... | [
"0.62905645",
"0.62092376",
"0.6187387",
"0.61387825",
"0.59728163",
"0.59533626",
"0.5949166",
"0.5931795",
"0.59107006",
"0.57482326",
"0.5709943",
"0.57056373",
"0.56844634",
"0.56675494",
"0.5573993",
"0.5563017",
"0.5562117",
"0.5537423",
"0.54805326",
"0.54638547",
"0.5... | 0.628717 | 1 |
execute /bin/sh from vi | def send_vi_shell
send_ctrl_escape
data = ":!/bin/sh" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vi\n system \"vim ~/.scratchvim.rb\"\nend",
"def handle_shell(cmd)\n cmd = cmd[1, cmd.size - 2]\n result = \"\"\n export_vim\n IO.popen(\"sh -s\", 'w+') do |p|\n p.write cmd\n p.write \"\\nexit 0\\n\" # make shure to end it\n result = p.read\n end\n result.strip\n end"... | [
"0.6696476",
"0.6642108",
"0.6228469",
"0.6079588",
"0.5997068",
"0.59771395",
"0.5891756",
"0.5884789",
"0.58067703",
"0.57803935",
"0.5755008",
"0.57001007",
"0.5661485",
"0.5636625",
"0.5620029",
"0.56118035",
"0.559914",
"0.55802333",
"0.55049276",
"0.5504787",
"0.5499035... | 0.6804456 | 0 |
exit vi without saving | def send_vi_exit_nosave
send_ctrl_escape
data = ":q!" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_vi_exit_save\n send_ctrl_escape\n data = \":x!\" + \"\\n\"\n session.shell_write(data)\n end",
"def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend",
"def command_quit\n command_save\n exit(0)\n end",
"def vi\n ... | [
"0.7136679",
"0.63457584",
"0.63432187",
"0.6122709",
"0.6105719",
"0.60879666",
"0.59103423",
"0.58881104",
"0.58782023",
"0.58237094",
"0.5751046",
"0.57458407",
"0.57309943",
"0.56523895",
"0.558681",
"0.5556906",
"0.5555957",
"0.5551185",
"0.55152076",
"0.5491714",
"0.546... | 0.7385188 | 0 |
exit vi with saving | def send_vi_exit_save
send_ctrl_escape
data = ":x!" + "\n"
session.shell_write(data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_vi_exit_nosave\n send_ctrl_escape\n data = \":q!\" + \"\\n\"\n session.shell_write(data)\n end",
"def command_quit\n command_save\n exit(0)\n end",
"def exit\n\t\t\teditors.each do |ed|\n\t\t\t\tquit ed\n\t\t\tend\n\t\t\t@continue = false\n\t\tend",
"def exit... | [
"0.7302805",
"0.66112596",
"0.6165263",
"0.6039795",
"0.59225386",
"0.5856519",
"0.58551484",
"0.5772585",
"0.5742138",
"0.57154423",
"0.5635889",
"0.562363",
"0.5599144",
"0.55843806",
"0.55843806",
"0.5559939",
"0.55066425",
"0.5476224",
"0.54656345",
"0.5414928",
"0.540874... | 0.74668807 | 0 |
for assigning teacher to a course | def teacher_assign
@course_allocation = CourseAllocation.find_by_course_id(params[:id])
@course = Course.find(params[:id])
@teachers = get_teachers_for_institute
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_courses_teacher\n @courses_teacher = CoursesTeacher.find(params[:id])\n end",
"def assign_teacher\n @teacher = Teacher.find(params[:teacher_id])\n @teaching = Teaching.find(params[:id])\n @teaching.teacher = @teacher\n if @teaching.save\n flash[:notice] = \"Docente assegnato con ... | [
"0.7822968",
"0.78052306",
"0.7733629",
"0.76818025",
"0.7464994",
"0.7394245",
"0.7357507",
"0.7309564",
"0.7286604",
"0.7269256",
"0.72615325",
"0.7217374",
"0.72116303",
"0.72116303",
"0.7158139",
"0.7146397",
"0.7132286",
"0.7132286",
"0.7132286",
"0.7132286",
"0.7132286"... | 0.8252131 | 0 |
creates a button and form with a hidden field in order to pass ids across to new objects | def my_button_to(text, path, objs)
s = "<form method=\"get\" action=\"#{path}\" class=\"button_to\">
<div><input type=\"submit\" value=\"#{text}\"/></div>"
for obj in objs
if(!obj.nil?)
s+= "<input type=\"hidden\" name=\"#{obj.class.to_s.downcase}_id\" value=\"#{obj.id}\" />"
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def button_id(value)\n @submit_id = value\n end",
"def add\n frm.button(:value=>\"Add\").click\n end",
"def form_button_for(obj, name = nil)\n name ||= obj.object.new_record? ? 'Create' : 'Update'\n\n obj.button name, class: 'btn btn-theme', data: { disable_with: raw(\"<i class='fa fa-cir... | [
"0.6666378",
"0.66006607",
"0.6559309",
"0.6451646",
"0.6353997",
"0.63111794",
"0.61738646",
"0.61665714",
"0.61242944",
"0.61235887",
"0.61193067",
"0.61145574",
"0.6049062",
"0.6038238",
"0.6019454",
"0.6015727",
"0.60116994",
"0.59618545",
"0.59570044",
"0.595056",
"0.594... | 0.72084606 | 0 |
Function to build a radio button list | def radio_list(items)
rl = "<ul>"
if(!items.empty?)
for item in items
if(item.is_a?(Category)) #not currently used
rl += "#{radio_button_tag "category_ids[]", item.id, @items_to_select.include?(item), :id=>"a#{item.id}"}" + "<label for=\"a#{item.id}\">#{item.name}</label... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radiobuttons; end",
"def collection_radio_buttons(method, collection, value_method, text_method, options = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def radio_buttons(method, choices, options = {})\n choices.map!{ |i| i.is_a?(Array) ? i : [i] }\n build_shell(method, options, \"... | [
"0.7448311",
"0.69899714",
"0.6984335",
"0.69725823",
"0.6946345",
"0.68229556",
"0.6820075",
"0.6739062",
"0.65432394",
"0.64837223",
"0.6454941",
"0.64338064",
"0.6326125",
"0.6298247",
"0.6253906",
"0.6190775",
"0.6186663",
"0.61753744",
"0.61707795",
"0.61401755",
"0.6084... | 0.76315546 | 0 |
Function to build a checkbox list only usable for an array of the same class | def checkbox_list(items)
cl = "<ul>"
if(!items.empty?)
item_class = items[0].class.to_s
item_class_sub = item_class[0..0].to_s
for item in items
cl += "<li>#{check_box_tag(item_class +"_ids[]", item.id, @items_to_select.include?(item), :id=>"#{item_class_sub + "" + item.id.to_s}")}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkboxes; end",
"def checkboxes_for coll, &blok\n \n @checkbox ||= Class.new do \n \n def initialize &blok\n instance_eval(&blok)\n end\n \n def text txt\n @text = txt\n end\n \n def value txt\n @value = txt\n end\n \n def na... | [
"0.68280846",
"0.679491",
"0.6624006",
"0.65273535",
"0.63910574",
"0.6323731",
"0.6249029",
"0.6192223",
"0.61546016",
"0.61353314",
"0.61196727",
"0.6092349",
"0.60013986",
"0.5910738",
"0.5887161",
"0.58766425",
"0.5864241",
"0.58504075",
"0.58073705",
"0.5799527",
"0.5790... | 0.7032377 | 0 |
Creates a hash for all groups | def all_group_hash
hash = {}
for group in @all_groups
hash[group] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"def hash\n [group, x, y].hash\n end",
"def groups\n @groups ||= {}\n end",
"def generate_hash\n @tags.group_by do |x|\n x[:name]\n x.delete(:name)\n end\n end",
"def has... | [
"0.8311913",
"0.6860097",
"0.6604363",
"0.65066975",
"0.63019824",
"0.62774056",
"0.6254687",
"0.62543106",
"0.619326",
"0.6178484",
"0.61632216",
"0.61543566",
"0.6108044",
"0.6099868",
"0.60638934",
"0.6053439",
"0.60182005",
"0.6002634",
"0.6001861",
"0.6001835",
"0.600003... | 0.80437905 | 1 |
Creates a hash for all properties | def all_property_hash
hash = {}
items = @all_properties
for prop in items
hash[prop] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_properties_hash\n self.class.send(:property_list).inject({}) do |hash, property|\n hash.merge(property.to_hash(self))\n end\n end",
"def property_objects\n hash = {}\n self.class.properties.each { |prop| hash[prop] = @properties[prop] }\n hash\n end",
"def to_hash\n... | [
"0.73561674",
"0.7222284",
"0.72018546",
"0.7129041",
"0.7120944",
"0.71134275",
"0.70107436",
"0.69681937",
"0.69446194",
"0.6911096",
"0.6911096",
"0.6877544",
"0.6867742",
"0.6840477",
"0.6783789",
"0.67366326",
"0.6720364",
"0.66989625",
"0.6696661",
"0.66567147",
"0.6656... | 0.83505917 | 0 |
Creates a hash for all products | def all_product_hash
hash = {}
items = @all_products
for prod in items
hash[prod] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end",
"def all_prod_comp_hash(item=nil)\n\n hash = {}\n\n if(!item.nil?)\n items = item.components\n else\n items = @all_products\n end\n\n for comp in item... | [
"0.7073511",
"0.6473979",
"0.635769",
"0.63136965",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.62572646",
"0.6239127",
"0.6233616",
"0.61678636",
"0.6075923",
"0.6047452",
"0.6032454",
"0.5996097",
"0.5979352",
"0.5918926",
"0.59155... | 0.7736915 | 0 |
Creates a hash for all valuefields | def all_valuefield_hash
hash = {}
items = @all_valuefields
for vf in items
hash[vf] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values_hash\n hashify(:value)\n end",
"def fields_hash\n each_pair.to_h\n end",
"def field_hash\n\n self.yattributes || fields.inject({}) { |r, f| r[f.fkey] = f.value; r }\n end",
"def to_field_hash\n to_values_hash.flatten\n end",
"def hash\n raw = [name, t... | [
"0.74033475",
"0.7286386",
"0.72832227",
"0.71734506",
"0.7046589",
"0.6868515",
"0.68565035",
"0.6713206",
"0.66925",
"0.66783965",
"0.66783965",
"0.6637003",
"0.6631829",
"0.6589479",
"0.65876424",
"0.65799785",
"0.6552264",
"0.65461266",
"0.6529494",
"0.6504742",
"0.650053... | 0.84429306 | 0 |
Creates a hash for all images | def all_image_hash
hash = {}
items = @all_images
for img in items
hash[img] = {}
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_hash; end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def hash\n @real.hash ^ @image.hash\n end",
"def images\n @images ||= Hash.new\n end",
"def create_images\n imgNames = Hash[\n \tFile.join(Dir.home, 'Desktop/image1.png... | [
"0.75077754",
"0.69907784",
"0.6733545",
"0.6701184",
"0.6669953",
"0.6547589",
"0.6434566",
"0.64201224",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.6400155",
"0.63923895",
"0.6360124",
"0.6360124",
"0.624349",
"0.6210763",
"0.6206685",
... | 0.7829283 | 0 |
Creates a hash for all products and components | def all_prod_comp_hash(item=nil)
hash = {}
if(!item.nil?)
items = item.components
else
items = @all_products
end
for comp in items
hash[comp] = all_prod_comp_hash(comp)
end
return hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_product_hash\n hash = {}\n items = @all_products\n for prod in items\n hash[prod] = {}\n end\n return hash\n end",
"def hash\n [name, product_ids_any, product_ids_all, quantity_exact, quantity_min, quantity_max, all_products].hash\n end",
"def hash\n [description, filt... | [
"0.7531119",
"0.71283114",
"0.6604469",
"0.65833277",
"0.636211",
"0.62478995",
"0.6161364",
"0.61421555",
"0.6138925",
"0.6083583",
"0.60561466",
"0.6051967",
"0.60285294",
"0.6009138",
"0.6007196",
"0.5990676",
"0.5913872",
"0.5902172",
"0.5900502",
"0.5890153",
"0.5877546"... | 0.7326326 | 1 |
checks if move is on the board or if the position is taken | def valid_move?(board, position)
position.between?(0, 8) && !position_taken?(board, position)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(board, index)\n # Is the position taken?\n pos_taken = position_taken?(board, index)\n # Is the position on the board?\n on_board = index.between?(0, board.length - 1)\n # If position is open and on the board, return true,\n if !pos_taken && on_board\n return true\n else\n return false... | [
"0.80792993",
"0.8067555",
"0.8067508",
"0.7998108",
"0.7997551",
"0.7996043",
"0.79471105",
"0.7938306",
"0.7933517",
"0.79316616",
"0.79257625",
"0.7919123",
"0.7918614",
"0.79119545",
"0.7911005",
"0.7904976",
"0.78985584",
"0.7890923",
"0.7885436",
"0.7882803",
"0.7880304... | 0.8196325 | 0 |
Generate the video tag +options+ you can specify height/width/allowfullscreen for an individual video here | def video_tag(options = {})
options = ActiveRecord::Acts::Cinema::DEFAULT_OPTIONS.merge(options)
video_url = read_attribute(ActiveRecord::Acts::Cinema::SOURCE_PARAM)
width = options[:width]
height = options[:height]
allow_full_screen = options[:allow_full_screen] ? "tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_video_directly options={}\n # render video player\n content_tag(:div) do\n options[:value].collect do |video_md5|\n l1 = video_md5[0..1]\n l2 = video_md5[2..3]\n content_tag(:video,\n content_tag(:source, \"I'm sorry; your browser doesn't support HTML5 video in M... | [
"0.71909595",
"0.6952281",
"0.69388676",
"0.63539743",
"0.6339057",
"0.63382554",
"0.63025355",
"0.6230984",
"0.6212228",
"0.61467355",
"0.61361605",
"0.6087843",
"0.6050872",
"0.6015247",
"0.59435266",
"0.59200305",
"0.58018124",
"0.5798503",
"0.57810897",
"0.576828",
"0.574... | 0.77156365 | 0 |
Public: Prints the elements inside tree nodes in a PARENT LEFT RIGHT manner x Node, Preferably a root node Examples NOTE: Based on the mock tree structure at LINE:61 preoder_tree_walk(F) => F B A D C E G I H | def preoder_tree_walk(x)
unless x.nil?
p x.key
preoder_tree_walk(x.left)
preoder_tree_walk(x.right)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend",
"def preorder(node)\n return if !node\n print node.value, \" \"\n preorder(node.left... | [
"0.6997386",
"0.6885649",
"0.68095547",
"0.6699235",
"0.6674675",
"0.665289",
"0.6595587",
"0.6548316",
"0.653387",
"0.64814216",
"0.63783693",
"0.63685155",
"0.63498884",
"0.628961",
"0.62798953",
"0.62707573",
"0.6260636",
"0.62538236",
"0.6225005",
"0.6216512",
"0.62128687... | 0.709064 | 0 |
Calculates the minimum element in a row | def min (row_num)
row = @rows[row_num]
min = row[0]
row.each do |num|
if min == 0 then
min = num
end
if (num < min) && (num != 0) then
min = num
end
end
return min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min\n min = get(0,0)\n\tfor i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) < min)\n min = get(i,j)\n end\n end\n end\n min\n end",
"def min\n # Establecemos ... | [
"0.7722905",
"0.7538922",
"0.7506053",
"0.7400789",
"0.7291085",
"0.72551525",
"0.72491235",
"0.7223778",
"0.72022706",
"0.7177007",
"0.7140284",
"0.709822",
"0.70954186",
"0.7068832",
"0.7055058",
"0.7050754",
"0.70164704",
"0.7001922",
"0.70006156",
"0.69394386",
"0.6927789... | 0.81465644 | 0 |
Calculates the common factor of a row | def has_common (row_num, row_min)
row = @rows[row_num]
result = false
if row_min != 0 then
result = true
row.each do |num|
if result == true then
if (num != 0) && ((num.abs).modulo(row_min.abs) != 0) then
result = false
end
end
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_common_factors(arg_one,arg_two)\n max_factor_one, max_factor_two = arg_one / 2, arg_two / 2\n arg_one_factors = (2..max_factor_one).filter{|num| arg_one % num === 0 }\n arg_two_factors = (2..max_factor_two).filter{|num| arg_two % num === 0 }\n\n return arg_one_factors + arg_two_factors\n\nend",
"def ... | [
"0.61979204",
"0.6130847",
"0.6073339",
"0.5945819",
"0.583233",
"0.576845",
"0.57225376",
"0.5704762",
"0.5702288",
"0.5690293",
"0.5666728",
"0.5666728",
"0.56572676",
"0.5652409",
"0.5642133",
"0.56305593",
"0.5611286",
"0.55926484",
"0.559128",
"0.55783755",
"0.55783755",... | 0.6766124 | 0 |
Divides a whole row by its common factor (Row , Common Factor) | def reduce (row_num, row_min)
row = @rows[row_num]
for i in 0..(row.length - 1) do
@rows[row_num][i] = (@rows[row_num][i])/row_min
if @rows[row_num][i] == -0.0 then
@rows[row_num][i] = 0.0
end
end
num, den = row_min.to_fraction
if den == 1 then
puts "R#{row_num + 1} -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def divide_by(iFactor)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n @Function[:Points].each do |ioPoint|\n ioPoint[1] /= iFactor\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end",
... | [
"0.55781704",
"0.5515967",
"0.54971004",
"0.53898335",
"0.53534096",
"0.5316323",
"0.524927",
"0.5216814",
"0.51739395",
"0.51715213",
"0.5171128",
"0.5137487",
"0.51267326",
"0.51240975",
"0.510751",
"0.5067971",
"0.5049427",
"0.5044258",
"0.5015577",
"0.50066626",
"0.499020... | 0.5858023 | 0 |
Swaps two rows with each other (Index 's) | def swap (row1, row2)
row1_copy = @rows[row1]
row2_copy = @rows[row2]
new_row1 = row2_copy
new_row2 = row1_copy
@rows[row1] = new_row1
@rows[row2] = new_row2
puts "R#{row1 + 1} <-> R#{row2 + 1}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(index1,index2)\n if index1==index2\n return\n end\n # swap the entries in the list\n @content[index1],@content[index2] = @content[index2],@content[index1]\n # fix the indices map\n @indices[@content[index1]] = index1\n @indices[@content[index2]] = index2\n end",
"def swapper(a... | [
"0.68529135",
"0.6794802",
"0.6794802",
"0.6791486",
"0.6727307",
"0.65977305",
"0.6593027",
"0.65798867",
"0.6435022",
"0.63789755",
"0.63758546",
"0.63704634",
"0.6353265",
"0.634496",
"0.63039774",
"0.6301512",
"0.6294747",
"0.6292657",
"0.6292657",
"0.6292657",
"0.6292657... | 0.71538293 | 0 |
Substitutes Pivot Row (Array Index) with the row you are performing a row operation on (Array Index). Applies cancel_val (See cancel_val above) as the multiplier | def substitute (pivot_row_num, cancel_row_num, cancel_val)
for i in 0..(((@rows[pivot_row_num]).length) - 1)
@rows[cancel_row_num][i] = @rows[cancel_row_num][i] - (cancel_val)*(@rows[pivot_row_num][i])
if @rows[cancel_row_num][i] == -0.0 then
@rows[cancel_row_num][i] = 0.0
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_val (pivot_val, cancel)\n return cancel/pivot_val\n end",
"def inverted_rows(options = {})\n rows = voucher_rows\n rows.reject!(&:canceled?) unless options[:canceled]\n rows.map do |old|\n vr = old.dup\n vr.sum *= -1\n vr\n end\n end",
"def _reduce_479(val, _values, r... | [
"0.6452407",
"0.555063",
"0.53112596",
"0.52505565",
"0.5119662",
"0.5103442",
"0.5039365",
"0.501498",
"0.49772435",
"0.496464",
"0.47991565",
"0.47860178",
"0.4782933",
"0.47543213",
"0.4746215",
"0.47361553",
"0.47243476",
"0.46922165",
"0.468925",
"0.4661551",
"0.46506196... | 0.7500678 | 0 |
Prints matrix to Standard Output | def print_matrix
width = @rows.flatten.max.to_s.size
if width > 4 then
width = width - 0.5
end
puts @rows.map { |a|
"|#{ a.map { |i|
outp = ""
num, den = i.to_fraction
if den == 1 then
outp += "#{num}"
else
outp += "#{num}/#{den}"
end
"#{ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end",
"def print_matrix\n for i in 0...@number_of_rows\n for j in 0...@number_of_columns\n print @matrix[i][j]\n end\n puts ''\n end\n end",
"def print\n @maze[:matrix].each do |line|\n puts ... | [
"0.8553344",
"0.7839165",
"0.7765039",
"0.7291293",
"0.72614694",
"0.71777624",
"0.7100341",
"0.70865875",
"0.70570606",
"0.69582385",
"0.6939778",
"0.693125",
"0.6866958",
"0.67701817",
"0.67550945",
"0.6732928",
"0.67040026",
"0.66058517",
"0.6577692",
"0.6567373",
"0.65575... | 0.8034365 | 1 |
Get process information by command 'ps auxw | grep serverId | grep pid' | def get_ps_info args={}, &block
return if OS.windows?
pid = args[:pid]
EM.system('sh', proc{ |process|
process.send_data "ps auxw | grep " + pid.to_s + " | grep -v 'grep'\n"
process.send_data "exit\n"
}) { |output, status|
if status.exitstatus == 0
format args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_pids\n `lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end",
"def ps_running\n c... | [
"0.74520993",
"0.7438365",
"0.7126289",
"0.71195465",
"0.70977867",
"0.7040693",
"0.69930017",
"0.69849795",
"0.6941538",
"0.6887157",
"0.68529695",
"0.68377346",
"0.6791492",
"0.6788745",
"0.6778669",
"0.67205286",
"0.6692933",
"0.666617",
"0.66612226",
"0.66494066",
"0.6629... | 0.744078 | 1 |
Example For n = 29, the output should be addTwoDigits(n) = 11. | def addTwoDigits(n)
result = 0
n.to_s.split("").each {|number| result += number.to_i }
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_digits(num)\n return num if num.to_s.length == 1\n add_digits(num.to_s[0].to_i + add_digits(num.to_s[1..-1]).to_i)\nend",
"def add_digits(num)\n return num if num.to_s.length == 1\n int_array = split_digits(num)\n sum = add_array_ints(int_array)\n return add_digits(sum)\n end",
"def add_... | [
"0.7786175",
"0.76464266",
"0.7602193",
"0.7565762",
"0.74024767",
"0.72868913",
"0.721501",
"0.71777153",
"0.7091348",
"0.70408916",
"0.7022131",
"0.69648373",
"0.695648",
"0.6947659",
"0.6940182",
"0.6890425",
"0.68735445",
"0.6858815",
"0.68503183",
"0.6840207",
"0.6831636... | 0.8303512 | 0 |
GET /session_replicas GET /session_replicas.json | def index
@session_replicas = SessionReplica.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def get_all_replicas(id, options = GetAllReplicasOptions.new) end",
"def replicas; end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url ... | [
"0.68597347",
"0.66880745",
"0.6502734",
"0.6378547",
"0.62445986",
"0.6064645",
"0.5996224",
"0.5950158",
"0.5847749",
"0.5792938",
"0.57326543",
"0.5591757",
"0.54726493",
"0.5337873",
"0.533406",
"0.53334785",
"0.5249959",
"0.5239103",
"0.51504034",
"0.51504034",
"0.514155... | 0.82171476 | 0 |
POST /session_replicas POST /session_replicas.json | def create
@session_replica = SessionReplica.new(session_replica_params)
respond_to do |format|
if @session_replica.save
format.html { redirect_to @session_replica}
format.json { render :show, status: :created, location: @session_replica }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @session_replicas = SessionReplica.all\n end",
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def destroy\n @session_replica.destroy\n respond_to do |format|\n format.html { redirect_to session_replicas_url }\n format.json { head ... | [
"0.72132355",
"0.68021774",
"0.639382",
"0.638609",
"0.6376838",
"0.63217497",
"0.60546887",
"0.57516086",
"0.5648277",
"0.555512",
"0.53954935",
"0.53938895",
"0.51999646",
"0.5123359",
"0.5002693",
"0.49794427",
"0.49644673",
"0.4958506",
"0.49353305",
"0.49186015",
"0.4895... | 0.7139926 | 1 |
PATCH/PUT /session_replicas/1 PATCH/PUT /session_replicas/1.json | def update
respond_to do |format|
if @session_replica.update(session_replica_params)
format.html { redirect_to @session_replica}
format.json { render :show, status: :ok, location: @session_replica }
else
format.html { render :edit }
format.json { render json: @session_rep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end",
"def update!(**args)\n @max_replicas = args[:max_replicas] if args.key?(:max_replicas)\n @min_replicas = args[:min_replicas] if args.key?(:min_replicas)\n end",
"def increment_replica_count\n ... | [
"0.65559",
"0.6220529",
"0.6152326",
"0.61337984",
"0.6014983",
"0.5835703",
"0.5744421",
"0.56974447",
"0.5681056",
"0.56587446",
"0.56110454",
"0.55506253",
"0.5516534",
"0.5504615",
"0.5400901",
"0.5381052",
"0.5347868",
"0.5278142",
"0.52709705",
"0.52651864",
"0.52610946... | 0.6951087 | 0 |
DELETE /session_replicas/1 DELETE /session_replicas/1.json | def destroy
@session_replica.destroy
respond_to do |format|
format.html { redirect_to session_replicas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def decrement_replica_count\n self.original['spec']['replicas'] -= 1\n end",
"def destroy\n @shard = Shard.find(params[:id])\n @shard.destroy\n\n respond_t... | [
"0.630367",
"0.61659247",
"0.60246676",
"0.6015206",
"0.60112727",
"0.5996535",
"0.5980484",
"0.5930732",
"0.5909079",
"0.586176",
"0.5851236",
"0.58501256",
"0.5843635",
"0.5799133",
"0.57767534",
"0.57584006",
"0.57451165",
"0.5726068",
"0.5711957",
"0.56949353",
"0.5693736... | 0.80110145 | 0 |
Delete participant by ID. | def delete_participant(account_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/participants/{participantId}'
_query_builder = APIHelper.append_url_with_template_parameter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @participant = Participant.find(params[:id])\n @participant.des... | [
"0.72154033",
"0.7198045",
"0.7198045",
"0.71091694",
"0.7099698",
"0.70190936",
"0.70072484",
"0.69691104",
"0.6938913",
"0.69336134",
"0.6904828",
"0.6866794",
"0.6866794",
"0.68004376",
"0.6768609",
"0.67427915",
"0.6705309",
"0.66963917",
"0.66963917",
"0.66963917",
"0.66... | 0.74030274 | 0 |
List participants in a session. | def list_session_participants(account_id,
session_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/participants'
_query_builder = APIHelper.append_url_with_tem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_session_participants(account_id, session_id, opts = {})\n data, _status_code, _headers = list_session_participants_with_http_info(account_id, session_id, opts)\n data\n end",
"def get_participants\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n\n if us... | [
"0.6977873",
"0.67511976",
"0.67085135",
"0.6699871",
"0.6695217",
"0.6586641",
"0.65847737",
"0.65847737",
"0.6551789",
"0.6521923",
"0.6515579",
"0.6515579",
"0.6501313",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6495838",
"0.6477563",
"0.6468465",... | 0.7196438 | 0 |
Add a participant to a session. Subscriptions can optionally be provided as part of this call. | def add_participant_to_session(account_id,
session_id,
participant_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_participant_to_session(account_id, session_id, participant_id, opts = {})\n add_participant_to_session_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def add_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\n partic... | [
"0.69242907",
"0.6579323",
"0.64100623",
"0.6259223",
"0.6197239",
"0.61822116",
"0.6081688",
"0.60389733",
"0.60210556",
"0.599112",
"0.5919563",
"0.58165616",
"0.57802224",
"0.5687276",
"0.55658764",
"0.5538888",
"0.55289817",
"0.54701144",
"0.5463343",
"0.5450351",
"0.5439... | 0.6828904 | 1 |
Remove a participant from a session. This will automatically remove any subscriptions the participant has associated with this session. | def remove_participant_from_session(account_id,
session_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_participant_from_session(account_id, session_id, participant_id, opts = {})\n remove_participant_from_session_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def remove_participant\n user = self.load_user(params)\n meeting = self.load_meeting(params)\... | [
"0.75884026",
"0.6380433",
"0.624602",
"0.60856694",
"0.6079354",
"0.60488826",
"0.60285354",
"0.59954965",
"0.59787464",
"0.5914275",
"0.5896921",
"0.5887634",
"0.58749133",
"0.586737",
"0.5838793",
"0.57602346",
"0.5759116",
"0.57585454",
"0.57508636",
"0.57487637",
"0.5723... | 0.7534986 | 1 |
Get a participant's subscriptions. | def get_participant_subscriptions(account_id,
session_id,
participant_id)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_query_builder << '/accounts/{accountId}/sessions/{sessionId}/part... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subscriptions\n get_subscriptions_from(@nodename)\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n ... | [
"0.73605067",
"0.7262282",
"0.7177072",
"0.71370053",
"0.70708144",
"0.7036096",
"0.7030234",
"0.6889275",
"0.687437",
"0.6863825",
"0.68365085",
"0.6836278",
"0.6778858",
"0.67383724",
"0.67221636",
"0.6709729",
"0.66607046",
"0.6650482",
"0.6644378",
"0.66291213",
"0.661985... | 0.73398226 | 1 |
Update a participant's subscriptions. This is a full update that will replace the participant's subscriptions. First call `getParticipantSubscriptions` if you need the current subscriptions. Call this function with no `Subscriptions` object to remove all subscriptions. | def update_participant_subscriptions(account_id,
session_id,
participant_id,
body: nil)
# Prepare query url.
_query_builder = config.get_base_uri(Server::WEBRTCDEFAULT)
_que... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_participant_subscriptions(account_id, session_id, participant_id, opts = {})\n update_participant_subscriptions_with_http_info(account_id, session_id, participant_id, opts)\n nil\n end",
"def update_subscriptions(opts = {})\n data, _status_code, _headers = update_subscriptions_with_h... | [
"0.7673749",
"0.7155982",
"0.67502654",
"0.6652334",
"0.6607356",
"0.6371448",
"0.624291",
"0.62138253",
"0.6094653",
"0.6083461",
"0.60051227",
"0.60031813",
"0.5951139",
"0.58575505",
"0.5813624",
"0.5774981",
"0.57129824",
"0.56561977",
"0.5618912",
"0.5617216",
"0.5555525... | 0.731687 | 1 |
other sport name actions are scoped to venue; we need all possible sport names for all venues | def sport_name_options
authorize :report
sport_names = company.venues.
flat_map { |venue| venue.supported_sports_options }.
uniq { |hash| hash[:value] }
render json: sport_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unusual_sport; end",
"def venue_name\n venue.name if venue\n end",
"def national_sport; end",
"def unusual_sport\n fetch('sport.unusual')\n end",
"def summon_captain_planet(planeteer_calls)\n planeteer_calls.collect{|item| \"#{item.capitalize}!\" }\nend",
"def select_options_for_cour... | [
"0.68725216",
"0.64305365",
"0.6364664",
"0.6239143",
"0.6028444",
"0.5989123",
"0.59350896",
"0.5926912",
"0.5918938",
"0.5874233",
"0.5868325",
"0.58343124",
"0.5799144",
"0.57866204",
"0.57598597",
"0.5754906",
"0.57469916",
"0.5715616",
"0.5698548",
"0.56727165",
"0.56646... | 0.672665 | 1 |
Adds an HTTP header to the request | def add_http_header(key, value)
@http_headers[key] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_headers\n @headers.each do |field, value|\n @request_header << \"#{field}: #{value}\"\n end\n end",
"def add_header(header)\n @headers.merge!(header)\n end",
"def add_headers; end",
"def add_header(name, value)\n end",
"def add_header key, value\n\t\t\t@headers ... | [
"0.78114223",
"0.7737657",
"0.76608366",
"0.74980533",
"0.74719864",
"0.72978187",
"0.71946865",
"0.71307015",
"0.71052104",
"0.7026713",
"0.70074236",
"0.6964078",
"0.6944201",
"0.6932701",
"0.6866111",
"0.6844005",
"0.6833592",
"0.68277824",
"0.6827778",
"0.6726953",
"0.671... | 0.8141636 | 0 |
load the workflow view | def show
name = params[:name]
action = params[:id] ? "show" : "index"
action = params[:view] if params[:view].present?
@page = ("Workflows::#{name.to_s.capitalize}::#{action.capitalize}").constantize.new(params, { user: current_user, cookies: cookies })
render(html: @page.item.display) and return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end",
"def show\n workflow_steps = WorkflowStep.where(\n repository: params[:repo],\n druid: params[:druid],\n w... | [
"0.7102376",
"0.63925046",
"0.6367075",
"0.61744845",
"0.6164956",
"0.61139506",
"0.60870904",
"0.60870904",
"0.60870904",
"0.6032993",
"0.6004404",
"0.60043406",
"0.6003554",
"0.59932077",
"0.59932077",
"0.59932077",
"0.59932077",
"0.5955843",
"0.592802",
"0.5923831",
"0.591... | 0.65805703 | 1 |
GET /evolutions/1 GET /evolutions/1.json | def show
@evolution = Evolution.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @devolutions = Devolution.all\n end",
"def evolution_request(species, name)\n\t\tevolution_request = HTTParty.get(\"http://pokeapi.co/api/v2/evolution-chain/#{species.evolution_id}\")\n\t\tevolutions = PokeapiEvolutions.new(evolution_request, name)\n\t\treturn evolutions\n\tend",
"def show\n ... | [
"0.6348234",
"0.6341934",
"0.62985355",
"0.6251146",
"0.60362124",
"0.60007274",
"0.59500164",
"0.59396225",
"0.5922972",
"0.5891881",
"0.5885376",
"0.5884324",
"0.5884324",
"0.5884324",
"0.58804417",
"0.5861999",
"0.5842792",
"0.58417",
"0.58361787",
"0.5817218",
"0.58170485... | 0.6410378 | 0 |
configures the target page (using a Dynarex document) for a new day | def new_day()
puts 'inside new_day' if @debug
@archive_path = Time.now.strftime("%Y/%b/%-d").downcase
@indexpath = File.join(@filepath, @archive_path, 'index.xml')
FileX.mkdir_p File.dirname(@indexpath)
if FileX.exists? @indexpath then
@dx = Dynarex.new @indexpath
else
puts 'cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def go_to_date_link(user)\n\t\tdynamic_range\n\t\t@base_path = root_path+\"users/#{user.id}/scrapbook/#{@destination}\"\n\tend",
"def set_page\n end",
"def setPageTimer\n\t\t@pageTimer= Time.now.to_i+ @pageTimeOut\n\t\treturn OK\n\tend",
"def twenty_pct_release_date=(rd=Time.now)\n update_values([:twen... | [
"0.5742993",
"0.57319957",
"0.5424249",
"0.5418482",
"0.5353863",
"0.52722067",
"0.52563167",
"0.52300715",
"0.5229549",
"0.52201146",
"0.52026075",
"0.520027",
"0.5166835",
"0.51458937",
"0.51351106",
"0.5115724",
"0.5098779",
"0.5086328",
"0.5086247",
"0.5069055",
"0.506691... | 0.6240864 | 0 |
guesses random word of appropriate length | def guess_word(word_length)
self.sample(dict.select { |word| word.length == word_length } )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick_mystery_word\n @picked_word = self.dict.sample\n self.picked_word.length\n end",
"def pick_secret_word\n\t\t@secret_word = @dictionary.sample.chomp.downcase\n\t\t@secret_word.length\n\tend",
"def get_word(difficulty)\n WORDS.select{|word| word.length == difficulty}.sample\nend",
"def random_... | [
"0.7428584",
"0.7291276",
"0.72800356",
"0.724955",
"0.724955",
"0.724955",
"0.724955",
"0.7227071",
"0.7218384",
"0.721788",
"0.71920466",
"0.7160873",
"0.71190596",
"0.7070547",
"0.70439917",
"0.70407236",
"0.7022391",
"0.70084393",
"0.7008256",
"0.6977465",
"0.6966264",
... | 0.80783665 | 0 |
Finds Single match via the supplied ID Usage: match = PUBG::Match(1337) Arguments: id: (Integer) | def match(id)
self.get("/matches/#{id}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(match_id)\n get_request(shard_endpoint_uri(\"matches/#{match_id}\"))\n end",
"def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end",
"def get_match\n @match = Match.find( params[:match_id] )\n raise ActiveRecord::Record... | [
"0.7601857",
"0.7325076",
"0.687629",
"0.6634679",
"0.6585606",
"0.65841526",
"0.65738595",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
"0.6571568",
... | 0.79567343 | 0 |
Builds the query that will be passed to the matches request, based on what options are supplied (if any) | def query_builder(options)
parsed_options = []
options.each do |key,value|
case key
when :offset
parsed_options << "page[offset]=#{value}"
when :limit
parsed_options << "page[limit]=#{value}"
when :sort
parsed_options << "sort=#{value}"
when :cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_query(options)\n array = []\n\n options.each do |key, value|\n next if key == :all\n if [:filter, :select, :top].include?(key)\n array << \"$#{key}=#{value}\" if value\n elsif key == :continuation_token\n value.each { |k, token| array << \"#{... | [
"0.72319084",
"0.6983082",
"0.6948496",
"0.6912919",
"0.6810623",
"0.6707633",
"0.6572565",
"0.65251833",
"0.648483",
"0.6458556",
"0.6419039",
"0.64018494",
"0.6397483",
"0.63915026",
"0.6379985",
"0.6338988",
"0.6320643",
"0.6273354",
"0.6254824",
"0.62426573",
"0.6222928",... | 0.80172116 | 0 |
Makes a Web Scrapper to get the twitter description | def fetch_twitter_informations
unparsed_html = Nokogiri::HTML(open(twitter_profile_address))
self.twitter_username = fetch_twitter_username(unparsed_html)
self.twitter_description = fetch_twitter_description(unparsed_html)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getTwitters(searchTerm)\n # url encoding the searchterm\n searchTerm = CGI::escape(searchTerm)\n \n # grabbing the search results for the given searchTerm from summize as a REXML document\n doc = REXML::Document.new open(\"http://summize.com/search.atom?lang=en&rpp=100&q=#{searchTerm}\").read\n ... | [
"0.66195697",
"0.65626043",
"0.6519734",
"0.6477642",
"0.64733297",
"0.64159995",
"0.6252092",
"0.62426245",
"0.61802083",
"0.6168861",
"0.6164772",
"0.6151207",
"0.6137684",
"0.60889065",
"0.6015941",
"0.60034657",
"0.5990987",
"0.5990987",
"0.59700227",
"0.59684956",
"0.596... | 0.6654091 | 0 |
Return all the elements containing currency input text field | def get_currency_input_field_elements
elements(xpath: './/label[contains(text(),"Limit") or contains(text(), "Accounts Receivable") or contains(text(), "On Premises") or contains(text(), "Off Premises")]//following-sibling::app-currency-input/input[1]')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_currency_input_field_elements\n get_currency_input_field_elements.each do |ele|\n # This is a temporary work around for clearing the currency input field as '.clear' on element is not working\n ele.send_keys(:control, a)\n end\n end",
"def get_all_price\n page = Nokogiri::HTML(open(... | [
"0.6336415",
"0.58622056",
"0.56495047",
"0.5637705",
"0.55859274",
"0.55801743",
"0.557341",
"0.5567995",
"0.55606097",
"0.55167186",
"0.54955214",
"0.54481405",
"0.5432425",
"0.54159683",
"0.53988266",
"0.53815293",
"0.53564405",
"0.53067076",
"0.5246456",
"0.5239302",
"0.5... | 0.7382589 | 0 |
Clear input field of all the elements containing currency input text field | def clear_currency_input_field_elements
get_currency_input_field_elements.each do |ele|
# This is a temporary work around for clearing the currency input field as '.clear' on element is not working
ele.send_keys(:control, a)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_text_field(locator)\n find(locator).clear\n end",
"def clear\n set ' '\n # PhoneNumber inputs have country dial code pre-populated on focus. To have\n # it fully cleared, need more than one \"backspace\" hit\n wait_until_true do\n native.send_keys :backspace\n value.empty?\n ... | [
"0.6813654",
"0.65169317",
"0.6312544",
"0.6279329",
"0.6050338",
"0.60489315",
"0.59699625",
"0.5887981",
"0.58871186",
"0.5874187",
"0.5860212",
"0.58410794",
"0.57665896",
"0.5751195",
"0.5736496",
"0.5716399",
"0.5713885",
"0.5687539",
"0.5665564",
"0.5622061",
"0.5588736... | 0.8816248 | 0 |
DNA to RNA Conversion Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems. It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T'). Ribonucleic acid, RNA, is the primary messenger molecule in cells. RNA differs slightly from DNA ... | def DNAtoRNA(dna)
dna.gsub("T", "U")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dna_to_rna(string)\n index = 0\n rna_strand = \"\"\n while index < string.length\n if string[index] == \"G\"\n rna_strand << \"C\"\n elsif string[index] == \"C\"\n rna_strand << \"G\"\n elsif string[index] == \"T\"\n rna_strand << \"A\"\n elsif string[index] == \"A\"\n rna_st... | [
"0.77877134",
"0.75076234",
"0.7242171",
"0.72287625",
"0.6791206",
"0.6569357",
"0.63117486",
"0.6245453",
"0.61811334",
"0.6178439",
"0.6146539",
"0.6055493",
"0.57858807",
"0.5694598",
"0.56432116",
"0.5634003",
"0.5576411",
"0.5539162",
"0.53444237",
"0.53415924",
"0.5328... | 0.7727879 | 1 |
Do a shelllike path lookup for prog_script and return the results. If we can't find anything return prog_script. | def whence_file(prog_script)
if prog_script.index(File::SEPARATOR)
# Don't search since this name has path separator components
return prog_script
end
for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do
prog_script_try = File.join(dirname, prog_script)
return prog_script_try if File.exist?(p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whence_file(prog_script)\n if prog_script.index(File::SEPARATOR)\n # Don't search since this name has path separator components\n return prog_script\n end\n for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do\n prog_script_try = File.join(dirname, prog_script)\n return prog_s... | [
"0.7780434",
"0.6989591",
"0.69886225",
"0.6239696",
"0.61683714",
"0.60768193",
"0.6011705",
"0.6010599",
"0.60050213",
"0.5948889",
"0.59437",
"0.59130657",
"0.5908372",
"0.5908372",
"0.58705324",
"0.5841371",
"0.5841371",
"0.5822527",
"0.5817532",
"0.58142436",
"0.5806768"... | 0.7816255 | 0 |
A method to convert an openlayersformat bbox string into an rgeo bbox object | def bbox_from_string(string, factory)
return unless string
minlon, minlat, maxlon, maxlat = string.split(',').collect { |i| i.to_f }
bbox = RGeo::Cartesian::BoundingBox.new(factory)
bbox.add(factory.point(minlon, minlat)).add(factory.point(maxlon, maxlat))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bbox(left, bottom, right, top)\n raise TypeError.new('\"left\" value needs to be a number between -180 and 180') unless(left.kind_of?(Float) && left >= -180 && left <= 180)\n raise TypeError.new('\"bottom\" value needs to be a number between -90 and 90') unless(bottom.kind_of?(Float) ... | [
"0.60862356",
"0.6003337",
"0.58920217",
"0.5798198",
"0.5747368",
"0.57424223",
"0.57411665",
"0.5593428",
"0.55598086",
"0.55468273",
"0.5448083",
"0.5251661",
"0.5244827",
"0.52320683",
"0.51605576",
"0.51529425",
"0.5119328",
"0.5119328",
"0.5106917",
"0.5088977",
"0.5013... | 0.6811537 | 0 |
Method: walk_automation_objects Purpose: Recursively walk and record the automation object hierarchy from $evm.root downwards Arguments: service_object Returns: A completed Struct::ServiceObject data structure | def walk_automation_objects(service_object)
automation_object = Struct::ServiceObject.new(service_object.to_s, "", Array.new)
if service_object.to_s == $evm.root.to_s
automation_object.position = 'root'
elsif service_object.to_s == $evm.parent.to_s
automation_object.position = 'parent'
elsif service_obj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy... | [
"0.6170826",
"0.58349305",
"0.52400583",
"0.5162253",
"0.49944493",
"0.49401417",
"0.49225986",
"0.485547",
"0.47778556",
"0.47574612",
"0.47574612",
"0.4657206",
"0.46291947",
"0.45374662",
"0.45239592",
"0.451452",
"0.44957012",
"0.44923642",
"0.44308883",
"0.44273072",
"0.... | 0.89353615 | 0 |
End of walk_object_hierarchy Method: print_automation_objects Purpose: recursively walk & dump the service object hierarchy discovered by walk_automation_objects Arguments: hierarchy: the service object hierarchy indent_level: the indentation string Returns: Nothing | def print_automation_objects(indent_level, hierarchy)
case hierarchy.position
when 'root'
print_line(indent_level, "#{hierarchy.obj_name} ($evm.root)")
when 'parent'
print_line(indent_level, "#{hierarchy.obj_name} ($evm.parent)")
when 'object'
print_line(indent_level, "#{hierarchy.obj_name} ($evm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end",
"def walk_automation_objects(service_object)\n automation_object = Struct::ServiceObject.new(service_object.to_s, \"\", Array.new)\n if service_object.to_s == $evm.root.to_s\n automation_object.position = 'root'\n elsif ser... | [
"0.6505712",
"0.64134264",
"0.6296363",
"0.59506553",
"0.5782438",
"0.56913894",
"0.56465787",
"0.56415635",
"0.55538833",
"0.5416576",
"0.5406604",
"0.5405907",
"0.54033494",
"0.53748494",
"0.53709364",
"0.53589237",
"0.53528774",
"0.5324307",
"0.5299967",
"0.52920884",
"0.5... | 0.8389056 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.