query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Full line size with prompt | def size
prompt_size + text_size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liner box_char=@box_char, box_size=@box_size\n self.puts( box_char * box_size ) if self.debug?\n end",
"def prompt(msg)\n\t\tdivider = \"-⚑-\"\n\t\t@width.times { divider << \"--\" }\n\t\tdivider << \"-⚑-\"\n\t\tcenter_this [divider, msg, divider]\n\t\tputs\n\tend",
"def size\n $stdout.winsize.rever... | [
"0.6503442",
"0.64792013",
"0.6441347",
"0.6401678",
"0.63889825",
"0.636405",
"0.6320819",
"0.62944835",
"0.6268031",
"0.6268031",
"0.6231317",
"0.6206257",
"0.6159699",
"0.6063029",
"0.6061386",
"0.60579383",
"0.60526717",
"0.60143566",
"0.60143566",
"0.5992037",
"0.5992037... | 0.7319152 | 0 |
every bike has the same defaults for tire and chain size | def spares
{
chain: '11-speed',
tire_size: '23',
tape_color: tape_color
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_tire_size\n '23'\n end",
"def setup\n\n bikeSizes = {size: 12,tire_size: 3.0}\n @road = RoadBike.new(bikeSizes.merge({tape_color: \"blue\"}))\n @mountainBike = MountainBike.new(bikeSizes.merge({front_shock: 20,rear_shock: 30}))\n\n # @mountain_bike = MountainBike.new({})\n\n\n end",
... | [
"0.675555",
"0.67293733",
"0.6674256",
"0.62716806",
"0.6186326",
"0.6125058",
"0.6063928",
"0.5988917",
"0.5869567",
"0.58652025",
"0.580758",
"0.5759563",
"0.5704028",
"0.56786555",
"0.5638796",
"0.562109",
"0.562109",
"0.5571505",
"0.55473125",
"0.55430114",
"0.5531579",
... | 0.0 | -1 |
Creates a new resource for the specified DOI with the specified payload | def create(doi:, payload:, retries: 3)
logger.debug("Stash::MerrittDeposit::Client.create(doi: #{doi}, payload: #{payload})")
profile = "#{collection_uri.to_s.split('/').last}_content"
do_post(profile: profile, payload: payload, doi: doi, retries: retries)
rescue StandardError => e
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_draft_doi\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"draft_doi_payload.to_json=#{draft_doi_payload.to_json}\",\n ... | [
"0.6350466",
"0.6121043",
"0.6063353",
"0.6051451",
"0.6047451",
"0.6002251",
"0.59791064",
"0.5938606",
"0.5904791",
"0.58987707",
"0.58888966",
"0.5886706",
"0.5870072",
"0.5848769",
"0.5810543",
"0.5769815",
"0.57667226",
"0.5765228",
"0.5730709",
"0.57090724",
"0.5689872"... | 0.708821 | 0 |
Updates a new resource for the specified DOI with the specified payload | def update(doi:, payload:, download_uri:, retries: 3)
logger.debug("Stash::MerrittDeposit::Client.update(doi: #{doi}, payload: #{payload}, download_uri: #{download_uri})")
profile = "#{collection_uri.to_s.split('/').last}_content"
ark = URI.decode_www_form_component(download_uri.split('/').last)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Acc... | [
"0.70369136",
"0.6492322",
"0.6330343",
"0.6245897",
"0.62423205",
"0.5995114",
"0.59761536",
"0.5931016",
"0.59303546",
"0.5900904",
"0.5888561",
"0.5817347",
"0.5802296",
"0.5785833",
"0.57480085",
"0.57370234",
"0.5656638",
"0.563445",
"0.5622363",
"0.56197816",
"0.5618812... | 0.6489869 | 2 |
The function of the receipt is to update the following fields in the resource: resource.download_uri = receipt.em_iri resource.update_uri = receipt.edit_iri We no longer need an update_uri, since it's based on the DOI, which we can use directly. The download_uri should be populated by the rake task which checks merritt... | def do_post(profile:, payload:, doi:, ark: nil, retries: 3)
params = {
file: HTTP::FormData::File.new(payload),
profile: profile,
localIdentifier: doi,
submitter: @on_behalf_of,
retainTargetURL: true,
responseForm: 'json'
}
params[:pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n if receipt_params[:receipt_date].present? && receipt_params[:form_receipt].blank?\n flash[:warning] = 'Selecione uma forma de recebimento!'\n redirect_to edit_receipt_path(@receipt) and return\n end\n \n #se informou a data da baixa e não alterou para RECEBIDA o status\n ... | [
"0.5774114",
"0.5737393",
"0.56548893",
"0.5628472",
"0.5624368",
"0.5611409",
"0.558115",
"0.55689275",
"0.5549016",
"0.55444276",
"0.55431503",
"0.5532021",
"0.5524131",
"0.55122566",
"0.5502904",
"0.5495637",
"0.54915416",
"0.5489557",
"0.54399836",
"0.54339826",
"0.543398... | 0.0 | -1 |
and return the average score of all the students | def class_average(hashh)
sum = 0.0
hashh.each_value { |val| sum += val}
average = sum / hashh.size
hashh.empty? ? sum : average.round(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def average_score\n grades.average(:score) || 0\n end",
"def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end",
"def ... | [
"0.79682726",
"0.79124254",
"0.7669872",
"0.755751",
"0.75083375",
"0.7501204",
"0.749686",
"0.7478906",
"0.74303836",
"0.7413836",
"0.7354465",
"0.7332579",
"0.73140246",
"0.73112935",
"0.7299067",
"0.72839457",
"0.7278656",
"0.7274314",
"0.72715676",
"0.7261636",
"0.7257181... | 0.0 | -1 |
GET /dependent_representatives/1 GET /dependent_representatives/1.xml | def show
@dependent_representative = DependentRepresentative.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @dependent_representative }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @dependent_representative = DependentRepresentative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dependent_representative }\n end\n end",
"def show\n @independent = @member.independents.find(params[:id])\n\n respond_to do |format|... | [
"0.64884496",
"0.6440345",
"0.64006656",
"0.610492",
"0.5914894",
"0.58972657",
"0.57735234",
"0.5764541",
"0.568228",
"0.56470835",
"0.5597161",
"0.5559115",
"0.5517685",
"0.5463874",
"0.5462352",
"0.5440867",
"0.5416134",
"0.54077554",
"0.54076445",
"0.53858685",
"0.5378144... | 0.73120785 | 0 |
GET /dependent_representatives/new GET /dependent_representatives/new.xml | def new
@dependent_representative = DependentRepresentative.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @dependent_representative }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @representative = Representative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @representative }\n end\n end",
"def create\n @dependent_representative = DependentRepresentative.new(params[:dependent_representative])\n\n respond_to d... | [
"0.7134449",
"0.6834277",
"0.6589971",
"0.6504209",
"0.6469062",
"0.6440709",
"0.64192516",
"0.6396815",
"0.6386601",
"0.63712907",
"0.63432837",
"0.6315721",
"0.63070494",
"0.6295",
"0.6294973",
"0.62784094",
"0.62651473",
"0.626214",
"0.624601",
"0.623019",
"0.61960727",
... | 0.77671087 | 0 |
POST /dependent_representatives POST /dependent_representatives.xml | def create
@dependent_representative = DependentRepresentative.new(params[:dependent_representative])
respond_to do |format|
if @dependent_representative.save
flash[:notice] = 'DependentRepresentative was successfully created.'
format.html { redirect_to(@dependent_representative) }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @dependent_representative = DependentRepresentative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dependent_representative }\n end\n end",
"def destroy\n @dependent_representative = DependentRepresentative.find(params[:id])\n @depe... | [
"0.62341344",
"0.59767884",
"0.5886912",
"0.5696212",
"0.5491317",
"0.54174554",
"0.53048015",
"0.52933824",
"0.5253856",
"0.5202417",
"0.51559395",
"0.5097869",
"0.50767666",
"0.5043602",
"0.4997104",
"0.49947596",
"0.49907902",
"0.4974424",
"0.49530458",
"0.4934981",
"0.492... | 0.6888988 | 0 |
PUT /dependent_representatives/1 PUT /dependent_representatives/1.xml | def update
@dependent_representative = DependentRepresentative.find(params[:id])
respond_to do |format|
if @dependent_representative.update_attributes(params[:dependent_representative])
flash[:notice] = 'DependentRepresentative was successfully updated.'
format.html { redirect_to(@depende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dependent_representative = DependentRepresentative.find(params[:id])\n @dependent_representative.destroy\n\n respond_to do |format|\n format.html { redirect_to(dependent_representatives_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @representative = Repres... | [
"0.62520325",
"0.615073",
"0.61176664",
"0.5741983",
"0.5731524",
"0.5709293",
"0.5635498",
"0.562554",
"0.56196",
"0.5518496",
"0.55076146",
"0.52021194",
"0.5193619",
"0.5190682",
"0.5160736",
"0.5132815",
"0.5130298",
"0.51113844",
"0.5100681",
"0.50932443",
"0.50850374",
... | 0.7126497 | 0 |
DELETE /dependent_representatives/1 DELETE /dependent_representatives/1.xml | def destroy
@dependent_representative = DependentRepresentative.find(params[:id])
@dependent_representative.destroy
respond_to do |format|
format.html { redirect_to(dependent_representatives_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @representative = Representative.find(params[:id])\n @representative.destroy\n\n respond_to do |format|\n format.html { redirect_to(representatives_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sale_representative = SaleRepresentative.find(params[:id])\n ... | [
"0.6982245",
"0.6492407",
"0.6454705",
"0.6355728",
"0.6295597",
"0.6258356",
"0.62360984",
"0.6198217",
"0.61924565",
"0.61883396",
"0.616135",
"0.60630494",
"0.6051899",
"0.6035426",
"0.6027418",
"0.5979927",
"0.59509766",
"0.5913785",
"0.5911694",
"0.5908655",
"0.59024805"... | 0.7558791 | 0 |
Write a function to check if a given string is a palindrome | def isPalindrome(string)
string == string.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindrome?(string)\r\n reverse_string = string.reverse\r\n if reverse_string == string\r\n true\r\n else\r\n false\r\n end\r\nend",
"def palindrome (string)\n\n if string.reverse == string\n return true\n else\n return false\n end\n \nend",
"def palindrome?(string)\n\n\ti... | [
"0.8881514",
"0.8861304",
"0.8827202",
"0.8813057",
"0.879175",
"0.879175",
"0.879175",
"0.8780905",
"0.8759175",
"0.87587047",
"0.8755996",
"0.87541187",
"0.87541187",
"0.87541187",
"0.87526554",
"0.8721073",
"0.87033343",
"0.86953324",
"0.86904454",
"0.86885804",
"0.8688580... | 0.86215717 | 32 |
another_deli = ["Amanda", "Annette", "Ruchi", "Jason", "Logan", "Spencer", "Avi", "Joe", "Rachel", "Lindsey"] def deli_counter(katz_deli) | def line(array)
if array.empty?
puts "The line is currently empty."
else
string = "The line is currently:"
array.each.with_index(1) { |name, index| string << " #{index}. #{name}"}
puts string
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_a_number(katz_deli, name)\n katz_deli << name\n\n# katz_deli.each_with_index do |name, index|\n puts \"Welcome, #{name}. You are number #{katz_deli.length} in line.\"\n# end\nend",
"def take_a_number(katz_deli, name)\n \n \n people_waiting = katz_deli.count\n\n katz_deli << name\n \n ... | [
"0.6665332",
"0.63949907",
"0.6325134",
"0.6304456",
"0.6277731",
"0.6276317",
"0.6221341",
"0.6221341",
"0.6192186",
"0.6189814",
"0.6189814",
"0.61804163",
"0.6172176",
"0.616724",
"0.6149362",
"0.6149362",
"0.61292005",
"0.61292005",
"0.6125655",
"0.61242884",
"0.6107793",... | 0.0 | -1 |
Creates a button that when clicked will reload the current page with all existing params still applied but with the filter set to the new filter values. If you use the :prefix option in the filter helper you must use the same :prefix option in this helper to make the two work together | def filter_button(label='Apply Filter', options={}, html_options={})
options.reverse_merge! :prefix => 'filter'
html_options.reverse_merge! :disabled => true, :type => 'button',
:value => label, :id => "#{options[:prefix]}_button"
p = params.dup
p.delete_if {|key, value| [options[:prefi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_buttons query_params, field\n filter_opts = query_params.filters[field] || {}\n value = query_params.filter_value(field)\n values = filter_opts[:values] || []\n\n bootstrap_btn_group(values) do |v|\n filter_value = v unless value.eql?(v.to_s)\n\n url = query_params.filter(field, fil... | [
"0.60758054",
"0.60364515",
"0.59388685",
"0.5902707",
"0.5822321",
"0.56270915",
"0.5607059",
"0.55972785",
"0.55831695",
"0.5574597",
"0.5496107",
"0.5488162",
"0.5480325",
"0.54157084",
"0.5415604",
"0.538442",
"0.53599477",
"0.5337969",
"0.53266066",
"0.53218466",
"0.5318... | 0.6499066 | 1 |
Setup project based on available ENV variables | def setup
@spanner = $spanner
refute_nil @spanner, "You do not have an active spanner to run the tests."
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be... | [
"0.6647909",
"0.6591983",
"0.6514676",
"0.6463362",
"0.6369938",
"0.63404167",
"0.63108516",
"0.6282777",
"0.6270803",
"0.6241764",
"0.62365913",
"0.6208165",
"0.62059295",
"0.6199519",
"0.61804754",
"0.6155787",
"0.61071867",
"0.6085911",
"0.60514486",
"0.5996953",
"0.596785... | 0.0 | -1 |
job2 = job.instance.create_database "main" job2.wait_until_done! | def clean_up_spanner_objects
puts "Cleaning up instances and databases after spanner tests."
$spanner.instances.all.select { |i| i.instance_id.start_with? $spanner_prefix }.each do |instance|
instance.databases.all.each &:drop
instance.delete
end
rescue => e
puts "Error while cleaning up instances and d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_database\n say_with_task(\"Creating database...\", \"db:create\")\n end",
"def reserve_and_run_one_job; end",
"def create_database(connection_string, db_name)\n create_sql = <<-SQL\n CREATE DATABASE #{db_name};\n SQL\n\n run \"#{connection_string} --execute=\\\"#{create_sql}\\\"\"\... | [
"0.63527817",
"0.63507724",
"0.62367636",
"0.6150289",
"0.6122857",
"0.59706414",
"0.5963373",
"0.59267443",
"0.5887193",
"0.5846537",
"0.5823964",
"0.57721585",
"0.57720697",
"0.5767328",
"0.57444227",
"0.57268965",
"0.5696282",
"0.5679861",
"0.56688064",
"0.564051",
"0.5639... | 0.0 | -1 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(hash)
if hash.empty? == true
nil
else
array = []
hash.each do |k, v|
array << v
end
min_value = array[0]
array.each do |value|
min_value = value if value < min_value
end
hash.each do |k, v|
return k if min_value == v
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.882206",
"0.87785",
"0.87776536",
"0.8746582",
"0.8690028",
"0.86559135",
"0.86532515",
"0.8617044",
"0.8588429",
"0.8572508",
"0.85678524",
"0.85517466",
"0.85302997",
"0.85302997",
"0.8519287",
"0.8494114",
"0.8475786",
"0.8475786",
"0.8466334",
"0.8449688",
"0.8449442",... | 0.0 | -1 |
Parser must have a lots of methods (see /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb) We dont need most of them in QEc2_Parser and method_missing helps us to skip their definition | def method_missing(method, *params)
# if the method is one of known - just skip it ...
return if [:comment, :attlistdecl, :notationdecl, :elementdecl,
:entitydecl, :cdata, :xmldecl, :attlistdecl, :instruction,
:doctype].include?(method)
# ... else - call super to raise an... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pluggable_parser; end",
"def parse\n raise NotImplementedError.new\n end",
"def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parser; end",
"def parsed... | [
"0.70328426",
"0.6676286",
"0.6650178",
"0.6613762",
"0.6613762",
"0.6613762",
"0.6613762",
"0.6612321",
"0.6460187",
"0.6456657",
"0.64342356",
"0.633727",
"0.61523265",
"0.61466503",
"0.60744745",
"0.604867",
"0.6009458",
"0.60027605",
"0.5974533",
"0.5974533",
"0.5974533",... | 0.55539846 | 36 |
the functions to be overriden by children (if nessesery) | def reset ; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overrides; end",
"def override() # Note that despite the module.override, this still overrides\r\n puts \"CHILD override()\"\r\n end",
"def override()\n puts \"CHILD override()\"\n end",
"def apply_children\n \n end",
"def set_functions\n super\n end",
"def special\n override\n... | [
"0.6942895",
"0.6693907",
"0.6658223",
"0.66298425",
"0.66028124",
"0.65910095",
"0.6399812",
"0.6399812",
"0.63843364",
"0.63755137",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688",
"0.6327688"... | 0.0 | -1 |
symbolic names, maps into icon file | def initialize(context)
@context = context
@name = metadata[:name]
@points = metadata[:points]
@icon = metadata[:icon]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon(filename)\n @attributes.store(:icon, filename)\n end",
"def iconify (icon_name) # currently action_name (preferred as more specific) or controller_name \n icon_name_s = icon_name.to_s\n\n # logger.debug(\"SessionsHelper: Icon_array: #{Icon_array.inspect}, Icon_hash: #{Icon_hash.inspect}\... | [
"0.65693945",
"0.64492065",
"0.64339083",
"0.6433255",
"0.6380724",
"0.6356385",
"0.629844",
"0.6213734",
"0.6203155",
"0.61733824",
"0.61722237",
"0.61441636",
"0.6123556",
"0.6123338",
"0.61144584",
"0.61095023",
"0.6102448",
"0.6075161",
"0.60602826",
"0.60464615",
"0.6036... | 0.0 | -1 |
Returns an array of unlock objects that would be created from the provided user data | def unlocks_from_user_data(user_data)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_unlock_instructions; end",
"def privileges\n users.reduce([]) do |memo, user|\n operations.reject(&:prohibition?).each do |operation|\n objects.each do |object|\n if is_privilege?(user, operation, object)\n memo << [user, operation, object]\n end\n end\... | [
"0.5434064",
"0.5431264",
"0.5351603",
"0.5294964",
"0.5240647",
"0.5225857",
"0.5214631",
"0.51927453",
"0.5185417",
"0.51813334",
"0.515156",
"0.51319396",
"0.5123279",
"0.50831884",
"0.5072201",
"0.50547564",
"0.50260013",
"0.50172675",
"0.5006686",
"0.5000239",
"0.4995183... | 0.6861435 | 0 |
GET /story_texts/1 GET /story_texts/1.xml | def show
@story_text = StoryText.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @story_text }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"def new\n @story_text = StoryText.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml {... | [
"0.6835954",
"0.66156363",
"0.63891804",
"0.6370608",
"0.63136107",
"0.63136107",
"0.63136107",
"0.6303451",
"0.6264843",
"0.6247087",
"0.61412764",
"0.61245507",
"0.601542",
"0.60083365",
"0.60078156",
"0.5997147",
"0.5950358",
"0.5950296",
"0.59197325",
"0.5865328",
"0.5805... | 0.7307595 | 0 |
GET /story_texts/new GET /story_texts/new.xml | def new
@story_text = StoryText.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @story_text }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n ... | [
"0.73189604",
"0.73189604",
"0.73189604",
"0.71549004",
"0.70894754",
"0.7077125",
"0.7057032",
"0.6938009",
"0.6874782",
"0.6785043",
"0.6731569",
"0.6671185",
"0.6654333",
"0.66429865",
"0.66429865",
"0.66429865",
"0.66429865",
"0.6635693",
"0.6631791",
"0.6631791",
"0.6631... | 0.7946931 | 0 |
POST /story_texts POST /story_texts.xml | def create
@story_text = StoryText.new(params[:story_text])
respond_to do |format|
if @story_text.save
flash[:notice] = 'StoryText was successfully created.'
format.html { redirect_to(@story_text) }
format.xml { render :xml => @story_text, :status => :created, :location => @story... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @text_story = current_user.text_stories.new(params[:text_story])\n @text_story.save\n\n respond_to do |format|\n if @text_story.save\n format.html { redirect_to profile_index_url, notice: 'Text story was successfully created.' }\n format.json { render json: @text_story, sta... | [
"0.6471058",
"0.6343528",
"0.6094822",
"0.6059296",
"0.60273063",
"0.601072",
"0.5950855",
"0.59215426",
"0.5907248",
"0.5899716",
"0.5842478",
"0.5814968",
"0.57595325",
"0.57489926",
"0.57403034",
"0.5728039",
"0.57236904",
"0.56889886",
"0.56784743",
"0.5667966",
"0.566782... | 0.7221564 | 0 |
PUT /story_texts/1 PUT /story_texts/1.xml | def update
@story_text = StoryText.find(params[:id])
respond_to do |format|
if @story_text.update_attributes(params[:story_text])
flash[:notice] = 'StoryText was successfully updated.'
format.html { redirect_to(@story_text) }
format.xml { head :ok }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @text_story = current_user.text_stories.find(params[:id])\n\n respond_to do |format|\n if @text_story.update_attributes(params[:text_story])\n format.html { redirect_to @text_story, notice: 'Text story was successfully updated.' }\n format.json { head :no_content }\n else... | [
"0.7052269",
"0.6810041",
"0.666501",
"0.666501",
"0.65900713",
"0.6472669",
"0.63699996",
"0.63667566",
"0.63667566",
"0.6352244",
"0.6352244",
"0.63266414",
"0.63064563",
"0.6305273",
"0.63027036",
"0.628957",
"0.6261429",
"0.6260606",
"0.6239049",
"0.62293196",
"0.62247306... | 0.73923993 | 0 |
DELETE /story_texts/1 DELETE /story_texts/1.xml | def destroy
@story_text = StoryText.find(params[:id])
@story_text.destroy
respond_to do |format|
format.html { redirect_to(story_texts_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end",
"def destroy\n @text_content = TextContent.find(params[:id])\n @text_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(text_contents_url) }\n format.xml { head :ok }\n end\n end",
"... | [
"0.7070622",
"0.69338673",
"0.6842561",
"0.6842561",
"0.6842561",
"0.6807775",
"0.68063945",
"0.6773553",
"0.6750095",
"0.6648325",
"0.6617384",
"0.65844214",
"0.6584194",
"0.6557035",
"0.6520601",
"0.65103585",
"0.65000933",
"0.6472132",
"0.64635",
"0.6459395",
"0.6428996",
... | 0.75271034 | 0 |
GET /localvdos GET /localvdos.json | def index
@localvdos = Localvdo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def vips\n request :get, '/vips'\n end",
"def show\n @vdisk = V... | [
"0.6405738",
"0.5942009",
"0.5927344",
"0.58925414",
"0.5855409",
"0.5721209",
"0.57160664",
"0.5693398",
"0.56821275",
"0.5665634",
"0.56630707",
"0.56535137",
"0.5642071",
"0.56339085",
"0.56215984",
"0.5610081",
"0.556063",
"0.55288815",
"0.5524646",
"0.55219305",
"0.55096... | 0.6858584 | 0 |
GET /localvdos/1 GET /localvdos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @localvdos = Localvdo.all\n end",
"def index\n @vdms = Vdm.all\n\n render json: @vdms\n end",
"def show\n @vdisk = Vdisk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vdisk }\n end\n end",
"def show\n @st... | [
"0.67642754",
"0.6371184",
"0.61805534",
"0.6131751",
"0.60814935",
"0.60242814",
"0.6019131",
"0.59848",
"0.59690905",
"0.5957484",
"0.59573776",
"0.5901055",
"0.5890227",
"0.586171",
"0.5859437",
"0.5850865",
"0.5828672",
"0.58236706",
"0.58234274",
"0.5816912",
"0.57505333... | 0.0 | -1 |
POST /localvdos POST /localvdos.json | def create
@localvdo = Localvdo.new(localvdo_params)
puts "Creatingggggg localvdoooo"
puts localvdo_params
@localvdo.user_id = session[:user_id]
puts @localvdo
respond_to do |format|
if @localvdo.save
@user = User.find(@localvdo.user_id )
format.html { redirect_to @use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def create\n @server = Server.find(params[:server_id])\n... | [
"0.57374966",
"0.559022",
"0.556823",
"0.55112946",
"0.5509481",
"0.5499088",
"0.54744744",
"0.5396948",
"0.53791136",
"0.5357538",
"0.5340619",
"0.53318185",
"0.53264266",
"0.53042585",
"0.52861166",
"0.52830887",
"0.5267351",
"0.52589446",
"0.52483225",
"0.52483225",
"0.523... | 0.55480754 | 3 |
PATCH/PUT /localvdos/1 PATCH/PUT /localvdos/1.json | def update
respond_to do |format|
@user = User.find(session[:user_id])
if @localvdo.update(localvdo_params)
format.html { redirect_to @user, notice: 'Localvdo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
... | [
"0.63002217",
"0.608237",
"0.5935226",
"0.58220404",
"0.5813867",
"0.5790774",
"0.57898617",
"0.57742083",
"0.57653004",
"0.5763429",
"0.57305294",
"0.57264507",
"0.5723019",
"0.57223904",
"0.5713865",
"0.5702377",
"0.5685411",
"0.56576484",
"0.5644566",
"0.5644486",
"0.56400... | 0.5968964 | 2 |
DELETE /localvdos/1 DELETE /localvdos/1.json | def destroy
deleted_url = @localvdo.video.url
vdo_obj = Video.where(local_link: deleted_url).all
vdo_obj.each do |vdo|
vdo.inLocal = false
vdo.local_link = ""
vdo.save!
end
@localvdo.destroy
@user = User.find(session[:user_id])
respond_to do |format|
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\n... | [
"0.7439233",
"0.68773204",
"0.67936754",
"0.66950357",
"0.66925025",
"0.651429",
"0.65102535",
"0.64773107",
"0.6469405",
"0.6461596",
"0.64526737",
"0.6426719",
"0.64197063",
"0.6418994",
"0.6380394",
"0.6351983",
"0.63466257",
"0.63441855",
"0.6334079",
"0.6333026",
"0.6332... | 0.61458975 | 64 |
Use callbacks to share common setup or constraints between actions. | def set_localvdo
@localvdo = Localvdo.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def localvdo_params
params.require(:localvdo).permit(:url)
params.require(:localvdo).permit(:video)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
GET /video_intitucionals GET /video_intitucionals.json | def index
@video_intitucionals = VideoIntitucional.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_video_intitucional\n @video_intitucional = VideoIntitucional.find(params[:id])\n end",
"def show\n @video = Video.find(params[:id])\n\n @networks = @video.networks\n\n @impressions = @video.impressions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { ... | [
"0.64768577",
"0.6457025",
"0.6416398",
"0.605443",
"0.602721",
"0.5921481",
"0.5905475",
"0.5881053",
"0.58736664",
"0.587258",
"0.58695316",
"0.5862606",
"0.5855821",
"0.58546364",
"0.58495694",
"0.5842127",
"0.5824676",
"0.5824676",
"0.5824676",
"0.5824676",
"0.5824676",
... | 0.7264683 | 0 |
GET /video_intitucionals/1 GET /video_intitucionals/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @video_intitucionals = VideoIntitucional.all\n end",
"def set_video_intitucional\n @video_intitucional = VideoIntitucional.find(params[:id])\n end",
"def show\n @video = Video.find(params[:id])\n\n @networks = @video.networks\n\n @impressions = @video.impressions\n\n respond... | [
"0.7420473",
"0.67429966",
"0.6717019",
"0.63507915",
"0.6320781",
"0.6309388",
"0.62432474",
"0.62432474",
"0.62432474",
"0.62432474",
"0.62432474",
"0.62432474",
"0.62432474",
"0.6212979",
"0.6179669",
"0.61752295",
"0.6088028",
"0.6065579",
"0.60610306",
"0.60435736",
"0.6... | 0.0 | -1 |
POST /video_intitucionals POST /video_intitucionals.json | def create
@video_intitucional = VideoIntitucional.new(video_intitucional_params)
respond_to do |format|
if @video_intitucional.save
format.html { redirect_to @video_intitucional, notice: 'Video intitucional was successfully created.' }
format.json { render :show, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_intitucional_params\n params.require(:video_intitucional).permit(:nombre, :descripcion, :link, :activo)\n end",
"def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video ... | [
"0.64546984",
"0.61293733",
"0.60708416",
"0.6061241",
"0.60548425",
"0.60441387",
"0.6002101",
"0.5983983",
"0.59267706",
"0.59027594",
"0.58806026",
"0.58126694",
"0.5734433",
"0.5718471",
"0.57132244",
"0.5700071",
"0.56710935",
"0.5642869",
"0.56424904",
"0.5631015",
"0.5... | 0.7089821 | 0 |
PATCH/PUT /video_intitucionals/1 PATCH/PUT /video_intitucionals/1.json | def update
respond_to do |format|
if @video_intitucional.update(video_intitucional_params)
format.html { redirect_to @video_intitucional, notice: 'Video intitucional was successfully updated.' }
format.json { render :show, status: :ok, location: @video_intitucional }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @video.update(video_params)\n render json: @video\n end",
"def update\n @video = Video.find(params[:id])\n @video.update_attributes\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.... | [
"0.6835218",
"0.6705878",
"0.66956615",
"0.66954476",
"0.66954476",
"0.66921955",
"0.66921955",
"0.66921955",
"0.66921955",
"0.66921955",
"0.66921955",
"0.66921955",
"0.66723114",
"0.66500187",
"0.6634138",
"0.6607293",
"0.65547734",
"0.64904875",
"0.64904875",
"0.64904875",
... | 0.7329276 | 0 |
DELETE /video_intitucionals/1 DELETE /video_intitucionals/1.json | def destroy
@video_intitucional.destroy
respond_to do |format|
format.html { redirect_to video_intitucionals_url, notice: 'Video intitucional was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @video.destroy\n render json: @video, :status => :ok\n end",
"def destroy\n @video = Video.find_by_hash_permalink_id(params[:id])\n @video.destroy\n\n respond_to do |format|\n format.html { redirect_to videos_url }\n format.json { head :ok }\n end\n end",
"def destro... | [
"0.717657",
"0.71142566",
"0.7095204",
"0.70524085",
"0.7024359",
"0.70192826",
"0.70188814",
"0.70188814",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
"0.70177126",
... | 0.77402765 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_video_intitucional
@video_intitucional = VideoIntitucional.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def video_intitucional_params
params.require(:video_intitucional).permit(:nombre, :descripcion, :link, :activo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
no more "ARRRGH, EVIL GLOBALS!!!" | def initialize
self.surveys = []
self.define_counter_methods(%w(survey survey_section question_group question answer dependency dependency_condition))
self.initialize_fixtures(%w(surveys survey_sections question_groups questions answers dependencies dependency_conditions), File.join(RAILS_ROOT, "surveys", "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def globals; end",
"def globals; end",
"def global_variables() end",
"def global; end",
"def local_global\n\t\t\they = \"hey there\" # Local - only accessible from certain methods\n\t\t\tputs hey\n\t\tend",
"def global?; end",
"def globals; list_all :global_variables; end",
"def do_global_map\r\n ... | [
"0.80914676",
"0.80914676",
"0.7748214",
"0.7676119",
"0.6960128",
"0.69316316",
"0.6790769",
"0.6724919",
"0.6695338",
"0.6649684",
"0.6624043",
"0.662169",
"0.65178186",
"0.65088546",
"0.6484918",
"0.6350706",
"0.6307145",
"0.62798005",
"0.6219924",
"0.6215761",
"0.62156826... | 0.0 | -1 |
TODO: this appears to be unused | def iphone_observation(field, options = {})
content_tag(:li,
content_tag(:span, options[:label] || t(:"attributes.#{field}.title"), :class => 'label') +
content_tag(:small,
@last_observation.send(field).to_s +
content_tag(:span, options[:unit] || t(:"attributes.#{field}.unit"), :class =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def refutal()\n end",
"def terpene; end",
"def implementation; end",
"def implementation; end",
"def weber; end",
"def custom; end",
"def custom; end... | [
"0.77166003",
"0.6780847",
"0.6574254",
"0.6574254",
"0.6574254",
"0.6574254",
"0.6385496",
"0.60868096",
"0.60729736",
"0.6027127",
"0.6027127",
"0.60201615",
"0.6013403",
"0.6013403",
"0.6003339",
"0.59841484",
"0.59266776",
"0.5923404",
"0.5923404",
"0.5923404",
"0.5923404... | 0.0 | -1 |
a class variable for generating unique name of element Constructor | def initialize(elem)
TstLog("Sequence: #{elem}")
@offset = elem.offset
@length = elem.length
@elements = [elem]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instancename classname\n\t\t\t'i'+classname\n\t\tend",
"def cr_class_name(attr_name)\n instance_var = attr_name.gsub('/','_').downcase()\n instance_var.gsub!(' ','_')\n instance_var = instance_var.gsub('-','_')\n class_name = \"Cr\" + camelise(instance_var)\n return class_name\nend",
"def generate\n ... | [
"0.6764835",
"0.67122763",
"0.66912144",
"0.65741235",
"0.6460776",
"0.6407089",
"0.6393394",
"0.63794714",
"0.6375468",
"0.63256025",
"0.6303589",
"0.6272186",
"0.6259468",
"0.6233571",
"0.62297565",
"0.62211305",
"0.62201756",
"0.619863",
"0.6166278",
"0.61625344",
"0.61455... | 0.0 | -1 |
add an element (a letter or a parenthesis) to sequence | def add(elem)
TstLog("Sequence add: #{elem}")
@elements.push elem
@length += elem.length
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_one(input)\n newc = new_char\n input + newc\n end",
"def add_character(char)\n @characters << char\n end",
"def createPhoneNumber(arr)\n arr.insert(0, '(')\n arr.insert(4, ') ')\n arr.insert(8, '-')\n arr.join\nend",
"def seq()\n node1 = symbol()\n\n if @look.kind.eql... | [
"0.6046306",
"0.59403485",
"0.59085935",
"0.5858877",
"0.580163",
"0.5736172",
"0.57158047",
"0.57100457",
"0.5703474",
"0.5697781",
"0.5687235",
"0.56765896",
"0.5670504",
"0.5657095",
"0.5652451",
"0.564595",
"0.5640288",
"0.5606985",
"0.56003195",
"0.5598281",
"0.5594318",... | 0.59931576 | 1 |
concatinate other sequence object to sequence | def concatinate(other_obj)
TstLog("Sequence concatinate: #{other_obj}")
@elements += other_obj.elements
@length += other_obj.length
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concat(other)\n other.each do |obj|\n add obj\n end\n self\n end",
"def qseq; @seq1.seq; end",
"def hseq; @seq2.seq; end",
"def concat(*other)\n Observable.concat(self, *other)\n end",
"def concat(other)\n contract.concat(other)\n end",
"def conc... | [
"0.66233665",
"0.6379445",
"0.625002",
"0.6249185",
"0.6231056",
"0.60658836",
"0.6065667",
"0.6065667",
"0.5974578",
"0.59447706",
"0.59391916",
"0.59299785",
"0.59149927",
"0.5899127",
"0.58966047",
"0.5859499",
"0.58475655",
"0.5845244",
"0.58273816",
"0.58221126",
"0.5787... | 0.7743977 | 0 |
transform to json format | def json
# if @elements.size > 1
@@id += 1
"{\"type\": \"LEX_SEQ\", " +
" \"id\": \"q#{@@id}\", " +
" \"offset\": \"#{@offset}\", " +
" \"length\": \"#{@length}\", " +
" \"value\": [#{@elements.map{|elem| elem.json}.join(",")}]}"
# else
# @elements[0].j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tojson\n\t\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n\t\tto_h.to_json\n\tend",
"def to_json\n to_parsed.to_json\n end",
"def to_json\n to_h.to_json\n end",
"def to_json\n to_h.to_json\n end",
"def to_json\r\n to_hash.to_json\r\n end",
"def to_json\n ... | [
"0.7705823",
"0.769111",
"0.769111",
"0.7574801",
"0.7439115",
"0.7439115",
"0.74229664",
"0.7371268",
"0.73579794",
"0.7331206",
"0.7321626",
"0.72884166",
"0.72716767",
"0.726922",
"0.7227323",
"0.7227323",
"0.7227323",
"0.7227323",
"0.7227323",
"0.7227323",
"0.7227323",
... | 0.0 | -1 |
Hosts + Ports for MDNS resolver This looks for MM_MDNSRC in your environment. If you are going to use IPv6addresses: Make sure you do not forget to add the port at the end. MM_MDNSRC=ip:port ip:port | def nameserver_config
return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC']
address, port = ENV['MM_DNSRC'].split(/:/)
{
nameserver_port: [[address, port.to_i]]
}
rescue StandardError
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasm... | [
"0.5764018",
"0.5393909",
"0.52853024",
"0.5268853",
"0.52286005",
"0.52286005",
"0.51319456",
"0.5128705",
"0.5128179",
"0.5080676",
"0.5078517",
"0.50548786",
"0.5046793",
"0.5012342",
"0.49696177",
"0.496625",
"0.49582797",
"0.4950464",
"0.4940983",
"0.4912187",
"0.4895452... | 0.6437371 | 0 |
specifies the size in bytes of the random salt you want to generate. The default and minimum is 8 bytes (64 bits). Maximum is 32 bytes (256 bits). | def salt_size
@salt_size ||= 8
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def salt_size\n @salt_size ||= defaults[:salt_size]\n end",
"def salt\n # 72 bits\n SecureRandom.hex(9)\n end",
"def generate_salt\n self.salt = SecureRandom.base64(8)\n end",
"def gen_salt\n chars = []\n 8.times { chars << SALT_CHARS[SecureRandom.random... | [
"0.8048943",
"0.7398",
"0.72707367",
"0.7215457",
"0.7149919",
"0.7139437",
"0.70908016",
"0.7040125",
"0.6978845",
"0.69562936",
"0.6910451",
"0.6842759",
"0.6730861",
"0.66973144",
"0.66888684",
"0.66656536",
"0.66656536",
"0.66462296",
"0.6639908",
"0.6599872",
"0.65642494... | 0.85975146 | 0 |
specifies the maximum number of seconds the computation should take. | def max_time
@max_time ||= 0.2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_time\n @max_time ||= defaults[:max_time]\n end",
"def time_limit\n [2, problem.time_limit].min\n end",
"def max_run_time\n 96.hours\n end",
"def time_tolerance_seconds\n 600\n end",
"def limit\n @timeout\n end",
"def max_wait_time\n @data[\"max_wait_time\"... | [
"0.71479255",
"0.7079802",
"0.69693017",
"0.6936189",
"0.69310325",
"0.6816541",
"0.66486907",
"0.6609191",
"0.65463907",
"0.65309966",
"0.6491734",
"0.64174205",
"0.63921803",
"0.63892305",
"0.6379274",
"0.6360037",
"0.63196754",
"0.630715",
"0.6290767",
"0.6290109",
"0.6252... | 0.77659875 | 0 |
specifies the maximum number of bytes the computation should take. A value of 0 specifies no upper limit. The minimum is always 1 MB. | def max_mem
@max_mem ||= 1024 * 1024
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specific_max_size(number); end",
"def max_size; end",
"def max_size\n @max_size ||= options[:max_size] || [DEFAULT_MAX_SIZE, min_size].max\n end",
"def default_max_size; end",
"def max_size_in_megabytes\n to_i description['MaxSizeInMegabytes']\n end",
"def max_size\n 1\n e... | [
"0.7896738",
"0.7810239",
"0.757034",
"0.74343175",
"0.7425131",
"0.7398905",
"0.7396783",
"0.7352815",
"0.7351131",
"0.72469765",
"0.7217425",
"0.7207503",
"0.714148",
"0.70103246",
"0.70078194",
"0.6943921",
"0.69062257",
"0.69024545",
"0.6898784",
"0.6889835",
"0.68638676"... | 0.69866174 | 15 |
specifies the maximum memory in a fraction of available resources to use. Any value equal to 0 or greater than 0.5 will result in 0.5 being used. | def max_memfrac
@max_memfrac ||= 0.5
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_memfrac\n @max_memfrac ||= defaults[:max_memfrac]\n end",
"def memory_fraction(fraction = 4)\n os_memory / 1024 / fraction\n end",
"def max_mem\n @max_mem ||= defaults[:max_mem]\n end",
"def calculate_max_memory(vm, memory)\n max = vm.memory_policy&.max || mem... | [
"0.80121577",
"0.7196062",
"0.68142754",
"0.67821",
"0.67685753",
"0.65092397",
"0.64872664",
"0.63811594",
"0.63811594",
"0.633542",
"0.6277992",
"0.6246751",
"0.6197276",
"0.6183832",
"0.6169973",
"0.6085192",
"0.60639054",
"0.60114676",
"0.60011345",
"0.59756505",
"0.59711... | 0.8131146 | 0 |
Hashes a secret, returning a SCrypt::Password instance. | def encrypt( *tokens )
::SCrypt::Password.create( join_tokens( tokens ), { key_len: key_len,
salt_size: salt_size,
max_time: max_time,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password=(secret)\n if secret.present?\n @password = secret\n self.password_digest = BCrypt::Password.create(secret)\n end\n end",
"def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, s... | [
"0.7490748",
"0.7380996",
"0.7245717",
"0.6957664",
"0.6918203",
"0.6894858",
"0.6766931",
"0.676554",
"0.6756027",
"0.6712433",
"0.67024577",
"0.67013735",
"0.6695569",
"0.6679478",
"0.66791534",
"0.66752535",
"0.66740775",
"0.6661777",
"0.6653983",
"0.66453147",
"0.66453147... | 0.0 | -1 |
Compares a potential secret against the hash. Returns true if the secret is the original secret, false otherwise. | def matches?( crypted, *tokens )
crypted == join_tokens( tokens )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(secret)\n SecurityUtils.secure_compare(self, SCrypt::Engine.hash_secret(secret, @cost + @salt, self.digest.length / 2))\n end",
"def secret_matches?(input, secret)\n unless perform_secret_hashing?\n return ActiveSupport::SecurityUtils.secure_compare input, secret\n end... | [
"0.7526958",
"0.7422309",
"0.73407036",
"0.715153",
"0.715153",
"0.68170935",
"0.6806525",
"0.67129976",
"0.6700066",
"0.65875715",
"0.65256196",
"0.63749087",
"0.63634974",
"0.60494566",
"0.59981966",
"0.59817594",
"0.59504807",
"0.59272015",
"0.5902958",
"0.5854829",
"0.585... | 0.0 | -1 |
after run, this contains the clusters that were merged into other clusters | def dropped_clusters
_dropped_clusters.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_clusters\n _updated_clusters.to_a\n end",
"def merge(c1, c2)\n clusters = @clusters.dup\n @clusters = clusters - [c1, c2] + [c1.merge(c2)]\n end",
"def all_clusters\n if @all_clusters.empty?\n @clusters.each do |id, clusters|\n @all_... | [
"0.69300854",
"0.67396766",
"0.6720351",
"0.6565847",
"0.6558252",
"0.6551425",
"0.63118744",
"0.622049",
"0.6153493",
"0.6145974",
"0.6131021",
"0.6125796",
"0.6113336",
"0.61089003",
"0.6091532",
"0.6068058",
"0.60474646",
"0.6041832",
"0.58739924",
"0.5850866",
"0.5826933"... | 0.6140386 | 10 |
after run, this contains the clusters that were modified and need to be persisted | def updated_clusters
_updated_clusters.to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_cluster_role\n save_cluster_general_data\n end",
"def manage_cluster\n @nodes = Node.find(:all)\n end",
"def reapply_nodes\n @nodes.each { |node| node.data[:cluster] = self }\n end",
"def cluster_list\n super\n end",
"def all_clusters\n if @all_clusters.empty?\n ... | [
"0.6896658",
"0.6617583",
"0.65020734",
"0.62735033",
"0.61499625",
"0.6129363",
"0.6114407",
"0.59710115",
"0.5965129",
"0.5936992",
"0.59170896",
"0.59158826",
"0.58738035",
"0.58576506",
"0.5838994",
"0.5828285",
"0.5800905",
"0.5795871",
"0.5776542",
"0.57740664",
"0.5763... | 0.7474327 | 0 |
fraction of the diagonal of the fence tile | def min_distance
@min_distance ||= (_fence.southwest & _fence.northeast) * @min_distance_ratio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diagonal_size\n Math.sqrt( @room_height * @room_height + @room_width * @room_width ).round(0)\n end",
"def density\n @colt_property.density(@colt_matrix)\n end",
"def uncertainty_cell_diagonal_meters\n return nil unless georeferenced?\n lat = private_latitude || latitude\n lon = privat... | [
"0.64561695",
"0.6020869",
"0.5928978",
"0.5794344",
"0.5778001",
"0.57281953",
"0.572262",
"0.56569207",
"0.56538683",
"0.5648718",
"0.56057644",
"0.5605245",
"0.56000495",
"0.5595546",
"0.5585679",
"0.5568493",
"0.55405563",
"0.552303",
"0.55073357",
"0.5497909",
"0.5494963... | 0.0 | -1 |
factory for pairs, switches between fenced/unfenced and conditionnaly adds density bias | def _build_pair(c1, c2, fence)
pair = fence.nil? ? Pair.new(c1, c2) : FencedPair.new(c1, c2, fence)
if DENSITY_BIAS_FACTOR && (@max_density != @min_density)
# the least dense cluster pairs have a density_bias value close to 0, the densest closer to 1
density_bias = (c1.density + c2.density ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbor &block\n factory = block || lambda { |o| State.new o }\n new_params = @o.merge(\n (p = @params.sample) => @o[p] + @deltas.call(p).sample\n )\n legal(new_params)?\n factory.call(new_params) :\n neighbor\n end",
"def condensation\n sc = strong_components\n cg = ... | [
"0.505051",
"0.5031198",
"0.5000089",
"0.4931899",
"0.49195954",
"0.4899468",
"0.4792735",
"0.47809967",
"0.477591",
"0.47709605",
"0.47482035",
"0.47264934",
"0.47157902",
"0.46941504",
"0.46804374",
"0.46581507",
"0.46537575",
"0.464206",
"0.46245107",
"0.46199772",
"0.4606... | 0.68184626 | 0 |
def ==(other) (self.left_id == other.left_id) && (self.right_id == other.right_id) end | def values
[@left, @right]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n @left == other.left && @middle == other.middle && @right == other.right\n end",
"def eql?(other)\n instance_of?(other.class) &&\n left.eql?(other.left) &&\n right.eql?(other.right)\n end",
"def ==(other)\n other.respond_to?(:node?) && other.node? &&\n ... | [
"0.82324237",
"0.8105831",
"0.8070402",
"0.80001163",
"0.7987241",
"0.7970822",
"0.7953482",
"0.79002905",
"0.7886394",
"0.78467065",
"0.7790415",
"0.7790415",
"0.77531284",
"0.77414477",
"0.7740103",
"0.7740103",
"0.7740103",
"0.7740103",
"0.77348006",
"0.7731266",
"0.772482... | 0.0 | -1 |
GET /arealists GET /arealists.json GET /arealists/1 GET /arealists/1.json | def show
@arealist = Arealist.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artists\n render :nothing => true and return if params[:id].nil?\n\n if ( params[:meta] == 'tattoos' )\n @artist = Artist.find(params[:id], :include => :tattoos)\n render :json => @artist.tattoos.to_json(:include => { :assets => { :only => [:id, :data_file_name] } })\n return\n end\n ... | [
"0.6466967",
"0.63085747",
"0.6255869",
"0.6254115",
"0.62457836",
"0.61070406",
"0.6104378",
"0.6082721",
"0.6072986",
"0.6065658",
"0.6045662",
"0.60314035",
"0.6007726",
"0.5958373",
"0.5951207",
"0.5947573",
"0.594266",
"0.5938748",
"0.59342986",
"0.5926839",
"0.5923527",... | 0.59078556 | 22 |
POST /arealists POST /arealists.json | def create
@arealist = @user.Arealist.build(arealist_params)
respond_to do |format|
if @arealist.save
format.html { redirect_to @arealist, notice: 'Arealist was successfully created.' }
format.json { render :show, status: :created, location: @arealist }
else
format.html { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :u... | [
"0.59605306",
"0.5855083",
"0.57560205",
"0.5673423",
"0.5659032",
"0.56164026",
"0.559885",
"0.557391",
"0.5527403",
"0.550841",
"0.548613",
"0.54615396",
"0.54492486",
"0.54396135",
"0.5434048",
"0.5429472",
"0.5409692",
"0.54028976",
"0.5392758",
"0.53816473",
"0.5371223",... | 0.5889695 | 1 |
PATCH/PUT /arealists/1 PATCH/PUT /arealists/1.json | def update
@arealist = Arealist.find(params[:id])
respond_to do |format|
if @arealist.update(arealist_params)
format.html { redirect_to @arealist, notice: 'Arealist was successfully updated.' }
format.json { render :show, status: :ok, location: @arealist }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { red... | [
"0.6563652",
"0.62660086",
"0.6257029",
"0.6239999",
"0.62186784",
"0.62170005",
"0.6157597",
"0.61561465",
"0.61074686",
"0.61047244",
"0.6077115",
"0.60745704",
"0.6059536",
"0.6042427",
"0.60415787",
"0.60347474",
"0.6016818",
"0.6013584",
"0.59831697",
"0.5980185",
"0.597... | 0.6415842 | 1 |
DELETE /arealists/1 DELETE /arealists/1.json | def destroy
@arealist = Arealist.find(params[:id])
@arealist.destroy
respond_to do |format|
format.html { redirect_to arealists_url, notice: 'Arealist was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ally.destroy\n ... | [
"0.696929",
"0.69352263",
"0.69352263",
"0.68559027",
"0.6831747",
"0.67919195",
"0.6779069",
"0.6764605",
"0.6759929",
"0.67563164",
"0.6734271",
"0.6726095",
"0.6722624",
"0.67179126",
"0.67056453",
"0.6688347",
"0.6681762",
"0.66782624",
"0.66734016",
"0.66679996",
"0.6665... | 0.72305274 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_arealist
@arealist = Arealist.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def arealist_params
params.require(:arealist).permit(:uuid, :name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980384",
"0.6782743",
"0.6746196",
"0.6742575",
"0.6736",
"0.6594004",
"0.65037984",
"0.6496699",
"0.64819324",
"0.64791185",
"0.6456292",
"0.64403296",
"0.63795286",
"0.6375975",
"0.6365291",
"0.63210756",
"0.6300542",
"0.6299717",
"0.62943304",
"0.6292561",
"0.6290683",... | 0.0 | -1 |
GET /ps_connection_informations GET /ps_connection_informations.json | def index
@ps_connection_informations = PsConnectionInformation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_connection_info\n info = []\n @connections.each do |connection|\n info.push([connection.id, connection.target_uri, 'i', connection.protocol, @topic_name])\n end\n info\n end",
"def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n form... | [
"0.69329274",
"0.6659657",
"0.66174996",
"0.64111155",
"0.6387036",
"0.6379933",
"0.6379933",
"0.63109094",
"0.6248713",
"0.6235743",
"0.6192539",
"0.61849725",
"0.616234",
"0.6133005",
"0.61096084",
"0.61015207",
"0.6034845",
"0.6017248",
"0.6008693",
"0.59971774",
"0.597331... | 0.7840774 | 0 |
GET /ps_connection_informations/1 GET /ps_connection_informations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ps_connection_informations = PsConnectionInformation.all\n end",
"def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end",
"def getconnectioncount\n @api.reques... | [
"0.76207924",
"0.69555026",
"0.652222",
"0.65037256",
"0.6470935",
"0.6466035",
"0.6436867",
"0.64349544",
"0.6390047",
"0.6221463",
"0.6221463",
"0.6128989",
"0.6103244",
"0.60638565",
"0.6012503",
"0.6001069",
"0.5966645",
"0.59633005",
"0.5928881",
"0.5902179",
"0.5881666"... | 0.0 | -1 |
POST /ps_connection_informations POST /ps_connection_informations.json | def create
@ps_connection_information = PsConnectionInformation.new(ps_connection_information_params)
respond_to do |format|
if @ps_connection_information.save
format.html { redirect_to @ps_connection_information, notice: 'Ps connection information was successfully created.' }
format.json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ps_connection_informations = PsConnectionInformation.all\n end",
"def create\n @connection = Connection.new(connection_params)\n\n respond_to do |format|\n if @connection.save\n format.html { redirect_to @connection, notice: \"Connection was successfully created.\" }\n f... | [
"0.6974499",
"0.64507985",
"0.644934",
"0.64247346",
"0.63751084",
"0.6274576",
"0.61323273",
"0.6092267",
"0.60474217",
"0.60231894",
"0.59996927",
"0.59752303",
"0.59210455",
"0.5837974",
"0.57823753",
"0.57412577",
"0.57303625",
"0.5679137",
"0.56776553",
"0.56675863",
"0.... | 0.71168685 | 0 |
PATCH/PUT /ps_connection_informations/1 PATCH/PUT /ps_connection_informations/1.json | def update
respond_to do |format|
if @ps_connection_information.update(ps_connection_information_params)
format.html { redirect_to @ps_connection_information, notice: 'Ps connection information was successfully updated.' }
format.json { head :no_content }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @connection.update(connection_params)\n format.html { redirect_to @connection, notice: \"Connection was successfully updated.\" }\n format.json { render :show, status: :ok, location: @connection }\n else\n format.html { render :edit, status... | [
"0.65162784",
"0.6387729",
"0.62986165",
"0.60680145",
"0.606553",
"0.60116845",
"0.59717023",
"0.5927998",
"0.58808357",
"0.5873172",
"0.5831931",
"0.5794607",
"0.5727732",
"0.5719695",
"0.57170784",
"0.5692328",
"0.56889635",
"0.5641839",
"0.5638203",
"0.56366724",
"0.56317... | 0.7132336 | 0 |
DELETE /ps_connection_informations/1 DELETE /ps_connection_informations/1.json | def destroy
@ps_connection_information.destroy
respond_to do |format|
format.html { redirect_to ps_connection_informations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @connection.destroy\n respond_to do |format|\n format.html { redirect_to connections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @connection = Connection.find(params[:id])\n @connection.destroy\n\n respond_to do |format|\n format.html { re... | [
"0.7054572",
"0.69786316",
"0.69786316",
"0.69606066",
"0.682075",
"0.68184865",
"0.67460597",
"0.67282176",
"0.6667255",
"0.6630655",
"0.660108",
"0.6571307",
"0.6557402",
"0.6532977",
"0.64949656",
"0.64836174",
"0.64659226",
"0.64632",
"0.6459185",
"0.6420869",
"0.63675064... | 0.7785583 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ps_connection_information
@ps_connection_information = PsConnectionInformation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ps_connection_information_params
params.require(:ps_connection_information).permit(:print_station_id, :ip_address, :jack, :pharos)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
number2 the second integer to be compared to the others number3 the third integer to be compared to the others Exampels between(1, 1, 10) => true between(1, 5, 100) => false between(0, 1, 1) => true Retuns the answear | def between(number1,number2,number3)
output = false
if number1 < number3 && number2 < number1
output = true
end
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_range2 (number)\n\t \tcase number\n\t\twhen 0..50\n\t\tputs \"your number is between 0 and 50\"\n\t\twhen 51..100\n\t\tputs \"your number is between 51 and 100\"\n\t\telse\n\t\t\tif number < 0\n\t\t\t\tputs \"can't enter a negative number\"\n\t\t\telsif number > 100\n\t\t\t\tputs \"over 100\"\n\t\t\tend... | [
"0.6980149",
"0.6914846",
"0.6884441",
"0.68793243",
"0.68750334",
"0.68147904",
"0.67787725",
"0.6734428",
"0.67339426",
"0.66916513",
"0.6690419",
"0.6690419",
"0.66695476",
"0.6652958",
"0.66449606",
"0.6602224",
"0.65150726",
"0.65077645",
"0.64974874",
"0.6491347",
"0.64... | 0.7135278 | 0 |
initializes the article with its name | def initialize(id)
if id =~ /(.*)\.markdown$/
@id = $1
else
@id = id
end
parse_attributes(filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(name)\n @name = name # initializes every new object with a name\n @posts = [ ] # initializes a places to store all an authors posts inside the artist\n end",
"def initialize(name, document); end",
"def initialize name\n\t\t\t@name = name\n\t\tend",
"def initialize(name)\n @name = nam... | [
"0.66665596",
"0.6477239",
"0.645606",
"0.6421653",
"0.640901",
"0.63997465",
"0.6389222",
"0.6363654",
"0.63518465",
"0.63446873",
"0.63407415",
"0.6327653",
"0.6314666",
"0.62803113",
"0.62577647",
"0.6256321",
"0.6255434",
"0.6254536",
"0.6248883",
"0.6236904",
"0.6236904"... | 0.0 | -1 |
returns the expanded path of the article | def filename
"#{Parchemin::Config.articles_path}/#{@id}.markdown"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_expanded path\n end",
"def article_path(article)\r\n article.id + \".html\"\r\n end",
"def path\n Pathname(@path.respond_to?(:to_path) ? @path.to_path : @path.to_s).expand_path\n end",
"def full_path\n path\n end",
"def expand(path)\n (root_path/trim(path)).to_s\n end",
... | [
"0.777507",
"0.70165795",
"0.6992306",
"0.6846693",
"0.6679536",
"0.66470456",
"0.6625564",
"0.65999657",
"0.6591607",
"0.6591607",
"0.6460832",
"0.643172",
"0.64006245",
"0.6395829",
"0.6388516",
"0.6323211",
"0.63048124",
"0.6303459",
"0.62861484",
"0.62784773",
"0.6258971"... | 0.0 | -1 |
returns the month of the article's creation date | def month
MONTHS[@created_at.month-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month\n created.strftime '%m'\n end",
"def month_number\n date.month\n end",
"def month() end",
"def month; end",
"def month; end",
"def month\n start_date&.strftime('%b %Y')\n end",
"def month\n return @month\n ... | [
"0.81738174",
"0.74032086",
"0.7398011",
"0.73234814",
"0.73234814",
"0.72898835",
"0.72887266",
"0.71788",
"0.71110255",
"0.71070075",
"0.71019036",
"0.7077225",
"0.7064291",
"0.7004275",
"0.7002611",
"0.69693196",
"0.69212836",
"0.69212836",
"0.6862187",
"0.68588215",
"0.68... | 0.7562349 | 1 |
returns the day of the article's creation date | def day
@created_at.day
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def day\n created.strftime '%d'\n end",
"def day\n created_at.beginning_of_day\n end",
"def creation_date\n data.creation_date\n end",
"def create_date\n data.create_date\n end",
"def create_date\n data.create_date\n end",
"def create_date\n data.create_... | [
"0.81368834",
"0.7392849",
"0.7174824",
"0.7168847",
"0.7168847",
"0.7168847",
"0.7125389",
"0.71064574",
"0.7100348",
"0.7049136",
"0.7042355",
"0.7042355",
"0.7038487",
"0.6998561",
"0.6959766",
"0.6885895",
"0.6883332",
"0.68791693",
"0.686824",
"0.68648005",
"0.6850861",
... | 0.7695122 | 1 |
returns the year of the article's creation date | def year
@created_at.year
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def year\n created.strftime '%Y'\n end",
"def year\n (created_at || Time.now).year\n end",
"def publication_year\n end",
"def get_publication_year\n\t\treturn publication_year.year if !publication_year.nil?\n\tend",
"def year\n #Para que salga con el formato de ARG\n fecha = Da... | [
"0.82964057",
"0.8127567",
"0.7792779",
"0.77722645",
"0.7581792",
"0.75603783",
"0.7516281",
"0.74586415",
"0.7447144",
"0.7447144",
"0.7423837",
"0.74027145",
"0.73818177",
"0.73643404",
"0.7351247",
"0.7340673",
"0.73223585",
"0.72890925",
"0.72669595",
"0.7249564",
"0.724... | 0.8132715 | 1 |
returns a well formatted date | def date
"#{day} #{month.capitalize} #{year}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def date_str d\n Util::date(d)\n end",
"def nice_date_form(the_date)\n \treturn the_date ? the_date.strftime('%b %d, %Y') : ''\n\tend",
"def formatted_date(date)\n DateTime.parse(date).strftim... | [
"0.78318113",
"0.77300584",
"0.77292496",
"0.7541324",
"0.7532686",
"0.7518496",
"0.7513229",
"0.7477962",
"0.7471103",
"0.74061245",
"0.74036753",
"0.73716295",
"0.7363928",
"0.73497534",
"0.7331789",
"0.732258",
"0.73035",
"0.7298053",
"0.7278482",
"0.7261701",
"0.72517926"... | 0.7376188 | 11 |
defines the comparison of two articles | def <=>(article)
created_at <=> article.created_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(x, y); end",
"def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end",
"def review... | [
"0.64818335",
"0.6300679",
"0.62025976",
"0.6170123",
"0.61584014",
"0.6112442",
"0.6040939",
"0.60288393",
"0.6008935",
"0.60073614",
"0.59620154",
"0.59151936",
"0.59130526",
"0.590601",
"0.5885376",
"0.58787936",
"0.5850576",
"0.58390737",
"0.58210886",
"0.58210886",
"0.58... | 0.53389287 | 82 |
returns all the comments available for an article | def comments
Comment.where(:article => @id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @comments = @article.comments\n end",
"def index\n @article_comments = Article::Comment.all\n end",
"def index\n @comments = CommentsArticle.all\n end",
"def index\n @article_comments = ArticleComment.all\n end",
"def index\n @article_comments = ArticleComment.all\n end",
... | [
"0.753977",
"0.74242103",
"0.7354983",
"0.73508626",
"0.73508626",
"0.7312806",
"0.7282617",
"0.69914985",
"0.69609654",
"0.6923979",
"0.6923979",
"0.68881804",
"0.68799645",
"0.6857746",
"0.6856396",
"0.6845282",
"0.6832279",
"0.6831484",
"0.6813461",
"0.68082523",
"0.680141... | 0.82807285 | 0 |
Parse the header of an article's file | def parse_attributes(filename)
body = ""
File.open(filename) do |f|
f.lines.each do |line|
if line.match /<!--\s(.*)\s-->/
$1.match /(.*)\s:\s(.*)/
eval "@#{$1} = #{$2}"
else
body += line
end
end
end
@body = RDisc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_header_contents; end",
"def parse_setext_header; end",
"def parse_header_contents\n text = @src[\"contents\"]\n text.rstrip!\n id_match = HEADER_ID.match(text)\n if id_match\n id = id_match[\"id\"]\n text = text[0...-id_match[0].length]\n text.rs... | [
"0.7786152",
"0.68417853",
"0.68044674",
"0.67463005",
"0.6680447",
"0.66587573",
"0.66396195",
"0.66116804",
"0.6601397",
"0.65167665",
"0.6418185",
"0.6385188",
"0.6332754",
"0.62921286",
"0.6261827",
"0.623335",
"0.6230859",
"0.6199148",
"0.61903316",
"0.61870986",
"0.6177... | 0.0 | -1 |
set up the new Game | def start
puts "Welcome to Tic Tac Toe!"
puts "Select the type of game you'd like to play:"
puts "0 - Computer vs Computer"
puts "1 - Human vs Computer"
puts "2 - Human vs Human"
input = gets.strip
if input == "0"
this_game = Game.new(player_1 = Players::Computer.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_setup\n end",
"def initialize_game\n setup_boards\n end",
"def begin_game\n\t\t#Does this need really to be stored in a variable?\n\t\tg = Game.new(@name)\n\tend",
"def start\n # start a new game using @config\n end",
"def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game =... | [
"0.8062615",
"0.7525469",
"0.7493664",
"0.7392851",
"0.73857975",
"0.7342361",
"0.73275",
"0.72957385",
"0.72897637",
"0.72620595",
"0.72616696",
"0.72420114",
"0.72270143",
"0.72228134",
"0.7157853",
"0.7138763",
"0.7123241",
"0.7112455",
"0.7050608",
"0.69825137",
"0.697276... | 0.0 | -1 |
Add document to index or update existing document | def add(pubid, file, change = nil)
item = @index.find { |i| i[:pubid] == pubid }
unless item
item = { pubid: pubid }
@index << item
end
item[:file] = file
item[:last_change] = change if change
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_index\n SolrService.add(to_solr, softCommit: true)\n end",
"def write_document_to_index(document)\n\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": docu... | [
"0.73236984",
"0.72552866",
"0.70742285",
"0.7066096",
"0.6957972",
"0.69263345",
"0.6914893",
"0.6875199",
"0.67894286",
"0.6670051",
"0.66618747",
"0.660112",
"0.65334344",
"0.6525462",
"0.6517534",
"0.6505371",
"0.6468243",
"0.6453638",
"0.64530367",
"0.6449925",
"0.643983... | 0.0 | -1 |
Find document in index by reference and sort results by document ID | def search(ref)
upcase_ref = ref.upcase
@index.select do |i|
RelatonBib.array(i[:pubid]).detect { |r| r.include? upcase_ref }
end.sort_by { |r| r[:pubid].is_a?(Array) ? r[:pubid].min : r[:pubid] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_docs_by_key!; end",
"def reorder(results, solr_data, options = {})\n return results if options[:find] && options[:find][:order]\n returned_results = []\n solr_data.docs.each_with_index do |doc, index|\n doc_id = doc[\"#{solr_configuration[:primary_key_field]}\"]\n returned_r... | [
"0.6422081",
"0.61803955",
"0.6092465",
"0.60288966",
"0.6006153",
"0.5729371",
"0.5667782",
"0.5662614",
"0.561649",
"0.55154556",
"0.5514297",
"0.549116",
"0.5485356",
"0.54809225",
"0.5440515",
"0.54314494",
"0.54114693",
"0.5409767",
"0.53825575",
"0.53761417",
"0.5300706... | 0.66946495 | 0 |
Save index to file | def save
File.write @path, @index.to_yaml, encoding: "UTF-8"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n File.open(@index_file, 'wb') do |f|\n Marshal.dump([@terms, @index], f)\n end\n end",
"def save\n File.open(@index_file, 'wb') do |f|\n f.puts Marshal::dump([@terms, @index])\n end\n end",
"def save_index\n @index.compute_digest(@data_file)\n @index.to_disk(@index_f... | [
"0.8777805",
"0.8767179",
"0.84048784",
"0.7901087",
"0.7873457",
"0.75497323",
"0.7452673",
"0.6984207",
"0.6829194",
"0.6784523",
"0.67748994",
"0.6717418",
"0.6717085",
"0.66985905",
"0.6617627",
"0.6493543",
"0.6483771",
"0.6464888",
"0.64572155",
"0.63925976",
"0.6330886... | 0.83197534 | 3 |
Create dir if need and return path to index file | def path
@path ||= begin
dir = File.join Dir.home, ".relaton", "iec"
FileUtils.mkdir_p dir
File.join dir, "index.yaml"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_path\n safe_dir / options[:index_name]\n end",
"def write\n if File.exist?(@dir)\n FileWriter.write File.join(@dir, 'index.html'), @index\n end\n end",
"def directory_index\n end",
"def generate_directory_index(dir)\n @log.debug(\" creating an index for #{dir}\"... | [
"0.74345577",
"0.7088934",
"0.7061355",
"0.69059354",
"0.6846963",
"0.6834745",
"0.64518034",
"0.6447755",
"0.6356991",
"0.63167685",
"0.631071",
"0.62927186",
"0.62884134",
"0.6287499",
"0.62772065",
"0.62129396",
"0.62039185",
"0.61860263",
"0.6183861",
"0.6150455",
"0.6146... | 0.70782804 | 2 |
Create index file for dataset | def create_index_file
return [] unless File.exist? path
RelatonBib.parse_yaml File.read(path, encoding: "UTF-8"), [Symbol]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_index\n @logger.fine('Constructing index...')\n File.open(@index_path, 'wb') do |f|\n write_int(@data_timestamp, f) # The timestamp value - used to determine if an index is valid.\n write_int(0, f) # The first row - always at offset 0.\n @data.each_line { write_int(@dat... | [
"0.80383235",
"0.7166157",
"0.7132383",
"0.7113231",
"0.68705577",
"0.6802015",
"0.680151",
"0.6780163",
"0.6737207",
"0.67000496",
"0.66689134",
"0.66556966",
"0.6521685",
"0.6511643",
"0.6481663",
"0.64789",
"0.645119",
"0.6446515",
"0.6438737",
"0.6403467",
"0.64028955",
... | 0.6842961 | 5 |
Read index from file if it exists and not outdated | def read_index_file
return if !File.exist?(path) || File.ctime(path).to_date < Date.today
RelatonBib.parse_yaml File.read(path, encoding: "UTF-8"), [Symbol]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_index_file\n @index = File.open(@index_path, 'rb')\n end",
"def load_index_file(index_filename)\n # Look for an index. If it is found, load it and use it.\n return unless File.readable?(index_filename)\n Pocolog.info \"loading file info from #{index_filename}... ... | [
"0.71039397",
"0.7032064",
"0.68395513",
"0.68030477",
"0.6739776",
"0.67032725",
"0.66439116",
"0.6626459",
"0.6620582",
"0.6608279",
"0.6575662",
"0.6387999",
"0.63222945",
"0.6313984",
"0.62340796",
"0.6218858",
"0.62106216",
"0.62088245",
"0.6174969",
"0.6164392",
"0.6088... | 0.7379033 | 0 |
Get index from a GitHub repository | def get_index_from_gh # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
resp = Zip::InputStream.new URI("#{Hit::GHURL}index.zip").open
zip = resp.get_next_entry
yaml = zip.get_input_stream.read
index = RelatonBib.parse_yaml yaml, [Symbol]
File.write path, index.to_yaml, encoding: "UT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if (params[:search]) && (params[:search].empty? == false) \n urlformated = URI.encode(params[:search])\n uri = URI.parse(\"https://api.github.com/legacy/repos/search/#{urlformated}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (uri.scheme == 'https')... | [
"0.69008994",
"0.6746276",
"0.66121113",
"0.6425425",
"0.64242375",
"0.64043343",
"0.63995385",
"0.63975894",
"0.63927484",
"0.63521236",
"0.63319755",
"0.6308071",
"0.62738264",
"0.6262867",
"0.62478465",
"0.6202453",
"0.6181602",
"0.61753637",
"0.61668444",
"0.6141394",
"0.... | 0.7371433 | 0 |
Setup game and play | def play
board_setup
gameplay_setup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_setup\n end",
"def gameplay_setup\n game_status = :new_game\n\n loop do\n print_player_turn(@board_turn.player.name)\n\n print \"Introduce your shoot - x, y: \".blue\n shoot = $stdin.gets.chomp.split(\",\").map(&:to_i)\n game_shoot = set_shoot(shoot)\n\n c... | [
"0.82987815",
"0.79175234",
"0.7629301",
"0.74981123",
"0.7461193",
"0.7232653",
"0.72095954",
"0.71499836",
"0.71257806",
"0.7111792",
"0.7104963",
"0.70475477",
"0.70290667",
"0.7018257",
"0.7015547",
"0.698662",
"0.69770384",
"0.6971919",
"0.696905",
"0.6953118",
"0.690555... | 0.83113146 | 0 |
Constructor with validations if mode = best_of3 then players play 3 matches in a row if not just play 1 match and cli will ask user if want to play another match | def setup(size, random, best_of3)
@size = size
if best_of3 && @board_player1 && @board_player2
@board_player1 = Board.new(size, @board_player1.player)
@board_player2 = Board.new(size, @board_player2.player)
else
@board_player1 = Board.new(size, Player.new("abrahan"))
@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_new_match\n @player1.points = 0\n @player1.deuce = false\n @player1.advantage = false\n @player1.win = false\n @player1.games_won = 0\n @player1.sets_won = 0\n\n @player2.points = 0\n @player2.deuce = false\n @player2.advantage = false\n @player2.win = fa... | [
"0.60871804",
"0.60478675",
"0.5969482",
"0.5922797",
"0.5804111",
"0.5791053",
"0.57559395",
"0.5710196",
"0.5699001",
"0.5692177",
"0.5691602",
"0.5637059",
"0.5576179",
"0.55706227",
"0.5549388",
"0.5537225",
"0.552475",
"0.55098665",
"0.5507031",
"0.5503575",
"0.5473088",... | 0.54156464 | 25 |
Setup all boards with ships for all users | def board_setup
puts ""
puts "**********************".green
puts "1st step - Board setup".green
puts "**********************".green
puts ""
player1_title = @best_of3 ? "#{@board_player1.player.wins} wins" : ""
puts "Player #{@board_player1.player.name} #{player1_title}".blue
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_board\n # Create game objects.\n create_objects\n\n # Print the start game string.\n puts start_game\n # For each ship ask for user input and place them once the given coordinates and placement is valid.\n @user_ships.each do |ship|\n print user_placement_selection(ship)\n use... | [
"0.6881231",
"0.6779627",
"0.6552814",
"0.6458086",
"0.64275604",
"0.6347926",
"0.63425803",
"0.6330182",
"0.6327522",
"0.62976193",
"0.62617415",
"0.6233333",
"0.6210991",
"0.616199",
"0.6144731",
"0.61087257",
"0.60356665",
"0.6006236",
"0.59824425",
"0.59271604",
"0.592048... | 0.52107507 | 70 |
User set shoot in his turn, if that shoot make user wins and best_of3 mode players they will play another match until someone wins at least 2 | def gameplay_setup
game_status = :new_game
loop do
print_player_turn(@board_turn.player.name)
print "Introduce your shoot - x, y: ".blue
shoot = $stdin.gets.chomp.split(",").map(&:to_i)
game_shoot = set_shoot(shoot)
case game_shoot
when :finished, :finished... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_won?\n if @sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n if @opponent.sets_won == 3\n @match_won = 1\n @sets_won = 0\n @opponent.sets_won = 0\n end\n end",
"def easy_win(player)\n win if player.point... | [
"0.7016143",
"0.7008363",
"0.70034814",
"0.66983503",
"0.6572449",
"0.65342355",
"0.652236",
"0.65077966",
"0.6473367",
"0.6465329",
"0.64579886",
"0.6437828",
"0.6431436",
"0.6420095",
"0.6403615",
"0.6396681",
"0.6382485",
"0.63797474",
"0.63781595",
"0.6369582",
"0.6357856... | 0.6052155 | 74 |
Print header for a new game | def print_header
print "\e[H\e[2J"
puts "*************************".green
puts "2nd step - Gameplay setup".green
puts "*************************".green
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_header\n\tputs \"The students of Villians Academy\"\n\tputs \"-------------\"\nend",
"def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend",
"def print_header\n\tputs \"The students of my cohort at Makers Academy\"\n\tputs \"-------------------------... | [
"0.7937776",
"0.79272944",
"0.7813171",
"0.7800578",
"0.7792766",
"0.7769068",
"0.7766217",
"0.7761845",
"0.77343065",
"0.77212334",
"0.77183855",
"0.76961356",
"0.76864254",
"0.7685833",
"0.7685833",
"0.7685833",
"0.7679499",
"0.7679499",
"0.76732033",
"0.76434267",
"0.76424... | 0.8337364 | 0 |
Print header for the player turn | def print_player_turn(name)
sleep 1
print_header
puts ""
puts "#{name} turn #{@best_of3 ? "#{@board_turn.player.wins} wins" : ''}".cyan
puts "*************************".cyan
puts ""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_header\n print \"\\e[H\\e[2J\"\n puts \"*************************\".green\n puts \"2nd step - Gameplay setup\".green\n puts \"*************************\".green\n end",
"def print_header\n\tputs \"The students of my cohort at Makers Academy\"\n\tputs \"-------------------------\"\... | [
"0.8183606",
"0.7784836",
"0.7776099",
"0.77384555",
"0.77079606",
"0.76157826",
"0.7550245",
"0.7528642",
"0.75227845",
"0.7509347",
"0.7492753",
"0.7483164",
"0.74802864",
"0.747556",
"0.74564475",
"0.74564475",
"0.7446268",
"0.7445652",
"0.7445652",
"0.7445652",
"0.7442601... | 0.74529517 | 16 |
Give the turn to the opposing player | def next_turn
@player_turn = @players.reject { |player| player.id == @board_turn.player.id }.first
@board_turn = @boards.select { |board| board.player.id == @player_turn.id }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end",
"def switch_players\n @player1_turn = !@player1_turn\n end",
"def chang... | [
"0.77097887",
"0.7633102",
"0.7570855",
"0.7564209",
"0.75453174",
"0.75262827",
"0.75022304",
"0.7469369",
"0.7421913",
"0.7391874",
"0.738887",
"0.73587525",
"0.7254211",
"0.7251102",
"0.7251102",
"0.7231437",
"0.7218507",
"0.7217717",
"0.7216226",
"0.72040695",
"0.71917826... | 0.0 | -1 |
Ask if players want to play a new match | def ask_new_game
print "Would you like to start a new game?: [y/n]".blue
new_game = $stdin.gets.chomp
if new_game.downcase == "y"
print "\e[H\e[2J"
:new_game
else
puts "Bye!!!".green
:finished
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_match\r\n reset_scores\r\n\r\n loop do\r\n display_scores\r\n choose_turn_order\r\n play_round\r\n break if someone_won_match?\r\n end\r\n\r\n display_match_result\r\n end",
"def gui_new_match(players)\n end",
"def play_match()\n\t\t#start a loop \n\t\tgame_end = fals... | [
"0.7210158",
"0.71209365",
"0.70614755",
"0.70149505",
"0.6741907",
"0.6590405",
"0.6527483",
"0.6511525",
"0.6507021",
"0.6479476",
"0.64662606",
"0.646278",
"0.64546597",
"0.642649",
"0.6416393",
"0.64120996",
"0.63998896",
"0.6387112",
"0.6382998",
"0.6343085",
"0.6341175"... | 0.59925264 | 65 |
Check if some player win the match or best_of3 rounds | def verify_winner(opponent_board)
if opponent_board.ships.all?(&:sunk?)
@board_turn.player.set_win
if @best_of3 && @boards.map(&:player).any? { |player| player.wins > 1 }
puts "*******************************************************".green
puts "Player #{@board_turn.player.nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end",
"def check_win(player)\n winning_combos.each do |wi... | [
"0.77848697",
"0.7634241",
"0.7599701",
"0.74364674",
"0.74109423",
"0.7314343",
"0.7224554",
"0.7224051",
"0.71869874",
"0.7165276",
"0.7146245",
"0.71315664",
"0.7105512",
"0.70888513",
"0.7078452",
"0.7066933",
"0.70543915",
"0.7042711",
"0.6995673",
"0.6988713",
"0.698036... | 0.74864966 | 3 |
Hit the opponent ship on the cell request by current player and if ship has all cells hitted it will be sunk | def hit_ship(opponent_board, opponent_cell)
opponent_cell.hitted!
opponent_ship = opponent_board.get_ship_by_cell(opponent_cell)
opponent_ship.check_sunk
puts "Ship #{opponent_ship.name} has been sunked".yellow if opponent_ship.sunk? && @random
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ship(x,y)\n\n # If player guess is not already a hit and the position is occupied by the ship update the hit value from '0' to '1'\n if grid[x][y] != 'X'\n s = ships.detect { |s| s.name == grid[x][y] }\n puts 'Ship hit!!!'\n s.position.each do ... | [
"0.74189866",
"0.6792554",
"0.67292273",
"0.66333395",
"0.6627661",
"0.65630835",
"0.65542954",
"0.6513403",
"0.6474965",
"0.6414328",
"0.6329268",
"0.62967056",
"0.6249627",
"0.62471163",
"0.6229224",
"0.6180147",
"0.61768925",
"0.6169489",
"0.6156627",
"0.61062557",
"0.6092... | 0.83406705 | 0 |
Show hint cell if player miss 3 hits in a row | def show_hint(hint)
print "Hint for you, try with (#{hint.coord_x}, #{hint.coord_y}), [Enter to continue]".cyan
$stdin.gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def give_hint()\n \n sleep(2)\n puts \"hint...\"\n sleep(1)\n\n correct_colors = []\n correct_place = 0\n\n #count matching colors\n $computer[\"code\"].map { |value| if $player[\"code\"].include?(value)\n if !correct_colors.include?(value)\n correct_colors.p... | [
"0.58133686",
"0.56934786",
"0.56040996",
"0.5553264",
"0.55395484",
"0.5474812",
"0.54576164",
"0.53981495",
"0.53801703",
"0.53501874",
"0.53020704",
"0.52893174",
"0.52859807",
"0.5284439",
"0.527519",
"0.5263402",
"0.5241167",
"0.5234728",
"0.5215339",
"0.52149785",
"0.51... | 0.5119372 | 34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.