query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Get a row from the result.
def [](index) if index < 0 index += length end unless index < 0 || index >= length Row.new(`#@native.rows.item(index)`) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_row(sql)\n # Run the query\n results = query(sql)\n\n # Check result counts\n if results.count == 0\n check.critical(\"Expected to receive a single row, but result set is empty\", \"SQL: #{sql}\")\n end\n if results.count > 1\n c...
[ "0.7638399", "0.702936", "0.700246", "0.6939295", "0.6877787", "0.6751474", "0.6723773", "0.664939", "0.66211694", "0.65161836", "0.6493874", "0.64328617", "0.64326614", "0.63858974", "0.63577604", "0.6287206", "0.6275268", "0.62573916", "0.6219167", "0.6203666", "0.6169865",...
0.57442963
71
Enumerate over the rows.
def each(&block) return enum_for :each unless block %x{ for (var i = 0, length = #@native.rows.length; i < length; i++) { #{block.call(self[`i`])}; } } self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_row\n end", "def each_row\n @sheet.rowIterator.each { |row| yield row }\n end", "def each\n @cells.each_with_index do |row, ir|\n row.each_with_index do |val, ic|\n yield ir, ic, val\n end\n end\n end", "def by_row\r\n Enumerator.new do |yielder|\r\n indice...
[ "0.73837185", "0.7197733", "0.717142", "0.71417356", "0.70881146", "0.70638794", "0.69808954", "0.69603354", "0.69448465", "0.6942839", "0.6933076", "0.69265735", "0.69182944", "0.6917571", "0.69166017", "0.6912603", "0.6875929", "0.6875929", "0.6856252", "0.6856252", "0.6848...
0.69747853
7
Method to get the cpu usage from a running webserver
def cpu_usage containers = [] @hosts.each do |host| Docker.url = "tcp://#{host}:#{@docker_port}/" containers.concat Docker::Container.all(all: true, filters: { ancestor: [@ws_image],status:['running'] }.to_json) end cpuPercent = 0.0 status = containers.first.stats cpuDelta ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpu_usage\r\n # all usage\r\n total_used_cpu = IO.popen(\"ps aux\").read.split(\"\\n\").inject 0 do |a, i|\r\n a += i.split(' ')[2].to_f\r\n end\r\n # mysqld usage\r\n tread_desc = IO.popen(\"ps aux|grep mysqld\").read.split(\"\\n\")[0].split \" \" #get total info about mysql-process\r\n...
[ "0.69750625", "0.67805725", "0.67805725", "0.65862215", "0.6468889", "0.64659643", "0.63881683", "0.63557076", "0.6345079", "0.6316572", "0.63116467", "0.6308", "0.6298507", "0.62740934", "0.6240622", "0.6223297", "0.62154007", "0.6200482", "0.6167709", "0.61236066", "0.61069...
0.6904562
1
Method to get the id and the server for an image in a pull of servers
def get_container_id(image=@ws_image, hosts=@hosts) hosts.each do |host| Docker.url = "tcp://#{host}:#{@docker_port}/" containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json) return containers.first unless containers.empty? end fail('Could n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_image_id(s)\n s.respond_to?('image_id') ? s.image_id : 'no_image'\n end", "def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options p...
[ "0.73290086", "0.6772108", "0.6691233", "0.66905504", "0.6597353", "0.65839183", "0.657593", "0.650275", "0.64376134", "0.6323429", "0.62900186", "0.62834847", "0.62738526", "0.6265871", "0.6253316", "0.6244479", "0.6231352", "0.6223999", "0.61767286", "0.6156743", "0.6138084...
0.0
-1
Method to get the number of existing webservers running in a pull of servers
def ws_running?(hosts=@hosts) total = 0 puts "looking at: #{@hosts}" hosts.each do |host| Docker.url = "tcp://#{host}:#{@docker_port}/" containers = Docker::Container.all(all: true, filters: { ancestor: [@ws_image], status:['running'] }.to_json) total += containers.size end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_remote_servers\n connection.servers.inject(0) do |sum, s|\n sum += 1 if server_is_proxy_type?(s) \n sum\n end\n end", "def get_pulls_count\n pulls_count\n end", "def servercount\n url = \"https://discordbots.org/api/bots/#{@id}\"\n JSON.parse(RestClient.get(ur...
[ "0.7156128", "0.6946807", "0.6857106", "0.6578612", "0.6534628", "0.6464708", "0.64567363", "0.6448838", "0.6438768", "0.63433695", "0.6333768", "0.6303893", "0.6263936", "0.6233108", "0.6229441", "0.6229023", "0.62216014", "0.6219469", "0.6212167", "0.6189796", "0.61734456",...
0.5949236
31
Method to get an available port on a host
def get_available_port(host) (7000..7100).each do |port| status = `nmap -Pn -p #{port} #{host} | grep #{port} | awk '{print $2}'`.chomp("\n") return port if status.eql? 'closed' end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_avail_port(host)\n host ||= (Socket::gethostbyname('')||['localhost'])[0]\n\n infos = Socket::getaddrinfo(host, nil, Socket::AF_UNSPEC,\n Socket::SOCK_STREAM, 0, \n Socket::AI_PASSIVE)\n fam = infos.inject(...
[ "0.8258386", "0.80536866", "0.80052227", "0.756263", "0.7488922", "0.7423117", "0.7417603", "0.74142665", "0.72814554", "0.72323245", "0.7223862", "0.7097144", "0.70687973", "0.69444543", "0.69444543", "0.69434285", "0.6897088", "0.6876533", "0.6821543", "0.68137294", "0.6789...
0.82286906
1
Method to get an available host to instantiate new containers
def get_available_host @hosts.each do |host| return host if ws_running?([host]) < @ws_limit end puts "No host available! Providing a new one on aws" json = `aws ec2 run-instances --image-id ami-689cc908 --instance-type t2.medium --key-name mior --security-group-id sg-5bb3af3f` json = JSON.pars...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_host\n host_list.first\n end", "def get_host(name)\n # create a host object to work with\n host_obj = Com::Vmware::Vcenter::Host.new(vapi_config)\n\n if name.nil?\n host = host_obj.list\n else\n filter = Com::Vmware::Vcenter::Host::FilterSpec.new(name...
[ "0.64142144", "0.6313287", "0.62808466", "0.62536585", "0.62360233", "0.6220651", "0.6211062", "0.618804", "0.6131152", "0.6061299", "0.5973693", "0.5971544", "0.59336907", "0.5902657", "0.58682615", "0.5861301", "0.5826437", "0.5784183", "0.57781345", "0.5771931", "0.574524"...
0.72020346
0
Method to create new containers based on available hosts and ports
def create_new_container puts 'Start creating a new container..' host = get_available_host if host.nil? puts 'Could not found a host with limit enough to create more containers' return end puts "getting an available port to #{host}" port = get_available_port(host) if port.nil? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_container(image, expose_port)\n container = Docker::Container.create('Image' => image, 'HostConfig' => {'PortBindings' => {\"#{expose_port}/tcp\" => [{}]}})\n container.start\n Container.new(container, expose_port)\nend", "def prepare_container\n exposed_ports = {}\n port_bindings = {}\n li...
[ "0.6730131", "0.6544568", "0.64701444", "0.6224988", "0.60641176", "0.59913635", "0.58838004", "0.5863922", "0.58426726", "0.5820154", "0.5811106", "0.57884234", "0.5754376", "0.5731109", "0.5727038", "0.57236093", "0.5710107", "0.56480235", "0.56255305", "0.5620154", "0.5552...
0.7997852
0
Method to terminate a node when there is overload
def kill_node return if ws_running? < 2 puts 'Low load, let\'s kill a node..' to_kill = get_container_id(image=@ws_image) unregister_server(to_kill.id) container = Docker::Container.get(to_kill.id, to_kill.connection).kill end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terminate()\n connection.nodes.terminate(uuid).tap{ self.forget }\n end", "def close(node)\r\n end", "def terminate\n raise NotImplementedError\n end", "def terminate() end", "def terminate\n\t\traise NotImplementedError\n\tend", "def terminate!() end", "def do_kill\n\n retu...
[ "0.664543", "0.6564041", "0.64445454", "0.6396273", "0.6365018", "0.6244983", "0.6211343", "0.6177524", "0.6071045", "0.6049491", "0.6034969", "0.6034969", "0.596857", "0.59193003", "0.5828539", "0.5720607", "0.57205117", "0.5641888", "0.5618093", "0.5616324", "0.5611682", ...
0.5142176
46
Method to register a new server on lb configurations
def register_container(host, port, id) puts "Start registring container #{id}" name = 'webserver' tempfile = '/tmp/haproxy.cfg' server_config = "server #{name} #{host}:#{port} check \##{id}" contents = File.read(File.expand_path(@haproxy_config_file)) open(tempfile, 'w+') do |f| cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regist_server(server)\n @server[server.uri] = server\n mutex.synchronize do\n @primary_server = server unless @primary_server\n end\n end", "def add_server server\n @station.add_server server\n end", "def server(name, options = {}, &blk)\n add_child(:servers, Hubcap::Server.ne...
[ "0.6889634", "0.68409187", "0.6742169", "0.6720169", "0.6686957", "0.66469765", "0.66350216", "0.65477794", "0.64231277", "0.64231277", "0.63964903", "0.6347702", "0.6333962", "0.6289081", "0.6268258", "0.6261473", "0.6217305", "0.61737233", "0.6111986", "0.6070764", "0.59804...
0.6016082
20
Method to unregister a server on lb configurations
def unregister_server(id) puts "Removing entry to #{id} from HA configurations" name = 'webserver' tempfile = '/tmp/haproxy.cfg' server_config = "server #{name}" contents = File.read(File.expand_path(@haproxy_config_file)) open(tempfile, 'w+') do |f| contents.each_line do |line| ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_server(server)\n @server.delete(server.uri)\n end", "def remove_server( host, port )\n server = get_server( host, port )\n Penctl.update_server( @pen, server[:slot], :address => '0.0.0.0', :port => 0 )\n !server_in_pool? host, port\n end", "def unconfigure_cc_server(options)\n unconfi...
[ "0.68974334", "0.6749871", "0.6419386", "0.64100635", "0.6396826", "0.6390541", "0.6362493", "0.634938", "0.6314173", "0.6314173", "0.6303885", "0.62675935", "0.6261123", "0.62557817", "0.62342304", "0.61709726", "0.61541086", "0.6132939", "0.6059999", "0.6029776", "0.6023869...
0.69093907
0
Method to run a new HAProxy load balancer when there is no lb running
def lb_running? containers = Docker::Container.all(all: true, filters: { ancestor: [@lb_image], status:['running'] }.to_json) if containers.empty? lb = Docker::Container.create( 'Cmd'=> [ '-n', '10000' ], 'Image' => "#{@lb_image}", 'ExposedPorts' => { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ready_load_balancer(action_handler, lb_spec, lb_options, machine_specs)\n end", "def load_balancer # rubocop:disable AbcSize\n raise 'Can not determine hostname to load client for' if @new_resource.f5.nil?\n @@load_balancers ||= []\n add_lb(@new_resource.f5) if @@load_balancers.empty?\n ...
[ "0.64021456", "0.6308647", "0.615235", "0.5948533", "0.594549", "0.58581686", "0.58309716", "0.5738304", "0.5736448", "0.5725162", "0.558037", "0.55757904", "0.55384505", "0.55282605", "0.546945", "0.5460365", "0.5444994", "0.5368971", "0.53599536", "0.53560555", "0.5342512",...
0.6290933
2
Method to clean up the webservers entries on HAProxy lb configuration file
def clean_up name = 'webserver' tempfile = '/tmp/haproxy.cfg' server_config = "server #{name}" contents = File.read(File.expand_path(@haproxy_config_file)) open(tempfile, 'w+') do |f| contents.each_line do |line| f.puts line unless line.match(server_config) end end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all_servers\n super\n end", "def cleanup\n begin\n File.unlink(File.join(Restore::Config.socket_dir, 'restore_backend.sock'))\n rescue => e\n BackgrounDRb::ServerLogger.log_exception('server', e)\n end\n end", "def destroy\n if self.class.cfg_name == \"server\"\n...
[ "0.65997314", "0.6208951", "0.6136841", "0.6107191", "0.6076707", "0.60043406", "0.6003126", "0.5952395", "0.591766", "0.59110963", "0.5864654", "0.58445036", "0.5830171", "0.5820457", "0.5792044", "0.57903314", "0.5779059", "0.5703844", "0.5698832", "0.56504244", "0.56428677...
0.75116295
0
Method to update the webservers entries with the running webservers
def update_lb_servers clean_up @hosts.each do |host| Docker.url = "tcp://#{host}:#{@docker_port}/" containers = Docker::Container.all(all: true, filters: { ancestor: [@ws_image], status:['running'] }.to_json) containers.each do |container| port = container.json['HostConfig']['PortBindi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def servers\n sync{@servers.keys}\n end", "def servers=(servers)\r\n @servers = {}\r\n servers.each{|s| @servers[s.host] = s}\r\n end", "def update_status\n @servers.each do |type|\n begin\n @server_status.send(\"#{type}_reinitialize\") # re-ping the server\n ...
[ "0.6247067", "0.61018604", "0.59021914", "0.5893541", "0.584094", "0.58088124", "0.58057207", "0.57136923", "0.5661316", "0.56575567", "0.5644022", "0.56031513", "0.5594829", "0.5591334", "0.5575777", "0.55660146", "0.55660146", "0.5558011", "0.5548205", "0.5546352", "0.54893...
0.60162646
2
Returns all factors of a number, in order.
def factors k = 1 max = Math.sqrt(self).ceil lofacs = [] hifacs = [] while k <= max.ceil if (self.to_f/k) == (self.to_i/k) lofacs << k hifacs << self/k unless self/k == k end k += 1 end lofacs + hifacs.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factors(number)\n fs = [1,number]\n (2..Math.sqrt(number).to_i).each do |i|\n if number % i == 0\n fs << i\n fs << number/i unless number/i == i\n end\n end\n fs.sort\n end", "def factors(num)\n factors = Prime.prime_division(num)\n result = []\n ...
[ "0.8495161", "0.8407239", "0.83438486", "0.8324943", "0.8309591", "0.83050936", "0.82516384", "0.82201415", "0.8216604", "0.82154673", "0.8212212", "0.8207854", "0.8207039", "0.820408", "0.81810015", "0.8175626", "0.8175626", "0.8175626", "0.8175626", "0.8175626", "0.8175626"...
0.0
-1
Retrieve group members for a group
def group_members members("Group") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_members(id)\n get(\"/groups/#{id}/members\")\n end", "def group_members(group_id)\n url = \"/groups/#{group_id}/members/\"\n get(url)\n end", "def get_membership(group)\n @uri = URI.parse(\"#{@api_url}/group/#{group}/member\")\n body = make_get_request\n doc = Noko...
[ "0.8180778", "0.8123063", "0.8071533", "0.8015869", "0.78396213", "0.782432", "0.7608671", "0.7584698", "0.75649506", "0.7470431", "0.7452888", "0.74415076", "0.73966545", "0.7364911", "0.7357861", "0.73520494", "0.73473066", "0.7208945", "0.7142245", "0.71201456", "0.7119502...
0.7712768
6
Retrieve user member ids
def user_member_ids member_ids("User") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_ids\n object.member_ids\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids(entity)\n params = self.class.prepare_params_for(:members, \"groupId\...
[ "0.8391676", "0.8225511", "0.8225511", "0.8225511", "0.76523995", "0.76359", "0.7624865", "0.7579126", "0.7474112", "0.73487943", "0.7310724", "0.7310724", "0.7310724", "0.72777843", "0.72415495", "0.7238701", "0.72357166", "0.7196906", "0.7186721", "0.7110875", "0.70920867",...
0.8583693
0
Retrieve group member ids
def group_member_ids member_ids("Group") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_ids\n groups.pluck(:id)\n end", "def member_ids(entity)\n params = self.class.prepare_params_for(:members, \"groupId\" => group_id)\n response = self.class.perform(params)\n self.class.check_response(response)\n # Prepare a User array\n xml = Nokogiri::XML(response.body...
[ "0.77952635", "0.7737004", "0.76312757", "0.7579618", "0.74004847", "0.738079", "0.73781", "0.73463255", "0.73463255", "0.73463255", "0.7313398", "0.7313398", "0.7313398", "0.7178813", "0.71254283", "0.7125007", "0.7067689", "0.7045959", "0.6961312", "0.6944207", "0.6919318",...
0.85389435
0
Retrieve member ids for an entity [Group or User]
def member_ids(entity) params = self.class.prepare_params_for(:members, "groupId" => group_id) response = self.class.perform(params) self.class.check_response(response) # Prepare a User array xml = Nokogiri::XML(response.body) entity_ids = parse_member_response(xml, entity) whi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_ids\n object.member_ids\n end", "def group_member_ids\n member_ids(\"Group\")\n end", "def user_member_ids\n member_ids(\"User\")\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n team_users.pluck(:user_id)\n end", "def member_ids\n te...
[ "0.756729", "0.7312764", "0.71858877", "0.7165978", "0.7165978", "0.7165978", "0.7035421", "0.700859", "0.690843", "0.68373215", "0.67172766", "0.6663328", "0.6598532", "0.65625685", "0.6504848", "0.6503369", "0.6457338", "0.6456977", "0.64296645", "0.64273083", "0.6385801", ...
0.8565418
0
Retrieve entity members for a group
def members(entity) member_ids(entity).map{ |member| "RubyProvisioningApi::#{entity}".constantize.send(:find, member) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def members\n @group = Group.find(params[:group_id])\n @members = @group.users\n end", "def users\n GroupMembers.new(:id => id).get.items\n end", "def index\n @group = Group.find(params[:id])\n @members = GroupUser.where(:group_id => params[:id])\n end", "def group_members(id)\n ge...
[ "0.75482345", "0.73751634", "0.7327523", "0.7286194", "0.72293264", "0.7228873", "0.71968395", "0.71177197", "0.7051065", "0.70352346", "0.6898394", "0.68867236", "0.6862764", "0.6853229", "0.6815498", "0.67921793", "0.67689776", "0.676001", "0.6758262", "0.6756706", "0.67444...
0.6534999
31
Clear Scripto instance variables so we can start fresh.
def reset_scripto %i[@log_with_color @logger @options].each do if Scripto.instance_variable_defined?(_1) Scripto.remove_instance_variable(_1) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @instance = nil\n @local_env = nil\n end", "def reset\n @instance = nil\n @local_env = nil\n end", "def reset\n # self.instance_variable_names.each do |var_name|\n # self.instance_variable_set var_name, nil\n # end\n ...
[ "0.7653916", "0.7653916", "0.7594553", "0.7513567", "0.74618894", "0.7410193", "0.7228556", "0.713755", "0.71291035", "0.7087924", "0.7016342", "0.69057375", "0.68801403", "0.68488914", "0.68257743", "0.67794085", "0.67627853", "0.67384976", "0.6730995", "0.6685596", "0.66207...
0.77352476
0
I find it a little awkward that this method is not referenced in this class (it's sent by subclasses). This suggests that I need an abstract superclass and that there should be a parallel BeverageVerseN subclass....but I must say, that seems like double overkill for this one thing..
def zero_quantity_phrase 'No more' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class Motorbike < Vehicle\r\n def wheelie\r\n end\r\nend", "def manufacture; end", "def abstract!; end", "def initialize(beverage)\n @beverage = beverage\n end", "def virtual; end", "def abstract?; end", "def superclass() end", "def specie; end", "def specie; end", "def specie; end"...
[ "0.6054675", "0.5992723", "0.59425473", "0.582326", "0.58219224", "0.578638", "0.5715321", "0.5681956", "0.5681956", "0.5681956", "0.5681956", "0.56607234", "0.5617998", "0.5610484", "0.55606556", "0.5545302", "0.55319285", "0.55053353", "0.54907095", "0.54888934", "0.5459513...
0.0
-1
Return the total number of strings in the provided array using the count enumerable
def count_empty_strings(array) array.count("") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_empty_strings(array)\n count = 0\n array.each do |string|\n if string == \"\"\n count += 1\n end\n end\n count\n # Return the total number of EMPTY strings in the provided array using the count enumerable\nend", "def count(array)\n count = 0\n array.each do |x|\n count += 1\n end\...
[ "0.7524747", "0.71000457", "0.6998606", "0.69831485", "0.6971885", "0.6914824", "0.68180174", "0.6791462", "0.6781263", "0.6779641", "0.6732296", "0.6729332", "0.671412", "0.6709035", "0.66925085", "0.6684526", "0.6649149", "0.6643434", "0.66279715", "0.66273385", "0.66249156...
0.6639989
18
generic admin notification email method
def admin_notification(subject, requester, message) # don't deliver if config value is set to true unless Rails.application.config.disable_admin_notifications == true @subject = subject @requester = requester.nil? ? 'no-reply@broadinstitute.org' : requester @message = message @admins = U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_admin_notification\n order = Order.last\n OrderMailer.order_admin_notification(order)\n end", "def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end", "def admin_story_email\n NotificationsMailer.admin_story_email(Story.first)\n end", "def send_admin_notif...
[ "0.7630307", "0.75789094", "0.7515103", "0.7493016", "0.74760187", "0.7257974", "0.7245482", "0.7207676", "0.7177799", "0.7175801", "0.71555334", "0.7051989", "0.7036957", "0.7034615", "0.7032978", "0.7017485", "0.70142925", "0.7014253", "0.70082235", "0.7001936", "0.6982842"...
0.7338657
5
notifier of FireCloud API service interruptions
def firecloud_api_notification(current_status, requester=nil) unless Rails.application.config.disable_admin_notifications == true @admins = User.where(admin: true).map(&:email) @requester = requester.nil? ? 'no-reply@broadinstitute.org' : requester @current_status = current_status unless @ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def service_unavailable\n\n end", "def notify_incomplete\n Notification.notify_incomplete\n end", "def client_disconnected\n end", "def notify_error(error)\n end", "def notifier; end", "def notifier; end", "def notify\n {}\n end", "def notify\n {}\n end", "de...
[ "0.59585965", "0.5804861", "0.57641816", "0.5762749", "0.5739281", "0.5739281", "0.5732916", "0.5732916", "0.5732916", "0.569487", "0.56632835", "0.56632835", "0.5614325", "0.55573666", "0.5551225", "0.5551225", "0.55266064", "0.5498651", "0.549309", "0.5458647", "0.5449181",...
0.0
-1
FIXME: is this really wanted or expected behavior?
def test_scope_for_create_is_cached relation = Relation.new Post, Post.arel_table assert_equal({}, relation.scope_for_create) relation.where_values << relation.table[:id].eq(10) assert_equal({}, relation.scope_for_create) relation.create_with_value = {:hello => 'world'} assert_equa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def same; end", "def used?; end", "def isolated; end", "def isolated; end", "def internship_passed; end", "def anchored; end", "def schubert; end", "def internal; end", "d...
[ "0.71957844", "0.6409791", "0.63131744", "0.63131744", "0.63131744", "0.63131744", "0.6138523", "0.60656995", "0.6035524", "0.6035524", "0.5980246", "0.5975475", "0.5921914", "0.58868825", "0.5830097", "0.5802475", "0.58016586", "0.57823694", "0.5763694", "0.5763694", "0.5760...
0.0
-1
`path_for` is a recursive method used to find the "path" for `.dig` to take when looking for a given attribute in the params. Example: `path_for(:name)` should return an array that looks like [:names, 0, :givenName]. `.dig` can then use that path against the params to translate the :name attribute to "John".
def path_for(attribute, object = ScimRails.config.mutable_group_attributes_schema, path = []) at_path = path.empty? ? object : object.dig(*path) return path if at_path == attribute case at_path when Hash at_path.each do |key, value| found_path = path_for(attribute, object, [*p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_for name, type\n \"#{type}/#{name}\"\n end", "def route_for(name, *args); end", "def url_for options = {}\n return \"/#{options[:controller].downcase}/#{options[:action]}/#{options[:id]}\" if options[:id].present?\n \"/#{options[:controller.downcase]}/#{options[:action]}\"\nend", "def url_for(...
[ "0.6088694", "0.5445511", "0.52487785", "0.5192151", "0.51890874", "0.5158851", "0.5158851", "0.51400435", "0.5133261", "0.5126662", "0.5106367", "0.5097002", "0.50741553", "0.50556433", "0.5051875", "0.50485325", "0.50279754", "0.5027648", "0.494283", "0.49426785", "0.493260...
0.4587967
34
GET /comments GET /comments.xml
def index @comments = Comment.paginate :page => params[:page], :per_page => 25, :conditions => {:flag => true} if request.xhr? render(:update) do |page| page.replace_html 'results', :partial => "results" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def comments; rest_query(:comment); end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def comments\n @list.client.get(\"#{url}/comments\")\n end", "def index\n @comments = Comment.find(:all)\n\n ...
[ "0.76349247", "0.7078839", "0.7050343", "0.7050343", "0.694906", "0.694906", "0.69271475", "0.6917307", "0.68833375", "0.6871063", "0.6871063", "0.6871063", "0.6771832", "0.6762841", "0.67415357", "0.6717631", "0.6705388", "0.66543263", "0.66304934", "0.65904164", "0.6585651"...
0.0
-1
GET /comments/1 GET /comments/1.xml
def show @comment = Comment.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comments\n client.get(\"/#{id}/comments\")\n end", "def index\n @comments = @commentable.comments\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comments }\n end\n end", "def comments; rest_query(:comment); end", "def index\...
[ "0.73548913", "0.693442", "0.6909092", "0.69014907", "0.69014907", "0.6885073", "0.68666923", "0.681376", "0.68123436", "0.68062603", "0.68062603", "0.68062603", "0.6759341", "0.6747612", "0.6694016", "0.66797477", "0.6648471", "0.6648471", "0.6648471", "0.6648471", "0.664847...
0.66228604
33
GET /comments/new GET /comments/new.xml
def new @comment = Comment.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @comment } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @comment = Comment.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comment }\n end\n end", "def new\n @comment = @story.comments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comm...
[ "0.76403975", "0.75350714", "0.75025994", "0.71966404", "0.71887654", "0.7109443", "0.70622236", "0.70211035", "0.70024085", "0.6965282", "0.69639325", "0.69639325", "0.6956517", "0.6956517", "0.6956517", "0.6956517", "0.6956517", "0.6956517", "0.6956517", "0.6956517", "0.695...
0.7658112
9
POST /comments POST /comments.xml
def create @comment = Comment.new(params[:comment]) respond_to do |format| if @comment.save flash[:notice] = 'Comment was successfully created.' format.html { redirect_to(@comment) } format.xml { render :xml => @comment, :status => :created, :location => @comment } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment options={}\n client.post(\"/#{id}/comments\", options)\n end", "def post_comment(comment, poi=\"4f4f4c27d4374e800100001d\")\n uri = URI.parse(\"http://mashweb.fokus.fraunhofer.de:3008/api/comment\")\n response = Net::HTTP.post_form(uri, {\n :title => 'Autocomment',\n :body => co...
[ "0.6438144", "0.63944346", "0.6314433", "0.6279525", "0.6177414", "0.6117951", "0.6052219", "0.6050391", "0.604765", "0.60258925", "0.60258925", "0.60258925", "0.5955842", "0.594936", "0.59480053", "0.5906261", "0.58979017", "0.5835288", "0.5829491", "0.5828639", "0.5812348",...
0.61582184
5
PUT /comments/1 PUT /comments/1.xml
def update @comment = Comment.find(params[:id]) respond_to do |format| if @comment.update_attributes(params[:comment]) flash[:notice] = 'Comment was successfully updated.' format.html { redirect_to(@comment) } format.xml { head :ok } else format.html { render :actio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.xml { head :ok }\n format.json { head :ok } \n else\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity ...
[ "0.6987354", "0.6470188", "0.639144", "0.63796103", "0.6373086", "0.6338675", "0.63336104", "0.63336104", "0.63336104", "0.63336104", "0.63336104", "0.63336104", "0.63336104", "0.63336104", "0.6332264", "0.6315601", "0.6301437", "0.62940633", "0.6263799", "0.6237293", "0.6236...
0.634739
8
DELETE /comments/1 DELETE /comments/1.xml
def destroy @comment = Comment.find(params[:id]) @comment.destroy respond_to do |format| format.html { redirect_to(comments_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comments\n end", "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok } \n end\n end", "def delete_comment(id)\n record \"/msg/delete_comment/#{id}\"\n end", "def ...
[ "0.7069298", "0.70650667", "0.6983991", "0.69345826", "0.6933929", "0.6881332", "0.6874554", "0.68715304", "0.686064", "0.68428504", "0.68428504", "0.6831695", "0.679763", "0.67835516", "0.67760897", "0.67750806", "0.67700255", "0.6713014", "0.6686587", "0.6592369", "0.658775...
0.69140357
14
GET /chains/1 GET /chains/1.json
def show @chain = Chain.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @chain } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @chain = Chain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @chain }\n end\n end", "def index\n @chains = Chain.all\n end", "def index\n @chains = Chain.where(\"user_id = ?\", current_user.id)\n #@chains = Ch...
[ "0.7000296", "0.6934242", "0.6837863", "0.65206766", "0.64685476", "0.62473583", "0.607646", "0.6047157", "0.59958035", "0.5776174", "0.5763867", "0.5763867", "0.56859905", "0.56859905", "0.55966556", "0.5543966", "0.5454826", "0.5410003", "0.5385941", "0.5380332", "0.5364352...
0.70781434
0
GET /chains/new GET /chains/new.json
def new @chain = Chain.new respond_to do |format| format.html # new.html.erb format.json { render json: @chain } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @chain = Chain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @chain }\n end\n end", "def create\n @chain = Chain.new(params[:chain])\n\n respond_to do |format|\n if @chain.save\n format.html { redirect_to @chain, notice...
[ "0.7758939", "0.7094116", "0.68604326", "0.68036044", "0.6695603", "0.6695603", "0.6596032", "0.62162423", "0.6206328", "0.6199468", "0.6167997", "0.61654556", "0.6158233", "0.6155419", "0.61188006", "0.6083681", "0.60760397", "0.60735995", "0.606764", "0.60667384", "0.605518...
0.783291
0
POST /chains POST /chains.json
def create @chain = Chain.new(params[:chain]) respond_to do |format| if @chain.save format.html { redirect_to @chain, notice: 'Chain was successfully created.' } format.json { render json: @chain, status: :created, location: @chain } else format.html { render action: "new" }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @chain = Chain.new(chain_params)\n\n respond_to do |format|\n if @chain.save\n format.html { redirect_to @chain, notice: 'Chain was successfully created.' }\n format.json { render :show, status: :created, location: @chain }\n else\n format.html { render :new }\n ...
[ "0.67599213", "0.6674877", "0.65102607", "0.5945043", "0.5887569", "0.574318", "0.56750745", "0.5635235", "0.55651635", "0.5457566", "0.52654845", "0.5222354", "0.5222354", "0.5203518", "0.5186257", "0.5155372", "0.51477844", "0.51477844", "0.5112006", "0.51104563", "0.511045...
0.6880466
0
PUT /chains/1 PUT /chains/1.json
def update @chain = Chain.find(params[:id]) respond_to do |format| if @chain.update_attributes(params[:chain]) format.html { redirect_to @chain, notice: 'Chain was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @chains = args[:chains] if args.key?(:chains)\n end", "def update!(**args)\n @chains = args[:chains] if args.key?(:chains)\n end", "def update\n @chain = Chain.find(params[:id])\n\n respond_to do |format|\n if @chain.update_attributes(params[:cha...
[ "0.673373", "0.673373", "0.6524221", "0.62223035", "0.62158364", "0.60707533", "0.59876996", "0.5959223", "0.59066325", "0.59066325", "0.5845555", "0.5756804", "0.57263196", "0.57263196", "0.54618794", "0.54463106", "0.54289395", "0.5414758", "0.5357954", "0.52566314", "0.524...
0.65134263
3
DELETE /chains/1 DELETE /chains/1.json
def destroy @chain = Chain.find(params[:id]) @chain.destroy respond_to do |format| format.html { redirect_to chains_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @chain.destroy\n respond_to do |format|\n format.html { redirect_to chains_url, notice: 'Chain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", ...
[ "0.73056185", "0.6804039", "0.6660589", "0.6298634", "0.6293762", "0.62559354", "0.62530774", "0.62455755", "0.6229625", "0.6225268", "0.62239057", "0.6201896", "0.6191242", "0.6187405", "0.6175142", "0.6174401", "0.6173789", "0.61702955", "0.6167111", "0.6149392", "0.6112409...
0.7672306
0
POST /links POST /links.json
def create @link = LinkCreator.new(link_params) Rails.logger.debug(link_params) @link.user = current_user respond_to do |format| if @link.save format.html do if params[:return_to].present? redirect_to params[:return_to] else redirect_to ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n ...
[ "0.7279239", "0.7042173", "0.6892667", "0.6849184", "0.67824477", "0.67146206", "0.6708206", "0.66861737", "0.66628766", "0.66427463", "0.66249496", "0.65540344", "0.6506658", "0.64941686", "0.6478123", "0.6459337", "0.64366543", "0.64365256", "0.6423571", "0.64210635", "0.64...
0.5720168
97
Use callbacks to share common setup or constraints between actions.
def set_link @link = Link.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def link_params params.require(:link).permit(:name, :url, :description, :hottiness, pot_ids: [ ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.6290564...
0.0
-1
hash_letter_freq() Takes an array of randomised letters Using a hash, have the letter as the key and it's frequency (the number of repeats) as its value returns a hash
def hash_letter_freq( array ) i = 0 # keeps track of outter loop hash = Hash.new() while( array.length > i ) count = 1 i2 = 1 + i # keeps track of inner while loop while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_frequency(text)\n\n #create blank hash\n character_hash = Hash.new\n character_hash.default = 0\n\n #delete other characters\n text.delete! \"^a-zA-Z\"\n\n #all lower case\n text = text.downcase\n\n #turn string into array\n text_array = text.chars\n\n #move each letter to hash with number of times it a...
[ "0.757045", "0.73490727", "0.7205911", "0.7187081", "0.7083201", "0.7049306", "0.6971145", "0.6938446", "0.6932685", "0.6907188", "0.69051325", "0.6881682", "0.6877212", "0.6862368", "0.6861961", "0.6860172", "0.68457276", "0.68310875", "0.68012303", "0.6793086", "0.67846286"...
0.7717621
0
def Splits a string e.g. "dog" into "d" "o" "g" and places it in an array returns an array Calls String.split() not my own implementation
def string_splitter( string ) array = [] array = string.split("") p array return array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_into_array(word)\n word.split(\"\")\nend", "def split_string_to_array(str)\n @string_as_array = str.split('')\n return @string_as_array\nend", "def string_to_array(string)\n string.split(\" \")\nend", "def string_to_array(string)\n string.split(\" \")\nend", "def sentence_to_array (string)\n...
[ "0.8138662", "0.75949985", "0.75502986", "0.75502986", "0.7323947", "0.730076", "0.7244737", "0.7129216", "0.7078107", "0.70628536", "0.69751096", "0.6845489", "0.68389684", "0.6795993", "0.6679411", "0.66670793", "0.66611606", "0.6630858", "0.6615235", "0.6609287", "0.658336...
0.7518159
4
GET /api/v2/client/getInitialInfo Requires: Header access_token: String Returns: Information for creating new clients
def get_client_initial_info conn = @client.get do |req| req.url '/api/v2/client/getInitialInfo' req.headers["Authorization"] = @token end conn.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def fetch_client\n # check if client not present?\n r = ClientApiDetail.get_client_data(@api_key)\n @client = r[:client]\n @client_api_detail = r[:client_api_detail]\n...
[ "0.61028", "0.6075018", "0.57441443", "0.57383764", "0.55986965", "0.5556492", "0.5539133", "0.5536614", "0.5361525", "0.5348352", "0.5334359", "0.5334359", "0.53116626", "0.52948946", "0.5260201", "0.5253981", "0.5238144", "0.5219797", "0.521828", "0.5212283", "0.5208981", ...
0.88002825
0
GET /api/v2/client/:id Requires: Header access_token: String Parameters id: String Returns: id: Number name: String
def get_client(id) conn = @client.get do |req| req.url "/api/v2/client/#{id}" req.headers["Authorization"] = @token end conn.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_from_id(id)\n resp = get \"#{CLIENT_API_PATH}/#{id}\"\n result = process_response(resp)\n Resources::Client.new(result)\n rescue Errors::NotFound\n nil\n end", "def get_client_by_id client_id\n @clients[client_id]\n end", "def show\n id = shift_argume...
[ "0.7217387", "0.7058601", "0.7005157", "0.69627196", "0.6899722", "0.6687794", "0.6675597", "0.66681695", "0.6650042", "0.66248", "0.658072", "0.65667576", "0.6563679", "0.6544318", "0.6543765", "0.6543121", "0.65425676", "0.65425676", "0.65425676", "0.65425676", "0.6530986",...
0.81252617
0
GET /api/v2/client/list Requires: Header access_token: String Parameters name: String (optional) Returns: Array of Client objects
def list_clients(json_payload={}) conn = @client.get do |req| req.url "/api/v2/client/list?" req.headers["Authorization"] = @token req.params = json_payload end conn.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_clients\n resp = get CLIENT_API_PATH\n result = process_response(resp)\n return [] if result.empty? # In case response is {}\n result.each.map { |c| Resources::Client.new(c) }\n end", "def index\n clients = request do\n api.request(\n :expects => 200,\n ...
[ "0.7423788", "0.7383859", "0.68673164", "0.6582604", "0.65639144", "0.6477763", "0.64590156", "0.6427994", "0.6345234", "0.62818325", "0.6264487", "0.62465537", "0.6220346", "0.6220346", "0.6220346", "0.6220346", "0.6220346", "0.6220346", "0.6220346", "0.6220346", "0.6168415"...
0.71512353
2
GET /api/v2/client/:id/tflows Requires: Header access_token: String Parameters id: String Returns: Array of Tflow objects
def get_client_tflows(id) conn = @client.get do |req| req.url "/api/v2/client/#{id}/tflows" req.headers["Authorization"] = @token end conn.body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_flows()\n\tputs \"Getting flows\"\n\tresponse = request_get('/api/partner/flow')\n\tputs response.body\nend", "def get_flows_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ArchitectApi.get_flows ...\"\n end\n \n \n ...
[ "0.6399589", "0.59974396", "0.573726", "0.57220155", "0.55452913", "0.55362463", "0.55003095", "0.5475815", "0.54546714", "0.5434752", "0.5411595", "0.5382709", "0.5354318", "0.5347557", "0.53404593", "0.53139627", "0.5310445", "0.52667147", "0.52140105", "0.5211589", "0.5192...
0.863545
0
lookup a single community cookbook site cookbook version
def cb_remote_lookup(cb_name) url = "http://cookbooks.opscode.com/api/v1/cookbooks/#{cb_name}" resp = Net::HTTP.get_response(URI.parse(url)) if resp.code == '404' return nil else par_resp = JSON.parse(resp.body) version = par_resp['latest_version'].split('/').last.gsub!('_', '.') return version...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version!(version)\n version.gsub!(/_/, '.')\n\n if version == 'latest'\n cookbook_versions.first!\n else\n cookbook_versions.find_by!(version: version)\n end\n end", "def latest_version\n quietly {\n uri = rest.get_rest(name)['latest_version']\n\n [ version...
[ "0.74812925", "0.6962258", "0.67354554", "0.6667277", "0.6592607", "0.6592607", "0.6586782", "0.6406435", "0.62750757", "0.6266341", "0.6200302", "0.61803186", "0.6100584", "0.60975003", "0.6095207", "0.6080263", "0.6064532", "0.6056673", "0.6045441", "0.6035256", "0.60331774...
0.6700462
3
get an array of all local repository cookbooks
def get_cookbooks cookbooks = [] Dir.foreach($opts[:repo]) do |cookbook_dir| if File.directory?(File.join($opts[:repo], cookbook_dir)) && !cookbook_dir.start_with?('.') cookbooks << cookbook_dir end end cookbooks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookbooks\n get_directories_absolute_paths cookbooks_path\n end", "def cookbooks_paths\n fetch(:cookbooks_paths).to_a.select { |path| File.exists? path }\n end", "def known_cookbook_paths\n # Keep a cache of it for performance.\n unless defined?(@cookbook_p...
[ "0.7489623", "0.71783364", "0.6968902", "0.666767", "0.66474", "0.66286016", "0.6595075", "0.65909183", "0.6535396", "0.6360969", "0.6323937", "0.6300123", "0.6277444", "0.62548846", "0.62147284", "0.62056124", "0.6150386", "0.61217505", "0.6060925", "0.6059825", "0.6048219",...
0.8102574
0
lookup a single local cookbooks version
def cb_local_lookup(cb_name) full_path = File.expand_path("#{$opts[:repo]}/#{cb_name}") if File.exists?("#{full_path}/metadata.rb") version = (`grep '^version' #{full_path}/metadata.rb`) else return -1 end version.split(' ').last.gsub('"','').gsub('\'','').chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cb_remote_lookup(cb_name)\n url = \"http://cookbooks.opscode.com/api/v1/cookbooks/#{cb_name}\"\n resp = Net::HTTP.get_response(URI.parse(url))\n\n if resp.code == '404'\n return nil\n else\n par_resp = JSON.parse(resp.body)\n version = par_resp['latest_version'].split('/').last.gsub!('_', '.')\n ...
[ "0.76823", "0.7043086", "0.6968428", "0.6725765", "0.65375", "0.64370614", "0.64055014", "0.64006007", "0.6357666", "0.6270923", "0.6226778", "0.62000257", "0.61955893", "0.6188703", "0.6188703", "0.60147244", "0.6007835", "0.59990686", "0.5988983", "0.5983059", "0.58585924",...
0.67152023
4
Accepts either a Unix timestamp integer or a Time object. Time objects will be adjusted to UTC automatically
def at(time) generate_otp(timecode(time)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_for_timestamp_shape(arg)\n return nil if arg.nil?\n\n time_value = case arg\n when Time\n arg\n when Date, DateTime\n arg.to_time\n when Integer, Float\n Time.at(arg)\n else\n Time.parse(arg.to_s)\n end\n time_value.utc...
[ "0.6633188", "0.6467675", "0.62619555", "0.6211142", "0.6196724", "0.617687", "0.6175131", "0.6172605", "0.61701196", "0.6160077", "0.6139568", "0.6131801", "0.61208194", "0.6114577", "0.61129516", "0.6101684", "0.6095221", "0.60830283", "0.6068334", "0.60647714", "0.6039883"...
0.0
-1
Generate the current time OTP
def now generate_otp(timecode(Time.now)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def now(padding=false)\n generate_otp(timecode(Time.now), padding)\n end", "def at(time)\n generate_otp(timecode(time))\n end", "def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end", "def gen_nonce\n Time.now.utc.to_i.to_s\n end", "def time\...
[ "0.79941463", "0.7975238", "0.70086616", "0.69044584", "0.68526894", "0.68208796", "0.678476", "0.67644906", "0.6754348", "0.6748101", "0.6673422", "0.6660354", "0.6639588", "0.66257197", "0.65963775", "0.6553311", "0.6519988", "0.64931494", "0.64931494", "0.6448483", "0.6419...
0.8752517
0
Verifies the OTP passed in against the current time OTP and adjacent intervals up to +drift+. Excludes OTPs from `after` and earlier. Returns time value of matching OTP code for use in subsequent call.
def verify(otp, drift_ahead: 0, drift_behind: 0, after: nil, at: Time.now) timecodes = get_timecodes(at, drift_behind, drift_ahead) timecodes = timecodes.select { |t| t > timecode(after) } if after result = nil timecodes.each do |t| result = t * interval if super(otp, generate_otp(t)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_with_drift(otp, drift, time = Time.now)\n time = time.to_i\n times = (time-drift..time+drift).step(interval).to_a\n times << time + drift if times.last < time + drift\n times.any? { |ti| verify(otp, ti) }\n end", "def verify input_token, options = {}\n opts = {:at => Time.now...
[ "0.7811539", "0.6381375", "0.5463985", "0.54385775", "0.53204346", "0.5291537", "0.5155122", "0.51432204", "0.51260144", "0.5085474", "0.50652474", "0.5044519", "0.47539374", "0.4711263", "0.46704125", "0.4626488", "0.46105227", "0.46042666", "0.46038818", "0.4602846", "0.458...
0.8290774
0
Returns the provisioning URI for the OTP This can then be encoded in a QR Code and used to provision the Google Authenticator app
def provisioning_uri(name = nil) OTP::URI.new(self, account_name: name || @name).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provisioning_uri(name, initial_count=0)\n \"otpauth://hotp/#{URI.encode(name)}?secret=#{secret}&counter=#{initial_count}\"\n end", "def provisioning_uri(name)\n encode_params(\"otpauth://totp/#{URI.encode(name)}\",\n :period => (interval==30 ? nil : interval), :issuer => issue...
[ "0.7933297", "0.7514161", "0.68723416", "0.67327166", "0.67327166", "0.6722737", "0.67030734", "0.6176162", "0.59617335", "0.59011465", "0.58670884", "0.5841671", "0.5733952", "0.5652587", "0.56475943", "0.5593852", "0.5569154", "0.5508632", "0.5441326", "0.54298985", "0.5415...
0.7433048
2
Get back an array of timecodes for a period
def get_timecodes(at, drift_behind, drift_ahead) now = timeint(at) timecode_start = timecode(now - drift_behind) timecode_end = timecode(now + drift_ahead) (timecode_start..timecode_end).step(1).to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timecodes\n return [] if start_time.nil?\n start_hour = start_time.strftime(\"%H\")\n start_min = start_time.strftime(\"%M\").to_i < 30 ? \"00\" : \"30\"\n curr_time = Time.parse(\"#{start_hour}:#{start_min}\")\n timecode_array = []\n while curr_time < Time.parse(\"#{end_time.strftime(\"%H\")...
[ "0.8219405", "0.6659237", "0.6189314", "0.59549737", "0.5946628", "0.5868806", "0.58516043", "0.5772283", "0.5757646", "0.5692132", "0.56851125", "0.5655532", "0.56414795", "0.5633896", "0.5620873", "0.5618355", "0.5617488", "0.5583048", "0.55760926", "0.5575761", "0.55658036...
0.75483024
1
property BSTR FieldTypes ???????? Not documected............. BSTR table_name [IN]
def FieldTypes @_FieldTypes ||= OLEProperty.new(@ole, 9, [VT_BSTR], [VT_BSTR, VT_BSTR]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_types\r\n return @field_types\r\n end", "def types\n FIELD_TYPES\n end", "def _field_types\n special_attribute('@fieldTypes'.freeze)\n end", "def get_data_types(table_name) \r\n data_types = get_info(table_name, 'type')\r\n data_types.shift\r\n ...
[ "0.6799591", "0.67610574", "0.6511534", "0.63403887", "0.61657685", "0.6136656", "0.611501", "0.611501", "0.611501", "0.611501", "0.611501", "0.60449445", "0.60053843", "0.5989465", "0.5917432", "0.59011006", "0.5876071", "0.58576053", "0.58176655", "0.58147615", "0.5796241",...
0.77634907
0
method VOID InitFromDB BSTR connect_string [IN] BSTR sign_file [IN]
def InitFromDB(connect_string, sign_file) @ole._invoke(2, [connect_string.to_s, sign_file.to_s], [VT_BSTR, VT_BSTR]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectDB\n \t#config = YAML.load_file( '/home/ubuntu/DB-Performance-Testing/config/db.yml' )['DB2']\n config = YAML.load_file( @@path + '../config/db.yml' )['DB2']\n\t cstring = \"DATABASE=#{config['db']};HOSTNAME=#{config['hostname']};\"\n\t cstring += \"PORT=#{config['port']};PROTOCOL=#{config['protoc...
[ "0.5726331", "0.5648962", "0.56310046", "0.5499357", "0.547861", "0.54403406", "0.53738", "0.5352295", "0.5232211", "0.5213686", "0.517279", "0.51517624", "0.51390773", "0.51358294", "0.51123565", "0.5102164", "0.50885046", "0.5054825", "0.5029026", "0.4986532", "0.49854192",...
0.88628525
0
method VOID AddTable BSTR table_name [IN] BSTR fieldl_list [IN] UI8 rev [IN]
def AddTable(table_name, fieldl_list, rev) @ole._invoke(3, [table_name, fieldl_list, rev], [VT_BSTR, VT_BSTR, VT_UI8]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'rec...
[ "0.58578384", "0.57273394", "0.56742543", "0.56436855", "0.5557421", "0.5339407", "0.53363246", "0.5323291", "0.5259798", "0.5207484", "0.5120955", "0.51032853", "0.5077215", "0.5076124", "0.5075996", "0.5035321", "0.5016633", "0.50124526", "0.49928674", "0.4967529", "0.49513...
0.8689499
0
method VOID DeleteTable BSTR table_name [IN]
def DeleteTable(table_name) @ole._invoke(6, [table_name], [VT_BSTR]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_table(table_name)\n data.delete(table_name)\n end", "def delete_table(table_id); delete(\"tables/#{table_id}\"); nil; end", "def delete_table(table_name, options = {})\n call(:delete, table_uri(table_name, new_query(options)), nil, {}, options)\n nil\n end", "def del...
[ "0.7299873", "0.71036893", "0.6715944", "0.6694613", "0.66836065", "0.66702795", "0.66479427", "0.66307825", "0.654737", "0.6479002", "0.6451591", "0.6405977", "0.63856304", "0.6374666", "0.6373445", "0.6284078", "0.62431055", "0.6170705", "0.6090456", "0.59508896", "0.594634...
0.84492385
0
HRESULT GetScheme OLE_HANDLE p_val [OUT]
def GetScheme(p_val) keep_lastargs @ole._invoke(1610678272, [p_val], [VT_BYREF|VT_BYREF|VT_DISPATCH]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preferred_handle\n @preferred_handle\n end", "def get_module_handle(name)\r\n name = name.to_utf16\r\n r = CALLS[\"kernel32!GetModuleHandleW:P=L\"].call(name)\r\n raise WinX.new(:get_module_handle) if r == 0\r\n return r\r\n end", "def scheme\n fetch(:@scheme) { |gri...
[ "0.53328526", "0.5298273", "0.5107216", "0.5039706", "0.5026553", "0.49005103", "0.48974183", "0.48256886", "0.4799788", "0.47979712", "0.47945005", "0.47945005", "0.47945005", "0.47945005", "0.47945005", "0.47945005", "0.4754028", "0.47265396", "0.47236916", "0.47185704", "0...
0.69123626
1
Test 2: One Article Inline Comment
def test02_pre_open_news_ArticleOneComment_TC_24319 login $user_1_email, $master_password $browser.goto($patch_news_pre_open_article) commentPopSubmit "Test Comment #{random}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02_post_open_news_ArticleOneComment_TC_24319\n\t\tlogin $user_1_email, $master_password\n\t\t$browser.goto($patch_news_post_open_article)\n\t\t\n\t\tcommentPopSubmit \"Test Comment #{random}\"\n\tend", "def test02_ArticleOneComment_TC_24319\n\t\tcommentArticlePop\n\t\tcommentPopSubmit\n\tend", "def tes...
[ "0.66943264", "0.6682266", "0.66816217", "0.659874", "0.65529126", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", "0.6497013", ...
0.6703946
0
Test 5: Two Note Inline Comments
def test05_pre_open_news_NoteTwoComments_TC_24319 login $user_1_email, $master_password $browser.goto($patch_news_pre_open_note) commentPopSubmit "Test Comment #{random}" commentPopSubmit "Test Comment #{random}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test05_NoteTwoComments_TC_24319\n\t\tcommentNotePop\n\t\tcommentPopSubmit\n\tend", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def wine_comment\n end", "def verify_comment(line) \n end", "def comment?; end", "def comment?;...
[ "0.6783382", "0.6782127", "0.6782127", "0.6782127", "0.6782127", "0.6615517", "0.65507627", "0.6537345", "0.6537345", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", "0.653436", ...
0.65037864
27
Replace this with your real tests.
def test_truth assert true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188"...
0.0
-1
Authenticate with the DFA soap service.
def authenticate(username = nil, password = nil) @username = username @password = password response = self.request('login', :authenticate, {username: @username, password: @password}) @token = response[:token] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(username, password)\n\n @username = username\n @password = password\n\n auth_request = if on_premise?\n build_on_premise_request(username, password, region, login_url)\n else\n build_ocp_request(username, password, region, login_url)\n end\n\n soap_respo...
[ "0.62457883", "0.62123203", "0.6212181", "0.6189247", "0.61736435", "0.6054974", "0.5990756", "0.5990083", "0.59677", "0.5942259", "0.586069", "0.5828553", "0.5828356", "0.58092326", "0.5804881", "0.57999504", "0.57982385", "0.57927036", "0.5734859", "0.57306033", "0.57163095...
0.0
-1
Do we have a token?
def connected? @token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token?\n @token && !@token.empty?\n end", "def token?(token)\n return false\n end", "def token?\n (@token.respond_to?(:empty?) && !@token.empty?)\n end", "def valid_token?(token)\n exists?(:token => token)\n end", "def has_token?\n api.has_token?\n en...
[ "0.87127167", "0.86704344", "0.8662234", "0.84839636", "0.8322765", "0.8239397", "0.8183536", "0.8025764", "0.79567707", "0.79110366", "0.7886102", "0.774635", "0.76572514", "0.7645463", "0.7579426", "0.7563162", "0.746515", "0.746515", "0.746515", "0.746515", "0.746515", "...
0.72711855
37
Make a request to the DFA API.
def request(endpoint = '', method='', params = {}, raw = false) client = Savon.client(wsdl: "#{@baseurl}#{endpoint}?wsdl") do |locals| locals.wsse_auth(@username, @token) if @token end @last_response = client.call(method, message: params) # Return data or handle exceptions. @last_response.suc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request(path, options={})\n response = @connection.get do |req|\n req.url path\n req.params[:api_key] = @access_token\n options.each do |key, val|\n req.params[key] = val\n end\n end\n response.body\n end", "def request\n http_segments = @segments...
[ "0.60224473", "0.58534634", "0.5761419", "0.57603514", "0.5736361", "0.5703658", "0.568292", "0.56744665", "0.5646923", "0.5641191", "0.56202036", "0.5568507", "0.5554935", "0.55249107", "0.547923", "0.54741454", "0.54654396", "0.5462909", "0.5450476", "0.5441943", "0.5438072...
0.0
-1
Handle soap and http errors.
def error(response) throw response.http_error? ? response.http_error : response.soap_fault end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_errors(response)\n if response.soap_fault?\n exception = exception_for_soap_fault(response)\n raise exception\n end\n if response.http_error?\n raise AdsCommon::Errors::HttpError,\n \"HTTP Error occurred: %s\" % response.http_error\n end\n end", "...
[ "0.75328434", "0.7441451", "0.689251", "0.6522873", "0.62533003", "0.6215528", "0.6175053", "0.6175053", "0.6153356", "0.6082971", "0.6075285", "0.6067682", "0.5998957", "0.59354204", "0.59120184", "0.58664405", "0.58455366", "0.5842239", "0.5807312", "0.58061653", "0.5782995...
0.69713646
2
GET /ecoles GET /ecoles.json
def index @ecoles = Ecole.all.page(params[:page]) @ecole = Ecole.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @equipos = Equipo.all\n render json: @equipos, status: :ok\n end", "def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ei...
[ "0.7132032", "0.65377784", "0.6469496", "0.64293706", "0.6293075", "0.625683", "0.6254668", "0.62539893", "0.6252386", "0.6249393", "0.6245361", "0.6226851", "0.62251943", "0.6222013", "0.62105787", "0.62094784", "0.62094784", "0.6196359", "0.6193517", "0.61883444", "0.618656...
0.66411775
1
GET /ecoles/1 GET /ecoles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @ecoles = Ecole.all.page(params[:page])\n @ecole = Ecole.new\n end", "def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =...
[ "0.66659397", "0.6552463", "0.65479046", "0.6432982", "0.6432516", "0.64093584", "0.637202", "0.6347408", "0.63268614", "0.6286037", "0.62711084", "0.62650627", "0.626266", "0.624721", "0.62422305", "0.62405694", "0.62322193", "0.61955625", "0.6167588", "0.61553234", "0.61521...
0.0
-1
POST /ecoles POST /ecoles.json
def create if Admin? @ecole = current_user.ecoles.new(ecole_params) respond_to do |format| if @ecole.save format.html { redirect_to ecoles_url, notice: 'Ecole was successfully created.' } format.json { render :show, status: :created, location: @ecole } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |form...
[ "0.65463454", "0.6499968", "0.63564605", "0.6188707", "0.61485237", "0.61377895", "0.613677", "0.6123448", "0.599641", "0.59949243", "0.5978919", "0.5978099", "0.59534", "0.5910534", "0.59034157", "0.5900297", "0.58757627", "0.5875714", "0.5861294", "0.5849515", "0.58459806",...
0.57120126
36
PATCH/PUT /ecoles/1 PATCH/PUT /ecoles/1.json
def update respond_to do |format| if @ecole.update(ecole_params) format.html { redirect_to ecoles_url, notice: 'Ecole was successfully updated.' } format.json { render :show, status: :ok, location: @ecole } else format.html { render :edit } format.json { render json: @eco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # ...
[ "0.65011436", "0.6226112", "0.62249166", "0.62041074", "0.61998814", "0.61998814", "0.61593854", "0.61355364", "0.6114838", "0.6103908", "0.60888505", "0.6086216", "0.6070097", "0.60416037", "0.60330594", "0.60199386", "0.60198516", "0.6017423", "0.6010216", "0.60058177", "0....
0.6603896
0
DELETE /ecoles/1 DELETE /ecoles/1.json
def destroy @ecole.destroy respond_to do |format| format.html { redirect_to ecoles_url, notice: 'Ecole was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n ...
[ "0.70926136", "0.67970544", "0.67746234", "0.6765759", "0.67465615", "0.6742435", "0.67130816", "0.66951776", "0.6687186", "0.6686021", "0.66846716", "0.6684336", "0.6682517", "0.6674972", "0.66541654", "0.66537505", "0.6640116", "0.66268647", "0.6623868", "0.662364", "0.6623...
0.716053
0
Use callbacks to share common setup or constraints between actions.
def set_ecole @ecole = Ecole.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ecole_params params.require(:ecole).permit(:libelle, :image, :etat, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
human readable description of modeling approach
def modeler_description return "OS Version of HVACTemplate:System:PackagedVAV. Input values in this measure will generate Packaged VAV system. Another template measure HVACTemplate:Zone:VAV, or HVACTemplate:Zone:VAV:FanPowered, or HVACTemplate:Zone:VAV:HeatAndCool should be applied after applying this measure. " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end", "def modeler_description\n return \"Example use case is adding special loads like an elevator to a model as part of an analysis workflow\"\n end", "def m...
[ "0.7710149", "0.76145315", "0.75934714", "0.74018747", "0.7299891", "0.7296635", "0.727943", "0.71912926", "0.71912926", "0.7191264", "0.7100944", "0.70977926", "0.70629936", "0.7045383", "0.7044268", "0.70413125", "0.7040473", "0.7032938", "0.70267737", "0.70182866", "0.6987...
0.0
-1
define the arguments that the user will input
def arguments(model) args = OpenStudio::Ruleset::OSArgumentVector.new # the name of the space to add to the model system_name = OpenStudio::Ruleset::OSArgument.makeStringArgument("system_name", true) #Do we need to call this air loop name instead of system name? system_name.setDisplayName("New system n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arguments; end", "def arguments; end", "def arguments; end", "def arguments\n \"\"\n end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end", "def args; end...
[ "0.73753476", "0.73753476", "0.73753476", "0.70890766", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301", "0.7008301",...
0.0
-1
define what happens when the measure is run
def run(model, runner, user_arguments) super(model, runner, user_arguments) # use the built-in error checking if !runner.validateUserArguments(arguments(model), user_arguments) return false end # assign the user inputs to variables system_name = runner.getStringArgumentValue("system_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure; end", "def measure=(_arg0); end", "def measure\n\t\t1\n\tend", "def measure(*args, &b)\n end", "def communicate_measure_result(_ = nil, _ = nil); end", "def communicate_measure_result(_ = nil, _ = nil); end", "def called\n self.measurement.called\n end", "def measure\n ...
[ "0.79855496", "0.76400995", "0.76367414", "0.71709776", "0.66934615", "0.66934615", "0.667237", "0.663209", "0.65998226", "0.6589019", "0.65327746", "0.6483336", "0.6406444", "0.64016944", "0.63334644", "0.6284153", "0.6284153", "0.6284153", "0.628078", "0.6267355", "0.624199...
0.0
-1
Add the newly created app to the network specified in the constuctor's `apps_network_id`
def add_to_apps_network visit "#{TestChamber.target_url}/dashboard/tools/apps_network_association/#{apps_network_id}" fill_in('app_ids', :with => id) click_button('Add') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_apps_network\n raise \"This method can only be called if apps_network_id is set\" unless apps_network_id\n visit \"#{TestChamber.target_url}/dashboard/tools/apps_network_association/#{apps_network_id}\"\n fill_in('app_ids', :with => id)\n click_button('Add')\n end", "d...
[ "0.81426", "0.7048062", "0.6537098", "0.61542284", "0.5947802", "0.5941517", "0.5923152", "0.5762364", "0.5678733", "0.56532663", "0.565277", "0.56431454", "0.5582596", "0.55809045", "0.5572901", "0.55331147", "0.5512837", "0.55083674", "0.54866004", "0.5443178", "0.5424971",...
0.7933112
1
GET /songs GET /songs.json
def index @songs = Song.all @song = Song.new respond_to do |format| format.html # index.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def songs\n \t@songs = Album.find(params[:id])\n songs = RSpotify::Track.search(@songs.name)\n \t@songs = songs.map do |s_songs|\n \tSong.new_from_spotify_song(s_songs)\n end\n render json: {data:@songs}\n end", "def index\n \n @songs = Song.order 'id'\n\n respond_to do |format|\n f...
[ "0.8023557", "0.772287", "0.7639002", "0.7577367", "0.7519796", "0.7518334", "0.74522924", "0.74318486", "0.7406608", "0.7387082", "0.7190135", "0.7173719", "0.7173719", "0.7173719", "0.7173719", "0.7109256", "0.70980364", "0.70968103", "0.7045383", "0.7045383", "0.7045383", ...
0.65070516
89
GET /songs/1 GET /songs/1.json
def show @song = Song.find(params[:id]) respond_to do |format| format.html # show.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @song = Song.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @song }\n end\n end", "def getSong\n\t\tid = params[:songId]\n\t\tresult = GetSongFromSpotify.build.call(id)\n\t\trender json: result\n\tend", "def show\n @song = Song.find(params[:id])\n\n re...
[ "0.7938354", "0.7895859", "0.7706705", "0.7706705", "0.7706705", "0.7706705", "0.76346755", "0.7571089", "0.75562555", "0.75397277", "0.7520489", "0.7483983", "0.74218845", "0.7320445", "0.7221914", "0.7221914", "0.71899533", "0.7179004", "0.7111133", "0.7081457", "0.70678484...
0.6858209
34
GET /songs/new GET /songs/new.json
def new @song = Song.new respond_to do |format| format.html # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @song = @playlist.songs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n end", "def new\n @song = Song.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song }\n end\n ...
[ "0.82548463", "0.8149559", "0.8149559", "0.8149559", "0.8149559", "0.8064257", "0.8064257", "0.76893467", "0.7658273", "0.75979596", "0.75979596", "0.7502496", "0.7478078", "0.7465487", "0.7438949", "0.7436724", "0.7409202", "0.74078274", "0.74078274", "0.74078274", "0.740626...
0.73255026
27
POST /songs POST /songs.json
def create @song = Song.new(params[:song]) @song.requester = current_user if !PlaylistRole.playlist_member_or_creator?(@song.playlist_id, current_user) redirect_to playlist_path(@song.playlist_id), notice: 'Must join playlist before you can add a song' return end respond_to do |format|...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\tparams = song_params\n\t\tsongkey = params['song_key']\n\t\tparams.delete('song_key')\n\n songtags = params['tags']\n params.delete('tags')\n\n\t\t@song = Song.new(params)\n\n\t\trespond_to do |format|\n\t\t\tif @song.save\n\n\t\t\t\tif songkey.to_s.length > 0\n\t\t\t\t\t@song.song_ke...
[ "0.7317642", "0.7306261", "0.72927094", "0.722913", "0.7216716", "0.7178553", "0.7174498", "0.7174498", "0.71243626", "0.71243626", "0.71243626", "0.70965916", "0.7070521", "0.7064345", "0.7047276", "0.70400494", "0.7028956", "0.70153564", "0.69714177", "0.69509834", "0.69507...
0.0
-1
PUT /songs/1 PUT /songs/1.json
def update @song = Song.find(params[:id]) respond_to do |format| if @song.update_attributes(params[:song]) format.html { redirect_to @song, notice: 'Song was successfully updated.' } else format.html { render action: "edit" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n#require 'logger'\n\n\t\tparams = song_params\n\t\tsongkey = params['song_key']\n\t\tparams.delete('song_key')\n\n songtags = params['tags']\n params.delete('tags')\n\n\t\trespond_to do |format|\n\t\t\tif @song.update(params)\n\n\t\t\t\tif songkey.to_s.length > 0\n\t\t\t\t\t@song.song_key...
[ "0.7389037", "0.7367655", "0.7314861", "0.72749823", "0.7272344", "0.7270997", "0.7207542", "0.7193947", "0.71894085", "0.7180984", "0.7180984", "0.7180984", "0.7145284", "0.7134241", "0.7128344", "0.71237797", "0.7107259", "0.7107259", "0.7107259", "0.7107259", "0.7107259", ...
0.68214566
34
DELETE /songs/1 DELETE /songs/1.json
def destroy @song = Song.find(params[:id]) @song.destroy respond_to do |format| format.html { redirect_to songs_url } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { redirect_to songs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @song = Song.find(params[:id])\n @song.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.7993327", "0.79589206", "0.79589206", "0.79589206", "0.79589206", "0.79589206", "0.79589206", "0.7946083", "0.787302", "0.787302", "0.787302", "0.787302", "0.787302", "0.787302", "0.787302", "0.77754766", "0.77688175", "0.7692386", "0.76777565", "0.76777565", "0.76777565",...
0.7617773
38
GET /quants GET /quants.xml
def index @quants = Quant.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @quants } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @quay = Quay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quay }\n end\n end", "def index\n @qxes = Qx.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @qxes }\...
[ "0.6450468", "0.61971545", "0.61704105", "0.61542064", "0.6063715", "0.59908736", "0.5967399", "0.5831651", "0.5825206", "0.58064413", "0.57854074", "0.57414806", "0.5728477", "0.5667282", "0.5652612", "0.5634595", "0.5629546", "0.5626242", "0.5615393", "0.56122863", "0.56096...
0.6866132
0
GET /quants/1 GET /quants/1.xml
def show @quant = Quant.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @quant } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @quants = Quant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quants }\n end\n end", "def show\n @quay = Quay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @...
[ "0.66127414", "0.6487867", "0.630534", "0.6234899", "0.6119007", "0.61188924", "0.6110749", "0.61102295", "0.6067244", "0.6051479", "0.6033801", "0.6014323", "0.5975375", "0.5918683", "0.5909555", "0.5877189", "0.58753484", "0.58013815", "0.5801192", "0.57989764", "0.5797158"...
0.5674526
32
GET /quants/new GET /quants/new.xml
def new @quant = Quant.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @quant } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @quay = Quay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quay }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest }\n end\n end...
[ "0.72011715", "0.7065887", "0.69196016", "0.6849515", "0.68277216", "0.682463", "0.6814312", "0.6814312", "0.67813456", "0.6753389", "0.6741945", "0.6702093", "0.6679831", "0.66652334", "0.6654355", "0.6640369", "0.663926", "0.663926", "0.663926", "0.66091007", "0.65928286", ...
0.65523905
26
POST /quants POST /quants.xml
def create @quant = Quant.new(params[:quant]) respond_to do |format| if @quant.save flash[:notice] = 'Quant was successfully created.' format.html { redirect_to(@quant) } format.xml { render :xml => @quant, :status => :created, :location => @quant } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_query( xml )\n url = URI.parse( self.url )\n response = self.http.post_form( url, { \"query\" => xml } )\n return response.body\n end", "def create\n @quay = Quay.new(params[:quay])\n\n respond_to do |format|\n if @quay.save\n flash[:notice] = 'Quay was successfully created.'...
[ "0.660033", "0.5921385", "0.58905035", "0.58616245", "0.57456166", "0.56707835", "0.56287813", "0.5502512", "0.5490937", "0.54818344", "0.5462369", "0.5462369", "0.5456477", "0.5454393", "0.54117405", "0.5378357", "0.53754145", "0.5353301", "0.5335372", "0.5284586", "0.528156...
0.0
-1
PUT /quants/1 PUT /quants/1.xml
def update @quant = Quant.find(params[:id]) respond_to do |format| if @quant.update_attributes(params[:quant]) flash[:notice] = 'Quant was successfully updated.' format.html { redirect_to(@quant) } format.xml { head :ok } else format.html { render :action => "edit" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def res...
[ "0.6505637", "0.6419208", "0.6019965", "0.59945804", "0.5972309", "0.58569306", "0.57503986", "0.57393306", "0.57360774", "0.5728598", "0.57151103", "0.5698726", "0.5637649", "0.5618719", "0.5587714", "0.55772406", "0.5555214", "0.5555214", "0.55432755", "0.55353516", "0.5522...
0.0
-1
DELETE /quants/1 DELETE /quants/1.xml
def destroy @quant = Quant.find(params[:id]) goal_id = @quant.goal.id @quant.destroy respond_to do |format| format.html { redirect_to('/goals#tab_1_5_' + goal_id.to_s) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response ...
[ "0.66676635", "0.666037", "0.66364366", "0.6565036", "0.65174973", "0.64253986", "0.64150715", "0.6378695", "0.63607615", "0.62892413", "0.62892413", "0.6272744", "0.6272651", "0.6239382", "0.62370133", "0.62178653", "0.62063766", "0.6199897", "0.61926645", "0.6174214", "0.61...
0.0
-1
a method that takes a number and returns this number of stories related to this interest
def get_stories(stories_number=10) # querying the related stories to the passed interest and take only the number given in the method self.stories [0..stories_number-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_interest_rank\n \n rank = (self.stories.count * 2) + (self.adding_users.count * 5)\n\n end", "def num_stories\n return @num_stories_above_grade + @num_stories_below_grade\n end", "def number\n lecture.lessons.index(self) + 1\n end", "def sheep_count(num)\n \nend", "def number\n ...
[ "0.69943017", "0.6595104", "0.63540465", "0.6334708", "0.6231228", "0.5877598", "0.5849836", "0.5830379", "0.58189446", "0.57607955", "0.57523274", "0.57497895", "0.57462454", "0.57275397", "0.56979007", "0.566856", "0.565326", "0.5649096", "0.56489825", "0.56405294", "0.5638...
0.74234825
1
def search_result_content_with_initialize search_result_content_without_initialize || build_search_result_content end
def search_result_domain if s = super s else domain = SitescanCommon::SearchResultDomain .find_or_create_by domain: URI(link).host # search_result_domain= domain self.search_result_domain_id = domain.id save super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_search_data(cond_wheather)\n @search_query = \"\"\n\n\n end", "def create_search_if_required\n @search ||= Search.find_or_create_by(query: query)\n end", "def construct_if_found(results)\n unless results.blank?\n new(results)\n else\n nil\n ...
[ "0.62538314", "0.62406385", "0.62376225", "0.6131279", "0.6076156", "0.6054315", "0.6007851", "0.5645554", "0.56356305", "0.5581764", "0.55335957", "0.5530387", "0.5523053", "0.5523037", "0.55219984", "0.5510167", "0.5496411", "0.54963523", "0.54958", "0.54827124", "0.5474211...
0.0
-1
Update link of the instance. If link with new value exist and tied to product then remove the instance, if exist but not tied then remove existed link. url new value of link. Return true if link updated, false if instance removed.
def update_link # if save # true # else sr_clone = SitescanCommon::SearchResult.includes(:search_product) .references(:search_product).where.not(id: id).find_by_link link if sr_clone if search_product and search_product.product sr_clone.destroy ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_link(from,to,tag)\n link = JiakLink.new(to.jiak.object.bucket, to.jiak.object.key, tag)\n has_link = from.jiak.object.links.include?(link)\n if has_link\n from.jiak.object.links.delete(link)\n if(from.auto_update? ||\n ((from.auto_update? != false) && f...
[ "0.6127848", "0.59137654", "0.58695525", "0.5757788", "0.5727092", "0.5648583", "0.56459504", "0.5589651", "0.5529937", "0.5512131", "0.5488217", "0.5437415", "0.5436342", "0.5428455", "0.54121035", "0.5396627", "0.5374484", "0.536522", "0.5349111", "0.5328304", "0.5317114", ...
0.7133939
0
setup http connection for sending async incoming webhook messages to slack
def setup_incoming_webhook @uri = URI.parse "https://#{@options['team']}.slack.com/services/hooks/incoming-webhook?token=#{@options['incoming_token']}" @http = Net::HTTP.new(@uri.host, @uri.port) @http.use_ssl = true @http.verify_mode = OpenSSL::SSL::VERIFY_PEER end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n \n # Setup Slack\n Slack.configure do |config|\n config.token = ENV['SLACK_TOKEN']\n if not config.token\n puts('Missing ENV[SLACK_TOKEN]! Exiting program')\n exit\n end\n end\n @client = Slack::RealTime::Client.new\n @client.on :hello do\n puts(\"Connected '#{@client.self['...
[ "0.63648623", "0.6242691", "0.6122607", "0.6108998", "0.60154784", "0.60059667", "0.5879933", "0.58472645", "0.5839615", "0.58122146", "0.5756", "0.573161", "0.5705067", "0.5700823", "0.5697459", "0.5645002", "0.5639215", "0.56089574", "0.55791163", "0.5554125", "0.5536783", ...
0.6972243
0
format to send text to incoming webhook
def encode_payload(text, options = {}) payload = { text: text, username: @options['name'], channel: @options['channel'].gsub(/^#?/, '#'), # ensure channel begins with # }.merge(options) "payload=#{payload.to_json.to_s}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webhook\n\t\t# 學說話\n\t\tbegin\n\t\t\treply_text = command_trigger(channel_id, received_text)\n\t\trescue\n\t\t\tnil\n\t\tend\n\t\t# 關鍵字回覆\n\t\treply_text = keyword_reply(channel_id, received_text) if reply_text.nil?\n\n\t\t# 傳送訊息到 line\n\t\tresponse = reply_to_line(reply_text)\n\n\t\t# 回應 200\n\t\thead :ok\n\t...
[ "0.65249306", "0.625394", "0.6209739", "0.6198142", "0.6181222", "0.59697455", "0.5957709", "0.59455174", "0.59410334", "0.5933643", "0.5908698", "0.5873075", "0.5846781", "0.5846781", "0.5785456", "0.57227945", "0.57205886", "0.5680789", "0.56723195", "0.5663887", "0.5662637...
0.5427009
51
send text to slack using incoming webhook
def say(text, options = {}) request = Net::HTTP::Post.new(@uri.request_uri) request.body = encode_payload(text, options) response = @http.request(request) return nil # so as not to trigger text in outgoing webhook reply end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webhook\n\t\t# 學說話\n\t\tbegin\n\t\t\treply_text = command_trigger(channel_id, received_text)\n\t\trescue\n\t\t\tnil\n\t\tend\n\t\t# 關鍵字回覆\n\t\treply_text = keyword_reply(channel_id, received_text) if reply_text.nil?\n\n\t\t# 傳送訊息到 line\n\t\tresponse = reply_to_line(reply_text)\n\n\t\t# 回應 200\n\t\thead :ok\n\t...
[ "0.77566934", "0.7375418", "0.7115238", "0.70448065", "0.70063967", "0.69933856", "0.69049364", "0.6680046", "0.6668113", "0.6656939", "0.66543144", "0.6595854", "0.6536746", "0.6526743", "0.64968204", "0.6414162", "0.6409804", "0.63898975", "0.63780254", "0.6376551", "0.6343...
0.67975205
7
add regex to things to hear
def hear(regex, &block) @regexes[regex] = block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regexps; end", "def extended_regexps!\n @hsh = self.class.er(@hsh)\n end", "def re; end", "def pre_match() end", "def regexp; end", "def regexp; end", "def regexp=(_arg0); end", "def regex(_obj)\n raise NotImplementedError\n end", "def pattern2regex(pattern); end", "def make_regex...
[ "0.7214663", "0.6883061", "0.6776491", "0.6629918", "0.6614973", "0.6614973", "0.6380086", "0.6292892", "0.62322843", "0.6222911", "0.62190634", "0.61940706", "0.61550176", "0.6122736", "0.6102187", "0.60888726", "0.60888726", "0.60888726", "0.6014837", "0.59980893", "0.59980...
0.7118861
1
pass list of files containing hear statements, to be opened and evaled
def eval_scripts(*files) files.flatten.each do |file| self.instance_eval File.open(file).read end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_exec_list(filename)\n file = File.open filename\n @exec_list = []\n file.each { |pcb| @exec_list << pcb.split.map(&:to_i) } unless file.nil?\n @exec_object = @exec_list.each_with_index\n @feedback = \"\"\n filename\n end", "def fls(file)\n end", "def file!\n @file_list = @file_...
[ "0.59316313", "0.5726406", "0.57109874", "0.56045634", "0.5604441", "0.55761254", "0.55761254", "0.5510453", "0.5484437", "0.5438666", "0.5432949", "0.5432949", "0.5432949", "0.5432949", "0.5432949", "0.5432949", "0.54291123", "0.53955007", "0.53759754", "0.5361238", "0.53612...
0.4904932
81
check message and run blocks for any matches
def handle_item(msg) return nil unless @options['outgoing_token'].include? msg[:token] # ensure messages are for us from slack return nil if msg[:user_name] == 'slackbot' # do not reply to self return nil unless msg[:text].is_a?(String) # skip empty messages ## loop things to look for and coll...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(message)\n @block ? @block.call(message) : true\n end", "def perform_match message\n return false if reject_not_ack(message)\n return false unless type_match?(message)\n #@notifier.log \"#{identifier}: Looking at #{message.type} #{message.m_id_short}\", level: :collect\n ...
[ "0.77140605", "0.755916", "0.6149631", "0.6147704", "0.61062115", "0.604226", "0.60315776", "0.60285115", "0.592857", "0.5911583", "0.5851567", "0.5820135", "0.5813865", "0.58132684", "0.57630396", "0.5739213", "0.571271", "0.5706596", "0.5703644", "0.56510365", "0.56322527",...
0.5355976
50
Odin project map method takes a proc or a proc and a block
def my_map(p = nil) if p.class == Proc arr = [] self.my_each {|e| arr.push(p.call(e)) } unless p == nil if p !=nil and block_given? self.my_each {|e| arr.push(yield(e)) } end arr end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map( &proc ) # this is a wrapper, which saves the given block\n\t\ttraverse( proc )\n\tend", "def map(&block)\n mapper.instance_eval(&block)\n end", "def my_map_proc_block(my_proc = nil, &my_block)\n my_block = my_proc || my_block\n\n mapped_array = []\n index = 0\n while index ...
[ "0.82391095", "0.77142227", "0.76331764", "0.75081193", "0.7500261", "0.72817427", "0.7247451", "0.72403246", "0.72160614", "0.71735847", "0.71176654", "0.71127534", "0.70613194", "0.69871205", "0.6984775", "0.6971599", "0.6971599", "0.6967144", "0.6941505", "0.6930671", "0.6...
0.66292614
42