query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Use callbacks to share common setup or constraints between actions. | def set_employee
@employee = Employee.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def employee_params
params.require(:employee).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Immediately disconnect from the server, normally the garbage collector will disconnect automatically when a connection is no longer needed. Explicitly closing this will free up server resources sooner than waiting for the garbage collector. | def close()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect\n @server = nil\n @status = :disconnected\n end",
"def disconnect\n @connection.close if connected?\n @connection = nil\n end",
"def disconnect\n unless @server.nil?\n @server.cmd \"quit\"\n @server.close\n end\n @authenticated = false\n ... | [
"0.7495734",
"0.7439601",
"0.742584",
"0.7293161",
"0.7279424",
"0.72778237",
"0.71725005",
"0.71725005",
"0.7165585",
"0.7140823",
"0.7140823",
"0.7140823",
"0.7140823",
"0.7105412",
"0.70503324",
"0.7046527",
"0.7039868",
"0.69513273",
"0.69505125",
"0.6939492",
"0.6925858"... | 0.0 | -1 |
client.abandon_results! When using MULTI_STATEMENTS support, calling this will throw away any unprocessed results as fast as it can in order to put the connection back into a state where queries can be issued again. | def abandon_results!()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard_results; end",
"def clear_result; end",
"def cancel\n @client.call('unrecur', @jid)\n end",
"def reset\n\t @result_set = nil\n\t self\n\tend",
"def abandon!\n authentication.abandon!\n end",
"def shutdown() \n results.close\n @delete_results = false\n end",
... | [
"0.65328425",
"0.58121544",
"0.563419",
"0.56045413",
"0.5497814",
"0.5450634",
"0.54432",
"0.54406613",
"0.5410774",
"0.5333708",
"0.5322152",
"0.5302076",
"0.52953947",
"0.52633023",
"0.5226806",
"0.5219252",
"0.5201536",
"0.51976997",
"0.51734537",
"0.5172571",
"0.5166813"... | 0.7537483 | 0 |
client.escape(string) Escape +string+ so that it may be used in a SQL statement. | def escape(string)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escape(string)\n @conn.escape(string.to_s)\n end",
"def escape(s)\n dummy_conn.escape(s)\n end",
"def escape_string(str)\n raw_connection.escape(str)\n end",
"def escape(string)\n # This code is taken directly from the documentation so we dont have to rely on the SQLite... | [
"0.87118375",
"0.8362337",
"0.81531495",
"0.78528523",
"0.78372353",
"0.7822767",
"0.76672065",
"0.76276463",
"0.75679797",
"0.7524391",
"0.74259454",
"0.7353424",
"0.73352385",
"0.7308199",
"0.72718394",
"0.7265975",
"0.7260804",
"0.72375655",
"0.7231755",
"0.71756005",
"0.7... | 0.772451 | 6 |
client.info Returns a string that represents the client library version. | def info()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_info\n \"5.0.0\"\n end",
"def client_version\n ClientVersion\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSION + \", API v2, converter \" + @helper.getConverterVersion()\n end",
"def getVersion()\n return \"client \" + CLIENT_VERSI... | [
"0.779927",
"0.7570547",
"0.74523723",
"0.74523723",
"0.74523723",
"0.74523723",
"0.74523723",
"0.74523723",
"0.74523723",
"0.70872587",
"0.707312",
"0.70129335",
"0.70129335",
"0.69456756",
"0.6934649",
"0.693085",
"0.69091326",
"0.68994004",
"0.6822208",
"0.6775555",
"0.674... | 0.0 | -1 |
client.server_info Returns a string that represents the server version number | def server_info()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_server_version\n server_info[:server_version]\n end",
"def server_version\n ServerVersion.new(server_info[\"version\"])\n end",
"def info\n response = rpc.request Riakpb::Util::MessageCode::GET_SERVER_INFO_REQUEST\n\n @node = response.node\n @server_v... | [
"0.8401739",
"0.8044778",
"0.77923614",
"0.7700643",
"0.76930517",
"0.7686442",
"0.75869834",
"0.7484647",
"0.74782294",
"0.73494476",
"0.7245557",
"0.72191197",
"0.71653694",
"0.712763",
"0.70883054",
"0.70788693",
"0.70427895",
"0.7036223",
"0.70106477",
"0.69814605",
"0.69... | 0.7173057 | 12 |
client.socket Return the file descriptor number for this client. | def socket()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fd\n return @sock\n end",
"def socket #:nodoc:\n return @socket\n end",
"def socket\n @socket\n end",
"def socket_port; end",
"def client_name\n sockname[0]\n end",
"def fileno\n Cproton.pn_selectable_get_fd(@impl)\n end",
"def socket\n @socket |... | [
"0.7439351",
"0.67188334",
"0.66017896",
"0.65331835",
"0.63315016",
"0.6300606",
"0.62447387",
"0.6193496",
"0.6188319",
"0.61722267",
"0.61713296",
"0.60992724",
"0.6013519",
"0.5996655",
"0.59386",
"0.593112",
"0.5907626",
"0.58651006",
"0.5842177",
"0.5842177",
"0.5815715... | 0.58200014 | 20 |
client.async_result Returns the result for the last async issued query. | def async_result()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def async_result(url:)\n AsyncResult.new(url: url)\n end",
"def long_poll_result\n response = async_response(api_url)\n return response[:body]\n end",
"def get_result\n\t\texecute unless @result\n\t\treturn @result\n\tend",
"def result\n wait_for\n # If the task threw a... | [
"0.626612",
"0.60333186",
"0.6019623",
"0.6006107",
"0.5878902",
"0.5817618",
"0.57950693",
"0.56842",
"0.55707693",
"0.55509615",
"0.54785883",
"0.5436043",
"0.54291457",
"0.5397962",
"0.5373834",
"0.5319335",
"0.53167546",
"0.5290406",
"0.5286121",
"0.5232634",
"0.51691353"... | 0.7365759 | 0 |
client.last_id Returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement. | def last_id()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_id\n return @mysql.last_id\n end",
"def last_insert_id\n @connection.identity_val_local\n end",
"def last_insert_id\n @connection.sql(\"SELECT @@IDENTITY\")\n unless @connection.cmd_fail?\n id = @connection.top_row_result.rows.first.first\n if id\n ... | [
"0.80476815",
"0.80448616",
"0.78293526",
"0.75794387",
"0.7456295",
"0.7368306",
"0.7368306",
"0.7334682",
"0.73134303",
"0.73134303",
"0.7278714",
"0.72343296",
"0.7046172",
"0.7029071",
"0.7013336",
"0.69394654",
"0.6858419",
"0.68418473",
"0.68418473",
"0.68350184",
"0.68... | 0.7463269 | 4 |
client.affected_rows returns the number of rows changed, deleted, or inserted by the last statement if it was an UPDATE, DELETE, or INSERT. | def affected_rows()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affected_rows(conn)\n s = conn.info\n if s && s =~ /Rows matched:\\s+(\\d+)\\s+Changed:\\s+\\d+\\s+Warnings:\\s+\\d+/\n $1.to_i\n else\n conn.affected_rows\n end\n end",
"def affected\n IBM_DB.num_rows(@stmt)\n end",
"def affected_rows\n ... | [
"0.80709714",
"0.79075",
"0.77360857",
"0.7588166",
"0.7570464",
"0.7076853",
"0.6849393",
"0.6145629",
"0.59424144",
"0.5817816",
"0.5787704",
"0.5787704",
"0.5787704",
"0.5716588",
"0.5651926",
"0.5647409",
"0.55518425",
"0.55157185",
"0.54878736",
"0.54434216",
"0.5432985"... | 0.71625465 | 5 |
client.thread_id Returns the thread ID of the current connection. | def thread_id()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_id\n check_connection\n @protocol.thread_id\n end",
"def thread_id\n return @thread_id\n end",
"def conversation_thread_id\n return @conversation_thread_id\n end",
"def thread_id\n\n\t\t::Pantheios::Core.thread_id\n\tend",
"def thread_id... | [
"0.8440182",
"0.8138541",
"0.75782615",
"0.75613177",
"0.71541375",
"0.70730567",
"0.6924222",
"0.62589353",
"0.6238831",
"0.6083244",
"0.60523975",
"0.6031252",
"0.6031252",
"0.6026884",
"0.602228",
"0.602228",
"0.602228",
"0.602228",
"0.602228",
"0.602228",
"0.602228",
"0... | 0.7488048 | 4 |
client.ping Checks whether the connection to the server is working. If the connection has gone down and autoreconnect is enabled an attempt to reconnect is made. If the connection is down and autoreconnect is disabled, ping returns an error. | def ping()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping\n if god?\n tries = 3\n begin\n @server.ping\n rescue Exception => e\n retry if (tries -= 1) > 1\n raise e, \"The server is not available (or you do not have permissions to access it)\"\n end\n end\n end",
"def ping(options = {})\n ... | [
"0.6932698",
"0.68216926",
"0.67925984",
"0.6591872",
"0.6544054",
"0.64793885",
"0.6444448",
"0.62181145",
"0.6213822",
"0.6193067",
"0.612876",
"0.61276793",
"0.605931",
"0.6051212",
"0.60368866",
"0.60274476",
"0.5970264",
"0.5917197",
"0.5914499",
"0.58878773",
"0.5883193... | 0.0 | -1 |
client.select_db(name) Causes the database specified by +name+ to become the default (current) database on the connection specified by mysql. | def select_db(name)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_db(db)\n query \"use #{db}\"\n self\n end",
"def use(args)\n @dbh.select_db(args[:db_name])\n end",
"def database! name\n create_db(name) rescue nil\n database name\n end",
"def use(name)\n with(database: name)\n end",
"def use(name)\n with(database: name... | [
"0.744077",
"0.70374817",
"0.67252976",
"0.6643945",
"0.6643945",
"0.65352017",
"0.6394628",
"0.63929933",
"0.63331604",
"0.6263246",
"0.6186758",
"0.61462134",
"0.61462",
"0.6137212",
"0.61280715",
"0.6115489",
"0.60967857",
"0.60659343",
"0.5970773",
"0.59497017",
"0.593315... | 0.783835 | 0 |
client.more_results? Returns true or false if there are more results to process. | def more_results?()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def more_after_limit?\n more_results == :MORE_RESULTS_AFTER_LIMIT\n end",
"def more_results\n @server_status & SERVER_MORE_RESULTS_EXISTS != 0\n end",
"def no_more?\n more_results == :NO_MORE_RESULTS\n end",
"def more_pages?\n return false if start_index == 0\n ... | [
"0.7921848",
"0.7824379",
"0.762029",
"0.7451037",
"0.7424022",
"0.73506737",
"0.73197466",
"0.7298327",
"0.72463524",
"0.72266185",
"0.7087872",
"0.7054309",
"0.6989921",
"0.6900303",
"0.6891427",
"0.6832157",
"0.6789923",
"0.67645293",
"0.67645293",
"0.67461723",
"0.6743023... | 0.82769096 | 0 |
client.next_result Fetch the next result set from the server. Returns nothing. | def next_result()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_result\n return false unless more_results\n check_connection\n @fields = nil\n nfields = @protocol.get_result\n if nfields\n @fields = @protocol.retr_fields nfields\n @result_exist = true\n end\n return true\n end",
"def next\n\t\t@skip = (@skip || 0) + get_resultcount\n\... | [
"0.72045916",
"0.7165134",
"0.69670725",
"0.67809623",
"0.6618492",
"0.6438362",
"0.64205325",
"0.63445264",
"0.63445264",
"0.62594223",
"0.6251522",
"0.6173223",
"0.602844",
"0.60150933",
"0.59713995",
"0.5915282",
"0.591481",
"0.5844022",
"0.58265",
"0.5763463",
"0.57453823... | 0.7220711 | 0 |
client.store_result Return the next result object from a query which yielded multiple result sets. | def store_result()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_result()\n #This is a stub, used for indexing\n end",
"def nextResult\n result = nil\n @mutex.synchronize do\n result = @results.shift\n @progressMutex.synchronize{ @requestProgress.delete result.requestId } if result\n end\n result\n end",
"def n... | [
"0.7044584",
"0.684579",
"0.67921764",
"0.67407894",
"0.6585797",
"0.6423207",
"0.63785505",
"0.63539034",
"0.62777114",
"0.62089354",
"0.61991596",
"0.6162677",
"0.6087444",
"0.6063905",
"0.60550004",
"0.60508096",
"0.5999984",
"0.5960796",
"0.5935967",
"0.59310883",
"0.5922... | 0.59316057 | 19 |
client.reconnect = true Enable or disable the automatic reconnect behavior of libmysql. Read for more information. | def reconnect=(p1)
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reconnect\n @mutex.synchronize do\n require \"mysql2\" unless ::Object.const_defined?(:Mysql2)\n\n args = {\n host: @db.opts[:host],\n username: @db.opts[:user],\n password: @db.opts[:pass],\n database: @db.opts[:db],\n port: @port,\n symbolize_keys: true,... | [
"0.718796",
"0.6821758",
"0.6678307",
"0.65568995",
"0.65112484",
"0.6498411",
"0.6455446",
"0.6402148",
"0.6400127",
"0.6397335",
"0.6383182",
"0.6383182",
"0.63529557",
"0.63188845",
"0.6317732",
"0.6317732",
"0.62529653",
"0.6251808",
"0.6199088",
"0.6197312",
"0.6188208",... | 0.0 | -1 |
client.encoding Returns the encoding set on the client. | def encoding()
#This is a stub, used for indexing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encoding\n @connection.encoding.to_s\n end",
"def encoding\n @io.external_encoding\n end",
"def encoding\n @io.external_encoding\n end",
"def encoding\n @external_encoding\n end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
"def encoding; end",
... | [
"0.7452432",
"0.7051568",
"0.7051568",
"0.68793225",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.6797242",
"0.67549396",
"0.67549396",
... | 0.6821976 | 4 |
Return the list of intermediate object files | def objects
expand_sources(@sources).map { |x| x.gsub(/\.c$/, '.o') }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object_files\n source_files.map { |file| object_path( file ) }\n end",
"def filepaths\n object.object_files.map(&:relative_path)\n end",
"def object_files(sources)\n res = []\n sources.sort.each do |s|\n res.push s.sub(/.c$/, Platform.object_extension)\n end\n res\n end",
"d... | [
"0.7397996",
"0.6671671",
"0.6605052",
"0.62580913",
"0.6194489",
"0.6097293",
"0.5976085",
"0.59750456",
"0.5944492",
"0.59378827",
"0.5914088",
"0.59030724",
"0.59030724",
"0.5893675",
"0.58909553",
"0.58847624",
"0.5882003",
"0.5882003",
"0.5862274",
"0.58455735",
"0.57813... | 0.6605979 | 2 |
Install the output file(s) | def install(installer)
# By default, this does nothing.
# Derived classes are expected to override this method.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install\n #python executable files\n end",
"def install\n end",
"def install\n FileUtils.mv self.class.extracted_file.to_s, self.class.force_installed_executable.to_s\n end",
"def install\n end",
"def install\n end",
"def run_installer\n Installer.install\n File.open(@insta... | [
"0.6726498",
"0.66729575",
"0.6642657",
"0.66079396",
"0.66079396",
"0.65781",
"0.6529349",
"0.6517747",
"0.6461591",
"0.64148116",
"0.6358732",
"0.6277968",
"0.6256673",
"0.62495136",
"0.6243925",
"0.62391925",
"0.6233183",
"0.6217788",
"0.61949897",
"0.6180434",
"0.6177208"... | 0.0 | -1 |
Creates things from configure.rb, for example generating pkgconfig.pc.in | def project_hook(project)
# STUB
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pkg_default_configure(args='')\n <<CONFIGURE\nautoreconf\n\nCC=\"#{$bsyscfg.get_cc}\" \\\\\nCPP=\"#{$bsyscfg.get_cpp}\" \\\\\nCXX=\"#{$bsyscfg.get_cxx}\" \\\\\nCFLAGS=\"#{$bsyscfg.get_cflags} #{@cflags}\" \\\\\nCPPFLAGS=\"#{$bsyscfg.get_cppflags} #{@cppflags}\" \\\\\nCXXFLAGS=\"#{$bsyscfg.get_cxxflags} #{@c... | [
"0.68638927",
"0.66617537",
"0.6350344",
"0.6311526",
"0.62204874",
"0.6090487",
"0.6083461",
"0.60634106",
"0.6042282",
"0.5958205",
"0.59285533",
"0.59228164",
"0.5922298",
"0.5900645",
"0.58877575",
"0.5857822",
"0.5819233",
"0.58039314",
"0.57288957",
"0.5714314",
"0.5712... | 0.0 | -1 |
Last chance to put things into the Makefile | def makefile_hook(makefile)
# STUB
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make; end",
"def setup\r\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup;... | [
"0.64912695",
"0.5792355",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",
"0.57797116",... | 0.5823793 | 1 |
Return a hash containing Makefile rules and targets needed to compile the object. | def compile(cc)
makefile = Makefile.new
objs = []
sources = expand_sources(@sources)
log.debug 'buildable = ' + self.pretty_inspect
if sources.empty?
puts "*** Error in #{self.id}: "
raise 'One or more source files are required' if sources.empty?
end
# Generate the targets and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_compile_rule(src)\n sha = Digest::SHA1.hexdigest(src)\n fn = File.basename(src, '.c')\n dest = \"build/#{sha}_#{fn}.o\"\n SOURCE_LOOKUP[src] = dest\n\n CompileTask.define_task(dest => [src]) do |t|\n sh \"#{TOOLCHAIN}gcc #{t.cflags.join(' ')} -c #{t.prerequisites.first} -o #{t.name}\"\n end\nend"... | [
"0.59378374",
"0.57545704",
"0.57090384",
"0.5669461",
"0.5525324",
"0.54503804",
"0.53773135",
"0.5369794",
"0.5335314",
"0.5288738",
"0.52623373",
"0.5246119",
"0.52317697",
"0.52057564",
"0.5151767",
"0.5129913",
"0.5100316",
"0.50684303",
"0.5064901",
"0.50519764",
"0.503... | 0.54993427 | 5 |
Return a hash containing Makefile rules and targets needed to link the object. | def link(ld)
makefile = Makefile.new
ld.flags = @ldflags
@ldadd = [ @ldadd ] if @ldadd.kind_of?(String)
@ldadd.each { |lib| ld.library lib }
ld.objects = self.objects
ld.output = @output
cmd = ld.rule
makefile.add_target(output, self.objects, cmd)
makefile.add_dependency('all', out... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule\n ['$(LD)', flags, '$(LDFLAGS)', @objects, sorted_ldadd, '$(LDADD)'].flatten.join(' ')\n end",
"def hash\n [rel, href].hash\n end",
"def hash\n [fully_qualified_rel, raw_href, templated?].hash\n end",
"def hash\n\t\treturn [ self.subject, self.predicate, self.object ].hash\n... | [
"0.6454002",
"0.5961559",
"0.55839103",
"0.55597574",
"0.5537343",
"0.55351716",
"0.5515867",
"0.54646164",
"0.5353775",
"0.5338954",
"0.53021926",
"0.52841854",
"0.52773374",
"0.5248823",
"0.52241874",
"0.5198432",
"0.5192448",
"0.5182371",
"0.5149344",
"0.514379",
"0.513398... | 0.5373372 | 8 |
Return a hash containing Makefile dependencies | def makedepends
res = []
if @sources.nil?
log.error self.to_s
raise 'Missing sources'
end
# Generate the targets and rules for each translation unit
expand_sources(@sources).each do |src|
next if src =~ /\.o$/
cc = @project.cc
cc.flags = [ @cflags, '-E' ]
cc.o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end",
"def dependency_history_key\n \"asset-uri... | [
"0.6457509",
"0.64193374",
"0.6380965",
"0.62939143",
"0.6220765",
"0.6172918",
"0.61310935",
"0.6100966",
"0.59629697",
"0.5948716",
"0.5944607",
"0.58935356",
"0.5870837",
"0.58645564",
"0.58302563",
"0.58302563",
"0.58302563",
"0.58302563",
"0.5826948",
"0.5819403",
"0.576... | 0.5464583 | 44 |
and then return to the method that it was called in. | def say_hello(&block)
puts "Hello, world"
# One advantage of yield is that you can run that code
# any number of times, so let's go ahead and put yield
# again.
yield
yield
puts "I said hello"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish()\n #This is a stub, used for indexing\n end",
"def proceed!; end",
"def proceed!; end",
"def call() end",
"def called_from; end",
"def called_from; end",
"def method\n\t\t# code code\n\tend",
"def recall; end",
"def call\n advance until done?\n end",
"def... | [
"0.64839786",
"0.6384145",
"0.6384145",
"0.62890786",
"0.6244164",
"0.6244164",
"0.60877746",
"0.60695356",
"0.6054314",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",
"0.6053382",... | 0.0 | -1 |
This should return the minimal set of values that should be in the session in order to pass any filters (e.g. authentication) defined in RecommendationsController. Be sure to keep this updated too. | def valid_session
{}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def session\n raw_session[\"warden.user.#{scope}.session\"] ||= {}\n end",
"def valid_session\n {\"warden.user.user.key\" => session[\"warden.user.user.key\"]}\n end",
"def set_session # rubocop:disable Metrics/AbcSize\n session[:prospect_params] ||= {}.with_indifferent_access\n sessi... | [
"0.6186517",
"0.61809397",
"0.60901827",
"0.6074103",
"0.603077",
"0.6027945",
"0.59703875",
"0.59631246",
"0.59507245",
"0.59507245",
"0.5926702",
"0.5898237",
"0.5879752",
"0.5810288",
"0.58090955",
"0.5800186"
] | 0.0 | -1 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge by myself. 1. Pseudocode What is the input? Total function: the input is an array of numbers Sentence Maker: the input is an array of... | def total(array)
total = 0
array.each do |x|
total += x
end
return total
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_maker(array)\n x = 0\n sum = \"\"\n while x <= array.length-1\n sum += array[x].to_s + \" \"\n x += 1\n end\n sum.rstrip!\n sum += \".\"\n sum.capitalize!\n return sum\nend",
"def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\twhile x <= array.length-1\n\t\tif x == array.length-1\n\t\... | [
"0.74988127",
"0.74878097",
"0.7224571",
"0.7077385",
"0.70696723",
"0.70492584",
"0.70057493",
"0.69869196",
"0.6967678",
"0.6941724",
"0.68814594",
"0.6873547",
"0.6861496",
"0.6853755",
"0.6848618",
"0.6848174",
"0.6819601",
"0.6814174",
"0.6813766",
"0.68048084",
"0.67893... | 0.0 | -1 |
Configure the server's SSLContext to require a client certificate. The `client_ca` setting allows the server to advertise which client CAs it will accept. | def require_client_certs(ctx)
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
ctx.client_ca = [cert_fixture('ca.pem')]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_ssl(client)\n Preconditions.assert_class('client', client, Net::HTTP)\n client.use_ssl = true\n client.verify_mode = OpenSSL::SSL::VERIFY_PEER\n client.cert_store = OpenSSL::X509::Store.new\n client.cert_store.set_default_paths\n end",
"def set_ssl_client_cer... | [
"0.73566455",
"0.6771915",
"0.6179915",
"0.5859486",
"0.5664831",
"0.56624943",
"0.5592271",
"0.55914485",
"0.55129075",
"0.5510128",
"0.5504912",
"0.54587",
"0.5448281",
"0.5424902",
"0.54193217",
"0.5385832",
"0.538241",
"0.5351311",
"0.53444487",
"0.5321733",
"0.52911794",... | 0.74801844 | 0 |
usage Print usage information and exit. | def usage
$stderr.puts <<EOS
osxmail2maildir v#{PROG_VER}
Copyright (c) 2005-2008 Toby DiPasquale <toby@cbcg.net>
Usage: #{__FILE__} <target directory> [ <source directory> ]
EOS
exit 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_usage_and_exit\n puts usage\n exit\n end",
"def usage\n\t\t$stderr.printf \"usage: %s [ options ]\\n\",$0\n\t\t$stderr.printf \"\\n%s\\n\",$help\n\t\texit 0\n\tend",
"def usage()\n puts \"usage: ruby build.rb [verbose] [clean] [rebuild] \"\n puts \" [keepSource] [-buildType=[de... | [
"0.86879",
"0.8148297",
"0.79330903",
"0.7677534",
"0.7636395",
"0.75824475",
"0.75457793",
"0.7535449",
"0.74905324",
"0.74187",
"0.7414805",
"0.7410885",
"0.7410027",
"0.7387913",
"0.7382344",
"0.7350538",
"0.73490334",
"0.73481894",
"0.734428",
"0.73440576",
"0.732777",
... | 0.0 | -1 |
new_maildir Recursively create directories for a new Maildir mail store. | def new_maildir(target, source, name)
x = name.sub(/Messages$/, "").sub(/\.mbox\/?.*/, "")
x = x.sub(Regexp.new(source), "").sub(/^\//, "")
d = ""
x.split("/").each do |comp|
d << "/" + comp.delete(" ")
unless FileTest.directory?(target + "/" + d)
FileUtils.mkdir(target + "/" + d)
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_dirs; end",
"def make_mailbox mailbox\n Dir.mkdir(mailbox)\n %w{cur tmp new}.each do |dir|\n Dir.mkdir(File.join(mailbox,dir))\n end\n end",
"def makedir(dir)\n FileUtils.mkdir_p dir\n end",
"def create\n create_direc... | [
"0.6798174",
"0.6305898",
"0.62928265",
"0.6281286",
"0.6107783",
"0.6104187",
"0.60859275",
"0.60540706",
"0.6026999",
"0.5937781",
"0.5937781",
"0.58950996",
"0.58685356",
"0.578591",
"0.57734954",
"0.57541996",
"0.5743035",
"0.5716457",
"0.571542",
"0.569656",
"0.56560653"... | 0.7139482 | 0 |
set? Test a number against a bitmask to see if bits are set or cleared. | def set?(num, mask)
(num & mask) != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set?(bit)\n bit = convert_bit(bit)\n intersect(bit) == bit\n end",
"def checkBitSet( i, bitfield )\n bitfield & (1<<i)\n end",
"def set?(flag)\n (@status_register & flag == 0) ? false : true\n end",
"def set(bit, value = true)\n if value\n @bits = union convert_bi... | [
"0.70374274",
"0.65251094",
"0.6378356",
"0.60671204",
"0.6050882",
"0.5951982",
"0.59074026",
"0.5737606",
"0.56482375",
"0.55721843",
"0.55721843",
"0.55373645",
"0.5512168",
"0.5482953",
"0.545729",
"0.5423635",
"0.5362051",
"0.532357",
"0.53168195",
"0.52969193",
"0.52884... | 0.79458624 | 0 |
Got this off of jwz's blog in reference to what the bits in the flags parameter in Mail.app message files mean Update: An anonymous benefactor has the goods: 0 read 1 Also, see for information on how to formulate a proper Maildir file name. maildirname Create a proper Maildir filename for this message. | def maildirname(deliveries, flags)
s = ""
s << Time.now.to_i.to_s
s << "."
s << "P" + Process.pid.to_s
s << "Q" + deliveries.to_s
s << "R" + rand(2147483648).to_s
s << "."
s << Socket.gethostname.sub(/\//, "\\057").sub(/:/, "\\072")
# if this is a new message, we don't add the third part of the
# f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markMail(imap, folder)\n pp \"MARKED #{folder}..\"\n message_ids = imap.uid_search(\"ALL\")\n imap.uid_store(message_ids, \"+FLAGS\", [:Seen])\n imap.expunge\nend",
"def main\n # check those arguments\n usage if ARGV[0].nil?\n target = ARGV[0].strip\n maildir = \"#{ENV['HOME']}/Library/Mail\"... | [
"0.5614705",
"0.5512599",
"0.5263956",
"0.5263956",
"0.5201007",
"0.5151428",
"0.5142768",
"0.51138014",
"0.505541",
"0.50229967",
"0.50127774",
"0.50067925",
"0.4962257",
"0.4958947",
"0.49570668",
"0.49166808",
"0.4858849",
"0.4851474",
"0.48391956",
"0.4833337",
"0.4830502... | 0.71362436 | 0 |
main Main processing logic. | def main
# check those arguments
usage if ARGV[0].nil?
target = ARGV[0].strip
maildir = "#{ENV['HOME']}/Library/Mail"
maildir = ARGV[1].strip unless ARGV[1].nil?
puts "Using source directory of '#{maildir}'..."
puts "Using target directory of '#{target}'..."
deliveries = 0
# make the target directory... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_main\n end",
"def mainfun\n begin\n puts \"[MAINFUN]:: Entering\\n[MAINFUN]:: Setting application variables for filenames\" if $diag\n ingestion # Gather files to be processes from ingestion function\n puts \"[MAINFUN]:: Examining files\"+(sleep $pause; if $verb; \": #{$filesin}\"; else \"\"; end)... | [
"0.71724117",
"0.7127028",
"0.70823824",
"0.6996459",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69533104",
"0.69120795",
"0.68822813",
"0.6882267",
"0.6882267",
"0.6882267",
"0.6882267",
"0.6882267",
"0.6882267",
"0.6... | 0.0 | -1 |
Extracting extension icon (currently not used anywhere) | def icon action = 'ruby'
loader = @main.get_class.get_class_loader
stream = loader.get_resource_as_stream("/com/moneydance/modules/features/ruby/#{action}.gif")
bytes = stream.to_io.read.to_java_bytes
java.awt.Toolkit.default_toolkit.create_image(bytes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end",
"def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end",
"def get_icon(extension)\n ICONS.each do |ext_type|\n # Compare the extension to each value in the list\n ext_type.each do |value|\n if extensio... | [
"0.73295116",
"0.73295116",
"0.6917767",
"0.66556346",
"0.6590214",
"0.6517913",
"0.6467652",
"0.6451857",
"0.6424869",
"0.63560283",
"0.6334211",
"0.63336474",
"0.6312444",
"0.6259907",
"0.61983734",
"0.6183759",
"0.6180591",
"0.61791754",
"0.61041206",
"0.60896486",
"0.6084... | 0.5729709 | 71 |
This is called when a data set is closed, so that the extension can let go of any references that it may have to the data or the GUI. | def cleanup
STDERR.puts "cleanup called"
if @console
@console.dispose
System.gc
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlander_at_exit\n DATA.close if Object.const_defined?(:DATA) && DATA.respond_to?(:close)\n end",
"def close()\n #This is a stub, used for indexing\n end",
"def on_close\n\t\tend",
"def close\n @data.close\n @index.close\n end",
"def close\n close_data_file\n... | [
"0.65373117",
"0.6267555",
"0.6258237",
"0.62300915",
"0.62115484",
"0.61874604",
"0.61844754",
"0.61838245",
"0.61407524",
"0.6138274",
"0.6030773",
"0.60290504",
"0.6018416",
"0.6006764",
"0.5991732",
"0.5991732",
"0.5982435",
"0.5965368",
"0.5956815",
"0.5936893",
"0.59169... | 0.0 | -1 |
Process an invocation of this module with the given URI | def invoke uri
STDERR.puts "invoke called with: #{uri}"
unless defined? MD
# Setting universally accessible constants in JRuby runtime for Moneydance access
# Not possible to do it in initialize() since datafile is not yet loaded there
Object.const_set :MD, @context
Object.const_set :RO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_uri(uri)\n # empty --> this is like an abstract class method\n end",
"def uri! uri, verb, http_version\n rv = Wrapper.msc_process_uri txn_ptr, (strptr uri), (strptr verb), (strptr http_version)\n rv == 1 or raise Error \"msc_process_uri failed for #{[uri, verb, http_version].inspect}\"\... | [
"0.65416384",
"0.6301325",
"0.58738416",
"0.5845321",
"0.5805085",
"0.5750924",
"0.5743979",
"0.5697193",
"0.5651822",
"0.5602614",
"0.5594933",
"0.5590553",
"0.5586265",
"0.54781926",
"0.5473089",
"0.5473089",
"0.5473089",
"0.5473089",
"0.5459831",
"0.5445616",
"0.541231",
... | 0.60324085 | 2 |
Shows Moneydance IRB console, starts new one if necessary. Moneydance URI: moneydance:fmodule:ruby:irb | def irb
if @console
@console.show
else
# We need to address compiled RubyConsole via full java name... Why?
@console ||= com.moneydance.modules.features.ruby.rb.RubyConsole.new self
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_console\n puts \"IRB Session starting. @parser is now available to you for querying your code. The extension object is available as 'self'\"\n IRB.start_session(binding)\n end",
"def cmd_irb(*args)\n\t\tprint_status(\"Starting IRB shell\")\n\t\tprint_status(\"The 'client' variable holds th... | [
"0.6613842",
"0.6571702",
"0.644046",
"0.64315814",
"0.62401664",
"0.61630654",
"0.6154752",
"0.59439135",
"0.59439135",
"0.58823496",
"0.58741856",
"0.5816951",
"0.57949674",
"0.5714689",
"0.56929004",
"0.5651548",
"0.56413275",
"0.5615641",
"0.5494351",
"0.5494351",
"0.5480... | 0.6734599 | 0 |
Loads Ruby script file located at path. Moneydance URI: moneydance:fmodule:ruby:file?/path/to/script.rb | def file path
STDERR.puts "file called with: #{path}"
puts "Loading file: #{path}"
begin
load path
rescue => e
puts e.inspect
puts e.backtrace.join("\n\tfrom ")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_script(file); end",
"def load_script_file file_path\n load file_path, true\n rescue Exception => e\n warn \"The script `#{file_path}' failed to load\"\n warn \"#{e.class}: #{e.message}\"\n warn ''\n warn 'Backtrace:', '---', e.backtrace\n end",
"def script(script_file)\n... | [
"0.7798297",
"0.7240647",
"0.7222812",
"0.7200353",
"0.69514585",
"0.68488413",
"0.684869",
"0.6837185",
"0.67525876",
"0.662729",
"0.6587361",
"0.6571107",
"0.65500116",
"0.6373808",
"0.63699734",
"0.6326723",
"0.6287738",
"0.6281507",
"0.62259895",
"0.6197932",
"0.61866224"... | 0.62767106 | 18 |
delete_if calls delete delete_if == reject! | def test_delete_if
graph = Rgraphum::Graph.new
(0..9).each do |i|
graph.vertices << { label: "v#{i}" }
end
(0..9).each do |i|
graph.edges << {
source: graph.vertices[i],
target: graph.vertices[(i+1) % 10],
weight: i,
}
end
# v0 -> v1 -> v2 -> v3 -> v4 -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_if(&block); end",
"def delete_if\n super { |r| yield(r) && orphan_resource(r) }\n end",
"def delete_if\n block_given? or return enum_for(__method__)\n select { |o| yield o }.each { |o| delete(o) }\n self\n end",
"def delete_if\n @hash.delete_if { |o,| yield(o) }\n self\n e... | [
"0.77335644",
"0.6792169",
"0.67731375",
"0.6494146",
"0.6460993",
"0.6435202",
"0.6345791",
"0.62816185",
"0.60826504",
"0.605276",
"0.6049256",
"0.6016138",
"0.59996253",
"0.59944975",
"0.59741575",
"0.5962173",
"0.59615374",
"0.59562486",
"0.59451437",
"0.5935561",
"0.5933... | 0.5706744 | 30 |
Use callbacks to share common setup or constraints between actions. | def set_task
@task = Task.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def task_params
params.require(:task).permit(:name, :running, :start, :end, :project_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
You might also need yn00 installed and can be found in the default searching PATH. | def read_seq(seq_file)
seq_objs = Hash.new
Bio::FlatFile.open(seq_file, "r").each_entry do |f|
seq_objs[f.definition] = f
end
return(seq_objs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_ktlint_path\n File.expand_path(File.join(File.dirname(__FILE__), 'bin', 'ktlint'))\n end",
"def install\n prefix.install Dir[\"*\"]\n\n # Install a shell script to launch mitofy.\n bin.mkdir\n open(bin/\"mitofy\", \"w\") do |file|\n file.write <<~EOS\n #!/bin/sh\n e... | [
"0.5123963",
"0.49773237",
"0.49362165",
"0.48971885",
"0.48893815",
"0.4844051",
"0.48238742",
"0.48052233",
"0.477431",
"0.47605532",
"0.47534853",
"0.4746956",
"0.47379658",
"0.47312486",
"0.47107664",
"0.4708828",
"0.47058558",
"0.4681395",
"0.467478",
"0.46721005",
"0.46... | 0.0 | -1 |
regex to catch stuff in parentheses: \(([^\)]+)\) | def ensure_session_token
self.token ||= self.class.random_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_parentheses(str)\n str = str.chars.select {|char| char == \"(\" || char == \")\"}.join \n s = str.gsub(/\\(\\)/, '')\n while s.gsub!(/\\(\\)/, '') do; end\n s.empty?\nend",
"def valid_parentheses?(str)\n while str.gsub!(/\\([^()]*\\)/, ''); end\n !(str.include?('(') || str.include?(')'))\nend",
... | [
"0.66864705",
"0.6683965",
"0.657788",
"0.65514797",
"0.6527405",
"0.6509867",
"0.6342175",
"0.6173059",
"0.6149269",
"0.60647285",
"0.6060362",
"0.6054382",
"0.60454595",
"0.6039779",
"0.60211426",
"0.6013849",
"0.5998175",
"0.5919106",
"0.57845867",
"0.5767412",
"0.57618827... | 0.0 | -1 |
callback from Taskrabbit OAuth | def login
@user = User.find_or_create_from_auth_hash(auth_hash)
@user_name = @user.display_name
session[:current_user_id] = @user.id
render :login, :layout => false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end",
"def oauth_callback\n at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])\n \n #There can only be one...\n Qbo.destroy_all\n\n # Save the authenticatio... | [
"0.7529367",
"0.72080463",
"0.7026238",
"0.69977915",
"0.6917349",
"0.68688726",
"0.68401235",
"0.6823098",
"0.6816951",
"0.680955",
"0.6804489",
"0.67364866",
"0.67296726",
"0.6651905",
"0.66514426",
"0.6637351",
"0.6635302",
"0.66314083",
"0.66163737",
"0.6578697",
"0.65422... | 0.0 | -1 |
Parse actual student id from University of Helsinki's format: urn:mace:terena.org:schac:personalUniqueCode:int:studentID:helsinki.fi:165934 Returns the number value of the last URN attribute: raw "urn:schac:personalUniqueCode:fi:yliopisto.fi:x8734" will return: "x8734" Student number may be a multivalue array such as "... | def parse_student_number(raw)
value = nil
if raw.is_a?(Array)
raw.each do |v|
value = v if v.starts_with?(Vaalit::Haka::HAKA_STUDENT_NUMBER_KEY)
end
elsif raw.is_a?(String)
if raw.starts_with?(Vaalit::Haka::HAKA_STUDENT_NUMBER_KEY)
value = raw
else
Rails.logg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_student_number(raw)\n if raw.blank?\n errors.add :student_number, \"SAML student number value missing\"\n return nil\n end\n\n value = nil\n\n if raw.is_a?(Array)\n value = parse_student_number_from_array(raw)\n elsif raw.is_a?(String)\n value = parse_... | [
"0.7177625",
"0.6797976",
"0.6255774",
"0.6172146",
"0.6058029",
"0.5926973",
"0.57413656",
"0.56428057",
"0.5527995",
"0.54794717",
"0.5391596",
"0.534214",
"0.5315253",
"0.52918714",
"0.528688",
"0.52524376",
"0.5201319",
"0.5186482",
"0.51713794",
"0.5136229",
"0.50757694"... | 0.6970069 | 1 |
GET /feedstocks/1 GET /feedstocks/1.json | def show
@feedstock = Feedstock.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @feedstock }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n ... | [
"0.7481314",
"0.7200624",
"0.7200624",
"0.7200624",
"0.7200624",
"0.7027244",
"0.7009431",
"0.6994312",
"0.69823974",
"0.6921781",
"0.69217616",
"0.69093794",
"0.6903323",
"0.68105304",
"0.6780064",
"0.67473733",
"0.67095417",
"0.6707456",
"0.667386",
"0.6630244",
"0.6588681"... | 0.77577364 | 0 |
GET /feedstocks/new GET /feedstocks/new.json | def new
@feedstock = Feedstock.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @feedstock }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end",
"def new\n @stock = Stock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock }\n end\n end"... | [
"0.77843577",
"0.77843577",
"0.77843577",
"0.77843577",
"0.77843577",
"0.77843577",
"0.76262206",
"0.7540472",
"0.75165796",
"0.74591637",
"0.7258315",
"0.72371787",
"0.72207344",
"0.719669",
"0.7167876",
"0.71585625",
"0.71558446",
"0.71121883",
"0.71121883",
"0.71008366",
"... | 0.81142837 | 0 |
POST /feedstocks POST /feedstocks.json | def create
@feedstock = Feedstock.new(params[:feedstock])
respond_to do |format|
if @feedstock.save
format.html { redirect_to @feedstock, notice: 'Estoque criado.' }
format.json { render json: @feedstock, status: :created, location: @feedstock }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n symbol = params[:symbol].upcase\n is_existing_stock = current_user.stocks.where(symbol: symbol, run_id: params[:run_id]).flatten.size > 0\n num_of_stocks = current_user.stocks.where( run_id: params[:run_id]).flatten.size\n respond_to do |format|\n if !is_existing_stock && num_of_stock... | [
"0.65808815",
"0.65192276",
"0.64771163",
"0.64771163",
"0.64771163",
"0.64771163",
"0.6452023",
"0.6423323",
"0.6423323",
"0.6423323",
"0.6423323",
"0.6423323",
"0.6423323",
"0.6417566",
"0.64088804",
"0.6350653",
"0.62951624",
"0.62869126",
"0.6279759",
"0.6267703",
"0.6254... | 0.6985218 | 0 |
PUT /feedstocks/1 PUT /feedstocks/1.json | def update
@feedstock = Feedstock.find(params[:id])
respond_to do |format|
if @feedstock.update_attributes(params[:feedstock])
format.html { redirect_to @feedstock, notice: 'Estoque atualizado.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json... | [
"0.6847157",
"0.68467253",
"0.66715634",
"0.66715634",
"0.66715634",
"0.66442037",
"0.6643687",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6627671",
"0.6515683",
"0.6515683",
"0.6514635"... | 0.69225293 | 0 |
DELETE /feedstocks/1 DELETE /feedstocks/1.json | def destroy
@feedstock = Feedstock.find(params[:id])
@feedstock.destroy
respond_to do |format|
format.html { redirect_to feedstocks_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n f... | [
"0.7402271",
"0.7402271",
"0.7402271",
"0.7402271",
"0.7402271",
"0.7402271",
"0.7391295",
"0.7391295",
"0.72909725",
"0.7286378",
"0.7275189",
"0.7275189",
"0.7241329",
"0.723864",
"0.7218686",
"0.7217168",
"0.713936",
"0.713936",
"0.7124956",
"0.71182597",
"0.70830005",
"... | 0.7755825 | 0 |
Add the current directory to the path Thor uses to look up files | def current_directory
@current_directory ||=
if __FILE__ =~ %r{\Ahttps?://}
require 'tmpdir'
tempdir = Dir.mktmpdir("rails-templates")
at_exit { FileUtils.remove_entry(tempdir) }
git clone: [
"--quiet",
"https://github.com/nimbl3/rails-templates.gi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_dir; end",
"def [](fpath=nil)\n if fpath.nil? || fpath.index('/') == 0\n @rye_current_working_directory = fpath\n else\n # Append to non-absolute paths\n if @rye_current_working_directory\n newpath = File.join(@rye_current_working_directory, fpath)\n @... | [
"0.707296",
"0.6876488",
"0.68723637",
"0.6837339",
"0.6824064",
"0.6743436",
"0.6632154",
"0.6610077",
"0.6479901",
"0.6447947",
"0.6442909",
"0.6422451",
"0.6411695",
"0.6405568",
"0.6399243",
"0.63942415",
"0.6386539",
"0.6363146",
"0.6347394",
"0.6316872",
"0.6316872",
... | 0.6139035 | 36 |
Add directory/file to path | def push(p)
@obj << p
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_dir(path)\n Dir.foreach(@new_base + path) do |fname|\n path_fname = path + fname\n next if fname == '.' || fname == '..' || filter_fname(path_fname)\n type = File.ftype(@new_base + path_fname).to_sym\n @entries << [path_fname, type, :added]\n add_dir(path_fname + '/') if type =... | [
"0.71631175",
"0.7134155",
"0.71100754",
"0.6977207",
"0.69040775",
"0.68905485",
"0.68446094",
"0.68049663",
"0.6787208",
"0.6731179",
"0.66492313",
"0.663652",
"0.6589136",
"0.65639687",
"0.6556734",
"0.6535433",
"0.6526001",
"0.65234536",
"0.6506837",
"0.6504824",
"0.64557... | 0.0 | -1 |
Remove last pushed component of path | def pop
@obj.pop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_to_remove(path)\n if aug.match(path).size == 1\n path\n elsif !aug.match(path + \"[1]\").empty?\n path + \"[1]\"\n else\n raise \"Unknown augeas path #{path}\"\n end\n end",
"def final_path_component(path)\n path.split(PATH_SEPARATOR)[-1... | [
"0.7338963",
"0.69796246",
"0.66718054",
"0.66323346",
"0.6612352",
"0.6611513",
"0.65900743",
"0.6523844",
"0.6516543",
"0.6473401",
"0.6394845",
"0.6362248",
"0.635797",
"0.6321514",
"0.62932426",
"0.62921864",
"0.61632323",
"0.61550987",
"0.61275214",
"0.6117868",
"0.60197... | 0.0 | -1 |
Return string at index | def [](index)
to_s[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_character(full_string, index)\n full_string[index]\nend",
"def character(index = nil)\n return '' if collection && collection.empty?\n return collection[-1] unless index\n\n by_index(index)\n end",
"def current()\n @string[@index...(@index+1)]\n end",
"def g... | [
"0.74124044",
"0.7045007",
"0.704017",
"0.7011896",
"0.67605764",
"0.67111087",
"0.6686547",
"0.66417587",
"0.66152966",
"0.6552539",
"0.6544779",
"0.64533865",
"0.63174736",
"0.6310852",
"0.62865055",
"0.6283503",
"0.625181",
"0.6226616",
"0.6218564",
"0.61770934",
"0.616911... | 0.7404589 | 1 |
Only allow a list of trusted parameters through. | def person_params
params.require(:person)
.permit(:display_name, :email, :language, :avatar_provider,
:tagline, :introduction, :bragging_rights, :occupation,
:skills, :gender, :looking_for_friends,
:looking_for_dating, :looking_for_relationsh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Returns the calculated value | def value(entity)
apply_mutations(_value(entity), entity)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value\n @calc.last\n end",
"def compute_total_value\n @value= @net_price * @count\n end",
"def value\n @value ||= ComputationContext.new(events).compute(&calculated_as)\n end",
"def calculated; end",
"def value\n\n\t\treturn @calculator.last\n\n\tend",
"def calculate\n self.total... | [
"0.8043799",
"0.7475465",
"0.74704385",
"0.7435962",
"0.74016696",
"0.7388378",
"0.7284948",
"0.72835773",
"0.7282855",
"0.7282855",
"0.7274936",
"0.7213947",
"0.7208873",
"0.71096426",
"0.7094143",
"0.7070638",
"0.70488274",
"0.70488274",
"0.70488274",
"0.70463264",
"0.70445... | 0.0 | -1 |
Finds and loads mutations | def load_mutation(attrs)
type = attrs.fetch('type')
raise "Mutation type invalid: #{type}" unless /\A[a-z_]+\Z/.match(type)
require "data_generator/mutation/#{type}"
"DataGenerator::Mutation::#{type.camelize}".constantize.new(attrs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changes_to_save\n mutations_from_database.changes\n end",
"def reload(*)\n super.tap do\n @mutations_before_last_save = nil\n @mutations_from_database = nil\n end\n end",
"def mutation_for(index)\n @mutations[index] ||= OpenStruct.new(indexes: [], deletes... | [
"0.58254653",
"0.5689881",
"0.53026754",
"0.5284672",
"0.5263093",
"0.521552",
"0.5022063",
"0.48296148",
"0.4761612",
"0.4761612",
"0.47508165",
"0.47088957",
"0.46971196",
"0.4647011",
"0.4632354",
"0.46253774",
"0.46222842",
"0.46157894",
"0.46038693",
"0.45501333",
"0.453... | 0.57555157 | 1 |
The functions we need | def putInMatrix(number, matrix)
nibbles = ((Math.log(number)/Math.log(2)).ceil() / 4.0).ceil()
shift = (nibbles * 4) - 4
for i in 1..nibbles
if i.modulo(2) == 0 then row = 1 else row = 0 end
if i < 3 then col = 0 else col = 1 end
matrix[row][col] = (number >> shift) & 0xF
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def functions\n\n end",
"def operations; end",
"def operations; end",
"def methods() end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def probers; end",
"def methods; end",
"def methods; end",
"def methods; end",
"d... | [
"0.79654634",
"0.71230316",
"0.71230316",
"0.7020142",
"0.6830288",
"0.6830288",
"0.6830288",
"0.6830288",
"0.6830288",
"0.67452174",
"0.66843444",
"0.66843444",
"0.66843444",
"0.66843444",
"0.6681622",
"0.6681622",
"0.6681622",
"0.6673061",
"0.6673061",
"0.6576206",
"0.64411... | 0.0 | -1 |
The allimportant method that takes our animation and turns it into a series of canvases | def rasterise
@frames.each do |frame|
printf '.';
canvas = Canvas.new(@width, @height);
@canvases.push(canvas);
if frame.pixmaps.length == 0 then next; end;
frame.pixmaps.each do |pixmap|
img = pixmap.sprite.getImage(pixmap.frame);
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbSelectAnim(canvas,animwin)\n animfiles=[]\n pbRgssChdir(\".\\\\Graphics\\\\Animations\\\\\") {\n animfiles.concat(Dir.glob(\"*.png\"))\n }\n cmdwin=pbListWindow(animfiles,320)\n cmdwin.opacity=200\n cmdwin.height=512\n bmpwin=BitmapDisplayWindow.new(320,0,320,448)\n ctlwin=ControlWindow.new(320,4... | [
"0.58498806",
"0.5765122",
"0.5588385",
"0.5567525",
"0.5545158",
"0.5487253",
"0.54458976",
"0.5439173",
"0.5372336",
"0.53692234",
"0.53000534",
"0.52953935",
"0.5289006",
"0.52600247",
"0.52322984",
"0.5210905",
"0.51793283",
"0.51736474",
"0.51636565",
"0.51437515",
"0.51... | 0.58236283 | 1 |
Run the animation once all the pixmaps have been loaded | def run(speed)
printf 'Rasterising';
rasterise;
puts " Done! [Hit any key]"
gets
@canvases.each_index do |i|
canvas = @canvases[i];
#canvas.add(' Frame '+i.to_s+' ', 0, 0);
canvas.print;
sleep 0.1;
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(p... | [
"0.6557818",
"0.644224",
"0.6021123",
"0.57794994",
"0.57171464",
"0.5716891",
"0.57065433",
"0.56866187",
"0.5682188",
"0.5663494",
"0.56384534",
"0.5608864",
"0.55490506",
"0.54941094",
"0.548456",
"0.5466381",
"0.54454976",
"0.54436433",
"0.54291564",
"0.54209435",
"0.5419... | 0.51326513 | 59 |
Create neccessary frames and copy standing pixmaps | def catchupFrames(fromFrameNo, toFrameNo)
#puts "#{fromFrameNo} --> #{toFrameNo}"
for i in fromFrameNo..toFrameNo do
#puts "Catching up frame #{i}:";
if @frames.length <= i then
@frames[i] = Frame.new(self);
@frames[i-1].pixmaps.each do |pixmap|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(p... | [
"0.7125234",
"0.7114542",
"0.65075475",
"0.6335945",
"0.6252415",
"0.6243129",
"0.62345177",
"0.6197847",
"0.6163358",
"0.61623794",
"0.61567885",
"0.6090131",
"0.6019725",
"0.60126495",
"0.59938073",
"0.59840506",
"0.5967043",
"0.5950513",
"0.59315187",
"0.5922468",
"0.59215... | 0.0 | -1 |
Load a series of sprites from a file | def loadSprites(filename)
lines = [];
sprite = nil;
IO.foreach(filename) do |line|
line.chomp!
if line =~ /^(\w+):/ then
# We've named a new sprite
if lines.length > 0 then
# We've finished a sprite
sprite.addIm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(file = @monster.filename, dir = @monster.work_dir, *_args)\n path = get_path(file, dir)\n a = split_canvas(ChunkyPNG::Canvas.from_file(path))\n h = { rom: @rom, index: @index }\n\n normal_rgb = a[0].to_rgb_stream + a[2].to_rgb_stream\n shiny_rgb = a[1].to_rgb_stream + a[... | [
"0.70588005",
"0.6801027",
"0.63514525",
"0.6005391",
"0.595951",
"0.5953462",
"0.59274143",
"0.58635354",
"0.5854375",
"0.58301353",
"0.5774591",
"0.5739177",
"0.5712484",
"0.57064974",
"0.56812316",
"0.5665038",
"0.5656688",
"0.5656688",
"0.5580559",
"0.55684626",
"0.556811... | 0.845051 | 0 |
Strong parameters for locale switch | def system_locale_params
params.require(:system).permit(:locale)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locale_from_params\n params[:locale] if (params[:locale] && ['en', 'se'].include?(params[:locale]))\n end",
"def set_locale\n \tI18n.locale = params[:locale] if params[:locale].present? \n end",
"def apply_locale; end",
"def locale=(_arg0); end",
"def set_locale\n I18n.locale = params[:locale... | [
"0.73926294",
"0.7297857",
"0.7243118",
"0.7154089",
"0.71538067",
"0.71232015",
"0.71232015",
"0.7109761",
"0.70823973",
"0.70404106",
"0.70230925",
"0.7022758",
"0.6975346",
"0.69356924",
"0.692779",
"0.69261724",
"0.6921937",
"0.6882444",
"0.6882444",
"0.6835983",
"0.67836... | 0.6706794 | 30 |
Can potentially be called more than once, so make it idempotent. | def cleanup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_once\n end",
"def once\n end",
"def non_idempotent\n self.idempotent = false\n end",
"def sharded?; true; end",
"def sharded?; false; end",
"def once\n @once\n end",
"def duplicate()\n bug( \"you must override duplicate()\" )\n end",
"def used?; end",
"def ... | [
"0.7056155",
"0.6750679",
"0.663043",
"0.64272624",
"0.6364918",
"0.61567366",
"0.60534745",
"0.60451156",
"0.6027486",
"0.6005364",
"0.5988834",
"0.59741604",
"0.59678334",
"0.5952718",
"0.59312844",
"0.5870965",
"0.5850221",
"0.5820175",
"0.5820175",
"0.5820175",
"0.5799570... | 0.0 | -1 |
GET /services GET /services.json | def index
@services = Service.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def services\n params = { command: 'account_services' }\n get('/json.php', params)\n end",
"def list_services\n response = @http_client.get(prefix_path('services'))\n Response.new(response)\n end",
"def services\n ... | [
"0.7777552",
"0.777449",
"0.7438209",
"0.73864925",
"0.7264791",
"0.7223465",
"0.7217482",
"0.70817554",
"0.69659567",
"0.6894663",
"0.6884723",
"0.6880644",
"0.6869151",
"0.68193513",
"0.679946",
"0.6788263",
"0.6788263",
"0.6788263",
"0.67320096",
"0.6664671",
"0.6650039",
... | 0.65679055 | 29 |
GET /services/1 GET /services/1.json | def show
@service = Service.find(params[:id])
respond_to do |format|
format.js
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n endpoint(get(services_url).body)\n end",
"def service(id)\n request :get, \"/services/#{id}\"\n end",
"def show\n @service = Service.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n ... | [
"0.75270754",
"0.7477992",
"0.71894914",
"0.7102449",
"0.7099407",
"0.7099407",
"0.7099407",
"0.7096293",
"0.6959161",
"0.6950294",
"0.6931149",
"0.68634444",
"0.6851751",
"0.68342865",
"0.6784193",
"0.6777289",
"0.6684241",
"0.6634103",
"0.658715",
"0.65441275",
"0.6543152",... | 0.0 | -1 |
POST /services POST /services.json | def create
@service = Service.new(service_params)
@cuenta = AccountingAccount.new
@name=@service.nombre
@idp=@service.cuenta_padre
respond_to do |format|
if @service.save
@cuenta.nombre=@name
@cuenta.imputable=true
@cuenta.cuenta=0
@padres=AccountingAccount... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_service(service={})\n request :post, '/services', service\n end",
"def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n e... | [
"0.7435853",
"0.7211795",
"0.6790206",
"0.66864383",
"0.66696",
"0.6628953",
"0.6628953",
"0.65936494",
"0.65936494",
"0.65936494",
"0.65936494",
"0.65936494",
"0.65936494",
"0.65925246",
"0.65513784",
"0.65001976",
"0.646277",
"0.64596283",
"0.6454777",
"0.64523786",
"0.6430... | 0.0 | -1 |
PATCH/PUT /services/1 PATCH/PUT /services/1.json | def update
respond_to do |format|
if @service.update(service_params)
format.js { }
else
format.html { render :edit }
format.json { render json: @service.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n service.update(service_params)\n\n respond_with(service)\n end",
"def update\n if @service.update(service_params)\n render json: @service, status: :ok, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def update\n ... | [
"0.665279",
"0.6637126",
"0.649423",
"0.6430556",
"0.6430556",
"0.64204186",
"0.6397555",
"0.63450557",
"0.62501574",
"0.6246304",
"0.6246304",
"0.62337315",
"0.62241524",
"0.62231463",
"0.62122774",
"0.62115115",
"0.6205756",
"0.61736095",
"0.61736095",
"0.61736095",
"0.6173... | 0.5864073 | 56 |
DELETE /services/1 DELETE /services/1.json | def destroy
@service.destroy
respond_to do |format|
format.html { redirect_to services_url, notice: 'El servicio ha sido eliminado.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n format.html { redirect_to services_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @service = Service.find(params[:id])\n @service.destroy\n\n respond_to do |format|\n ... | [
"0.7445268",
"0.7405554",
"0.7405554",
"0.7405554",
"0.74017256",
"0.736012",
"0.7339786",
"0.73383987",
"0.7177263",
"0.71209097",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
"0.7111978",
... | 0.7086057 | 27 |
Use callbacks to share common setup or constraints between actions. | def set_service
@service = Service.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def service_params
params.require(:service).permit(:nombre, :descripcion, :precio,:cuenta_padre)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
dryv needs symbolized keys TODO: Don't do this here... Representers?? | def symbolize_hash(old_hash)
old_hash.each_with_object({}) { |(k, v), new_hash|
new_hash[k.to_sym] = if v.is_a?(Hash)
symbolize_hash(v)
elsif v.is_a?(Array)
v.map{ |h| h.is_a?(Hash) ? symbolize_hash(h) : h }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbolize_keys; end",
"def symbolize_keys!\n replace symbolize_keys\n end",
"def symbolize_keys!; self end",
"def key_coercions; end",
"def stringified_keys; end",
"def symbolize_keys!\n replace(self.symbolize_keys)\n end",
"def symbolize_hash_keys(hash); end",
"def symbolize_keys\n ... | [
"0.74445045",
"0.68661493",
"0.67290723",
"0.65681887",
"0.6452122",
"0.6436847",
"0.6372235",
"0.63018584",
"0.63018584",
"0.6283513",
"0.6283513",
"0.6283513",
"0.6283513",
"0.6276873",
"0.6274451",
"0.6271493",
"0.6271493",
"0.6271493",
"0.62591726",
"0.6236613",
"0.623661... | 0.0 | -1 |
Retrieves the pagination "page" attribute for a given element (passed in as a prefix uniq identifyer) | def initialize_requested_page(prefix="")
(@search_params[prefix + "page"] || 1).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pagination_page\n @pagination_page\n end",
"def pagination_page_param\n WillPaginate::ViewHelpers.pagination_options[:param_name]\n end",
"def page_param\n if params[:page].is_a? ActionController::Parameters\n params[:page][:number]\n else\n params[:page]\n end\n end",
"def pa... | [
"0.6478853",
"0.64042175",
"0.62956154",
"0.62670034",
"0.6203463",
"0.6128497",
"0.6126657",
"0.6116487",
"0.6116487",
"0.6050661",
"0.60500693",
"0.60254586",
"0.6006341",
"0.6001819",
"0.59999555",
"0.59548235",
"0.5943376",
"0.5911394",
"0.59099525",
"0.590054",
"0.579397... | 0.618195 | 5 |
Retrieves the pagination "per_page" attribute for a given element (passed in as a prefix uniq identifyer) | def get_per_page(prefix="")
(@search_params[prefix + "per_page"] || 10).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_page\n params[\"length\"].to_i\n end",
"def per_page\n 10\n end",
"def per_page\n pagination_adapter.per_page\n end",
"def per_page; end",
"def page_index(item_index)\n return -1 if item_index < 0 || item_index > item_count-1 \n item_index/@per_page \n end",
"d... | [
"0.6280538",
"0.6266342",
"0.6260376",
"0.6171978",
"0.6165387",
"0.6085732",
"0.6084138",
"0.6081429",
"0.6070097",
"0.6054496",
"0.60319066",
"0.6031471",
"0.60157114",
"0.59576046",
"0.5955758",
"0.59200644",
"0.5902128",
"0.58876914",
"0.5827792",
"0.57958484",
"0.5785236... | 0.6916205 | 0 |
Creates a Location Object based on the zip code entered. | def initialize(zip = DEFAULT_ZIP)
address = (!Geocoder.search(zip).empty? ? Geocoder.search(zip) : Geocoder.search(DEFAULT_ZIP))
@city = address[0].data["standard"]["city"]
@state = address[0].data["standard"]["prov"]
@zip = address[0].data["standard"]["postal"]
@confidence = address[0].data["standard"]["c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_location(zip)\n location = Weatherman::Client.new(:unit =>'f')\n location.lookup_by_location(zip)\nend",
"def zip_code\n Faker::Address.zip\n end",
"def zip_code\n Faker::Address.zip\n end",
"def get_location_info(zip)\n url_string = \"https://offer-demo.adcrws.com/v1/geoloca... | [
"0.63561875",
"0.6328943",
"0.6328943",
"0.6241868",
"0.6169024",
"0.6163781",
"0.613777",
"0.60630083",
"0.60135335",
"0.5980115",
"0.5976136",
"0.59750444",
"0.59628206",
"0.5942102",
"0.5940398",
"0.5939853",
"0.59272504",
"0.5907992",
"0.58517087",
"0.5829498",
"0.5829301... | 0.65771854 | 0 |
Terminal size as tuple | def size
@size.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def terminal_size; end",
"def terminal_size; end",
"def terminal_size\n if /solaris/ =~ RUBY_PLATFORM && (`stty` =~ /\\brows = (\\d+).*\\bcolumns = (\\d+)/)\n w, r = [$2, $1]\n else\n w, r = `stty size`.split.reverse\n end\n w = `tput cols` unless w # last ditch effort to at ... | [
"0.7163018",
"0.7163018",
"0.6817911",
"0.6812135",
"0.6595817",
"0.65479994",
"0.6492725",
"0.6422152",
"0.6390844",
"0.63874173",
"0.6372809",
"0.6362208",
"0.63563776",
"0.6352182",
"0.63450813",
"0.63450813",
"0.63368106",
"0.63329834",
"0.62930477",
"0.62635064",
"0.6263... | 0.6154956 | 35 |
This way, we keep these methods separated from other potential parts of the program | def find(id)
raise "candidates must be an Array" if @candidates.nil?
@candidates.each do |candidate|
return candidate if candidate[:id] == id
end
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def internal; end",
"def operations; end",
"def operations; end",
"def schubert; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; ... | [
"0.74075437",
"0.67953146",
"0.6630201",
"0.6630201",
"0.6364668",
"0.6355618",
"0.6355618",
"0.6272921",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6269647",
"0.6258522",
"0.62575066",
"0.6216936",
"0.61943597",... | 0.0 | -1 |
fixes update bug dont know why its not working with super() | def before_update_save(record)
record.comments.each do |comment|
comment.user = current_user
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update\n super\n end",
"def update ; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; en... | [
"0.8254868",
"0.8112858",
"0.8112858",
"0.8112858",
"0.8112858",
"0.75643975",
"0.7534073",
"0.7534073",
"0.7534073",
"0.7534073",
"0.7534073",
"0.7534073",
"0.7534073",
"0.7534073",
"0.75304925",
"0.73172283",
"0.73077285",
"0.7241693",
"0.7241693",
"0.72261465",
"0.72094274... | 0.0 | -1 |
Check if the AMI is bootstrapped | def ami_bootstrapped?
version = ''
bootstrapped_file = '/opt/parallelcluster/.bootstrapped'
current_version = "aws-parallelcluster-cookbook-#{node['cluster']['parallelcluster-cookbook-version']}"
if ::File.exist?(bootstrapped_file)
version = IO.read(bootstrapped_file).chomp
Chef::Log.info("Detected boo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bootstrapped?\n # @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').match(/YES/).nil?\n @bootstrapped ||= !run('if [ -f /var/poolparty/bootstrapped ]; then echo \"YES\"; fi').chomp.empty? || false\n end",
"def bootstrapped?\n # When we have a boots... | [
"0.7959211",
"0.76660186",
"0.7460651",
"0.7421735",
"0.7393507",
"0.72355336",
"0.69843256",
"0.67771",
"0.660928",
"0.6591966",
"0.65501887",
"0.6536266",
"0.62622106",
"0.62615067",
"0.61869",
"0.61601883",
"0.61601883",
"0.6123886",
"0.6089094",
"0.6067623",
"0.60569245",... | 0.7990134 | 0 |
ToDo: Use Regex in validation format | def format_name
if name.match?(/\s/) || name.include?("+") || name.include?("-")
errors.add(:name, "please enter tags in correct format, without -, + or whitespaces")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_regex value, validator\n return unless regexp? value\n\n regex = value.value\n unless secure_regex?(regex)\n warn :model => @current_model,\n :warning_type => \"Format Validation\",\n :warning_code => :validation_regex,\n :message => \"Insufficient validation for '#{get_name ... | [
"0.70503867",
"0.6828818",
"0.6631806",
"0.6611406",
"0.6605407",
"0.6516531",
"0.6500286",
"0.649847",
"0.6488866",
"0.6483471",
"0.64774036",
"0.64774036",
"0.64758354",
"0.647409",
"0.64687914",
"0.6410002",
"0.6408877",
"0.64065015",
"0.63889974",
"0.63280857",
"0.6327566... | 0.0 | -1 |
json_should_skip skips if line does not include json clean unescapes string and strips whitespace | def get_unique_ddis(tags_file, output)
ddis = []
tags_file.each do |line|
next if json_should_skip line
hashed_line = JSON.parse(clean(line))
ddis << hashed_line["ddi"]
end
ddis.uniq.sort.each do |ddi|
output << "#{ddi}\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def looks_like_json? line\n !!(line =~ /^\\s*\\{/)\n end",
"def fix_malformed_json(malformed_json)\n return malformed_json.gsub(/([a-z][a-zA-Z0-9_]+):(?!\\s)/, '\"\\1\":')\n end",
"def dirty_json_decode(json_string)\n json_string.gsub!(/^(\\s*\\{)/, \"\")\n if $1\n json_string.gsub!(/\\s*\... | [
"0.6370061",
"0.6124558",
"0.5631142",
"0.5602503",
"0.5551827",
"0.5551194",
"0.5524658",
"0.54648596",
"0.5428329",
"0.54069835",
"0.52820855",
"0.5214262",
"0.5166706",
"0.5150397",
"0.5136355",
"0.50895226",
"0.50424236",
"0.50387377",
"0.5036359",
"0.5016935",
"0.5016935... | 0.0 | -1 |
Version sync of preview | def sync
@sync ||= Sync.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_latest_version\n load_attributes_from_version(latest_version)\n end",
"def initial_version\n version - changes.size\n end",
"def set_version\n if request.post?\n @page = Comatose::Page.find_is_snippet params[:id]\n @version_num = params[:version]\n ... | [
"0.7012343",
"0.65945196",
"0.6168273",
"0.614521",
"0.6098438",
"0.60552686",
"0.60170543",
"0.60170543",
"0.6013906",
"0.6006286",
"0.5996411",
"0.5987675",
"0.5987675",
"0.5972605",
"0.59260565",
"0.59260565",
"0.59260565",
"0.59260565",
"0.59260565",
"0.59260565",
"0.5926... | 0.0 | -1 |
Version wireless of preview | def wireless
@wireless ||= Wireless.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v81\n fetch_version(:v81)\n end",
"def version\n network(hex: true) + 1\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def vers... | [
"0.64345",
"0.6409575",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.6393114",
"0.... | 0.0 | -1 |
Version marketplace of preview | def marketplace
@marketplace ||= Marketplace.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_latest_version\n load_attributes_from_version(latest_version)\n end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end",
"def version; end... | [
"0.7309287",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"0.6583171",
"... | 0.0 | -1 |
Version bulk_exports of preview | def bulk_exports
@bulk_exports ||= BulkExports.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export\n\n end",
"def export\n\n end",
"def pre_export\n end",
"def index\n @ct_gov_import_exports = CtGovImportExport.all\n end",
"def list_exports(db)\n db.query(\"SELECT e.id, e.dataset, e.path, r.root_dataset, r.root_path FROM storage_export e\n\t\t INNER JOIN storage_root r... | [
"0.63831395",
"0.63629186",
"0.62455535",
"0.59455234",
"0.58599985",
"0.58586043",
"0.57343173",
"0.5681223",
"0.5681223",
"0.5681223",
"0.5681223",
"0.5681223",
"0.567961",
"0.56094086",
"0.55835295",
"0.55257595",
"0.54642355",
"0.5460826",
"0.5418252",
"0.5404658",
"0.539... | 0.6428675 | 0 |
Version proxy of preview | def proxy
@proxy ||= Proxy.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_latest_version\n load_attributes_from_version(latest_version)\n end",
"def preview\n end",
"def preview\n end",
"def preview\n redirect_to preview_url\n end",
"def preview\n @preview ||= Preview.new(self) #if has_preview?\n end",
"def preview_url(opts={})... | [
"0.6497256",
"0.63926834",
"0.63926834",
"0.6119125",
"0.60128826",
"0.5998925",
"0.5948553",
"0.59470284",
"0.59375757",
"0.5936404",
"0.5892427",
"0.5842236",
"0.58414125",
"0.58414125",
"0.58414125",
"0.58414125",
"0.58414125",
"0.58414125",
"0.58414125",
"0.58414125",
"0.... | 0.0 | -1 |
Version hosted_numbers of preview | def hosted_numbers
@hosted_numbers ||= HostedNumbers.new self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview_latest_version\n load_attributes_from_version(latest_version)\n end",
"def url_desktop_revisions\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"revision\"]\n\t\tend",
"def to_s\n '<Twilio::REST::Preview::HostedNumbers>';\n end",
"def to_s\n ... | [
"0.60115606",
"0.5992923",
"0.57860225",
"0.57031095",
"0.55112565",
"0.5453312",
"0.54045796",
"0.5393122",
"0.53792286",
"0.53665614",
"0.53662103",
"0.53660667",
"0.5354391",
"0.5312538",
"0.53111196",
"0.5286933",
"0.52662617",
"0.5249385",
"0.5220751",
"0.5219073",
"0.52... | 0.6207096 | 0 |
Provide a user friendly representation | def to_s
'#<Twilio::REST::Preview>'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_display\n raise NotImplementedError\n end",
"def to_s; description end",
"def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end",
"def to_s\n super\n end",
"def to_s\n super\n end",
"def to_s\n \"#{@nam... | [
"0.70430577",
"0.7025487",
"0.7008232",
"0.7007793",
"0.69441473",
"0.6917163",
"0.68431",
"0.6797009",
"0.6655106",
"0.66227216",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.6618043",
"0.660979",
"0.660979",
"0.6585346",
"0... | 0.0 | -1 |
GET /quality_histories GET /quality_histories.json | def index
qualities_viewed = QualityHistory.where(:user_id => current_user.id, :action_type => 'view').group(:quality_id)
@quality_histories = qualities_viewed.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render json: @quality_histories }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quality_history = QualityHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quality_history }\n end\n end",
"def new\n @quality_history = QualityHistory.new\n\n respond_to do |format|\n format.html # new.html... | [
"0.70626575",
"0.6520115",
"0.647272",
"0.6463762",
"0.64036715",
"0.6384516",
"0.62913513",
"0.62686884",
"0.6261365",
"0.62293816",
"0.6189942",
"0.6173799",
"0.6149583",
"0.61420107",
"0.61397016",
"0.60923433",
"0.6074062",
"0.6070745",
"0.6070745",
"0.6050353",
"0.605035... | 0.6860215 | 1 |
GET /quality_histories/1 GET /quality_histories/1.json | def show
@quality_history = QualityHistory.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @quality_history }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @quality_history = QualityHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_history }\n end\n end",
"def index\n qualities_viewed = QualityHistory.where(:user_id => current_user.id, :action_type => 'view').group(:quality_id)... | [
"0.6851117",
"0.6719136",
"0.6468403",
"0.63825536",
"0.63797617",
"0.63718927",
"0.63697",
"0.6364662",
"0.6325568",
"0.6284946",
"0.62709045",
"0.626188",
"0.6254117",
"0.62222284",
"0.61906344",
"0.61783046",
"0.6169568",
"0.6158731",
"0.6137104",
"0.61342704",
"0.6123947"... | 0.73705065 | 0 |
GET /quality_histories/new GET /quality_histories/new.json | def new
@quality_history = QualityHistory.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @quality_history }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @quality_history = QualityHistory.new(params[:quality_history])\n\n respond_to do |format|\n if @quality_history.save\n format.html { redirect_to @quality_history, notice: 'Quality history was successfully created.' }\n format.json { render json: @quality_history, status: :cre... | [
"0.7448725",
"0.73022723",
"0.72997046",
"0.7261206",
"0.72538495",
"0.7099804",
"0.7052254",
"0.7003994",
"0.6990626",
"0.6979273",
"0.6944034",
"0.69072586",
"0.68853587",
"0.68750745",
"0.6860785",
"0.6844546",
"0.68209887",
"0.67954314",
"0.674185",
"0.6700981",
"0.668132... | 0.80879384 | 0 |
POST /quality_histories POST /quality_histories.json | def create
@quality_history = QualityHistory.new(params[:quality_history])
respond_to do |format|
if @quality_history.save
format.html { redirect_to @quality_history, notice: 'Quality history was successfully created.' }
format.json { render json: @quality_history, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def new\n @quality_history = QualityHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_history }\n end\n end",
"def post_to_historical(data_hash, title_number)\n\n ... | [
"0.6532357",
"0.63877237",
"0.63809854",
"0.61764854",
"0.60242957",
"0.60004705",
"0.59981865",
"0.5858503",
"0.58467406",
"0.5805381",
"0.57931155",
"0.5756571",
"0.56911445",
"0.56720656",
"0.56676334",
"0.5666265",
"0.56615573",
"0.5634191",
"0.5630224",
"0.56190896",
"0.... | 0.7134147 | 0 |
PUT /quality_histories/1 PUT /quality_histories/1.json | def update
@quality_history = QualityHistory.find(params[:id])
respond_to do |format|
if @quality_history.update_attributes(params[:quality_history])
format.html { redirect_to @quality_history, notice: 'Quality history was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @quality_history = QualityHistory.new(params[:quality_history])\n\n respond_to do |format|\n if @quality_history.save\n format.html { redirect_to @quality_history, notice: 'Quality history was successfully created.' }\n format.json { render json: @quality_history, status: :cre... | [
"0.6291566",
"0.6236274",
"0.60506403",
"0.60506403",
"0.5935741",
"0.5935741",
"0.58857745",
"0.5861245",
"0.58012384",
"0.57324314",
"0.5732102",
"0.5722932",
"0.5719681",
"0.571646",
"0.57110196",
"0.5694382",
"0.5692788",
"0.56860423",
"0.5685636",
"0.56603634",
"0.565953... | 0.69913536 | 0 |
DELETE /quality_histories/1 DELETE /quality_histories/1.json | def destroy
@quality_history = QualityHistory.find(params[:id])
@quality_history.destroy
respond_to do |format|
format.html { redirect_to quality_histories_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @unified_history.destroy\n respond_to do |format|\n format.html { redirect_to unified_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.h... | [
"0.72094935",
"0.7144605",
"0.71441084",
"0.7035836",
"0.70033014",
"0.6973414",
"0.68953204",
"0.68646663",
"0.685356",
"0.6849198",
"0.68471557",
"0.68437225",
"0.6824167",
"0.68219095",
"0.6803445",
"0.6798743",
"0.6794679",
"0.6791891",
"0.67903334",
"0.67832595",
"0.6781... | 0.78279686 | 0 |
search using recursion O(h)T, h = height of the tree | def search(value)
return 'not found' if @root.nil?
return 'found' if @root.value == value
if value < @root.value
@root = root.left
search(value)
elsif value > @root.value
@root = root.right
search(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of th... | [
"0.6822407",
"0.672857",
"0.66945803",
"0.66742915",
"0.666793",
"0.6653098",
"0.66234493",
"0.6606114",
"0.6567309",
"0.6564819",
"0.6542217",
"0.65376097",
"0.6536601",
"0.6505281",
"0.6501015",
"0.64799875",
"0.64699745",
"0.646264",
"0.64204514",
"0.6412999",
"0.6406781",... | 0.61256385 | 72 |
Minimum and maximum values in a tree All minimum values are in the left side of the tree All maximum values are in the right side of the tree def find_minimum | def find_minimum
current = @root
while current.left && !current.nil?
current = current.left
return current.value if current.left.nil?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_minimum_value\n if self.left_child\n self.left_child.find_minimum_value\n else\n self.value\n end\n end",
"def minimum_value\n current = self\n \n while current.left_child != nil do\n current = current.left_child\n end\n \n return current.data\n end",
"def e... | [
"0.74091643",
"0.72250617",
"0.71735525",
"0.71202904",
"0.71043676",
"0.6939688",
"0.69330454",
"0.6922298",
"0.69042546",
"0.68924165",
"0.68508",
"0.6825214",
"0.6784729",
"0.6735086",
"0.668519",
"0.66575253",
"0.66036737",
"0.66036737",
"0.6601173",
"0.6575141",
"0.65691... | 0.73109835 | 1 |
Tree traversal BST traversal can list all nodes in sorted order inorder traversal visit all left nodes, then the root, then the right nodes O(n) nodes in the tree | def inorder
@queue = []
inorder_traversal(@root)
@queue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inOrderTraversal(node = @root)\n return if (node == nil)\n inOrderTraversal(node.left)\n puts node.value.to_s\n inOrderTraversal(node.right)\n\n\n end",
"def inOrderTraversal(node = @root)\n return if (node == nil)\n inOrderTraversal(node.left)\n puts node.value.to_s\n... | [
"0.7449664",
"0.74014187",
"0.7384122",
"0.7372669",
"0.7292114",
"0.72721654",
"0.71762145",
"0.713875",
"0.71321404",
"0.7086427",
"0.70720214",
"0.7055813",
"0.7036965",
"0.7030448",
"0.69960386",
"0.6989455",
"0.6986476",
"0.69684577",
"0.69522667",
"0.6943163",
"0.694304... | 0.0 | -1 |
O(h)T height of the tree | def insertion(value)
insertion_recursion(value, @root)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n return @tree_height\n end",
"def height\n height_recursive(@root)\n end",
"def height\n return 0 if @root.nil?\n current = @root\n height_recursive(current)\n end",
"def height\n return 0 if @root == nil\n t, result = @root, -1\n while t\n t = t.left\n result... | [
"0.8402187",
"0.8365457",
"0.8068938",
"0.8059152",
"0.7943672",
"0.7943672",
"0.79393345",
"0.79169375",
"0.7901057",
"0.78391355",
"0.78350675",
"0.78350675",
"0.7801125",
"0.7793733",
"0.77828336",
"0.7773098",
"0.7771369",
"0.77545017",
"0.7740022",
"0.77248394",
"0.76906... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.