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 |
|---|---|---|---|---|---|---|
Gets a new token which can be used with all nonget requests. | def get_token
get(TOKEN_URL)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_token\n if @token && @valid_until && @valid_until > Time.now + 10\n @token\n else\n renew_token\n end\n end",
"def retrieve_token!\n body = request_token\n # Refresh our token early so that it won't expire while a request is in-flight. We expect 15m\n # expi... | [
"0.73652244",
"0.7084024",
"0.7045007",
"0.6967743",
"0.693791",
"0.6911041",
"0.68612254",
"0.6853653",
"0.68447465",
"0.678606",
"0.67324704",
"0.6728006",
"0.66732067",
"0.66624445",
"0.6629212",
"0.6623875",
"0.661605",
"0.66055715",
"0.65699345",
"0.65484333",
"0.6546965... | 0.7010382 | 3 |
atom parser doesn't bring in google's custom atom fields this method grabs the continuation so that i can instantly grab the next set of items CO3urYix4Y8C | def extract_continuation(body)
matches = body.match(/<gr:continuation>(.*)<\/gr:continuation>/)
matches.nil? ? nil : matches[0].gsub(/<\/?gr:continuation>/, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atom\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n return_value = AtomReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __CHUNK9__ = nil\n char_l... | [
"0.5789002",
"0.563046",
"0.5534069",
"0.5467363",
"0.53857195",
"0.53067064",
"0.5294806",
"0.5236822",
"0.5203074",
"0.51871663",
"0.51871663",
"0.5186845",
"0.5105037",
"0.5089447",
"0.5011211",
"0.5005247",
"0.49985915",
"0.4983909",
"0.49815953",
"0.49815953",
"0.4953262... | 0.56158304 | 2 |
Add the other statuses as well | def total_price
worker_profile.price_per_hour * hours.to_i + material_cost
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def statuses; end",
"def extend_status(_status)\n end",
"def set_common_data\n @statuses = Status.all\n end",
"def add_status(status)\n items = @items[status]\n @dialog.logMessage(\"Adding #{items.size} items with status: #{status}\")\n items\n end",
"def add_status( thing, s... | [
"0.70385915",
"0.6937979",
"0.65846485",
"0.65839356",
"0.65256006",
"0.6476959",
"0.63691956",
"0.62403905",
"0.6202731",
"0.618113",
"0.618113",
"0.61045456",
"0.6084048",
"0.60767525",
"0.6069543",
"0.6069543",
"0.6068796",
"0.6041721",
"0.59384006",
"0.5925387",
"0.591690... | 0.0 | -1 |
return the rmagick instance | def rmagick_img
return @rmagick_img unless @rmagick_img.blank?
if self.class.st_config[:blob].present?
@rmagick_img ||= Magick::ImageList.new.from_blob(
self.send(self.class.st_config[:blob])
).first
elsif self.class.st_config[:file].present?
@rmagick_img ||= Magick::... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n unless @image.kind_of? Magick::Image\n raise TypeError, \"images must be set and be an instance of RMagick::Image\"\n end\n \n draw\n @image #returns image with grid drawn on top\n end",
"def img\n Magick::Image::read(self.image).first\n end",
"def imagemagick?; end",
"def ... | [
"0.64236414",
"0.63355774",
"0.6115451",
"0.5886867",
"0.5848267",
"0.58099043",
"0.5695926",
"0.55382246",
"0.55095035",
"0.54670537",
"0.53907704",
"0.53873366",
"0.53649306",
"0.53527576",
"0.5342302",
"0.5339875",
"0.53175604",
"0.52412033",
"0.5221309",
"0.5212468",
"0.5... | 0.67042136 | 0 |
returns the specific formatarray for the key f e.g. ["100x200", :cut] The config value for formats can be a hash or sth that responds to +call+ e.g. a lambda. | def st_format(f)
if self.class.st_config[:formats].respond_to?(:call)
self.class.st_config[:formats].call(f.to_sym)
else
if self.class.st_config[:formats][f].is_a?(Symbol)
self.send(self.class.st_config[:formats][f])
else
self.class.st_config[:formats][f]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fmt(key)\n case key\n when \"PNG\" , \"png\" then 0\n when \"BMP\" , \"bmp\" then 1\n when \"TIFF\" , \"tiff\" then 2\n when \"PBM\" , \"pbm\" then 3\n when \"SVG\" , \"svg\" then 4\n when \"JSON\" , \"json\" then 5\n when \"DIGIT\", \"digit\" then 6\n when \... | [
"0.6150604",
"0.5991118",
"0.5912638",
"0.5759762",
"0.56921786",
"0.56131727",
"0.5606528",
"0.555431",
"0.5550844",
"0.5522504",
"0.5521644",
"0.55065674",
"0.5469601",
"0.5421815",
"0.54028034",
"0.54028034",
"0.53834194",
"0.53629845",
"0.5335561",
"0.52980155",
"0.529759... | 0.5750714 | 4 |
returns the file extension for the current image | def st_extension
return "jpg" unless self.class.st_config[:extension].present?
if self.class.st_config[:extension].is_a?(String)
self.class.st_config[:extension]
else
self.send(self.class.st_config[:extension])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extname\n File.extname(image_src).delete('.') unless image_src.nil?\n end",
"def file_extension\n filename.split(\".\").last\n end",
"def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end",
"def... | [
"0.82310915",
"0.80769455",
"0.8037124",
"0.8024101",
"0.80210006",
"0.80096835",
"0.7999097",
"0.7999097",
"0.7999097",
"0.79982394",
"0.7966847",
"0.79528725",
"0.78495574",
"0.7849188",
"0.782664",
"0.780921",
"0.78063065",
"0.7801075",
"0.7801075",
"0.7801075",
"0.7773353... | 0.7702179 | 25 |
returns the gravity for the current resizing process and provides some shrotcuts | def gravity
@gravity ||= {
:new => Magick::NorthWestGravity,
:n => Magick::NorthGravity,
:ne => Magick::NorthEastGravity,
:w => Magick::WestGravity,
:c => Magick::CenterGravity,
:e => Magick::EastGravity,
:sw => Magick::SouthWestGravity,
:s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gravity\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:gravity].z\n attr = Sketchup.active_model.get_attribute('MSPhysics', 'Gravity', default)\n return attr.to_f\n end",
"def gravity\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:gravity].z\n attr = Sket... | [
"0.63455075",
"0.63157403",
"0.6310049",
"0.6298049",
"0.6269295",
"0.622519",
"0.60604674",
"0.5852483",
"0.5628355",
"0.5544231",
"0.5534999",
"0.5514756",
"0.54735965",
"0.5445199",
"0.5442052",
"0.54291004",
"0.53682554",
"0.5322438",
"0.53031313",
"0.52746934",
"0.525174... | 0.67049056 | 0 |
Does a thumb already exist? | def thumb_exists_for?(format)
File.exists?(self.thumb_path_for(format))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_thumbnail?\n File.exists? path.gsub(/(.+)\\/(.+)/, '\\1/thumbs/\\2')\n end",
"def exists?\n thumbnail_method.present? ||\n (thumbnail_field && thumbnail_value_from_document.present?) ||\n default_thumbnail.present?\n end",
"def exists?\n thumbnail_method.present? ||\n... | [
"0.77330506",
"0.7369543",
"0.7369543",
"0.7206688",
"0.7147145",
"0.6929984",
"0.6897941",
"0.6744601",
"0.6659804",
"0.64177066",
"0.6209174",
"0.61788285",
"0.6128025",
"0.6109757",
"0.6105284",
"0.60912275",
"0.60742974",
"0.60705197",
"0.6051529",
"0.6051529",
"0.6021508... | 0.7449051 | 1 |
returns the cachepath for a certain image | def thumb_path_for(format)
"#{Rails.root}/public#{thumb_url_for(format)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_image_cache_path(options={})\n image_type = options[:image_type] = options[:image_type].to_s\n if image_type.blank? or not IMAGE_TYPES.include?(image_type)\n image_type = options[:image_type] = IMAGE_TYPES.first\n end\n size = options[:size] = options[:size].to_s\n if size.blank? or not... | [
"0.729689",
"0.7170849",
"0.71044934",
"0.708241",
"0.7039097",
"0.69418865",
"0.69174683",
"0.68429154",
"0.6832427",
"0.68228734",
"0.67851037",
"0.67851037",
"0.6719671",
"0.6718485",
"0.66851354",
"0.668384",
"0.6674987",
"0.6647155",
"0.6639038",
"0.6634774",
"0.66273594... | 0.0 | -1 |
return the http url to the resized image this one has to be route from which the image is availabe otherwise the caching benefit is gone | def thumb_url_for(format)
if Smartthumbs::Config.get_option(:assume_klass).to_s == self.class.to_s
"/th/#{format.to_s}/#{self.id}.#{st_extension}"
else
"/th/#{self.class.to_s.underscore.parameterize}/#{format.to_s}/#{self.id}.#{st_extension}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def small_image_url\n self.small_image.convert('-resize 50%').url\n end",
"def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end",
"def image_url\n is_processed ?\n FileSystem.url(image_path) : \n orig_image_url\n end",
"def thumbnail_url\n i... | [
"0.75779027",
"0.7281455",
"0.7281455",
"0.7211794",
"0.7136976",
"0.7063854",
"0.7047464",
"0.70332265",
"0.701858",
"0.6928551",
"0.6903404",
"0.6900055",
"0.6891922",
"0.68855786",
"0.68570596",
"0.6792794",
"0.67686284",
"0.6740696",
"0.6737008",
"0.6716755",
"0.669047",
... | 0.0 | -1 |
resizes the image in a manner that both edges fit the needs. usually one of the edges is smaller than the needs afterwards | def fit
if self.needs_to_be_resized?
rmagick_img.resize_to_fit!(@x, @y)
else
rmagick_img.resize_to_fit(@x, @y)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize\n @image.resize \"#{@placement[:a]}x#{OUTER}\\!\"\n end",
"def scale(width: @image.width, height: @image.height,\n algorithm: 'bilineal') # bilinear, nearest_neighbor\n if algorithm == 'nearest_neighbor'\n Image.new(@image.resample_nearest_neighbor(width, height), path)\n ... | [
"0.6509412",
"0.63239235",
"0.62586784",
"0.62129134",
"0.61509526",
"0.6141109",
"0.61341184",
"0.61341184",
"0.6127751",
"0.61206144",
"0.61028546",
"0.60956657",
"0.6087964",
"0.603646",
"0.6029456",
"0.6026125",
"0.6022609",
"0.60060835",
"0.60029656",
"0.6000927",
"0.599... | 0.648341 | 1 |
the same as +fit+, except the fact that the image get's filled up with a border | def fill
fit
rounding_error
border_x = (@x - rmagick_img.columns)/2
border_y = (@y - rmagick_img.rows)/2
rmagick_img.border!(border_x,border_y,"white")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit\n if self.needs_to_be_resized?\n rmagick_img.resize_to_fit!(@x, @y)\n else\n rmagick_img.resize_to_fit(@x, @y)\n end\n end",
"def fit_image(*args)\n @p.fit_image(self, *args)\n end",
"def scale_to_fit(width, height)\n @image = @image.scale_to_fit(width, he... | [
"0.6661806",
"0.6411662",
"0.6229371",
"0.6182858",
"0.6155147",
"0.6082244",
"0.59963",
"0.5984282",
"0.5956749",
"0.58157015",
"0.5807456",
"0.57971483",
"0.5791272",
"0.5789423",
"0.5785869",
"0.56850713",
"0.56500256",
"0.5646113",
"0.5644024",
"0.56424385",
"0.5625771",
... | 0.78001237 | 0 |
resizes and cuts the image, so it that it fits exactly | def cut
rmagick_img.crop_resized!(@x, @y, gravity)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_and_crop(size)\n manipulate! do |image|\n Rails.logger.error '----------- image:'\n Rails.logger.error image.inspect\n\n if image[:width] < image[:height]\n remove = ((image[:height] - image[:width]) / 2).round\n image.shave(\"0x#{remove}\")\n elsif image[:width] > i... | [
"0.72349024",
"0.71662605",
"0.70160437",
"0.68665594",
"0.6795778",
"0.6698092",
"0.66710144",
"0.66680133",
"0.66680133",
"0.6620055",
"0.65897197",
"0.6584398",
"0.65547127",
"0.65434897",
"0.65288395",
"0.64779955",
"0.64400434",
"0.6406173",
"0.63588864",
"0.63558704",
"... | 0.7757298 | 0 |
if there's just a small difference between the needs and the result, we'll make it fit exaclty | def rounding_error
dif = (@y-rmagick_img.rows) + (@x-rmagick_img.columns)
if dif > 0 && dif < 10 then
rmagick_img.resize!(@x, @y)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_need_bits; end",
"def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n # defining a method that takes 2 arguments and compares them to an existing hash library\n# error counter = 3\n \n unless library.has_key?(item_to_make)\n rai... | [
"0.54866576",
"0.5423045",
"0.53560615",
"0.5344297",
"0.5288699",
"0.52845263",
"0.527912",
"0.52760273",
"0.52584046",
"0.5233839",
"0.52265006",
"0.5221335",
"0.52184886",
"0.5184608",
"0.5179455",
"0.5174839",
"0.51659936",
"0.51650006",
"0.51593614",
"0.51593614",
"0.515... | 0.0 | -1 |
Default the robot params | def initialize(params = {})
puts 'Building Robot with Params:'
pp params
self.my_set = params.fetch(:my_set, nil)
self.my_color = params.fetch(:my_color, nil)
self.my_background_set = params.fetch(:my_background_set, nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_params\n self.difficulty = 0\n self.result = \"active\"\n self.board_size = 3\n end",
"def set_default_params(params)\n\t\t\tparams[:authorization_token] = @token\n\t\t\tparams[:account] = params[:account] || @account\n\t\t\t\n\t\t\tif params[:site] == \"ignore\"\n\t\t\t\tparams.delete(... | [
"0.7289892",
"0.7245177",
"0.71313995",
"0.68199044",
"0.68133086",
"0.6795421",
"0.6656291",
"0.66435987",
"0.66407835",
"0.6621119",
"0.66134864",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179",
"0.6576179... | 0.62787485 | 42 |
todo: replace by app configuration & remove | def copy_stage_config
run "if [ -f #{release_path}/config/stage_configs/#{stage}.rb ]; then cp #{release_path}/config/stage_configs/#{stage}.rb #{release_path}/config/environments/stage.rb; fi"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"def config; end",
"... | [
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.6858582",
"0.66362464",
"0.6546913",
"0.6546913",
... | 0.0 | -1 |
todo: one should be enough | def restart_apache
FileUtils.touch "#{config.get(:current_path)}/tmp/restart.txt"
monit_command "restart apache2"
end | {
"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 same; end",
"def first; end",
"def first; end",
"def offences_by; end",
"def suivre; end",
"def anchored; end",
"def terpene; end",
"def formation... | [
"0.7056462",
"0.65461195",
"0.6374681",
"0.6374681",
"0.6374681",
"0.6374681",
"0.6228677",
"0.6137774",
"0.6124189",
"0.6124189",
"0.6047092",
"0.6002023",
"0.59902465",
"0.5939543",
"0.5928593",
"0.58256274",
"0.5791768",
"0.57837796",
"0.5716254",
"0.5694258",
"0.5693156",... | 0.0 | -1 |
In Rails 4.1 and below | def verified_request?
super || form_authenticity_token == request.headers['X-XSRF-TOKEN']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def model_class; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def version_helper; end",
"def rails_3\n defined?(ActiveRecord::VERSION) && ActiveRecord::VERSION::MAJOR >= 3\nend",
"def active_record_at_least_4?\n defined?(::ActiveRecord)... | [
"0.6457498",
"0.5645387",
"0.5621639",
"0.5621639",
"0.5621639",
"0.5621639",
"0.5621126",
"0.5602233",
"0.54953074",
"0.54953074",
"0.54606855",
"0.5438581",
"0.54269934",
"0.5403862",
"0.5398208",
"0.5391212",
"0.5391212",
"0.53587",
"0.5344839",
"0.5344092",
"0.5325085",
... | 0.0 | -1 |
Example For inputArray = [1, 1, 1], the output should be arrayChange(inputArray) = 3. | def arrayChange(a)
total = 0
a.each_with_index do |v, i|
next if i == 0
if(v <= a [i-1])
total += (a[i-1] + 1) - a[i]
a[i] = a[i-1] + 1
end
end
total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_to_no_change(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index])\n index += 1 \n end\n return array\nend",
"def map_to_no_change(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array <... | [
"0.6545813",
"0.6542512",
"0.6265896",
"0.621563",
"0.61783385",
"0.613437",
"0.60775334",
"0.6074201",
"0.6023001",
"0.5997963",
"0.5997093",
"0.5984444",
"0.59559256",
"0.59527624",
"0.5935264",
"0.59338754",
"0.5909447",
"0.5909447",
"0.5909447",
"0.5909447",
"0.5909447",
... | 0.60528415 | 8 |
Public methods Constructor. Takes the socket port as parameter. | def initialize( port )
# Setup the server:
@server = TCPServer.new port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize( port=DEFAULT_PORT )\n\t\tcheck_port( port )\n\t\t@socket = CZTop::Socket::REQ.new\n\t\t@socket.options.linger = 0\n\t\t@socket.connect( port.to_s )\n\tend",
"def initialize(port=9999)\n\t\t@port = port\n\t\t@server = TCPServer.new(@port)\n\tend",
"def initialize(address, port)\n self.addre... | [
"0.8433799",
"0.8153221",
"0.8083075",
"0.8064848",
"0.7962786",
"0.7895813",
"0.7894992",
"0.7849681",
"0.7768272",
"0.7766824",
"0.7726934",
"0.77030176",
"0.7692975",
"0.7692975",
"0.76466614",
"0.7617867",
"0.7571437",
"0.7556758",
"0.75093645",
"0.74978864",
"0.7473877",... | 0.83478725 | 1 |
Starts listening for connections on the websocket, handles handshake and reads data. Takes a block to handle the received data. | def accept( &block )
# Start by accepting a connection:
@connection = @server.accept
# The first request ever should be the handshake:
http_request = ""
while line = @connection.gets and line != "\r\n" do
http_request += line
end
# If it contains a secret key, use it to send the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen(&block)\n block ||= self.class.for_client\n Supernova.logger.info { \"Server started.\" }\n while run\n next unless IO.select [server], nil, nil, 1\n thread_list << Thread.start(server.accept) do |client|\n Supernova.logger.info { \"Client accepted.\" }\... | [
"0.67477804",
"0.66621596",
"0.64098424",
"0.63792646",
"0.6296401",
"0.6264366",
"0.61940473",
"0.61780536",
"0.61129993",
"0.60747904",
"0.6063599",
"0.6061458",
"0.60522646",
"0.6011901",
"0.599372",
"0.595204",
"0.59332615",
"0.593317",
"0.59143686",
"0.59076256",
"0.5899... | 0.7962569 | 0 |
Sends data via the websocket. | def send( data )
# Final text data header:
header = 0b10000001
# Payload size to use (data will always be unmasked):
size = "#{data}".size
# Standard payload:
if size < 126 then
@connection.write [ header, size, "#{data}" ].pack "C2A#{size}"
# 16-bit extended payload:
elsif size... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send(data)\r\n @connected.callback { send_data data }\r\n end",
"def send(data)\r\n @connected.callback { send_data data }\r\n end",
"def send(data)\n @conn.send serialize data\n end",
"def send_data(raw_data)\n encoded_message = encode(raw_data)\n Rails.logger.d... | [
"0.76258534",
"0.76258534",
"0.76182777",
"0.751787",
"0.75025684",
"0.7400135",
"0.7300967",
"0.7248343",
"0.7233696",
"0.72254723",
"0.720092",
"0.7180447",
"0.7163628",
"0.71005917",
"0.7092098",
"0.70466274",
"0.70141673",
"0.7011281",
"0.69864905",
"0.6953805",
"0.692566... | 0.6376274 | 39 |
Gets a bytes as a string, always having 8 characters: | def get_byte
byte = @connection.getbyte.to_s 2
byte = "0" * (8 - byte.length) + byte
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def to_str\n bytes\n end",
"def get_byte_str(byt, byte_size=nil)\n byt_str = \"\"\n\n # case byt.class.name\n # when \"Fixnum\"\n\n # byt_str = byt.to_s(16)\n # byte_size = 1 if !byte_size && byt <= 0xf\n... | [
"0.7751136",
"0.7751136",
"0.7751136",
"0.69871664",
"0.6727047",
"0.6725315",
"0.6659424",
"0.66078645",
"0.66078645",
"0.6508652",
"0.6485655",
"0.64639145",
"0.64589036",
"0.6382654",
"0.635094",
"0.63331425",
"0.6326026",
"0.63243914",
"0.6323791",
"0.63149744",
"0.629045... | 0.72187185 | 3 |
Reads data from the websocket. Returns the type and the data read: | def read( can_repeat )
# Read the first byte containing final and opcode flags:
byte = get_byte
final = byte[ 0 ].to_i
opcode = byte[ 4..7 ].to_i 2
# Read the second byte containing the masked flag and payload size:
byte = get_byte
masked = byte[ 0 ].to_i
payload_size = byte[ 1..7 ].to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read()\n data = @sock.recv(8192)\n return data\n end",
"def read\n @socket.gets\n end",
"def read\n @socket.read(1)\n end",
"def read\n data = @handle.availableData\n return data\n end",
"def read()\r\n return @socket.read(1)\r\n end",
"def read_p... | [
"0.70921016",
"0.6993093",
"0.69262373",
"0.69075847",
"0.68870926",
"0.6723385",
"0.66036284",
"0.65155584",
"0.64186084",
"0.6385766",
"0.63692635",
"0.6348241",
"0.6313913",
"0.6247753",
"0.6185118",
"0.61277866",
"0.61151695",
"0.60972804",
"0.6097273",
"0.6077489",
"0.60... | 0.55138934 | 88 |
Sends a pong message. | def pong
to_send = [ 0b10001010, 0, "" ]
@connection.write to_send.pack "C2A0"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pong(msg)\n raise ArgumentError, 'message not a PING' if msg.command != 'PING'\n send_msg(\"PONG #{msg.params.join(' ')}\")\n end",
"def pong(s, m)\n @socket << \"PONG #{s} #{m}\"\n end",
"def pong_everyone\n #log \"trying to pong\"\n if @sockets.length > 0 && !self.stopped?\n ... | [
"0.779494",
"0.76054305",
"0.7320528",
"0.7251865",
"0.724491",
"0.71456903",
"0.70765173",
"0.67642623",
"0.66111004",
"0.65561557",
"0.65547985",
"0.64703906",
"0.6241228",
"0.6177319",
"0.6099811",
"0.60893935",
"0.6070635",
"0.6045208",
"0.60289705",
"0.5982932",
"0.59358... | 0.8141279 | 0 |
GET /aspcategories GET /aspcategories.json | def index
@aspcategories = Aspcategory.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.7674496",
"0.7483863",
"0.7346609",
"0.7193755",
"0.7185479",
"0.71293",
"0.71124905",
"0.6992513",
"0.6935218",
"0.69168204",
"0.683715",
"0.683442",
"0.68012",
"0.679574",
"0.6794922",
"0.6794922",
"0.6781398",
"0.6747948",
"0.6733882",
"0.6705019",
"0.6689104",
"0.666... | 0.7158211 | 5 |
GET /aspcategories/1 GET /aspcategories/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_ba... | [
"0.75793713",
"0.743825",
"0.7318282",
"0.7212079",
"0.7167239",
"0.71657664",
"0.71572065",
"0.7008358",
"0.70008826",
"0.6997334",
"0.6975594",
"0.69635326",
"0.69145507",
"0.691429",
"0.69100404",
"0.6909401",
"0.6909401",
"0.68720233",
"0.6832999",
"0.67846674",
"0.675580... | 0.0 | -1 |
POST /aspcategories POST /aspcategories.json | def create
@aspcategory = Aspcategory.new(aspcategory_params)
respond_to do |format|
if @aspcategory.save
format.html { redirect_to aspcategories_path, notice: 'Aspcategory was successfully created.' }
format.json { render :show, status: :created, location: @aspcategory }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def get_categories\r\n categ... | [
"0.6817249",
"0.6609545",
"0.6445214",
"0.63571423",
"0.62594503",
"0.6209892",
"0.6164852",
"0.6130375",
"0.60714936",
"0.60494256",
"0.6044756",
"0.6031183",
"0.5965784",
"0.5965422",
"0.5901004",
"0.5894797",
"0.58794546",
"0.5859838",
"0.5828811",
"0.58144766",
"0.5791229... | 0.6791593 | 1 |
PATCH/PUT /aspcategories/1 PATCH/PUT /aspcategories/1.json | def update
respond_to do |format|
if @aspcategory.update(aspcategory_params)
format.html { redirect_to @aspcategory, notice: 'Aspcategory was successfully updated.' }
format.json { render :show, status: :ok, location: @aspcategory }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n json_update(category,category_params, Category)\n end",
"def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci... | [
"0.7290131",
"0.7083007",
"0.6857403",
"0.64219517",
"0.64030915",
"0.6368919",
"0.6312456",
"0.6306869",
"0.6305974",
"0.6295368",
"0.6277525",
"0.6203516",
"0.62006426",
"0.6175206",
"0.6149074",
"0.6149071",
"0.613707",
"0.6127921",
"0.6127819",
"0.60935146",
"0.6083338",
... | 0.67597634 | 3 |
DELETE /aspcategories/1 DELETE /aspcategories/1.json | def destroy
@aspcategory.destroy
respond_to do |format|
format.html { redirect_to aspcategories_url, notice: 'Aspcategory was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end",
"def deleteCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n ... | [
"0.7374116",
"0.7329225",
"0.729894",
"0.72745425",
"0.72721696",
"0.72612536",
"0.720799",
"0.72064483",
"0.7176982",
"0.7138286",
"0.7123636",
"0.71066254",
"0.70902103",
"0.70685434",
"0.70604104",
"0.7051416",
"0.7048261",
"0.70337284",
"0.70277345",
"0.70253235",
"0.7012... | 0.73991597 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_aspcategory
@aspcategory = Aspcategory.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 aspcategory_params
params.require(:aspcategory).permit(:nombre)
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 |
not really parfait test, but related and no other place currently | def test_reg_index
message_ind = Register.resolve_index( :message , :receiver )
assert_equal 3 , message_ind
@mess.receiver = 55
assert_equal 55 , @mess.get_internal_word(message_ind)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def spec; end",
"def spec; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def used?; end",
"def internship_passed; end",
"def self_test; end",
"def self_test; end",
"def setup; end",
"def setup; end",
"def setup... | [
"0.70189077",
"0.6749333",
"0.6749333",
"0.66379327",
"0.6466664",
"0.6466664",
"0.6466664",
"0.6466664",
"0.64127606",
"0.62997526",
"0.62827873",
"0.62827873",
"0.62825626",
"0.62825626",
"0.62825626",
"0.62825626",
"0.62825626",
"0.62825626",
"0.62825626",
"0.62825626",
"0... | 0.0 | -1 |
Write a method that returns a list of all substrings of a string that start at the beginning of the original string. The return value should be arranged in order from shortest to longest substring. Examples: | def substrings_at_start(string)
sum_total = []
arr = string.split("")
1.upto(arr.size) do |count|
sum_total << arr.slice(0, count).reduce(:+)
end
sum_total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def substrings_at_start(string)\n string.size <= 1 ? [string] : [substrings_at_start(string.chop), string].flatten\nend",
"def substrings_at_start(string)\n result = []\n 1.upto(string.size) do |substring|\n result << string.slice(0, substring)\n end\n result\nend",
"def substrings_at_start(string)\n ... | [
"0.82844",
"0.80873215",
"0.80873215",
"0.80714744",
"0.8069904",
"0.8069904",
"0.8069762",
"0.80472094",
"0.80307037",
"0.8027903",
"0.8007842",
"0.8007842",
"0.7991933",
"0.7991933",
"0.79797363",
"0.7979658",
"0.7979389",
"0.7971153",
"0.7958755",
"0.79483646",
"0.79464567... | 0.0 | -1 |
GET /watched_posts GET /watched_posts.json | def index
@watched_posts = WatchedPost.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def set_watched_post\n @watched_post = WatchedPost.find(params[:id])\n end",
... | [
"0.66477025",
"0.63622254",
"0.6104307",
"0.6026499",
"0.6019396",
"0.5987823",
"0.58932173",
"0.58902293",
"0.58869034",
"0.58794796",
"0.5870027",
"0.5867759",
"0.5867434",
"0.5851734",
"0.58494186",
"0.58169776",
"0.5812532",
"0.5809515",
"0.58074486",
"0.58074486",
"0.580... | 0.7799221 | 0 |
GET /watched_posts/1 GET /watched_posts/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @watched_posts = WatchedPost.all\n end",
"def set_watched_post\n @watched_post = WatchedPost.find(params[:id])\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n ... | [
"0.77417207",
"0.67772573",
"0.66721445",
"0.62372965",
"0.61708266",
"0.6041184",
"0.6041017",
"0.59800756",
"0.59382766",
"0.59264535",
"0.5914142",
"0.59129995",
"0.58939004",
"0.58614904",
"0.585691",
"0.58559245",
"0.5847403",
"0.58427644",
"0.5841841",
"0.5819511",
"0.5... | 0.0 | -1 |
POST /watched_posts POST /watched_posts.json | def create
if WatchedPost.where(user_id: params[:watched_post][:user_id], post_id: params[:watched_post][:post_id]).empty?
@watched_post = WatchedPost.new(watched_post_params)
respond_to do |format|
if @watched_post.save
format.html { redirect_to :back, notice: 'Watched post was succ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @watched_posts = WatchedPost.all\n end",
"def watched_post_params\n params.require(:watched_post).permit(:user_id, :post_id)\n end",
"def set_watched_post\n @watched_post = WatchedPost.find(params[:id])\n end",
"def push_to_web_sockets\n if created_at_changed?\n Action... | [
"0.70595074",
"0.6650826",
"0.66308236",
"0.6402545",
"0.5855627",
"0.58330834",
"0.56717765",
"0.56250983",
"0.55693644",
"0.5518219",
"0.55081666",
"0.5489872",
"0.5459479",
"0.5403659",
"0.5401484",
"0.5401484",
"0.53935325",
"0.53910094",
"0.5388474",
"0.5329864",
"0.5318... | 0.7226617 | 0 |
PATCH/PUT /watched_posts/1 PATCH/PUT /watched_posts/1.json | def update
respond_to do |format|
if @watched_post.update(watched_post_params)
format.html { redirect_to @watched_post, notice: 'Watched post was successfully updated.' }
format.json { render :show, status: :ok, location: @watched_post }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_watched_post\n @watched_post = WatchedPost.find(params[:id])\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n post = current_user.posts.find_by_uuid(params[:id])\n return render_item_not_found('Post') unless post\n post.update_a... | [
"0.67319006",
"0.6466641",
"0.63313323",
"0.6292245",
"0.62203586",
"0.61339635",
"0.60845643",
"0.60370046",
"0.5993316",
"0.59355915",
"0.5935336",
"0.59297407",
"0.5885732",
"0.586917",
"0.5841329",
"0.5803992",
"0.57921773",
"0.57847995",
"0.57742023",
"0.5766365",
"0.575... | 0.71536976 | 0 |
DELETE /watched_posts/1 DELETE /watched_posts/1.json | def destroy
@watched_post.destroy
respond_to do |format|
format.html { redirect_to :back, notice: 'Watched post was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n post = current_user.posts.find_by_uuid(params[:id])\n return render_item_not_found('Post') unless post\n post.destroy\n broadcast(post, 'delete')\n head :ok\n end",
"def destroy\n @post.destroy\n respond_to d... | [
"0.71157324",
"0.7006278",
"0.68684036",
"0.6835429",
"0.68088496",
"0.67718995",
"0.6768176",
"0.67605263",
"0.67580146",
"0.6723057",
"0.6719164",
"0.67096436",
"0.67063385",
"0.668756",
"0.668756",
"0.668756",
"0.668756",
"0.668756",
"0.668756",
"0.668756",
"0.668756",
"... | 0.75040936 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_watched_post
@watched_post = WatchedPost.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def watched_post_params
params.require(:watched_post).permit(:user_id, :post_id)
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 |
Alias so that we can refer to configuration as config | def config
configuration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parametrize #alias\n self.configuration\n end",
"def reference\n :config\n end",
"def reference\n :config\n end",
"def configuration_name\n super\n end",
"def lookup_config(name)\n\t\tend",
"def alias?(uri)\n @conf.alias?(uri)\n end",
"def config\n log.deprecated... | [
"0.7278195",
"0.71431386",
"0.71431386",
"0.6798167",
"0.66228735",
"0.65900534",
"0.64386183",
"0.6427003",
"0.6325367",
"0.6289041",
"0.6278837",
"0.6264198",
"0.6256654",
"0.62132484",
"0.6194023",
"0.6194023",
"0.6194023",
"0.6194023",
"0.6194023",
"0.61845285",
"0.616847... | 0.60767317 | 33 |
Access the courses client | def courses
Content::Courses.new(token: @token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def courses\n request(COURSES_URL, {}, 'GET').map do |course|\n Course.new(self, course)\n end\n end",
"def index\n #to see tenant info\n #@tenant = Tenant.current_tenant\n @courses = Course.all\n end",
"def courses\n unless user_signed_in? && current_user.instructor\n rende... | [
"0.691775",
"0.68480873",
"0.6733818",
"0.6710697",
"0.6702536",
"0.66013724",
"0.65487736",
"0.65417975",
"0.6467807",
"0.6434286",
"0.6374932",
"0.6368143",
"0.6360732",
"0.63552165",
"0.6331737",
"0.6311297",
"0.63003004",
"0.62947214",
"0.6284735",
"0.62697685",
"0.626744... | 0.6766762 | 2 |
add a node to end of list | def append (number)
# create new node
this_node = Node.new(number)
# make head if none
if head.nil?
return @head = this_node
end
# else, loop to end of list
current = @head
until current.next_node.nil?
current = current.next_node
end
# make last node point to new no... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(value)\n #needs .last method\n #self.last\n last.next = Node.new(value)\n end",
"def append( value )\n last.next = Node.new value\n end",
"def add_to_tail(node)\n @head ||= node\n\n @tail.next = node if @tail\n @tail = node\n end",
"def add_to_tail(node)\n if self.head =... | [
"0.7506871",
"0.74633217",
"0.7462077",
"0.7438376",
"0.7362368",
"0.73556757",
"0.7350349",
"0.73357266",
"0.7294122",
"0.7266734",
"0.7237285",
"0.7221831",
"0.7207249",
"0.7207055",
"0.72064704",
"0.7199497",
"0.71856403",
"0.71838987",
"0.7163111",
"0.7163111",
"0.7159838... | 0.0 | -1 |
add a node to start of list | def prepend (number)
# create a new node
this_node = Node.new(number)
# make new node point to head, and save it to head
this_node.next_node = head
@head = this_node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend( value )\n new_node = Node.new value\n\n # Whatever node was at the start of the list, it\n # is now the 'next' node for our newly created node\n new_node.next = @head\n\n # The new head of the list is set to be the new\n # node that we just created\n @head = new_node\n end",
"d... | [
"0.7451546",
"0.7451546",
"0.72764206",
"0.720654",
"0.72048163",
"0.71769935",
"0.7138337",
"0.71237147",
"0.71237147",
"0.71237147",
"0.7102109",
"0.70790285",
"0.70453537",
"0.7033646",
"0.7011344",
"0.70066506",
"0.7001357",
"0.6988498",
"0.6982323",
"0.69745475",
"0.6967... | 0.6892508 | 27 |
returns number of elements in list | def size
# return 0 if empty list
if head.nil?
return 0
end
current = @head
elements = 1
until current.next_node.nil?
# loop thru list to end
# increment
elements += 1
# advance to next node
current = current.next_node
end
puts elements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length(list)\n number(list.to_a.size)\n end",
"def count(list)\n list.length\nend",
"def length\n return @list.length\n end",
"def size\n list.size\n end",
"def length\r\n @list.length\r\n end",
"def size\n @list.size\n end",
"def size\n @list.size\n ... | [
"0.8338875",
"0.8247731",
"0.80477476",
"0.79853386",
"0.7941688",
"0.7865503",
"0.7865503",
"0.7804265",
"0.7693823",
"0.7665098",
"0.7639188",
"0.76387405",
"0.7615966",
"0.75606304",
"0.74763536",
"0.7475631",
"0.7468067",
"0.74469876",
"0.74436027",
"0.7335449",
"0.733022... | 0.7358636 | 19 |
remove last element from list | def pop
current = @head
# loop to second to last element of list
until current.next_node == tail
current = current.next_node
end
# update tail
@tail = current
# set next_node to nil
current.next_node = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_last\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the tail node\n # Move the tail to the previous node\n data = @tail.data\n \n if size < 2\n return remove_first\n else\n each_cons(2) do |node, next_node|\n if next_node... | [
"0.7582747",
"0.74826",
"0.74676216",
"0.7310875",
"0.72072273",
"0.720402",
"0.71229666",
"0.71229666",
"0.70536804",
"0.70187914",
"0.6960687",
"0.6940214",
"0.69381",
"0.68975794",
"0.6830705",
"0.6734318",
"0.6726282",
"0.66047364",
"0.6602258",
"0.6574042",
"0.6570573",
... | 0.61876947 | 47 |
return true if value is in list | def contains? (number)
current = @head
until current.next_node.nil?
if current.value == number
return true
else
current = current.next_node
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include?(value)\n each do |index, list_value|\n return true if list_value == value\n end\n return false\n end",
"def contains(value, list)\n assert_type list, :List\n \n Sass::Script::Bool.new(list.value.include?(value))\n end",
"def in?(*list)\n for item... | [
"0.8348142",
"0.8190887",
"0.8079315",
"0.79992825",
"0.78710824",
"0.7568998",
"0.7550091",
"0.7538633",
"0.7537615",
"0.7423725",
"0.7406146",
"0.7337812",
"0.73149025",
"0.7309618",
"0.7269923",
"0.72646433",
"0.72309726",
"0.7223594",
"0.7139859",
"0.7133557",
"0.7113353"... | 0.0 | -1 |
displays list as ( value ) > ... > nil | def to_s
current = @head
until current.next_node.nil?
print "( #{current.value} ) -> "
current = current.next_node
end
print "( #{current.value} ) -> nil"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_values(list)\n if !list\n print \"nil\\n\"\n else\n print \"#{list.value} -> \"\n print_values(list.next_node)\n end\n end",
"def display_list(list)\n\t\tsanitize(list.empty? ? \"None\" : list.map(&:display).join(', '))\n\tend",
"def print_values(list_node)\n\t\t\tif list_nod... | [
"0.75321245",
"0.7454412",
"0.72134155",
"0.72022015",
"0.71510607",
"0.7037851",
"0.70135176",
"0.70053947",
"0.70053947",
"0.6973008",
"0.6856187",
"0.6791057",
"0.65603",
"0.6536303",
"0.6443994",
"0.64400023",
"0.636256",
"0.6333171",
"0.6290013",
"0.62634546",
"0.6255995... | 0.5856336 | 53 |
Set up the context for security tests | def allowed_acl(sid, expected_perms, flags = 0)
acl = [ ACE.access_allowed(sid, expected_perms[:specific], flags) ]
if expected_perms[:generic]
acl << ACE.access_allowed(sid, expected_perms[:generic], (Chef::ReservedNames::Win32::API::Security::SUBFOLDERS_AND_FILES_ONLY))
end
acl
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(_context)\n end",
"def setup_environment; end",
"def context\n init\n @context\n end",
"def setup\n @model = Participant\n @controller = ParticipantsController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n\n ... | [
"0.7451887",
"0.67582345",
"0.6585234",
"0.65627974",
"0.6498501",
"0.64722645",
"0.64618015",
"0.64400697",
"0.6428076",
"0.63748026",
"0.6364367",
"0.6355879",
"0.6338008",
"0.6329526",
"0.6316134",
"0.63117564",
"0.62936974",
"0.62927234",
"0.62479854",
"0.62468404",
"0.62... | 0.0 | -1 |
analyze the saved query to determine the format. this delegates the detection to each formats class until th right one is found | def analyze!
return unless @q
FORMATS.each do |format|
if Query::Format.const_get(format.to_s).is?(@q)
@format = Query::Format.const_get(format.to_s).format
@country_code = Query::Format.const_get(format.to_s).country_code(@q)
break
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_format(format); end",
"def _process_format(format); end",
"def formats; end",
"def formats; end",
"def format2type(format)\n if FORMATS.has_key? format\n FORMATS[format]\n elsif @user_defined_formats.has_key? format\n @user_defined_formats[format]\n else\n # Previously,... | [
"0.6093268",
"0.6093268",
"0.59757614",
"0.59757614",
"0.59009266",
"0.5786163",
"0.576879",
"0.5730023",
"0.5690479",
"0.5625845",
"0.5568173",
"0.55567133",
"0.54875803",
"0.54821026",
"0.54040474",
"0.534658",
"0.53222054",
"0.53159547",
"0.5296988",
"0.52948487",
"0.52613... | 0.6461173 | 0 |
take a list of acceptable (and ordered by preference) formats and convert the current query (q) into the most preferred and acceptable format. a side effect of the conversions may reveal the country_code, if so save it | def convert!(preferred_formats=nil)
raise ArgumentError unless (preferred_formats && preferred_formats.size > 0)
# why convert if we are already there?
# (except in the case that the serivce excepts coordinates and we have a
# a geocode ... the google geocode results are superior)
#
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def analyze!\n return unless @q\n FORMATS.each do |format|\n if Query::Format.const_get(format.to_s).is?(@q)\n @format = Query::Format.const_get(format.to_s).format\n @country_code = Query::Format.const_get(format.to_s).country_code(@q)\n break\n end\n end\n ... | [
"0.6403716",
"0.58860916",
"0.5710354",
"0.5331009",
"0.5296122",
"0.5208205",
"0.5208205",
"0.51463336",
"0.51449996",
"0.5115732",
"0.5031547",
"0.5020517",
"0.4965028",
"0.4953501",
"0.4953501",
"0.49473268",
"0.49360487",
"0.4932113",
"0.49127975",
"0.4912723",
"0.4839618... | 0.6950333 | 0 |
save the important parts of the conversion ... by saving conversion we can avoid doing the same conversion multiple times | def post_conversion(converted_query)
return unless (converted_query && converted_query.q && converted_query.format)
@conversions = {} unless @conversions
return if @conversions.has_key?(converted_query.format.to_sym)
puts "store: #{self.format} -> #{converted_query.format.to_sym} = #{self.q} -> #{converted_quer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert!; end",
"def convert\n end",
"def convert\n end",
"def save\n valid_file? and successful_conversion?\n end",
"def converter; end",
"def save_output\n\n end",
"def save!\n if self.file =~ LOCALE_INTERPOLATOR\n I18n.available_locales.each do |locale|\n ... | [
"0.6500285",
"0.6330165",
"0.6330165",
"0.6212268",
"0.59716886",
"0.59326667",
"0.5905469",
"0.5869489",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58325297",
"0.58219403",
"0.5815007",
"0.57434857",
"0.5717529",
"0.5... | 0.55299544 | 28 |
Cucumber's Transform object overrides the to_s function and strips the anchor tags ^$ and any captures so that id it is interpolated in a step definition the it can appear anywhere in the step without being effected by position or captures | def convert_captures(regexp_source)
regexp_source
.gsub(/(\()(?!\?[<:=!])/,'(?:')
.gsub(/(\(\?<)(?![=!])/,'(?:<')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sharps2anchor\n str = self.gsub(/###(\\S*)/, \" <a name=\\\"\\\\1\\\" href=\\\"#\\\\1\\\" title=\\\"\\\\1\\\"></a> \")\n return str\n end",
"def pretty_step step\n step.sub!(\"Given\", \"<div class='spector-keyword'>Given</div>\")\n step.sub!(\"When\", \"<div class='spector-keyword'>When</div>\"... | [
"0.65501213",
"0.59710896",
"0.58409834",
"0.5809687",
"0.55758303",
"0.5419811",
"0.54032373",
"0.5358084",
"0.53535134",
"0.533898",
"0.52983326",
"0.5224073",
"0.5186978",
"0.51776797",
"0.51329255",
"0.512062",
"0.5116139",
"0.5110255",
"0.5101494",
"0.5056399",
"0.504142... | 0.0 | -1 |
Support for interpolation in the Transform's Regex | def substitute(data)
until (nested = constants_from_value(data)).empty?
nested.each {|n| data.gsub!(value_regex(n),find_value_for_constant(n)) }
end
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regexp=(_arg0); end",
"def interpolation_patterns; end",
"def format_regex\n callback.options[:live_validator] || callback.options[:with]\n end",
"def pattern2regex(pattern); end",
"def convert_regexp_handling target\n convert_string super\n end",
"def lex_en_interp_string=(_arg0); en... | [
"0.65775406",
"0.65072966",
"0.6297873",
"0.6289378",
"0.6251998",
"0.62454027",
"0.62454027",
"0.62454027",
"0.62431115",
"0.62431115",
"0.62431115",
"0.6182103",
"0.6182103",
"0.6182103",
"0.6179385",
"0.6115718",
"0.6115718",
"0.6115718",
"0.6108718",
"0.6047921",
"0.60257... | 0.0 | -1 |
Return a regex of the value | def value_regex(value)
/#\{\s*#{value}\s*\}/
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_regexp\n Regexp.new(@value)\n end",
"def regex\n Regexp.new(@str)\n end",
"def to_regex_str\n pattern\n end",
"def regexp; end",
"def regexp; end",
"def regex_search\n if use_regex?\n ::Arel::Nodes::Regexp.new((custom_field? ? field : table[field]), ::Arel::... | [
"0.7820683",
"0.71402895",
"0.70635337",
"0.69770247",
"0.69770247",
"0.6972594",
"0.6925727",
"0.68972087",
"0.68726593",
"0.68285656",
"0.6788004",
"0.67518485",
"0.6709283",
"0.6699269",
"0.66909367",
"0.6681839",
"0.6638349",
"0.6635247",
"0.655925",
"0.655925",
"0.652046... | 0.7102095 | 2 |
Step the regex starting / and ending / from the value | def strip_regex_from(value)
value.gsub(/^\/|\/$/,'')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan_for_slash(token); end",
"def reg_url2; /(.+)\\//; end",
"def reg_url2; /(.+)\\//; end",
"def slash_count_in_slashes_regexp=(value)\n configure_slashes(value) { |current| [current, value].max }\n end",
"def preprocess_value(value)\n if value.is_a?(Array)\n # Recurse!\n ... | [
"0.6556785",
"0.6187993",
"0.6187993",
"0.5832828",
"0.54935986",
"0.5382378",
"0.53346527",
"0.53174746",
"0.52812266",
"0.52768576",
"0.5264563",
"0.52518797",
"0.5242636",
"0.5213559",
"0.51731807",
"0.5170428",
"0.51408714",
"0.5140545",
"0.51113206",
"0.50929683",
"0.506... | 0.5893487 | 3 |
Starts the adapter and don't block the current thread. | def start
mutex.synchronize do
return unless stopped
@stopped = false
end
start_worker
start_poller
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!\n @adapter.start\n end",
"def start!\n setup\n adapter.start!\n end",
"def start\n return unless stopped?\n @stopped = false\n @adapter.opening\n run_input_thread\n end",
"def start\n _init_actors\n unpause\n @stopping = false\n r... | [
"0.8267722",
"0.7851027",
"0.73991907",
"0.72111684",
"0.6539486",
"0.65029436",
"0.64649355",
"0.64598274",
"0.64509755",
"0.635329",
"0.62639946",
"0.6166991",
"0.61668736",
"0.60837835",
"0.6043905",
"0.6027241",
"0.6013708",
"0.60122675",
"0.59884936",
"0.59781647",
"0.59... | 0.5819147 | 30 |
Starts the adapter and block the current thread. | def start!
start
blocking_thread.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start!\n @adapter.start\n end",
"def start!\n setup\n adapter.start!\n end",
"def start\n _init_actors\n unpause\n @stopping = false\n registry[:adapter].async.start\n Thread.new { _wait_for_changes }\n end",
"def start\n return unless stopped?\n ... | [
"0.7818822",
"0.7273217",
"0.71815914",
"0.7142136",
"0.6572634",
"0.65275174",
"0.6344792",
"0.6322187",
"0.6250582",
"0.6212831",
"0.61305183",
"0.6024485",
"0.6023817",
"0.599702",
"0.59145427",
"0.59121054",
"0.5894089",
"0.58940387",
"0.5884326",
"0.5881667",
"0.5871969"... | 0.68196845 | 4 |
Returns whether the adapter is started or not. | def started?
!stopped
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def started?\n @started\n end",
"def started?\n @started\n end",
"def started?\n backend.started?\n end",
"def started? # :nodoc:\n @started\n end",
"def starting?\n if connection_in_info?\n status.queued? && !connect.to_h.compact.empty?\n else\n ... | [
"0.7991402",
"0.7991402",
"0.79251575",
"0.79182386",
"0.7710051",
"0.7641337",
"0.76241314",
"0.76241314",
"0.75551707",
"0.7457392",
"0.74558353",
"0.7362627",
"0.7359798",
"0.73281527",
"0.73256487",
"0.732013",
"0.731012",
"0.7307298",
"0.710102",
"0.70899194",
"0.7087686... | 0.75694525 | 8 |
Returns whether the adapter is paused or not. | def paused?
paused
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paused?\n !!adapter && adapter.paused?\n end",
"def paused?\n @paused > 0\n end",
"def paused?\r\n\t\treturn @pause\r\n\tend",
"def paused?\n @paused == true\n end",
"def paused?\n @paused == true\n end",
"def paused?\n @paused == true\n end",
"def paused... | [
"0.9325116",
"0.8617648",
"0.84928423",
"0.84880304",
"0.84880304",
"0.84880304",
"0.8432323",
"0.8432323",
"0.842806",
"0.82555634",
"0.8236335",
"0.8195162",
"0.7925688",
"0.769447",
"0.7486012",
"0.7374867",
"0.7196914",
"0.71170706",
"0.70588684",
"0.685309",
"0.6852113",... | 0.86070603 | 2 |
Blocks the main thread until the poll thread runs the callback. | def wait_for_callback
turnstile.wait unless paused
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait!\n until query_done?\n check_cancel\n periodic_callback\n sleep @poll_every\n end\n check_errors\n end",
"def poll(_) end",
"def blocking_thread\n poller_thread\n end",
"def wait_until_running\n until @running\n ControllableThread.sleep POLL... | [
"0.71407604",
"0.68878716",
"0.67755425",
"0.6561612",
"0.639559",
"0.6357725",
"0.6353189",
"0.6345812",
"0.6316818",
"0.6316027",
"0.6278074",
"0.6277006",
"0.62395865",
"0.6231508",
"0.6139393",
"0.6131912",
"0.61267793",
"0.612567",
"0.612567",
"0.6097118",
"0.6093649",
... | 0.64038545 | 4 |
Blocks the main thread until N changes are detected. | def wait_for_changes(threshold = 0)
changes = 0
loop do
mutex.synchronize { changes = changed_directories.size }
return if paused || stopped
return if changes >= threshold
sleep(latency)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(n)\n n.times do\n update\n yield if block_given?\n end\n end",
"def until_no_change\n begin @changed = false; yield; end while @changed\n end",
"def wait_for_changes(goal = 0)\n changes = 0\n\n loop do\n @mutex.synchronize { changes = @changed_dirs.size }\n\n ... | [
"0.6850283",
"0.6229708",
"0.6078058",
"0.5801606",
"0.56617886",
"0.5636479",
"0.5599811",
"0.55779487",
"0.55517846",
"0.5470246",
"0.5453825",
"0.54317826",
"0.54136395",
"0.5381371",
"0.536631",
"0.53584427",
"0.5310282",
"0.52724403",
"0.5257851",
"0.5245866",
"0.5230245... | 0.61697376 | 2 |
Runs the callback and passes it the changes if there are any. | def report_changes
changed_dirs = nil
mutex.synchronize do
return if @changed_directories.empty?
changed_dirs = @changed_directories.to_a
@changed_directories.clear
end
callback.call(changed_dirs, {})
turnstile.signal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute\n listen_for_changes\n @block.call\n end",
"def run_on_changes(_)\n restart\n end",
"def run_on_changes(paths)\n run_all()\n end",
"def callback!\n watcher && watcher.callback!(self)\n end",
"def run_on_changes(paths)\n run(paths)\n end",
"def on_c... | [
"0.69417304",
"0.6681753",
"0.6574675",
"0.65156037",
"0.64890224",
"0.6429955",
"0.64269006",
"0.64247257",
"0.6415748",
"0.64012885",
"0.63888174",
"0.6377864",
"0.6337281",
"0.62858146",
"0.6283465",
"0.62776655",
"0.6256615",
"0.62123334",
"0.62092954",
"0.6152922",
"0.61... | 0.5600277 | 74 |
The default delay between checking for changes. | def default_latency
DEFAULT_LATENCY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_delay\n @@default_delay ||= 0\n end",
"def default_delay\n 0.seconds\n end",
"def delay\n @delay ||= 600\n end",
"def delay\n @delay || initial_delay\n end",
"def delay\n @delay || initial_delay\n end",
"def default_delay=(v)\n @@default_dela... | [
"0.75120986",
"0.7427421",
"0.72019994",
"0.71910465",
"0.71411425",
"0.70339096",
"0.6987394",
"0.68324596",
"0.6683713",
"0.6683713",
"0.6683713",
"0.6622498",
"0.65061724",
"0.6503907",
"0.64456564",
"0.6401719",
"0.63742554",
"0.63094306",
"0.6295355",
"0.6247311",
"0.624... | 0.0 | -1 |
The thread on which the main thread should wait when the adapter has been started in blocking mode. | def blocking_thread
worker_thread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blocking_thread\n poller_thread\n end",
"def start!\n start\n blocking_thread.join\n end",
"def waitable_for_current_thread\n Waitable.new(self)\n end",
"def wait\n @thread.join\n end",
"def initialize(&blk)\n self.future_thread = Thread.new(&blk)\n end",
"def... | [
"0.74487966",
"0.6375384",
"0.634699",
"0.63450307",
"0.62101847",
"0.61829364",
"0.61829364",
"0.6134896",
"0.6134896",
"0.6133019",
"0.612844",
"0.6074807",
"0.60682166",
"0.6046555",
"0.6039779",
"0.6037351",
"0.6037351",
"0.6037351",
"0.6015307",
"0.600287",
"0.59817183",... | 0.7532608 | 0 |
Initialize the adpater' specific worker. | def initialize_worker
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(worker)\n @worker = worker\n end",
"def initialize\n @worker = Fetcher::Worker.new\n end",
"def initialize\n @worker = Fetcher::Worker.new\n end",
"def worker_initial_config\n\n end",
"def worker_init\n raise \"Invalid worker name\" if !worker_name\n Thread.abort... | [
"0.7618884",
"0.719108",
"0.719108",
"0.7098384",
"0.7002339",
"0.6932332",
"0.6843488",
"0.682083",
"0.6754112",
"0.6694878",
"0.6649076",
"0.6577903",
"0.6536077",
"0.64216137",
"0.6412809",
"0.6399058",
"0.63964343",
"0.62849283",
"0.6277195",
"0.62764466",
"0.62593096",
... | 0.7275227 | 1 |
Should start the worker in a new thread. | def start_worker
raise NotImplementedError, "#{self.class} cannot respond to: #{__method__}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _start_new_worker(worker)\n Thread.new do\n worker.work\n end\n end",
"def start_worker_thread\n @worker_threads << ControllableThread.new(@name + \"-worker\") {yield}\n end",
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n e... | [
"0.81666934",
"0.7920237",
"0.76841193",
"0.74393284",
"0.7429807",
"0.73871315",
"0.7072399",
"0.7055351",
"0.70131814",
"0.6993289",
"0.69926476",
"0.6982739",
"0.69458175",
"0.6914177",
"0.68498796",
"0.6841243",
"0.68145597",
"0.6773348",
"0.67412513",
"0.6730126",
"0.672... | 0.69818944 | 12 |
This method starts a new thread which poll for changes detected by the adapter and report them back to the user. | def start_poller
@poller_thread = Thread.new { poll_changed_directories }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n _init_actors\n unpause\n @stopping = false\n registry[:adapter].async.start\n Thread.new { _wait_for_changes }\n end",
"def start\n _signals_trap\n _init_actors\n unpause\n Celluloid::Actor[:listen_adapter].async.start\n @thread = Thread.new { _wai... | [
"0.69808793",
"0.6466049",
"0.6374886",
"0.63215804",
"0.61747795",
"0.61075425",
"0.60169005",
"0.59751207",
"0.5900797",
"0.58488905",
"0.57596624",
"0.5729809",
"0.5721097",
"0.5717066",
"0.5716657",
"0.5710781",
"0.57004726",
"0.56943446",
"0.56701434",
"0.56701434",
"0.5... | 0.65312 | 1 |
Polls changed directories and reports them back when there are changes. | def poll_changed_directories
until stopped
sleep(latency)
report_changes
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def poll_changed_dirs\n until @stop\n sleep(@latency)\n report_changes\n end\n end",
"def report_changes\n changed_dirs = nil\n\n mutex.synchronize do\n return if @changed_directories.empty?\n changed_dirs = @changed_directories.to_a\n @changed_directorie... | [
"0.8661012",
"0.78588057",
"0.7707175",
"0.7592704",
"0.7311116",
"0.7259764",
"0.71781516",
"0.7141873",
"0.6938955",
"0.6874952",
"0.6589987",
"0.65410894",
"0.64495766",
"0.64464045",
"0.6425354",
"0.6407449",
"0.6332142",
"0.6321192",
"0.62634075",
"0.6260471",
"0.6248126... | 0.85677826 | 1 |
GET /levels/1 GET /levels/1.json | def show
@level = Level.find(params[:id])
authorize! :show, @level, :message => 'Acceso denegado.'
respond_to do |format|
format.html # show.html.erb
format.json { render json: @level }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @founda... | [
"0.8155705",
"0.7942849",
"0.72984266",
"0.7224381",
"0.7224381",
"0.71205467",
"0.7089395",
"0.7037464",
"0.684202",
"0.68018925",
"0.6784465",
"0.67548525",
"0.6748975",
"0.6699899",
"0.66695654",
"0.65858287",
"0.6577207",
"0.6570663",
"0.6551074",
"0.6540905",
"0.651433",... | 0.6333949 | 28 |
GET /levels/new GET /levels/new.json | def new
@level = Level.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @level }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @level = Level.new\n @level.set_defaults\n bingo!(\"create_level_button\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @level }\n end\n end",
"def new\n @level_category = LevelCategory.new\n\n respond_to do |format|\n for... | [
"0.7876898",
"0.7474014",
"0.73763907",
"0.7356393",
"0.7315537",
"0.7315537",
"0.7086898",
"0.7052044",
"0.70116144",
"0.69760764",
"0.69072884",
"0.68890446",
"0.6838188",
"0.67895305",
"0.6776874",
"0.6750389",
"0.6734451",
"0.67241544",
"0.6723817",
"0.6669619",
"0.661376... | 0.8075973 | 1 |
POST /levels POST /levels.json | def create
@level = Level.new(params[:level])
authorize! :create, @level, :message => 'Acceso denegado.'
respond_to do |format|
if @level.save
format.html { redirect_to @level, notice: t("activerecord.alerts.level.created") }
format.json { render json: @level, status: :created, locati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @level = Level.new(params[:level])\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to @level, notice: 'Level was successfully created.' }\n format.json { render json: @level, status: :created, location: @level }\n else\n format.html { render ac... | [
"0.6971333",
"0.6971333",
"0.6745412",
"0.66188776",
"0.6605027",
"0.6528696",
"0.6475621",
"0.64384544",
"0.6362735",
"0.63355964",
"0.6253227",
"0.6235083",
"0.6231185",
"0.6224483",
"0.61914253",
"0.6158239",
"0.6133909",
"0.612062",
"0.6107473",
"0.6105576",
"0.6102901",
... | 0.64615446 | 7 |
PUT /levels/1 PUT /levels/1.json | def update
@level = Level.find(params[:id])
authorize! :update, @level, :message => 'Acceso denegado.'
respond_to do |format|
if @level.update_attributes(params[:level])
format.html { redirect_to @level, notice: t("activerecord.alerts.level.updated") }
format.json { head :no_content }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @level = Level.find(params[:id])\n\n respond_to do |format|\n if @level.update_attributes(params[:level])\n format.html { redirect_to @level, notice: 'Level was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ... | [
"0.7181207",
"0.71730685",
"0.69729644",
"0.6853727",
"0.67365575",
"0.6722724",
"0.67001474",
"0.6634597",
"0.6634597",
"0.6634332",
"0.662801",
"0.6571991",
"0.6507236",
"0.63843447",
"0.63750845",
"0.63694525",
"0.63694525",
"0.6346149",
"0.62434196",
"0.6233891",
"0.62273... | 0.66568696 | 7 |
DELETE /levels/1 DELETE /levels/1.json | def destroy
@level = Level.find(params[:id])
authorize! :destroy, @level, :message => 'Acceso denegado.'
@level.destroy
respond_to do |format|
format.html { redirect_to levels_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @level = Level.find(params[:id])\n @level.destroy\n\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level = Level.find(params[:id])\n @level.destroy\n\n respond_to do |format|\n f... | [
"0.78578126",
"0.78535116",
"0.7793629",
"0.733917",
"0.73036915",
"0.72178555",
"0.7185569",
"0.7119995",
"0.7119995",
"0.7091842",
"0.7016745",
"0.7007547",
"0.7006501",
"0.6866436",
"0.68362767",
"0.68350285",
"0.6792138",
"0.67415595",
"0.66958725",
"0.66290593",
"0.66199... | 0.74670964 | 3 |
this is my source code. Hello! I have a method called Fizzbuz() | def fizzbuzz(number)
if number % 5 == 0 && number % 3 == 0
"FizzBuzz"
elsif number % 5 == 0
"Buzz"
elsif number % 3 == 0
"Fizz"
else
number
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fizzbuzz\nend",
"def fizz_buzz number\nend",
"def fizz_buzz number\nend",
"def fizz_buzz number \nend",
"def hey_hey; end",
"def test_fizzbuzz__5_returns_buzz\n #Arrange\n number = 5\n #Act\n result = fizzbuzz(number)\n #Assert\n assert_equal(\"Buzz\", result)\n end",
... | [
"0.8251735",
"0.74638164",
"0.74638164",
"0.7430524",
"0.69538426",
"0.679956",
"0.67398787",
"0.67385423",
"0.67297447",
"0.67046434",
"0.666541",
"0.66273165",
"0.660993",
"0.6593149",
"0.6587318",
"0.6580347",
"0.6559068",
"0.6555662",
"0.6552611",
"0.65394163",
"0.6537746... | 0.0 | -1 |
GET /studanswers GET /studanswers.json | def index
@studanswers = Studanswer.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n ... | [
"0.7012073",
"0.6885591",
"0.6867381",
"0.6867381",
"0.6867381",
"0.6867381",
"0.68258154",
"0.6720181",
"0.67084193",
"0.6695905",
"0.66890776",
"0.66196185",
"0.6609573",
"0.6604411",
"0.6567164",
"0.6559389",
"0.65506065",
"0.6540369",
"0.6516026",
"0.64403707",
"0.6382643... | 0.7517882 | 0 |
GET /studanswers/1 GET /studanswers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end",
"def index\n @studanswers = Studanswer.all\n end",
"def show\n @student_answer = StudentAnswer.find(params[:id])\n\n respond_to do |format|\n format.h... | [
"0.7501154",
"0.72806484",
"0.6992352",
"0.6945137",
"0.6847311",
"0.6847311",
"0.6847311",
"0.6847311",
"0.6661247",
"0.66511184",
"0.66511184",
"0.66511184",
"0.6635244",
"0.6614786",
"0.66044635",
"0.6599018",
"0.6585638",
"0.6532132",
"0.6526006",
"0.6526006",
"0.6526006"... | 0.0 | -1 |
POST /studanswers POST /studanswers.json | def create
@studanswer = Studanswer.new(studanswer_params)
respond_to do |format|
if @studanswer.save
format.html { redirect_to @studanswer, notice: 'Studanswer was successfully created.' }
format.json { render :show, status: :created, location: @studanswer }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end",
"def create\n @studsubanswer = Studsubanswer.new(studsubanswer_params)\n\n respond_to do |format|\n if @studsubanswer.save\n format.html { redi... | [
"0.67406654",
"0.67343426",
"0.671602",
"0.67007995",
"0.66683924",
"0.6651434",
"0.6605598",
"0.6569492",
"0.65265036",
"0.64824915",
"0.64279467",
"0.64163965",
"0.64076424",
"0.63971454",
"0.6371308",
"0.63610953",
"0.6348323",
"0.63270324",
"0.63156813",
"0.63134426",
"0.... | 0.7385681 | 0 |
PATCH/PUT /studanswers/1 PATCH/PUT /studanswers/1.json | def update
respond_to do |format|
if @studanswer.update(studanswer_params)
format.html { redirect_to @studanswer, notice: 'Studanswer was successfully updated.' }
format.json { render :show, status: :ok, location: @studanswer }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\... | [
"0.7178205",
"0.7060834",
"0.6996378",
"0.6812188",
"0.68099546",
"0.6770166",
"0.676029",
"0.67406917",
"0.6696563",
"0.6660518",
"0.6659975",
"0.6659975",
"0.6650949",
"0.66499674",
"0.6633496",
"0.6629473",
"0.6626467",
"0.6626467",
"0.66230655",
"0.6614476",
"0.66039383",... | 0.70930845 | 1 |
DELETE /studanswers/1 DELETE /studanswers/1.json | def destroy
@studanswer.destroy
respond_to do |format|
format.html { redirect_to studanswers_url, notice: 'Studanswer was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @studsubanswer.destroy\n respond_to do |format|\n format.html { redirect_to studsubanswers_url, notice: 'Studsubanswer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_answer = StudentAnswer.find(params[:id])\n @studen... | [
"0.74638444",
"0.737147",
"0.7321966",
"0.73219573",
"0.73219573",
"0.72660995",
"0.7262603",
"0.723351",
"0.723351",
"0.71848327",
"0.71689904",
"0.7162904",
"0.7133745",
"0.7133745",
"0.71299684",
"0.7127776",
"0.7127776",
"0.7127776",
"0.7127776",
"0.7127776",
"0.7095307",... | 0.76357025 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_studanswer
@studanswer = Studanswer.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def studanswer_params
params.require(:studanswer).permit(:StudentAnswer, :formanswer_id)
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 |
prefix 099$a with "MS" per local style guidelines | def handle_id(*ids)
ids.reject!{|i| i.nil? || i.empty? }
df('099', ' ', ' ').with_sfs(['a', "MS #{ids.join('.')}"])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_cm\n self.gsub(/[mm]/,\"\")\n end",
"def no_mm\n self.gsub(/[cm]/,\"\")\n end",
"def genclase\n \"M\"\n end",
"def quarter_wind_abbreviation; end",
"def half_wind_abbreviation; end",
"def local_prefixes; end",
"def toast_english_muffin (toast = 2)\n \"My english muff... | [
"0.60320604",
"0.6018445",
"0.5722539",
"0.5628927",
"0.5569288",
"0.55346924",
"0.55257756",
"0.5489304",
"0.548907",
"0.544443",
"0.53625786",
"0.53509",
"0.53436303",
"0.53214586",
"0.53057104",
"0.52938735",
"0.5285277",
"0.5276475",
"0.5276475",
"0.5276475",
"0.5276475",... | 0.0 | -1 |
if subject['source'] == 'built' export as 610 TODO: fix 610$2 == "local" if the real source is Library of Congress (inferred from authority_id) | def handle_subjects(subjects)
subjects.each do |link|
subject = link['_resolved']
term, *terms = subject['terms']
code, ind2 = case term['term_type']
when 'uniform_title'
['630', source_to_code(subject['source'])]
when 'temporal'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_type; end",
"def support_multiple_source?; end",
"def should_remove_librun_and_stc_sources\n !(core_developer? or ENV['RETAIN_STX_AND_LIBRUN_SOURCE'] == 'yespleaseretain!')\nend",
"def source_name\n 'Archives & Manuscripts'\n end",
"def export_as_openurl_ctx_kev(format = 'book')\n Rails.... | [
"0.5523916",
"0.54226005",
"0.54212505",
"0.53982204",
"0.5338582",
"0.52484536",
"0.52172434",
"0.5168864",
"0.51335984",
"0.50830793",
"0.5019386",
"0.5001773",
"0.5000587",
"0.49875844",
"0.49830168",
"0.49756896",
"0.49712297",
"0.4957116",
"0.4951172",
"0.49427572",
"0.4... | 0.5045147 | 10 |
export dimensions into 300|c subfield | def handle_extents(extents)
extents.each do |ext|
e = ext['number']
t = "#{I18n.t('enumerations.extent_extent_type.'+ext['extent_type'], :default => ext['extent_type'])}"
if ext['container_summary']
t << " (#{ext['container_summary']})"
end
if ext['dimensions']
d = e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size=(dimension); end",
"def dimensions(val); @dimensions = val; self; end",
"def dims_to_xml(xml)\n xml.dims do |xml|\n if @dimensions && @pov\n @dimensions.each_with_index do |dim,i|\n if @row_dims.include? dim\n ... | [
"0.6415548",
"0.6050288",
"0.5914897",
"0.5793116",
"0.57598007",
"0.54171145",
"0.5395826",
"0.5378385",
"0.5377828",
"0.5365888",
"0.53535223",
"0.5295307",
"0.5289382",
"0.52892",
"0.5271972",
"0.5268105",
"0.5256652",
"0.52302754",
"0.52250886",
"0.5215644",
"0.52008355",... | 0.5218396 | 19 |
load the loop_items of a loop_source from a file. | def parse_file status, source_file_obj
existing_structure = self.loop_item_type.present?
# keep track of the errors
status[:errors] = []
# keep track of the line and column being analised, for error reporting.
status[:line] = 0
status[:column] = 0
# save the headers and the items
stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_source!\n @source = load_file_contents\n end",
"def load_items\n @items = []\n data_sources.each do |ds|\n items_in_ds = ds.items\n items_in_ds.each { |i| i.identifier = File.join(ds.items_root, i.identifier) }\n @items += items_in_ds\n end\n\n @items_loa... | [
"0.6229381",
"0.6091598",
"0.6089621",
"0.6048423",
"0.585632",
"0.57661146",
"0.5729885",
"0.5711434",
"0.56023395",
"0.5590825",
"0.553359",
"0.55295837",
"0.5514494",
"0.54865044",
"0.5473818",
"0.5465922",
"0.54628164",
"0.5447149",
"0.5366971",
"0.5366971",
"0.5340886",
... | 0.0 | -1 |
Return the error if there is one, nil otherwise. | def error
@data['error']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getError\n return @error\n end",
"def error\n nil\n end",
"def error\n nil\n end",
"def error\n errors.first\n end",
"def error\n errors.first\n end",
"def error\n errors.first\n end",
"def error\n return unless id.nil?\n @error ||= @res... | [
"0.77686846",
"0.77321565",
"0.7702849",
"0.75699544",
"0.75699544",
"0.75244933",
"0.7425533",
"0.7378182",
"0.73543864",
"0.73350024",
"0.73214763",
"0.7267335",
"0.7245614",
"0.70354354",
"0.70319355",
"0.7015137",
"0.6903819",
"0.6815585",
"0.67970204",
"0.6781828",
"0.67... | 0.6555741 | 36 |
Return true if there is an error, false otherwise. | def error?
!@data['error'].nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error?\n false\n end",
"def error?\n return true if errors.count > 0\n\n false\n end",
"def error?\n true\n end",
"def error?\n false\n end",
"def error?\n false\n end",
"def error?\n false\n end",
"def error?\n !erro... | [
"0.8650197",
"0.8640689",
"0.86151445",
"0.8595215",
"0.8595215",
"0.85740095",
"0.8559726",
"0.8559726",
"0.8554058",
"0.85477436",
"0.8542044",
"0.85022944",
"0.8497772",
"0.84505975",
"0.84505975",
"0.84418577",
"0.8422497",
"0.8379329",
"0.83792883",
"0.83792883",
"0.8359... | 0.7864053 | 51 |
The custom bot invite url of the bot. | def invite
@data['invite']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invite_url(server = nil)\n raise 'No application ID has been set during initialization! Add one as the `application_id` named parameter while creating your bot.' unless @application_id\n\n guild_id_str = server ? \"&guild_id=#{server.id}\" : ''\n \"https://discordapp.com/oauth2/authorize?&client... | [
"0.7343329",
"0.7128833",
"0.70367575",
"0.6937881",
"0.67097247",
"0.66485727",
"0.66140074",
"0.640297",
"0.6392458",
"0.6154059",
"0.61326194",
"0.60644615",
"0.5981642",
"0.5955906",
"0.59025836",
"0.5887016",
"0.58761287",
"0.5826833",
"0.5825052",
"0.5819773",
"0.580611... | 0.0 | -1 |
The link to the github repo of the bot. | def github
@data['github']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_for_repo(repo)\n repo.url\n end",
"def github_url\n \"https://github.com/#{self.nickname}\"\n end",
"def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end",
"def url\n \"http://github.com/#{login}\"\n end",
"def github_url\n @github_url |... | [
"0.8045132",
"0.7682349",
"0.7618218",
"0.7613995",
"0.7501102",
"0.7279075",
"0.7274423",
"0.7151333",
"0.71172494",
"0.7100194",
"0.709522",
"0.7084642",
"0.7081502",
"0.70732886",
"0.70446354",
"0.7022832",
"0.6999424",
"0.69733065",
"0.69520175",
"0.6935323",
"0.6860272",... | 0.6139297 | 56 |
The website url of the bot. | def website
@data['website']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def website_url; website end",
"def site_url\n get_url(:site)\n end",
"def site_url\n SITE_URL\n end",
"def url\n Config.site.url.chomp('/') + self.path\n end",
"def website_link\n return unless website?\n\n @website_link ||= website.split(\"//\")[1].sub(/^www\\./, \"\... | [
"0.81017154",
"0.7731201",
"0.7627697",
"0.75219434",
"0.7358081",
"0.72467554",
"0.72467554",
"0.72467554",
"0.7225551",
"0.71355426",
"0.6960987",
"0.6960987",
"0.6960987",
"0.6960987",
"0.6960987",
"0.69183946",
"0.68808365",
"0.6867629",
"0.6859601",
"0.6845959",
"0.68387... | 0.0 | -1 |
The long description of the bot. Can contain HTML and/or Markdown. | def longdesc
@data['longdesc']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_description\n text = @command.long_description\n return \"\" if text.nil? # empty description\n\n lines = text.split(\"\\n\")\n lines.map do |line|\n # In the CLI help, we use 2 spaces to designate commands\n # In Markdown we need 4 spaces.\n line.sub(/^ \\b/, ' ... | [
"0.81584007",
"0.79368496",
"0.7900123",
"0.7783111",
"0.77271235",
"0.7716433",
"0.76465213",
"0.75978637",
"0.75839496",
"0.75770724",
"0.7389105",
"0.7332357",
"0.73292816",
"0.7325238",
"0.7312501",
"0.72983664",
"0.7294924",
"0.7283904",
"0.7195938",
"0.7146649",
"0.7118... | 0.7562774 | 10 |
The short description of the bot. | def shortdesc
@data['shortdesc']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_description\n description\n end",
"def full_description\n\t\t\t\"#{@name}\\n\\nYou are in #{@description}\"\n\t\tend",
"def description\n raise \"description not provided for command #{name}\"\n end",
"def description\n end",
"def description\n end",
"def brief_des... | [
"0.78036463",
"0.7727555",
"0.742285",
"0.7397923",
"0.7397923",
"0.72666734",
"0.7247737",
"0.72187793",
"0.7214012",
"0.720234",
"0.7191026",
"0.71869195",
"0.7161375",
"0.7155672",
"0.71522033",
"0.71520823",
"0.7146097",
"0.7138477",
"0.71360964",
"0.7123867",
"0.70949423... | 0.0 | -1 |
The prefix of the bot. | def prefix
@data['prefix']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefix\n fetch('superhero.prefix')\n end",
"def prefix\n ''\n end",
"def prefix\n self.class.prefix\n end",
"def prefix\n @obj['prefix']\n end",
"def prefix\n nil\n end",
"def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end",
"d... | [
"0.77737975",
"0.76626384",
"0.7639561",
"0.74750626",
"0.7397903",
"0.7385204",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.737212",
"0.7362214",
"0.7252475",
"0.72072846",
"0.71369106",
"0.7104292",
"0.708... | 0.7137074 | 19 |
The library of the bot. | def lib
@data['lib']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def library\n @library ||= Boson.library(@lib)\n end",
"def lib\n @obj['lib']\n end",
"def library; end",
"def library; end",
"def library\n @library ||= Library.new(self)\n end",
"def library\n @library ||= Library.new(self)\n end",
"def library\n @library ||= {}... | [
"0.77346253",
"0.73730224",
"0.73416644",
"0.73416644",
"0.72785574",
"0.72785574",
"0.7269744",
"0.68761134",
"0.6862827",
"0.6774801",
"0.6691911",
"0.6643737",
"0.6626264",
"0.66196996",
"0.66196996",
"0.66196996",
"0.65533143",
"0.6466656",
"0.645227",
"0.64312327",
"0.64... | 0.71058667 | 7 |
Get the bot's Client ID. | def clientid
@data['clientid'].to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client_id\n @client_id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n return @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id\n @client_id\n ... | [
"0.7901568",
"0.78351134",
"0.78351134",
"0.7522737",
"0.74995357",
"0.74995357",
"0.74507564",
"0.74224097",
"0.7350442",
"0.71971506",
"0.71720016",
"0.716219",
"0.6986378",
"0.69227606",
"0.6916036",
"0.6884983",
"0.6879545",
"0.6858349",
"0.68521774",
"0.6845553",
"0.6700... | 0.62194383 | 28 |
The cdn hash of the bot's avatar if the bot has none. | def defavatar
@data['defAvatar']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avatar\n \"https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024\"\n end",
"def avatar_url\n \"https://avatars.githubusercontent.com/u/#{uid}?v=2\"\n end",
"def avatar_img\n \"https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024\"\n end",
"def avat... | [
"0.68517697",
"0.6745206",
"0.66385454",
"0.66382205",
"0.6556077",
"0.64024454",
"0.6374335",
"0.63543487",
"0.63375515",
"0.62957907",
"0.62683755",
"0.62673527",
"0.6208374",
"0.617191",
"0.6169834",
"0.6162638",
"0.616126",
"0.6144321",
"0.61374545",
"0.61106825",
"0.6108... | 0.55730736 | 67 |
The avatar hash of the bot's avatar. | def avatar
@data['avatar']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avatar\n \"https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024\"\n end",
"def user_avatar_url\n @raw['user']['avatar_url']\n end",
"def avatar_url\n \"https://avatars.githubusercontent.com/u/#{uid}?v=2\"\n end",
"def avatar(avatar_holder)\n if av... | [
"0.6787746",
"0.66519386",
"0.66382664",
"0.64725804",
"0.6462642",
"0.6312813",
"0.6301541",
"0.6244513",
"0.6215853",
"0.61926",
"0.61926",
"0.6178685",
"0.61602646",
"0.61501366",
"0.61488783",
"0.61486864",
"0.6102305",
"0.6096237",
"0.6021951",
"0.6010071",
"0.6004248",
... | 0.65528584 | 4 |
Get's the bot's avatar as an img, ready to be used in image linking. | def avatar_img
"https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avatar\n \"https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024\"\n end",
"def avatar(avatar_holder)\n if avatar_holder.avatar.attached?\n avatar = avatar_holder.avatar\n else\n avatar = \"https://arena-fighter.s3.eu-west-3.amazonaws.com/avatar... | [
"0.8129449",
"0.8031641",
"0.7715041",
"0.7636787",
"0.76342636",
"0.7569681",
"0.75448304",
"0.75351137",
"0.7470847",
"0.74567926",
"0.74567926",
"0.74386054",
"0.74284595",
"0.7414118",
"0.7406809",
"0.739597",
"0.73737234",
"0.73598003",
"0.7348613",
"0.73445135",
"0.7323... | 0.8005641 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.