_id stringlengths 2 6 | title stringlengths 9 130 | partition stringclasses 3
values | text stringlengths 30 4.3k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22500 | ZBar.Image.convert | train | def convert(format)
ptr = ZBar.zbar_image_convert(@img, format)
if ptr.null?
| ruby | {
"resource": ""
} |
q22501 | Metamagic.Renderer.transform_hash | train | def transform_hash(hash, path = "")
hash.each_with_object({}) do |(k, v), ret|
key = path + k.to_s
if v.is_a?(Hash)
| ruby | {
"resource": ""
} |
q22502 | Blockchain.Wallet.parse_json | train | def parse_json(response)
json_response = JSON.parse(response)
error = | ruby | {
"resource": ""
} |
q22503 | Numo.Gnuplot.stats | train | def stats(filename,*args)
fn = OptArg.quote(filename)
opt = OptArg.parse(*args)
| ruby | {
"resource": ""
} |
q22504 | HTML2Markdown.Converter.parse_element | train | def parse_element(ele)
if ele.is_a? Nokogiri::XML::Text
return "#{ele.text}\n"
else
if (children = | ruby | {
"resource": ""
} |
q22505 | HTML2Markdown.Converter.wrap_node | train | def wrap_node(node,contents=nil)
result = ''
contents.strip! unless contents==nil
# check if there is a custom parse exist
if respond_to? "parse_#{node.name}"
return self.send("parse_#{node.name}",node,contents)
end
# skip hidden node
return '' if node['style'] and node... | ruby | {
"resource": ""
} |
q22506 | HTML2Markdown.Converter.method_missing | train | def method_missing(name,*args,&block)
self.class.send :define_method,"parse_#{name}" do |node,contents|
| ruby | {
"resource": ""
} |
q22507 | Asciidoctor::Rouge.CalloutsSubstitutor.convert_line | train | def convert_line(line_num)
return '' unless @callouts.key? line_num
@callouts[line_num]
.map { | ruby | {
"resource": ""
} |
q22508 | Asciidoctor::Rouge.HtmlFormatter.stream_lines | train | def stream_lines(tokens, line_num)
yield line_start(line_num)
tokens.each do |token, value|
| ruby | {
"resource": ""
} |
q22509 | Text.Table.to_s | train | def to_s
rendered_rows = [separator] + text_table_rows.map(&:to_s) + [separator]
rendered_rows.unshift [separator, text_table_head.to_s] if head
| ruby | {
"resource": ""
} |
q22510 | Text.Table.align_column | train | def align_column(column_number, alignment)
set_alignment = Proc.new do |row, column_number_block, alignment_block|
cell = row.find do |cell_row|
row[0...row.index(cell_row)].map {|c| c.is_a?(Hash) ? c[:colspan] || 1 : 1}.inject(0, &:+) == column_number_block - 1
end
row[row.index... | ruby | {
"resource": ""
} |
q22511 | Asciidoctor::Rouge.PassthroughsSubstitutor.restore | train | def restore(text)
return text if @node.passthroughs.empty?
# Fix passthrough placeholders that got caught up in syntax highlighting.
text | ruby | {
"resource": ""
} |
q22512 | Crafty.Tools.element! | train | def element!(name, content = nil, attributes = nil)
build! do
if content or block_given?
@_crafted << "<#{name}#{Tools.format_attributes(attributes)}>"
if block_given?
value = yield
content = value if !@_appended or value.kind_of? String
end
| ruby | {
"resource": ""
} |
q22513 | Scorm.Package.extract! | train | def extract!(force = false)
return if @options[:dry_run] && !force
# If opening an already extracted package; do nothing.
if not package?
return
end
# Create the path to the course
FileUtils.mkdir_p(@path)
Zip::ZipFile::foreach(@package) do |entry|
... | ruby | {
"resource": ""
} |
q22514 | Scorm.Package.path_to | train | def path_to(relative_filename, relative = false)
if relative
| ruby | {
"resource": ""
} |
q22515 | Svelte.SwaggerBuilder.make_resource | train | def make_resource
resource = Module.new
paths.each do |path|
new_module = PathBuilder.build(path: path, module_constant: resource)
path.operations.each do |operation|
OperationBuilder.build(operation: operation,
| ruby | {
"resource": ""
} |
q22516 | Svelte.ModelFactory.define_models | train | def define_models(json)
return unless json
models = {}
model_definitions = json['definitions']
model_definitions.each do |model_name, parameters|
attributes = parameters['properties'].keys
model = Class.new do
attr_reader(*attributes.map(&:to_sym))
parameters... | ruby | {
"resource": ""
} |
q22517 | Googl.OAuth2.server | train | def server(client_id, client_secret, redirect_uri)
| ruby | {
"resource": ""
} |
q22518 | Cryptor.Encoding.decode | train | def decode(string)
padding_size = string.bytesize % 4
padded_string = padding_size > 0 ? string + '=' * | ruby | {
"resource": ""
} |
q22519 | Svelte.Path.operations | train | def operations
validate_operations
@operations ||= @raw_operations.map do |operation, properties|
| ruby | {
"resource": ""
} |
q22520 | Harvesting.Client.create | train | def create(entity)
url = "#{DEFAULT_HOST}/#{entity.path}"
uri = URI(url)
response = http_response(:post, uri, body: entity.to_hash)
| ruby | {
"resource": ""
} |
q22521 | Harvesting.Client.delete | train | def delete(entity)
url = "#{DEFAULT_HOST}/#{entity.path}"
uri = URI(url)
response = http_response(:delete, uri)
raise | ruby | {
"resource": ""
} |
q22522 | Harvesting.Client.get | train | def get(path, opts = {})
url = "#{DEFAULT_HOST}/#{path}"
url += "?#{opts.map {|k, v| "#{k}=#{v}"}.join("&")}" if opts.any?
uri = URI(url)
| ruby | {
"resource": ""
} |
q22523 | JobInterview.Knapsack.knapsack | train | def knapsack(items, capacity, algorithm = :dynamic)
if algorithm == :memoize
knapsack_memoize(items, capacity)
elsif algorithm | ruby | {
"resource": ""
} |
q22524 | NetAddr.IPv4Net.prev_sib | train | def prev_sib()
if (self.network.addr == 0)
return nil
end
shift = 32 - self.netmask.prefix_len | ruby | {
"resource": ""
} |
q22525 | NetAddr.IPv4Net.summ | train | def summ(other)
if (!other.kind_of?(IPv4Net))
raise ArgumentError, "Expected an IPv4Net object for 'other' but got a #{other.class}."
end
# netmasks must be identical
if (self.netmask.prefix_len != other.netmask.prefix_len)
return nil
end
# merge-able networks will be identical if you ... | ruby | {
"resource": ""
} |
q22526 | NetAddr.IPv6Net.contains | train | def contains(ip)
if (!ip.kind_of?(IPv6))
raise ArgumentError, "Expected an IPv6 object for | ruby | {
"resource": ""
} |
q22527 | NetAddr.EUI64.bytes | train | def bytes()
return [
(@addr >> 56 & 0xff).to_s(16).rjust(2, "0"),
(@addr >> 48 & 0xff).to_s(16).rjust(2, "0"),
(@addr >> 40 & 0xff).to_s(16).rjust(2, "0"),
(@addr >> 32 & 0xff).to_s(16).rjust(2, "0"),
(@addr >> 24 & | ruby | {
"resource": ""
} |
q22528 | TTY.Config.set | train | def set(*keys, value: nil, &block)
assert_either_value_or_block(value, block)
keys = convert_to_keys(keys)
key = flatten_keys(keys)
value_to_eval = block || value
if validators.key?(key)
if callable_without_params?(value_to_eval)
value_to_eval = delay_validation(key, va... | ruby | {
"resource": ""
} |
q22529 | TTY.Config.set_if_empty | train | def set_if_empty(*keys, value: nil, &block)
return unless deep_find(@settings, keys.last.to_s).nil?
block ? | ruby | {
"resource": ""
} |
q22530 | TTY.Config.set_from_env | train | def set_from_env(*keys, &block)
assert_keys_with_block(convert_to_keys(keys), block)
key = flatten_keys(keys)
env_key = block.nil? ? key : block.()
| ruby | {
"resource": ""
} |
q22531 | TTY.Config.fetch | train | def fetch(*keys, default: nil, &block)
# check alias
real_key = @aliases[flatten_keys(keys)]
keys = real_key.split(key_delim) if real_key
keys = convert_to_keys(keys)
env_key = autoload_env? ? to_env_key(keys[0]) : @envs[flatten_keys(keys)]
# first try settings
value = deep_fe... | ruby | {
"resource": ""
} |
q22532 | TTY.Config.append | train | def append(*values, to: nil)
keys = Array(to) | ruby | {
"resource": ""
} |
q22533 | TTY.Config.remove | train | def remove(*values, from: nil)
keys = Array(from) | ruby | {
"resource": ""
} |
q22534 | TTY.Config.alias_setting | train | def alias_setting(*keys, to: nil)
flat_setting = flatten_keys(keys)
alias_keys = Array(to)
alias_key = flatten_keys(alias_keys)
if alias_key == flat_setting
raise ArgumentError, 'Alias | ruby | {
"resource": ""
} |
q22535 | TTY.Config.validate | train | def validate(*keys, &validator)
key = flatten_keys(keys)
| ruby | {
"resource": ""
} |
q22536 | TTY.Config.read | train | def read(file = find_file, format: :auto)
if file.nil?
raise ReadError, 'No file found to read configuration from!'
elsif !::File.exist?(file)
raise | ruby | {
"resource": ""
} |
q22537 | TTY.Config.write | train | def write(file = find_file, force: false, format: :auto)
if file && ::File.exist?(file)
if !force
raise WriteError, "File `#{file}` already exists. " \
'Use :force option to overwrite.'
elsif !::File.writable?(file)
raise WriteError, "Cannot write to... | ruby | {
"resource": ""
} |
q22538 | TTY.Config.assert_either_value_or_block | train | def assert_either_value_or_block(value, block)
if value.nil? && block.nil?
raise ArgumentError, 'Need | ruby | {
"resource": ""
} |
q22539 | TTY.Config.assert_valid | train | def assert_valid(key, value)
validators[key].each do |validator|
| ruby | {
"resource": ""
} |
q22540 | TTY.Config.deep_set | train | def deep_set(settings, *keys)
return settings if keys.empty?
key, *rest = *keys
value = settings[key]
if value.nil? && rest.empty?
settings[key] = {} | ruby | {
"resource": ""
} |
q22541 | TTY.Config.deep_fetch | train | def deep_fetch(settings, *keys)
key, *rest = keys
value = settings.fetch(key.to_s, settings[key.to_sym])
if value.nil? || rest.empty?
| ruby | {
"resource": ""
} |
q22542 | TTY.Config.marshal | train | def marshal(file, data, format: :auto)
file_ext = ::File.extname(file)
ext = (format == :auto ? file_ext : ".#{format}")
self.extname = file_ext
self.filename = ::File.basename(file, file_ext)
case ext
when *EXTENSIONS[:yaml]
load_write_dep('yaml', ext)
YAML.dump(se... | ruby | {
"resource": ""
} |
q22543 | AcmePlugin.CertGenerator.save_certificate | train | def save_certificate(certificate)
return unless certificate
return HerokuOutput.new(common_domain_name, certificate).output unless ENV['DYNO'].nil?
output_dir = File.join(Rails.root, @options[:output_cert_dir])
| ruby | {
"resource": ""
} |
q22544 | JDBCHelper.TableWrapper.count | train | def count *where
sql, *binds = SQLHelper.count :table => name, :where => @query_where + where, :prepared => true
| ruby | {
"resource": ""
} |
q22545 | JDBCHelper.TableWrapper.insert_ignore | train | def insert_ignore data_hash = {}
sql, *binds = SQLHelper.insert_ignore :table => name,
:data => @query_default.merge(data_hash),
| ruby | {
"resource": ""
} |
q22546 | JDBCHelper.TableWrapper.replace | train | def replace data_hash = {}
sql, *binds = SQLHelper.replace :table => name,
:data => @query_default.merge(data_hash),
| ruby | {
"resource": ""
} |
q22547 | JDBCHelper.TableWrapper.delete | train | def delete *where
sql, *binds = SQLHelper.delete(:table => name, :where => @query_where + where, :prepared => true)
| ruby | {
"resource": ""
} |
q22548 | JDBCHelper.TableWrapper.select | train | def select *fields, &block
obj = self.dup
obj.instance_variable_set :@query_select, fields | ruby | {
"resource": ""
} |
q22549 | JDBCHelper.TableWrapper.where | train | def where *conditions, &block
raise ArgumentError.new("Wrong number of arguments") if conditions.empty?
obj = self.dup | ruby | {
"resource": ""
} |
q22550 | JDBCHelper.TableWrapper.order | train | def order *criteria, &block
raise ArgumentError.new("Wrong number of arguments") if criteria.empty?
obj = self.dup | ruby | {
"resource": ""
} |
q22551 | JDBCHelper.TableWrapper.default | train | def default data_hash, &block
raise ArgumentError.new("Hash required") unless data_hash.kind_of? Hash
obj = self.dup | ruby | {
"resource": ""
} |
q22552 | JDBCHelper.TableWrapper.fetch_size | train | def fetch_size fsz, &block
obj = self.dup
| ruby | {
"resource": ""
} |
q22553 | JDBCHelper.TableWrapper.each | train | def each &block
sql, *binds = SQLHelper.select(
:prepared => true,
:table => name,
:project => @query_select,
:where => @query_where,
:order => @query_order,
| ruby | {
"resource": ""
} |
q22554 | JDBCHelper.TableWrapper.clear_batch | train | def clear_batch *types
types = [:insert, :update, :delete] if types.empty?
types.each do |type|
raise ArgumentError.new("Invalid type: | ruby | {
"resource": ""
} |
q22555 | JDBCHelper.TableWrapper.close | train | def close
@pstmts.each do |typ, hash|
hash.each do |sql, | ruby | {
"resource": ""
} |
q22556 | JDBCHelper.FunctionWrapper.call | train | def call(*args)
pstmt = @connection.prepare("select #{name}(#{args.map{'?'}.join ','})#{@suffix}")
begin
| ruby | {
"resource": ""
} |
q22557 | JDBCHelper.ProcedureWrapper.call | train | def call(*args)
params = build_params args
cstmt = @connection.prepare_call "{call #{name}(#{Array.new(@cols.length){'?'}.join ', '})}"
begin
| ruby | {
"resource": ""
} |
q22558 | Fernet.BitPacking.unpack_int64_bigendian | train | def unpack_int64_bigendian(bytes)
bytes.each_byte.to_a.reverse.each_with_index.
reduce(0) | ruby | {
"resource": ""
} |
q22559 | JDBCHelper.Connection.transaction | train | def transaction
check_closed
raise ArgumentError.new("Transaction block not given") unless block_given?
tx = Transaction.send :new, @conn
ac = @conn.get_auto_commit
status = :unknown
begin
@conn.set_auto_commit false
yield tx
@conn.commit
status = :committed
rescue T... | ruby | {
"resource": ""
} |
q22560 | JDBCHelper.Connection.execute | train | def execute(qstr)
check_closed
stmt = @spool.take
begin
if stmt.execute(qstr)
ResultSet.send(:new, stmt.getResultSet) { @spool.give | ruby | {
"resource": ""
} |
q22561 | JDBCHelper.Connection.query | train | def query(qstr, &blk)
check_closed
stmt = @spool.take
begin
rset = stmt.execute_query(qstr)
rescue Exception => e
| ruby | {
"resource": ""
} |
q22562 | JDBCHelper.Connection.execute_batch | train | def execute_batch
check_closed
cnt = 0
if @bstmt
cnt += @bstmt.execute_batch.inject(:+) || 0
@spool.give @bstmt
@bstmt = | ruby | {
"resource": ""
} |
q22563 | JDBCHelper.Connection.table | train | def table table_name
table = JDBCHelper::TableWrapper.new(self, table_name) | ruby | {
"resource": ""
} |
q22564 | Chargify.Subscription.save | train | def save
self.attributes.stringify_keys!
self.attributes.delete('customer')
self.attributes.delete('product')
self.attributes.delete('credit_card')
self.attributes.delete('bank_account')
self.attributes.delete('paypal_account')
| ruby | {
"resource": ""
} |
q22565 | Oxcelix.Workbook.unpack | train | def unpack(filename)
@destination = Dir.mktmpdir
Zip::File.open(filename){ |zip_file|
zip_file.each{ |f|
f_path=File.join(@destination, f.name)
| ruby | {
"resource": ""
} |
q22566 | Oxcelix.Workbook.parse | train | def parse(options={})
@sheets.each do |x|
if !options[:paginate].nil?
lines = options[:paginate][0]; page = options[:paginate][1]
sheet = PagSheet.new(lines, page)
elsif !options[:cellrange].nil?
range = options[:cellrange]
sheet = Cellrange.new(range)
... | ruby | {
"resource": ""
} |
q22567 | Oxcelix.Workbook.commentsrel | train | def commentsrel
unless Dir[@destination + '/xl/worksheets/_rels'].empty?
Find.find(@destination + '/xl/worksheets/_rels') do |path|
if File.basename(path).split(".").last=='rels'
a=IO.read(path)
f=Ox::load(a)
f.locate("Relationships/*").each do |x|
| ruby | {
"resource": ""
} |
q22568 | Oxcelix.Workbook.shstrings | train | def shstrings
strings = Sharedstrings.new()
File.open(@destination + '/xl/sharedStrings.xml', 'r') do |f|
| ruby | {
"resource": ""
} |
q22569 | Oxcelix.Workbook.mkcomments | train | def mkcomments(commentfile)
unless commentfile.nil?
comms = Comments.new()
File.open(@destination + | ruby | {
"resource": ""
} |
q22570 | Oxcelix.Workbook.mergevalues | train | def mergevalues(m, col, row, valuecell)
if valuecell != nil
valuecell.xlcoords=(col.col_name)+(row+1).to_s
m[row, col]=valuecell
| ruby | {
"resource": ""
} |
q22571 | Oxcelix.Numformats.datetime | train | def datetime formatcode
deminutified = formatcode.downcase.gsub(/(?<hrs>H|h)(?<div>.)m/, '\k<hrs>\k<div>i')
.gsub(/im/, 'ii')
.gsub(/m(?<div>.)(?<secs>s)/, 'i\k<div>\k<secs>')
| ruby | {
"resource": ""
} |
q22572 | Oxcelix.Numberhelper.to_ru | train | def to_ru
if !@value.numeric? || Numformats::Formatarray[@numformat.to_i][:xl] == nil || Numformats::Formatarray[@numformat.to_i][:xl].downcase == "general"
return @value
end
if Numformats::Formatarray[@numformat.to_i][:cls] == 'date'
return DateTime.new(1899, 12, 30) + (eval | ruby | {
"resource": ""
} |
q22573 | Oxcelix.Numberhelper.to_fmt | train | def to_fmt
begin
if Numformats::Formatarray[@numformat.to_i][:cls] == 'date'
self.to_ru.strftime(Numformats::Formatarray[@numformat][:ostring]) rescue @value
elsif Numformats::Formatarray[@numformat.to_i][:cls] == 'numeric' || Numformats::Formatarray[@numformat.to_i][:cls] == '... | ruby | {
"resource": ""
} |
q22574 | Oxcelix.Sheet.to_m | train | def to_m(*attrs)
m=Matrix.build(self.row_size, self.column_size){nil}
self.each_with_index do |x, row, col|
if attrs.size == 0 || attrs.nil? | ruby | {
"resource": ""
} |
q22575 | LolSoap.Envelope.body | train | def body(klass = Builder)
builder = klass.new(body_content, | ruby | {
"resource": ""
} |
q22576 | LolSoap.Envelope.header | train | def header(klass = Builder)
builder = klass.new(header_content, | ruby | {
"resource": ""
} |
q22577 | GhInspector.Inspector.search_exception | train | def search_exception(exception, delegate = nil)
query | ruby | {
"resource": ""
} |
q22578 | GhInspector.Inspector.search_query | train | def search_query(query, delegate = nil)
delegate | ruby | {
"resource": ""
} |
q22579 | LolSoap.WSDL.type | train | def type(namespace, name)
if @allow_abstract_types
@types.fetch([namespace, name]) { abstract_type(namespace, name) }
else
| ruby | {
"resource": ""
} |
q22580 | LolSoap.Response.fault | train | def fault
@fault ||= begin
node = doc.at_xpath('/soap:Envelope/soap:Body/soap:Fault', 'soap' => soap_namespace)
| ruby | {
"resource": ""
} |
q22581 | GhInspector.Sidekick.search | train | def search(query, delegate)
validate_delegate(delegate)
delegate.inspector_started_query(query, inspector)
url = url_for_request query
begin
results = get_api_results(url)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSynt... | ruby | {
"resource": ""
} |
q22582 | GhInspector.Sidekick.url_for_request | train | def url_for_request(query, sort_by: nil, order: nil)
url = "https://api.github.com/search/issues?q="
url += ERB::Util.url_encode(query) | ruby | {
"resource": ""
} |
q22583 | GhInspector.Sidekick.get_api_results | train | def get_api_results(url)
uri = URI.parse(url)
puts "URL: #{url}" if self.verbose
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request | ruby | {
"resource": ""
} |
q22584 | GhInspector.Sidekick.parse_results | train | def parse_results(query, results)
report = InspectionReport.new
report.url = "https://github.com/#{repo_owner}/#{repo_name}/search?q=#{ERB::Util.url_encode(query)}&type=Issues&utf8=✓"
| ruby | {
"resource": ""
} |
q22585 | Blogit.CommentsHelper.name_for_comment | train | def name_for_comment(comment)
if comment.website?
link_to(comment.name, comment.website, class: | ruby | {
"resource": ""
} |
q22586 | StateMachines.Machine.draw | train | def draw(graph_options = {})
name = graph_options.delete(:name) || "#{owner_class.name}_#{self.name}"
draw_options = {:human_name => false}
draw_options[:human_name] = graph_options.delete(:human_names) if graph_options.include?(:human_names) | ruby | {
"resource": ""
} |
q22587 | Blogit.ApplicationHelper.div_tag_with_default_class | train | def div_tag_with_default_class(default_class, content_or_options, options, &block)
if block_given?
options = content_or_options
content = capture(&block)
else
content = content_or_options
end | ruby | {
"resource": ""
} |
q22588 | Payu.Pos.validate_options! | train | def validate_options!
raise PosInvalid.new('Missing pos_id parameter') if pos_id.nil? || pos_id == 0
raise PosInvalid.new('Missing pos_auth_key parameter') if pos_auth_key.nil? || pos_auth_key == ''
raise PosInvalid.new('Missing key1 parameter') if key1.nil? || key1 == ''
raise PosInvalid.new('M... | ruby | {
"resource": ""
} |
q22589 | Payu.Pos.new_transaction | train | def new_transaction(options = {})
options = options.dup
options.merge!({
:pos_id => @pos_id,
:pos_auth_key => @pos_auth_key,
:gateway_url => options[:gateway_url] || @gateway_url,
:key1 => @key1,
:encoding => encoding,
:variant => variant
})
| ruby | {
"resource": ""
} |
q22590 | Payu.Helpers.payu_hidden_fields | train | def payu_hidden_fields(transaction)
html = ""
%w(pos_id pos_auth_key pay_type session_id amount amount_netto desc
order_id desc2 trsDesc first_name last_name street street_hn
street_an city post_code country email phone language client_ip
js payback_login sig ts
).each do |field|
| ruby | {
"resource": ""
} |
q22591 | Payu.Helpers.payu_verify_params | train | def payu_verify_params(params)
pos_id = params['pos_id']
pos = Payu[pos_id]
Signature.verify!(
params['sig'],
params['pos_id'], | ruby | {
"resource": ""
} |
q22592 | Smartsheet.GeneralRequest.request | train | def request(method:, url_path:, body: nil, params: {}, header_overrides: {})
spec = body.nil? ? {} : {body_type: :json}
endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], **spec)
request_spec = Smartsheet::API::RequestSpec.new(
| ruby | {
"resource": ""
} |
q22593 | Smartsheet.GeneralRequest.request_with_file | train | def request_with_file(
method:,
url_path:,
file:,
file_length:,
filename:,
content_type: '',
params: {},
header_overrides: {}
)
endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], body_type: | ruby | {
"resource": ""
} |
q22594 | Smartsheet.GeneralRequest.request_with_file_from_path | train | def request_with_file_from_path(
method:,
url_path:,
path:,
filename: nil,
content_type: '',
params: {},
header_overrides: {}
)
endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], body_type: | ruby | {
"resource": ""
} |
q22595 | Octopress.Ink.list | train | def list(options={})
site = Octopress.site(options)
Plugins.register
options = {'minimal'=>true} if options.empty?
message = "Octopress Ink - v#{VERSION}\n"
if plugins.size > 0
plugins.each do |plugin|
message | ruby | {
"resource": ""
} |
q22596 | Octopress.Ink.copy_doc | train | def copy_doc(source, dest, permalink=nil)
contents = File.open(source).read
# Convert H1 to title and add permalink in YAML front-matter
#
contents.sub!(/^# (.*)$/, "#{doc_yaml('\1', permalink).strip}")
| ruby | {
"resource": ""
} |
q22597 | PusherClient.Socket.connect | train | def connect(async = false)
@connection_thread = Thread.new do
@connection = TestConnection.new
@global_channel.dispatch('pusher:connection_established', JSON.dump({'socket_id' => '123abc'}))
| ruby | {
"resource": ""
} |
q22598 | PusherClient.Socket.authorize | train | def authorize(channel, callback)
if is_private_channel(channel.name)
auth_data = get_private_auth(channel)
elsif is_presence_channel(channel.name)
auth_data = get_presence_auth(channel)
end | ruby | {
"resource": ""
} |
q22599 | OneviewSDK.Cli.console | train | def console
client_setup({}, true, true)
puts "Console Connected to #{@client.url}"
puts "HINT: The @client object is available to you\n\n"
rescue
puts "WARNING: Couldn't connect to #{@options['url'] || ENV['ONEVIEWSDK_URL']}\n\n"
ensure
require 'pry'
Pry.config.prompt = proc... | ruby | {
"resource": ""
} |
Subsets and Splits
SQL Console for CoIR-Retrieval/CodeSearchNet-ccr-ruby-queries-corpus
Retrieves a large number of entries in the 'ruby' language, providing basic information but limited analytical value.