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
it is used for, to find blocks according to the district
def block if current_user.has_role?(:district) district = Admin::District.find_by_district_name(current_user.district_name) @blocks = Admin::Block.find_all_by_district_id(district) else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @district_id = params[:district_id] \n\n if(@district_id.blank?)\n\t@blocks = Block.order(sort_column + \" \" + sort_direction)\n else \n\t@blocks = Block.find_all_by_district_id(@district_id, :order => sort_column + \" \" + sort_direction)\n end \n end", "def each(&block)\n @distri...
[ "0.63665664", "0.61494863", "0.6024646", "0.60202616", "0.58315337", "0.57691073", "0.55889094", "0.54895157", "0.5479207", "0.54565436", "0.5450814", "0.5358831", "0.5352633", "0.5347909", "0.5318615", "0.52922404", "0.5275183", "0.5257443", "0.5217392", "0.5199002", "0.5189...
0.63776267
0
determine if the maze is valid
def valid for i in 0..(@n-1) for j in 0..(@m-1) return false if @maze_table[2*j+1][2*i+1] == "1" walls = 0 walls += 1 if @maze_table[2*j][2*i+1] == "1" walls += 1 if @maze_table[2*j+2][2*i+1] == "1" walls += 1 if @maze_table[2*j+1][2*i+2] == "1" walls += 1 if @m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_move?(position)\n position && @maze[position] != \"*\" && @times_visited[position] < 2 && position[0] < @maze.maze.length && position[1] < find_max_row_length \n end", "def valid_position?(pos)\n r,c = pos\n row_len = @maze[0].length\n col_len = @maze[0].length\n\n # is ...
[ "0.7525062", "0.745382", "0.74011844", "0.72573256", "0.7241503", "0.7105281", "0.7103989", "0.704179", "0.6822134", "0.6769091", "0.67518777", "0.6721283", "0.66673064", "0.66588426", "0.6639792", "0.6631556", "0.6631556", "0.66205406", "0.6617253", "0.66171753", "0.66147065...
0.7588825
0
count a cell's walls
def count_walls(x, y) walls = 0 walls += 1 if @maze_table[x][y+1] == "1" walls += 1 if @maze_table[x][y-1] == "1" walls += 1 if @maze_table[x+1][y] == "1" walls += 1 if @maze_table[x-1][y] == "1" return walls end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbor_mines_count\n neighbor_cells.count(&:mine?)\n end", "def number_cells\n n = 1\n for row in 0...height\n for col in 0...width\n cell = self[row, col]\n west, north, east, south = DIRS.map{|dx, dy| self[row + dx, col + dy] and self[row + dx, col + dy].empty }\n ...
[ "0.7271694", "0.72484297", "0.719239", "0.71409535", "0.71409535", "0.71008146", "0.70756155", "0.70040166", "0.6961393", "0.69142574", "0.69114035", "0.68784094", "0.6866892", "0.68507653", "0.68026096", "0.67692286", "0.67394435", "0.67348397", "0.66632575", "0.6638201", "0...
0.82462496
0
redesign the maze using Prim algorithm
def redesign @waiting = [] @maze_table = Array.new(2*@m+1){Array.new(2*@n+1, "1")} for i in 0..2*@m for j in 0..2*@n @maze_table[i][j] = "w" if i%2==1 && j%2==1 end end sx = 2*rand(@m)+1 sy = 2*rand(@n)+1 @maze_table[sx][sy] = "0"#set cell add_neighbor(sx, sy) unt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redesign\r\n\t\tm = MazeMaker.new(@n,@m)\r\n\t\t@maze = m.make_maze\r\n\tend", "def redesign()\n\t\tr_maze= maze {|r,c| r_maze[r][c].to_i}\n\t\t(1..row-2).each {|r| (1..col-2).each {|c| r_maze[r][c] = Random.rand(2).to_s}}\n\t\treturn r_maze\n\tend", "def redesign(); load(MazeRedesign.new(across,down).prod...
[ "0.64417595", "0.6433259", "0.64218557", "0.60816276", "0.6070324", "0.60309535", "0.601728", "0.60160893", "0.6007822", "0.59296656", "0.5915794", "0.5877339", "0.58501744", "0.5839862", "0.5790449", "0.57543504", "0.57480645", "0.570359", "0.5700807", "0.5689995", "0.567952...
0.6575434
0
Method to return a string concatenating the CPU information of the resource
def cpu_values_string return "#{self.cpu_architecture} architecture" if !self.cpu_speed && self.cpu_architecture cpu_string = "#{self.cpu_speed} GHz" if self.cpu_speed cpu_string ||= "" cpu_string.insert(0, "#{self.cpu_count} x ") if self.cpu_count cpu_string << "CPU" if !self.cpu_speed && self.cpu_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cpu_info(workstation_id); end", "def cpu_temp\n\t\t`vcgencmd measure_temp`.chomp\n\tend", "def info\n str_info = \"\"\n\n # CPU\n str_info << \"MODELNAME=\\\"\" << @cpuModel.to_s << \"\\\"\\n\"\n str_info << \"CPUSPEED=\" << @cpuMhz.to_s << \"\\n\"\n str_info <...
[ "0.6775667", "0.6714586", "0.6705656", "0.6694897", "0.64760137", "0.63711286", "0.6350578", "0.63501096", "0.63112026", "0.62739253", "0.62657577", "0.6130171", "0.61168426", "0.6073224", "0.6066733", "0.6001989", "0.6000021", "0.6000021", "0.59904826", "0.59503895", "0.5949...
0.771105
0
this uploads the item to GDrive. It takes a hash of metadata ( :title, and :description) a file object, which is writen to a tmp file and a uuid of a parent folder, which is generated for the user.
def upload_item(item, file, parent = '0BxnZXCons72AYXZOTVVrdGk0bTg' ) tmp_file = Tempfile.new('mendeley').tap do |f| f.binmode # must be in binary mode f.write file f.rewind end metadata = @drive.files.insert.request_schema.new({ 'title' => item[:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload\n self._create params[:upfile], params[:pictitle]\n end", "def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend", "def upload_file(file_upload, owner)\n image = MiniMagick...
[ "0.6551275", "0.6498699", "0.6389274", "0.63684195", "0.63484985", "0.6295816", "0.6260204", "0.62232083", "0.6217135", "0.6189664", "0.6173948", "0.6172908", "0.6154489", "0.6144263", "0.6132227", "0.61124575", "0.608604", "0.6050799", "0.604509", "0.60159296", "0.5991713", ...
0.78845245
0
this creates a new ingest folder for the user.
def create_user_ingest_folder(user_name, parent = '0BxnZXCons72AYXZOTVVrdGk0bTg') metadata = @drive.files.insert.request_schema.new({ 'title' => user_name, 'mimeType' => "application/vnd.google-apps.folder", 'parents' => [{'id' => parent}] }) result = @client.execute( :api_method...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params[:user])\n # TODO process errors\n # TODO create folder\n # TODO create record in Folder\n if @user.save\n Dir.mkdir(Dir.pwd+\"/app/assets/images/from_users/\"+@user.id.to_s)\n render :partial => \"/users/create\"\n else\n render :partial => \"/u...
[ "0.6432338", "0.6346663", "0.6308674", "0.62749416", "0.62700254", "0.6257484", "0.6213386", "0.6183872", "0.61758965", "0.6159493", "0.6119036", "0.60606444", "0.60396194", "0.60279614", "0.6025426", "0.6024448", "0.60206765", "0.60206765", "0.60132974", "0.60029036", "0.599...
0.75658965
0
:nodoc: Creates a new Net::SSH::Multi::Session instance. Initially, it contains no server definitions, no group definitions, and no default gateway. You can set the concurrent_connections property in the options. Setting it to +nil+ (the default) will cause Net::SSH::Multi to ignore any concurrent connection limit and ...
def initialize(options={}) @server_list = ServerList.new @groups = Hash.new { |h,k| h[k] = ServerList.new } @gateway = nil @open_groups = [] @connect_threads = [] @on_error = :fail @default_user = ENV['USER'] || ENV['USERNAME'] || "unknown" @open_connections = 0 @p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_sessions_concurrently2(cluster, num_sessions)\n sessions = []\n threads = (1..num_sessions).map do\n Thread.new do\n begin\n session = cluster.connect\n sessions << session\n rescue Exception => e\n session.close\n raise RuntimeError.new(\"Err...
[ "0.6171822", "0.56242526", "0.5604951", "0.56034243", "0.55304754", "0.5508151", "0.5502938", "0.5468985", "0.546783", "0.54631543", "0.53356254", "0.5320778", "0.5319843", "0.5315983", "0.53068376", "0.5294342", "0.5287762", "0.5235571", "0.52286786", "0.5193006", "0.5183148...
0.5672846
1
Sets up a default gateway to use when establishing connections to servers. Note that any servers defined prior to this invocation will not use the default gateway; it only affects servers defined subsequently. session.via 'gateway.host', 'user' You may override the default gateway on a perserver basis by passing the :v...
def via(host, user, options={}) @default_gateway = Net::SSH::Gateway.new(host, user, options) self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway(gateway)\n @options[:gateway] = gateway\n end", "def gateway(name, options = {}, &block)\n server = Server.new(options.merge(:name => name, :is_gateway => true, :servers => self.__servers))\n self.__servers << server\n end", "def gateway\n @gateway ||= PAYMENT_CLASS.new(\n ...
[ "0.65456766", "0.60271835", "0.60189754", "0.58589494", "0.5669882", "0.5654905", "0.56490093", "0.5638161", "0.5619406", "0.5608209", "0.55244225", "0.5516053", "0.54915524", "0.54861516", "0.5452453", "0.5423992", "0.54232484", "0.5422895", "0.539926", "0.5387287", "0.53803...
0.7023645
0
Essentially an alias for servers_for without any arguments. This is used primarily to satistfy the expectations of the Net::SSH::Multi::SessionActions module.
def servers servers_for end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_servers(servers)\n servers = Array(servers)\n servers.map! do |server|\n server.is_a?(String) ? server : inspect_server(server)\n end\n super\n end", "def remote(args, &block)\n args = { args => :servers } unless args.is_a?(Hash)\n local(args) do\n name = ar...
[ "0.6303927", "0.60357136", "0.60267997", "0.60267997", "0.59725374", "0.58164173", "0.5774902", "0.5752063", "0.57502705", "0.5745658", "0.57376915", "0.5728757", "0.5685762", "0.561045", "0.5593751", "0.55685514", "0.55235934", "0.55208105", "0.55106914", "0.5503908", "0.549...
0.636609
0
Works as with, but for specific servers rather than groups. It will return a new subsession (Net::SSH::Multi::Subsession) consisting of the given servers. (Note that it requires that the servers in question have been created via calls to use on this session object, or things will not work quite right.) If a block is gi...
def on(*servers) subsession = Subsession.new(self, servers) yield subsession if block_given? subsession end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on(*new_servers)\r\n subsession = self.clone\r\n subsession.servers = new_servers & servers\r\n yield subsession if block_given?\r\n subsession\r\n end", "def on servers, opts = {}\n merge_opts_with_env opts\n (@servers = servers).each do |server|\n @server = serve...
[ "0.6976882", "0.6567145", "0.6108353", "0.59410346", "0.5886708", "0.58364797", "0.56832695", "0.5649612", "0.5596653", "0.55797946", "0.5465919", "0.544738", "0.5422072", "0.5401999", "0.5398836", "0.535602", "0.533103", "0.53225577", "0.53078943", "0.52971154", "0.5276749",...
0.7367818
0
Closes the multisession by shutting down all open server sessions, and the default gateway (if one was specified using via). Note that other gateway connections (e.g., those passed to use directly) will _not_ be closed by this method, and must be managed externally.
def close server_list.each { |server| server.close_channels } loop(0) { busy?(true) } server_list.each { |server| server.close } default_gateway.shutdown! if default_gateway end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closeConnections()\n #N Without this, the connections won't be closed\n @sshAndScp.close()\n end", "def close_all\n @connections.close_all\n end", "def closeConnections\n #N Without this, cached SSH connections to the remote system won't get closed\n destinationLocation.closeConn...
[ "0.66445184", "0.64651895", "0.6395496", "0.63639325", "0.63151383", "0.6308249", "0.6295422", "0.61965823", "0.5998212", "0.5970841", "0.5952416", "0.5950661", "0.594841", "0.59254044", "0.591767", "0.59018475", "0.58860517", "0.58717763", "0.58553994", "0.58452713", "0.5840...
0.7588814
0
Runs the preprocess stage on all servers. Returns false if the block returns false, and true if there either is no block, or it returns true. This is called as part of the process method.
def preprocess(&block) #:nodoc: return false if block && !block[self] server_list.each { |server| server.preprocess } block.nil? || block[self] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ev_preprocess(&block)\n return false if block_given? && !yield(self)\n\n @sessions.each(&:ev_preprocess)\n return false if block_given? && !yield(self)\n\n return true\n end", "def preprocess\n true\n end", "def preprocess(&block); end", "def pre_process...
[ "0.65958434", "0.6204776", "0.6039372", "0.57456905", "0.56770253", "0.5646727", "0.5555828", "0.5464847", "0.54087055", "0.54055077", "0.53939486", "0.538906", "0.5315904", "0.5308766", "0.52817476", "0.52793646", "0.52755123", "0.5227423", "0.5223624", "0.5204702", "0.51807...
0.8161832
0
Runs the postprocess stage on all servers. Always returns true. This is called as part of the process method.
def postprocess(readers, writers) #:nodoc: server_list.each { |server| server.postprocess(readers, writers) } true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_perform!\n return unless perform_hooks?\n unless hooks.post_hooks.any?\n GitPusshuTen::Log.message \"No post deploy hooks to perform.\"\n return\n end\n \n ##\n # Connect to the remote environment and perform the post deploy hooks\n hooks....
[ "0.6498138", "0.58987606", "0.5852972", "0.58301425", "0.5829444", "0.57345694", "0.561956", "0.55383915", "0.54992133", "0.54797935", "0.54568076", "0.54361284", "0.5418524", "0.5375296", "0.53538144", "0.53234255", "0.5304686", "0.5278461", "0.52778226", "0.5273647", "0.525...
0.70264184
0
Takes the concurrent_connections property into account, and tries to return a new session for the given server. If the concurrent connections limit has been reached, then a Net::SSH::Multi::PendingConnection instance will be returned instead, which will be realized into an actual session as soon as a slot opens up. If ...
def next_session(server, force=false) #:nodoc: # don't retry a failed attempt return nil if server.failed? @session_mutex.synchronize do if !force && concurrent_connections && concurrent_connections <= open_connections connection = PendingConnection.new(server) @pending_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available(server)\n available_connections(server).pop || make_new(server)\n end", "def make_new(server)\n if (n = created_count(server)) >= @max_size\n allocated(server).to_a.each{|t, c| release(t, c, server) unless t.alive?}\n n = nil\n end\n if (n || created_count(server)) < @max_siz...
[ "0.58729994", "0.5528547", "0.5517614", "0.5461938", "0.54018205", "0.53962195", "0.5391665", "0.5366723", "0.53502107", "0.53383106", "0.5273229", "0.52136445", "0.5200869", "0.51389277", "0.5119884", "0.51065564", "0.50594974", "0.5038861", "0.49982744", "0.49699026", "0.49...
0.76908237
0
Tells the session that the given server has closed its connection. The session indicates that a new connection slot is available, which may be filled by the next pending connection on the next event loop iteration.
def server_closed(server) #:nodoc: @session_mutex.synchronize do unless @pending_sessions.delete(server.session) @open_connections -= 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_close(event)\n logger.debug 'Socket closed'\n @connected = false\n @socket = nil\n dispatch('command' => 'session_ended')\n end", "def on_close(event)\n logger.debug 'Socket closed'\n @connected = false\n @socket = nil\n dispatch('command' => 'session_ended')\n ...
[ "0.70926625", "0.70926625", "0.65533656", "0.65043604", "0.64720094", "0.6469481", "0.63374543", "0.6224998", "0.61912745", "0.61833626", "0.6112138", "0.61101997", "0.6108173", "0.6105311", "0.60971254", "0.60386676", "0.5991889", "0.59803116", "0.5967776", "0.595571", "0.59...
0.7803224
0
Invoked by the event loop. If there is a concurrent_connections limit in effect, this will close any nonbusy sessions and try to open as many new sessions as it can. It does this in threads, so that existing processing can continue. If there is no concurrent_connections limit in effect, then this method does nothing.
def realize_pending_connections! #:nodoc: return unless concurrent_connections server_list.each do |server| server.close if !server.busy?(true) server.update_session! end @connect_threads.delete_if { |t| !t.alive? } count = concurrent_connections ? (concurrent_connection...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_idle_sockets\n return if closed?\n return unless max_idle_time\n\n @lock.synchronize do\n i = 0\n while i < @available_connections.length\n connection = @available_connections[i]\n if last_checkin = connection.last_checkin\n if (Ti...
[ "0.6089269", "0.60527456", "0.59480625", "0.58575565", "0.578673", "0.57660615", "0.57548916", "0.57293576", "0.5724839", "0.5715029", "0.5709969", "0.5698435", "0.56113714", "0.560899", "0.5607639", "0.5581407", "0.5566492", "0.556153", "0.55536294", "0.551427", "0.5496538",...
0.687591
0
Note: Does not perform any role expansion. Just checks for equivalence, or if I am the owner of the role record.
def can_admin_role? role return false unless exists? self.record.roleid == role.record.roleid || self.record.roleid == role.record.owner.roleid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role?(role)\n self.role&.name == role\n end", "def owner?\n self.role_level == 0 ? true : false\n end", "def role?(role)\n\t self.role == role\n\tend", "def role?(r)\n self.role == r.to_s\n end", "def role?(role)\n\t self.role.name == role\n end", "def role?(role)\n self.role == role....
[ "0.7377234", "0.7331949", "0.733144", "0.73145205", "0.7281078", "0.72430724", "0.72407126", "0.72332513", "0.72281015", "0.72020864", "0.71827406", "0.71827406", "0.71242785", "0.7105119", "0.707459", "0.70716155", "0.703806", "0.70134157", "0.70096016", "0.70069253", "0.696...
0.75063777
0
GET /tournaments/new GET /tournaments/new.json
def new @tournament = Tournament.new respond_to do |format| format.html # new.html.erb format.json { render json: @tournament } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\r\n\t\trender 'tournaments/_new', layout: false\r\n\tend", "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "def new\n @participant = Participant.new\n\n respond_to do |f...
[ "0.745925", "0.7032296", "0.7032296", "0.7032296", "0.69867676", "0.695781", "0.695781", "0.69251543", "0.68957984", "0.68957984", "0.6892376", "0.6879307", "0.687868", "0.6859766", "0.6857915", "0.6857915", "0.6844944", "0.68320286", "0.67999077", "0.679313", "0.6783016", ...
0.71581167
1
PUT /tournaments/1 PUT /tournaments/1.json
def update respond_to do |format| if @tournament.update_attributes(params[:tournament]) format.html { redirect_to @tournament, notice: 'Tournament was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @tomaturno.update(tomaturno_params)\n format.html { redirect_to :back, notice: 'Toma de Turnos Actualizada.' }\n format.json { render :show, status: :ok, location: @tomaturno }\n else\n format.html { render :edit }\n format.json { re...
[ "0.6007671", "0.58185655", "0.58105433", "0.5800951", "0.5739521", "0.56908363", "0.565979", "0.565979", "0.5652662", "0.5633466", "0.5594097", "0.5589169", "0.5521771", "0.5492246", "0.5463405", "0.54560226", "0.54489106", "0.54488915", "0.54205334", "0.54205334", "0.5397289...
0.5893821
1
Run a given task. task: YAML object for the task to run.
def run_task(task) packaged = task.keys[0] package, name = Bee::Util::get_package_name(packaged) parameters = @build.context.evaluate_object(task[packaged]) if not @packages[package] @packages[package] = Bee::Task::PackageManager.load_package(package, @build) end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(task)\n debug \"Run task: #{task}\"\n raise Deployment::NotImplemented, 'This method is abstract and should be implemented in a subclass'\n end", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\nend", "def run(task)\n Rake::Task[task].invoke\ne...
[ "0.73821443", "0.7283488", "0.7283488", "0.7283488", "0.7283488", "0.71924007", "0.71901536", "0.71470964", "0.6908796", "0.6817047", "0.6805526", "0.6726201", "0.6686428", "0.6592539", "0.6538731", "0.6499437", "0.6487756", "0.6480044", "0.6466131", "0.64497304", "0.64133215...
0.7581848
0
Get help for a given task. task: YAML object for the task to run.
def help_task(task) package, name = Bee::Util::get_package_name(task) if not @packages[package] @packages[package] = Bee::Task::PackageManager.load_package(package, @build) end help = {} if name == '?' methods = @packages[package].class.public_instance_methods...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_help(shell, task_name)\n meth = normalize_task_name(task_name)\n task = all_tasks[meth]\n handle_no_task_error(meth) unless task\n\n shell.say \"Usage:\"\n shell.say \" #{banner(task)}\"\n shell.say\n class_options_help(shell, nil => task.opt...
[ "0.78619176", "0.7446057", "0.64913577", "0.64913577", "0.6403546", "0.63903934", "0.63903934", "0.6358486", "0.63067675", "0.627661", "0.6275846", "0.6271789", "0.62690425", "0.6223104", "0.61746556", "0.61686915", "0.61454165", "0.61401826", "0.6139785", "0.6129729", "0.609...
0.8135017
0
Read a dictionary file on disk and parse into key/value pairs. === Parameters subpath(Array|String):: subpath or nil === Return result(Hash):: dictionary of metadata
def read_file(subpath = nil) result = {} path = full_path(@file_name_prefix, subpath) contents = File.file?(path) ? File.read(path) : '' contents.each_line do |line| match = line.chomp.match(/^(.+)=(.*)$/) result[match[1]] = match[2] end result e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_meta(node)\n t = decompress_revision(node)\n return {} unless has_metadata?(t)\n \n mt = t[metadata_start..(metadata_end(t) - 1)]\n mt.split(\"\\n\").inject({}) do |hash, line|\n k, v = line.split(\": \", 2)\n hash[k] = v\n hash...
[ "0.5941674", "0.593169", "0.5925045", "0.5843918", "0.583483", "0.58222145", "0.5694842", "0.56947136", "0.5584164", "0.555164", "0.55502796", "0.55240667", "0.55240667", "0.54664326", "0.54612535", "0.54259473", "0.54150414", "0.5402999", "0.5402999", "0.53945655", "0.539224...
0.7374749
0
Write given metadata to a dictionary file. === Parameters metadata(Hash):: Hashlike metadata to write subpath(Array|String):: subpath or nil === Return always true
def write_file(metadata, subpath = nil) return super(metadata, subpath) unless metadata.respond_to?(:has_key?) File.open(create_full_path(@file_name_prefix, subpath), "w", DEFAULT_FILE_MODE) do |f| metadata.each do |k, v| # ensure value is a single line by truncation since most ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_file(metadata)\n return unless metadata.respond_to?(:has_key?)\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) do |f|\n f.print(metadata.to_json)\n end\n end", "def write_file(metadata)\n return unless @formatter.can_format?(metadata)...
[ "0.75094116", "0.7378145", "0.61485076", "0.6072127", "0.6043025", "0.5772505", "0.5761024", "0.56870043", "0.56485474", "0.56177634", "0.5576101", "0.55425745", "0.5468493", "0.53518736", "0.53232056", "0.52566034", "0.52508175", "0.52482843", "0.52408606", "0.52206916", "0....
0.79027
0
If word is rare, it can be one of the following categories: includes numbers, numbers and punctuation symbols, nonnumbers following numbers and unknown. Otherwise, word has it's own category.
def classify(word) return word unless rare? word case word when /^\d+$/ then CARD when /^\d+[.,;:]+$/ then CARDPUNCT when /^\d+\D+$/ then CARDSUFFIX when /^\d+[.,;:\-]+(\d+[.,;:\-]+)*\d+$/ then CARDSEPS else UNKNOWN end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length\n end", "def categories_with_word_count(word)\n return 0 unless @word_list[word] && @word_list[word][:categories]\n @word_list[word][:categories].length \n ...
[ "0.66311985", "0.6447095", "0.6420565", "0.6291134", "0.61121374", "0.6058921", "0.6058921", "0.6015552", "0.59368473", "0.58991927", "0.587005", "0.5827188", "0.57988715", "0.57648385", "0.57625335", "0.57608235", "0.57369107", "0.56815404", "0.5665743", "0.56396836", "0.562...
0.74451405
0
Tagger requires the sentence stop symbol to be defined.
def stop_symbol STOP end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tagSentence(sentence) # MaxentTagger.java:1028\n testSentence = TestSentence.new(self)\n testSentence.tagSentence(sentence, false)\n end", "def tagging_symbol\n '@'\n end", "def tagline; end", "def tokenize\n super.merge(:tags => tags....
[ "0.6460844", "0.59254825", "0.59196895", "0.5845633", "0.5833296", "0.5755156", "0.57511246", "0.5695201", "0.5598354", "0.558489", "0.5581767", "0.55743766", "0.55740833", "0.5553661", "0.5542768", "0.54707676", "0.54462206", "0.544397", "0.5411498", "0.5392119", "0.538455",...
0.6075069
1
Parse the ngrams file.
def parse_ngrams! unigram, bigram = nil, nil read(ngrams_path) do |values| values[0] = unigram unless values[0] values[1] = bigram unless values[1] if values[0] && values[1] && values[2] && values[3] # a trigram ngrams[*values[0..2]] = values[3].to_i elsif values[0] && values[1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ParseQuery(n)\n\trequire \"rexml/document\"\n\tinclude REXML\n\tquery_file = REXML::Document.new(File.open($options[:i], \"r\"))\n\tif !Dir.exist?(\"#{$dir_queryfile}/queries_converted\") # \"./model-files/inverted-index_converted/0_dictionary\"\n\t\tDir.mkdir(\"#{$dir_queryfile}/queries_converted\")\n\tend\n\...
[ "0.6246067", "0.6199018", "0.6199018", "0.6007124", "0.59694284", "0.595846", "0.5952204", "0.5927593", "0.57827586", "0.57726765", "0.5719133", "0.5663354", "0.5591319", "0.55837697", "0.55786204", "0.5556483", "0.5536226", "0.55097646", "0.5494999", "0.5469193", "0.5462062"...
0.8125362
0
Parse the lexicon file.
def parse_lexicon! read(lexicon_path) do |values| values.compact! word, word_count, rare = values.shift, values.shift.to_i, false word = classify(word) if rare = (word_count == 1) lexicon[word] += word_count values.each_slice(2) do |tag, count| lexicon[word, tag] += count.to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_lexicon (file_name)\n begin\n #Opens given file for lexicon\n file = File.open(file_name, 'r')\n #Reads until the end of the file\n until file.eof?\n #For each line in the file compile into lexicon\n file.each_line do |line|\n line.chomp!\n #Gets first character of...
[ "0.6883747", "0.67769164", "0.62480545", "0.62101495", "0.61508644", "0.6079858", "0.60174584", "0.5963178", "0.5923126", "0.58576655", "0.58576655", "0.58416295", "0.58226097", "0.57989705", "0.5643504", "0.5639982", "0.5603", "0.55539244", "0.5539607", "0.55135703", "0.5499...
0.7581417
0
Remove unconfirmed accounts older than 1 day
def clean_up User.where("confirmed IS NULL AND created_at < ?", Time.now-1.day).destroy_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \tif signed_in? && current_user.sk.root?\n \t\toneweekago = Date.today - 7\n \t\tUser.where(\"email_confirm = ? AND created_at < ?\", false, oneweekago).each do |u|\n \t\t\tu.destroy\n \t\tend\n \tend\n end", "def remove_depricated\n self.articles.each do |a|\n unless ((a.created_a...
[ "0.6500287", "0.64815456", "0.6361556", "0.62253886", "0.62171674", "0.6090499", "0.60844916", "0.6075424", "0.6035246", "0.59441227", "0.5943056", "0.58875734", "0.57865953", "0.57865953", "0.5748818", "0.5716617", "0.5704588", "0.5662809", "0.5651006", "0.56436694", "0.5643...
0.7487989
0
GET /broadcaster/audios GET /broadcaster/audios.json
def index # @broadcaster_audios = Broadcaster::Audio.all @broadcaster_audios = @theme.broadcaster_audios end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n @audios = Audio.all\n\n respond_to do |format|\n format.html\n format.json { render json: @audios }\n end\n end", "def sounds_list(params = {})\n get \"sounds\", params\n end", "def index\n @audios = Audio.all\n end", "def index\n @audios = Audio.all\n end", "...
[ "0.687547", "0.6699339", "0.6469389", "0.6469389", "0.6399781", "0.6389791", "0.6329918", "0.632722", "0.62396735", "0.623487", "0.6214068", "0.6214068", "0.6211721", "0.6157629", "0.6125454", "0.61226594", "0.6111484", "0.6109405", "0.60988396", "0.6096917", "0.6025356", "...
0.74591684
0
POST /broadcaster/audios POST /broadcaster/audios.json
def create get_theme @broadcaster_audio = Broadcaster::Audio.new(broadcaster_audio_params) @broadcaster_audio.broadcaster_theme = @theme respond_to do |format| if @broadcaster_audio.save format.html { redirect_to @broadcaster_audio, notice: 'Audio was successfully created.' } for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcaster_audio_params\n params.require(:broadcaster_audio).permit(:title, :broadcaster_theme_id)\n end", "def index\n # @broadcaster_audios = Broadcaster::Audio.all\n @broadcaster_audios = @theme.broadcaster_audios\n\n end", "def audio_params\n params.require(:audio).permit(:audio)...
[ "0.7159106", "0.64661235", "0.6403476", "0.6356113", "0.630386", "0.62807256", "0.6256405", "0.6191029", "0.6136", "0.6103158", "0.6079621", "0.6002802", "0.59615135", "0.5928507", "0.5912126", "0.58930045", "0.5854138", "0.5851578", "0.5838583", "0.58332205", "0.5804545", ...
0.662407
1
PATCH/PUT /broadcaster/audios/1 PATCH/PUT /broadcaster/audios/1.json
def update respond_to do |format| if @broadcaster_audio.update(broadcaster_audio_params) format.html { redirect_to @broadcaster_audio, notice: 'Audio was successfully updated.' } format.json { render :show, status: :ok, location: @broadcaster_audio } else format.html { render :ed...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @audio.update(audio_params)\n format.html { redirect_to @audio, notice: 'Audio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @audio.errors,...
[ "0.66092783", "0.65925664", "0.65607333", "0.6506869", "0.64205533", "0.63924664", "0.6315574", "0.62942934", "0.6288328", "0.62784934", "0.6268633", "0.6249199", "0.61942065", "0.61268896", "0.6125207", "0.6079606", "0.5995746", "0.5974979", "0.59669495", "0.59620935", "0.59...
0.7589481
0
Wait until both the zone and cloud_network fields are set and then fetch subnets from inventory.
def cloud_subnets(_options = {}) return {} if ar_ems.nil? method_log = logger(__method__) zone = field(:placement_availability_zone) cloud_network = field(:cloud_network) return {} if zone.nil? || cloud_network.nil? method_log.debug("availability_zone value is #{zone} && cloud_network is #{cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_subnets\n @@client.describe_subnets.subnets\n end", "def get_subnets(client, vpc_id, vpc_name, subnet_type, subnet_hash)\n resp = get_vpc_subnets(client, vpc_id)\n resp.subnets.each do |subnet|\n if subnet_type == 'public'\n push_subnet(subnet, subnet_hash, vpc_name) if subnet['map...
[ "0.6007851", "0.5859955", "0.559086", "0.55851954", "0.55669147", "0.55346537", "0.5347408", "0.53217894", "0.5311534", "0.52947617", "0.5277921", "0.52742493", "0.52434474", "0.5183061", "0.5126157", "0.5087335", "0.5076534", "0.5071897", "0.50339144", "0.50198257", "0.49780...
0.6723224
0
Clean up a UUID for use in the library
def cleanup(uuid) Util.validate(uuid, 'UUID', UUID_PATTERN) uuid.downcase.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_guid(guid)\n return nil if guid.nil?\n\n g = guid.to_s.downcase\n return nil if g.strip.empty?\n return g if g.length == 36 && g =~ UUID_REGEX_FORMAT\n\n g.delete!('^0-9a-f')\n g.sub!(/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/, '\\1-\\2-\\3-\\4-\\...
[ "0.7061697", "0.69574153", "0.69251025", "0.6865524", "0.6827784", "0.6786986", "0.67146325", "0.6674954", "0.6618214", "0.66163987", "0.6610537", "0.6610537", "0.660724", "0.6575142", "0.6541065", "0.6531051", "0.65069133", "0.6505991", "0.64639044", "0.6457942", "0.64515924...
0.7768322
0
Search Nist xml doc for google code issue and chromium bug tracker links
def findNistLinks(entry, cveManualFile, prevCves) results = Hash.new cve = '' entry.each do |nodes| id = nodes.xpath("vuln:cve-id") id.each do |n| cve = n.content end if(checkForRedundancies(cve, prevCves)) puts "#{cve} already scraped, skipping..." next end results[cve] = Array.new ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draft_release_notes_xml\n extra_javascript 'docs'\n @bugs = sorted_bugs.select(&:doc_text_required?)\n end", "def find_refs\n # should always be there\n @proj_xml_node.css(\"Project Reference\")\n end", "def get_mag_index_pages(mag_url)\n links = []\n doc = Nokogiri::HTML(open(mag_u...
[ "0.5781099", "0.5759052", "0.57194376", "0.5629343", "0.5587981", "0.55754226", "0.55006444", "0.54600424", "0.54506105", "0.542687", "0.53798", "0.53695315", "0.53335905", "0.5317152", "0.53039783", "0.53014284", "0.52981985", "0.529464", "0.5289614", "0.5273807", "0.5271099...
0.5956539
0
Method invoked when a reitveld id is not present on a google code issue It searches the issue page for repository links, that might have reitveld ids It navigates to said repo page and scrapes for reitveld ids.
def scrapeDeep(tempDoc, gIds, rIds) tId = tempDoc.xpath("//a[contains(@href, 'src.chromium.org/viewvc/chrome?view=rev')]") tId.each do | last | link = last.attribute("href") begin lastDoc = Nokogiri::HTML(open(link)) vId = checkForCodeR(lastDoc) parseCodeRId(vId, rIds) rescue OpenURI::HTTPError...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_links_only\n found_issues = collect_issues_from_commits\n return if found_issues.empty?\n\n message = \"## Jira issues\\n\\n\"\n found_issues.each do |issue_id|\n if include_resolves_keyword\n message << \"Resolves \"\n end\n message << \"[#{issue_id}](#{...
[ "0.566568", "0.5633398", "0.5354181", "0.5226372", "0.5218341", "0.5197807", "0.5193745", "0.51874596", "0.5178744", "0.51778644", "0.5159411", "0.51544297", "0.51484555", "0.5131086", "0.5109644", "0.510629", "0.5104615", "0.50890344", "0.5087777", "0.507717", "0.50627476", ...
0.6015797
0
Iterate over all the links found for a list of CVEs and scrape them
def scrapeCveLinks(cves, removedFile, manualFile) results = Hash.new cves.each do | cve, links | puts "Scraping for CVE: #{cve}" gIds = Array.new rIds = Set.new links.each do | link | if link.empty? next end link = link[0] scrapeLink(link, gIds, rIds) end if not rIds.empty? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linkReturn(url)\n data = Nokogiri::HTML(open(url))\n links = data.css('div.case')\n allUrl = links.css('h3 a').map { |var| var['href'] }\n allUrl.each do |i|\n puts scraper(i)\n puts ''\n puts i\n end\nend", "def scrape_links(parsed_page, core_path)\n links = []\n \n parsed_page.css('#class-...
[ "0.6963323", "0.67089903", "0.66655254", "0.6625077", "0.66223305", "0.66027355", "0.6560113", "0.6537241", "0.6508187", "0.64517814", "0.64517814", "0.6426789", "0.6405981", "0.6389153", "0.63370866", "0.6323441", "0.6323441", "0.6302006", "0.62832564", "0.62636983", "0.6226...
0.7229767
0
Save scraping result ids to csv file
def saveResults(csvResults, results) results.keys.sort.each do |key| csvResults << [key, "#{results[key]['r_ids'].to_a.join(" ")}", "#{results[key]['g_ids'].join(" ")}"] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_csv\n CSV.open(\"./db/#{@name}.csv\", \"wb\") {|csv| @result_scrap.to_a.each {|elem| csv << elem} }\n end", "def save_results\n\t\t# save search results\n\t\tCSV.open('results.csv', 'wb') {|csv|\n\t\t\t@checked_links.each {|link|\n\t\t\t\tcsv << [link[0], link[1][:res], link[1][:time]]\n\t\...
[ "0.7678398", "0.68908453", "0.65481985", "0.6545585", "0.6534971", "0.6291337", "0.6268191", "0.6266269", "0.6224127", "0.61841893", "0.61703324", "0.61553323", "0.61536056", "0.6147645", "0.61321634", "0.60992175", "0.6089372", "0.6078459", "0.6075486", "0.60580695", "0.6048...
0.714749
1
Check if google code issue is about a webkit bug should only be run after all other options have been attempted
def webkitBug?(links) links.each do |link| if link.empty? next end link = link[0] page = getPage(link) if page == false next end webkitLinks = page.xpath("//a[contains(@href, 'bugs.webkit') or contains(@href, 'trac.webkit')]") if not webkitLinks.empty? return true end end r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buggy_webkit?\n if request.user_agent =~ /AppleWebKit/\n chrome_version = request.user_agent.slice(/Chrome\\/(\\d+)\\./, 1)\n return !chrome_version || chrome_version.to_i() <= 18\n else\n return false\n end\n end", "def chrome_conflict!\n spinner.update title: Pas...
[ "0.67206556", "0.6324675", "0.61158925", "0.59704536", "0.55860305", "0.5547927", "0.5499871", "0.54776114", "0.536556", "0.534734", "0.52757204", "0.5246009", "0.52369404", "0.5209406", "0.52013785", "0.51515585", "0.5126488", "0.5116897", "0.5105158", "0.50809085", "0.50661...
0.64957047
1
parses rietveld ids from from a url and adds them to the set rId
def parseCodeRId(vId, rIds) vId.each do | found | uri = URI.parse(found.content) rIds << uri.path.to_s.gsub(/\//, '').gsub(/show/, '').gsub(/(?<=\d)diff.*/, '') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(url)\n #return ['142730293478'] # for debugging\n #return ['141088779348'] # for debugging\n agent = Mechanize.new\n page = agent.get(url)\n ids = page.search('article').map do |a|\n a.get_attribute 'id'\n end\n if (nxt = page.at('#older'))\n sleep 1\n nextpage = nxt.get_attribute('href...
[ "0.59675443", "0.5849894", "0.58484584", "0.58425015", "0.5783174", "0.5782321", "0.57028085", "0.56990564", "0.56529415", "0.56527644", "0.56499994", "0.5640465", "0.5608732", "0.5594732", "0.5576567", "0.5562964", "0.55419606", "0.55173707", "0.55083764", "0.550125", "0.549...
0.60167867
0
GET /sessionmaps/1 GET /sessionmaps/1.xml
def show @sessionmap = Sessionmap.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @sessionmap } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sessionmap = Sessionmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sessionmap }\n end\n end", "def index\n respond_to do |format|\n format.html { redirect_to \"/\" }\n format.xml { render :xml => @maps }\n end\n end...
[ "0.64059556", "0.61595666", "0.613416", "0.5922289", "0.58907855", "0.5828422", "0.58101064", "0.58101064", "0.5787844", "0.5721965", "0.56700915", "0.5659923", "0.56598276", "0.5647602", "0.56132907", "0.56041545", "0.56015635", "0.55901724", "0.55442095", "0.55434394", "0.5...
0.72691894
0
GET /sessionmaps/new GET /sessionmaps/new.xml
def new @sessionmap = Sessionmap.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @sessionmap } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sessionmap = Sessionmap.new(params[:sessionmap])\n\n respond_to do |format|\n if @sessionmap.save\n format.html { redirect_to(@sessionmap, :notice => 'Sessionmap was successfully created.') }\n format.xml { render :xml => @sessionmap, :status => :created, :location => @sessi...
[ "0.6942492", "0.679904", "0.6754608", "0.65421873", "0.64842093", "0.63099986", "0.6231006", "0.61739916", "0.60931265", "0.6080135", "0.6058941", "0.6047268", "0.60393256", "0.602814", "0.60212976", "0.60145843", "0.5982046", "0.59266484", "0.5901047", "0.5894973", "0.589105...
0.7717613
0
POST /sessionmaps POST /sessionmaps.xml
def create @sessionmap = Sessionmap.new(params[:sessionmap]) respond_to do |format| if @sessionmap.save format.html { redirect_to(@sessionmap, :notice => 'Sessionmap was successfully created.') } format.xml { render :xml => @sessionmap, :status => :created, :location => @sessionmap } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @sessionmap = Sessionmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sessionmap }\n end\n end", "def destroy\n @sessionmap = Sessionmap.find(params[:id])\n @sessionmap.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.60596037", "0.55908966", "0.55604297", "0.55485195", "0.54320043", "0.5351283", "0.5326423", "0.5317676", "0.53135157", "0.5311889", "0.527506", "0.5196097", "0.51195", "0.51117027", "0.5110362", "0.5077508", "0.50497335", "0.5033014", "0.5015768", "0.50114435", "0.4997574...
0.70837426
0
PUT /sessionmaps/1 PUT /sessionmaps/1.xml
def update @sessionmap = Sessionmap.find(params[:id]) respond_to do |format| if @sessionmap.update_attributes(params[:sessionmap]) format.html { redirect_to(@sessionmap, :notice => 'Sessionmap was successfully updated.') } format.xml { head :ok } else format.html { render :...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sessionmap = Sessionmap.new(params[:sessionmap])\n\n respond_to do |format|\n if @sessionmap.save\n format.html { redirect_to(@sessionmap, :notice => 'Sessionmap was successfully created.') }\n format.xml { render :xml => @sessionmap, :status => :created, :location => @sessi...
[ "0.6169609", "0.60438615", "0.57193255", "0.56842065", "0.56607085", "0.5523443", "0.5480771", "0.5444257", "0.543975", "0.5410012", "0.540192", "0.5373287", "0.53161", "0.5309158", "0.5307287", "0.52971137", "0.52606946", "0.5250882", "0.5249902", "0.52450657", "0.5226415", ...
0.6966434
0
DELETE /sessionmaps/1 DELETE /sessionmaps/1.xml
def destroy @sessionmap = Sessionmap.find(params[:id]) @sessionmap.destroy respond_to do |format| format.html { redirect_to(sessionmaps_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @map = Map.find_by_id(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to(maps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.68907243", "0.6878021", "0.6630331", "0.6628582", "0.6608467", "0.65740156", "0.6516092", "0.64764", "0.6466296", "0.6397468", "0.6374603", "0.63410234", "0.6326994", "0.6309033", "0.6308895", "0.6274484", "0.62737334", "0.62517154", "0.62487316", "0.62487316", "0.62461025...
0.77177507
0
GET /movements GET /movements.json
def index @movements = Movement.paginate(:page => params[:page], :per_page => 100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @movements = Movement.all\n end", "def index\n @movings = current_user.movings\n end", "def index\n @estimated_movements = current_user.estimated_movements.all\n end", "def index\n @title = t('view.movements.index_title')\n @searchable = true\n @movements = Movement.filtered_...
[ "0.70703644", "0.6397222", "0.63839823", "0.6350542", "0.6227863", "0.61211264", "0.60716325", "0.6032527", "0.5983693", "0.5939265", "0.583242", "0.5744724", "0.57368886", "0.5728232", "0.5699263", "0.56396675", "0.56396675", "0.5633425", "0.5631694", "0.5631039", "0.5631039...
0.653392
1
POST /movements POST /movements.json
def create @movement = Movement.new(movement_params) respond_to do |format| if @movement.save format.html { redirect_to @movement, notice: 'Movement was successfully created.' } format.json { render :show, status: :created, location: @movement } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n movement = @user.tracked_movements.build(movement_id: params[:movement_id], movement_count: 0)\n render json: { message: 'Successfully added!' }, status: :ok if movement.save\n end", "def create\n @title = t('view.movements.new_title')\n @movement = Movement.new(params[:movement])\n\n ...
[ "0.6838787", "0.6611175", "0.6548848", "0.6465177", "0.6294927", "0.62578416", "0.62433565", "0.61616284", "0.6132662", "0.6034538", "0.6010854", "0.6007442", "0.5996897", "0.5979901", "0.5949325", "0.59287745", "0.587335", "0.5865027", "0.58626", "0.58401656", "0.58397937", ...
0.67117435
1
sign_in method for ldap users
def sing_in_ldap(args) login = args[:login] password = args[:password] ldap = User.ldapCheckUser({login:login, password:password}) if ldap[:bind] == false render :json => { login: false , error:ldap[:error]} return else userObj = {login:login , user_type: :ldap} user = User.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_sign_in(user)\n login_as(user, scope: :user)\nend", "def signin\n return set_session_user_id!(nil, 'Введите email и пароль.') { render :signin_new } if params_valid?(:signin)\n ldap_result = LdapService.new.auth(params[:email], params[:password])\n return set_session_user_id!(nil, 'Нет такого ...
[ "0.8670327", "0.7722924", "0.71923625", "0.7147491", "0.70476323", "0.70384413", "0.7035726", "0.6967072", "0.6953587", "0.6948785", "0.6860299", "0.6838842", "0.6808775", "0.67848396", "0.6767865", "0.6763047", "0.67521584", "0.67260647", "0.6717666", "0.6703809", "0.6685038...
0.80585384
1
active admins are: project admins whose role in the circle is active. project roles have no status.
def active_admins admins.select {|admin| circle.has_active_user?(admin) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_admins\n admins.select { |admin| circle.has_active_user?(admin) }\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def project_administrators\n people_with_the_role(Seek::Roles::PROJECT_ADMINISTRATOR)\n end", "def administrators\n ...
[ "0.75752807", "0.71368486", "0.71368486", "0.7050921", "0.68689203", "0.6855", "0.67378825", "0.6674973", "0.66660595", "0.6611098", "0.6602323", "0.65443873", "0.652289", "0.6498207", "0.64920306", "0.64779204", "0.6474751", "0.6464726", "0.6463528", "0.64467674", "0.6444961...
0.75180185
1
GET /subsubtopics/new GET /subsubtopics/new.xml
def new @subsubtopic = Subsubtopic.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @subsubtopic } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @subtopic = Subtopic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subtopic }\n end\n end", "def create\n @subsubtopic = Subsubtopic.new(params[:subsubtopic])\n\n respond_to do |format|\n if @subsubtopic.save\n format.htm...
[ "0.7797988", "0.7484277", "0.7300521", "0.72917753", "0.71902585", "0.70737875", "0.69570744", "0.6850071", "0.67315656", "0.6728833", "0.67230445", "0.67230445", "0.67230445", "0.67230445", "0.67230445", "0.6721433", "0.67087585", "0.6665937", "0.66600174", "0.65651876", "0....
0.79892194
0
POST /subsubtopics POST /subsubtopics.xml
def create @subsubtopic = Subsubtopic.new(params[:subsubtopic]) respond_to do |format| if @subsubtopic.save format.html { redirect_to(@subsubtopic, :notice => 'Subsubtopic was successfully created.') } format.xml { render :xml => @subsubtopic, :status => :created, :location => @subsubtop...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @subtopic = Subtopic.new(subtopic_params)\n\n respond_to do |format|\n if @subtopic.save\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully created.' }\n format.json { render :show, status: :created, location: @subtopic }\n else\n format.html...
[ "0.6888794", "0.6832643", "0.68043643", "0.6755429", "0.6702252", "0.6646262", "0.6454873", "0.64391094", "0.63903534", "0.63509095", "0.633827", "0.63302517", "0.63163644", "0.61990434", "0.6183337", "0.6150802", "0.61274946", "0.6085961", "0.60808796", "0.6023372", "0.59990...
0.7002336
0
PUT /subsubtopics/1 PUT /subsubtopics/1.xml
def update @subsubtopic = Subsubtopic.find(params[:id]) respond_to do |format| if @subsubtopic.update_attributes(params[:subsubtopic]) format.html { redirect_to(@subsubtopic, :notice => 'Subsubtopic was successfully updated.') } format.xml { head :ok } else format.html { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @subtopic = Subtopic.find(params[:id])\n\n respond_to do |format|\n if @subtopic.update_attributes(params[:subtopic])\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren...
[ "0.7104667", "0.70530254", "0.70260215", "0.69477016", "0.6925343", "0.68640095", "0.6827833", "0.68055654", "0.65067244", "0.6501431", "0.6499182", "0.63959575", "0.6372083", "0.63505495", "0.6315058", "0.6266794", "0.62634677", "0.6262908", "0.62334245", "0.61849856", "0.61...
0.7314234
0
DELETE /subsubtopics/1 DELETE /subsubtopics/1.xml
def destroy @subsubtopic = Subsubtopic.find(params[:id]) @subsubtopic.destroy respond_to do |format| format.html { redirect_to(subsubtopics_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @subtopic = Subtopic.find(params[:id])\n @subtopic.destroy\n\n respond_to do |format|\n format.html { redirect_to subtopics_url }\n format.json { head :no_content }\n end\n end", "def delete_topic(org_unit_id, topic_id) # DELETE\n query_string = \"/d2l/api/le/#{$le_ver}/#{or...
[ "0.7394157", "0.71502274", "0.7127571", "0.7125351", "0.71163976", "0.6791174", "0.6637567", "0.6636265", "0.6624182", "0.66179633", "0.6589611", "0.65556246", "0.6528096", "0.6528096", "0.65103585", "0.64967424", "0.64206284", "0.64206284", "0.64206284", "0.64206284", "0.642...
0.77572185
0
=begin def almostwin(my_number, winning_num) correct_numbers = 0 if my_number[0] == winning_num[0] correct_numbers += 1 else 0 end if my_number[1]== winning_num[1] correct_numbers += 1 else 0 end if my_number[2] == winning_num[2] correct_numbers += 1 else 0 end if my_number[3] == winning_num[3] correct_numbers += 1 end...
def almostwin(my_number, winning_num) correct_numbers = 0 z = 0 winning_num.length.times do i = 0 winning_num.length.times do if my_number[z] == winning_num[i] correct_numbers += 1 end i += 1 end z += 1 end correct_numbers == winning_num.length - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_off?(win_number,my_number)\n\tmatches = 0\n\tif win_number[0] == my_number[0]\n\t\tmatches +=1\n\tend\n\tif win_number[1] == my_number[1]\n\t\tmatches +=1\n\tend\n\tif win_number[2] == my_number[2]\n\t\tmatches +=1\n\tend\n\tif win_number[3] == my_number[3]\n\t\tmatches +=1\n\tend\n\tif matches == 3\n\t\tt...
[ "0.78723437", "0.7556327", "0.7373882", "0.72405493", "0.72405493", "0.72221977", "0.72111714", "0.7182584", "0.71396214", "0.70661515", "0.7032836", "0.70252347", "0.70214885", "0.697304", "0.6970782", "0.69705623", "0.69555837", "0.69414604", "0.69390935", "0.6928839", "0.6...
0.9040325
0
Raise an exception in 5% of cases
def raise_unexpected_exception chance = 1 + rand(100) if chance <= 5 raise "Out of service!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception\n raise \"It's a bad one!\"\n end", "def random_error\n\t\tif rand(50) % 5 == 0\n\t\t\traise Exeption.new('Random Error!')\n\t\tend\n\tend", "def rescue_action(e); raise e; end", "def raise(exception); end", "def abort_on_exception=(*) end", "def abort_on_exception(*) end", "def rescu...
[ "0.7054521", "0.702837", "0.6926034", "0.6921391", "0.6853259", "0.68288124", "0.6769261", "0.6769261", "0.6769261", "0.6769261", "0.6729519", "0.67110455", "0.6628766", "0.6628766", "0.6628766", "0.6628766", "0.6628766", "0.65532696", "0.6436469", "0.64262587", "0.640038", ...
0.78008205
0
when the user is disconnected set their status to offline and their game_id to nil
def player_disconnected current_user.player.status = 'offline' game = current_user.game if game Player.where(game_id: game.id).update_all(game_id: nil) # current_user.game.destroy no longer need to destroy game current_user.game.update_attributes(status: 'ended') unless game.status == 'end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_disconnected\n puts \"client #{current_user.email} disconnected\"\n current_player = current_user.player\n broadcast_message :player_exit, {\n id: current_player.id\n }\n current_player.is_online = false\n current_player.save\n end", "def offline()\n set_status(\"O...
[ "0.7054818", "0.6923736", "0.6418603", "0.6271375", "0.621038", "0.61983186", "0.6140055", "0.607872", "0.5923364", "0.58664507", "0.58370674", "0.58226466", "0.57632357", "0.5735538", "0.5677153", "0.5642099", "0.5629767", "0.561748", "0.5611118", "0.56027025", "0.5591779", ...
0.8151434
0
Public: Payment form url that includes a session token. Returns a url.
def payment_form_url "#{host}/form/#{session_token}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_redirection_url(token = nil)\n self.endpoint_url_with_token(:pay, token)\n end", "def form_url\n URL\n end", "def login_url(params, session)\n req_token = get_request_token\n session[:request_token] = req_token.token\n session[:request_token_secret] ...
[ "0.7104019", "0.6545954", "0.653317", "0.63185483", "0.62479264", "0.6203274", "0.6202808", "0.6181576", "0.61262304", "0.60545766", "0.602964", "0.6002258", "0.5895567", "0.58511597", "0.5847443", "0.5844465", "0.58227116", "0.5778756", "0.57464546", "0.57333565", "0.5727294...
0.8825976
0
Public: Request to update a session token with card data. Returns a response object.
def update_session_with_card(token, card) source_of_funds_params = ActiveSupport::OrderedHash.new source_of_funds_params['type'] = 'CARD' source_of_funds_params['provided'] = {'card' => card} params = {'sourceOfFunds' => source_of_funds_params} UpdateSessionResponse.new(request(:put, "/me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_session\n auth = Knock::AuthToken.new(payload: to_token_payload)\n auth.token\n end", "def update\n if @session\n @session.update_session(marshalize(@data))\n end\n end", "def update\n\n if params[:sk] != 'foeiuh9q28734gfa9w8hfg92830rq892g0oaw8hf'\n return\n else\n\n ...
[ "0.644488", "0.6057516", "0.5882051", "0.58159065", "0.57424533", "0.5739841", "0.5715025", "0.57147384", "0.5643073", "0.56390244", "0.5637907", "0.5553238", "0.5512444", "0.5485209", "0.5476646", "0.5454054", "0.5446024", "0.5446024", "0.5446024", "0.5446024", "0.5443692", ...
0.72066426
0
Public: Request to check a cardholder's enrollment in the 3DSecure scheme. Returns a Response object.
def check_enrollment transaction, token, postback_url redirect_params = ActiveSupport::OrderedHash.new redirect_params['pageGenerationMode'] = 'CUSTOMIZED' redirect_params['responseUrl'] = postback_url order_params = ActiveSupport::OrderedHash.new order_params['amount'] = transaction.amoun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buyer_auth_result\n params['3DSecureStatus']\n end", "def check(options = {})\n @options = options\n\n request_params = {\n card6: encrypt(:card6)\n }\n\n response = post(\n Flutterwave::Utils::Constants::BIN[:check_url],\n request_params\n )\...
[ "0.57489115", "0.55067784", "0.5496787", "0.5463756", "0.53353477", "0.5224935", "0.5197136", "0.515235", "0.50406796", "0.49820945", "0.497392", "0.49428937", "0.49099663", "0.48858887", "0.48842296", "0.483091", "0.4825599", "0.4823897", "0.48221415", "0.48208335", "0.47989...
0.6346532
0
Edits a routed item. The routed_item.id must be not nil and > 0.
def routed_item_update(routed_item) raise Client::FileboundClientException.new('Id is required', 0) unless routed_item[:id].greater_than_zero? post("/routeditems/#{routed_item[:id]}", nil, routed_item) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end", "def update\n @item = NavItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(extract_item(params))\n format.html { redirect_to nav_items_...
[ "0.6277456", "0.6224928", "0.6132966", "0.61016345", "0.60715646", "0.6045968", "0.6027078", "0.6015194", "0.5999502", "0.59916204", "0.59660435", "0.59629124", "0.5955636", "0.59457797", "0.59394675", "0.5936767", "0.59351015", "0.5930975", "0.5900531", "0.5886508", "0.58764...
0.7929177
0
Completes the current step for the routed item. The routed_item.id must be not nil and > 0.
def routed_item_complete_step(routed_item_id, step_number:, step_caption:, comment:, due_date:, user_id:, checklist_data:, route_step_id:, route_step_task_id:) raise Client::FileboundClientException.new('Id is required', 0) unless routed_item_id.greater_than_zero? par...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete(item, force_history=1)\n args = {id: item.id, force_history: force_history}\n return @client.api_helper.command(args, \"item_complete\")\n end", "def completed?(item = nil)\n # noinspection RubyMismatchedArgumentType\n super(item || self)\n end", "def complete...
[ "0.5889127", "0.58362585", "0.5766459", "0.5674953", "0.5659011", "0.5606032", "0.5591135", "0.5564385", "0.55349594", "0.5528424", "0.54746103", "0.5471812", "0.540578", "0.5365274", "0.53426594", "0.5305933", "0.53025985", "0.5295604", "0.5285971", "0.52781594", "0.5270162"...
0.7280976
0
Returns project's uncompleted items
def uncompleted_items new? ? Array.new : Item.uncompleted(@id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_not_completed_items\n return @to_do_item.select { |x| x.is_done? == false }\n end", "def uncompleted\n if params.has_key?(:project_id) && is_numeric?(params[:project_id]) && params[:project_id] != '0'\n work_orders = WorkOrder.uncompleted(params[:project_id])\n else\n work_or...
[ "0.7432515", "0.7097166", "0.68416256", "0.6790518", "0.672019", "0.6715441", "0.6679098", "0.6647146", "0.66034317", "0.6527095", "0.6506177", "0.6474964", "0.64156437", "0.6412358", "0.63760597", "0.62860984", "0.61840665", "0.61798906", "0.6177492", "0.6171407", "0.616968"...
0.76203585
0
getApplications(ak) curl X GET ' \H 'XApiKey:83e1c51dd6d9e3a3a608b52d733892db0e9bd9a6d18bd0c' i
def getApplications(ak) uri='https://api.newrelic.com/v2/applications.json' parseUrl=URI.parse(uri) host=parseUrl.host path=parseUrl.path getRequest(ak,uri,host,path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_applications\n http_get_request(Scalarium.applications_url)\n end", "def applications_list\n get \"applications\"\n end", "def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.d...
[ "0.7486555", "0.7099241", "0.69715464", "0.69179386", "0.68284464", "0.6662762", "0.6566568", "0.6524199", "0.6506709", "0.65015197", "0.63985676", "0.6331126", "0.62698", "0.6267192", "0.6097081", "0.60402673", "0.60402673", "0.6040205", "0.6034005", "0.60037243", "0.5882461...
0.76455027
0
Log on a user and set cookies and session etc.
def log_on_user(user, _session, cookies) unless user.auth_token && user.auth_token.length == 32 user.auth_token = SecureRandom.hex(16) user.save! end cookies.permanent[TOKEN_COOKIE] = { value: user.auth_token, httponly: true } make_developer_admin(user) @env[CURRENT_USER_KE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end", "def log_on_user(user, session, cookies)\n cookies.permanent[TOKEN_COOKIE] = { value: user.id, httponly: true }\n @env[CURRENT_USER...
[ "0.7525858", "0.75247556", "0.7429393", "0.74120283", "0.7367298", "0.73176366", "0.731018", "0.7231301", "0.72177994", "0.7202731", "0.7197756", "0.7157348", "0.7155052", "0.71456635", "0.7145151", "0.71414906", "0.7137181", "0.71272194", "0.7122742", "0.7118492", "0.7118426...
0.75451064
0
When requesting a part, the content store will return a content item with a base path that's different to the one requested. That content item contains all the parts for that document.
def requesting_a_part? parts.any? && requested_content_item_path && requested_content_item_path != base_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_for(part_slug)\n part_with_slug(part_slug).try(:body)\n end", "def path_part(part)\n @_path_parts ||= Blog::UriTemplates.extract_params(blog_data.source_template, path)\n @_path_parts[part.to_s]\n end", "def fetch_page_part(name, part, options = {})\n fetch('/page/%s/%...
[ "0.65073925", "0.61904913", "0.6114704", "0.6090976", "0.6080847", "0.59525025", "0.58820605", "0.5873419", "0.5861714", "0.58049357", "0.57851434", "0.57618785", "0.5709417", "0.5684447", "0.5684447", "0.5676998", "0.56512636", "0.56211406", "0.5611894", "0.5609021", "0.5535...
0.62170583
1
Invalid locations contain problem_cause xml tag
def valid? @xml.xpath('//weather/problem_cause').size == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_check\n begin\n raise CompulsoryElementMissingException.new('location', source_name) if @doc.root.nil? \n raise CompulsoryElementMissingException.new('blocks', source_name) if @doc.root.elements['blocks'].nil?\n rescue => ex\n @log.error \"Incomplete location data found i...
[ "0.5743629", "0.5671295", "0.5671295", "0.5671295", "0.5671295", "0.56551737", "0.56430966", "0.5489218", "0.534174", "0.53415674", "0.52949053", "0.52099276", "0.51914173", "0.5178975", "0.5146641", "0.51294065", "0.51200616", "0.5117463", "0.5117463", "0.5107641", "0.510631...
0.5845748
0
A hash of step names as symbols to numeric indices, with age: 0, name: 1 etc
def step_indices @step_indices ||= step_keys.each_with_index.map { |step, index| [step, index] }.to_h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step_names\n hash = raw_step_names\n hash = Hash[ hash.map{ |k,v| [ k, ( ft.steps[ k ] | v ).to_s ] } ] if r18n\n hash\n end", "def steps(steps)\n @step_lengths = steps.map {|keyword, name| (keyword+name).unpack(\"U*\").length}\n @max_step_length = @step_lengths.max\n @...
[ "0.6810825", "0.60222185", "0.60222185", "0.6005973", "0.5803326", "0.57089174", "0.57074434", "0.56722444", "0.5550875", "0.55236953", "0.5506759", "0.5506759", "0.5495842", "0.54874337", "0.5480048", "0.547288", "0.54725486", "0.5470991", "0.54673904", "0.5416791", "0.54111...
0.74623215
1
Will scan the tool_tuples attribute and create a processing chain. Tools will be instantiated and wrap each other, starting with the first one
def wrap_output_with_tools(output) return output unless (tool_tuples && tool_tuples.any?) tool_tuples.reverse.inject(output) do | wrapped, (tool_name, options) | Tracksperanto.get_tool(tool_name).new(wrapped, options || {}) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_chain\n chain = []\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@primary_output)\n chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@secondary_output)\n\n chain << reassignment_processor(@secondary_output)\n\n chain <<\n if @primary_output.new_name_stat...
[ "0.5926514", "0.57938814", "0.5488573", "0.5484489", "0.5343638", "0.5315538", "0.5223903", "0.5223903", "0.5217745", "0.51617754", "0.5092089", "0.5079768", "0.5078626", "0.5058629", "0.5057099", "0.504436", "0.5019657", "0.4996847", "0.49380687", "0.4905074", "0.48939773", ...
0.5998691
0
Runs the export and returns the number of points and keyframes processed. If a block is passed, the block will receive the percent complete and the last status message that you can pass back to the UI
def run_export(tracker_data_io, importer, exporter) points, keyframes, percent_complete = 0, 0, 0.0 last_reported_percentage = 0.0 report_progress(percent_complete, "Starting the parser") progress_lambda = lambda do | m | last_reported_percentage = percent_complete report_progress(perc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute &block\n super &block\n\n last_progress = 0\n last_progress_at = Time.new.to_f\n stdout.match PROGRESS_REGEXP, match: :last, in: :output do |file, total_bytes, percentage|\n progress = total_bytes.gsub(/[^\\d]/,'').to_i\n progress_at = Time.new.to_f\n ...
[ "0.6191172", "0.55129313", "0.5499929", "0.5485809", "0.5485809", "0.5485809", "0.5485809", "0.5485809", "0.5467719", "0.54486424", "0.5435763", "0.5412872", "0.52895385", "0.525194", "0.5228285", "0.5211814", "0.5205901", "0.5205901", "0.5205901", "0.5205901", "0.5168408", ...
0.5627705
1
Vault supports multiple instances of the 'ldap' backend mounted concurrently. The mapreducey method repo_files gets the list of ldap mounts, calls group_files() once for each of the mounts, then concatenates all those filenames into one big flat array
def repo_files @vault.sys.auths.select { |_,v| v.type == 'ldap' } .keys .inject([]) { |acc, elem| acc + group_files(elem) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'approle' }\n .keys\n .inject([]) { |acc, elem| acc + role_files(elem) }\n end", "def mount_files\n Dir.glob('proc/*', base: mountpoint)\n end", "def sync_many_files(files, user, api)\n files.group_by(&:project).each ...
[ "0.60092527", "0.57745236", "0.5763341", "0.5712711", "0.56103563", "0.5530165", "0.54679054", "0.54623634", "0.5402092", "0.5389479", "0.53568405", "0.5347382", "0.5267728", "0.52553993", "0.52485967", "0.52424926", "0.5211678", "0.51975256", "0.51624954", "0.51572335", "0.5...
0.78722405
0
Invokes an asynchronous system call
def async_system(cmd, timeout = 10, &callback) deferrable = EM::DefaultDeferrable.new EM.system cmd do |output, status| deferrable.succeed(output, status) end deferrable.timeout timeout deferrable.errback { } deferrable.callback(&callback) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call\n\t\t\t\tAsync do\n\t\t\t\t\tendpoint.connect do |socket|\n\t\t\t\t\t\tstream = Async::IO::Stream.new(socket)\n\t\t\t\t\t\t\n\t\t\t\t\t\t@command.call(stream)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def call\n return if @closed\n error = check_result ::Libuv::Ext.async_send(handl...
[ "0.6648453", "0.62956107", "0.6135422", "0.61279017", "0.60818624", "0.6045661", "0.5944606", "0.5829602", "0.5810424", "0.57792234", "0.57792234", "0.57653755", "0.5740554", "0.5734058", "0.5706528", "0.5688469", "0.567069", "0.56525993", "0.5645301", "0.56318396", "0.562199...
0.67388034
0
and the second is the first number of a sequence that your method will create. The method should return an Array that contains the same number of elements as the count argument, while the values of each element will be multiples of the starting number. You may assume that the count argument will always have a value of ...
def sequence(count, starting_num) result_arr = [] 1.upto(count) { |num| result_arr << starting_num * num } result_arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence(count, start_number)\n array = []\n count.times { |i| array << (start_number * (i + 1)) }\n array\nend", "def sequence(count, start)\n return [] if count == 0 \n sequence_array = []\n iterator = 1\n count.times do\n sequence_array << start * iterator \n iterator += 1 \n end \n seque...
[ "0.8109375", "0.79827297", "0.79295975", "0.78991055", "0.7849414", "0.7841752", "0.78318375", "0.78218216", "0.7813404", "0.7753074", "0.77199364", "0.76772505", "0.76490456", "0.7570937", "0.75497496", "0.754062", "0.7537206", "0.75160193", "0.7464018", "0.74617815", "0.745...
0.82579786
0
You need a YAML file config/ftp_accounts.yml with given structure your_account_name: host: your_host login: your_login password: your_password
def initialize(account_name) begin config = YAML::load(File.open("#{RAILS_ROOT}/config/ftp_accounts.yml")) @ftp = Net::FTP.new(config[account_name]["host"]) @ftp.login(config[account_name]["login"],config[account_name]["password"]) RAILS_DEFAULT_LOGGER.info "You have been succesfully connect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_with_conf_file(file='~/.googlecalendar4ruby/google.yaml')\r\n path = File.expand_path(file)\r\n if(File.exists?(path))\r\n File.open(path) { |f| @yaml = YAML::load(f) }\r\n else\r\n GData::create_conf_file('REPLACE_WITH_YOUR_MAIL@gmail.com', 'REPLACE_WITH_YOUR_PASSWORD')\r\n ...
[ "0.6120622", "0.5787526", "0.56921965", "0.5679512", "0.5658179", "0.56581527", "0.5610557", "0.557587", "0.55707127", "0.55374986", "0.55266035", "0.5483969", "0.5476627", "0.54652953", "0.5440516", "0.54399246", "0.5413938", "0.53767246", "0.5364998", "0.535993", "0.5358389...
0.698216
0
put local file to server, remotefile is optional (it specify the name of sending file on the server) return true if execute correctly send_file("C:\Clawfinger.mp3") send_file("C:\Clawfinger.mp3", "mp3\Clawfinger77.mp3")
def send_file(file, remotefile = File.basename(file)) begin @ftp.putbinaryfile(file, remotefile) return true rescue Exception => e error_message(e) return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_file(remote_filepath, remote_filename, local_filedata = null)\r\n magic_code = \"\\xdd\\xdd\"\r\n opcode = [6].pack('L')\r\n\r\n # We create the filepath for the upload, for execution it should be \\windows\\system32\\wbem\\mof\\<file with extension mof!\r\n file = \"..\\\\..\\\\\" << remote...
[ "0.7152208", "0.7146012", "0.7134222", "0.6975144", "0.69694924", "0.6879323", "0.6730845", "0.66503704", "0.6629176", "0.66226095", "0.65980214", "0.6584351", "0.65803623", "0.65308034", "0.65307134", "0.65057075", "0.648795", "0.6448024", "0.6393143", "0.6390966", "0.637410...
0.8360103
0
sending string to remote file on server send_text("text text text text text", "file.txt")
def send_text(text, remotefile) begin @ftp.put_text(text, remotefile) return true rescue return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send( text )\n checkConnection()\n @conn.write( text + EOL )\n end", "def send_file(path); end", "def send_text(text)\n client.api.send_message(id, text)\n end", "def ssh_send_file_ruby(host, username, comma...
[ "0.7388486", "0.7388486", "0.712602", "0.68351626", "0.67916757", "0.6680718", "0.66696113", "0.66672987", "0.6654049", "0.66049016", "0.656812", "0.6553849", "0.6476732", "0.6468197", "0.64360356", "0.6410375", "0.64022344", "0.63922507", "0.63757306", "0.6324644", "0.630041...
0.7917899
0
get file from a server return true if execute correctly retrieve_file("Clawfinger.mp3")
def retrieve_file(file) begin @ftp.getbinaryfile(file) return true rescue Exception => e error_message(e) return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(filename)\n begin\n out = @client.get_file(\"#{filename}\")\n rescue DropboxError\n return false\n end\n ProcessLayer.write_data(filename,out) #returns true/false\n end", "def on_a_fort\n fort_response = Net::HTTP.get_response(URI('http://files.fort/'))\n fort_response.is_a?(Net:...
[ "0.69234467", "0.6591652", "0.6469963", "0.64160943", "0.6393491", "0.6296927", "0.62897825", "0.62863636", "0.6283183", "0.6201409", "0.6143005", "0.61149096", "0.6101552", "0.60357034", "0.60132235", "0.60002565", "0.59859884", "0.59732777", "0.5903463", "0.5901457", "0.589...
0.72482634
0
delete file from a server return true if execute correctly remove_file("readme.txt")
def remove_file(file) begin @ftp.delete(file) return true rescue Exception => e error_message(e) return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end", "def delete_file( path )\n # removes a file at path\n connection.delete( path )\n las...
[ "0.79427993", "0.7724883", "0.757414", "0.7455487", "0.73223746", "0.72456753", "0.722807", "0.72156835", "0.7203945", "0.7203945", "0.72035927", "0.71975064", "0.7194774", "0.71838844", "0.7173796", "0.7173796", "0.71485245", "0.7072025", "0.69617933", "0.69137573", "0.68903...
0.783429
1
Use this method to close the websocket connection cleanly This sends a close frame and waits for acknowlegement before closing the connection
def close_websocket if @handler @handler.close_websocket else # The handshake hasn't completed - should be safe to terminate close_connection end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_close(env)\n @subscription.delete if @subscription\n logger.debug \"WebSocket closing connection\"\n end", "def close\n info { \"closing connection\" }\n socket.shutdown\n end", "def close\n conn.write(\"(api-quit)\") if connected?\n rescue Errno::ECONNR...
[ "0.74234647", "0.7316328", "0.7297016", "0.7296042", "0.7199143", "0.7057333", "0.7052621", "0.7014734", "0.7009993", "0.6970834", "0.6957389", "0.6936035", "0.6915914", "0.6893253", "0.6890349", "0.688963", "0.688963", "0.6887821", "0.6809477", "0.6801576", "0.67573786", "...
0.816555
0
Create a HTTP/GET request and retrieve its content Params: uri > URI which the request is going to be made Return: Either the body of the request or nil (if the request doesn't succeed)
def make_get_request(uri) response = Net::HTTP.get_response(uri) response.is_a?(Net::HTTPSuccess) ? response.body : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end", "def get(uri)\n req = requestor(Net::HTTP::Get.new(build_uri(uri)))\n parse req.body\n end", "def http_get uri\n http_req = Net::HTTP::Get.new uri\n http_resp = http_req_with_digest_auth http_req\n case http_res...
[ "0.7665226", "0.7633815", "0.7570545", "0.75094163", "0.7506994", "0.73925525", "0.738974", "0.7353164", "0.7349671", "0.7340801", "0.7296707", "0.7288568", "0.7258317", "0.72399205", "0.7193483", "0.7188189", "0.7179653", "0.7172773", "0.7139483", "0.7094586", "0.7093688", ...
0.7974786
0
Filters Section which defines generic filters Create a function which filter an item by a certain value for a given field Params: item > a hash containing one or more fields => field > a field at the given item => value > a value to be filtered Return: True if the given item holds the given field and value and False ot...
def filter_item_by_type(item, field, value) item[field] == value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_for(item)\n self.class.filter_for filter, item\n end", "def filter(field, value)\n @filters << [field, value]\n @loaded = false\n self\n end", "def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_...
[ "0.6424133", "0.6305096", "0.6247896", "0.61222523", "0.6116775", "0.607419", "0.6068666", "0.60470444", "0.60433596", "0.5956689", "0.59256566", "0.5924444", "0.5879482", "0.5879482", "0.58451676", "0.58390844", "0.5812665", "0.58067405", "0.5803932", "0.5800382", "0.5786059...
0.7353548
0
Products Section which use functions defined above for retrieving products from shopicruit.myshopify.com Retrive all products from shopicruit.myshopify.com Strategy: Make several requests to 'SHOPICRUIT_URL' increasing the 'page' to be retrived => at each request. When no more products is returned, return products => r...
def all_products params = { page: 0 } products = [] loop do params[:page] += 1 uri = create_uri(SHOPICRUIT_URL, params) response_body = make_get_request(uri) current_products = response_body.nil? ? [] : JSON.parse(response_body)[PRODUCTS_FIELD] product...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_products\n\n\t@parsed_products_array = []\n\n\tshopify_products = HTTParty.get(\"https://roquetest.myshopify.com/admin/products.json\", :headers => ShopifyHeaders).parsed_response\n\n\tshopify_products['products'].each do |product|\n\t\ttitle \t\t= product['title']\n\t\tprice \t\t= product['variants'][...
[ "0.73853767", "0.71826416", "0.71496516", "0.71226853", "0.70298856", "0.6984796", "0.69685954", "0.69324625", "0.6831648", "0.680049", "0.6711451", "0.67101806", "0.6699783", "0.66881496", "0.6646567", "0.6639423", "0.6639383", "0.6630656", "0.66301423", "0.6625518", "0.6614...
0.84421265
0
Retrive all products from shopicruit.myshopify.com holding a given type Params: type > type of the desired product Return: List containing all products at shopicruit.myshopify.com holding a given type
def products_by_type(type) all_products.select { |product| filter_item_by_type(product, TARGET_PRODUCT_FIELD, type) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend", "def all_products\n params = { page: 0 }\n products = []\n loop do\n params[:page] += 1\n uri = create_uri(SHOPICRUIT_URL, params)\n response_body = make_get_request(uri...
[ "0.7109542", "0.69273025", "0.6893535", "0.68022174", "0.6626619", "0.6581193", "0.65008897", "0.64074486", "0.63904417", "0.6388037", "0.63858503", "0.636523", "0.63592494", "0.6345976", "0.63352793", "0.6334043", "0.6272097", "0.6232971", "0.62049425", "0.61777574", "0.6176...
0.73574275
0
Calculate the sum of the prices for a list of products (considering its variants) Params: products > list containg products from a certain Shopify store Return: Total price for the given products with 2 decimals
def sum_prices(products) sum = 0.0 products.each do |product| product[VARIANTS_FIELD].each do |variant_product| sum += variant_product[PRICE_VARIANT_FIELD].to_f end end sum.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total\n add_products = 0\n @products.each_value do |cost|\n add_products += cost\n end\n total = (add_products + (add_products * 0.075)).round(2)\n return total\n end", "def total\n product_total = 0\n subtotal = 0\n @products.each_value do |prices|\n ...
[ "0.7816993", "0.77743876", "0.77358043", "0.7729797", "0.76632214", "0.7568358", "0.7522011", "0.7496383", "0.74753964", "0.7457382", "0.73315644", "0.7322671", "0.7315637", "0.728393", "0.72800624", "0.7271885", "0.7227666", "0.7209905", "0.71898836", "0.7119148", "0.705808"...
0.83650565
0
GET List nearby restaurants /api/v1/postions/:id/nearby
def nearby # Check the parameters if params[:long].present? && params[:lat].present? # using the parameters and offset/limit nearby_positions = Position.near([params[:lat].to_f, params[:long].to_f], 30).limit(@limit).offset(@offset) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n nearby_places_finder = NearbyPlaces.new(nearby_places_params)\n\n expose nearby_places_finder.call,\n each_serializer: NearbyRestaurantSerializer\n end", "def nearby\n # Check the parameters\n if params[:long].present? && params[:lat].present?\n # using the p...
[ "0.7252567", "0.7031731", "0.69686687", "0.69425535", "0.69399786", "0.6827936", "0.66480047", "0.66369766", "0.6580604", "0.64915985", "0.6299225", "0.6247257", "0.61718816", "0.61452496", "0.6131735", "0.6119951", "0.6118983", "0.61185753", "0.60814303", "0.60630375", "0.60...
0.71168095
1
If the line starts with A2P, call to_phonetic on the rest of the substring If the line starts with P2A, call from_phonetic on the rest of the substring Otherwise, return nothing.
def translate(line) if line[0,3] == "A2P" return to_phonetic(line[4,line.length]) end if line[0,3] == "P2A" return from_phonetic(line[4,line.length]) end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(line)\n if line[0, 3].upcase == \"A2P\"\n return to_phonetic(line[4..-1])\n elsif line[0, 3].upcase == \"P2A\"\n return from_phonetic(line[4..-1])\n end\n end", "def test_p2a_not_found\n alpha = \"FOXMART ALFA INDIGO LARGE\"\n assert_raise(RuntimeError) { Phonetic.from_pho...
[ "0.7655879", "0.5598595", "0.5291493", "0.52650476", "0.51614344", "0.50974816", "0.50847757", "0.5025574", "0.5023446", "0.50202227", "0.5014346", "0.5013366", "0.5004753", "0.49835584", "0.4968227", "0.49676386", "0.4920628", "0.48974922", "0.48825216", "0.4792645", "0.4787...
0.73833066
1
GET /course_informations GET /course_informations.json
def index @course_informations = CourseInformation.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def show_course\n\t\t@course = Course.find(params[:course_id])\n\t\trender json: @course\n\tend", "def show\n @course = Course.find(params[:id])\n \n respond_to do |...
[ "0.6649561", "0.65894735", "0.65879023", "0.65752655", "0.65527946", "0.65527946", "0.65527946", "0.65527946", "0.65527946", "0.65527946", "0.65469587", "0.65194225", "0.6519266", "0.64872986", "0.6477898", "0.6471258", "0.6468967", "0.6468403", "0.64429164", "0.64290863", "0...
0.7418955
0
DELETE /course_informations/1 DELETE /course_informations/1.json
def destroy @course_information.destroy respond_to do |format| format.html { redirect_to course_informations_url, notice: 'Course information was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @study_course = StudyCourse.find(params[:id])\n @study_course.destroy\n\n respond_to do |format|\n format.html { redirect_to study_courses_url }\n format.json { head :no_content }\n end\n end", "def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses...
[ "0.74015987", "0.737366", "0.7338987", "0.7321867", "0.7321867", "0.7321867", "0.7321867", "0.7315654", "0.73010623", "0.7297001", "0.7295453", "0.72849345", "0.72789174", "0.7278082", "0.72736394", "0.727199", "0.7271942", "0.7271942", "0.7271942", "0.7271942", "0.7271942", ...
0.75158757
0
Public: create_new_event Creates a new event for the DinnerClub Parameters: date String: date of the event restaurant String: restaurant where the club went to eat attendees Array of names (strings) of those who attended the event Returns: Prints array of attendees State Changes: None?
def create_new_event(date, restaurant, *attendees) @restaurant = restaurant @date = date # @event_list << [date, restaurant, amount] @attendees = Array.new #array to determine # of attendees attendees.each {|attendee| @attendees.push(attendee)} puts @attendees end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_event\n @event = Event.new\n @event.name = params[\"event_name\"]\n# @event.random_number = rand(100000)\n @event.date_of_event = params[\"event_date\"]\n @event.quote_message = Florist.find(session[\"found_florist_id\"]).quote_message_default\n @event.show_product_image = Florist....
[ "0.64360106", "0.6346901", "0.6319498", "0.6311285", "0.6159218", "0.60507274", "0.6018164", "0.6012114", "0.59831023", "0.5958144", "0.5939606", "0.59121335", "0.5892875", "0.58858895", "0.5883244", "0.58435607", "0.5811258", "0.580712", "0.58008534", "0.57948923", "0.578180...
0.7770339
0
Public: reconcile Uses CheckSplitter to determine the amount each person paid at this event Not sure how to enter this info since it calls another method?? Parameters: amt Integer: total amount of the bill from that event tip Integer: percent amount of the tip to be added to bill Returns: Nothing State Changes: None?
def reconcile(amt, tip) cs = CheckSplitter.new(attendees.length, amt, tip) pay_each_person = cs.pay_each_person attendees.each do |attendee| if @members[attendee] += pay_each_person else @members[attendee] = pay_each_person end end @members end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upd_running_totals(eventobj_name, event_check)\n if eventobj_name.treat\n @member_list[eventobj_name.treater].spend(event_check.total_bill)\n else\n eventobj_name.attendees.each { |a| @member_list[a].spend(event_check.per_person) }\n end\n end", "def add_check(total_cost, tip_percentage, ...
[ "0.61304027", "0.6018444", "0.600142", "0.57862586", "0.57470316", "0.57293", "0.57124573", "0.5668283", "0.5652267", "0.5641363", "0.56147295", "0.56069607", "0.5590365", "0.5587381", "0.5568144", "0.55388224", "0.55306673", "0.5496338", "0.5492309", "0.548527", "0.5482966",...
0.72554636
0
GET /internships/new GET /internships/new.json
def new @internship = Internship.new respond_to do |format| format.html # new.html.erb format.json { render json: @internship } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n if User.find(current_user.id).internship_authorization\n @internship = Internship.new\n respond_with(@internship)\n else\n flash[:notice] = \"You cannot create an internship\"\n redirect_to internships_url\n end\n end", "def new\n @internships_user = InternshipsUser.new...
[ "0.73464817", "0.71812993", "0.7029488", "0.69440657", "0.68487215", "0.6460255", "0.64570826", "0.6435727", "0.63888514", "0.6385345", "0.635009", "0.62826055", "0.6274469", "0.6244698", "0.619223", "0.616728", "0.616728", "0.61654985", "0.6136817", "0.6097551", "0.607388", ...
0.7489758
0
POST /internships POST /internships.json
def create @user = current_user @internship = @user.internships.build(params[:internship]) #@internship = Internship.new(params[:internship]) respond_to do |format| if @internship.save format.html { redirect_to @internship, notice: 'Internship was successfully created.' } format.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @internship = Internship.new(params[:internship])\n\n respond_to do |format|\n if @internship.save\n format.html { redirect_to @internship, notice: 'Internship was successfully created.' }\n format.json { render json: @internship, status: :created, location: @internship }\n ...
[ "0.71153027", "0.66901726", "0.6650743", "0.62748814", "0.61222106", "0.603316", "0.5962649", "0.5962649", "0.5857447", "0.58462054", "0.5833745", "0.5826254", "0.5741983", "0.57402045", "0.5725223", "0.5559854", "0.5483532", "0.54183525", "0.5410799", "0.5371768", "0.5342862...
0.73136044
0
PUT /internships/1 PUT /internships/1.json
def update @internship = Internship.find(params[:id]) respond_to do |format| if @internship.update_attributes(params[:internship]) format.html { redirect_to @internship, notice: 'Internship was successfully updated.' } format.json { head :no_content } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @internship = Internship.find(params[:id])\n\n if @internship.update_attributes(params[:internship])\n flash[:notice] = 'Internship was successfully updated.'\n end\n respond_with(@internship)\n end", "def update\n @internship = Internship.find(params[:id])\n respond_to do |f...
[ "0.67898536", "0.6564102", "0.6362706", "0.63572764", "0.6338132", "0.62355536", "0.6099583", "0.5964067", "0.57670724", "0.576195", "0.57573897", "0.57526064", "0.57436526", "0.5684591", "0.56517744", "0.5623222", "0.5623222", "0.5623222", "0.55432534", "0.54426694", "0.5334...
0.68532103
0
DELETE /internships/1 DELETE /internships/1.json
def destroy @internship = Internship.find(params[:id]) @internship.destroy respond_to do |format| format.html { redirect_to internships_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n respond_to do |format|\n format.html { redirect_to(internships_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @internship = Internship.find(params[:id])\n @internship.destroy\n\n re...
[ "0.78926134", "0.753798", "0.73089916", "0.71876377", "0.71622175", "0.7070037", "0.7040963", "0.69185615", "0.67246455", "0.66779965", "0.66556656", "0.65719885", "0.65703154", "0.6560641", "0.6546843", "0.6546843", "0.65217316", "0.6462253", "0.6432093", "0.64294034", "0.64...
0.78997415
0
give an estimated period before next payment
def time_before_next_payment delay = payment_frequency[:days] withdrawls = sort_operations_desc # next_payment_date = operations.last.date + delay.days next_payment_date = withdrawls.first.date + delay.days distance_of_time_in_words(Date.today, next_payment_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_service_billing_period\n if self.purchase_order && self.purchase_order.recurring? && self.purchase_order.pending?\n payment = self.purchase_order.payments.recurring.find(:all, :order => \"payments.id ASC\").last\n (self.service_period_end_on + 1.day)..(self.service_period_end_on + (payment.in...
[ "0.65286493", "0.6390781", "0.62860876", "0.62228036", "0.61794126", "0.6174933", "0.61740136", "0.61170244", "0.6041089", "0.6024", "0.6012808", "0.59503263", "0.59479034", "0.59444505", "0.59385186", "0.5936397", "0.59277916", "0.59191006", "0.58928335", "0.58885443", "0.58...
0.6982514
0
I should add this somewhere else, no? ToDo fetch the three countries and their respective data, store in cache, serve!
def initialize countries.each do |country| Rails.cache.fetch(country[:code]) do JSON.parse(Net::HTTP.get(URI.parse("https://api.fitpass.mx/v3/cities.json?country=#{country[:code]}"))) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_country_data(code)\n if cache_data?\n return @@cached_data[code] if @@cached_data[code]\n end\n\n json = File.read(path_for_country(code))\n country_data = MultiJson.load(json)\n\n if cache_data?\n @@cached_data[code] = country_data\n end\n\n country_data\n...
[ "0.67863107", "0.6679814", "0.66689897", "0.66314614", "0.6476419", "0.6444909", "0.63974655", "0.6371296", "0.63672686", "0.6351487", "0.6350069", "0.6335585", "0.63307714", "0.6245263", "0.6238902", "0.62279135", "0.6213083", "0.6168606", "0.61488163", "0.6117082", "0.61108...
0.7514509
0
GET /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/1 GET /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/1.xml
def show @loaderio_7abd2d23994e8fb4f6f945f20b5204db = Loaderio7abd2d23994e8fb4f6f945f20b5204db.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @loaderio_7abd2d23994e8fb4f6f945f20b5204db } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_dbs\n @conn.query({url_path: \"_all_dbs\", method: :get})\n end", "def databases\n CouchRest.get \"#{@uri}/_all_dbs\"\n end", "def restGetMetaInformation()\n printDebugMessage('restGetMetaInformation', 'Begin', 11)\n url = \"#{baseUrl}/dbfetch.databases?style=xml\"\n xmlDoc = r...
[ "0.5958823", "0.55055314", "0.54522955", "0.54062337", "0.54023296", "0.5379891", "0.5374405", "0.5323056", "0.53127164", "0.52928984", "0.5270684", "0.52544284", "0.52360696", "0.5151331", "0.51377267", "0.5130782", "0.5118327", "0.50765693", "0.5070427", "0.50056094", "0.50...
0.5641061
1
GET /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/new GET /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/new.xml
def new @loaderio_7abd2d23994e8fb4f6f945f20b5204db = Loaderio7abd2d23994e8fb4f6f945f20b5204db.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @loaderio_7abd2d23994e8fb4f6f945f20b5204db } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @drop = Drop.new\n @breadcrumbs = [{\"home\" => drops_url}, {\"new file\" => nil}]\n\n respond_to do |format|\n...
[ "0.5916901", "0.58736026", "0.5829675", "0.5822987", "0.5786353", "0.5725231", "0.5647524", "0.56395376", "0.56358784", "0.5625258", "0.5617934", "0.56044513", "0.5577064", "0.5567216", "0.5542569", "0.55191576", "0.55169934", "0.5515872", "0.55094796", "0.55041444", "0.54983...
0.61253726
0
DELETE /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/1 DELETE /loaderio_7abd2d23994e8fb4f6f945f20b5204dbs/1.xml
def destroy @loaderio_7abd2d23994e8fb4f6f945f20b5204db = Loaderio7abd2d23994e8fb4f6f945f20b5204db.find(params[:id]) @loaderio_7abd2d23994e8fb4f6f945f20b5204db.destroy respond_to do |format| format.html { redirect_to(loaderio_7abd2d23994e8fb4f6f945f20b5204dbs_url) } format.xml { head :ok } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete_file_from_database(file_id)\n $db.execute(\"DELETE FROM files WHERE id = ?\", file_id)\n $db.execute(\"DELETE FROM file_share_table WHERE file_...
[ "0.62602884", "0.6161261", "0.61605555", "0.60269386", "0.59268993", "0.5921408", "0.59063905", "0.5901612", "0.58287525", "0.58160114", "0.5815303", "0.5807196", "0.58023125", "0.5781516", "0.57746214", "0.5762284", "0.5743602", "0.5743602", "0.5719767", "0.56693393", "0.566...
0.63002354
0
Submit a POST request to submit a catalog to the server.
def post_catalog(name, facts:, environment:, configured_environment: nil, transaction_uuid: nil, job_uuid: nil, static_catalog: true, checksum_type: Puppet[:supported_checksum_types]) if Puppet[:preferred_serialization_format] == "pson" formatter = Puppet::Network::FormatHandler.format_for(:pson) # must...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n resource.post(request, response)\n end", "def commit(post)\n add_credentials(post)\n validate_request(post)\n url = URI.parse(resource_url)\n req = Net::HTTP::Post.new(url.path)\n params = post.to_s\n #display \"#{resource_url}?\" + params.map{|k,v| \"#{k}=#{v}\"}...
[ "0.64486474", "0.60685724", "0.5947963", "0.5896605", "0.5869767", "0.5817662", "0.57763624", "0.57380176", "0.5687271", "0.56643045", "0.5628491", "0.5609122", "0.56010723", "0.559139", "0.55877006", "0.557595", "0.5498736", "0.5493945", "0.5490477", "0.5484933", "0.54829466...
0.61158293
1
Submit a GET request to retrieve the facts for the named node.
def get_facts(name, environment:) headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node::Facts).join(', ')) response = @client.get( with_base_url("/facts/#{name}"), headers: headers, params: { environment: environment } ) process_response(response) [response, dese...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_facts(nodename)\n facts_puppetdb = Hash.new\n response_facts = RestClient.get\"http://#{Tayu.puppetdb_server}:#{Tayu.puppetdb_port}/facts/\" + nodename, { :accept => :json}\n\n # json string holds two object, we only need te facts object\n json_object = JSON.parse(response_facts...
[ "0.62216103", "0.58697665", "0.58316225", "0.58137995", "0.58137995", "0.5810658", "0.57173264", "0.5669858", "0.56671375", "0.56650734", "0.56596464", "0.56550664", "0.56478643", "0.5635795", "0.5609473", "0.5603767", "0.5601581", "0.55946934", "0.5572189", "0.5535088", "0.5...
0.6265463
0