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
Returns a list of TTS voices available. The list can be filtered by passing a language and/or gender parameter.
def list_voices(options) ListVoices.new(self, options).run end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tts_voices\n if session[:available_tts_voices].nil?\n session[:available_tts_voices] = TtsService.voices\n end\n session[:available_tts_voices]\n end", "def voices\n Say::VOICES\n end", "def get_voice_languages\r\n # Prepare query url.\r\n _query_builder = Configuration.base_ur...
[ "0.6688188", "0.62384295", "0.58254164", "0.5785576", "0.57644695", "0.5721451", "0.5679469", "0.5652299", "0.55730665", "0.54665786", "0.54158", "0.5377029", "0.5376854", "0.5362636", "0.5332814", "0.53048176", "0.5293979", "0.5293681", "0.5279533", "0.5263497", "0.5242881",...
0.57248247
5
Creates a new WebSocket manager for a specific connection with a user on a channel. It will listen for specific events and run their blocks whenever a WebSocket call on that channel comes through. == Params `channel`: The name of the channel `user`: Unique string to ID the user. See the `set_websocket_user` helper. `ws`: The WebSocket promise/reactor/etc whatever keeps it alive for this user. `event_context`: The Padrino application controller's context so that it can access the helpers, mailers, settings, etc. Making it a firstclass citizen as a regular HTTP action is. TODO Review it though, it's probably wrong. `&block`: A block with supported events to manage.
def initialize(channel, user, ws, event_context, &block) @channel = channel @user = user @ws = ws @@connections[@channel] ||= {} @@connections[@channel][@user] = @ws @events = {} @event_context = event_context instance_eval &block if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def websocket(channel, *args, &block)\n get channel, *args do\n # Let some other action try to handle the request if it's not a WebSocket.\n throw :pass unless request.env['rack.hijack']\n\n event_context = self\n ws_channel = params[:channel] || channel\n\n ...
[ "0.7521301", "0.52656215", "0.5228578", "0.51076615", "0.50883335", "0.5045584", "0.50301355", "0.50301355", "0.49879307", "0.49531558", "0.49418673", "0.48933852", "0.48813558", "0.48264095", "0.48108652", "0.48042235", "0.47769427", "0.47707653", "0.47474536", "0.4733113", ...
0.74436915
1
DSL for adding events from the events block
def event(name, &block) @events[name.to_sym] = block if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events(&block)\n events_dsl.call(&block)\n end", "def add_event(&block) #:yield:event\n push Vevent::Maker.make( &block )\n end", "def add_events(new_events); end", "def event(name, &block)\n add_event name, &block\n end", "def map_events!(&ruby_block)\n @events.map! ...
[ "0.79354614", "0.7693673", "0.75068206", "0.7247093", "0.69077146", "0.680567", "0.67019355", "0.6698709", "0.6694136", "0.66770285", "0.66770285", "0.66307545", "0.66307545", "0.655861", "0.6511129", "0.6492126", "0.6463459", "0.64548147", "0.64521664", "0.64521664", "0.6452...
0.6912777
4
Manage the WebSocket's connection being closed.
def on_shutdown logger.debug "Disconnecting user: #{@user} from channel: #{@channel}." @@connections[@channel].delete(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_close(env)\n @subscription.delete if @subscription\n logger.debug \"WebSocket closing connection\"\n end", "def connection_closed\n close\n end", "def connection_closed\n end", "def disconnect\n @on_disconnected.call if @on_disconnected\n @enable_reconnection = false\n @w...
[ "0.7658153", "0.7629711", "0.7546647", "0.7340754", "0.7197017", "0.71931493", "0.7171986", "0.7106153", "0.70312005", "0.69656974", "0.69523925", "0.69388276", "0.6931479", "0.6878083", "0.6871909", "0.6862242", "0.68411446", "0.6840783", "0.68396", "0.6834117", "0.6828966",...
0.0
-1
Broadcast a message to the whole channel. Can be used to access it outside the router's scope, for instance, in a background process.
def broadcast_local(channel, message, except=[]) logger.debug "Broadcasting message on channel: #{channel}. Message:" logger.debug message if @@connections[channel].nil? logger.error "channel not configured: #{channel}" return nil end @@connections[channel].each do |user, ws| next if except.include?(user) write message, ws end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def broadcast(message)\n @channel.default_exchange.publish(message, routing_key: @queue.name)\n end", "def broadcast(msg, cb)\n\n # de-encapsulate\n encap = Base64.urlsafe_decode64 msg['data']\n encap = Marshal.load encap\n name, msg, to, except = encap[:n], encap[:m], encap[:...
[ "0.7809055", "0.7668144", "0.76639956", "0.7263645", "0.72480994", "0.71540576", "0.71540576", "0.69403005", "0.6788194", "0.6774286", "0.67407066", "0.67362595", "0.67119014", "0.6705939", "0.668766", "0.6613549", "0.6575593", "0.65338033", "0.6502564", "0.6499026", "0.64964...
0.70687336
7
Send a message to a user on the channel Can be used to access it outside the router's scope, for instance, in a background process.
def send_message_local(channel, user, message) logger.debug "Sending message: #{message} to user: #{user} on channel: #{channel}. Message" if @@connections[channel].nil? logger.error "channel not configured: #{channel}" return nil end write message, @@connections[channel][user] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message_to(_user, _message, extra_data = {})\n return if _user.id == id # skip send message to self\n Conversation.get_single_conversation(id, _user.id).send_message(id, _message, extra_data)\n end", "def send_channel(message)\n @handler.send_channel message\n end", "def send_channel(me...
[ "0.7350237", "0.7248464", "0.7204313", "0.6990843", "0.6943378", "0.6764888", "0.6735823", "0.6663413", "0.6663135", "0.66064876", "0.6590582", "0.6587917", "0.6576593", "0.6574473", "0.6548996", "0.6541817", "0.6537256", "0.65179205", "0.6429775", "0.64259654", "0.6400243", ...
0.76138085
0
Write a message to the WebSocket. It's a wrapper around the different WS implementations. This has to be implemented for each backend.
def write(message, ws) logger.error "Override the write method on the WebSocket-specific backend." raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def send msg\n return unless @state == :state_inited\n @ws.send msg.to_json\n end", "def write(rawmsg)\r\n @connection.send(rawmsg)\r\n end", ...
[ "0.7113156", "0.67159843", "0.6679712", "0.6613265", "0.654455", "0.65323925", "0.6393641", "0.63804156", "0.6337991", "0.6280694", "0.6270391", "0.62423635", "0.6173154", "0.6124107", "0.61145926", "0.6113891", "0.60559237", "0.60255665", "0.6017627", "0.60154074", "0.598925...
0.84741056
0
set active pubsub impl. there is a 2way handshake because the pubsub impl must be able to forward messages to local websocket connections
def pub_sub=(pub_sub) @@pub_sub = pub_sub @@pub_sub.event_manager = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pubsub_adapter; end", "def pubsub\n @pubsub ||= begin\n PubsubClient.new(@host, @port, @password, @db, @tls).connect\n end\n end", "def pubsub; end", "def pubsub\n @pubsub || @mutex.synchronize { @pubsub ||= config.pubsub_adapter.new(self) }\n end", "def pubsub\n @p...
[ "0.66285837", "0.6360604", "0.62803817", "0.6275696", "0.624635", "0.6146919", "0.59574157", "0.5852769", "0.5768173", "0.57573426", "0.57487154", "0.57423407", "0.56935596", "0.56550705", "0.5653689", "0.56369007", "0.556726", "0.55653524", "0.5546458", "0.5546048", "0.55358...
0.61817014
5
Maintain the connection if ping frames are supported
def on_open(event) logger.debug "Connection openned as user: #{@user} on channel: #{@channel}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alive?; @keepalive; end", "def ping\n check_connection\n @protocol.ping_command\n self\n end", "def ping(body = '')\n if @handler\n @handler.pingable? ? @handler.send_frame(:ping, body) && true : false\n else\n raise WebSocketError, \"Cannot ping before onopen call...
[ "0.676819", "0.6715199", "0.6346016", "0.62696826", "0.6260695", "0.62308466", "0.62231076", "0.6198297", "0.6140466", "0.6140466", "0.613654", "0.6134717", "0.6129745", "0.6117425", "0.61098903", "0.610934", "0.6075376", "0.60733134", "0.6057977", "0.59883434", "0.5979144", ...
0.0
-1
Delete a instance_profile ==== Parameters instance_profile_name: name of the instance_profile to delete ==== Returns response: body: 'RequestId' Id of the request ==== See Also
def delete_instance_profile(instance_profile_name) request( 'Action' => 'DeleteInstanceProfile', 'InstanceProfileName' => instance_profile_name, :parser => Fog::Parsers::AWS::IAM::Basic.new ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_profile(profile_id)\n @type = Type::CIM_DELETE_PROFILE\n handle_profile_id(profile_id)\n make_request\n end", "def delete_profile(sbp_profile, opts = {})\n data, status_code, headers = delete_profile_with_http_info(sbp_profile, opts)\n return data\n end", "def delete_a...
[ "0.68104273", "0.67702913", "0.66600686", "0.64743483", "0.6378168", "0.63749707", "0.63122314", "0.62654126", "0.6261541", "0.6253168", "0.6237787", "0.62262344", "0.62129945", "0.62111855", "0.62111855", "0.62111855", "0.618887", "0.6181621", "0.6181621", "0.6181621", "0.61...
0.86644053
0
Add tag to multiple cache entries
def add(tag, *members) members.each do |element| add_scope(tag, element) if is_scope? element ident = id_for(element) @redis.sadd ident, tag unless ident.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\n end", "def cache_tag_list\n set_cached_tag_list\n save\n end", "def update_cached_tag_lists\n cache_tag_list if tag_list != cached_tag_list\n cache_topic_list if topic_list != cached_topic_list\n cache_user_tag_list if use...
[ "0.7030515", "0.67022294", "0.6460027", "0.63446313", "0.63396883", "0.6320677", "0.6252695", "0.62487495", "0.6217624", "0.6203322", "0.6197295", "0.60839236", "0.6079678", "0.6014012", "0.5967601", "0.59299046", "0.5925999", "0.5925999", "0.58804363", "0.5868776", "0.586095...
0.6191416
11
Get cache entries by given keys. This list is cleaned up after request: page = Page.create store.add('tag_name', page) store.get_scope(p).should == ['tag_name'] store.get_scope(p).should == []
def get(*members) keys = members.map { |tag| id_for(tag) } elements = @redis.sunion(keys) @redis.del(keys) scopes = members.delete_if {|a| not a.is_a? ActiveRecord::Base} elements += get_scope(*scopes) elements.flatten.uniq.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eager_load_keys(keys)\n # Speed up pulls by priming the page's placeholder keys\n end", "def get(keys)\n log(\"get :Cache, #{keys.inspect}\")\n connection.multi_get(:Cache, Array(keys)).values.map { |v| v['blob'] }\n end", "def store\n @by_cache.each{|cache, tags| cache[:tags] = tags }\...
[ "0.6171231", "0.6090769", "0.60565394", "0.5844985", "0.57736546", "0.56383264", "0.55821353", "0.5550793", "0.55476755", "0.5533819", "0.5505672", "0.54664326", "0.5412888", "0.5375794", "0.5352938", "0.53440803", "0.53417003", "0.5340705", "0.5323362", "0.5310546", "0.53032...
0.51028985
40
Creates a new instance of EnvVar, holds information about the ENV in the environment
def initialize(var, message, default=false) @var = var @message = message @default = default set_message_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environment\n @env_vars ||= VARS.reduce({}) do |hash, (key, value)|\n hash.merge(\"#{prefix}_#{value}\" => send(key))\n end.merge(env)\n end", "def set_env\n env = (container[:env] ||= [])\n\n # static data\n metadata = release_doc_metadata\n [:REVISION, :TAG, :DEPLOY_...
[ "0.64201534", "0.6266155", "0.6202656", "0.6182753", "0.6094235", "0.60122216", "0.601043", "0.5973519", "0.5951284", "0.5881462", "0.5861725", "0.5838016", "0.58176005", "0.5788929", "0.5788771", "0.5781957", "0.57783616", "0.57574093", "0.57527596", "0.5749436", "0.57292074...
0.0
-1
The value of the ENV determined by the EnvVar class
def value ENV[@var] || @default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end", "def getEnvVar\n if ENV['ENV'].nil?\n UI.user_error!(\"No 'ENV' environment variable set. Set it using `awsenv` config file. Must contain 'dev', 'qa' or 'prod' in value.\")\n end\n\n env_raw = /(dev|qa|prod)/.match(ENV.fetch('...
[ "0.782392", "0.7687164", "0.7650926", "0.7623559", "0.7510131", "0.7209759", "0.71094596", "0.7107854", "0.7063613", "0.69850737", "0.69560057", "0.69315803", "0.6893067", "0.6893067", "0.6816817", "0.68079424", "0.6804319", "0.6801651", "0.6760852", "0.67570883", "0.6736409"...
0.78060985
1
The formatted message to be displayed to the user
def message if message_level == :error red_text("The ENV #{@var} is required, #{@message}") elsif message_level == :info green_text("The ENV #{@var} was found in the environment with the value #{value}") elsif message_level == :warning yellow_text("WARNING: the ENV #{@var} is not set, proceeding with default value: #{@default}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_message\n \"#{@message} (#{@code})\"\n end", "def format_message\n return @format_message if @format_message\n\n @format_message = self.message.dup\n\n if self.line\n @format_message << \" near line #{self.line}\"\n end\n\n if self.code\n @format_message << \": #{fo...
[ "0.81034374", "0.7613558", "0.73922473", "0.7231758", "0.7222536", "0.72217095", "0.7206125", "0.71208024", "0.7113784", "0.7113784", "0.70790356", "0.6982702", "0.6886427", "0.6886427", "0.68744373", "0.6870681", "0.68704003", "0.68704003", "0.68704003", "0.68704003", "0.687...
0.0
-1
Constructs an array of subprocessors which will be run in sequence A subprocessor needs to respond to run
def prepare_chain chain = [] chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@primary_output) chain << NomenclatureChange::OutputTaxonConceptProcessor.new(@secondary_output) chain << reassignment_processor(@secondary_output) chain << if @primary_output.new_name_status == 'A' linked_names = @secondary_output ? [@secondary_output] : [] NomenclatureChange::StatusUpgradeProcessor.new(@primary_output, linked_names) else accepted_names = @secondary_output ? [@secondary_output] : [] NomenclatureChange::StatusDowngradeProcessor.new(@primary_output, accepted_names) end chain.compact end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_processes(process_array)\n process_repeat(\"start\")\n process_array.each do |thing|\n arr = []\n arr.push(thing)\n p arr\n end\nend", "def initialize\n @processes = []\n end", "def spawn_prospectors(num_prospectors)\r\n prospectors = []\r\n count = 0\r\n while count <= n...
[ "0.6394233", "0.6314811", "0.6013808", "0.59041053", "0.57428575", "0.568003", "0.5501036", "0.54708636", "0.5439377", "0.5427615", "0.5409714", "0.5367058", "0.53598785", "0.53280056", "0.53207296", "0.53060883", "0.5305424", "0.53012353", "0.52772635", "0.5262323", "0.52588...
0.5058405
51
NOTE: this return the ratio of how much money we need to borrow, vs how much the shares actualy cost always between 0 and 1
def lsr # NOTE: force type coersion to decimal [1.0*purchase_price / strike_price, 1].min rescue 1.0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budget_ratio\n budget = self.budget # cache result\n if budget > 0.0\n return ((self.spent / budget) * 100).round \n else\n self.progress\n end\n end", "def balance_owed\n discounted_price - amount_paid\n end", "def net_worth\n result = self.cash_on_hand\n self....
[ "0.73692816", "0.69553894", "0.6926713", "0.6910617", "0.69089544", "0.68797153", "0.68465185", "0.6845059", "0.6835064", "0.6813108", "0.6809357", "0.672189", "0.6717496", "0.67167395", "0.66828847", "0.66785544", "0.6671833", "0.663716", "0.66081405", "0.6605908", "0.658834...
0.0
-1
parse From, To,Cc field
def parse_mailbox_list(str, opt={}) mailbox_list(str, opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_parse_recipients(mail)\n %W(to cc bcc).inject({}) do |acc, header|\n acc[header] = [mail.header[header]].flatten.collect {|address| address.to_s}\n acc\n end\n end", "def parse_mail_from( data )\n mailfrom, esmtp_info = data.split(\"\\0\", 2 )\n return [mailfrom, esmtp...
[ "0.63544047", "0.6060611", "0.6019113", "0.5917161", "0.5663034", "0.56069726", "0.55718815", "0.5532675", "0.5507172", "0.5492961", "0.5479562", "0.54739404", "0.54720247", "0.5455681", "0.54433227", "0.5425053", "0.5355693", "0.5286006", "0.5279845", "0.5258724", "0.5258305...
0.0
-1
parse MessageId, ResentMessageId field
def parse_msg_id(str, opt={}) msg_id_list(str, opt)[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_irc message\n res = message.scan(/\\00314\\[\\[\\00307(.*)\\00314\\]\\]\\0034\\s+(.*)\\00310\\s+\\00302.*(diff|oldid)=([0-9]+)&(oldid|rcid)=([0-9]+)\\s*\\003\\s*\\0035\\*\\003\\s*\\00303(.*)\\003\\s*\\0035\\*\\003\\s*\\((.*)\\)\\s*\\00310(.*)\\003/).first\n #get rid of the diff/oldid and oldid/rc...
[ "0.619594", "0.61856633", "0.6142807", "0.6124912", "0.60433614", "0.59801257", "0.59375364", "0.5931033", "0.5909936", "0.589472", "0.5854622", "0.5722915", "0.5648653", "0.5648207", "0.5639652", "0.5589259", "0.55852807", "0.55289745", "0.55230665", "0.55158055", "0.5499996...
0.6405571
0
parse InReplyTo, References field
def parse_msg_id_list(str, opt={}) msg_id_list(str, opt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def including_replies \n\t\tif content[0] == \"@\"\n\t\t\tat_to_user = content.split(\".\")[0]\n\t\t\tid_number = at_to_user[1, at_to_user.length-1]\n\t\tend\n\tend", "def parse_references\n globbed_references = body.scan(/(.*?\\))/)\n\n globbed_references.each do |reference|\n url = reference.first.s...
[ "0.6266953", "0.6040956", "0.5789856", "0.57829535", "0.5712335", "0.5543342", "0.5504089", "0.5475965", "0.5465805", "0.53894997", "0.53775805", "0.5373613", "0.5342364", "0.5337112", "0.53111774", "0.523274", "0.5230166", "0.5205506", "0.5204087", "0.5181608", "0.51642376",...
0.0
-1
split arry by delim
def split_by(array, delim) ret = [] a = [] array.each do |i| if i == delim then ret << a a = [] else a << i end end ret << a unless a.empty? return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split(parts); end", "def split; end", "def split(separator)\n lambda do |rec, acc|\n acc.replace( acc.flat_map { |v| v.split(separator) } )\n end\n end", "def my_split(array) \n splitted = []\n array.each do |element|\n element.split(//).each { |each_splitted| split...
[ "0.71161866", "0.6887128", "0.6866123", "0.6801286", "0.66401136", "0.65819633", "0.654205", "0.63840145", "0.63062465", "0.62228453", "0.6145481", "0.6130174", "0.6092026", "0.60691285", "0.60691285", "0.6041811", "0.6040097", "0.5961625", "0.595883", "0.593272", "0.5913572"...
0.8154997
0
parse Mailbox type field
def mailbox_list(str, opt) ret = [] split_by(Tokenizer.token(str), ",").each do |m| if a1 = m.index("<") and a2 = m.rindex(">") and a2 > a1 then display_name = m[0..a1-1].join(" ") if opt[:decode_mime_header] then display_name = RFC2047.decode(display_name, opt) end mailaddr = _conv(m[a1+1..a2-1].join, opt) local_part, domain = mailaddr.split(/@/, 2) ret << RFC2822::Mailbox.new(RFC2822::AddrSpec.new(local_part, domain), _conv(display_name, opt)) else local_part, domain = _conv(m.join, opt).split(/@/, 2) ret << RFC2822::Mailbox.new(RFC2822::AddrSpec.new(local_part, domain)) end end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(type = nil)\n MimeType[type || mime_type].decode to_s\n end", "def parse_type(type)\n case type\n when /^int/ then :integer\n when /^tinyint\\(1\\)/ then :boolean\n when /^([^(]+)/ then $1.to_sym\n end\n end", "def parse_field(field)\n ...
[ "0.6518602", "0.60395825", "0.58944607", "0.5853428", "0.5789265", "0.57725185", "0.5759864", "0.57058924", "0.5639655", "0.56317276", "0.5595467", "0.55953366", "0.55453515", "0.55453515", "0.55447584", "0.5528285", "0.5382906", "0.5381062", "0.5362564", "0.5357241", "0.5351...
0.0
-1
parse MsgId type field
def msg_id_list(str, opt={}) ret = [] flag = false msgid = nil Tokenizer.token(str).each do |m| case m when "<" unless flag flag = true msgid = "" end when ">" if flag flag = false ret << RFC2822::MsgId.new(_conv(msgid, opt)) end else msgid << m if flag end end if ret.empty? ret = str.split.map{|s| RFC2822::MsgId.new(_conv(s, opt))} end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_msg_id(str, opt={})\n msg_id_list(str, opt)[0]\n end", "def type_id\n @type_id ||= extract_int(@content[0...TYPE_SIZE])\n end", "def input_id_from_type(type); end", "def decode(msg)\n if(msg.to_s(2).length == 112)\n df, ca, icao, me, pi = self.parse_seg...
[ "0.7056629", "0.6155745", "0.60858446", "0.6053845", "0.6036269", "0.59762734", "0.5974493", "0.5973043", "0.58749616", "0.5753959", "0.5706449", "0.56409395", "0.5599522", "0.55658954", "0.5562248", "0.5536934", "0.55056715", "0.54934233", "0.548099", "0.54713833", "0.546766...
0.55549085
15
tokenize for Received field
def token_received() ret = [] while @ss.rest? do if s = @ss.scan(/[\s]+/) then # ignore blank elsif s = @ss.scan(/\(/) then begin pos = @ss.pos cfws(@ss) rescue ParseError @ss.pos = pos ret.last << s unless ret.empty? end elsif s = @ss.scan(/\"([\s]*(\\[#{TEXT_RE}]|[#{QTEXT_RE}]))*[\s]*\"/o) ret << s elsif s = @ss.scan(/;/) ret << s else ret << @ss.scan(/[^\s\(\;]+/o) end end return ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize ; end", "def tokenize ; end", "def tokenize; end", "def tokenize; end", "def tokenize\n \n end", "def tokenize\n return @value.split(/\\s+/)\n end", "def tokenize\n post(\"token\")[\"token\"]\n end", "def tokenizer_relay_header_event_code\n TokenExtractor.new...
[ "0.7319433", "0.7319433", "0.7290561", "0.7290561", "0.71785444", "0.6737526", "0.6382473", "0.61756134", "0.6037186", "0.60059905", "0.5995347", "0.5979562", "0.5942019", "0.59057504", "0.59057504", "0.59057504", "0.59057504", "0.59057504", "0.59057504", "0.59057504", "0.590...
0.60217416
9
$ ruby example/basic.rb $ ruby example/basic.rb default $ ruby example/basic.rb default index
def index puts "Your name is #{option(:n)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n puts \"\\n******* index *******\"\n end", "def index\n puts \"You chose index!\"\nend", "def index\n puts \"You chose index!\"\nend", "def index ; @index ; end", "def index(options = {})\n system(\"gem generate_index -d #{@path} > /dev/null\")\n # options = {:build_legacy =>...
[ "0.68880755", "0.6663385", "0.6663385", "0.6525344", "0.6388609", "0.6386095", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "0.63853407", "...
0.59761506
86
$ ruby example/basic.rb test $ ruby example/basic.rb default test
def test puts 'This is a test method' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_test; end", "def default_test\r\n end", "def default_test\n end", "def default_test\n end", "def default_test\n end", "def default_test\n end", "def test(arg = nil)\n puts \"test\"\n end", "def run(*args) #:nodoc:\n return if @method_name == \"default_test\"\n ...
[ "0.6992721", "0.69362146", "0.6867656", "0.6758186", "0.67070824", "0.67070824", "0.6491491", "0.63455343", "0.63071436", "0.6235566", "0.60956335", "0.6075451", "0.6058573", "0.5923317", "0.59228843", "0.5885543", "0.5855042", "0.5851417", "0.58375084", "0.5836103", "0.58151...
0.5783119
25
GET /projects GET /projects.json
def index @projects = current_user.projects end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8574897", "0.8386689", "0.8355737", "0.8062607", "0.80368364", "0.8002139", "0.78593457", "0.7834634", "0.78324", "0.7799698", "0.77792805", "0.7748103", "0.77139485", "0.7700251", "0.7696023", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", ...
0.7031996
87
GET /projects/1 GET /projects/1.json
def show unless can?(:view, @project) redirect_to( root_path, notice: "this project has not been shared with you yet. "\ "Please contact its owner: #{@project.user.email}" ) return end redirect_to project_tasks_path(@project) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7869152", "0.7697662", "0.7680833", "0.7612184", "0.7533233", "0.75254804", "0.74929947", "0.74929947", "0.74929947", "0.74929947", "0.74929947", "0.74929947", "0.74929947", "0.7492764", "0.74836385", "0.7479486", "0.74459136", "0.7429542", "0.74227744", "0.7415444", "0.73...
0.0
-1
POST /projects POST /projects.json
def create @project = Project.new(project_params) @project.user = current_user respond_to do |format| if @project.save format.html { redirect_to @project, notice: 'Project was successfully created.' } format.json { render :show, status: :created, location: @project } else format.html { render :new } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338948", "0.73139244", "0.7308003", "0.7299582", "0.7227503", "0.7225945", "0.71982473", "0.71170384", "0.7104803", "0.7095263", "0.7070636", "0.70408624", "0.70358187", "0.7024969", "0.70191896", "0.7009597", "0.698481", "0.697517", "0.6963753", "0.6963096", "0.6948756",...
0.66838706
81
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html { redirect_to @project, notice: 'Project was successfully updated.' } format.json { render :show, status: :ok, location: @project } else format.html { render :edit } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\...
[ "0.7000353", "0.6911607", "0.6911267", "0.6889297", "0.68887025", "0.6878363", "0.68684334", "0.68578774", "0.6853591", "0.6853591", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0.68506134", "0....
0.6600165
96
DELETE /projects/1 DELETE /projects/1.json
def destroy @project.destroy respond_to do |format| format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7704753", "0.7704753", "0.7704753", "0.7704753", "0.7704753...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.find(params[:id] || params[:project_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.6164095", "0.6046031", "0.5945298", "0.59179014", "0.58890367", "0.58341795", "0.5776118", "0.5700777", "0.5700777", "0.5656277", "0.56218207", "0.5423995", "0.5411516", "0.5411516", "0.5411516", "0.5395004", "0.53783494", "0.53593004", "0.53412604", "0.534078", "0.5332865...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def project_params params.require(:project).permit(:name, :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.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /orders GET /orders.json
def index @orders = current_user.orders .where(status: [Order.statuses[:initiated], Order.statuses[:deleted]]) .includes(:items, :supplier) .order(id: :desc) .page(params[:page]) .per(params[:per]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n ...
[ "0.83267236", "0.815406", "0.80041754", "0.7947603", "0.7846487", "0.7823147", "0.78028905", "0.76992875", "0.76980406", "0.7682792", "0.7682792", "0.7682792", "0.7682792", "0.76827645", "0.75880665", "0.7574349", "0.756171", "0.7531827", "0.74860185", "0.7432208", "0.7369724...
0.0
-1
GET /orders/1 GET /orders/1.json
def show if @order.pmo_grab_id.present? pmo_grab = PmoGrab[@order.pmo_grab_id] pmo_item = PmoItem[pmo_grab.pmo_item_id] one_money = OneMoney[@order.one_money_id] @one_more_time = pmo_grab.seeds.any? { |seed| "pending" == seed.status } one_money_type = one_money.try(:type) || "one_money" redirect_url = one_money.try(:publish_url) || "/#{one_money_type}/#{ one_money.start_at.strftime('%Y-%m-%d') }/index.html" @redirect_url = "#{redirect_url}#/detail/#{ pmo_grab.pmo_item_id }" end # @order.items.includes(:orderable) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "def index\n @orders = Order.all\n render json: @orders\n end", "def index\n @orders = Order.all\n render json: @orders, status: 200\n end", "def index\n @orders = Order.order(\"id\").all\n\n resp...
[ "0.7554187", "0.7488565", "0.7475228", "0.73777765", "0.73714006", "0.7341344", "0.73384553", "0.73168725", "0.73018956", "0.7291244", "0.7291244", "0.7291244", "0.7291244", "0.72911215", "0.7281374", "0.7266143", "0.72498786", "0.7228276", "0.7213504", "0.71842283", "0.71261...
0.0
-1
POST /orders POST /orders.json
def create @order = current_user.orders.build(order_params) respond_to do |format| if @order.save_with_items(current_user) format.json { render json: @order, status: :created } format.html { redirect_to @order } else format.html do set_feed_back set_addresses_add_express_fee set_wx_cards flash.now[:error] = @order.errors.full_messages.join(', ') render :confirmation, status: :unprocessable_entity end format.json { render json: @order.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n authenticated_post(\"orders\").body\n end", "def orders\n authenticated_post(\"auth/r/orders\").body\n end", "def create\n order = Order.create(order_params)\n render json: order\nend", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ...
[ "0.75886714", "0.7490972", "0.7488501", "0.74664384", "0.72739846", "0.7195349", "0.7063682", "0.69745994", "0.6910657", "0.68880194", "0.68747663", "0.685004", "0.6840204", "0.6838178", "0.6838178", "0.6838178", "0.6838178", "0.682244", "0.6790037", "0.67793274", "0.6779247"...
0.6408214
75
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
def update respond_to do |format| if @order.update(order_update_params) format.json { head :no_content } format.html do # 一元购收货后跳到评价页面 if @order.wait_for_yiyuan_evaluate? one_money = OneMoney[@order.one_money_id] redirect_url = one_money.try(:publish_url) || "/one_money/#{ one_money.start_at.strftime('%Y-%m-%d') }/index.html" redirect_to "#{redirect_url}#/comment/#{ @order.pmo_grab_id }/#{@order.id}" elsif @order.wait_for_evaluate? redirect_to evaluate_order_path(@order) else redirect_to history_orders_path end end else format.json { render json: @order.errors, status: :unprocessable_entity } format.html { render :show, flash[:now] = @order.errors.full_messages.join(', ') } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte...
[ "0.6803119", "0.6803119", "0.67749745", "0.6743427", "0.67353284", "0.6726928", "0.6723453", "0.6719653", "0.67047364", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", "0.6704673", ...
0.0
-1
DELETE /orders/1 DELETE /orders/1.json
def destroy if @order.cancelable? @order.deleted! # head :no_content flash[:notice] = "订单删除成功!" redirect_to order_path(@order) else # render json: {error: "订单创建已经超过30分钟,不能删除"}, status: :unprocessable_entity flash[:error] = "这个订单不能删除!" redirect_to order_path(@order) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end", "def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\...
[ "0.7592003", "0.7475092", "0.74298924", "0.7371978", "0.7371411", "0.7371187", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7357556", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", "0.7347606", ...
0.0
-1
A tree is balanced if the heights of 2 subtrees are not different by more than 1 for each subtree
def balanced? height do |left_height, right_height| if (left_height - right_height).abs > 1 return false end end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def height_balanced(root)\n return true if root.nil?\n\n left, right = root.left, root.right\n left_depth, right_depth = max_depth(left), max_depth(right)\n\n (left_depth - right_depth) <= 1 &&\n height_balanced(left) &&\n height_balanced(right)\nend", "def is_balanced?\n diff = (self.left.depth - s...
[ "0.74741435", "0.7426273", "0.7340404", "0.7271711", "0.7247461", "0.72183776", "0.72141784", "0.70090353", "0.6995401", "0.6935518", "0.6889814", "0.6810053", "0.6764388", "0.6731263", "0.6533495", "0.64281887", "0.64266235", "0.63675094", "0.6182087", "0.61377376", "0.61187...
0.71399945
7
A binary tree is complete if each depth is filled with nodes from the left to the right
def complete? last_layer = true # If the previous layer had an empty branch each_depth do |layer, depth| return false if !last_layer nil_exists = false # If an empty branch exists at the current layer layer.each do |n| if n.nil? nil_exists = true elsif nil_exists return false end end last_layer = false if nil_exists end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebalance\n @root = build_tree(self.level_order_traversal) if !self.balanced?\n end", "def test_node_starts_with_empty_branches\n node = Node.new(50, \"movie a\")\n refute node.left_node\n refute node.right_node\n end", "def super_balanced(tree)\n if !tree\n return true\n end\n \n dept...
[ "0.6550691", "0.65286005", "0.640638", "0.63666046", "0.6192482", "0.6183272", "0.6176617", "0.6173376", "0.61648524", "0.6118794", "0.60793084", "0.606846", "0.605075", "0.60483074", "0.60252535", "0.6005165", "0.5998269", "0.5996137", "0.5996137", "0.59907246", "0.59865767"...
0.61370414
9
Generate a linked list at each depth of the tree
def linked_list_per_depth list = Array.new(height) each_depth do |layer, depth| n = layer.size - 1 list[depth] = (0..n).reduce(nil) do |acc, i| layer[n-i].nil? ? acc : LinkedList.new(layer[n-i].value, acc) end end list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_level_linked_list (root, lists, level)\n return if root == nil\n\n list = nil\n if lists.length == level\n list = LinkedList.new\n lists.add(list)\n else\n list = lists[level]\n end\n list.append(root)\n create_level_linked_list(root.left, lists, level + 1)\n create_level_linked_list(ro...
[ "0.7124069", "0.68713033", "0.6707763", "0.6515597", "0.6483137", "0.6472083", "0.6458913", "0.64190596", "0.6350964", "0.63065165", "0.6250523", "0.6226193", "0.6196545", "0.6172337", "0.61679", "0.6166736", "0.6152464", "0.6118536", "0.6105435", "0.6080998", "0.6067304", ...
0.75033957
0
A tree is a binary search tree (BST) if for every node, all left nodes have values current node value
def bst? with_values do |left_vals, value, right_vals| left_max, right_min = left_vals.max, right_vals.min return false if (!left_max.nil? && left_max > value) || (!right_min.nil? && right_min <= value) end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_children(value, node)\n if value < node.value\n node.left\n else\n node.right\n end\n end", "def insert(value)\n puts \"Inserting :\" + value.to_s\n current_node = @root\n\n while nil != current_node\n\n if (value < current_node.value) && (current_nod...
[ "0.6768502", "0.67055243", "0.66683453", "0.6664158", "0.6568327", "0.65374655", "0.65172446", "0.6512011", "0.6502012", "0.6495694", "0.64786947", "0.647248", "0.647198", "0.6458613", "0.6429929", "0.6419567", "0.63977766", "0.6396721", "0.6375623", "0.6372493", "0.63710123"...
0.0
-1
Returns a team by team id ==== Attributes +id+ numerical unique id for record +format+ be sure to include an accept header or add ".xml" or ".json" to the last path element +token+ your API Token for authentication ==== Raises ERROR 403 Forbidden When the token is invalid. ERROR 404 Not found When record to show is not found. ==== Examples To test this method, insert this url or your valid API key and application host into a browser or http client like wget or curl. For example: curl i H "accept: text/xml" X GET curl i H "accept: application/json" X GET
def show @team = Team.find(params[:id].to_i) rescue nil respond_to do |format| unless @team.blank? # to provide a version specific and secure representation of an object, wrap it in a presenter format.xml { render :xml => team_presenter } format.json { render :json => team_presenter } else format.xml { head :not_found } format.json { head :not_found } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def team( team_id )\n\n if( team_id.is_a?(String) && team_id.is_a?(Integer) )\n raise ArgumentError.new(format('wrong type. user \\'team_id\\' must be an String (for an Team name) or an Integer (for an Team Id), given \\'%s\\'', team_id.class.to_s))\n end\n raise ArgumentError.new('missing \\...
[ "0.82138854", "0.8035053", "0.76590484", "0.7395419", "0.7320656", "0.719236", "0.71899265", "0.70713925", "0.7031184", "0.6975662", "0.6906697", "0.68999976", "0.6846152", "0.68440145", "0.6825963", "0.6822054", "0.6703831", "0.6698207", "0.66595614", "0.66266406", "0.659610...
0.65765375
25
Soft deletes a team by deactivating them ==== Attributes +id+ numerical unique id for record +format+ be sure to include an accept header or add ".xml" or ".json" to the last path element +token+ your API Token for authentication ==== Raises ERROR 403 Forbidden When the token is invalid. ERROR 404 Not found When no records are found. ==== Examples To test this method, insert this url or your valid API key and application host into a browser or http client like wget or curl. For example: curl i H "accept: text/xml" X DELETE curl i H "accept: application/json" X DELETE
def destroy @team = Team.find(params[:id].to_i) rescue nil respond_to do |format| if @team success = @team.try(:deactivate!) rescue false if success format.xml { head :accepted } format.json { head :accepted } else format.xml { render :xml => team_presenter, :status => :precondition_failed } format.json { render :json => team_presenter, :status => :precondition_failed } end else format.xml { head :not_found } format.json { head :not_found } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_team(id)\n boolean_request :delete, \"/teams/#{id}\"\n end", "def delete(_team)\n # stub\n end", "def destroy\n team_id = params[:id]\n status = OkrTeam.remove_team_from_system(team_id)\n\n respond_to do |format|\n if status == 200\n format.json { ren...
[ "0.72970694", "0.68448937", "0.682987", "0.6720514", "0.6628636", "0.65848327", "0.65537024", "0.65483564", "0.6514772", "0.6508964", "0.650413", "0.64319867", "0.64319867", "0.64319867", "0.64319867", "0.64319867", "0.642338", "0.64201546", "0.6418408", "0.6418294", "0.64048...
0.67823756
3
helper for loading the teams presenter
def teams_presenter @teams_presenter ||= V1::TeamsPresenter.new(@teams, @template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_teams\n tell \"Loading teams...\" unless options.quiet?\n teams = []\n\n doc = Nokogiri::HTML(open(TEAMS_URL))\n div1a = doc.css('div.mod-container > div.span-2').first\n list = div1a.css('div.mod-teams-list-medium ul li')\n \n list.each do |t|\n a_tag = t.search(...
[ "0.7145481", "0.7089743", "0.70566934", "0.69878304", "0.6950763", "0.691396", "0.6826545", "0.6815258", "0.6672639", "0.6492821", "0.64828026", "0.64826024", "0.6469932", "0.64278144", "0.63981336", "0.6393897", "0.63064176", "0.63022566", "0.6295866", "0.62686205", "0.62624...
0.7678389
0
helper for loading the team present
def team_presenter @team_presenter ||= V1::TeamPresenter.new(@team, @template) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_teams\n tell \"Loading teams...\" unless options.quiet?\n teams = []\n\n doc = Nokogiri::HTML(open(TEAMS_URL))\n div1a = doc.css('div.mod-container > div.span-2').first\n list = div1a.css('div.mod-teams-list-medium ul li')\n \n list.each do |t|\n a_tag = t.search(...
[ "0.71425956", "0.6885521", "0.6797997", "0.6764692", "0.67594564", "0.67585826", "0.6742876", "0.6721364", "0.67193705", "0.6657193", "0.66475445", "0.6647078", "0.6630853", "0.65816236", "0.65816236", "0.65816236", "0.65816236", "0.65816236", "0.65816236", "0.65473723", "0.6...
0.0
-1
GET /ctypes GET /ctypes.json
def index @ctypes = Ctype.all respond_to do |format| format.html # index.html.erb format.json { render json: @ctypes } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body...
[ "0.60484743", "0.5878246", "0.5878246", "0.5861013", "0.5861009", "0.5719941", "0.5708777", "0.5671545", "0.55872506", "0.5545338", "0.55024284", "0.54853433", "0.5481184", "0.5477488", "0.547581", "0.54484564", "0.54096764", "0.53995395", "0.53819835", "0.53714323", "0.53505...
0.69982094
0
GET /ctypes/1 GET /ctypes/1.json
def show @ctype = Ctype.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @ctype } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts ...
[ "0.69031554", "0.56774974", "0.5653967", "0.5653967", "0.5589408", "0.55615175", "0.54566073", "0.54221964", "0.54184455", "0.5394405", "0.5361002", "0.5313779", "0.5284062", "0.5282375", "0.528223", "0.5251631", "0.5220851", "0.521727", "0.521727", "0.52152485", "0.5209912",...
0.6045218
1
GET /ctypes/new GET /ctypes/new.json
def new @ctype = Ctype.new respond_to do |format| format.html # new.html.erb format.json { render json: @ctype } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @cso = Cso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cso }\n end\n end", "def new...
[ "0.64395833", "0.6438386", "0.63779414", "0.63609314", "0.63589174", "0.63422275", "0.6325753", "0.6321999", "0.6293118", "0.62917733", "0.62826294", "0.6281174", "0.6278774", "0.6274287", "0.6236049", "0.6215375", "0.6194819", "0.6193911", "0.61777645", "0.61750823", "0.6171...
0.7346602
0
POST /ctypes POST /ctypes.json
def create @ctype = Ctype.new(params[:ctype]) respond_to do |format| if @ctype.save format.html { redirect_to @ctype, notice: 'Ctype was successfully created.' } format.json { render json: @ctype, status: :created, location: @ctype } else format.html { render action: "new" } format.json { render json: @ctype.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_to_cc(data)\n post_args = { \n 'js_code' => data[\"code\"],\n 'compilation_level' => data[\"level\"],\n 'output_format' => data[\"format\"],\n 'output_info' => data[\"info\"]\n }\n\n if $debug\n puts \"#DEBUG post_args \\n\"\n p post_args\n p...
[ "0.57375354", "0.5672813", "0.5494921", "0.5478138", "0.5452396", "0.5408685", "0.5393942", "0.5393851", "0.5313655", "0.5312502", "0.530955", "0.51561105", "0.51379377", "0.51326275", "0.51108605", "0.5110179", "0.51016384", "0.50910383", "0.5010841", "0.50014037", "0.499136...
0.5899374
0
PUT /ctypes/1 PUT /ctypes/1.json
def update @ctype = Ctype.find(params[:id]) respond_to do |format| if @ctype.update_attributes(params[:ctype]) format.html { redirect_to @ctype, notice: 'Ctype was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @ctype.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :pu...
[ "0.64754397", "0.58924526", "0.58376026", "0.57701546", "0.57378554", "0.5725518", "0.5649563", "0.5623119", "0.561453", "0.5544597", "0.5544562", "0.55338264", "0.54246265", "0.5418844", "0.5347696", "0.5345553", "0.5309235", "0.53067404", "0.52999985", "0.52985555", "0.5284...
0.6014326
1
DELETE /ctypes/1 DELETE /ctypes/1.json
def destroy @ctype = Ctype.find(params[:id]) @ctype.destroy respond_to do |format| format.html { redirect_to ctypes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => dat...
[ "0.6599729", "0.6565366", "0.65478235", "0.6494646", "0.64634866", "0.64422834", "0.64280754", "0.64246213", "0.6398982", "0.6398982", "0.6396429", "0.63853604", "0.63688326", "0.6363206", "0.6346976", "0.6346976", "0.6346976", "0.6346976", "0.6326976", "0.6315304", "0.630969...
0.72348297
0
[ [ link name]
def external_link(protocol) link = @context.scan_continued_until(/\s+|\]/) if @context.matched =~ /\s+/ @context.push_eol_sign(/^\]/) caption = short_inline(/\]/) @context.pop_eol_sign end ExternalLink.new(protocol + link, caption) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def links; end", "def links; end", "def link() url; end", "def link() url; end", "def link\n '-'\n end", "def link\n @link\n end", "def link_text\n name\n end", "def mediawiki_link\n return nil unless @name\n \"[[#{@name}]]\"\n end", "def link_name\n...
[ "0.7864791", "0.7864791", "0.76746905", "0.76746905", "0.7426567", "0.73853636", "0.7384823", "0.736436", "0.73615265", "0.71759415", "0.717243", "0.71054757", "0.7079028", "0.7033595", "0.6993695", "0.69683903", "0.69494635", "0.69469637", "0.69390893", "0.69390893", "0.6874...
0.0
-1
Script to create shopgroup/shop/tills/accounts for lotsys
def create_basic_account(http, account_name, identity_card) begin response = http.post 'Create a new account', "#{SERVER}/accounts", { 'lineId' => 1, 'username' => account_name, 'password' => account_name, 'email' => "#{account_name}@lvs.co.uk", 'countryCode' => 'IL', 'currencyCode' => 'ILS', 'online' => true, 'status' => 'open', 'identityCardNumber'=> identity_card } account_id = JSON.parse(response.body)['id'] account_uri = response.headers[:location] response = http.post 'Create a new transaction', "#{SERVER}/accounts/#{account_id}/transactions", { 'transactionSubType' => 'CREDIT_CARD', 'transactionType' => 'PAYMENTRECEIPT', 'accountId' => account_id, 'credit' => '10000', 'description' => 'Payment via REST API', } return account_id, account_uri end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_accounts\n self.accounts.create({:name => \"Checking\"})\n self.accounts.create({:name => \"Savings\"})\n end", "def create_accounts\n end", "def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end", "def create_gen1_account(name) \n\n ...
[ "0.625486", "0.5999848", "0.55318457", "0.5371051", "0.5273144", "0.52638984", "0.5238206", "0.5188506", "0.516966", "0.5155599", "0.5134089", "0.51239765", "0.5063806", "0.5000237", "0.49906", "0.49577153", "0.4935066", "0.49253193", "0.4922641", "0.49146694", "0.48811206", ...
0.0
-1
Add new Block for Post
def create @block = Post::CreateBlock.new(@post, find_block).perform end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @post_block = PostBlock.new(post_block_params)\n # ставим блок в самый конец поста\n @post_block.weight = @post.blocks.size\n\n respond_to do |format|\n if @post_block.save\n format.html { redirect_to edit_cm_post_block_url(@post, @post_block), notice: 'Post block was successfu...
[ "0.7465692", "0.7092099", "0.7002827", "0.69542176", "0.66568273", "0.6630233", "0.6630233", "0.6589676", "0.65526664", "0.65274", "0.6519412", "0.65058047", "0.64745355", "0.64745355", "0.64628464", "0.6454557", "0.6397183", "0.63628894", "0.63549405", "0.63508755", "0.63422...
0.7593519
0
Create a function called assess_situation that takes three arguments danger_level, save_the_day, bad_excuse danger_level should be an integer save_the_day should be a string a hero would say once they save the day bad_excuse should be a string a hero would say if they are too afraid of the danger_level
def assess_situation(danger_level, save_the_day, bad_excuse) if danger_level > 50 p bad_excuse elsif danger_level > 10 && danger_level < 50 p save_the_day else p "Meh. Hard pass." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assess_situation(danger_level, save_the_day, bad_excuse)\n danger_level = 100\n save_the_day = \"Fear not mortals I am here!\"\n bad_excuse = \"I'm sore from lifting all day bro.\"\n# Your function should include an if/else statement that meets the following criteria\n# - Danger levels that are above 50 a...
[ "0.79552543", "0.7840132", "0.78041863", "0.7728721", "0.7712961", "0.7607481", "0.7587195", "0.75833327", "0.75833327", "0.7562115", "0.75316584", "0.7531396", "0.7510766", "0.7481581", "0.7477385", "0.7463831", "0.74346447", "0.73617584", "0.73494494", "0.73444664", "0.6785...
0.773931
3
Instructions asked for class methods, but these should be instance methods SI
def say_name p name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def private; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; en...
[ "0.7219744", "0.70650476", "0.70650476", "0.70650476", "0.70650476", "0.67819923", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.66942656", "0.663573", "0.65942657", ...
0.0
-1
return mean rating to one decimal place, nil if no ratings
def average_rating ratings = book_reviews.pluck(:rating) ratings.size.zero? ? nil : (ratings.sum / ratings.size.to_f).round(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg_rating\n\t\t('%.2f' % issues.average(:rating).to_f).to_f\n\tend", "def average_rating \n\t\tif has_reviews?\n\t\t\taverage_rating = ratings.reduce(0){|sum, rating| sum + rating} / ratings.count.to_f\n\t\t\t'%.0f' % average_rating # rounds to nearest integer for now\n\t\telse\n\t\t\t\"NA\"\n\t\tend\n\tend...
[ "0.80628794", "0.8027905", "0.80139834", "0.79453653", "0.7922192", "0.78969723", "0.78886706", "0.7881735", "0.7874916", "0.78450537", "0.7818905", "0.7813677", "0.77954906", "0.7779628", "0.776018", "0.776018", "0.7759882", "0.7757693", "0.7734746", "0.7714891", "0.7714073"...
0.74006134
45
return author name "last, first"
def author_name "#{author.last_name}, #{author.first_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def author_name\n \"#{author.first_name} #{author.last_name}\"\n end", "def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:l...
[ "0.84426934", "0.8250827", "0.81724936", "0.8153553", "0.8067513", "0.80622244", "0.80128706", "0.8007115", "0.79043794", "0.7889297", "0.7865092", "0.78181946", "0.7772703", "0.77712744", "0.77254623", "0.7640478", "0.7621135", "0.7602157", "0.7598885", "0.757495", "0.756528...
0.8753848
0
the array of positive integers stored in arr and return the length of the longest increasing subsequence (LIS). A LIS is a subset of the original list where the numbers are in sorted order, from lowest to highest, and are in increasing order. The sequence does not need to be contiguous or unique, and there can be several different subsequences. For example: if arr is [4, 3, 5, 1, 6] then a possible LIS is [3, 5, 6], and another is [1, 6]. For this input, your program should return 3 because that is the length of the longest increasing subsequence.
def LongestIncreasingSequence(arr) size = arr.size while size > 1 sub_seq = arr.combination(size).to_a sub_seq.each do |seq| inc_seq = true seq.each_cons(2) { |num1, num2| break inc_seq = false unless num2 > num1 } return seq.size if inc_seq end size -= 1 end 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_increasing_subseq(arr)\n n = arr.size\n lis = Array.new(n, 1)\n\n (0 ... n).each do |i|\n (0 ... i).each do |j|\n if arr[i] > arr[j] && lis[j] + 1 > lis[i]\n lis[i] = lis[j] + 1\n end\n end\n end\n\n max_len = 0\n\n (1 ... n).each do |k|\n max_len = lis[k] if max_len < l...
[ "0.8485866", "0.8110899", "0.7634076", "0.7600888", "0.7506379", "0.73030883", "0.72382885", "0.7112142", "0.70626044", "0.7005865", "0.7000469", "0.6958385", "0.69192135", "0.68756783", "0.6864277", "0.67912805", "0.6747806", "0.67241186", "0.6710587", "0.6691756", "0.667627...
0.74864703
5
before_action :set_booking, only: [:show] GET /bookings GET /bookings.json
def index @bookings = @user.bookings end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: { booking: @booking }, status: 200\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking = Booking.find(params[:id])\n end", "def set_booking\n @booking =...
[ "0.7450458", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7434617", "0.7414854", "0.74083793", "0.74083793", "0.7366299", "0.7366299", "0.7366299", "0.7366299", "0.7366299", "0.7366299", "0.7366299", "0.7366299", ...
0.0
-1
GET /bookings/1 GET /bookings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |f...
[ "0.7793375", "0.76496434", "0.76496434", "0.76496434", "0.76409495", "0.76042414", "0.75729305", "0.73645985", "0.73645985", "0.73645985", "0.73645985", "0.7241474", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.720...
0.0
-1
do this in the tickets controller what if user does not select any seats? what if user does not select enough seats? what if seat was taken after user had made the selection
def save_seats # seat is not occupied occupied_seats = @booking.showtime.occupied_seat_nums booking_tickets = @booking.tickets.where(seat_num: nil) index = 0 params[:seats].uniq.each do |seat_num| break if index >= booking_tickets.size next if occupied_seats.include? seat_num booking_tickets[index].update(seat_num: seat_num) index += 1 end redirect_to confirm_movie_booking_path(@booking.movie, @booking) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def set_seat\n @seat = ::Seat.find(params[:id])\n @ticket = ::Ticket.find(params...
[ "0.7064377", "0.69663966", "0.6773573", "0.65622723", "0.64484155", "0.62215877", "0.62135863", "0.62066835", "0.6202465", "0.60932213", "0.60932213", "0.60932213", "0.60932213", "0.6080931", "0.6075382", "0.6063985", "0.60276836", "0.60258204", "0.60159904", "0.59795475", "0...
0.650703
4
POST /bookings POST /bookings.json
def create @booking = @user.bookings.new(booking_params) @booking.movie = @movie @booking.tickets = @booking.build_tickets(ticket_types_params) respond_to do |format| if @booking.save format.html { redirect_to seats_movie_booking_path(@movie,@booking) } format.json { render :show, status: :created, location: @booking } else format.html { render :new } format.json { render json: @booking.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_i...
[ "0.73516107", "0.7226872", "0.68609273", "0.67808926", "0.67808926", "0.676539", "0.6640409", "0.6638462", "0.6622561", "0.65139383", "0.650873", "0.650873", "0.650873", "0.6488294", "0.6432213", "0.6378408", "0.6345117", "0.6323815", "0.629621", "0.62872636", "0.62760705", ...
0.5978307
79
Use callbacks to share common setup or constraints between actions.
def set_booking @booking = @user.bookings.find_by(id: params[:id]) if @booking.nil? redirect_to user_bookings_path(@user) end 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 booking_params params.require(:booking).permit(:showtime_id, :title, :first_name, :last_name, :phone_number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
source: path to master git repository
def updateGit(source) dir = File.basename(source.sub(/\.git$/, '')) if File.exists?(dir) system 'cd '+dir+' && git pull' or exit 1 else system 'git clone ' + source or exit 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source\n \"#{source_repo}/#{source_branch}\"\n end", "def source_branch\n @client.branch(repo, options[:source]).commit.sha\n end", "def source_repo\n \"#{@user}/#{@repo}\"\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n ...
[ "0.85231006", "0.7301128", "0.71656436", "0.7136544", "0.706728", "0.7047686", "0.69938105", "0.6929099", "0.68748665", "0.685373", "0.6835489", "0.68293875", "0.67963785", "0.67958903", "0.6777659", "0.6776521", "0.6775426", "0.67693555", "0.6762756", "0.67625314", "0.674356...
0.68802315
9
Defining to_s on an object controls how the object is represented as a string, e.g., when you pass it to puts
def to_s output_string = String.new letter_array = @spaces 4.times do output_string << letter_array.shift(4).join('') + "\n" end output_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s_safe(obj)\n if obj.respond_to?(:to_s)\n obj.to_s\n else\n 'to_s error'\n end\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n object.to_s\n end", "def to_s\n @object.to...
[ "0.7929921", "0.7473684", "0.7473684", "0.7463086", "0.7318161", "0.72636086", "0.72636086", "0.72636086", "0.725486", "0.7236797", "0.7236797", "0.72337914", "0.7146482", "0.71402454", "0.71402454", "0.71402454", "0.71402454", "0.71402454", "0.71402454", "0.71402454", "0.714...
0.0
-1
GET /redcorporativa_interfaces GET /redcorporativa_interfaces.json
def index @redcorporativa_interfaces = RedcorporativaInterface.where(RedcorporativaInterface.arel_table[:created_at] .gt(RedcorporativaInterface.maximum(:created_at).to_date)) .order("status DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_redcorporativa_interface\n @redcorporativa_interface = RedcorporativaInterface.find(params[:id])\n end", "def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend", "def crea...
[ "0.69337016", "0.66526717", "0.6267309", "0.62535274", "0.6127321", "0.61037666", "0.60488874", "0.5949252", "0.5906524", "0.58817875", "0.58207005", "0.58072984", "0.5797935", "0.5795569", "0.5761924", "0.5751995", "0.56888336", "0.56513524", "0.5622419", "0.56151617", "0.56...
0.65045696
2
GET /redcorporativa_interfaces/1 GET /redcorporativa_interfaces/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_redcorporativa_interface\n @redcorporativa_interface = RedcorporativaInterface.find(params[:id])\n end", "def create\n @redcorporativa_interface = RedcorporativaInterface.new(redcorporativa_interface_params)\n\n respond_to do |format|\n if @redcorporativa_interface.save\n format...
[ "0.71796685", "0.6622638", "0.64974844", "0.632771", "0.6318461", "0.61239696", "0.60426396", "0.6014686", "0.60060257", "0.59806097", "0.5866561", "0.5844373", "0.5711001", "0.56986606", "0.56329274", "0.5632435", "0.56248707", "0.56042546", "0.55743784", "0.5564312", "0.556...
0.0
-1
POST /redcorporativa_interfaces POST /redcorporativa_interfaces.json
def create @redcorporativa_interface = RedcorporativaInterface.new(redcorporativa_interface_params) respond_to do |format| if @redcorporativa_interface.save format.html { redirect_to @redcorporativa_interface, notice: 'Redcorporativa interface was successfully created.' } format.json { render :show, status: :created, location: @redcorporativa_interface } else format.html { render :new } format.json { render json: @redcorporativa_interface.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redcorporativa_interface_params\n params.require(:redcorporativa_interface).permit(:device, :port, :servicio, :gbpsrx, :gbpstx, :bps_max, :statustx, :statusrx, :status, :last_bps_max, :last_status, :crecimiento_rx, :crecimiento_tx, :egressRate, :time, :comment, :deviceindex)\n end", "def set_redcorpo...
[ "0.682484", "0.6731913", "0.6436293", "0.6342025", "0.61238843", "0.6117492", "0.61167294", "0.6100542", "0.6097369", "0.60010785", "0.59632295", "0.59443665", "0.58294857", "0.5778707", "0.57382953", "0.5725938", "0.57049954", "0.5613508", "0.55841357", "0.5568054", "0.55485...
0.75880593
0
PATCH/PUT /redcorporativa_interfaces/1 PATCH/PUT /redcorporativa_interfaces/1.json
def update respond_to do |format| if @redcorporativa_interface.update(redcorporativa_interface_params) format.html { redirect_to @redcorporativa_interface, notice: 'Redcorporativa interface was successfully updated.' } format.json { render :show, status: :ok, location: @redcorporativa_interface } else format.html { render :edit } format.json { render json: @redcorporativa_interface.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_redcorporativa_interface\n @redcorporativa_interface = RedcorporativaInterface.find(params[:id])\n end", "def update\n @interface = Interface.find(params[:id])\n\n respond_to do |format|\n if @interface.update_attributes(params[:interface])\n format.html { redirect_to @interface...
[ "0.6646604", "0.64781004", "0.6409551", "0.6192071", "0.61643696", "0.6148377", "0.6109738", "0.61028343", "0.6063318", "0.60293764", "0.59931445", "0.5970782", "0.5957632", "0.595714", "0.5934313", "0.59192216", "0.59166867", "0.591505", "0.5863919", "0.5800971", "0.57873267...
0.74657226
0
DELETE /redcorporativa_interfaces/1 DELETE /redcorporativa_interfaces/1.json
def destroy @redcorporativa_interface.destroy respond_to do |format| format.html { redirect_to redcorporativa_interfaces_url, notice: 'Redcorporativa interface was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ipranaccess_interface.destroy\n respond_to do |format|\n format.html { redirect_to ipranaccess_interfaces_url, notice: 'Ipranaccess interface was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interface = Interface.find(params[:id...
[ "0.7198683", "0.70271564", "0.69521725", "0.693886", "0.6830735", "0.6788217", "0.67619455", "0.6734439", "0.6700412", "0.6684848", "0.6684313", "0.66424775", "0.661631", "0.656101", "0.65527046", "0.6511568", "0.6460949", "0.6460949", "0.6460949", "0.6460949", "0.6440703", ...
0.793587
0
Use callbacks to share common setup or constraints between actions.
def set_redcorporativa_interface @redcorporativa_interface = RedcorporativaInterface.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 redcorporativa_interface_params params.require(:redcorporativa_interface).permit(:device, :port, :servicio, :gbpsrx, :gbpstx, :bps_max, :statustx, :statusrx, :status, :last_bps_max, :last_status, :crecimiento_rx, :crecimiento_tx, :egressRate, :time, :comment, :deviceindex) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
AdminUser account actions. The ! methods are 'just get the job done'. It's true, they do some testing of their own thus unDRY'ing tests that do and should live in the admin_user account stories but the repetition is ultimately important so that a faulty test setup fails early.
def log_out get '/sessions/destroy' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin!\r\n check_account_type(3)\r\nend", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def admin_actions\n unless @current_admin.is_sup...
[ "0.6856615", "0.6812474", "0.6432614", "0.62248725", "0.620227", "0.61822504", "0.61723137", "0.61401325", "0.61113536", "0.6092103", "0.6061986", "0.60567766", "0.59944373", "0.59944373", "0.5980718", "0.5978004", "0.5950935", "0.59467894", "0.59407115", "0.5938766", "0.5935...
0.0
-1
GET /classannounces GET /classannounces.json
def index @classannounces = Classannounce.all.order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @announces = Announce.all\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @announ...
[ "0.6557628", "0.64243764", "0.63951796", "0.5951381", "0.57588816", "0.56563157", "0.5615331", "0.55452514", "0.554053", "0.54374504", "0.5407724", "0.53547937", "0.5324128", "0.528129", "0.52336466", "0.5208555", "0.5198197", "0.5168652", "0.51683664", "0.5163419", "0.516324...
0.7210438
0
GET /classannounces/1 GET /classannounces/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @classannounces = Classannounce.all.order(\"created_at DESC\")\n end", "def index\n @announces = Announce.all\n end", "def index\n @announces = Announce.not_finished.order(\"stime DESC\")\n\t\t@pannounces = Announce.finished.last_24_hours.limit(20).order(\"etime DESC\")\n\n respond_to...
[ "0.7266801", "0.66801995", "0.6564083", "0.64877766", "0.5934911", "0.5749291", "0.56740963", "0.557959", "0.5514829", "0.5490619", "0.5480095", "0.5380821", "0.5318306", "0.5306821", "0.5287194", "0.52752423", "0.5271237", "0.5217793", "0.51985747", "0.5183404", "0.5151775",...
0.0
-1
POST /classannounces POST /classannounces.json
def create @classannounce = current_user.classannounces.build(classannounce_params) respond_to do |format| if @classannounce.save format.html { redirect_to @classannounce } format.json { render :show, status: :created, location: @classannounce } else format.html { render :new } format.json { render json: @classannounce.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @classannounces = Classannounce.all.order(\"created_at DESC\")\n end", "def index\n @announces = Announce.all\n end", "def create\n @announcament = Announcament.new(announcament_params)\n\n respond_to do |format|\n if @announcament.save\n format.html { redirect_to @announc...
[ "0.63392454", "0.5621608", "0.5517595", "0.5376627", "0.53147507", "0.5299948", "0.52976966", "0.5249037", "0.5231384", "0.5194333", "0.51918733", "0.5185319", "0.5167044", "0.5160679", "0.5046606", "0.50308245", "0.5010681", "0.49976757", "0.49736822", "0.4948618", "0.494448...
0.71688247
0
PATCH/PUT /classannounces/1 PATCH/PUT /classannounces/1.json
def update respond_to do |format| if @classannounce.update(classannounce_params) format.html { redirect_to @classannounce, notice: 'Classannounce was successfully updated.' } format.json { render :show, status: :ok, location: @classannounce } else format.html { render :edit } format.json { render json: @classannounce.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @announcament.update(announcament_params)\n format.html { redirect_to @announcament, notice: 'Announcament was successfully updated.' }\n format.json { render :show, status: :ok, location: @announcament }\n else\n format.html { render :edit...
[ "0.6026807", "0.5977408", "0.5920598", "0.5907839", "0.59021693", "0.59000415", "0.58975327", "0.58104146", "0.58030635", "0.57901305", "0.57834786", "0.5777233", "0.577286", "0.5754975", "0.5754975", "0.5749045", "0.5720699", "0.57197964", "0.57104343", "0.5707499", "0.57019...
0.6201619
0
DELETE /classannounces/1 DELETE /classannounces/1.json
def destroy @classannounce.destroy respond_to do |format| format.html { redirect_to classannounces_url, notice: 'Classannounce was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @classs.destroy\n respond_to do |format|\n format.html { redirect_to classses_url, notice: 'Classs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @class_taken = ClassTaken.find(params[:id])\n @class_taken.destroy\n\n respo...
[ "0.66777474", "0.66129464", "0.66010755", "0.658097", "0.65771127", "0.6568918", "0.65294415", "0.65262944", "0.651078", "0.65025926", "0.6495567", "0.64163744", "0.63902175", "0.63839364", "0.6372693", "0.6359235", "0.63576347", "0.6352948", "0.6343359", "0.6342492", "0.6338...
0.7238144
0
Use callbacks to share common setup or constraints between actions.
def set_classannounce @classannounce = Classannounce.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 classannounce_params params.require(:classannounce).permit(:user_id, :classroom_id, :content) 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
GET /post421s/1 GET /post421s/1.xml
def show @post421 = Post421.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @post421 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @post445 = Post445.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post445 }\n end\n end", "def show\n @post57 = Post57.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml...
[ "0.6640471", "0.66198015", "0.65761817", "0.65738285", "0.655382", "0.65272444", "0.64923984", "0.64811134", "0.6478426", "0.64702576", "0.6450369", "0.64497423", "0.64464027", "0.64458585", "0.6444157", "0.64430743", "0.6442972", "0.6438669", "0.6429333", "0.6425948", "0.642...
0.69218504
0
GET /post421s/new GET /post421s/new.xml
def new @post421 = Post421.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @post421 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @post57 = Post57.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post57 }\n end\n end", "def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n ...
[ "0.7603476", "0.7601727", "0.75769293", "0.7576923", "0.75578505", "0.7552959", "0.75289685", "0.7505415", "0.75027406", "0.7480322", "0.74732244", "0.74718535", "0.74714625", "0.74662644", "0.7465571", "0.7462381", "0.7460551", "0.745415", "0.7453623", "0.74503535", "0.74425...
0.75676274
4
POST /post421s POST /post421s.xml
def create @post421 = Post421.new(params[:post421]) respond_to do |format| if @post421.save format.html { redirect_to(@post421, :notice => 'Post421 was successfully created.') } format.xml { render :xml => @post421, :status => :created, :location => @post421 } else format.html { render :action => "new" } format.xml { render :xml => @post421.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @post445 = Post445.new(params[:post445])\n\n respond_to do |format|\n if @post445.save\n format.html { redirect_to(@post445, :notice => 'Post445 was successfully created.') }\n format.xml { render :xml => @post445, :status => :created, :location => @post445 }\n else\n ...
[ "0.6188759", "0.61341625", "0.6118218", "0.6035417", "0.6025331", "0.6008808", "0.5977354", "0.59727955", "0.5967868", "0.5954649", "0.59474295", "0.5904192", "0.58930486", "0.58844733", "0.5884423", "0.58811843", "0.5873971", "0.586445", "0.585132", "0.5839846", "0.5834645",...
0.6988266
0
PUT /post421s/1 PUT /post421s/1.xml
def update @post421 = Post421.find(params[:id]) respond_to do |format| if @post421.update_attributes(params[:post421]) format.html { redirect_to(@post421, :notice => 'Post421 was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post421.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def 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 upd...
[ "0.6706847", "0.63417494", "0.63138807", "0.62955254", "0.6256115", "0.62082934", "0.6162715", "0.6153879", "0.6149762", "0.6142476", "0.6128714", "0.6097612", "0.6080918", "0.6075693", "0.60477126", "0.6042559", "0.602271", "0.601587", "0.6008078", "0.60080445", "0.59859085"...
0.63440716
1
DELETE /post421s/1 DELETE /post421s/1.xml
def destroy @post421 = Post421.find(params[:id]) @post421.destroy respond_to do |format| format.html { redirect_to(post421s_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @post445 = Post445.find(params[:id])\n @post445.destroy\n\n respond_to do |format|\n format.html { redirect_to(post445s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @post57 = Post57.find(params[:id])\n @post57.destroy\n\n respond_to do |format|\n ...
[ "0.7104696", "0.7001912", "0.69718504", "0.6925102", "0.690504", "0.689337", "0.68929666", "0.6887097", "0.6886517", "0.68830246", "0.6873298", "0.6867385", "0.6863669", "0.6861489", "0.6851397", "0.6849836", "0.6842174", "0.68411285", "0.6838388", "0.68278575", "0.68276036",...
0.705935
1
Allow you to route based on whether a scope is not authenticated. You can optionally specify which scope. unauthenticated do as :user do root to: 'devise/registrationsnew' end end root to: 'dashboardshow'
def unauthenticated(scope=nil) constraint = lambda do |request| not request.env["warden"].authenticate? scope: scope end constraints(constraint) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def github_unauthenticated(scope=nil, options={}, &routes_block)\n github_constraint(scope, options, routes_block) do |warden, scope|\n not warden.authenticated?(scope: scope)\n end\n end", "def not_authenticated\n redirect_to root_path\n end", "def not_authentic...
[ "0.7053037", "0.6965354", "0.6906089", "0.6867864", "0.6739562", "0.65778095", "0.6306136", "0.6294193", "0.6274529", "0.6252363", "0.62373114", "0.6206944", "0.61737186", "0.6157208", "0.6120985", "0.61066437", "0.6104841", "0.6099581", "0.60941666", "0.6070615", "0.6035522"...
0.65651834
6
TURN ON/OFF ALL LOGGING
def log_all_on &block out = '' old_out,old_cmd = @should_log_output,@should_log_command @should_log_output = @should_log_command = true if not block.nil? begin out = block.call ensure @should_log_output,@should_log_command = old_out,old_cmd end end out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_logging\n @logger = nil\n end", "def disable_log_to_screen\n @log_to_screen = false\n end", "def reset_logging\n\t\tRoninShell.reset_logger\n\tend", "def logoff\n end", "def enable_logging\n initialize_logger\n end", "def set_enable(opts = {})\n cmd = command_builder('logg...
[ "0.648736", "0.64295906", "0.64236003", "0.63817877", "0.6359752", "0.633001", "0.6315782", "0.6210505", "0.61696595", "0.61382264", "0.6113533", "0.611158", "0.6101162", "0.6059256", "0.6059256", "0.60476327", "0.60019565", "0.6001594", "0.6001594", "0.59887815", "0.5963685"...
0.5663762
41
TURN COMMAND LOGGIN ON/OFF
def log_command_on &block out = '' orig,@should_log_command = @should_log_command,true if not block.nil? begin out = block.call ensure @should_log_command = orig end end out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_on!\n @turned_off = false\n end", "def turn_on!\n set_power!(:on)\n end", "def turn_on\n 'If the thermocycler is off, toggle the power switch in the back of the' \\\n ' instrument'\n end", "def logoff\n # If there's no connection, bail\n return if !@connected\n\n # Se...
[ "0.6615441", "0.64413184", "0.63432896", "0.62672615", "0.6106478", "0.6096779", "0.60604733", "0.6026538", "0.5974519", "0.59703404", "0.59679896", "0.5956316", "0.5902691", "0.58952546", "0.58862936", "0.5814319", "0.57918185", "0.57841396", "0.57640153", "0.5722923", "0.57...
0.53794974
51
TURN OUTPUT LOGGIN ON/OFF
def log_output_on &block out = '' orig,@should_log_output = @should_log_output,true if not block.nil? begin out = block.call ensure @should_log_output = orig end end out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\n `rm #{log_file} && touch #{log_file}`\nend", "def disable_stdout\n stdoutoutputter = Log4r::Outputter[\"#{@name.to_s}-stdout\"]\n stdoutoutputter.level = Log4r::OFF\n...
[ "0.6722653", "0.66866064", "0.6465706", "0.63135207", "0.6301838", "0.6281261", "0.6281261", "0.62225443", "0.6151772", "0.61466146", "0.6112721", "0.60970944", "0.60927194", "0.60625386", "0.60625386", "0.60611117", "0.60352314", "0.5998992", "0.59542465", "0.59452844", "0.5...
0.583887
31
DO THE ACTUAL LOGGING WORK
def log_exec! title, cmd, &block log_command! title, cmd out = block.call || '' return out unless @should_log_output if out == '' logger.puts( NO_OUTPUT ) else logger.liner logger.puts( out ) logger.liner end out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n end", "def logs\n end", "def logger ; @log end", "def logs\n\n end", "def log_stuff\r\n log.info(\"TestLogger is here to log stuff.\")\r\n log...
[ "0.7716307", "0.7716307", "0.7716307", "0.7716307", "0.7716307", "0.7716307", "0.7716307", "0.7716307", "0.7682007", "0.75801736", "0.7435975", "0.7429897", "0.74210364", "0.71974295", "0.71974295", "0.71974295", "0.71974295", "0.71974295", "0.71974295", "0.71974295", "0.7197...
0.0
-1
simply to clean up the above methods
def email_ni(app_event, user, tenant, datum, meta_data) # set the mailer, unless it's been manually set # maybe move this to inside email_notification_item.rb ?? TS meta_data[:mailer] = "#{app_event.obj.class}Mailer" unless meta_data.has_key? :mailer EmailNotificationItem.create!({ app_event: app_event, user: user, tenant: tenant, datum: datum, meta_data: meta_data }) # do not process here, so that if the processor fails later, no NIs get processed! TS end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def suivre; end", "def operations; end", "def operations; end", "def formation; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def anchored; end", "def custom; end", "def custom; end", "def ...
[ "0.72982705", "0.6663903", "0.65269077", "0.6336117", "0.6224311", "0.6224311", "0.61570764", "0.6063013", "0.6063013", "0.6063013", "0.6063013", "0.6031214", "0.6003384", "0.6003384", "0.59004307", "0.58904326", "0.58904326", "0.5876214", "0.58507115", "0.58243", "0.5822291"...
0.0
-1
Returns a boolean value indicating if there are other video tabs besides this one remaining in the course.
def other_tabs_remaining? course.video_tabs.count > 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_tabs_remaining?\n category.tabs.count > 1\n end", "def viewing_players_tab?\n ! viewing_scouts_tab?\n end", "def tab?(s)\n @window.tab?(s)\n end", "def full?\n return false if self.parent_id.nil? # course team, does not max_team_size\n max_team_members = Assignment.find(self.paren...
[ "0.7709273", "0.63202375", "0.60256904", "0.5996964", "0.5898274", "0.58497757", "0.58345157", "0.5818986", "0.57867837", "0.5770388", "0.57635516", "0.5740414", "0.573755", "0.573425", "0.5679733", "0.5656917", "0.5656917", "0.56416917", "0.56303346", "0.5573543", "0.5563086...
0.89788955
0
Sample Input 18 3C 7E 7E 18 18 18 18 FF 81 BD A5 A5 BD 81 FF AA 55 AA 55 AA 55 AA 55 3E 7F FC F8 F8 FC 7F 3E 93 93 93 F3 F3 93 93 93
def hex_bitmap hex bin = hex.split(' ').map do |n| n.hex.to_s(2).rjust(8, '0').gsub(/[01]/, '0' => ' ', '1' => 'x') end bin.each { |n| puts n } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avengers\n Regexp.new s_to_h(<<-S)\n B1 96 B1 D3 ED AE 5F 92 1C 66 03 01 .. FF FF FF\n FF .. .. .. .. 4B 19 01 0B 03 00 00 00 08 00 00\n 00 2B 00 00 00 00 00 00 00 07 00 00 00 00 00 00\n 00 02 00 00 00 02 00 00 00 99 32 C5 C4 CC 57 6D\n 43 9A 6B 03 01 FF FF FF FF 99 32 C5 C4 CC 57 6D\n ...
[ "0.610146", "0.6022998", "0.6008666", "0.6001707", "0.59879345", "0.59847087", "0.59579724", "0.5948121", "0.59471285", "0.5941857", "0.58734894", "0.58734894", "0.5863902", "0.5835406", "0.57995695", "0.57947135", "0.57908463", "0.5774327", "0.5751343", "0.57431614", "0.5740...
0.0
-1
guessword is the given msytery word turned into an array
def given_word(word) @guessword = word.to_s.split('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wordArray(guessword)\n word_array = []\n\n guessword.length.times do |letter|\n word_array << guessword[letter]\n end\n return word_array\nend", "def fill_word(word_guess)\n\t\tword_guess_arr = @word_guess.scan\n\t\t\n\n\tend", "def guess_letters\n guess_array = []\n @current_word.each do\n ...
[ "0.7621004", "0.7542348", "0.75216603", "0.7503843", "0.7412214", "0.7400687", "0.7300409", "0.72931135", "0.7273362", "0.7273362", "0.72491676", "0.72038466", "0.7140242", "0.7091112", "0.7088766", "0.6990214", "0.6989534", "0.6969128", "0.69409555", "0.69408995", "0.6917581...
0.7840223
0
guessword2 will be blank array
def blank_word(word) @guessword2 = word.gsub(/[a-z]/, '_').split('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_word(word_guess)\n\t\tword_guess_arr = @word_guess.scan\n\t\t\n\n\tend", "def set_guess\n @guess = Array.new(@word.length, '*')\n end", "def match_letters #handle_guess\n\t\tindexes_matched = @word_array.each_index.select { |i| @word_array[i] == @guess}\n\n\t\tfor x in indexes_matched do\n\t\t\t@r...
[ "0.7699455", "0.7451198", "0.72390443", "0.72390443", "0.7232927", "0.72188777", "0.70838803", "0.70713526", "0.70561713", "0.7031864", "0.7031296", "0.6952626", "0.69217455", "0.68943363", "0.6886544", "0.6886001", "0.68782043", "0.68663424", "0.6865019", "0.6848213", "0.680...
0.66344357
30
GET /other_contactinfos GET /other_contactinfos.json
def index @other_contactinfos = OtherContactinfo.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_related\n approved_friends = current_user.allFriends.map!{|user| user.id}\n pending_friends = current_user.allPendingFriends.map!{|user| user.id}\n contacts = []\n filtered_contacts = current_user.contacts.where(\"contacts.name ilike '%#{current_user.lastname}%'\").joins('inner join users on u...
[ "0.68112564", "0.67054635", "0.6609758", "0.65124375", "0.6507727", "0.6501727", "0.64792293", "0.64572614", "0.64303726", "0.6370619", "0.6356713", "0.6356713", "0.635187", "0.6336319", "0.63334554", "0.6308251", "0.6303869", "0.62862045", "0.62862045", "0.62769705", "0.6231...
0.7577414
0
GET /other_contactinfos/1 GET /other_contactinfos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @other_contactinfos = OtherContactinfo.all\n end", "def set_other_contactinfo\n @other_contactinfo = OtherContactinfo.find(params[:id])\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to...
[ "0.7469629", "0.68934005", "0.66515255", "0.6572266", "0.6564402", "0.655043", "0.6542701", "0.6527892", "0.6523704", "0.64477414", "0.64422554", "0.64182", "0.64015085", "0.63966095", "0.6386184", "0.6373263", "0.63651705", "0.6354807", "0.63534415", "0.63534415", "0.6351350...
0.0
-1