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 |
|---|---|---|---|---|---|---|
Encodes provided list of HTTP headers. | def encode(headers)
buffer = Buffer.new
pseudo_headers, regular_headers = headers.partition { |f, _| f.start_with? ':' }
headers = [*pseudo_headers, *regular_headers]
commands = @cc.encode(headers)
commands.each do |cmd|
buffer << header(cmd)
end
buffer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_headers(headers)\n result = StringIO.new\n headers.each do |key, value|\n next if value == nil\n if value.kind_of?(Array)\n value.each do |subvalue|\n result << (\"%s: %s\\r\\n\" % [key, subvalue])\n end\n else\n result << (\"%s: %s\\r... | [
"0.7103328",
"0.68546784",
"0.68293905",
"0.66430014",
"0.6490554",
"0.6484714",
"0.6294974",
"0.62570447",
"0.61597466",
"0.6156765",
"0.6151804",
"0.6142774",
"0.61266536",
"0.6114945",
"0.61013496",
"0.6057859",
"0.60473675",
"0.601811",
"0.599802",
"0.59924835",
"0.586302... | 0.6654989 | 3 |
Set dynamic table size in EncodingContext | def table_size=(size)
@cc.table_size = size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table_size=(size)\n @limit = size\n size_check(nil)\n end",
"def table_size_for(entry_count); end",
"def set_table_size\n @table_x = @table_reversed[0].size\n @table_y = @table_reversed.size\n end",
"def set_sql_buffer_size(size)\n @config[:sql_buffer_size] = size\n end",
"... | [
"0.67325795",
"0.6474614",
"0.6455162",
"0.6274066",
"0.6184335",
"0.6153992",
"0.6153992",
"0.6102097",
"0.5886023",
"0.5867476",
"0.5749091",
"0.56934917",
"0.56808746",
"0.5678269",
"0.5647777",
"0.56332284",
"0.56114984",
"0.559146",
"0.5556758",
"0.5548491",
"0.5449057",... | 0.7270028 | 1 |
Decodes integer value from provided buffer. | def integer(buf, n)
limit = 2**n - 1
i = !n.zero? ? (buf.getbyte & limit) : 0
m = 0
while (byte = buf.getbyte)
i += ((byte & 127) << m)
m += 7
break if (byte & 128).zero?
end if (i == limit)
i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_integer(data)\n tag, value, remainder = decode_tlv(data)\n raise InvalidTag, tag.to_s if tag != INTEGER_TAG\n return decode_integer_value(value), remainder\n end",
"def decode_vint(data)\n value = 0\n size = 1\n\n bytes = data.bytes.to_a\n # Size of ... | [
"0.6984368",
"0.6778572",
"0.6739333",
"0.6688747",
"0.6637859",
"0.65257066",
"0.65187114",
"0.6466282",
"0.6290654",
"0.62756187",
"0.62686414",
"0.6242595",
"0.6198977",
"0.6155712",
"0.61331296",
"0.6123098",
"0.6071842",
"0.60520595",
"0.60515076",
"0.60093635",
"0.58978... | 0.5562151 | 32 |
Decodes header command from provided buffer. | def header(buf)
peek = buf.readbyte(0)
header = {}
header[:type], type = HEADREP.find do |_t, desc|
mask = (peek >> desc[:prefix]) << desc[:prefix]
mask == desc[:pattern]
end
fail CompressionError unless header[:type]
header[:name] = integer(buf, type[:prefix])
case header[:type]
when :indexed
fail CompressionError if (header[:name]).zero?
header[:name] -= 1
when :changetablesize
header[:value] = header[:name]
else
if (header[:name]).zero?
header[:name] = string(buf)
else
header[:name] -= 1
end
header[:value] = string(buf)
end
header
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unpack_header(header)\n # fixed fields\n self.version = header.slice!(0)\n self.type = header.slice!(0)\n self.seq_no = header.slice!(0)\n self.flags = header.slice!(0)\n self.session_id = header.slice!(0..3)\n self.length = header.slice!(0..3)\n return(ni... | [
"0.67892146",
"0.65014803",
"0.6116986",
"0.61061454",
"0.6043969",
"0.6029083",
"0.6021325",
"0.5990783",
"0.5988191",
"0.597239",
"0.594672",
"0.59310603",
"0.59210664",
"0.5883804",
"0.5863298",
"0.58425426",
"0.57614154",
"0.57441336",
"0.57001233",
"0.5675524",
"0.565361... | 0.6139417 | 2 |
Decodes and processes header commands within provided buffer. | def decode(buf)
list = []
decoding_pseudo_headers = true
until buf.empty?
next_header = @cc.process(header(buf))
next if next_header.nil?
is_pseudo_header = next_header.first.start_with? ':'
if !decoding_pseudo_headers && is_pseudo_header
fail ProtocolError, 'one or more pseudo headers encountered after regular headers'
end
decoding_pseudo_headers = is_pseudo_header
list << next_header
end
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_command_and_headers\n if (match = @buffer.match(/\\A\\s*(\\S+)\\r?\\n((?:[ \\t]*.*?[ \\t]*:[ \\t]*.*?[ \\t]*$\\r?\\n)*)\\r?\\n/))\n @frame.command, headers = match.captures\n @buffer = match.post_match\n headers.split(/\\r?\\n/).each do |data|\n if data.match(/^\\s*([^\... | [
"0.7042458",
"0.65799373",
"0.656868",
"0.6511067",
"0.63596576",
"0.63120687",
"0.6252626",
"0.6183024",
"0.6141167",
"0.6113948",
"0.6107435",
"0.6101284",
"0.6088299",
"0.60515416",
"0.6042078",
"0.59980965",
"0.59749573",
"0.5951541",
"0.5938001",
"0.591486",
"0.5872225",... | 0.6410871 | 4 |
GET /orders/1 GET /orders/1.xml | def show
@order = Order.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @order }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @orders = Order.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @orders }\n end\n end",
"def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @order... | [
"0.7172294",
"0.71683097",
"0.71683097",
"0.7009707",
"0.70073557",
"0.6988548",
"0.69491136",
"0.68992543",
"0.6891001",
"0.6878",
"0.685688",
"0.68052316",
"0.67745936",
"0.6773926",
"0.6773926",
"0.6773926",
"0.6773926",
"0.6773926",
"0.6773926",
"0.6773926",
"0.6773926",
... | 0.6842995 | 11 |
GET /orders/new GET /orders/new.xml | def new
@order = Order.new
@order.number= Order.gen_number
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @order }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @order = Order.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def new\n ... | [
"0.7655449",
"0.76387805",
"0.7632975",
"0.7632975",
"0.7632975",
"0.7632975",
"0.7632975",
"0.7632975",
"0.7355399",
"0.7288023",
"0.71911263",
"0.71804076",
"0.714181",
"0.7084765",
"0.7082755",
"0.70823526",
"0.70802796",
"0.7042071",
"0.70373166",
"0.7008877",
"0.70071673... | 0.6821264 | 47 |
POST /orders POST /orders.xml | def create
@order = Order.new(params[:order])
if @order.save
orders = Order.by_manufacture_state("0", @order.product_id)
sum_meterial_manufacutured = @order.product.manufactures.sum(:quantity)
orders.each do |order|
break if order.quantity > (sum_meterial_manufacutured - Order.by_manufacture_state("1", order.product.id).sum(:quantity))
order.manufacture_flag = 1
order.processing
order.save
end
flash.notice = t('order.save')
redirect_to orders_path
else
render :action => "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend",
"def orders\n authenticated_post(\"orders\").body\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def create_order(o... | [
"0.73056525",
"0.6817154",
"0.67592794",
"0.675842",
"0.6736928",
"0.6490132",
"0.64257747",
"0.64047706",
"0.6370877",
"0.6370877",
"0.6370877",
"0.6370877",
"0.6369361",
"0.63487893",
"0.6338869",
"0.6293918",
"0.6213785",
"0.618264",
"0.6159349",
"0.61520296",
"0.60640544"... | 0.0 | -1 |
PUT /orders/1 PUT /orders/1.xml | def update
@order = Order.find(params[:id])
if @order.update_attributes(params[:order])
#update_manufacture_flag
flash.notice = t('order.update')
redirect_to orders_path
else
render :action => "edit"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @order = resource\n respond_to do |format|\n if @order.update_attributes(params[:order])\n flash[:notice] = 'Order was successfully updated.'\n format.html { redirect_to(@order) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }... | [
"0.65621203",
"0.6457469",
"0.6320595",
"0.63085866",
"0.63085866",
"0.63085866",
"0.63085866",
"0.62742734",
"0.62527144",
"0.6235117",
"0.6235117",
"0.6235117",
"0.6235117",
"0.60976785",
"0.60793746",
"0.60721374",
"0.6071906",
"0.6009747",
"0.60095763",
"0.60095763",
"0.5... | 0.0 | -1 |
DELETE /orders/1 DELETE /orders/1.xml | def destroy
@order = Order.find(params[:id])
@order.destroy
respond_to do |format|
format.html { redirect_to(orders_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @order = Order.get!(params[:id])\n @order.destroy if @order\n\n respond_to do |format|\n format.html { redirect_to(orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n... | [
"0.70440656",
"0.70168704",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.7007644",
"0.6986753",
"0.69361466",
"0.6913439",
"0.6878758",
"0.68236905",
"0.67278254"... | 0.70455605 | 0 |
Cockroach DB only supports one savepoint | def supports_savepoints?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_savepoints?\n true\n end",
"def supports_savepoints?\n true\n end",
"def create_savepoint\n execute(\"SAVEPOINT #{current_savepoint_name}\")\n end",
"def supports_savepoints?\n false\n end",
"def savepoint_obj(conn)\n _trans(conn)[:sav... | [
"0.5910204",
"0.5910204",
"0.5891233",
"0.5874201",
"0.5829364",
"0.5800967",
"0.57480466",
"0.5717457",
"0.56977415",
"0.56977415",
"0.56704843",
"0.565551",
"0.55939287",
"0.557446",
"0.5539254",
"0.5538816",
"0.54843265",
"0.5479739",
"0.5439407",
"0.5439407",
"0.5439407",... | 0.5774304 | 8 |
Creates a proc that transforms an API call into a bundling call. It transform a_func from an API call that receives the requests and returns the response into a proc that receives the same request, and returns a +Google::Gax::Bundling::Event+. The returned Event object can be used to obtain the eventual result of the bundled call. | def _bundleable(a_func, desc, bundler)
proc do |request|
the_id = bundling.compute_bundle_id(
request,
desc.request_discriminator_fields)
return bundler.schedule(a_func, the_id, desc, request)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_job_with_callback(image_source, function_name, function_params, image_identifier, postback_url, application_id = nil)\n job = Blitline::Job.new(image_source)\n environment_app_id = ENV['BLITLINE_URL'] && ENV['BLITLINE_URL'].split(\"/\").last\n job.application_id = environment_app_id || application... | [
"0.5109801",
"0.5109801",
"0.50008374",
"0.46882308",
"0.46698418",
"0.46470216",
"0.4614675",
"0.4534511",
"0.45272124",
"0.44899482",
"0.44829533",
"0.44757283",
"0.44443557",
"0.44360235",
"0.44129664",
"0.44119886",
"0.44007614",
"0.43937877",
"0.4380408",
"0.43534958",
"... | 0.6562352 | 0 |
Creates a proc that yields an iterable to performs pagestreaming. | def _page_streamable(
a_func,
request_page_token_field,
response_page_token_field,
resource_field)
proc do |request, **kwargs|
Enumerator.new do |y|
loop do
response = a_func.call(request, **kwargs)
response[resource_field].each do |obj|
y << obj
end
next_page_token = response[response_page_token_field]
if next_page_token.nil? || (next_page_token == 0) ||
(next_page_token.respond_to?(:empty?) && next_page_token.empty?)
break
end
request[request_page_token_field] = next_page_token
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| y... | [
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"0.6381481",
"... | 0.63507074 | 22 |
rubocop:disable Metrics/MethodLength Creates a proc equivalent to a_func, but that retries on certain exceptions. | def _retryable(a_func, retry_options)
delay_mult = retry_options.backoff_settings.retry_delay_multiplier
max_delay = (retry_options.backoff_settings.max_retry_delay_millis /
MILLIS_PER_SECOND)
timeout_mult = retry_options.backoff_settings.rpc_timeout_multiplier
max_timeout = (retry_options.backoff_settings.max_rpc_timeout_millis /
MILLIS_PER_SECOND)
total_timeout = (retry_options.backoff_settings.total_timeout_millis /
MILLIS_PER_SECOND)
proc do |request, **kwargs|
delay = retry_options.backoff_settings.initial_retry_delay_millis
timeout = (retry_options.backoff_settings.initial_rpc_timeout_millis /
MILLIS_PER_SECOND)
exc = nil
result = nil
now = Time.now
deadline = now + total_timeout
while now < deadline
begin
exc = nil
result = _add_timeout_arg(a_func, timeout).call(request, **kwargs)
break
rescue => exception
if exception.respond_to?(:code) &&
!retry_options.retry_codes.include?(exception.code)
raise RetryError.new('Exception occurred in retry method that ' \
'was not classified as transient',
cause: exception)
end
exc = RetryError.new('Retry total timeout exceeded with exception',
cause: exception)
sleep(rand(delay) / MILLIS_PER_SECOND)
now = Time.now
delay = [delay * delay_mult, max_delay].min
timeout = [timeout * timeout_mult, max_timeout, deadline - now].min
end
end
raise exc unless exc.nil?
result
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f(&code)\n code.class == Proc or raise\n end",
"def retry_on_fail(args, &blk)\n success = FALSE\n if args[:times].respond_to?(:times) and block_given?\n args[:times].times do |i|\n begin\n blk.call\n success = TRUE\n break\n rescue\n puts \"An error was ... | [
"0.5882892",
"0.57335645",
"0.56656724",
"0.5658237",
"0.5581509",
"0.5523877",
"0.5497484",
"0.54969025",
"0.5457383",
"0.54074466",
"0.53959405",
"0.53804296",
"0.5354935",
"0.529893",
"0.5271404",
"0.5258291",
"0.52035445",
"0.51602334",
"0.5143934",
"0.5132522",
"0.512651... | 0.70292956 | 0 |
Updates +a_func+ so that it gets called with the timeout as its final arg. This converts a proc, a_func, into another proc with an additional positional arg. | def _add_timeout_arg(a_func, timeout)
proc do |request, **kwargs|
kwargs[:timeout] = timeout
a_func.call(request, **kwargs)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _retryable(a_func, retry_options)\n delay_mult = retry_options.backoff_settings.retry_delay_multiplier\n max_delay = (retry_options.backoff_settings.max_retry_delay_millis /\n MILLIS_PER_SECOND)\n timeout_mult = retry_options.backoff_settings.rpc_timeout_multiplier\n max_t... | [
"0.5446973",
"0.544588",
"0.51013684",
"0.50967443",
"0.50239456",
"0.49741912",
"0.4919182",
"0.49109864",
"0.48863637",
"0.48793814",
"0.48010525",
"0.47183812",
"0.47183812",
"0.47183812",
"0.47183812",
"0.46362114",
"0.46000594",
"0.45576775",
"0.45242915",
"0.44918266",
... | 0.7609202 | 0 |
GET /feria2010observaciones GET /feria2010observaciones.xml | def index
@feria2010observaciones = Feria2010observacion.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @feria2010observaciones }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @feria2009calificaciones = Feria2009calificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009calificaciones }\n end\n end",
"def show\n @feria2010observacion = Feria2010observacion.find(params[:id])\n\n respond_to do... | [
"0.6954724",
"0.6849729",
"0.66758657",
"0.6609415",
"0.6560294",
"0.6555057",
"0.6545133",
"0.6510224",
"0.64912844",
"0.6489843",
"0.64557403",
"0.64226246",
"0.6419885",
"0.6389564",
"0.63821536",
"0.6372341",
"0.63139886",
"0.631394",
"0.6310549",
"0.630219",
"0.62957233"... | 0.74384964 | 0 |
GET /feria2010observaciones/1 GET /feria2010observaciones/1.xml | def show
@feria2010observacion = Feria2010observacion.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @feria2010observacion }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @feria2010observaciones = Feria2010observacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010observaciones }\n end\n end",
"def index\n @feria2009calificaciones = Feria2009calificacion.all\n\n respond_to do |format|\n ... | [
"0.7326733",
"0.67701745",
"0.6651293",
"0.65635115",
"0.6547086",
"0.6506665",
"0.65031236",
"0.64925456",
"0.6464952",
"0.6453448",
"0.6435681",
"0.64301854",
"0.6418012",
"0.6378395",
"0.63586915",
"0.6326059",
"0.63226753",
"0.63224447",
"0.6315905",
"0.63153446",
"0.6313... | 0.69352484 | 1 |
GET /feria2010observaciones/new GET /feria2010observaciones/new.xml | def new
@feria2010observacion = Feria2010observacion.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @feria2010observacion }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end",
"def new\n @tservicio = Tservicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re... | [
"0.7552861",
"0.74594355",
"0.73433816",
"0.73343796",
"0.7321114",
"0.7319988",
"0.73164856",
"0.7307729",
"0.7302753",
"0.7290319",
"0.7259245",
"0.725026",
"0.7234215",
"0.7224459",
"0.7218282",
"0.7208237",
"0.72079855",
"0.7206213",
"0.7201976",
"0.7201976",
"0.71867096"... | 0.7548251 | 1 |
POST /feria2010observaciones POST /feria2010observaciones.xml | def create
@feria2010observacion = Feria2010observacion.new(params[:feria2010observacion])
respond_to do |format|
if @feria2010observacion.save
format.html { redirect_to(@feria2010observacion, :notice => 'Feria2010observacion was successfully created.') }
format.xml { render :xml => @feria2010observacion, :status => :created, :location => @feria2010observacion }
else
format.html { render :action => "new" }
format.xml { render :xml => @feria2010observacion.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://l... | [
"0.6745729",
"0.6431179",
"0.6331413",
"0.616075",
"0.60564345",
"0.6030767",
"0.60078436",
"0.59847224",
"0.5924312",
"0.57989943",
"0.57635134",
"0.57598203",
"0.5733002",
"0.5724445",
"0.57186073",
"0.5707242",
"0.56928957",
"0.56905234",
"0.5629478",
"0.56271553",
"0.5625... | 0.60121465 | 6 |
PUT /feria2010observaciones/1 PUT /feria2010observaciones/1.xml | def update
@feria2010observacion = Feria2010observacion.find(params[:id])
respond_to do |format|
if @feria2010observacion.update_attributes(params[:feria2010observacion])
format.html { redirect_to(@feria2010observacion, :notice => 'Feria2010observacion was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @feria2010observacion.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start... | [
"0.66719246",
"0.63451916",
"0.63067156",
"0.6228597",
"0.6168637",
"0.60784453",
"0.6067102",
"0.6023449",
"0.6013939",
"0.5977992",
"0.597374",
"0.593776",
"0.59260017",
"0.5897492",
"0.5877608",
"0.58668536",
"0.5831431",
"0.58109677",
"0.5802877",
"0.5792601",
"0.5788462"... | 0.62584424 | 3 |
DELETE /feria2010observaciones/1 DELETE /feria2010observaciones/1.xml | def destroy
@feria2010observacion = Feria2010observacion.find(params[:id])
@feria2010observacion.destroy
respond_to do |format|
format.html { redirect_to(feria2010observaciones_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end",
"def destroy\n @relatestagiario = Relatestagiario.f... | [
"0.70212084",
"0.6826956",
"0.6819283",
"0.6794892",
"0.675243",
"0.6750462",
"0.6749981",
"0.6743244",
"0.6736679",
"0.6734104",
"0.6703362",
"0.6700634",
"0.66880155",
"0.66880155",
"0.665943",
"0.6659187",
"0.6652112",
"0.66440105",
"0.6641765",
"0.6634057",
"0.66278565",
... | 0.7092507 | 0 |
MIGRATION STATUS: Not done yet. raise 'Migration already performed.' Don't run this migration. Kept for posterity These are string replacements that are formatted weird. | def string_replacements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migration\n end",
"def migrate\n run_migrations pending_migrations, :up\n end",
"def change_migration_content\n Dir.glob(\"#{plugin_path}/db/migrate/*.rb\").each do |f|\n content = \"\"\n file = File.open(f,\"r\")\n file.each do |line|\n content += \"#{line} \" \n ... | [
"0.6554187",
"0.615715",
"0.6062473",
"0.6015078",
"0.6015078",
"0.60119855",
"0.59501857",
"0.58009464",
"0.5800702",
"0.5786811",
"0.5757206",
"0.5712283",
"0.5699135",
"0.5699135",
"0.56662095",
"0.5633516",
"0.56331414",
"0.5632707",
"0.5603521",
"0.56013256",
"0.5595028"... | 0.0 | -1 |
validates :start_date, :presence => true validates :end_date, :presence => true | def current?
!start_date.nil? && (end_date.nil? || end_date > Date.today)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before t... | [
"0.8768662",
"0.8768662",
"0.85106343",
"0.84790975",
"0.84216523",
"0.8407901",
"0.8362189",
"0.83420205",
"0.82972103",
"0.82614017",
"0.81110376",
"0.80952454",
"0.80952454",
"0.807708",
"0.80548877",
"0.804479",
"0.8033768",
"0.799234",
"0.7969454",
"0.7960607",
"0.790846... | 0.0 | -1 |
GET /works GET /works.json | def index
@works = Work.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @works }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def all_works\n #start = numeric( params[:start], DEFAULT_START )\n #limit = numeric( params[:limit], DEFAULT_LIMIT )\n\n works = batched_get( {} )\n respond_to do |format|\n format.json do\n i... | [
"0.7593447",
"0.72769666",
"0.72711784",
"0.7182265",
"0.71102643",
"0.71102643",
"0.7047674",
"0.7041832",
"0.70329654",
"0.70329654",
"0.698592",
"0.6954507",
"0.68954045",
"0.6786843",
"0.6782489",
"0.67561126",
"0.6736578",
"0.67178315",
"0.6686987",
"0.66283953",
"0.6625... | 0.7964651 | 1 |
GET /works/1 GET /works/1.json | def show
@locations=@work.locations
map
respond_to do |format|
format.html # show.html.erb
format.json { render json: @work }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end",
"def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n... | [
"0.77681607",
"0.77681607",
"0.7337539",
"0.7337539",
"0.7274655",
"0.7250202",
"0.70975107",
"0.70936084",
"0.70882404",
"0.7059149",
"0.69210666",
"0.6906746",
"0.68945616",
"0.6868209",
"0.6868209",
"0.67656106",
"0.6708405",
"0.6655762",
"0.6639254",
"0.662724",
"0.662439... | 0.6173222 | 64 |
GET /works/new GET /works/new.json | def new
@work = Work.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @work }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n ... | [
"0.7975364",
"0.7949181",
"0.7949181",
"0.7544476",
"0.7452053",
"0.7348216",
"0.7335817",
"0.7293905",
"0.71847326",
"0.718286",
"0.71418506",
"0.7117379",
"0.7073043",
"0.7069727",
"0.7004255",
"0.6992778",
"0.6991903",
"0.69427204",
"0.6940422",
"0.69264424",
"0.6892451",
... | 0.7934851 | 3 |
POST /works POST /works.json | def create
@work = Work.new(params[:work].except(:extra_keys, :extra_values))
@work.extra = process_extra if params[:extra_keys]
current_dataset.works << @work
Work.create_locations(@work) if @work.places
respond_to do |format|
if @work.save
format.html { redirect_to @work, notice: 'Work was successfully created.' }
format.json { render json: @work, status: :created, location: @work }
else
format.html { render action: "new" }
format.json { render json: @work.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @work = Work.new(params[:work])\n\n respond_to do |format|\n if @work.save\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully created.' }}\n format.json { render json: @work, status: :created, location: @work }\n else\n format.... | [
"0.7088163",
"0.7052606",
"0.7052606",
"0.7019929",
"0.69990313",
"0.69580257",
"0.69580257",
"0.686494",
"0.68403333",
"0.68254054",
"0.6794479",
"0.6794479",
"0.6779949",
"0.6765766",
"0.6613553",
"0.6553939",
"0.6534692",
"0.6467813",
"0.6440691",
"0.64364225",
"0.63874805... | 0.6949028 | 7 |
PUT /works/1 PUT /works/1.json | def update
@work.extra = process_extra if params[:work][:extra_keys] && params[:work][:extra_keys]!= ""
respond_to do |format|
if @work.update_attributes(params[:work].except(:extra_keys, :extra_values))
Work.create_locations(@work) if @work.places#.changed?
Location.destroy_unused
format.html { redirect_to @work, notice: 'Work was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @work.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to action: 'index', flash: {notice: 'Work item was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { ren... | [
"0.66754544",
"0.660728",
"0.6429142",
"0.6389234",
"0.63811356",
"0.63810587",
"0.6367819",
"0.63580704",
"0.63580704",
"0.63580704",
"0.63580704",
"0.62920374",
"0.62443036",
"0.61780167",
"0.6166267",
"0.6152093",
"0.6134357",
"0.6118337",
"0.6102037",
"0.6093583",
"0.6080... | 0.6184863 | 13 |
DELETE /works/1 DELETE /works/1.json | def destroy
#controllare che le location che lascia non siano vuote
Work.check_n_destroy_locations(@work)
@work.destroy
respond_to do |format|
format.html { redirect_to url_for current_dataset }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.html { redirect_to works_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @work = Work.find(params[:id])\n @work.destroy\n\n respond_to do |format|\n format.h... | [
"0.7391999",
"0.7391999",
"0.7391999",
"0.7391999",
"0.737266",
"0.7142911",
"0.7125051",
"0.71064013",
"0.71064013",
"0.70951694",
"0.70608467",
"0.70608467",
"0.70608467",
"0.70608467",
"0.7048746",
"0.70331985",
"0.70024717",
"0.69983083",
"0.6982587",
"0.69468445",
"0.694... | 0.65384036 | 96 |
Build your say_hello method here | def greeting(name)
puts "Hello, #{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_hello\n\t'hello'\nend",
"def say_hello\n 'hello'\n end",
"def say_hello\n\tputs \"Bonjour!\"\nend",
"def say_hello(name, city, state)\r\n # Your Code Here\r\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\r\nend",
"def say_hello\nend",
"def say_hello thing_to_say\n puts \"H... | [
"0.7684631",
"0.7678715",
"0.76358366",
"0.76200134",
"0.7617163",
"0.7526862",
"0.7482173",
"0.7476293",
"0.74670416",
"0.74571234",
"0.74553204",
"0.74340284",
"0.74340284",
"0.74340284",
"0.7432822",
"0.74241775",
"0.742349",
"0.74183774",
"0.7403083",
"0.73961675",
"0.736... | 0.0 | -1 |
if the online order instance has no products, returns the total provided by Ordertotal (no shipping) otherwise, returns total provided by Ordertotal + $10 for shipping | def total
super
if @products.empty?
return super
else
return super + 10
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total\n total_no_shipping = super\n total = nil\n if total_no_shipping == 0\n total = 0\n else#total_no_shipping != 0\n total = total_no_shipping + 10\n end\n return total\n end",
"def total\n self.delivery_price +\n self.delivery_tax_amount +\n order_items.inject(... | [
"0.7598257",
"0.73474395",
"0.7330673",
"0.7317399",
"0.72927004",
"0.72453624",
"0.7087834",
"0.70385295",
"0.7018366",
"0.6950286",
"0.6917614",
"0.68665695",
"0.68374527",
"0.68349653",
"0.67990094",
"0.67963",
"0.67605966",
"0.6749183",
"0.6743507",
"0.6696094",
"0.669389... | 0.65396637 | 32 |
Define valid hexadecimal values | def generate_four_hexes
hexadecimals = 'abcdef0123456789'
rand_hexes = ''
4.times do |x|
rand_hexes << hexadecimals[rand(16)]
end
rand_hexes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex() end",
"def hexadecimal?\n # Both standard and shorthand (CSS) style hexadecimal color value.\n not cterm? and /\\A#?(?:[0-9a-f]{3}|[0-9a-f]{6})\\z/io.match(@value.to_s)\n end",
"def set_hex(clean_hex_str)\n @red = clean_hex_str[0, 2].to_i(16)\n @green = clean_hex_str[2, 2].to_i... | [
"0.73812795",
"0.7286691",
"0.68575186",
"0.6684513",
"0.66735476",
"0.66686666",
"0.6633199",
"0.65811485",
"0.6542079",
"0.65309393",
"0.65115124",
"0.6443698",
"0.64105195",
"0.6397716",
"0.6376746",
"0.63254696",
"0.63225234",
"0.63225234",
"0.6298576",
"0.6246508",
"0.62... | 0.0 | -1 |
Nodes Added (finds nodes in AW where version==1) | def number_of_new_nodes
{'New Nodes Added' => aw.node_added_count }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nodes\n if self.original_nodes.count == 0 and not new_record?\n self.save # Triggers callback of update_node\n end\n self.original_nodes\n end",
"def get_registered_nodes\n update_nodes\n @registered_nodes\n end",
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_ma... | [
"0.63365346",
"0.622395",
"0.61992544",
"0.61992544",
"0.61607844",
"0.61021644",
"0.60103834",
"0.5999755",
"0.5951833",
"0.5825141",
"0.57973486",
"0.57600474",
"0.5754352",
"0.5652469",
"0.56354684",
"0.56228226",
"0.5620612",
"0.56025285",
"0.556592",
"0.5554496",
"0.5530... | 0.6590132 | 1 |
Count the number of nodes edited by new mappers (those who created account during the aw) | def number_of_nodes_edited_by_new_mappers
nodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run
{'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_nodes_edited_by_experienced_mappers\n nodes_by_experienced_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.experienced_contributors}}).run\n {'Nodes Edited by Experienced Mappers' => nodes_by_experienced_mappers.first[:objects].length }\n end",
"def n... | [
"0.8214272",
"0.8214272",
"0.71829414",
"0.71829414",
"0.643785",
"0.62314045",
"0.6103351",
"0.60637754",
"0.59773695",
"0.59481984",
"0.59294236",
"0.5926083",
"0.5917741",
"0.59068274",
"0.5882205",
"0.5874247",
"0.586322",
"0.58547443",
"0.5832621",
"0.57997066",
"0.57322... | 0.8721325 | 1 |
Count the number of nodes edited by experienced mappers (those who had accounts before the aw) | def number_of_nodes_edited_by_experienced_mappers
nodes_by_experienced_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.experienced_contributors}}).run
{'Nodes Edited by Experienced Mappers' => nodes_by_experienced_mappers.first[:objects].length }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_nodes_edited_by_new_mappers\n \t\tnodes_by_new_mappers = Node_Query.new(analysis_window: aw, constraints: {'user' => {'$in' => aw.new_contributors}}).run\n {'Nodes Edited by New Mappers' => nodes_by_new_mappers.first[:objects].length }\n \tend",
"def number_of_nodes_edited_by_new_mappers\n ... | [
"0.8372792",
"0.8372792",
"0.652214",
"0.652214",
"0.61644244",
"0.6019544",
"0.6013423",
"0.59610736",
"0.58474",
"0.5818282",
"0.58096004",
"0.5807518",
"0.5802818",
"0.5802818",
"0.5802818",
"0.5788777",
"0.575141",
"0.5747009",
"0.574606",
"0.57366896",
"0.5680781",
"0.... | 0.8474294 | 1 |
Get the counts for nodes that are not a part of relations or ways | def singleton_nodes
all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.uniq
all_nodes_in_ways = Way_Query.new(analysis_window: aw).run.first[:objects].collect{|w| w.nodes}.flatten.uniq
# all_nodes_in_rels = Relation_Query.new(analysis_window: aw).run.first[:objects].collect{|r| r.nodes}.flatten.uniq
nodes_not_in_ways_or_rels = (all_node_ids - all_nodes_in_ways).length
puts "Total Nodes: #{all_node_ids.length}, Nodes not in ways or relations: #{nodes_not_in_ways_or_rels}"
puts "Percentage: #{nodes_not_in_ways_or_rels.to_f / all_node_ids.length.to_f}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_nonsense_nodes\n _clear_cache\n hash = {}\n self.each_node do |node|\n hash[node] = true if @pathway.graph[node].size == 2\n end\n hash.each_key do |node|\n adjs = @pathway.graph[node].keys\n edges = @pathway.graph[node].values\n new_edge = get_edge_m... | [
"0.6596682",
"0.64853853",
"0.63884145",
"0.6212811",
"0.6185454",
"0.61128056",
"0.61015505",
"0.60973597",
"0.6093575",
"0.60776937",
"0.60533315",
"0.60276556",
"0.6002992",
"0.6002992",
"0.59867126",
"0.5985495",
"0.5967808",
"0.59615296",
"0.59534544",
"0.5940806",
"0.59... | 0.66927713 | 0 |
GET /posts/1 GET /posts/1.json | def show
@post = Post.find(params[:id])
@user = @post.user
@comments = @post.comments
respond_to do |format|
format.html # show.html.erb
format.json { render json: @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
... | [
"0.77117836",
"0.73540246",
"0.7343923",
"0.73384964",
"0.7323458",
"0.7293848",
"0.7276783",
"0.7256915",
"0.7162477",
"0.71599144",
"0.7156261",
"0.7156261",
"0.71206903",
"0.7095526",
"0.7095526",
"0.7095526",
"0.7094604",
"0.70722955",
"0.7061599",
"0.7045983",
"0.7032826... | 0.0 | -1 |
GET /posts/new GET /posts/new.json | def new
@post = Post.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @post }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\... | [
"0.8041974",
"0.80156785",
"0.79855186",
"0.7931169",
"0.78988296",
"0.78666586",
"0.78468144",
"0.78327304",
"0.7832491",
"0.7822257",
"0.7780887",
"0.7681105",
"0.7630568",
"0.7627285",
"0.75908595",
"0.7578067",
"0.75370306",
"0.7530152",
"0.7473938",
"0.74487615",
"0.7443... | 0.79208946 | 27 |
PUT /posts/1 PUT /posts/1.json | def update
@post = Post.find(params[:id])
respond_to do |format|
if @post.update_attributes(params[:post])
format.html { redirect_to @post, notice: 'Post was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n title = params[:title]\n body ... | [
"0.7309282",
"0.71243113",
"0.6816402",
"0.664355",
"0.6619106",
"0.6606443",
"0.65831685",
"0.6565798",
"0.65536195",
"0.6531302",
"0.65128094",
"0.6488699",
"0.64477694",
"0.6433539",
"0.64167786",
"0.63868546",
"0.63833773",
"0.63669884",
"0.63658977",
"0.6364326",
"0.6362... | 0.6166721 | 65 |
GET /report_fields/1 GET /report_fields/1.xml | def show
@report_field = ReportField.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @report_field }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @report_field = ReportField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_field }\n end\n end",
"def show\n @report_field_template = ReportFieldTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.... | [
"0.67017",
"0.6478359",
"0.6152054",
"0.6020932",
"0.5962965",
"0.5933044",
"0.5933044",
"0.591766",
"0.5857987",
"0.5821544",
"0.58146423",
"0.5803105",
"0.5784296",
"0.5777077",
"0.57455015",
"0.57439995",
"0.57334113",
"0.57243633",
"0.57079715",
"0.57079715",
"0.5702247",... | 0.709934 | 0 |
GET /report_fields/new GET /report_fields/new.xml | def new
@report_field = ReportField.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @report_field }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @report_field_template = ReportFieldTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @report_field_template }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @... | [
"0.7882741",
"0.7356811",
"0.7356811",
"0.72900355",
"0.7111659",
"0.7111652",
"0.71018195",
"0.70430017",
"0.6942705",
"0.68529606",
"0.6841949",
"0.68359154",
"0.67354494",
"0.6706389",
"0.6654741",
"0.66104794",
"0.6608607",
"0.6608329",
"0.65933174",
"0.6589653",
"0.65624... | 0.81317717 | 0 |
POST /report_fields POST /report_fields.xml | def create
@report_field = ReportField.new(params[:report_field])
respond_to do |format|
if @report_field.save
format.html { redirect_to(@report_field, :notice => 'Report field was successfully created.') }
format.xml { render :xml => @report_field, :status => :created, :location => @report_field }
else
format.html { render :action => "new" }
format.xml { render :xml => @report_field.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_fields\n @screen = session.active_screen\n @report = Report.find(params[:id])\n\n params[:report] ||= {}\n params[:report][:fields] ||= []\n\n org_field_report = @report.fields_reports\n new_field_reports = params[:report][:fields]\n\n #remove not exist in new\n rem_field_report_ids... | [
"0.6318225",
"0.6206707",
"0.59982294",
"0.5984335",
"0.5878735",
"0.58616537",
"0.5856366",
"0.58388335",
"0.57947534",
"0.5789606",
"0.57413346",
"0.5737382",
"0.57279485",
"0.5723791",
"0.5721506",
"0.5695132",
"0.5683347",
"0.5672336",
"0.5672336",
"0.5670012",
"0.5656132... | 0.6544459 | 0 |
PUT /report_fields/1 PUT /report_fields/1.xml | def update
@report_field = ReportField.find(params[:id])
respond_to do |format|
if @report_field.update_attributes(params[:report_field])
format.html { redirect_to(@report_field, :notice => 'Report field was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @report_field.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @report_request = ReportRequest.find(params[:report_request][:id])\n @fields = params[:field_filter]\n\n @fields.each do |k, v|\n field_filter = @report_request.field_filter(k.to_i)\n field_filter.update_attributes(v)\n end\n \n respond_to do |format|\n format.html\n ... | [
"0.7057449",
"0.66359913",
"0.6492905",
"0.64305335",
"0.6240071",
"0.6182462",
"0.61775494",
"0.61376417",
"0.6116173",
"0.60696507",
"0.60518074",
"0.59987384",
"0.59832853",
"0.59512424",
"0.58394665",
"0.5822674",
"0.57928413",
"0.5724306",
"0.57006687",
"0.5686602",
"0.5... | 0.7047292 | 1 |
DELETE /report_fields/1 DELETE /report_fields/1.xml | def destroy
@report_field = ReportField.find(params[:id])
@report_field.destroy
respond_to do |format|
format.html { redirect_to(report_fields_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend",
"def destroy\n \n @report_field = @report_setup.report_fields.find(params[:id])\n @report_setup.remove_field(@report_field)\n\n return HESR... | [
"0.7090122",
"0.6759376",
"0.6748433",
"0.6705857",
"0.64638096",
"0.6442735",
"0.63763964",
"0.6298576",
"0.6286919",
"0.6286919",
"0.62739456",
"0.62674016",
"0.62661666",
"0.62661666",
"0.6225158",
"0.6215602",
"0.62014997",
"0.61964655",
"0.61964655",
"0.6194947",
"0.6145... | 0.7447525 | 0 |
Get the list of paths inside the directory | def get_filepaths(target_dir)
dirpaths = [target_dir + "/subnodes", target_dir + "/headnodes"]
filepaths = []
dirpaths.each do |dirpath|
Dir[dirpath+"/*"].each do |filepath|
filepaths << filepath
end
end
return filepaths
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n Dir.glob(\"#{@directory}/**/*\").reject(&File.directory?).map do |p|\n Pathname.new(p).relative_path_from(@directory)\n end\n end",
"def list\n Dir.glob(\"#{@path}/**/*\").select{|path| File.file?(path) }.map do |path|\n path.sub Regexp.new(\"^#{@path}\\... | [
"0.85098046",
"0.7983926",
"0.776324",
"0.7708049",
"0.7706787",
"0.7628569",
"0.75543326",
"0.74636316",
"0.7434752",
"0.74112576",
"0.7399241",
"0.7357893",
"0.7312576",
"0.7296792",
"0.7277693",
"0.7271048",
"0.7268602",
"0.72584915",
"0.7240925",
"0.72360337",
"0.7215018"... | 0.6977439 | 51 |
parse file and read relevant information from it | def get_node_from_file(filepath)
head_nodes_file = File.open(filepath,"r:UTF-16LE:UTF-8"){ |file| file.readlines }
lines_array = []
head_nodes_file.each do | line, i |
lines_array << line
end
# if /(\\)(.*)(\\)(.*)$/.match(head_nodes_file[0]) == nil
# node_type = "head"
# else
# node_type = "child"
# end
## get relevant nodes based on what type it is
head_nodes_file[0] == nil ? node = nil : node = /(Name: )(.*)/.match(head_nodes_file[0])[2].strip()
## get file name and reference number from line 2
head_nodes_file[2] == nil ? references = nil : references = /(§ )(\d)/.match(head_nodes_file[2])[2].to_i
## Get all references from in 3 line blocks
ref_array = []
### get the segment times from each reference
if references != nil
references.times do |i|
# ref = i+1
seg_line = 6+(i*4)
# puts head_nodes_file[seg_line]
# puts /(\[)(\d+:\d+.\d)/.match(head_nodes_file[seg_line])[2])
# puts seg_line
start_time = /(\[)(\d+:\d+.\d)/.match(head_nodes_file[seg_line])[2]
end_time = /(\d+:\d+.\d)(\])/.match(head_nodes_file[seg_line])[1]
ref_array << {"start_time": start_time, "end_time": end_time}
end
else
ref_array = nil
end
return {"filename": /^(.+)\/([^\/]+)$/.match(filepath)[2], "node": node, "segments": ref_array}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_file(filename); end",
"def parse_from_file filename\n parse File.open(filename)\n end",
"def parse_input(input_file); end",
"def parse_input(input_file); end",
"def parse(file)\n doc = Nokogiri::XML( File.open( file ) )\n @type = doc.xpath(\"/probe/header/@type\").to_s\n @ven... | [
"0.7569115",
"0.7406246",
"0.722304",
"0.722304",
"0.7092537",
"0.70140845",
"0.69805133",
"0.6954123",
"0.68765813",
"0.6806791",
"0.6806791",
"0.6806791",
"0.6806791",
"0.6806791",
"0.6806791",
"0.6787326",
"0.67753947",
"0.67576927",
"0.6738976",
"0.66760874",
"0.66030294"... | 0.0 | -1 |
Get all nodes from the supplied filepaths | def get_nodes(filepaths)
nodes = []
filepaths.each do |filepath|
node = get_node_from_file(filepath)
if node["segments"] != nil
nodes << node
end
end
return nodes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def /(*paths)\n NodeSet[paths.map { |path| xpath(path) }]\n end",
"def file_nodes\n @file_nodes ||= files.map { |file| create_node(file) }.compact\n end",
"def file_nodes\n @file_nodes ||= files.map { |file| create_node(file) }.compact\n end",
"def find_all_paths\n found_paths = []\n ... | [
"0.740601",
"0.700419",
"0.700419",
"0.69425946",
"0.6796159",
"0.6717918",
"0.622112",
"0.62169725",
"0.6206198",
"0.6191535",
"0.6177943",
"0.6152965",
"0.6145869",
"0.6132595",
"0.60528237",
"0.60476226",
"0.6041074",
"0.6037298",
"0.6018227",
"0.5997003",
"0.5993691",
"... | 0.804475 | 0 |
Ties it all together and saves the relevant objects to the database | def unpack_and_process_zip(zip_file)
Zip::File.open(zip_file) do |zipfile|
@zipfile = zipfile
folder_name = Time.now.strftime('%Y_%m_%d-%H_%M_%S')
destination_dir = Rails.root.to_s + "/tmp/uploads/zips/" + "#{folder_name}"
# Save files in directory
zipfile.each do |entry|
if /^[^_].*\/.*\/.*\.txt/.match(entry.name) != nil
puts "Extracting #{entry.name}"
f_path = File.join(destination_dir, entry.name)
FileUtils.mkdir_p(File.dirname(f_path))
zipfile.extract(entry, f_path) unless File.exist?(f_path)
end
end
# Get nodes from files
target_dir = File.join(destination_dir, "nodes")
filepaths = get_filepaths(target_dir)
@nodes = get_nodes(filepaths)
# Save nodes
# @recording is already in scope from controller
# @recording = Recording.find(params[:id])
@nodes.each do |tag|
@tag = Tag.new
@tagging = Tagging.new
### Set up the tag
@tag.name = tag[:node]
@tag = Tag.where(:name => @tag.name).first_or_create
## Now do the tagging
@tagging = Tagging.where(:taggable_id => @recording.id, :taggable_type => @recording.class.name, :tag_id => @tag.id).first_or_create
## Now do the segments
if tag[:segments]
@segments = tag[:segments]
@segments.each do |segment|
start_time = segment[:start_time]
end_time = segment[:end_time]
@segment = Segment.where(:recording_id => @recording.id, :start_time => start_time, :end_time => end_time, :name => @tag.name).first_or_create
## Tagging for segment
@tagging = Tagging.where(:taggable_id=> @segment.id, :taggable_type=> @segment.class.name, :tag_id => @tag.id).first_or_create
end
end
end
end
### Now save the recording to ensure that its got cached tags
@recording.save
### All done
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n objects.each do |object|\n object['request_id'] = request_id\n\n puts \"Processing object #{object}\"\n\n if object['id'].size > 11\n object['id'] = object['id'].split(//).last(11).join\n end\n\n next unless valid_object?(object)\n prepare_objects_... | [
"0.7052355",
"0.68525404",
"0.6773832",
"0.67555815",
"0.6733304",
"0.672638",
"0.67241967",
"0.67241967",
"0.67241967",
"0.67241967",
"0.67241967",
"0.67241967",
"0.67241967",
"0.67241967",
"0.670977",
"0.67035884",
"0.6687487",
"0.6599286",
"0.6567248",
"0.6567248",
"0.6567... | 0.0 | -1 |
GET /rating_reasons GET /rating_reasons.json | def index
@rating_reasons = RatingReason.order(:description).page params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reasons\n response[\"reasons\"]\n end",
"def create\n @rating_reason = RatingReason.new(rating_reason_params)\n\n respond_to do |format|\n if @rating_reason.save\n format.html { redirect_to @rating_reason, notice: 'Rating reason was successfully created.' }\n format.json ... | [
"0.64108825",
"0.6148299",
"0.61466134",
"0.6120967",
"0.6115576",
"0.5958787",
"0.59016013",
"0.57921207",
"0.56955206",
"0.5656206",
"0.5656206",
"0.5656206",
"0.565283",
"0.5611786",
"0.56102777",
"0.56102777",
"0.56102777",
"0.5555479",
"0.55486405",
"0.55170786",
"0.5492... | 0.6543928 | 0 |
GET /rating_reasons/1 GET /rating_reasons/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rating_reason\n @rating_reason = RatingReason.find(params[:id])\n end",
"def index\n @rating_reasons = RatingReason.order(:description).page params[:page]\n end",
"def rating\n response[\"rating\"]\n end",
"def create\n @rating_reason = RatingReason.new(rating_reason_params)\n\... | [
"0.6400011",
"0.63938546",
"0.6341913",
"0.6204058",
"0.61916244",
"0.6184488",
"0.6040009",
"0.6038196",
"0.6008064",
"0.6008064",
"0.6008064",
"0.59640604",
"0.5960299",
"0.5794828",
"0.57894343",
"0.57805645",
"0.57805645",
"0.57805645",
"0.56478924",
"0.5600198",
"0.56001... | 0.0 | -1 |
POST /rating_reasons POST /rating_reasons.json | def create
@rating_reason = RatingReason.new(rating_reason_params)
respond_to do |format|
if @rating_reason.save
format.html { redirect_to @rating_reason, notice: 'Rating reason was successfully created.' }
format.json { render :show, status: :created, location: @rating_reason }
else
format.html { render :new }
format.json { render json: @rating_reason.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rating_reason_params\n params.require(:rating_reason).permit(:description, :rating_type)\n end",
"def create\r\n rating = Rating.create(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n\r\n if rating.save\r\n render json: rating\r\n ... | [
"0.66336286",
"0.65473056",
"0.6193679",
"0.6181107",
"0.6150781",
"0.6094535",
"0.6049017",
"0.6038059",
"0.60340166",
"0.60141647",
"0.5988087",
"0.5954234",
"0.5950074",
"0.5900655",
"0.5884303",
"0.587284",
"0.58683133",
"0.5852736",
"0.5841068",
"0.5822944",
"0.57835627"... | 0.72556984 | 0 |
PATCH/PUT /rating_reasons/1 PATCH/PUT /rating_reasons/1.json | def update
respond_to do |format|
if @rating_reason.update(rating_reason_params)
format.html { redirect_to @rating_reason, notice: 'Rating reason was successfully updated.' }
format.json { render :show, status: :ok, location: @rating_reason }
else
format.html { render :edit }
format.json { render json: @rating_reason.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors... | [
"0.666167",
"0.6586431",
"0.6580293",
"0.65548146",
"0.64889127",
"0.64788187",
"0.6459215",
"0.6394283",
"0.6382502",
"0.6378838",
"0.6320322",
"0.62653595",
"0.616916",
"0.61431456",
"0.6135156",
"0.61293006",
"0.6111983",
"0.61095256",
"0.61079615",
"0.6103257",
"0.6083548... | 0.7284721 | 0 |
DELETE /rating_reasons/1 DELETE /rating_reasons/1.json | def destroy
@rating_reason.destroy
respond_to do |format|
format.html { redirect_to rating_reasons_url, notice: 'Rating reason was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rating.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @idea_rating.destroy\n respond_to do |format|\n format.html { redirect_to idea_ratings_url, notice: (I18n.t :act_delete) }\n format.json { head :no_content }\n ... | [
"0.7358601",
"0.71458375",
"0.7129402",
"0.71270174",
"0.71041346",
"0.7018322",
"0.69943124",
"0.69943124",
"0.6982677",
"0.69634813",
"0.68380725",
"0.68354315",
"0.68085265",
"0.677231",
"0.67673546",
"0.6747165",
"0.6735687",
"0.6717262",
"0.66776294",
"0.666508",
"0.6661... | 0.75054604 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_rating_reason
@rating_reason = RatingReason.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 rating_reason_params
params.require(:rating_reason).permit(:description, :rating_type)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
Track failed login attempts | def note_failed_signin
flash[:error] = "Não foi possível fazer seu login. Redigite seu e-mail e sua senha. As senhas do Cidade Democrática distinguem maiúsculas de minúsculas."
logger.warn "Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_login!\n @number_of_bad_logins = increment_bad_login_counter\n throttle_user if should_throttle?\n end",
"def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"... | [
"0.8288665",
"0.7961219",
"0.77037996",
"0.7341658",
"0.7305755",
"0.72876155",
"0.72876155",
"0.7263223",
"0.72473574",
"0.7188082",
"0.71714646",
"0.7148526",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.71... | 0.699336 | 30 |
Creates methods to read/write dependency | def call(dep, klass)
klass.send(:attr_accessor, dep.reader)
dep.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def direct_dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def create_reader\n return if source_model.resource_method_defined?(name.to_s)\n\n source_model.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{name}(query = nil) ... | [
"0.5639425",
"0.5573294",
"0.5573294",
"0.5573294",
"0.55085886",
"0.5502262",
"0.545927",
"0.54236406",
"0.53543276",
"0.5349103",
"0.53488636",
"0.5334702",
"0.53289825",
"0.52904683",
"0.52842534",
"0.5283983",
"0.5265016",
"0.5264294",
"0.5257875",
"0.525677",
"0.5254449"... | 0.0 | -1 |
Calls methods which will in turn print predicted deaths and speed of spread for a state, based on the data available in its instance variables | def virus_effects
predicted_deaths + speed_of_spread
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virus_effects\n # This is the beginning of object oriented design.\n predicted_deaths #(@population_density, @population, @state)\n speed_of_spread #(@population_density, @state)\n print_results\n end",
"def virus_effects\n predicted_deaths\n speed_of_spread\n print \"#{@state} will lose #... | [
"0.72704667",
"0.72467124",
"0.72011083",
"0.7180092",
"0.71747994",
"0.7107965",
"0.71036804",
"0.70912486",
"0.7086029",
"0.6999894",
"0.69842607",
"0.6980928",
"0.6961551",
"0.6961479",
"0.6958477",
"0.69424194",
"0.69340307",
"0.69298834",
"0.6926795",
"0.6926795",
"0.691... | 0.0 | -1 |
Takes the information for a state, and prints out a projection of the predicted deaths the virus will cause for that state | def predicted_deaths
# predicted deaths is solely based on population density
if @population_density >= 200
number_of_deaths = (@population * 0.4).floor
elsif @population_density >= 150
number_of_deaths = (@population * 0.3).floor
elsif @population_density >= 100
number_of_deaths = (@population * 0.2).floor
elsif @population_density >= 50
number_of_deaths = (@population * 0.1).floor
else
number_of_deaths = (@population * 0.05).floor
end
"#{@state} will lose #{number_of_deaths} people in this outbreak"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virus_effects\n # number_of_deaths = predicted_deaths\n # speed = speed_of_spread\n print \"#{@state} will lose #{predicted_deaths} people in this outbreak and will spread across the state in #{speed_of_spread} months.\\n\\n\"\n end",
"def predicted_deaths\n # predicted deaths is solely based on... | [
"0.75337523",
"0.75336885",
"0.75013185",
"0.7443176",
"0.7443176",
"0.74260545",
"0.7390296",
"0.73751384",
"0.736495",
"0.73194677",
"0.7318071",
"0.7310462",
"0.7308548",
"0.7306313",
"0.7305934",
"0.73004586",
"0.72650105",
"0.7258095",
"0.72356635",
"0.72356635",
"0.7235... | 0.0 | -1 |
Takes the information for a state, and prints out a projection of the speed at which the virus will spread across the state | def speed_of_spread #in months
# We are still perfecting our formula here. The speed is also affected
# by additional factors we haven't added into this functionality.
speed = 0.0
if @population_density >= 200
speed += 0.5
elsif @population_density >= 150
speed += 1
elsif @population_density >= 100
speed += 1.5
elsif @population_density >= 50
speed += 2
else
speed += 2.5
end
" and will spread across the state in #{speed} months.\n\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_state\n \tputs \"#{@name} a #{life_points} points de vie\"\n end",
"def show_state \n puts \"#{@name} a #{@life_points} points de vie et une arme au niveau #{@weapon_level}.\"\n end",
"def show_state\n puts \"#{@names} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n ... | [
"0.7020068",
"0.7008311",
"0.7002064",
"0.7001385",
"0.7001027",
"0.6972593",
"0.6965154",
"0.6949288",
"0.6948399",
"0.6908889",
"0.6893746",
"0.6888894",
"0.68874246",
"0.6886797",
"0.68844956",
"0.6872684",
"0.68625236",
"0.68364483",
"0.68250036",
"0.6796142",
"0.67681617... | 0.0 | -1 |
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger2.2.5/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger2.2.5 PassengerRuby /usr/bin/ruby1.8 creating this thing below may not be being run b/c it checks for the passenger.conf which isn't really a good test | def enable_passenger
unless @enable_passenger
installed_as_worker
has_package "build-essential"
has_package "apache2-prefork-dev"
has_gem_package "fastthread"
has_gem_package "passenger", :version => passenger_version
passenger_configs
has_exec "install_passenger_script" do
command "passenger-install-apache2-module --auto"
notifies get_exec("restart-apache2"), :run
requires get_exec("restart-apache2")
requires get_package("apache2")
requires get_gem_package("passenger")
not_if "test -e \#{node[:passenger_site][:passenger_module_path]}"
# creates lambda { "passenger_site[:passenger_module_path]" }
end
@enable_passenger = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_passenger\n passenger_config = find_passenger_config\n puts \"Using Passenger installation at: #{passenger_config}\"\n passenger_ruby_libdir = `#{passenger_config} about ruby-libdir`.strip\n require(\"#{passenger_ruby_libdir}/phusion_passenger\")\n PhusionPassenger.locate_director... | [
"0.7495348",
"0.65603924",
"0.619062",
"0.59855235",
"0.5854543",
"0.58455193",
"0.5813251",
"0.57105684",
"0.56858104",
"0.5654366",
"0.56394917",
"0.550989",
"0.54579175",
"0.53559834",
"0.50711334",
"0.50711334",
"0.50711334",
"0.5070542",
"0.50379145",
"0.4983071",
"0.493... | 0.7418858 | 1 |
GET /supplies_loans/1 GET /supplies_loans/1.json | def show
@supplies_loan = SuppliesLoan.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @supplies_loan }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n for... | [
"0.74265045",
"0.7028126",
"0.67761964",
"0.65393853",
"0.6385044",
"0.63195395",
"0.6185348",
"0.6173859",
"0.615681",
"0.6143534",
"0.6103255",
"0.61024606",
"0.6044658",
"0.6006542",
"0.59992886",
"0.5995779",
"0.5974976",
"0.5967528",
"0.5966067",
"0.5946897",
"0.59406847... | 0.76623017 | 0 |
GET /supplies_loans/new GET /supplies_loans/new.json | def new
@supplies_loan = SuppliesLoan.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @supplies_loan }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n fo... | [
"0.7742059",
"0.73320067",
"0.72038686",
"0.7112276",
"0.7104594",
"0.7104594",
"0.7064966",
"0.69920003",
"0.6978133",
"0.6956627",
"0.6956627",
"0.69430965",
"0.69429564",
"0.693173",
"0.6927658",
"0.6886705",
"0.6885992",
"0.6882497",
"0.68809605",
"0.68809605",
"0.6846284... | 0.7997525 | 0 |
POST /supplies_loans POST /supplies_loans.json | def create
@supplies_loan = SuppliesLoan.new(params[:supplies_loan])
@supply = Supply.find(@supplies_loan.supply_id)
@supply.stock_ini -= @supplies_loan.quantity
@supplies_loan.company_id = current_user.company_id
respond_to do |format|
if @supplies_loan.save
@supply.save
format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully created.' }
format.json { render json: @supplies_loan, status: :created, location: @supplies_loan }
else
format.html { render action: "new" }
format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.6774508",
"0.6423337",
"0.6004376",
"0.5896205",
"0.5859383",
"0.58536714",
"0.58336264",
"0.582698",
"0.5814011",
"0.5780923",
"0.5767883",
"0.5740206",
"0.56865907",
"0.5657558",
"0.56424767",
"0.56280696",
"0.5624527",
"0.5609238",
"0.56046385",
"0.55810267",
"0.5576898... | 0.6244359 | 2 |
PUT /supplies_loans/1 PUT /supplies_loans/1.json | def update
@supplies_loan = SuppliesLoan.find(params[:id])
respond_to do |format|
if @supplies_loan.update_attributes(params[:supplies_loan])
format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_providers_loan.update_attributes(params[:supplies_providers_loan])\n format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully upda... | [
"0.6740721",
"0.6202762",
"0.59052986",
"0.5809226",
"0.5754655",
"0.5708223",
"0.5663331",
"0.56453836",
"0.5642922",
"0.5604303",
"0.5592824",
"0.55767125",
"0.5576268",
"0.5573783",
"0.5565358",
"0.55583596",
"0.55577403",
"0.55577403",
"0.55475587",
"0.5547405",
"0.554230... | 0.7035142 | 0 |
DELETE /supplies_loans/1 DELETE /supplies_loans/1.json | def destroy
@supplies_loan = SuppliesLoan.find(params[:id])
@supplies_loan.destroy
respond_to do |format|
format.html { redirect_to supplies_loans_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n @supplies_providers_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_providers_loans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loan.destroy\n re... | [
"0.72861797",
"0.68461335",
"0.67448086",
"0.6684231",
"0.6657511",
"0.66485155",
"0.6633188",
"0.6619284",
"0.6619284",
"0.661623",
"0.661342",
"0.6611368",
"0.6611368",
"0.6611368",
"0.6609222",
"0.6606464",
"0.66044647",
"0.66010207",
"0.66005254",
"0.65863645",
"0.6583206... | 0.7604929 | 0 |
Return a new line item if no duplicates exist. Otherwise, return the duplicate line item with new quantity. | def add_line_item_to_order( variant )
duplicate_line_item = line_item_exists?( variant )
duplicate_line_item.quantity += 1 and return duplicate_line_item if duplicate_line_item
line_items.build :name => variant.good.name,
:price => variant.price,
:options => variant.option_values_to_s,
:sku => variant.sku
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_ite... | [
"0.6896395",
"0.6787482",
"0.6726764",
"0.67052823",
"0.66641724",
"0.6656313",
"0.66525567",
"0.66121817",
"0.6548679",
"0.6520597",
"0.6511673",
"0.648572",
"0.6465106",
"0.6401844",
"0.63849574",
"0.6368777",
"0.63677186",
"0.63147366",
"0.63027513",
"0.6280205",
"0.623844... | 0.7212428 | 0 |
we verify that the current admin has the ability to certify users | def can_certify
authorize! :certify, @registration
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_admin\n if current_user && current_user.admin\n logger.info \"[auth] Allowed for #{current_user.email}\"\n true\n else\n logger.info (\"[auth] Access Denied\")\n redirect_to new_user_session\n end\n end",
"def check_admin_user\n unless current_user && current_user.privi... | [
"0.79485995",
"0.77303845",
"0.76573724",
"0.7652946",
"0.75747913",
"0.756884",
"0.7528938",
"0.7496878",
"0.7489059",
"0.7483437",
"0.747937",
"0.74372894",
"0.74315894",
"0.742187",
"0.7402332",
"0.7382994",
"0.73412234",
"0.73235863",
"0.7306566",
"0.7288902",
"0.7276174"... | 0.0 | -1 |
Returns true if the message msg was a login or an unauthorized msg before a successful login. If the msg can be further processed by the TCPConnectionHandlerprocess method, false is returned. | def login_related(msg)
if Login === msg
if @connection.server.authenticator.allowed?(
msg.user_name, msg.password)
@connection.user_name = msg.user_name
@connection.send_msg(LoginOK.new)
@connection.room.add_connection @connection
else
@connection.send_msg(LoginWrong.new)
end
return true
elsif not @connection.authorized?
@connection.send_msg Kick.new(
"Unauthorized connections aren't allowed to send '#{msg.class}'!")
@connection.force_close
return true
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login?\n if session_code && session_token\n # check code exist at db.\n code_rec = get_code_rec(session_code, subject)\n return false unless code_rec\n # compare token\n code_rec.token == session_token\n else\n return false\n end\n end",
"def authok... | [
"0.6846368",
"0.67174816",
"0.67102873",
"0.67102873",
"0.67102873",
"0.64001757",
"0.6352684",
"0.6279493",
"0.6279493",
"0.6279493",
"0.6279493",
"0.6267214",
"0.61451864",
"0.6138692",
"0.60872686",
"0.60834825",
"0.6054314",
"0.60108083",
"0.60107094",
"0.5965128",
"0.595... | 0.76861805 | 0 |
Process the message msg_json, that has to be a JSON encoded string. | def process(msg_json)
msg = JSON.parse(msg_json)
Log.debug 'Proc: ' + msg_json
login_related(msg) and return
# Login for this connection was granted before
case msg
when Alive
@connection.alive
when Logout
@connection.room.remove_connection @connection
@connection.send_msg LoggedOut.new
@connection.force_close
when Go, ListDoors, Public
@connection.room.process(@connection, msg)
else
Log.warn "Didn't expect message '#{msg.class}': #{msg}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process\n {\n \"type\": \"message\",\n \"channel\": channel,\n \"text\": message\n }.to_json\n end",
"def handle_json_message(json)\n data = MultiJson.load(json, symbolize_keys: true)\n # Don't announce DISPATCH events since we log it on the same level\n ... | [
"0.71243113",
"0.68225694",
"0.6683263",
"0.64986086",
"0.6497783",
"0.6483578",
"0.63613486",
"0.63368595",
"0.63304967",
"0.63253516",
"0.62550426",
"0.62349653",
"0.62300503",
"0.6193563",
"0.61876893",
"0.61131257",
"0.6086704",
"0.60797423",
"0.6075315",
"0.60518336",
"0... | 0.6486676 | 5 |
dish (name, restaurant_id(optional), price, cost) 10 dishes per restaurant | def random_cost
rand(1..10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @restaurant = Restaurant.find(restaurant_id)\n @dishes = Dish.where(restaurant_id: restaurant_id).all\n end",
"def index\n @dishes = @restaurant.dishes\n end",
"def index\n @dish_ratings = DishRating.all\n end",
"def add_dish(list_of_dishes)\n list_of_dishes.each do |dish, qty|\... | [
"0.69381523",
"0.6536088",
"0.64816314",
"0.63268286",
"0.6299948",
"0.61337066",
"0.61320883",
"0.60869443",
"0.6000486",
"0.5979838",
"0.59604913",
"0.5944736",
"0.5944736",
"0.5944736",
"0.59292865",
"0.59097975",
"0.58535814",
"0.5839215",
"0.5821735",
"0.5812608",
"0.580... | 0.0 | -1 |
(from 0 to 65535). Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, "flood fill" the image. To perform a "flood fill", consider the starting pixel, plus any pixels connected 4directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4directionally to those pixels (also with the same color as the starting pixel), and so on. Replace the color of all of the aforementioned pixels with the newColor. At the end, return the modified image. Example 1: Input: image = [[1,1,1],[1,1,0],[1,0,1]] sr = 1, sc = 1, newColor = 2 Output: [[2,2,2],[2,2,0],[2,0,1]] Explanation: From the center of the image (with position (sr, sc) = (1, 1)), all pixels connected by a path of the same color as the starting pixel are colored with the new color. Note the bottom corner is not colored 2, because it is not 4directionally connected to the starting pixel. Note: The length of image and image[0] will be in the range [1, 50]. The given starting pixel will satisfy 0 <= sr < image.length and 0 <= sc < image[0].length. The value of each color in image[i][j] and newColor will be an integer in [0, 65535]. | def flood_fill(image, sr, sc, new_color)
queue = [[sr, sc]]
old_color = image[sr][sc]
until queue.empty? do
start = queue.pop
x, y = start
image[x][y] = new_color
queue << [x, y+1] if y+1 < image[x].length && image[x][y+1] == old_color
queue << [x, y-1] if y-1 >= 0 && image[x][y-1] == old_color
queue << [x+1, y] if x+1 < image.length && image[x+1][y] == old_color
queue << [x-1, y] if x-1 >= 0 && image[x-1][y] == old_color
end
image
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flood_fill(x, y, color)\n x_i, y_i = pixel_to_index(x, y)\n original_color = bitmap[y_i][x_i]\n flood_fill_helper(x, y, original_color, color)\n end",
"def floodfill(x, y, color)\n if @pixels[y-1][x-1] != color\n @pixels[y-1][x-1] = color\n floodfill(x+1, y, color)\n floodfill(x-1... | [
"0.720144",
"0.70694464",
"0.7062606",
"0.6929653",
"0.67364776",
"0.6302418",
"0.621556",
"0.6179859",
"0.6044709",
"0.6023015",
"0.59714526",
"0.5871398",
"0.5693701",
"0.5692818",
"0.56531537",
"0.55340147",
"0.55195665",
"0.5457676",
"0.5444117",
"0.54161936",
"0.54103273... | 0.8510763 | 0 |
`call` implements the Rack 1.x specification which accepts an `env` Hash and returns a three item tuple with the status code, headers, and body. Mapping your environment at a url prefix will serve all assets in the path. map "/assets" do run Sprockets::Environment.new end A request for `"/assets/foo/bar.js"` will search your environment for `"foo/bar.js"`. | def call(env)
start_time = Time.now.to_f
time_elapsed = lambda { ((Time.now.to_f - start_time) * 1000).to_i }
unless ALLOWED_REQUEST_METHODS.include? env['REQUEST_METHOD']
return method_not_allowed_response
end
msg = "Served asset #{env['PATH_INFO']} -"
# Extract the path from everything after the leading slash
full_path = Rack::Utils.unescape(env['PATH_INFO'].to_s.sub(/^\//, ''))
path = full_path
unless path.valid_encoding?
return bad_request_response(env)
end
# Strip fingerprint
if fingerprint = path_fingerprint(path)
path = path.sub("-#{fingerprint}", '')
end
# URLs containing a `".."` are rejected for security reasons.
if forbidden_request?(path)
return forbidden_response(env)
end
if fingerprint
if_match = fingerprint
elsif env['HTTP_IF_MATCH']
if_match = env['HTTP_IF_MATCH'][/"(\w+)"$/, 1]
end
if env['HTTP_IF_NONE_MATCH']
if_none_match = env['HTTP_IF_NONE_MATCH'][/"(\w+)"$/, 1]
end
# Look up the asset.
asset = find_asset(path)
# Fallback to looking up the asset with the full path.
# This will make assets that are hashed with webpack or
# other js bundlers work consistently between production
# and development pipelines.
if asset.nil? && (asset = find_asset(full_path))
if_match = asset.etag if fingerprint
fingerprint = asset.etag
end
if asset.nil?
status = :not_found
elsif fingerprint && asset.etag != fingerprint
status = :not_found
elsif if_match && asset.etag != if_match
status = :precondition_failed
elsif if_none_match && asset.etag == if_none_match
status = :not_modified
else
status = :ok
end
case status
when :ok
logger.info "#{msg} 200 OK (#{time_elapsed.call}ms)"
ok_response(asset, env)
when :not_modified
logger.info "#{msg} 304 Not Modified (#{time_elapsed.call}ms)"
not_modified_response(env, if_none_match)
when :not_found
logger.info "#{msg} 404 Not Found (#{time_elapsed.call}ms)"
not_found_response(env)
when :precondition_failed
logger.info "#{msg} 412 Precondition Failed (#{time_elapsed.call}ms)"
precondition_failed_response(env)
end
rescue Exception => e
logger.error "Error compiling asset #{path}:"
logger.error "#{e.class.name}: #{e.message}"
case File.extname(path)
when ".js"
# Re-throw JavaScript asset exceptions to the browser
logger.info "#{msg} 500 Internal Server Error\n\n"
return javascript_exception_response(e)
when ".css"
# Display CSS asset exceptions in the browser
logger.info "#{msg} 500 Internal Server Error\n\n"
return css_exception_response(e)
else
raise
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call!(env)\n @default_options.each { |k,v| env[k] ||= v }\n @env = env\n \n if (@request = Request.new(@env.dup.freeze)).for_sprockets?\n Response.new(@env.dup.freeze, @request.source.to_js).to_rack\n else\n @app.call(env)\n end\n end",
"def call(env)\n d... | [
"0.73374",
"0.6801305",
"0.66659635",
"0.6598347",
"0.65973556",
"0.65877205",
"0.6527578",
"0.6440925",
"0.64115703",
"0.6364864",
"0.634116",
"0.6338985",
"0.6332732",
"0.63234544",
"0.62705404",
"0.6194112",
"0.6193398",
"0.61804163",
"0.6169548",
"0.6142424",
"0.6050625",... | 0.6648843 | 3 |
Returns a 200 OK response tuple | def ok_response(asset, env)
if head_request?(env)
[ 200, headers(env, asset, 0), [] ]
else
[ 200, headers(env, asset, asset.length), asset ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ok(response)\n [200, headers, [response]]\n end",
"def create_success_response\n response = {\n body: {\n status: \"ok\"\n },\n status: 200\n }\n return response\n end",
"def ok_response\n {\n statusCode: 200,\n headers: {'Content-Type': 'application/json'},\n... | [
"0.7834317",
"0.7780099",
"0.7595329",
"0.7528107",
"0.7330633",
"0.7266486",
"0.7172",
"0.71355623",
"0.7113925",
"0.7113925",
"0.70596343",
"0.701571",
"0.680964",
"0.6790036",
"0.6744116",
"0.67430043",
"0.6702926",
"0.66918224",
"0.6690446",
"0.66480786",
"0.66343856",
... | 0.69967985 | 12 |
Returns a 304 Not Modified response tuple | def not_modified_response(env, etag)
[ 304, cache_headers(env, etag), [] ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_modified!\n body.close if body.respond_to?(:close)\n self.status = 304\n self.body = []\n NOT_MODIFIED_OMIT_HEADERS.each { |name| headers.delete(name) }\n nil\n end",
"def is_not_modified?\n @code == 304\n end",
"def last_modified(time)\n response['Last-Modified']... | [
"0.6988113",
"0.6962565",
"0.68850154",
"0.6773562",
"0.6721432",
"0.6656685",
"0.6470372",
"0.64020914",
"0.6344106",
"0.63035387",
"0.6192897",
"0.6140158",
"0.6136297",
"0.6119406",
"0.61182994",
"0.60511506",
"0.60408545",
"0.5992652",
"0.59129643",
"0.5900168",
"0.588721... | 0.77147406 | 0 |
Returns a 400 Forbidden response tuple | def bad_request_response(env)
if head_request?(env)
[ 400, { "content-type" => "text/plain", "content-length" => "0" }, [] ]
else
[ 400, { "content-type" => "text/plain", "content-length" => "11" }, [ "Bad Request" ] ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_denied\n [ 403, {'Content-Type' => 'text/plain', 'Content-Length' => '14'},\n ['Access denied.'] ]\n end",
"def forbidden\n respond_with 403\n end",
"def forbidden\n respond_with 403\n end",
"def forbidden_response(env)\n if head_request?(env)\n [ 4... | [
"0.7646742",
"0.7634883",
"0.76129365",
"0.75107235",
"0.74449533",
"0.7390841",
"0.7307552",
"0.7163367",
"0.7123292",
"0.71062493",
"0.70390725",
"0.7011402",
"0.6994287",
"0.6926831",
"0.6920139",
"0.68828017",
"0.68402034",
"0.6822413",
"0.68114394",
"0.6792389",
"0.67836... | 0.7058371 | 10 |
Returns a 403 Forbidden response tuple | def forbidden_response(env)
if head_request?(env)
[ 403, { "content-type" => "text/plain", "content-length" => "0" }, [] ]
else
[ 403, { "content-type" => "text/plain", "content-length" => "9" }, [ "Forbidden" ] ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_denied\n [ 403, {'Content-Type' => 'text/plain', 'Content-Length' => '14'},\n ['Access denied.'] ]\n end",
"def forbidden(response)\n Forbidden.new.tap { |exception| exception.response = response }\n end",
"def forbidden\n respond_with 403\n end",
"def forbidde... | [
"0.7975272",
"0.7736419",
"0.76756734",
"0.76410735",
"0.75872874",
"0.71999055",
"0.717647",
"0.70671767",
"0.70422834",
"0.7008958",
"0.6992803",
"0.6909886",
"0.6903923",
"0.6888445",
"0.68773025",
"0.6847919",
"0.679274",
"0.672341",
"0.6705158",
"0.66526955",
"0.66116667... | 0.79521406 | 1 |
Returns a 404 Not Found response tuple | def not_found_response(env)
if head_request?(env)
[ 404, { "content-type" => "text/plain", "content-length" => "0", "x-cascade" => "pass" }, [] ]
else
[ 404, { "content-type" => "text/plain", "content-length" => "9", "x-cascade" => "pass" }, [ "Not found" ] ]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found_response\n [404, {'Content-Type' => \"text/plain\", 'Content-Length' => \"9\"}, ['Not found']]\n end",
"def not_found_response\n [ 404, { \"Content-Type\" => \"text/plain\", \"Content-Length\" => \"9\", \"X-Cascade\" => \"pass\" }, [ \"Not found\" ] ]\n end",
"def not_found(respon... | [
"0.85607773",
"0.84133726",
"0.83347017",
"0.77289104",
"0.7647753",
"0.7647753",
"0.7647753",
"0.76468384",
"0.76303375",
"0.7581362",
"0.7576452",
"0.7481595",
"0.7466802",
"0.7464614",
"0.7414132",
"0.73831487",
"0.73509055",
"0.73226464",
"0.73011595",
"0.7294756",
"0.728... | 0.80762947 | 3 |
Returns a JavaScript response that rethrows a Ruby exception in the browser | def javascript_exception_response(exception)
err = "#{exception.class.name}: #{exception.message}\n (in #{exception.backtrace[0]})"
body = "throw Error(#{err.inspect})"
[ 200, { "content-type" => "application/javascript", "content-length" => body.bytesize.to_s }, [ body ] ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def javascript_prologue\n 'throw \"error\";'\n end",
"def handle_uncaught_exception(exception)\n if request.format == :js\n report_error(exception)\n flash.now[:error] = Rails.env.development? ? exception.message : I18n.t('errors.unknown')\n render 'layouts/uncaught_error.js'\n else\n ... | [
"0.6797564",
"0.65123045",
"0.6420131",
"0.6399521",
"0.6383661",
"0.6263249",
"0.6236751",
"0.6164791",
"0.6137488",
"0.60966843",
"0.6059411",
"0.60096115",
"0.60093546",
"0.59283704",
"0.59036505",
"0.5894967",
"0.5890879",
"0.58894765",
"0.58805627",
"0.58789825",
"0.5862... | 0.81018996 | 0 |
Returns a CSS response that hides all elements on the page and displays the exception | def css_exception_response(exception)
message = "\n#{exception.class.name}: #{exception.message}"
backtrace = "\n #{exception.backtrace.first}"
body = <<-CSS
html {
padding: 18px 36px;
}
head {
display: block;
}
body {
margin: 0;
padding: 0;
}
body > * {
display: none !important;
}
head:after, body:before, body:after {
display: block !important;
}
head:after {
font-family: sans-serif;
font-size: large;
font-weight: bold;
content: "Error compiling CSS asset";
}
body:before, body:after {
font-family: monospace;
white-space: pre-wrap;
}
body:before {
font-weight: bold;
content: "#{escape_css_content(message)}";
}
body:after {
content: "#{escape_css_content(backtrace)}";
}
CSS
[ 200, { "content-type" => "text/css; charset=utf-8", "content-length" => body.bytesize.to_s }, [ body ] ]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hide_message\n # todo - mark the message as read\n render :update do |page|\n page.visual_effect :fade, \"marketing\"\n end\n end",
"def hide\n @notice.display(false)\n end",
"def exception_renderer; end",
"def hideElements \n @hideElements.each do |element|\n element.hide\... | [
"0.5899046",
"0.570788",
"0.5683194",
"0.55499476",
"0.55491996",
"0.554038",
"0.55319643",
"0.5527378",
"0.5475665",
"0.54627705",
"0.54400164",
"0.5438993",
"0.54374593",
"0.5409887",
"0.54020804",
"0.5396586",
"0.5396586",
"0.5394467",
"0.5393887",
"0.53215164",
"0.5308579... | 0.6568818 | 0 |
Escape special characters for use inside a CSS content("...") string | def escape_css_content(content)
content.
gsub('\\', '\\\\005c ').
gsub("\n", '\\\\000a ').
gsub('"', '\\\\0022 ').
gsub('/', '\\\\002f ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape_css(string); end",
"def escape(content)\n return content if content.html_safe?\n content.gsub(/[&><\"]/) { |char| ESCAPE_SEQUENCE[char] }\n end",
"def escape_content\n content.to_s.gsub(/&/, \"&\").gsub(/\\\"/, \""\").gsub(/>/, \">\").gsub(/</, \"<\") \n end... | [
"0.7984677",
"0.706124",
"0.6726479",
"0.6541266",
"0.6407304",
"0.6361772",
"0.636166",
"0.636166",
"0.63456094",
"0.6267945",
"0.6192881",
"0.61866564",
"0.6174253",
"0.6165465",
"0.61347127",
"0.6128127",
"0.61039907",
"0.61012864",
"0.608002",
"0.60479414",
"0.60364974",
... | 0.84356433 | 0 |
Gets ETag fingerprint. "foo0aa2105d29558f3eb790d411d7d8fb66.js" => "0aa2105d29558f3eb790d411d7d8fb66" | def path_fingerprint(path)
path[/-([0-9a-zA-Z]{7,128})\.[^.]+\z/, 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def etag\n headers['ETag']\n end",
"def etag\n stat = ::File.stat(@path)\n '\"' + Digest::SHA1.hexdigest(stat.ino.to_s + stat.size.to_s + stat.mtime.to_s) + '\"'\n end",
"def etag\n version = environment_version\n\n if version && version != \"\"\n DigestUtils.h... | [
"0.64862925",
"0.64433813",
"0.64143693",
"0.63614064",
"0.63614064",
"0.6303991",
"0.62888104",
"0.62372357",
"0.6222516",
"0.6204838",
"0.6035104",
"0.60080147",
"0.59918654",
"0.59053767",
"0.5889761",
"0.58814895",
"0.5864182",
"0.5859631",
"0.5809773",
"0.5776818",
"0.57... | 0.57961786 | 19 |
string If set, this string in the destination path will be replaced with the value in `destination_replace_to`. | def destination_replace_from
@attributes[:destination_replace_from]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_replace_to\n @attributes[:destination_replace_to]\n end",
"def destination_format_string=(format_string)\n @destination_format_string = format_string\n end",
"def destination=(d)\n raise ArgumentError, \"destination must be a string\" unless d.is_a?(String)\n @destination ... | [
"0.6691371",
"0.64220506",
"0.6343425",
"0.59865975",
"0.58498436",
"0.5818002",
"0.57393885",
"0.56624955",
"0.5634276",
"0.561401",
"0.5590412",
"0.5583411",
"0.5467287",
"0.54394263",
"0.542428",
"0.542428",
"0.542428",
"0.54032516",
"0.53643805",
"0.5359778",
"0.5347662",... | 0.6113456 | 3 |
string If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here. | def destination_replace_to
@attributes[:destination_replace_to]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destination_replace_from\n @attributes[:destination_replace_from]\n end",
"def destination_format_string=(format_string)\n @destination_format_string = format_string\n end",
"def destination\n @_destination ||= \"#{@rf['project_id']}/#{@rf['booking_id']}/\"\\\n \"#{base_filename... | [
"0.6500772",
"0.6464828",
"0.6224427",
"0.60433984",
"0.5976483",
"0.58279014",
"0.57192546",
"0.56953514",
"0.56561244",
"0.56369704",
"0.5620567",
"0.56151533",
"0.5605233",
"0.5530385",
"0.55127084",
"0.5487542",
"0.53846437",
"0.53729063",
"0.5314399",
"0.5292075",
"0.527... | 0.6543974 | 0 |
string How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end` | def interval
@attributes[:interval]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def period_in_words\n case recurring_month\n when 12\n 'yearly'\n when 1\n 'monthly'\n when 0\n \"once\"\n else\n \"every #{recurring_month} months\"\n end\n end",
"def runtime\n details.at(\"div.subtext time[itemprop='duration']\")['datetime'].gsub(/[^\\d+]/, '').to_i... | [
"0.6188403",
"0.59400356",
"0.5919274",
"0.5894139",
"0.5799428",
"0.5774056",
"0.5752598",
"0.5746092",
"0.5736628",
"0.5688664",
"0.5647106",
"0.5640155",
"0.5634566",
"0.5634566",
"0.56151843",
"0.5598606",
"0.55870503",
"0.55870503",
"0.55870503",
"0.555289",
"0.5491782",... | 0.0 | -1 |
string Date this automation will next run. | def next_process_on
@attributes[:next_process_on]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date\n\t\t@date = Date.today.to_s\n\tend",
"def date\n Time.now\n end",
"def get_date_scraped\n\n return Date.today.to_s\n\nend",
"def get_date_scraped\n\n return Date.today.to_s\n\nend",
"def date\n now.to_date\n end",
"def current_date()\r\n return Time.new.strftime(\"%... | [
"0.7109087",
"0.70863235",
"0.6898836",
"0.6898836",
"0.6897634",
"0.68481827",
"0.6832713",
"0.6832713",
"0.6826579",
"0.6826579",
"0.6826579",
"0.6826579",
"0.67848605",
"0.6731494",
"0.67154855",
"0.67154855",
"0.6698644",
"0.6692529",
"0.66892123",
"0.6661392",
"0.6651767... | 0.0 | -1 |
string Path on which this Automation runs. Supports globs. This must be slashdelimited, but it must neither start nor end with a slash. Maximum of 5000 characters. | def path
@attributes[:path]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob\n \"**/*\"\n end",
"def path_as_r_glob\n path.map {|p| \"#{p}/**/#{self.base_as_r}\"}\n end",
"def escape_path_for_glob(path)\n result = path.to_s\n characters_to_escape = ['[', ']', '{', '}', '?', '*']\n characters_to_escape.each do |character|\n result.gsub!... | [
"0.63111377",
"0.63067156",
"0.6237693",
"0.61888844",
"0.60716367",
"0.59795785",
"0.59392613",
"0.59267807",
"0.59228504",
"0.59004736",
"0.58972776",
"0.58155024",
"0.57221305",
"0.57183486",
"0.5669316",
"0.56371874",
"0.56313926",
"0.5625642",
"0.562328",
"0.55837727",
"... | 0.0 | -1 |
boolean Does this automation run in real time? This is a readonly property based on automation type. | def realtime
@attributes[:realtime]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_running?\n @running\n end",
"def running?\n @is_running\n end",
"def is_running?\n return @running\n end",
"def running?\n @running\n end",
"def running?\n @running\n end",
"def running?\n @running\n end",
"def running?\n @running\n end",
"def running?\n ... | [
"0.7108667",
"0.70057094",
"0.6964951",
"0.6943444",
"0.6943444",
"0.69246864",
"0.69246864",
"0.69246864",
"0.69246864",
"0.69246864",
"0.69246864",
"0.69246864",
"0.6871445",
"0.68599415",
"0.6827679",
"0.6805068",
"0.6805068",
"0.6805068",
"0.6805068",
"0.6790008",
"0.6783... | 0.0 | -1 |
int64 User ID of the Automation's creator. | def user_id
@attributes[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creator_id\n return @creator_id\n end",
"def creator_id=(value)\n @creator_id = value\n end",
"def creator_id # :nodoc:\n @creator_id.dup\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def creator # :nodoc:\n... | [
"0.7598425",
"0.7441381",
"0.7332096",
"0.7256513",
"0.72389436",
"0.7123367",
"0.70652705",
"0.7038212",
"0.6951215",
"0.6948477",
"0.6896723",
"0.6863969",
"0.6863969",
"0.68454516",
"0.68154174",
"0.6802832",
"0.6797746",
"0.6781301",
"0.6774155",
"0.67405146",
"0.67362094... | 0.0 | -1 |
array IDs of Users for the Automation (i.e. who to Request File from) | def user_ids
@attributes[:user_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def get_user_ids\n @assigned_lawfirm_users.map(&:id)\n end",
"def userids\n metadata[\"userids\"]\n ... | [
"0.7596544",
"0.74327326",
"0.74037296",
"0.71778214",
"0.71614844",
"0.7139272",
"0.7129231",
"0.70670235",
"0.70271116",
"0.69887096",
"0.6970369",
"0.6898027",
"0.675344",
"0.6687073",
"0.6684329",
"0.66645074",
"0.6640893",
"0.6631865",
"0.66285956",
"0.660854",
"0.660851... | 0.7101637 | 9 |
array IDs of Groups for the Automation (i.e. who to Request File from) | def group_ids
@attributes[:group_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_ids\n groups.map{|g| g.id}\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",
"def group_ids\n groups.pluck(:id)\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n ... | [
"0.7521913",
"0.7331384",
"0.71343404",
"0.7079821",
"0.68550307",
"0.68177545",
"0.681123",
"0.6767725",
"0.66407406",
"0.6602606",
"0.6539312",
"0.648451",
"0.6455463",
"0.6452134",
"0.6435152",
"0.64208275",
"0.6398785",
"0.6392913",
"0.63814753",
"0.637707",
"0.63541454",... | 0.69701785 | 6 |
Parameters: automation (required) string Type of automation. One of: `create_folder`, `request_file`, `request_move` source string Source Path destination string Destination Path destination_replace_from string If set, this string in the destination path will be replaced with the value in `destination_replace_to`. destination_replace_to string If set, this string will replace the value `destination_replace_from` in the destination filename. You can use special patterns here. interval string How often to run this automation? One of: `day`, `week`, `week_end`, `month`, `month_end`, `quarter`, `quarter_end`, `year`, `year_end` path string Path on which this Automation runs. Supports globs. user_ids string A list of user IDs the automation is associated with. If sent as a string, it should be commadelimited. group_ids string A list of group IDs the automation is associated with. If sent as a string, it should be commadelimited. | def update(params = {})
params ||= {}
params[:id] = @attributes[:id]
raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id]
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params.dig(:id) and !params.dig(:id).is_a?(Integer)
raise InvalidParameterError.new("Bad parameter: automation must be an String") if params.dig(:automation) and !params.dig(:automation).is_a?(String)
raise InvalidParameterError.new("Bad parameter: source must be an String") if params.dig(:source) and !params.dig(:source).is_a?(String)
raise InvalidParameterError.new("Bad parameter: destination must be an String") if params.dig(:destination) and !params.dig(:destination).is_a?(String)
raise InvalidParameterError.new("Bad parameter: destination_replace_from must be an String") if params.dig(:destination_replace_from) and !params.dig(:destination_replace_from).is_a?(String)
raise InvalidParameterError.new("Bad parameter: destination_replace_to must be an String") if params.dig(:destination_replace_to) and !params.dig(:destination_replace_to).is_a?(String)
raise InvalidParameterError.new("Bad parameter: interval must be an String") if params.dig(:interval) and !params.dig(:interval).is_a?(String)
raise InvalidParameterError.new("Bad parameter: path must be an String") if params.dig(:path) and !params.dig(:path).is_a?(String)
raise InvalidParameterError.new("Bad parameter: user_ids must be an String") if params.dig(:user_ids) and !params.dig(:user_ids).is_a?(String)
raise InvalidParameterError.new("Bad parameter: group_ids must be an String") if params.dig(:group_ids) and !params.dig(:group_ids).is_a?(String)
raise MissingParameterError.new("Parameter missing: id") unless params.dig(:id)
raise MissingParameterError.new("Parameter missing: automation") unless params.dig(:automation)
Api.send_request("/automations/#{@attributes[:id]}", :patch, params, @options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def automation_id=(value)\n @automation_id = value\n end",
"def file_upload_using_r_automation (filepath,window_title=nil)\n\n if window_title.nil?\n if @params and @params['browser'] != nil\n browser_type = @params['browser']\n else\n fail(\"Failed unrecognized browser... | [
"0.51406336",
"0.4975808",
"0.47807488",
"0.47510847",
"0.46828023",
"0.46108678",
"0.46108678",
"0.44946936",
"0.44349116",
"0.44308856",
"0.44206378",
"0.43518767",
"0.43334466",
"0.42580503",
"0.42539045",
"0.4240938",
"0.42152762",
"0.41962224",
"0.41840428",
"0.41664177",
... | 0.5290776 | 0 |
GET /case_studies/1 GET /case_studies/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n ... | [
"0.7604283",
"0.7395156",
"0.7370141",
"0.7065706",
"0.6997034",
"0.6994038",
"0.6939345",
"0.68732303",
"0.6845814",
"0.68452924",
"0.6760769",
"0.6726029",
"0.66042423",
"0.66032386",
"0.6581288",
"0.6539361",
"0.65308595",
"0.64426976",
"0.64426976",
"0.6431035",
"0.636596... | 0.0 | -1 |
POST /case_studies POST /case_studies.json | def create
@case_study = CaseStudy.new(case_study_params)
respond_to do |format|
action_message_for('new')
if create_case_study
format.html { redirect_to redirect_target(@case_study), flash: @feedback_flash }
format.json { render :show, status: :created, location: @case_study }
else
format.html { render :new }
format.json { render json: @case_study.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @study_case = StudyCase.new(study_case_params)\n\n if @study_case.save\n render :show, status: :created\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def create\n @case_study = CaseStudy.new(case_study_params)\n\n respond_to do |f... | [
"0.73487103",
"0.7223041",
"0.72036403",
"0.6855472",
"0.67788166",
"0.6672859",
"0.66121024",
"0.6391108",
"0.63402647",
"0.6306418",
"0.6233425",
"0.6194894",
"0.61210406",
"0.6113811",
"0.6113811",
"0.61130214",
"0.6111078",
"0.60913277",
"0.60826606",
"0.605765",
"0.60163... | 0.6548004 | 7 |
PATCH/PUT /case_studies/1 PATCH/PUT /case_studies/1.json | def update
respond_to do |format|
action_message_for(@case_study.content_item.status)
if update_case_study
format.html { redirect_to redirect_target(@case_study), flash: @feedback_flash }
format.json { render :show, status: :ok, location: @case_study }
else
@case_study.content_item.status = session[:content_item_status]
format.html { render :edit }
format.json { render json: @case_study.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def update\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attribu... | [
"0.73327094",
"0.713397",
"0.71233934",
"0.7103722",
"0.7103722",
"0.6983629",
"0.6750975",
"0.67494017",
"0.6701353",
"0.6510868",
"0.6364692",
"0.6324043",
"0.6277685",
"0.6275242",
"0.62278765",
"0.6210228",
"0.61786765",
"0.61786765",
"0.61786765",
"0.61574525",
"0.615492... | 0.0 | -1 |
DELETE /case_studies/1 DELETE /case_studies/1.json | def destroy
@case_study.destroy
respond_to do |format|
format.html { redirect_to :delete, flash: { message: 'Case study was successfully deleted.' } }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respo... | [
"0.7973681",
"0.7972713",
"0.7826727",
"0.7680591",
"0.7669685",
"0.7669685",
"0.75907934",
"0.73891556",
"0.73891556",
"0.7385382",
"0.73201984",
"0.73029745",
"0.7283339",
"0.7210857",
"0.717726",
"0.7104044",
"0.70635974",
"0.70597076",
"0.7059214",
"0.70437837",
"0.702958... | 0.7717751 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_case_study
@case_study = CaseStudy.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.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def case_study_params
params.require(:case_study).permit(:subtype,
:body_content,
:quote,
:quote_attribution,
:featured_image,
:featured_image_alt,
:featured_image_caption,
:object_title,
:object_embed_code,
:call_to_action_type,
:call_to_action_label,
:call_to_action_content,
:call_to_action_reason,
:contact_name,
:contact_email,
:contact_phone,
:last_published_version,
content_item_attributes: [:id,
:as_a,
:i_need,
:so_that,
:title,
:summary,
:status,
:organisation_id,
associated_org_ids: [],
label_ids: []]
)
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 |
Creates a new SmartOS infrastructure project | def perform(args)
opts = Slop.parse!(args) do
banner (<<-eos
Usage:
smartos new <name>
Description:
Creates a new SmartOS virtual infrastructure project.
Asks some questions about the topology of your network and then creates configuration
files to prepare your Global Zone. After this command has run, use 'smartos generate'
to generate VM definitions. And finally, run 'smartos up' to actaully create your VMs.
eos
).strip_indent
end
if args.size != 1
say opts
exit
end
new_project(args.first)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name... | [
"0.73550034",
"0.7303497",
"0.69944227",
"0.68460345",
"0.68095064",
"0.6797321",
"0.6763972",
"0.6730337",
"0.67056006",
"0.66985947",
"0.66793865",
"0.66396016",
"0.6611806",
"0.65320367",
"0.65182745",
"0.64440095",
"0.641434",
"0.6389167",
"0.63878846",
"0.6367293",
"0.63... | 0.7095085 | 2 |
Creates a new SmartOS infrastructure project | def new_project(name)
path = File.expand_path(name)
if Dir.exist?(path)
say "#{path} already exists. Please choose a directory name that doesn't already exist.".red
exit
end
@gz_info = new_global_zone
@gz_info.serialize(path)
say "You have now configured your SmartOS virtual infrastructure. Inspect it, then run "\
"'smartos up' to build it!".green
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n name = shift_argument\n unless name\n error(\"Usage: mortar projects:create PROJECTNAME\\nMust specify PROJECTNAME\")\n end\n\n args = [name,]\n is_public = false \n if options[:public]\n is_public= true\n ask_public(is_public)\n end \n validate_project_name(name... | [
"0.73563874",
"0.7096025",
"0.6996222",
"0.6846292",
"0.68109053",
"0.6799541",
"0.67650557",
"0.67328644",
"0.67064244",
"0.6699129",
"0.6679023",
"0.66408324",
"0.6612795",
"0.65335655",
"0.6520443",
"0.64451766",
"0.6414412",
"0.6389195",
"0.6388626",
"0.63685",
"0.634802"... | 0.7303828 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.