query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Connects to the database. In addition to the standard database options, using the :encoding or :charset option changes the client encoding for the connection, :connect_timeout is a connection timeout in seconds, :sslmode sets whether postgres's sslmode, and :notice_receiver handles server notices in a proc. :connect_ti... | def connect(server)
opts = server_opts(server)
if USES_PG
connection_params = {
:host => opts[:host],
:port => opts[:port] || 5432,
:dbname => opts[:database],
:user => opts[:user],
:password => opts[:password],
:connect_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :sslmode => sslmode, :dbname => dbname)\n end",
"def initialize options\n host = options['host'] || 'localhost'\n port = options['port'] || 5432\n database = options['database']\n ... | [
"0.73320276",
"0.70448613",
"0.7007973",
"0.69815606",
"0.6863588",
"0.6848689",
"0.6848689",
"0.68261606",
"0.6744137",
"0.67378205",
"0.67165136",
"0.66200817",
"0.6610611",
"0.6599768",
"0.6572738",
"0.6564431",
"0.6520831",
"0.65082985",
"0.6462121",
"0.6445565",
"0.63426... | 0.7335289 | 0 |
Set whether to allow infinite timestamps/dates. Make sure the conversion proc for date reflects that setting. | def convert_infinite_timestamps=(v)
@convert_infinite_timestamps = case v
when Symbol
v
when 'nil'
:nil
when 'string'
:string
when 'float'
:float
when String
typecast_value_boolean(v)
else
false
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typecast_value_date(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end",
"def infinite_timestamp_value(value)\n case c... | [
"0.66383576",
"0.6420522",
"0.62761325",
"0.601918",
"0.5762987",
"0.5707895",
"0.5591486",
"0.55315447",
"0.5378172",
"0.5378172",
"0.5294206",
"0.52896124",
"0.5235742",
"0.521018",
"0.506912",
"0.5042014",
"0.4996655",
"0.49401912",
"0.49288452",
"0.49236864",
"0.49205405"... | 0.75502497 | 0 |
+copy_into+ uses PostgreSQL's +COPY FROM STDIN+ SQL statement to do very fast inserts into a table using input preformatting in either CSV or PostgreSQL text format. This method is only supported if pg 0.14.0+ is the underlying ruby driver. This method should only be called if you want results returned to the client. I... | def copy_into(table, opts=OPTS)
data = opts[:data]
data = Array(data) if data.is_a?(String)
if block_given? && data
raise Error, "Cannot provide both a :data option and a block to copy_into"
elsif !block_given? && !data
raise Error, "Must provide either a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_from path_or_io, options = {}\n options = { delimiter: \",\", format: :csv, header: true, quote: '\"' }.merge(options)\n options[:delimiter] = \"\\t\" if options[:format] == :tsv\n options_string = if options[:format] == :binary\n \"BINARY\"\n ... | [
"0.7032002",
"0.6770422",
"0.66057664",
"0.6383086",
"0.62767667",
"0.60340726",
"0.58851403",
"0.5839566",
"0.5807533",
"0.57698584",
"0.57081026",
"0.5655016",
"0.5653409",
"0.5566205",
"0.5379597",
"0.5323078",
"0.5316464",
"0.5315271",
"0.5310676",
"0.52876455",
"0.517848... | 0.7367899 | 0 |
Listens on the given channel (or multiple channels if channel is an array), waiting for notifications. After a notification is received, or the timeout has passed, stops listening to the channel. Options: :after_listen :: An object that responds to +call+ that is called with the underlying connection after the LISTEN s... | def listen(channels, opts=OPTS, &block)
check_database_errors do
synchronize(opts[:server]) do |conn|
begin
channels = Array(channels)
channels.each do |channel|
sql = "LISTEN ".dup
dataset.send(:identifier_append, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen_to_channel(connection, channel, &block)\n connection.execute(\"LISTEN #{channel}\")\n\n loop do\n connection.raw_connection.wait_for_notify(10) do |event, pid, payload|\n return if yield payload\n end\n end\n ensure\n connection.execute(\"UNLISTEN *\")\n end",
"def notif... | [
"0.734112",
"0.61051863",
"0.60600615",
"0.5844702",
"0.5599413",
"0.5572211",
"0.55013776",
"0.5444815",
"0.5353724",
"0.5312384",
"0.52903867",
"0.52607447",
"0.5257268",
"0.5238882",
"0.522982",
"0.5066929",
"0.5061401",
"0.4985596",
"0.4924846",
"0.49017558",
"0.48918104"... | 0.6936913 | 1 |
Execute the given SQL string or prepared statement on the connection object. | def _execute(conn, sql, opts, &block)
if sql.is_a?(Symbol)
execute_prepared_statement(conn, sql, opts, &block)
else
conn.execute(sql, opts[:arguments], &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(sql, opts=OPTS, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n elsif sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n ... | [
"0.7445554",
"0.7422908",
"0.7357486",
"0.7246502",
"0.7226507",
"0.71983963",
"0.71972597",
"0.71766317",
"0.71016574",
"0.70863456",
"0.7083009",
"0.70563096",
"0.7035786",
"0.70321035",
"0.70274603",
"0.69948757",
"0.697758",
"0.69380987",
"0.69369465",
"0.6917853",
"0.689... | 0.7483042 | 0 |
Execute the prepared statement name with the given arguments on the connection. | def _execute_prepared_statement(conn, ps_name, args, opts)
conn.exec_prepared(ps_name, args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end",
"def execute(sql, name = nil, binds = [])\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n @connection.do(sql)\n end\n end",
"def execute_pr... | [
"0.8060444",
"0.7714628",
"0.76499593",
"0.7505872",
"0.7403695",
"0.7378101",
"0.7176152",
"0.7082819",
"0.7076367",
"0.704002",
"0.703833",
"0.70047003",
"0.68566793",
"0.6823273",
"0.6779913",
"0.67718613",
"0.6749446",
"0.67423135",
"0.67368865",
"0.67130417",
"0.664596",... | 0.8195851 | 0 |
Set the DateStyle to ISO if configured, for faster date parsing. | def connection_configuration_sqls
sqls = super
sqls << "SET DateStyle = 'ISO'" if @use_iso_date_format
sqls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def date_style\n @date_style if [:date, :date_range, :month_and_year, :only_year, :date_disabled].include? @date_style.to_sym\n end",
"def use_euro_formats\n self.current_date_format = :euro\n end",
"def format_date\n begin\n self.eob_date = Date.strptime(self.unformatted_eob_date, ... | [
"0.6048192",
"0.5229943",
"0.5126543",
"0.501055",
"0.49447453",
"0.4936957",
"0.4936076",
"0.48847598",
"0.48566493",
"0.48507422",
"0.4844862",
"0.48273945",
"0.48191088",
"0.4818787",
"0.48047313",
"0.47984964",
"0.47938967",
"0.47908103",
"0.478097",
"0.4746114",
"0.47351... | 0.5452926 | 1 |
Execute the prepared statement with the given name on an available connection, using the given args. If the connection has not prepared a statement with the given name yet, prepare it. If the connection has prepared a statement with the same name and different SQL, deallocate that statement first and then prepare this ... | def execute_prepared_statement(conn, name, opts=OPTS, &block)
ps = prepared_statement(name)
sql = ps.prepared_sql
ps_name = name.to_s
if args = opts[:arguments]
args = args.map{|arg| bound_variable_arg(arg, conn)}
end
unless conn.prepared_statements[ps_name] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_prepared_statement(name, args)\n check_disconnect_errors{exec_prepared(name, args)}\n end",
"def execute_prepared_statement(ps_name, opts)\n args = opts[:arguments]\n ps = prepared_statement(ps_name)\n sql = ps.prepared_sql\n synchronize(opts[:server]) do |conn... | [
"0.6955069",
"0.6580697",
"0.63122255",
"0.6284847",
"0.62554204",
"0.6185766",
"0.59890246",
"0.5971333",
"0.5964543",
"0.59414786",
"0.5874059",
"0.58605134",
"0.58355135",
"0.57717687",
"0.57630914",
"0.57173634",
"0.5708109",
"0.56787074",
"0.56594557",
"0.5647648",
"0.55... | 0.7185684 | 0 |
Return an appropriate value for the given infinite timestamp string. | def infinite_timestamp_value(value)
case convert_infinite_timestamps
when :nil
nil
when :string
value
else
value == 'infinity' ? PLUS_INFINITY : MINUS_INFINITY
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_timestamp(string)\n DateTime.parse(string).to_i\n end",
"def timestamp_parse(_timestamp)\n _undefined\n end",
"def value_from_s(value)\n a = value.scanf(@format)\n t = 0\n t += a[0] * 3600 if a.size > 0 # hours * seconds-per-hour\n t += a[1] * 60 if a.size > ... | [
"0.67301536",
"0.6327498",
"0.6100885",
"0.6039964",
"0.6016131",
"0.5899857",
"0.5820336",
"0.5796626",
"0.57559997",
"0.5623346",
"0.559958",
"0.55709267",
"0.5555473",
"0.5536436",
"0.5422841",
"0.54129356",
"0.5411092",
"0.5410207",
"0.540438",
"0.5401252",
"0.5388682",
... | 0.7355437 | 0 |
Replace the WHERE clause with one that uses CURRENT OF with the given cursor name (or the default cursor name). This allows you to update a large dataset by updating individual rows while processing the dataset via a cursor: DB[:huge_table].use_cursor(:rows_per_fetch=>1).each do |row| DB[:huge_table].where_current_of.u... | def where_current_of(cursor_name='sequel_cursor')
clone(:where=>Sequel.lit(['CURRENT OF '], Sequel.identifier(cursor_name)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_where(table, what, where, *bindvars)\n sql = \"update #{table.name}\\nset #{what} where #{where}\"\n#$stderr.puts sql\n db.do(sql, *bindvars)\n end",
"def current_to_false_sql_statement\n klass = self.class\n lock_column_name = klass.locking_column\n lock_value ... | [
"0.5185605",
"0.5111115",
"0.50961035",
"0.50961035",
"0.50961035",
"0.5060107",
"0.50512356",
"0.5036264",
"0.49734023",
"0.49724764",
"0.49651286",
"0.49085128",
"0.47928664",
"0.47766036",
"0.47595295",
"0.4749393",
"0.47241792",
"0.47152784",
"0.4701604",
"0.46561593",
"0... | 0.68356913 | 0 |
Set the columns based on the result set, and return the array of field numers, type conversion procs, and name symbol arrays. | def fetch_rows_set_cols(res)
cols = []
procs = db.conversion_procs
res.nfields.times do |fieldnum|
cols << [fieldnum, procs[res.ftype(fieldnum)], output_identifier(res.fname(fieldnum))]
end
self.columns = cols.map{|c| c[2]}
cols
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_column_descriptors\n #skip past header to get to column information\n @data.seek(HEADER_LENGTH)\n \n # column names are the first 128 bytes and column info takes up the last 72 bytes. \n # byte 130 contains a 16-bit column type\n # byte 136 contains a 16-bit length field\n ... | [
"0.6341035",
"0.6265122",
"0.61390173",
"0.61286724",
"0.6065369",
"0.60560626",
"0.6054228",
"0.6051409",
"0.60335994",
"0.6031213",
"0.60208285",
"0.60194063",
"0.599764",
"0.5990914",
"0.5966242",
"0.59636736",
"0.5963157",
"0.59273154",
"0.59227055",
"0.59190816",
"0.5916... | 0.7526813 | 0 |
Generate the xml for this notice and sign with the given private key. | def to_xml private_key
# Generate magic envelope
magic_envelope = XML::Document.new
magic_envelope.root = XML::Node.new 'env'
me_ns = XML::Namespace.new(magic_envelope.root,
'me', 'http://salmon-protocol.org/ns/magic-env')
magic_envelope.root.namespaces.namespace = me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_xml_request\n tax_receipt = generate_tax_receipt\n @certificate.certifica tax_receipt\n @key.sella tax_receipt\n tax_receipt.to_xml\n end",
"def sign(message, private_key)\n msg_point = BLS.norm_p2h(message)\n msg_point * BLS.normalize_priv_key(private_key)\n end",
"def sign_le... | [
"0.6189456",
"0.5949525",
"0.5949234",
"0.59353924",
"0.59199554",
"0.5917015",
"0.58884853",
"0.5887561",
"0.58661014",
"0.582439",
"0.5766398",
"0.57590437",
"0.56318474",
"0.5622876",
"0.56163824",
"0.5600364",
"0.55871844",
"0.55687976",
"0.55659765",
"0.5556279",
"0.5549... | 0.6497375 | 0 |
Remove all of the tags from the selected text. | def clear_clicked(txtvu)
s, e = txtvu.buffer.selection_bounds
txtvu.buffer.remove_all_tags(s, e)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_tag(*tags)\n tags.each do |tag|\n gsub! Regexp.new(\"<\\s*#{tag}[^>]*>.*?<\\s*\\/#{tag}\\s*>\", Regexp::IGNORECASE + Regexp:: MULTILINE), ''\n end\n end",
"def delete_all_tags\n delete_tags(self.tags)\n nil\n end",
"def remove\n from = Suspender.new(d... | [
"0.643675",
"0.6429013",
"0.63510513",
"0.6189877",
"0.60902566",
"0.6028987",
"0.6027333",
"0.60212183",
"0.6015184",
"0.60080105",
"0.5966635",
"0.59562767",
"0.5924286",
"0.5919715",
"0.5914191",
"0.5892503",
"0.58860105",
"0.5863277",
"0.5861183",
"0.58451355",
"0.5801099... | 0.6968981 | 0 |
GET /persona_punto_venta GET /persona_punto_venta.json | def index
@persona_punto_venta = PersonaPuntoVentum.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_persona_punto_ventum\n @persona_punto_ventum = PersonaPuntoVentum.find(params[:id])\n end",
"def persona_punto_ventum_params\n params.require(:persona_punto_ventum).permit(:persona_id, :punto_venta_id)\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params... | [
"0.684093",
"0.6608203",
"0.65238965",
"0.6478566",
"0.63313097",
"0.61472183",
"0.61254483",
"0.6094465",
"0.60358447",
"0.6015532",
"0.5965137",
"0.59626883",
"0.5922764",
"0.5922764",
"0.59172255",
"0.5873233",
"0.5862093",
"0.58567005",
"0.58518165",
"0.5837091",
"0.58153... | 0.70606333 | 0 |
POST /persona_punto_venta POST /persona_punto_venta.json | def create
@persona_punto_ventum = PersonaPuntoVentum.new(persona_punto_ventum_params)
respond_to do |format|
if @persona_punto_ventum.save
format.html { redirect_to @persona_punto_ventum.punto_venta, notice: 'Persona punto ventum was successfully created.' }
format.json { render :show, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def persona_punto_ventum_params\n params.require(:persona_punto_ventum).permit(:persona_id, :punto_venta_id)\n end",
"def set_persona_punto_ventum\n @persona_punto_ventum = PersonaPuntoVentum.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @persona_punto_ventum.updat... | [
"0.7436393",
"0.7049305",
"0.6603138",
"0.6143716",
"0.60707164",
"0.59953636",
"0.595887",
"0.59437424",
"0.5839788",
"0.575266",
"0.57334405",
"0.5713411",
"0.5705717",
"0.56932175",
"0.5684104",
"0.56136143",
"0.5607358",
"0.559614",
"0.5584539",
"0.55763674",
"0.5553745",... | 0.7563744 | 0 |
PATCH/PUT /persona_punto_venta/1 PATCH/PUT /persona_punto_venta/1.json | def update
respond_to do |format|
if @persona_punto_ventum.update(persona_punto_ventum_params)
format.html { redirect_to @persona_punto_ventum, notice: 'Persona punto ventum was successfully updated.' }
format.json { render :show, status: :ok, location: @persona_punto_ventum }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end"... | [
"0.6947051",
"0.67096686",
"0.66256475",
"0.66102594",
"0.65836143",
"0.65129006",
"0.6438746",
"0.6425371",
"0.64011145",
"0.63980716",
"0.6397051",
"0.6367387",
"0.6359711",
"0.63567084",
"0.63453615",
"0.6291125",
"0.6271334",
"0.62678224",
"0.6223979",
"0.6216488",
"0.621... | 0.73514277 | 0 |
DELETE /persona_punto_venta/1 DELETE /persona_punto_venta/1.json | def destroy
@punto_venta = PuntoVentum.find(@persona_punto_ventum.punto_venta_id)
@persona_punto_ventum.destroy
respond_to do |format|
format.html { redirect_to @punto_venta, notice: 'Persona punto ventum was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end",
"def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url... | [
"0.76277345",
"0.7387782",
"0.7387782",
"0.7387782",
"0.7385074",
"0.7275049",
"0.7166503",
"0.7151515",
"0.71326953",
"0.712416",
"0.7103515",
"0.7092933",
"0.7063283",
"0.70572364",
"0.70177877",
"0.6998521",
"0.6980156",
"0.6980139",
"0.69677246",
"0.69669056",
"0.6955762"... | 0.7592983 | 1 |
Return the float point of the expression, otherwise raise an error | def to_f
if isFloat? then
value = exp.to_f
return value
elsif exp == "Infinity" then return @@MAX_VALUE
elsif exp == "-Infinity" then return @@MIN_VALUE
else
raise "Non-float conversion in expression: " + exp
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Float(p0) end",
"def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\... | [
"0.6644832",
"0.6538606",
"0.65259284",
"0.6385289",
"0.6373016",
"0.63188416",
"0.6293305",
"0.62895405",
"0.62686646",
"0.61740994",
"0.61555135",
"0.6135612",
"0.6124431",
"0.60668963",
"0.606103",
"0.6043514",
"0.59881836",
"0.5977649",
"0.59574723",
"0.5941438",
"0.59347... | 0.65456533 | 1 |
GET /dom0s GET /dom0s.json | def index
@dom0s = Dom0.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_domoticz_json(domoticz_uri)\n uri = URI(domoticz_uri)\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n ... | [
"0.6123326",
"0.581122",
"0.5674552",
"0.5660206",
"0.5556566",
"0.5537444",
"0.5526527",
"0.5493284",
"0.546806",
"0.5455959",
"0.5452535",
"0.544711",
"0.54072374",
"0.53764915",
"0.5340168",
"0.5336084",
"0.53206885",
"0.52866936",
"0.52781004",
"0.52780795",
"0.5273331",
... | 0.7176695 | 0 |
POST /dom0s POST /dom0s.json | def create
@dom0 = Dom0.new(dom0_params)
respond_to do |format|
if @dom0.save
format.html { redirect_to @dom0, notice: 'Dom0 was successfully created.' }
format.json { render :show, status: :created, location: @dom0 }
else
format.html { render :new }
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dom0_params\n params[:dom0]\n end",
"def index\n @dom0s = Dom0.all\n end",
"def destroy\n @dom0.destroy\n respond_to do |format|\n format.html { redirect_to dom0s_url, notice: 'Dom0 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def set_do... | [
"0.57373255",
"0.571542",
"0.56012785",
"0.551812",
"0.54482204",
"0.5268613",
"0.5030848",
"0.49307495",
"0.4899661",
"0.48912323",
"0.4800201",
"0.47533327",
"0.4743312",
"0.47391972",
"0.4730478",
"0.4728335",
"0.47194347",
"0.47138953",
"0.47062275",
"0.46899125",
"0.4672... | 0.71896154 | 0 |
PATCH/PUT /dom0s/1 PATCH/PUT /dom0s/1.json | def update
respond_to do |format|
if @dom0.update(dom0_params)
format.html { redirect_to @dom0, notice: 'Dom0 was successfully updated.' }
format.json { render :show, status: :ok, location: @dom0 }
else
format.html { render :edit }
format.json { render json: @dom0.errors,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => ... | [
"0.64772713",
"0.634038",
"0.6260748",
"0.6077363",
"0.6016408",
"0.6016157",
"0.58441067",
"0.5841534",
"0.5798322",
"0.5798322",
"0.57883316",
"0.57657605",
"0.57232183",
"0.5708018",
"0.56785774",
"0.56506515",
"0.56330734",
"0.5627697",
"0.56198543",
"0.5617977",
"0.56132... | 0.6755568 | 0 |
DELETE /dom0s/1 DELETE /dom0s/1.json | def destroy
@dom0.destroy
respond_to do |format|
format.html { redirect_to dom0s_url, notice: 'Dom0 was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def test_del\n header 'Conte... | [
"0.6924843",
"0.68064195",
"0.66468406",
"0.661468",
"0.6569856",
"0.6568001",
"0.6556821",
"0.65491503",
"0.6527892",
"0.6527892",
"0.6527892",
"0.6527892",
"0.65258557",
"0.65239805",
"0.6523552",
"0.6518982",
"0.64959806",
"0.64850986",
"0.64850986",
"0.647416",
"0.6471033... | 0.7263812 | 0 |
Insert assets into a gallery or uploader | def insert
@fieldname = params[:fieldname]
@uploader_id = params[:uploader_id]
@assets = Assetabler::Asset.find(params[:asset_ids])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_assets\n num_files = params[:count].to_i\n \n @new_assets = []\n @new_assets_html = []\n num_files.times do |file_num|\n # recreate the file key from the current index\n file = params[\"file-\"+file_num.to_s]\n @asset = Asset.new(:name => file.original_filename)\n @asset.... | [
"0.61756617",
"0.6154996",
"0.61383945",
"0.6001432",
"0.60004574",
"0.59871066",
"0.5963862",
"0.5963862",
"0.5963862",
"0.5954183",
"0.59353906",
"0.59330684",
"0.5869575",
"0.5823433",
"0.5820491",
"0.5820491",
"0.5820491",
"0.57837665",
"0.57716024",
"0.57602334",
"0.5738... | 0.68637425 | 0 |
Edit an asset will return the edit form | def edit
@asset = Assetabler::Asset.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n @asset = Asset.find(params[:id])\n end",
"def edit_asset\n @asset = Asset.find(params[:id])\n end",
"def show\n @asset = OtherAsset.find(params[:id])\n @content_title = @title = \"Editing #{@asset.title}\"\n @submit_value = \"Update\"\n asset_show\n end",
"def edit\n @uploa... | [
"0.84800553",
"0.83911324",
"0.77883995",
"0.7457932",
"0.743196",
"0.73515004",
"0.73232806",
"0.7302282",
"0.7232861",
"0.7217202",
"0.7217202",
"0.7217202",
"0.7209364",
"0.72051823",
"0.71942514",
"0.7173698",
"0.7163836",
"0.7160366",
"0.715314",
"0.71491045",
"0.7147524... | 0.8413417 | 1 |
Performs a HTTP request method Request method (:get, :post, :put, :delete) url Target URL payload Delivery content format Delivery format | def request(method, url, payload, format)
opts = {
:method => method,
:url => url,
:payload => payload,
:headers => {:content_type => CONTENT_TYPES[format]},
:timeout => TIMEOUT,
:open_timeout => OPEN_TIMEOUT
}
RestCl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end",
"def run_request(method, url, body, headers); end",
"def invoke(options = {})\n defaults = { method: 'get'}\n options = defaults.merge(options)\n\n connection.send(options[:me... | [
"0.68332547",
"0.6700983",
"0.6639594",
"0.6551825",
"0.65194184",
"0.6514597",
"0.6471604",
"0.6460943",
"0.63053584",
"0.626688",
"0.6263862",
"0.62524426",
"0.62160903",
"0.62027645",
"0.62000614",
"0.6195601",
"0.61842906",
"0.6175784",
"0.6171844",
"0.61623764",
"0.61606... | 0.72402686 | 0 |
GET /vitabus GET /vitabus.json | def index
@vitabus = Vitabu.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end",
"def index\n @vampires = Vampire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vampires }\n end\n end",
"def show\n @virus = Virus.find(param... | [
"0.695314",
"0.6797506",
"0.6641814",
"0.6636317",
"0.6636317",
"0.66190094",
"0.65613353",
"0.6548526",
"0.65438986",
"0.652484",
"0.65126985",
"0.65052944",
"0.65038717",
"0.6428445",
"0.6414535",
"0.6408994",
"0.63224435",
"0.6299798",
"0.6285904",
"0.6283811",
"0.62795573... | 0.7213476 | 0 |
POST /vitabus POST /vitabus.json | def create
@vitabus = Vitabu.new(vitabus_params)
respond_to do |format|
if @vitabus.save
format.html { redirect_to @vitabus, notice: 'Vitabu was successfully created.' }
format.json { render action: 'show', status: :created, location: @vitabus }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @vitamina = Vitamina.new(vitamina_params)\n\n respond_to do |format|\n if @vitamina.save\n format.html { redirect_to @vitamina, notice: 'Vitamina was successfully created.' }\n format.json { render :show, status: :created, location: @vitamina }\n else\n format.html... | [
"0.6499655",
"0.63951945",
"0.63511556",
"0.6227624",
"0.62136674",
"0.62136674",
"0.6202348",
"0.62002325",
"0.6183671",
"0.6182404",
"0.61244017",
"0.61104494",
"0.60863024",
"0.6044589",
"0.6037201",
"0.60351026",
"0.60107845",
"0.5992457",
"0.59287417",
"0.59257084",
"0.5... | 0.7407548 | 0 |
PATCH/PUT /vitabus/1 PATCH/PUT /vitabus/1.json | def update
respond_to do |format|
if @vitabus.update(vitabus_params)
format.html { redirect_to @vitabus, notice: 'Vitabu was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @vitabus.errors, st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def put!\n request! :put\n end",
"def update!(params)\n res = @c... | [
"0.66542",
"0.66045177",
"0.6471563",
"0.6462322",
"0.6385802",
"0.63763386",
"0.63688964",
"0.6366525",
"0.63304",
"0.6278602",
"0.6255677",
"0.6231925",
"0.61880845",
"0.6171431",
"0.6167253",
"0.6150614",
"0.6140274",
"0.60750055",
"0.60743695",
"0.6070956",
"0.60682815",
... | 0.68498445 | 0 |
DELETE /vitabus/1 DELETE /vitabus/1.json | def destroy
@vitabus.destroy
respond_to do |format|
format.html { redirect_to vitabus_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url... | [
"0.7228342",
"0.7202471",
"0.70137244",
"0.70137244",
"0.69435054",
"0.6893573",
"0.689157",
"0.68524086",
"0.68480206",
"0.68387157",
"0.6835442",
"0.6819716",
"0.6796227",
"0.67877436",
"0.67875737",
"0.67846715",
"0.67788893",
"0.67628354",
"0.67628354",
"0.67628354",
"0.6... | 0.751043 | 0 |
GET /navigation_entries/new GET /navigation_entries/new.xml | def new
@navigation_entry = NavigationEntry.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @navigation_entry }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n get_system\n @parent = NavEntry.find(params[:parent_id]) unless params[:parent_id].nil?\n @nav_entry = NavEntry.new(:system => @system, :parent => @parent)\n get_parents\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nav_entry }\n end\n... | [
"0.6963487",
"0.68094933",
"0.6779341",
"0.65997523",
"0.65111494",
"0.6475915",
"0.6453136",
"0.6371884",
"0.6367441",
"0.6349056",
"0.63081664",
"0.6302887",
"0.6284018",
"0.6284018",
"0.6281309",
"0.6276518",
"0.62648857",
"0.62576354",
"0.6250752",
"0.6236876",
"0.621537"... | 0.76766187 | 0 |
POST /navigation_entries POST /navigation_entries.xml | def create
@navigation_entry = NavigationEntry.new(params[:navigation_entry])
respond_to do |format|
if @navigation_entry.save
format.html { redirect_to(@navigation_entry, :notice => 'Navigation entry was successfully created.') }
format.xml { render :xml => @navigation_entry, :status =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @navigation_entry = NavigationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @navigation_entry }\n end\n end",
"def create \n get_system\n @nav_entry = NavEntry.new(params[:nav_entry])\n get_parents\n\n respond_to do |... | [
"0.5658883",
"0.5533778",
"0.50773793",
"0.49485782",
"0.4905544",
"0.4884094",
"0.48772314",
"0.48564732",
"0.48458454",
"0.46960834",
"0.46764162",
"0.46683216",
"0.4659268",
"0.46583784",
"0.46539962",
"0.46283823",
"0.46105677",
"0.4609168",
"0.46084428",
"0.460109",
"0.4... | 0.64855915 | 0 |
PUT /navigation_entries/1 PUT /navigation_entries/1.xml | def update
@navigation_entry = NavigationEntry.find(params[:id])
respond_to do |format|
if @navigation_entry.update_attributes(params[:navigation_entry])
format.html { redirect_to(@navigation_entry, :notice => 'Navigation entry was successfully updated.') }
format.xml { head :ok }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n get_system\n @nav_entry = NavEntry.find(params[:id])\n get_parents\n\n respond_to do |format|\n if @nav_entry.update_attributes(params[:nav_entry])\n format.html { redirect_to(system_nav_entry_path(@system, @nav_entry), :notice => 'Nav entry was successfully updated.') }\n ... | [
"0.59629303",
"0.55001026",
"0.5487206",
"0.5458992",
"0.5433569",
"0.5425323",
"0.5262817",
"0.5261352",
"0.5249022",
"0.5235539",
"0.52352047",
"0.52067214",
"0.51349837",
"0.50847137",
"0.50655854",
"0.5048693",
"0.5015466",
"0.49999553",
"0.4958886",
"0.49584007",
"0.4950... | 0.6453088 | 0 |
DELETE /navigation_entries/1 DELETE /navigation_entries/1.xml | def destroy
@navigation_entry = NavigationEntry.find(params[:id])
@navigation_entry.destroy
respond_to do |format|
format.html { redirect_to(navigation_entries_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; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n pa... | [
"0.65846765",
"0.65635955",
"0.65635955",
"0.6414862",
"0.63691705",
"0.6178738",
"0.6097885",
"0.60384494",
"0.5999612",
"0.5992182",
"0.5987641",
"0.59374195",
"0.5907902",
"0.59064543",
"0.5905868",
"0.59022814",
"0.5897556",
"0.58923584",
"0.58897096",
"0.5878547",
"0.587... | 0.7221005 | 0 |
Returns the last geometry from the collection. | def last
self.get_geometry_n(self.num_geometries - 1) if self.num_geometries > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last\n @collection.size - 1\n end",
"def last\n @features.last\n end",
"def geometry\n @geometry ||= _geometry\n end",
"def last\n @locations.last\n end",
"def last\n @adapter.last(collection)\n end",
"def last_point\n path_points.last\n end",
"def la... | [
"0.68261254",
"0.6805249",
"0.6681199",
"0.6625544",
"0.6611591",
"0.66014403",
"0.6566384",
"0.6534133",
"0.65032506",
"0.6473712",
"0.64014393",
"0.63910794",
"0.6388546",
"0.63861334",
"0.6358029",
"0.6349516",
"0.63397944",
"0.6269032",
"0.6242639",
"0.61935025",
"0.61626... | 0.88753515 | 1 |
Dumps points similarly to the PostGIS `ST_DumpPoints` function. | def dump_points(cur_path = [])
self.each do |geom|
cur_path << geom.dump_points
end
cur_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_points(cur_path = [])\n cur_path.push(self.dup)\n end",
"def pp_points(points)\n \"[%s]\" % points.map { |point| \"%d: %d,%d\" % point }.join(\" \")\n end",
"def save_point\n @save_points\n end",
"def to_s\n @points.join(' ')\n end",
"def\n\t\tprint_point\n\t\tp \"(... | [
"0.6411781",
"0.6126447",
"0.6121726",
"0.5772761",
"0.5558724",
"0.5546756",
"0.5493614",
"0.543597",
"0.5423503",
"0.5344848",
"0.52858406",
"0.52596927",
"0.52544564",
"0.5251316",
"0.52197444",
"0.52121836",
"0.52052927",
"0.52044517",
"0.5167359",
"0.516649",
"0.51576203... | 0.760294 | 0 |
Obtain IP address from http request header | def src_addr_on_header
request.headers['X-Forwarded-For'] || request.headers['REMOTE_ADDR']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_ip\n return request.headers[\"X-Forwarded-For\"] if request.headers[\"X-Forwarded-For\"]\n return request.headers[\"REMOTE_ADDR\"] if request.headers[\"REMOTE_ADDR\"]\n end",
"def get_ip_address\n request.remote_ip\n end",
"def parse_ip\n @request[FHOST] || BLANK_STR\n end",... | [
"0.7722499",
"0.75440204",
"0.75008315",
"0.7356482",
"0.7319257",
"0.7288718",
"0.7276756",
"0.7239505",
"0.72183764",
"0.72174376",
"0.7175481",
"0.7157487",
"0.71513623",
"0.7093448",
"0.7081977",
"0.6993343",
"0.6965759",
"0.69640845",
"0.6960995",
"0.6924997",
"0.6917261... | 0.7665337 | 1 |
Obtain HOST FQDN from http request header | def host_on_header
request.headers['HTTP_HOST']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host\n @headers['HTTP_X_FORWARDED_HOST'] || @headers['HTTP_HOST'] \n end",
"def hostname\n (request.env['HTTP_X_FORWARDED_SERVER'] =~ /[a-z]*/) ? request.env['HTTP_X_FORWARDED_SERVER'] : request.env['HTTP_HOST']\n end",
"def host\n @request['Host']\n end",
"def hostname\n protoco... | [
"0.77148664",
"0.7541365",
"0.7495885",
"0.71831733",
"0.71040004",
"0.6984895",
"0.6928435",
"0.68830967",
"0.6800195",
"0.6766139",
"0.67552334",
"0.6754956",
"0.67038345",
"0.6666227",
"0.6666208",
"0.66583365",
"0.66311055",
"0.6595148",
"0.6585325",
"0.6584013",
"0.65806... | 0.82105935 | 0 |
Obtain User Agent from http request header | def user_agent_on_header
request.headers['HTTP_USER_AGENT']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_agent\n @headers['User-Agent']\n end",
"def user_agent\n @headers['User-Agent']\n end",
"def user_agent\n @headers['User-Agent']\n end",
"def user_agent\n @request['User-Agent']\n end",
"def user_agent\n headers[\"HTTP_USER_AGENT\"] || headers[\"USER-AGENT\"]\n ... | [
"0.87297374",
"0.87297374",
"0.87297374",
"0.8564696",
"0.8517576",
"0.8340213",
"0.81074625",
"0.80660886",
"0.7931847",
"0.7921811",
"0.7763692",
"0.77623594",
"0.77623594",
"0.7713474",
"0.7711464",
"0.7711464",
"0.7711464",
"0.7658591",
"0.7531901",
"0.7404778",
"0.732046... | 0.8891262 | 0 |
Renders plain text and html to html. If parse_code isn't true, only runs bluecloth on text outside any ... blocks. | def bluecloth(text, parse_code = true, increment_headers = true)
return text if text.nil?
if parse_code
return BlueCloth::new(text).to_html
end
text = text.dup
out = ''
level = 0
until text.empty? do
if level < 1
# Find start of c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html\n return if self.text.blank?\n\n html = self.text\n \n # s = StringScanner.new(self.text)\n # html = ''\n # while markup = s.scan_until(/\\[code/) do\n # html += RedCloth.new(markup[0..-6]).to_html\n # s.pos= s.pos-5\n # code = s.scan_until(/\\[\\/code\\]/)\n # if cod... | [
"0.6652656",
"0.6535241",
"0.6412524",
"0.6400033",
"0.6294351",
"0.6195641",
"0.61693525",
"0.6141368",
"0.61001754",
"0.60769266",
"0.60422814",
"0.6006865",
"0.59752667",
"0.592088",
"0.5911805",
"0.589874",
"0.5836841",
"0.582105",
"0.5796861",
"0.5793838",
"0.57308114",
... | 0.6571611 | 1 |
Macro substitutions Expands [[type:resource][name]] macros. Right now, resource is just an attachment. Included types are: url: returns the URL to an attachment image: returns an image tag link: returns a link to an attachment page_nav: A list of subpages attachments: A list of attachments The default action is a link,... | def macro(text)
return text if text.nil?
copy = text.dup
# Links
#
# Example [[image:foo.png][name]]
# 1. the prefix image
# 2. the link, with colon :foo.png
# 3. the link itself foo.png
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def template_for(action, resource)\n\t\t\t\"#{resource.gsub(\" \",\"_\")}/#{action}\"\n\t\tend",
"def expand\n\t\t\tblock = Glyph::MACROS[@name]\n\t\t\tmacro_error \"Undefined macro '#@name'\" unless block\n\t\t\tinstance_exec(@node, &block).to_s.gsub(/\\\\?([\\[\\]\\|])/){\"\\\\#$1\"}\n\t\tend",
"def content_... | [
"0.5072739",
"0.50537956",
"0.49182448",
"0.49032867",
"0.48522288",
"0.4848557",
"0.4846442",
"0.48158833",
"0.48065653",
"0.47986424",
"0.47954062",
"0.47842097",
"0.47820592",
"0.47547767",
"0.47478554",
"0.4742011",
"0.46857753",
"0.46598318",
"0.4657052",
"0.4650557",
"0... | 0.6145426 | 0 |
Input: List of names(cohort) Output : Groups of no less than 3, no more than 5 made from the list array cohort, ideally 45 per group Steps to complete: See if cohort is divisible by 5 or 4 create a new hash test if group is divisible by 5 and 4 find remainder of group when divided by 4 or 5 go through array and assign ... | def create_groups(cohort)
if cohort.length % 5 == 0
hash = {}
counter = 1
group_count = cohort.length / 5
remainder = cohort.length % 5
# Set to groups(keys) to members(values)
group_count.times do
hash[counter] = cohort.slice!(0..4)
counter += 1
end
else
hash = {}
coun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acct_groups(cohort)\n\tgroups_array = []\n\tcohort_array = cohort.split(\", \").shuffle!\n\theadcount = cohort_array.size\n\t\tif headcount < 6\n\t\t\tputs \"Too few students to sort!\"\n\t\telsif headcount == 6 || headcount == 9\n\t\t\tcohort_array.each_slice(3) { |three_person|\tgroups_array.push(three_perso... | [
"0.8172613",
"0.76304543",
"0.7329762",
"0.7263083",
"0.7213749",
"0.7018138",
"0.697309",
"0.6910674",
"0.69004035",
"0.68534166",
"0.67199785",
"0.67139083",
"0.66952914",
"0.6645634",
"0.66045386",
"0.6573632",
"0.65453225",
"0.6532134",
"0.6493227",
"0.64893305",
"0.64716... | 0.806292 | 1 |
GET /military_document_types GET /military_document_types.json | def index
@military_document_types = MilitaryDocumentType.all
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @military_document_types }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @military_document_type = MilitaryDocumentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @military_document_type }\n end\n end",
"def index\n @documenttypes = Documenttype.all\n end",
"def index\n @docume... | [
"0.700759",
"0.6775187",
"0.6644835",
"0.65929484",
"0.6538695",
"0.6527967",
"0.64848167",
"0.636672",
"0.6363027",
"0.63435507",
"0.63435507",
"0.6322925",
"0.6318144",
"0.6280156",
"0.627328",
"0.6246751",
"0.6159099",
"0.6106487",
"0.6097845",
"0.6084949",
"0.60723674",
... | 0.7892265 | 0 |
GET /military_document_types/1 GET /military_document_types/1.json | def show
@military_document_type = MilitaryDocumentType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @military_document_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @military_document_types = MilitaryDocumentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @military_document_types }\n end\n end",
"def show\n @document_type = DocumentType.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.7853476",
"0.7101261",
"0.68319607",
"0.67287123",
"0.66368157",
"0.66021055",
"0.66021055",
"0.652735",
"0.65189695",
"0.6496666",
"0.64009976",
"0.6394475",
"0.63475245",
"0.6244297",
"0.61611617",
"0.60895705",
"0.60724723",
"0.6066076",
"0.6055568",
"0.60470915",
"0.60... | 0.7510824 | 1 |
GET /military_document_types/new GET /military_document_types/new.json | def new
@military_document_type = MilitaryDocumentType.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @military_document_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @document_type = DocumentType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @document_type }\n end\n end",
"def new\n @document = Document.new\n @document.document_type = 1\n\n respond_to do |format|\n format.html # new.html.e... | [
"0.78218365",
"0.76295704",
"0.74823594",
"0.725441",
"0.71714187",
"0.7168285",
"0.7132817",
"0.69822234",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.69702554",
"0.6969036",
"0.6951032",
"0.6944768",
"0.... | 0.7906374 | 0 |
POST /military_document_types POST /military_document_types.json | def create
@military_document_type = MilitaryDocumentType.new(params[:military_document_type])
respond_to do |format|
if @military_document_type.save
format.html { redirect_to @military_document_type, :notice => 'Tipo de Documento Militar criado com sucesso.' }
format.json { render :json ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @document_type = @enterprise.document_types.new(document_type_params)\n\n respond_to do |format|\n if @document_type.save\n format.html { redirect_to edit_document_type_path(@document_type), notice: 'El tipo de documento ha sido creado satisfactoriamente.' }\n format.json { re... | [
"0.6845149",
"0.67884475",
"0.67559874",
"0.67298055",
"0.6637083",
"0.66122353",
"0.6464347",
"0.6457802",
"0.6367807",
"0.6289234",
"0.62546116",
"0.6250756",
"0.6202728",
"0.6162214",
"0.61429536",
"0.6125838",
"0.6124055",
"0.6120345",
"0.6119991",
"0.6119991",
"0.6066942... | 0.69768006 | 0 |
PUT /military_document_types/1 PUT /military_document_types/1.json | def update
@military_document_type = MilitaryDocumentType.find(params[:id])
respond_to do |format|
if @military_document_type.update_attributes(params[:military_document_type])
format.html { redirect_to @military_document_type, :notice => 'Tipo de Documento Militar atualizado com sucesso.' }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @document_type.update(document_type_params)\n format.html { redirect_to edit_document_type_path(@document_type), notice: 'El tipo de documento ha sido actualizado satisfactoriamente.' }\n format.json { render :edit, status: :ok, location: @document_typ... | [
"0.7216173",
"0.7205511",
"0.7188631",
"0.70816517",
"0.69233686",
"0.69178843",
"0.6869233",
"0.68102914",
"0.6694511",
"0.6675898",
"0.6573239",
"0.65542465",
"0.64890915",
"0.64732486",
"0.64250034",
"0.63367647",
"0.62926567",
"0.62926567",
"0.6212918",
"0.61546224",
"0.6... | 0.7246239 | 0 |
DELETE /military_document_types/1 DELETE /military_document_types/1.json | def destroy
@military_document_type = MilitaryDocumentType.find(params[:id])
@military_document_type.destroy
respond_to do |format|
format.html { redirect_to military_document_types_url, :notice => 'Tipo de Documento Militar excluído com sucesso.' }
format.json { head :no_content }
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @document_type = DocumentType.find(params[:id])\n @document_type.destroy\n\n respond_to do |format|\n format.html { redirect_to document_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_type.destroy\n respond_to do |format|\n fo... | [
"0.7619207",
"0.7351393",
"0.73229754",
"0.7293766",
"0.71715677",
"0.70488644",
"0.7026494",
"0.69568884",
"0.68637085",
"0.6821977",
"0.67709005",
"0.67343533",
"0.6725197",
"0.6697152",
"0.668687",
"0.6680535",
"0.6654211",
"0.66144544",
"0.66075844",
"0.65992564",
"0.6585... | 0.76715434 | 0 |
=begin Inserts a value to the collection. Returns true if the collection did not already contain the specified element. :type val: Integer :rtype: Boolean =end | def insert(val)
hash[val] = Set.new unless hash[val]
hash[val].add(values.size)
values.push(val)
hash[val].size == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(val)\n return false if @h[val]\n @a.push(val)\n @h[val] = @a.size - 1\n return true\n end",
"def add(val)\n @set.include?(val) ? nil : @set.push(val)\n end",
"def insert(val)\n return false if @number_index_map.key?(val)\n @number_list << val\n @number_index_map[v... | [
"0.75590783",
"0.7356093",
"0.71431",
"0.7066172",
"0.67980886",
"0.6683719",
"0.66010106",
"0.6525003",
"0.6509468",
"0.6493217",
"0.6231391",
"0.6192678",
"0.6155127",
"0.60978436",
"0.6065289",
"0.59597135",
"0.5879541",
"0.58649284",
"0.58424693",
"0.5828541",
"0.5828429"... | 0.74929804 | 1 |
=begin Removes a value from the collection. Returns true if the collection contained the specified element. :type val: Integer :rtype: Boolean =end | def remove(val)
return false if !hash[val] || hash[val].empty?
# Update values array
idx = hash[val].first
last = values[-1]
values[idx] = last
# Remove last from array
values.pop
# Remove val
hash[val].delete(idx)
# Update last
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(val)\n return false unless @number_index_map.key?(val)\n index = @number_index_map[val]\n last_element = @number_list[-1]\n @number_list[index] = last_element\n\n @number_list.pop\n @number_index_map[last_element] = index\n @number_index_map.delete(val)\n true\n end",
"def rem... | [
"0.7230835",
"0.7229514",
"0.7152616",
"0.7116149",
"0.689907",
"0.6758695",
"0.66874665",
"0.6573358",
"0.6397571",
"0.6345565",
"0.6250748",
"0.6080194",
"0.60422605",
"0.5958605",
"0.59559196",
"0.5946012",
"0.5908866",
"0.58999157",
"0.58809286",
"0.5867662",
"0.58550835"... | 0.75217015 | 0 |
Supported values for options: :region AWS region (e.g. uswest1) :secure true or false, default true. :timeout the timeout, in seconds, when making a request to EMR, default 60. | def initialize(options={})
# There is a cryptic error if this isn't set
if options.has_key?(:region) && options[:region] == nil
raise MissingRegionError, 'A valid :region is required to connect to EMR'
end
options[:region] = 'us-east-1' unless options[:region]
@region = options[:re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aws_options\n options = {\n retry_limit: 7, # default: 3\n retry_base_delay: 0.6, # default: 0.3\n }\n options.merge!(\n log_level: :debug,\n logger: Logger.new($stdout),\n ) if ENV['CFN_STATUS_DEBUG_AWS_SDK']\n options\n end",
"def configure_timeout(op... | [
"0.5818868",
"0.5627236",
"0.5560421",
"0.5550543",
"0.55356747",
"0.54547215",
"0.5405509",
"0.5281793",
"0.52772796",
"0.5249756",
"0.52192575",
"0.5209955",
"0.5119666",
"0.5097042",
"0.5045118",
"0.50450814",
"0.5030702",
"0.502459",
"0.502459",
"0.50037855",
"0.49800667"... | 0.7225927 | 0 |
Enqueues the action for a single resource. | def enqueue_action_single_resource(action, type, id)
raise BadRequestError, "Must specify an id for changing a #{type} resource" unless id
physical_switch = resource_search(id, type, collection_class(type))
api_action(type, id) do
begin
desc = "Performing #{action} for #{physical_s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enqueue(action)\n # add our request id for tracing purposes\n action[:messageId] = uid\n unless queue_full = @queue.length >= @max_queue_size\n ensure_worker_running\n @queue << action\n end\n !queue_full\n end",
"def enqueue(action)\n # add our ... | [
"0.6444264",
"0.6344201",
"0.6113562",
"0.5767109",
"0.5728094",
"0.5720891",
"0.57013947",
"0.5664915",
"0.5645009",
"0.5626888",
"0.5567248",
"0.5559725",
"0.5558766",
"0.5555397",
"0.55398643",
"0.5510747",
"0.5496871",
"0.5486329",
"0.5464261",
"0.54426163",
"0.5426837",
... | 0.72336215 | 0 |
Enqueues the action for multiple resources. For multiple resources, when an error occurs, the error messages must be built individually for each resource. Always responding with status 200. | def enqueue_action_multiple_resources(action, type, id)
enqueue_action_single_resource(action, type, id)
rescue ActiveRecord::RecordNotFound => err
action_result(false, _(err.message))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collection_post_action(action)\n action = action.to_s.gsub('bulk_', '').to_sym\n\n raise 'expected post, patch or put http action' unless (request.post? || request.patch? || request.put?)\n raise \"expected #{resource_name} to respond to #{action}!\" if resources.to_a.present? && !resources.firs... | [
"0.5996528",
"0.59655535",
"0.5676235",
"0.5563469",
"0.55244195",
"0.5516578",
"0.5504725",
"0.55009824",
"0.54760396",
"0.54397523",
"0.53459245",
"0.5337982",
"0.52587515",
"0.5235957",
"0.5229544",
"0.5224417",
"0.5215673",
"0.52050513",
"0.5141789",
"0.5130663",
"0.51168... | 0.72910756 | 0 |
GET /exercise_templates GET /exercise_templates.json | def index
@exercise_templates = ExerciseTemplate.all
render json: @exercise_templates
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @exercise_template\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def templates\n response = get 'templates'\n response.map... | [
"0.7126005",
"0.70159036",
"0.68598884",
"0.6789637",
"0.67713577",
"0.6725251",
"0.66778237",
"0.6596028",
"0.65107256",
"0.64400196",
"0.6423538",
"0.6418938",
"0.64132273",
"0.6409025",
"0.6409025",
"0.6352914",
"0.63268644",
"0.6298526",
"0.6271051",
"0.6222909",
"0.61799... | 0.7781126 | 0 |
GET /exercise_templates/1 GET /exercise_templates/1.json | def show
render json: @exercise_template
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise... | [
"0.76289266",
"0.6616761",
"0.6582318",
"0.65737027",
"0.644448",
"0.64309645",
"0.64309645",
"0.64262646",
"0.641031",
"0.6387172",
"0.6283847",
"0.6283847",
"0.62828577",
"0.62621826",
"0.62445545",
"0.62287426",
"0.6208674",
"0.6191285",
"0.61840236",
"0.61582685",
"0.6134... | 0.72894967 | 1 |
POST /exercise_templates POST /exercise_templates.json | def create
@exercise_template = ExerciseTemplate.new(exercise_template_params)
if @exercise_template.save
render json: @exercise_template, status: :created, location: @exercise_template
else
render json: @exercise_template.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_t... | [
"0.6443866",
"0.6424446",
"0.6355208",
"0.6267342",
"0.62536114",
"0.6245498",
"0.6241469",
"0.6241336",
"0.6221112",
"0.61768353",
"0.6160134",
"0.6144805",
"0.6127116",
"0.60892713",
"0.60494596",
"0.60323447",
"0.6003123",
"0.60004467",
"0.5978884",
"0.5947667",
"0.5939243... | 0.76109755 | 0 |
PATCH/PUT /exercise_templates/1 PATCH/PUT /exercise_templates/1.json | def update
@exercise_template = ExerciseTemplate.find(params[:id])
if @exercise_template.update(exercise_template_params)
head :no_content
else
render json: @exercise_template.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { rend... | [
"0.6624844",
"0.6485179",
"0.6468314",
"0.64318746",
"0.64318746",
"0.64318746",
"0.63112164",
"0.63102996",
"0.6307914",
"0.62699884",
"0.62584835",
"0.6257754",
"0.62360495",
"0.61973506",
"0.6182043",
"0.6182043",
"0.61755174",
"0.617128",
"0.61525905",
"0.61441153",
"0.61... | 0.7475527 | 0 |
DELETE /exercise_templates/1 DELETE /exercise_templates/1.json | def destroy
@exercise_template.destroy
head :no_content
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n ... | [
"0.760863",
"0.73966616",
"0.73966616",
"0.7386129",
"0.73255175",
"0.73255175",
"0.73255175",
"0.73255175",
"0.7325453",
"0.7166219",
"0.7161098",
"0.71421456",
"0.71421456",
"0.7133151",
"0.71203744",
"0.7103718",
"0.7102772",
"0.70902383",
"0.70858175",
"0.7074158",
"0.705... | 0.7792735 | 0 |
Merge the current Hash object (self) cloned with a Hash/Array tree contents (data). 'self' is used as original data to merge to. 'data' is used as data to merged to clone of 'self'. If you want to update 'self', use rh_merge! if 'self' or 'data' contains a Hash tree, the merge will be executed recursively. The current ... | def rh_merge(data)
_rh_merge(clone, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rh_merge(result, data)\n return _rh_merge_choose_data(result, data) unless data.is_a?(Hash)\n\n data.each do |key, _value|\n next if [:__struct_changing, :__protected].include?(key)\n\n _do_rh_merge(result, key, data)\n end\n [:__struct_changing, :__protected].each do |key|\n # Refu... | [
"0.7118564",
"0.70461404",
"0.7019008",
"0.69477296",
"0.6902892",
"0.68409175",
"0.6684241",
"0.6617985",
"0.6593967",
"0.6593967",
"0.6593967",
"0.6560709",
"0.65426683",
"0.65015894",
"0.64709705",
"0.6372555",
"0.63637376",
"0.63613176",
"0.6344908",
"0.6336662",
"0.63165... | 0.728417 | 0 |
Merge the current Hash object (self) with a Hash/Array tree contents (data). For details on this functions, see rh_merge | def rh_merge!(data)
_rh_merge(self, data)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rh_merge(data)\n _rh_merge(clone, data)\n end",
"def merge(hash); end",
"def merge(hash); end",
"def merge(hash); end",
"def deep_merge!(data)\n merger = lambda do |_key, v1, v2|\n Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2\n end\n merge!(data, &merger)\n ... | [
"0.7709388",
"0.6946114",
"0.6946114",
"0.6946114",
"0.6810289",
"0.66208786",
"0.66208786",
"0.6526052",
"0.6514497",
"0.65080833",
"0.64784604",
"0.6426913",
"0.64115846",
"0.64077103",
"0.6384978",
"0.63511044",
"0.6344408",
"0.630933",
"0.6307362",
"0.6282395",
"0.6282395... | 0.7381702 | 1 |
Internal function to execute the merge on one key provided by _rh_merge if refuse_discordance is true, then result[key] can't be updated if stricly not of same type. | def _do_rh_merge(result, key, data, refuse_discordance = false)
value = data[key]
return if _rh_merge_do_add_key(result, key, value)
return if _rh_merge_recursive(result, key, data)
return if refuse_discordance
return unless _rh_struct_changing_ok?(result, key, data)
return unless _rh_merge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rh_merge(result, data)\n return _rh_merge_choose_data(result, data) unless data.is_a?(Hash)\n\n data.each do |key, _value|\n next if [:__struct_changing, :__protected].include?(key)\n\n _do_rh_merge(result, key, data)\n end\n [:__struct_changing, :__protected].each do |key|\n # Refu... | [
"0.66566783",
"0.6546197",
"0.5866346",
"0.56332564",
"0.53934026",
"0.53718096",
"0.53412914",
"0.53256875",
"0.5317653",
"0.52883005",
"0.52566755",
"0.5231188",
"0.5226204",
"0.52182066",
"0.51989967",
"0.5190673",
"0.51871425",
"0.51842844",
"0.51671237",
"0.51543087",
"0... | 0.8479817 | 0 |
Created On: 08/11/2014 Purpose: To get country statistics report ++ | def get_country_statistics_report(country_list, device_access)
@country_hash = {}
country_list.each do |country|
country_count = device_access.where(:access_country => country).count
@country_hash[country] = country_count
end
country_stat = @country_hash.sort_by {|_key, value| value}.revers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country; end",
"def country; end",
"def country; end",
"def countries_geo_entity_stats\n countries.present? ? GeoEntityStat.where(geo_entity_id: countries.map(&:id)) : geo_entity_stats\n end",
"def country_details(region, input)\n country = @countries[input - 1]\n\n Table.display_as_summary(c... | [
"0.6671692",
"0.6671692",
"0.6671692",
"0.66341335",
"0.66064835",
"0.6473873",
"0.64499825",
"0.63868284",
"0.6376618",
"0.6353003",
"0.6335491",
"0.63140094",
"0.62906873",
"0.62640035",
"0.62503564",
"0.6236346",
"0.6235966",
"0.62233686",
"0.62133247",
"0.61735654",
"0.61... | 0.73234856 | 0 |
Created On: 08/11/2014 Purpose: To get city statistics report ++ | def get_city_statistics_report(city_list, device_access)
@city_hash = {}
city_list.each do |city|
city_count = device_access.where(:access_city => city).count
@city_hash[city] = city_count
end
city_stat = @city_hash.sort_by {|_key, value| value}.reverse
hash = Hash[*city_stat.flatten]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_data\n House.cities.each_with_object([]) do |city, report|\n sum_house_daylights = House.sum_house_daylights(city)\n item = {\n name: city,\n daylight: average_house_daylights(sum_house_daylights).round(1).to_s,\n }\n report << item\n end\n end",
"def get_n... | [
"0.70277655",
"0.6519229",
"0.64871705",
"0.6361573",
"0.6277916",
"0.6140002",
"0.61096627",
"0.61096627",
"0.61081153",
"0.61061937",
"0.61061937",
"0.61061937",
"0.61061937",
"0.60661817",
"0.60499763",
"0.6043724",
"0.5992022",
"0.5991582",
"0.59725887",
"0.59559923",
"0.... | 0.73081815 | 0 |
Created On: 05/01/2014 Purpose: To get listen media count country vice ++ | def play_count_country_vice(country_lists,device_accesses,listen_medias,sorted_array = [])
@device_accesses = device_accesses
@listen_medias = listen_medias
country_lists.each do |country_name|
id_lists = @device_accesses.where(:access_country => country_name).map(&:id)
add_count=[]
id_lis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_media\n general_data['nb_media']\n end",
"def media_object_count\n @media_object_count ||= MediaObject.where(\"collection_ssim\" => name).count\n end",
"def get_listen_count(device_access_id,listen_medias)\n listen_medias.where(:device_access_id => device_access_id).count rescue nil\n ... | [
"0.6876442",
"0.63025284",
"0.628603",
"0.6176559",
"0.61061996",
"0.6085936",
"0.6083711",
"0.6083323",
"0.6051409",
"0.6039257",
"0.5981409",
"0.5979366",
"0.59754515",
"0.5953041",
"0.59466374",
"0.5913393",
"0.59101397",
"0.58907956",
"0.5866429",
"0.5863772",
"0.58630204... | 0.6455097 | 1 |
Created On: 05/01/2014 Purpose: To get state from city ++ | def get_city_state(city)
DeviceAccess.where(access_city: city).last.access_state rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state(city)\n city = append_country(city)\n request = Request.new(:query => city, :output => \"json\")\n response = JSON.parse(request.execute!)\n if response[\"Status\"][\"code\"] == 200\n response[\"Placemark\"][0][\"AddressDetails\"][\"Country\"][\"AdministrativeArea\"][\"Administ... | [
"0.78866184",
"0.7468075",
"0.7364859",
"0.7095594",
"0.70820695",
"0.69557536",
"0.69557536",
"0.694709",
"0.69435513",
"0.6941228",
"0.6898114",
"0.6890261",
"0.6890261",
"0.6845333",
"0.6845333",
"0.68107957",
"0.68089175",
"0.68089175",
"0.6795827",
"0.67792064",
"0.67670... | 0.75993824 | 1 |
GET /username_cookies/1 GET /username_cookies/1.json | def show
@username_cookie = UsernameCookie.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @username_cookie }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cookies\n if cookies.signed[:name].present? && cookies.signed[:email].present?\n render json: { allow: true, name: cookies.signed[:name], email: cookies.signed[:email] }\n else\n render json: { allow: false }\n end\n end",
"def new\n @username_cookie = UsernameCookie.new\n\n res... | [
"0.666682",
"0.661203",
"0.65926945",
"0.6536844",
"0.64701635",
"0.64571476",
"0.64571476",
"0.64571476",
"0.64571476",
"0.64571476",
"0.64571476",
"0.64571476",
"0.63908243",
"0.6372121",
"0.63702923",
"0.6334846",
"0.6296664",
"0.6284103",
"0.62789625",
"0.6268361",
"0.622... | 0.71412313 | 0 |
GET /username_cookies/new GET /username_cookies/new.json | def new
@username_cookie = UsernameCookie.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @username_cookie }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @username_cookie = UsernameCookie.new(params[:username_cookie])\n\n respond_to do |format|\n if @username_cookie.save\n format.html { redirect_to @username_cookie, notice: 'Username cookie was successfully created.' }\n format.json { render json: @username_cookie, status: :cre... | [
"0.7236221",
"0.7074697",
"0.6533255",
"0.6389992",
"0.63502216",
"0.6290688",
"0.62468415",
"0.62126946",
"0.60776377",
"0.605743",
"0.60219675",
"0.6008606",
"0.6006027",
"0.5994231",
"0.597861",
"0.5970128",
"0.59373",
"0.5927919",
"0.59244573",
"0.5918984",
"0.5918651",
... | 0.7941485 | 0 |
POST /username_cookies POST /username_cookies.json | def create
@username_cookie = UsernameCookie.new(params[:username_cookie])
respond_to do |format|
if @username_cookie.save
format.html { redirect_to @username_cookie, notice: 'Username cookie was successfully created.' }
format.json { render json: @username_cookie, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend",
"def create\n \tcookies.signed[:username] = params[:session][... | [
"0.70282894",
"0.6747255",
"0.6416628",
"0.63507915",
"0.6194151",
"0.614814",
"0.6139925",
"0.6095302",
"0.6072791",
"0.6068868",
"0.60643744",
"0.6019987",
"0.5963435",
"0.5963435",
"0.5963435",
"0.5963435",
"0.5963435",
"0.5963435",
"0.5963435",
"0.5956143",
"0.59257454",
... | 0.7165247 | 0 |
PUT /username_cookies/1 PUT /username_cookies/1.json | def update
@username_cookie = UsernameCookie.find(params[:id])
respond_to do |format|
if @username_cookie.update_attributes(params[:username_cookie])
format.html { redirect_to @username_cookie, notice: 'Username cookie was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @username_cookie = UsernameCookie.new(params[:username_cookie])\n\n respond_to do |format|\n if @username_cookie.save\n format.html { redirect_to @username_cookie, notice: 'Username cookie was successfully created.' }\n format.json { render json: @username_cookie, status: :cre... | [
"0.62237877",
"0.59685695",
"0.58763754",
"0.5856852",
"0.58295923",
"0.58131045",
"0.57982934",
"0.57786036",
"0.57616216",
"0.5760699",
"0.57233286",
"0.5719673",
"0.57148725",
"0.5692965",
"0.5687843",
"0.5682418",
"0.5679484",
"0.5643379",
"0.5640627",
"0.56324404",
"0.56... | 0.6980895 | 0 |
DELETE /username_cookies/1 DELETE /username_cookies/1.json | def destroy
@username_cookie = UsernameCookie.find(params[:id])
@username_cookie.destroy
respond_to do |format|
format.html { redirect_to username_cookies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_cookie name, path\r\n command 'deleteCookie', name, path\r\n end",
"def delete_cookie name\n @response.delete_cookie name\n end",
"def delete_cookie(name); end",
"def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end",... | [
"0.7660538",
"0.74207956",
"0.73470616",
"0.70989513",
"0.7055573",
"0.6955128",
"0.6723728",
"0.66885024",
"0.6678918",
"0.6662511",
"0.6649223",
"0.66455483",
"0.66165936",
"0.6593298",
"0.6543894",
"0.64898294",
"0.6472694",
"0.6472694",
"0.6472011",
"0.6471079",
"0.646460... | 0.76348335 | 1 |
method compare contractor data hashes | def compare_contractor_data(contractor)
message_good = "Each attribute value is equal to the corresponding attributes of a freelancer #{contractor[:name]} on a profile page:\n#{contractor}"
message_bad = "Freelancer attribute values not equal to the corresponding attributes in the shared page. Expected:\n#{co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_same_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.new(0,0,s,0.0,\"90a2\")\r\n\t\ttb.set_calculated_hash(\"90a2\")\r\n\t\t\r\n\t\tassert_equal(1, tb.compare_current_hash)\r\n\tend",
"def test_different_hashes\r\n\t\ts = \"Addr1<Addr2(100):Addr3<Addr4(500)\"\r\n\t\ttb = Block.... | [
"0.6754163",
"0.666868",
"0.65692586",
"0.65692586",
"0.65692586",
"0.65692586",
"0.65692586",
"0.65692586",
"0.65692586",
"0.63513196",
"0.63345236",
"0.6251595",
"0.6182625",
"0.61696875",
"0.61654735",
"0.6145629",
"0.6126361",
"0.6124191",
"0.6124191",
"0.6124191",
"0.612... | 0.6989397 | 0 |
method checks contractor data by keyword | def check_contractor_by_keyword(keyword)
match = @hash_contractor.find do |pair|
pair.last.downcase.include? keyword.downcase
end
(match == nil) ? (puts "#{@hash_contractor[:name]} dont have a #{keyword}") : (puts "The #{keyword} was include in #{match}, #{@hash_contractor[:name]}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_keyword(candidate, keyword)\n puts \"\\n#{candidate[:name]}\\nAttributes containing '#{keyword}': \"\n candidate.each { |k, v| puts k if v.to_s.include?(keyword) }\n puts \"Attributes not containing '#{keyword}':\"\n candidate.each { |k, v| puts k unless v.to_s.include?(keyword)}\n end",
... | [
"0.5875342",
"0.5729285",
"0.5527747",
"0.5392854",
"0.53882164",
"0.53882164",
"0.53565216",
"0.53565216",
"0.53465486",
"0.5319063",
"0.5317044",
"0.5288998",
"0.52725273",
"0.52521265",
"0.5246642",
"0.52169985",
"0.52038676",
"0.5198129",
"0.5151281",
"0.5122915",
"0.5121... | 0.7204914 | 0 |
List the sales orders under this account | def index
@sales_orders = @customer.sales_orders
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sales_orders = SalesOrder.all\n end",
"def sales\n @orders = Order.where(seller: current_user.id).order(\"created_at DESC\")\n end",
"def list_orders\n Order.list(@current_user)\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\... | [
"0.752036",
"0.718857",
"0.71228445",
"0.6865054",
"0.6795823",
"0.67306465",
"0.66761994",
"0.6625378",
"0.66157407",
"0.66115594",
"0.66115594",
"0.6540638",
"0.6540638",
"0.652416",
"0.65212643",
"0.65206635",
"0.6518269",
"0.6511002",
"0.6503947",
"0.6503932",
"0.6443859"... | 0.7583141 | 0 |
Contact profile Only "Email" of customer account(AX.Customer) is changeable. | def profile
if request.post?
@customer.update_attributes :email => params[:customer][:email], :phone => params[:customer][:phone]
@store_user.my_account_log(@customer,"Update Profile Email: #{@customer.email} Phone: #{@customer.phone}")
@customer.update_ax
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def personal_profile\n RubyRedtail::Query.run(\"contacts/#{@id}/personalprofile\", @api_hash, \"GET\")\n end",
"def email; default_profile.try :email; end",
"def update_profile_email\n user_profile.update_attribute(:email, email) if saved_change_to_email?\n end",
"def customer_profile... | [
"0.6796298",
"0.6526886",
"0.6511111",
"0.63874984",
"0.6371345",
"0.6347491",
"0.62825084",
"0.6266809",
"0.604923",
"0.6016393",
"0.6011583",
"0.6005552",
"0.6003028",
"0.5976328",
"0.5940195",
"0.5912079",
"0.59075475",
"0.58509773",
"0.58488977",
"0.5844784",
"0.5844245",... | 0.71256965 | 0 |
Order History TODO: Find out the completed orders of current customer account. | def order_history
@orders = @customer.close_orders
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_orders()\n\t\twith_auth nil do |options|\n\t\t\tself.class.get(\"/api/v1/orders\", options)\n \tend\n\tend",
"def order_history(limit = 10)\n plain_orders = Fyb.private.getorderhistory(limit: limit).perform.parse\n error = plain_orders['error']\n\n fail Exception, error unless error ... | [
"0.67846155",
"0.66428006",
"0.6506397",
"0.6493447",
"0.64623666",
"0.63281834",
"0.63238096",
"0.62117016",
"0.61890954",
"0.6144186",
"0.61402255",
"0.61331505",
"0.60950536",
"0.6086065",
"0.60834295",
"0.60790026",
"0.60756993",
"0.60676146",
"0.6056458",
"0.6043835",
"0... | 0.78379375 | 0 |
Delete sales line of an open order via given id | def delete_sales_line
sales_line = ERP::SalesLine.find( params[:id], :include => "sales_order" )
@store_user.my_account_log(sales_line,"Delete Sales Line: #{sales_line.invent_trans_id} (#{sales_line.item_id})")
if @customer.open_orders.collect{|order| order.id}.include?( sales_line.sales_order.id ) && sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_sales_invoice!(id)\n delete(\"sales_invoices/#{id}\")\n end",
"def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end",
"def delete_sales_entry_from_sales_order\n @sales_order = SalesOrder.find_by_id params... | [
"0.7191335",
"0.7036305",
"0.70347667",
"0.70268524",
"0.7011492",
"0.6572518",
"0.6530496",
"0.6511341",
"0.6409515",
"0.6324507",
"0.632261",
"0.625593",
"0.62545407",
"0.6243178",
"0.6235454",
"0.62074715",
"0.6194714",
"0.61884665",
"0.6162448",
"0.615727",
"0.6145458",
... | 0.8255487 | 0 |
Update product quantity of sales line with given id | def update_sales_line_qty
sales_line = ERP::SalesLine.find params[:id]
result = sales_line.update_sales_qty( params[:value].to_i )
@store_user.my_account_log(sales_line,"Update Sales Line Qty: #{sales_line.invent_trans_id} (#{sales_line.item_id}), returns #{result}")
render :text => result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_product_qty\n @order = Spree::Order.find_by_id(params[:order_id])\n @line_item = Spree::LineItem.find_by_id(params[:line_item_id])\n request_to_update_qty = params[:quantity].to_i\n # code to find the order_total\n if @order.market_place.present?\n case @order.mark... | [
"0.7286502",
"0.72142226",
"0.7144943",
"0.7038057",
"0.6993245",
"0.697177",
"0.6956866",
"0.69196177",
"0.68746245",
"0.68467855",
"0.6830455",
"0.68247193",
"0.68189305",
"0.6801956",
"0.6786757",
"0.6782704",
"0.6778026",
"0.67523664",
"0.6694163",
"0.6694044",
"0.6693155... | 0.77470005 | 0 |
Move sales line with given id to another open order | def move_sales_line
=begin
sales_line = ERP::SalesLine.find params[:id]
@original_order_id = sales_line.erp_sales_order_id
sales_line.update_attribute :erp_sales_order_id, params[:target]
mark_as_unsync [@original_order_id, params[:target]]
=end
@sales_line = ERP::SalesLine.find params[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_sales_line( sales_line_id, target_order_id )\r\n sales_line = self.sales_lines.find sales_line_id\r\n target_order = self.customer.sales_orders.find target_order_id\r\n\r\n moving_qty = sales_line.remain_sales_physical\r\n if moving_qty.zero?\r\n self.errors.add :sales_lines, \"This sales... | [
"0.7951165",
"0.6301795",
"0.62164396",
"0.62020606",
"0.6030135",
"0.6030135",
"0.60238665",
"0.60203403",
"0.5993305",
"0.5978917",
"0.5947596",
"0.5893678",
"0.5888943",
"0.5830033",
"0.5809828",
"0.57957757",
"0.5781215",
"0.5753478",
"0.5739659",
"0.5739659",
"0.5689915"... | 0.75429773 | 1 |
Commit changes of sales order with given id to AX server. | def commit_order
order = @customer.open_orders.find params[:id]
unless !order.commit
headers['Content-Type'] = 'text/plain'
render :text => "Failed to connect with AX server."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit_orders\r\n orders = @customer.open_orders.find_all_by_synchronized( false )\r\n sales_id = \"\"\r\n orders.each do |o| sales_id += \"'#{o.sales_id}', \" end \r\n @store_user.my_account_log(@customer,\"Commit Sales Order Updates: #{sales_id}\")\r\n\r\n if orders.empty? || ERP::SalesOrde... | [
"0.706133",
"0.61689913",
"0.58067054",
"0.58067054",
"0.5658508",
"0.55772775",
"0.5566188",
"0.5561589",
"0.5535155",
"0.5535155",
"0.5525487",
"0.55223143",
"0.54974896",
"0.54317796",
"0.53934306",
"0.5352393",
"0.5285899",
"0.52817357",
"0.52787346",
"0.52727956",
"0.526... | 0.7198284 | 0 |
Commit all changed orders under customer's account | def commit_orders
orders = @customer.open_orders.find_all_by_synchronized( false )
sales_id = ""
orders.each do |o| sales_id += "'#{o.sales_id}', " end
@store_user.my_account_log(@customer,"Commit Sales Order Updates: #{sales_id}")
if orders.empty? || ERP::SalesOrder.commit_orders( orders... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit\r\n self.class.commit_orders [self]\r\n end",
"def submit_order!\n @customer_order.transaction do\n cache_addresses!\n mark_deliveries_as_pending!\n cache_billing_address! unless @customer_order.anon_billing_address?\n update_subtotal_items!\n as... | [
"0.6986604",
"0.6477692",
"0.6333579",
"0.6221034",
"0.6045331",
"0.603372",
"0.59519094",
"0.5916829",
"0.5779564",
"0.5764588",
"0.57638794",
"0.5753903",
"0.5660284",
"0.56332177",
"0.56252193",
"0.5624888",
"0.561535",
"0.558923",
"0.558393",
"0.5488663",
"0.54863745",
... | 0.8004923 | 0 |
Return address's JSON for filling address form in "MyAccount / OpenOrders" (while editing a billing / shipping address) | def get_address_json
address = @customer.addresses.find( params[:id] )
render :text => address.attributes.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_address(options)\n address = options[:billing_address]\n\n post = {}\n post['Address 1'] = address[:address1] unless empty?(address[:address1])\n post['Address 2'] = address[:address2] unless empty?(address[:address2])\n post['City'] = address[:city] unless empty?(address... | [
"0.7202232",
"0.71755147",
"0.7173584",
"0.7112513",
"0.7093242",
"0.6926755",
"0.6901112",
"0.68754226",
"0.6872379",
"0.68548584",
"0.68484205",
"0.6846325",
"0.67974365",
"0.67877334",
"0.6725801",
"0.6724113",
"0.66894776",
"0.6676635",
"0.6675103",
"0.6662099",
"0.661562... | 0.75897086 | 0 |
Update delivery mode id of sales order with given id | def update_delivery_mode
sales_order = @customer.open_orders.find_by_id( params[:id] )
sales_order.delivery_mode_id = params[:delivery_mode_id]
render :text => sales_order.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_delivery_order\n @delivery_order = DeliveryOrder.find(params[:id])\n end",
"def set_order\n @order = Order.find(params[:id])\n @delivery = Delivery.find(@order.delivery_id)\n end",
"def update\n @sales_order = SalesOrder.find(params[:id])\n\n # update delivery_status(includes... | [
"0.70056903",
"0.664061",
"0.6504144",
"0.64623064",
"0.63080394",
"0.63080394",
"0.63080394",
"0.63080394",
"0.63080394",
"0.63080394",
"0.63080394",
"0.6276239",
"0.62408423",
"0.6236928",
"0.6202967",
"0.6189267",
"0.61659944",
"0.61258143",
"0.6118086",
"0.6083522",
"0.60... | 0.8249441 | 0 |
Initialize ERPCustomer and ERPContactPerson via logined user's email. | def init_user
#logger.info session.inspect
@store_user = session[:web_user]
@store_user.request_path = request.path + "?" + request.query_string
@customer = ERP::Customer.find_by_account_num @store_user.erp_account_number
if @customer.nil?
render :partial => "unaccessible", :layout... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_initialize\n if self.new_record?\n self.author_email_address = 'test@test.com'\n end\n end",
"def initialize_email\n require File.expand_path('../../appenders/email', __FILE__)\n end",
"def after_initialize\n if new_record?\n self.email ||= \"jakub.hozak@gmail.... | [
"0.6232575",
"0.61504364",
"0.61116004",
"0.5989782",
"0.59440607",
"0.58635557",
"0.56136346",
"0.5609897",
"0.55926967",
"0.55457896",
"0.55336964",
"0.55041265",
"0.5500439",
"0.54990166",
"0.549587",
"0.54816705",
"0.5475785",
"0.54365516",
"0.54329795",
"0.54312396",
"0.... | 0.642711 | 0 |
Get specified contact person using given name. | def get_contact
@contact = @customer.contact_people.find_by_name params[:id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_contact(name)\n contacts = {\n \"Mike Dane\" => \"(02) 9876 0402\",\n \"Tom Sanchez\" => \"(02) 9872 6432\",\n \"Karen Posner\" => \"(02) 9476 5488\",\n \"Ryan Terry\" => \"(08) 7776 5532\",\n \"Chris Freeman\" => \"(05) 9666 8412\"\n }\n\n for contact in contact... | [
"0.7287245",
"0.70697236",
"0.6979043",
"0.68891877",
"0.6626884",
"0.66163087",
"0.66163087",
"0.64621943",
"0.64332324",
"0.6355308",
"0.6355308",
"0.6336558",
"0.63358283",
"0.62979287",
"0.62979287",
"0.62979287",
"0.62979287",
"0.62979287",
"0.6218429",
"0.61829454",
"0.... | 0.74601007 | 0 |
Mark the sales order(s) with given id(s) as unsynchronized. This method MUST be called after updating anything about these orders ( ERPAddresses, SalesLines, etc. ). | def mark_as_unsync(order_ids)
order_ids = [order_ids] unless order_ids.is_a?(Array)
@customer.sales_orders.update_all "synchronized = false", ["id in (?)", order_ids]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_ids\n self.task_id = @task_number\n self.order_id = @order_number\n end",
"def move_sales_line\r\n=begin\r\n sales_line = ERP::SalesLine.find params[:id]\r\n @original_order_id = sales_line.erp_sales_order_id\r\n sales_line.update_attribute :erp_sales_order_id, params[:target]\r\n \... | [
"0.5774726",
"0.56881034",
"0.5487312",
"0.5487312",
"0.547677",
"0.5456823",
"0.5411922",
"0.5388102",
"0.5331965",
"0.52381945",
"0.51438457",
"0.51162374",
"0.5106291",
"0.5096775",
"0.5087578",
"0.5081171",
"0.5075133",
"0.5058175",
"0.5012792",
"0.5012114",
"0.49914965",... | 0.74006194 | 0 |
After signed in My Account, start a backend process to synchronize customer's account including orders. Note: Unsaved changes from last login are discarded. | def synchronize_customer_account
return false unless session[:web_user] && request.post?
unless (cust_id = session[:web_user].erp_account_number).blank?
customer = ERP::Customer.find_by_account_num(cust_id) ||
ERP::Customer.new(:account_num => cust_id)
customer.synchronize(true)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n handle_service do\n @order.save!\n # create an activity register\n ::Activity.new_activity(@user, :created, @order, nil)\n ::JobActivation.perform_later(@order, @user)\n end\n\n @order\n end",
"def submit_order!\n @customer_order.transaction do\n ... | [
"0.595816",
"0.5875038",
"0.58296734",
"0.5761117",
"0.5729202",
"0.5722417",
"0.5673489",
"0.5649308",
"0.56413364",
"0.5612919",
"0.5594063",
"0.5539273",
"0.5491705",
"0.54705316",
"0.5467064",
"0.54059744",
"0.53117275",
"0.52932996",
"0.52900213",
"0.5281833",
"0.5268900... | 0.6340605 | 0 |
Public: Formats a datauri based HTML IMG tag for the file. Returns the entire IMG tag as a String. | def as_img_tag()
"<img src='#{self.encode}' />"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_uri(image)\n mime_type = image.svg? ? 'image/svg+xml' : image.mime_type\n \"'data:#{mime_type};base64,#{Base64.encode64(image.blob).gsub(/\\r?\\n/, '')}'\"\n end",
"def to_data_uri\n \"url(data:image/svg+xml;base64,#{to_base64});\"\n end",
"def data_uri\n data = Base64.encode... | [
"0.655535",
"0.6232312",
"0.6125246",
"0.6061649",
"0.59991056",
"0.5890778",
"0.58529246",
"0.58281356",
"0.5805518",
"0.5791674",
"0.57703424",
"0.5752037",
"0.5677066",
"0.5651576",
"0.56212115",
"0.5584148",
"0.55580264",
"0.55569035",
"0.55525017",
"0.5548703",
"0.554722... | 0.6632851 | 0 |
Public: Formats a CSS background image rule for the file, and wraps it in a class definition. klass The name of the class to use for the CSS rule. Optional. If ommitted, the default will the basename of the file path. Returns the class wrapped CSS background rule as a String. | def as_css_background_with_class(klass=nil)
klass=File.basename(@file_path).tr('.','_') unless klass
".#{klass} {\n #{self.as_css_background}\n}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_css_background()\n \"background: url(#{self.encode}) no-repeat;\"\n end",
"def class_file klass_name\n name = klass_name.split('::').last\n File.join class_path(klass_name), \"cdesc-#{name}.ri\"\n end",
"def file_linker(klass = nil)\n klass ? @file_linker = klass : get_inherited_at... | [
"0.51849985",
"0.50258887",
"0.49501657",
"0.4906297",
"0.48422053",
"0.47846317",
"0.47634044",
"0.47355697",
"0.4717101",
"0.47041813",
"0.46950427",
"0.46693936",
"0.46611258",
"0.46506253",
"0.46431187",
"0.46363416",
"0.45550895",
"0.4537252",
"0.45228663",
"0.45189008",
... | 0.82585263 | 0 |
Public: Formats a CSS background image rule for the file. Returns the CSS background rule as a String. | def as_css_background()
"background: url(#{self.encode}) no-repeat;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_background\n css = \"\"\n css += \"background-color: #{self.background_color};\" unless self.background_color.blank?\n if self.background_image_file_name.blank?\n css += \"background-image: none; \"\n else\n css += \"background-image: url('#{self.background_image.url(\"original\", ... | [
"0.6116016",
"0.6110001",
"0.5880279",
"0.56555027",
"0.55505973",
"0.54491764",
"0.51739293",
"0.505619",
"0.48845205",
"0.48193994",
"0.4815815",
"0.48022708",
"0.47672442",
"0.4752824",
"0.47404608",
"0.4730031",
"0.47261375",
"0.47046033",
"0.4703655",
"0.4641412",
"0.463... | 0.66690105 | 0 |
Public: Encodes file into a CSS string representation. Returns the Base64 encoded String with filetype information embedded. | def encode()
"data:#{self.filetype};base64," + self.raw_encode
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64_encode\n Base64.encode64(file_contents)\n end",
"def encode_attachment(file_path:, file_type: nil)\n # try to find file_type\n if file_type.nil?\n content_types = MIME::Types.type_for(file_path)\n file_type = content_types.first.content_type if content_types.any?\n end... | [
"0.62018394",
"0.60733205",
"0.6025695",
"0.5805515",
"0.55570173",
"0.53412",
"0.53347754",
"0.52877456",
"0.5252136",
"0.52432954",
"0.5236314",
"0.52030176",
"0.5185328",
"0.51304704",
"0.51236224",
"0.5106166",
"0.5062003",
"0.5047567",
"0.5035784",
"0.502976",
"0.5002851... | 0.6224828 | 0 |
Public: file into its raw Base64 string representation. Returns the Base64 encoded String. | def raw_encode()
return Base64.encode64(File.read @file_path).delete("\n") if RUBY_VERSION < "1.9.0"
Base64.strict_encode64(File.read @file_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base64\n binary = open { |io| io.read }\n result = Base64.strict_encode64(binary)\n binary.clear # deallocate string\n result\n end",
"def base64\n binary = open { |io| io.read }\n result = Base64.encode64(binary).chomp\n binary.clear # de... | [
"0.8243077",
"0.8152603",
"0.8091158",
"0.77152807",
"0.75076354",
"0.73864985",
"0.7129103",
"0.70412093",
"0.6953615",
"0.6900227",
"0.67988527",
"0.6794249",
"0.67909104",
"0.6775498",
"0.67481357",
"0.67096156",
"0.66520727",
"0.6636371",
"0.66254175",
"0.6582562",
"0.658... | 0.83455765 | 0 |
Protected: is the file of an image format we support? Returns a Boolean representing image format validity. | def valid_image_format?
VALID_FILE_MIMETYPES.include? self.filetype
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n image_resource? && supported_format?\n end",
"def valid_file?\n if @image.size.zero?\n errors.add_to_base(\"Please enter an image filename\")\n return false\n end\n unless @image.content_type =~ /^image/\n errors.add(:image, \"is not a recognized format\")\n return f... | [
"0.833717",
"0.80348176",
"0.7844336",
"0.77031714",
"0.76832324",
"0.76832324",
"0.767027",
"0.75332147",
"0.75325483",
"0.75274813",
"0.73949313",
"0.73759717",
"0.7371084",
"0.73615336",
"0.7313972",
"0.7296801",
"0.7254463",
"0.7242669",
"0.7222223",
"0.72180223",
"0.7197... | 0.876727 | 0 |
Like self.find(), but returns nil when a DigitalObject isn't found instead of raising an error | def find_by_pid(pid)
find(pid)
rescue Hyacinth::Exceptions::DigitalObjectNotFoundError
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(pid)\n digital_object_record = ::DigitalObjectRecord.find_by(pid: pid)\n\n if digital_object_record.nil?\n raise Hyacinth::Exceptions::DigitalObjectNotFoundError, \"Couldn't find DigitalObject with pid #{pid}\"\n end\n\n # Retry after Fedora timeouts / unreachable host\n fo... | [
"0.74274224",
"0.6814657",
"0.6559267",
"0.6468734",
"0.6432075",
"0.63332105",
"0.62680995",
"0.6197517",
"0.6134887",
"0.6084389",
"0.6084262",
"0.60618645",
"0.60472596",
"0.6045599",
"0.6045599",
"0.6028982",
"0.60053873",
"0.5977807",
"0.5976942",
"0.5947629",
"0.5902561... | 0.75704217 | 0 |
Overrides the parent method to ensure the current ping node is destroyed | def inherit(node)
ping.remove
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_node_destroy( node )\n\t\t\tself.log.debug \"unhandled on_node_destroy for %p\" % [ node ]\n\t\tend",
"def delete_ping\n delete 'ping'\n end",
"def teardown\n response = Vanagon::Utilities.http_request(\n \"#{@pooler}/vm/#{@target}\",\n \"DELETE\",\n nil,\n ... | [
"0.6354683",
"0.633756",
"0.6294712",
"0.6251677",
"0.62298685",
"0.618085",
"0.6174263",
"0.61154544",
"0.6078201",
"0.6063464",
"0.6055601",
"0.605479",
"0.5984734",
"0.5982262",
"0.5982262",
"0.5952237",
"0.5900358",
"0.5863139",
"0.5787076",
"0.5766752",
"0.57618076",
"... | 0.6927966 | 0 |
Ping node accessor If a ping node exists it will be returned. Otherwise a new node will be created and returned | def ping
p = find_first 'ns:ping', :ns => self.class.registered_ns
unless p
(self << (p = XMPPNode.new('ping', self.document)))
p.namespace = self.class.registered_ns
end
p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping\n response = connection.get(get_ping_url)\n if response.success?\n PingResponse.new(response.body)\n end\n end",
"def pingnode(address, interface=nil)\n out = interface ? `ping -I #{interface} -c 5 #{address}` : `ping -c 5 #{address}`\n if $? != 0\n # Ping command... | [
"0.6521571",
"0.6185138",
"0.61219424",
"0.6079024",
"0.6055741",
"0.6040929",
"0.6020641",
"0.5991688",
"0.5990256",
"0.5943572",
"0.59406835",
"0.59399575",
"0.58999497",
"0.5873468",
"0.5872066",
"0.58527225",
"0.58280146",
"0.58013415",
"0.57956356",
"0.57860965",
"0.5722... | 0.7059382 | 0 |
POST /boat_types POST /boat_types.json | def create
@boat_type = BoatType.new(boat_type_params)
respond_to do |format|
if @boat_type.save
format.html { redirect_to edit_boat_type_path(@boat_type)}
format.json { render json: @boat_type.hash_view('control'), status: :created, location: @boat_type }
else
format.html { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def boat_type_params\n params.require(:boat_type).permit(:ru_name, :en_name, :design_category, :copy_params_table_from_id, :boat_series_id, :body_type, :ru_description, :en_description, :ru_slogan, :en_slogan, :cnf_data_fi... | [
"0.6612902",
"0.65330064",
"0.6479013",
"0.63873273",
"0.63754666",
"0.629241",
"0.6270711",
"0.6210799",
"0.618794",
"0.614453",
"0.6124388",
"0.61091834",
"0.60448927",
"0.6033925",
"0.60282665",
"0.59335744",
"0.59335744",
"0.5928024",
"0.5919358",
"0.5919358",
"0.58681124... | 0.6875857 | 0 |
PATCH/PUT /boat_types/1 PATCH/PUT /boat_types/1.json | def update
prms = @boat_type.is_modification? ? modification_params : boat_type_params
respond_to do |format|
if @boat_type.update(prms)
format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }
format.json { render json: @boat_type.hash_view('contro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @kind_of_boat.update(kind_of_boat_params)\n format.html { redirect_to @kind_of_boat, notice: 'Kind of boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @kind_of_boat }\n else\n format.html { render :edit... | [
"0.69488794",
"0.67846626",
"0.6779809",
"0.67107934",
"0.6644783",
"0.65858734",
"0.65858734",
"0.65858734",
"0.65431744",
"0.6492222",
"0.6469287",
"0.64582306",
"0.64381003",
"0.6426274",
"0.6350214",
"0.6291226",
"0.6237887",
"0.6204577",
"0.6184031",
"0.6162096",
"0.6146... | 0.7168352 | 0 |
Determine available moves receive p1 moves and p2 moves return array of available moves | def open_squares(p1_moves, p2_moves)
avail_moves = Array.new
SQUARES.each { |n| avail_moves << n unless p1_moves.include?(n) || p2_moves.include?(n) }
return avail_moves
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def moves_available\n # return what moves are available to this piec\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_... | [
"0.72172505",
"0.6733831",
"0.6693919",
"0.6663384",
"0.64564115",
"0.64156556",
"0.64130557",
"0.64099115",
"0.6341616",
"0.6334819",
"0.6317007",
"0.6278047",
"0.6267057",
"0.62636286",
"0.6245892",
"0.6237971",
"0.62254995",
"0.62038827",
"0.61890054",
"0.6182633",
"0.6149... | 0.7014443 | 1 |
set columns names . NOTE that we are not clearing chash here. In case, someone changes table and columns. | def columns=(array)
#$log.debug "tabular got columns #{array.count} #{array.inspect} " if $log
@columns = array
@columns.each_with_index { |e,i|
#@chash[i] = ColumnInfo.new(c, c.to_s.length)
c = get_column(i)
c.name = e
c.width = e.to_s.length
#@chash[i] = c
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def columns= columns\n columns.each { |c| c.table = self }\n @columns = columns\n end",
"def columns(table_name, name = nil) end",
"def initialize_columns\n @columns = []\n valid_table = table.alias('valid_taxon_names')\n\n @columns.push({ header: 'ro', projected: rank_over(ta... | [
"0.68806785",
"0.6714919",
"0.66101706",
"0.6537603",
"0.65074956",
"0.6458233",
"0.6431775",
"0.6431775",
"0.6371532",
"0.6305882",
"0.6231081",
"0.6224894",
"0.61524403",
"0.61167276",
"0.61036533",
"0.6091803",
"0.6084889",
"0.60723287",
"0.60540897",
"0.6042492",
"0.60394... | 0.67733675 | 1 |
set alignment of given column offset | def column_align colindex, lrc=:NONE
if lrc == :NONE
return get_column(colindex).align
#return @calign[colindex]
end
raise ArgumentError, "wrong alignment value sent" if ![:right, :left, :center].include? lrc
get_column(colindex).align = lrc
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align_column colindex, lrc\n raise ArgumentError, \"wrong alignment value sent\" if ![:right, :left, :center].include? lrc\n @calign[colindex] ||= lrc\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", nil, lrc)\n else\n @chash[colindex].align = lrc\n en... | [
"0.6934832",
"0.67424357",
"0.6686975",
"0.6625456",
"0.6587735",
"0.6587735",
"0.6460359",
"0.6460359",
"0.6433331",
"0.63598865",
"0.62720424",
"0.62634814",
"0.62217283",
"0.6138361",
"0.611345",
"0.60497516",
"0.6049009",
"0.6045546",
"0.6045546",
"0.6001273",
"0.5967639"... | 0.6835414 | 1 |
return an array of visible columns names | def visible_column_names
visible = []
@chash.each_with_index do |c, ix|
if !c.hidden
if block_given?
yield c.name, ix
else
visible << c.name
end
end
end
return visible unless block_given?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_columns_visible\n if columns_visible\n return JSON.parse columns_visible\n else\n return []\n end\n end",
"def get_columns_visible\n columns_visible ? JSON.parse(columns_visible) : []\n end",
"def get_visible_columns\n return @visible_columns_cache unless @visible_columns_c... | [
"0.79247165",
"0.7845815",
"0.78433377",
"0.7817416",
"0.765696",
"0.7655768",
"0.75953966",
"0.7585849",
"0.7460832",
"0.72860515",
"0.72471976",
"0.72181123",
"0.7210697",
"0.7187838",
"0.717872",
"0.7132154",
"0.70969605",
"0.70618695",
"0.70578426",
"0.7038825",
"0.703694... | 0.8338983 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.