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 |
|---|---|---|---|---|---|---|
there is no "echo" here, since there is an "echo" procedure | def task
case @message['tasker']
when *NATO then route 'nato'
else route true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def echo(value); end",
"def echo(value); end",
"def echo msg\n $stdout.puts msg\nend",
"def echo(text)\n\ttext \nend",
"def echo(str)\n\tstr\nend",
"def echo(str)\n\tstr\nend",
"def echo _args\n \"echo _args;\" \n end",
"def echo(str)\n p str\nend",
"def echo message\r\n command 'echo'... | [
"0.7467156",
"0.7467156",
"0.7117053",
"0.7092305",
"0.7046906",
"0.7046906",
"0.7005502",
"0.6824836",
"0.6800158",
"0.6793153",
"0.67745847",
"0.67743313",
"0.67721623",
"0.6768614",
"0.6757329",
"0.6703902",
"0.6696702",
"0.6696702",
"0.6696702",
"0.6696702",
"0.6696702",
... | 0.0 | -1 |
Fetches the value for the specified key, same as doing hash[key] | def fetch(key, *extras)
super(convert_key(key), *extras)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n @hash.get(key)\n end",
"def get(key)\n @hash[key]\n end",
"def fetch(key, value = nil)\n if read = self[key]\n return read\n end\n block_given? ? yield(key) : value\n end",
"def obtain!(key)\n raise \"Missing key #{key}\" unless @hash.key?(key)\n... | [
"0.79132456",
"0.78904486",
"0.77051896",
"0.76648504",
"0.7663493",
"0.7631362",
"0.7590011",
"0.75239146",
"0.73805416",
"0.73403555",
"0.73383665",
"0.72928756",
"0.7267645",
"0.72667235",
"0.72548145",
"0.7195356",
"0.7178305",
"0.7172585",
"0.7168798",
"0.71638215",
"0.7... | 0.0 | -1 |
Returns an exact copy of the hash. | def dup
Settings.new(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def hash\n @orig.hash\n end",
"def to_hash\n @_hash.dup\n end",
"def to_hash\n @hash.dup\n end",
"def hash\n @hash || calculate_hash!\n end",
"def to_hash\n @hash.dup\n end",
"def hash() sour... | [
"0.6997122",
"0.6997122",
"0.6997122",
"0.69816893",
"0.69641626",
"0.69092524",
"0.6842076",
"0.68317187",
"0.68317187",
"0.68193966",
"0.68193966",
"0.68193966",
"0.68193966",
"0.68193966",
"0.68193966",
"0.68193966",
"0.6817702",
"0.67826986",
"0.6734803",
"0.6724344",
"0.... | 0.0 | -1 |
Convert to a Hash with String keys. | def to_hash
Hash.instance_method(:to_hash).bind(self).call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string_hash(hash)\n hash.map { |k, v| [k.to_s, v.to_s] }.to_h\n end",
"def stringify_keys\n hsh = Hash.new(default)\n self.each do |key, val|\n hsh[key.to_s] = val\n end\n hsh\n end",
"def migue_to_hash(strs, keys)\n vals = strs.split(':')\n hashi = {}\n vals.each do |o,i... | [
"0.7523218",
"0.7272221",
"0.7254647",
"0.7061932",
"0.70176804",
"0.6925129",
"0.6925129",
"0.6925129",
"0.6892119",
"0.68750453",
"0.68554026",
"0.68277365",
"0.67203593",
"0.67129856",
"0.67058676",
"0.6689845",
"0.66800606",
"0.66664064",
"0.6585252",
"0.6560649",
"0.6554... | 0.0 | -1 |
Finalizes the config. This is called when the app or slice is prepared. After this, no further changes to config can be made. | def finalize!
# Finalize nested configs
assets.finalize!
actions.finalize!
views.finalize!
logger.finalize!
router.finalize!
use_body_parser_middleware
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize!\n return self if config.frozen?\n\n config.finalize!\n self\n end",
"def finalize!\n return self if config.frozen?\n\n config.finalize!\n self\n end",
"def finalize(config)\n\t\t\t@options.config_merge!(config, :no_new => true)\n\t\t\t@options.r... | [
"0.73778987",
"0.7377734",
"0.6977407",
"0.6578682",
"0.6533902",
"0.6514027",
"0.64974904",
"0.62836486",
"0.6274444",
"0.6087271",
"0.6080555",
"0.59797925",
"0.59797925",
"0.5959608",
"0.595632",
"0.595421",
"0.5951774",
"0.59471595",
"0.5902976",
"0.5890374",
"0.58724815"... | 0.6492078 | 7 |
Configures the app's custom inflections. You should call this one time only. Subsequent calls will override previously configured inflections. | def inflections(&block)
self.inflector = Dry::Inflector.new(&block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inflections\n if block_given?\n yield Inflections.instance\n else\n Inflections.instance\n end\n end",
"def inflections\n if block_given?\n yield Inflections.instance\n else\n Inflections.instance\n end\n end",
"def inflector\n config.i... | [
"0.7062065",
"0.7062065",
"0.6434926",
"0.61039394",
"0.61039394",
"0.6042152",
"0.5544529",
"0.53130054",
"0.5113844",
"0.50843155",
"0.50285125",
"0.5006935",
"0.49228927",
"0.48809186",
"0.48175925",
"0.4745155",
"0.46998933",
"0.4691647",
"0.46736223",
"0.46358582",
"0.46... | 0.6984546 | 2 |
Disabling this to permit distinct documentation for `logger` vs `logger=` rubocop:disable Style/TrivialAccessors Returns the logger config. Use this to configure various options for the default `Dry::Logger::Dispatcher` logger instance. | def logger
@logger
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger\n @logger ||= configuration.logger\n end",
"def logger\n options.logger\n end",
"def logger\n options.logger\n end",
"def configuration\n if options[:log].nil? ||\n options[:log] == false ||\n empty_value?(options[:log])\n Vedeu... | [
"0.685039",
"0.68148506",
"0.67329764",
"0.66898704",
"0.6662991",
"0.6608143",
"0.65523255",
"0.65523255",
"0.6515721",
"0.645964",
"0.6435123",
"0.6410615",
"0.6406031",
"0.638185",
"0.6373309",
"0.6372549",
"0.6372549",
"0.6353986",
"0.6349362",
"0.63270664",
"0.6278748",
... | 0.59632087 | 44 |
Sets the app's logger instance. This entirely replaces the default `Dry::Logger::Dispatcher` instance that would have been | def logger=(logger_instance)
@logger_instance = logger_instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logger=(obj)\n config.logger = obj\n end",
"def logger\n init unless @initialized\n logger = @logger\n end",
"def logger=(logr); @logger = logr end",
"def set_logger(logger)\n @logger = logger\n end",
"def set_logger(logger)\n LOGGER.set_logger(logger)\n end",
"de... | [
"0.6712802",
"0.6597218",
"0.6587997",
"0.6563059",
"0.6558856",
"0.65468496",
"0.6543378",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459621",
"0.6459244",
"0.6451897",
"0.6445686",
"0.6440099",
"0.64381653",
"0.64381653",
... | 0.6559478 | 4 |
This method spawns a thread | def answer_pings
@ping_thread = Thread.new do
begin
loop do
pkt = @tap.recv
icmp = icmp_offset(pkt)
if icmp and pkt[icmp] == "\x08" #type == Echo Request
pkt[icmp, 1] = "\x00"
pkt[26, 4], pkt[30, 4] = pkt[30, 4], pkt[26, 4]
@tap.inject(pkt)
end
end
rescue Object
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end",
"def spawn_thread\n Thread.new{ run_thread }.tap do |t|\n t.abort_on_exception = true\n end\n end",
"def start_new_thread(username, params = {})\n $LOG.i \"running... | [
"0.7642397",
"0.72957313",
"0.70700276",
"0.68847656",
"0.68847656",
"0.68847656",
"0.68306917",
"0.6752685",
"0.6743945",
"0.6741217",
"0.66230565",
"0.66000235",
"0.65595585",
"0.64939696",
"0.64429706",
"0.6423834",
"0.6374436",
"0.6365108",
"0.63413334",
"0.63369906",
"0.... | 0.0 | -1 |
Return the MAC address of the tap device | def tap_mac
@sock.local_address.to_sockaddr[-6,6]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tap_mac\n @sock.local_address.to_sockaddr[-6, 6]\n end",
"def mac_addr\n if (mac_addr = @host.at('tag[name=mac-addr]'))\n mac_addr.inner_text\n end\n end",
"def mac_eth0\n eth0.mac_address\n end",
"def mac_address\n if NicView.empty_mac?(self[\"CurrentMACAddress... | [
"0.8397455",
"0.8076307",
"0.79054993",
"0.77712315",
"0.77181554",
"0.75649524",
"0.74780935",
"0.74680185",
"0.74211556",
"0.740509",
"0.73622",
"0.73502094",
"0.7312169",
"0.71858805",
"0.71211857",
"0.70530903",
"0.70500547",
"0.6992315",
"0.6992234",
"0.69615155",
"0.693... | 0.83925295 | 2 |
Wait for and return the next ping reply on the raw socket up to timeout | def ping_reply(timeout = 1.0)
loop do
st = Time.now.to_f
act = select([@sock], [], [@sock], timeout)
return nil if !act or act.first.empty?
pkt = @sock.recv(1514)
icmp = icmp_offset(pkt)
return pkt if icmp and pkt[icmp] == "\x00"
timeout = timeout - Time.now.to_f + st
return nil if timeout <= ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ping_reply(timeout = 1.0)\n loop do\n st = Time.now.to_f\n act = select([@sock], [], [@sock], timeout)\n return nil if !act or act.first.empty?\n pkt = @sock.recv(1514)\n icmp = icmp_offset(pkt)\n return pkt if icmp and pkt[icmp] == \"\\x00\" # type = Echo Reply\n timeou... | [
"0.792536",
"0.6661379",
"0.658519",
"0.64673173",
"0.6457619",
"0.6399726",
"0.6345231",
"0.6326999",
"0.63183653",
"0.6279778",
"0.6265646",
"0.6207323",
"0.61789435",
"0.6174201",
"0.61726373",
"0.6127821",
"0.60883874",
"0.60846674",
"0.607642",
"0.60582876",
"0.60496795"... | 0.78143346 | 2 |
Send the given raw layer2 packet to the tap | def inject(frame)
@sock.send(frame, 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_packet(payload); end",
"def send_packet(type, *args); end",
"def send(packet)\n id = Common.packet_to_id(packet)\n data = [id, [packet.to_a]].to_msgpack\n\n @stream.write Common.encode_u16(data.length)\n @stream.write data\n end",
"def send_packet(o... | [
"0.6779186",
"0.62888664",
"0.5959951",
"0.59585136",
"0.5905128",
"0.5902042",
"0.5777613",
"0.5742288",
"0.5740857",
"0.5662232",
"0.561634",
"0.5510799",
"0.55103225",
"0.5501953",
"0.55000246",
"0.5499275",
"0.5460246",
"0.5453468",
"0.5433338",
"0.5427618",
"0.5410258",
... | 0.0 | -1 |
Inject the ping, wait for a reply | def test_ping
@tt.sock.send(@ping, 0)
=begin
pong = @tt.ping_reply
assert_equal(42, pong.length)
assert_equal(pong[0, 6], @tt.tap_mac)
assert_equal(pong[30, 4], @ping[26, 4])
assert_equal(pong[26, 4], @ping[30, 4])
=end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receive_ping\n done\n end",
"def answer_pings\n\t\t@ping_thread = Thread.new do \n\t\t\tbegin\n\t\t\t\tloop do \n\t\t\t\t\tpkt = @tap.recv\n\t\t\t\t\ticmp = icmp_offset(pkt)\n\t\t\t\t\tif icmp and pkt[icmp] == \"\\x08\" #type == Echo Request\n\t\t\t\t\t\tpkt[icmp, 1] = \"\\x00\"\n\t\t\t\t\t\tpkt[26,... | [
"0.7021026",
"0.6859055",
"0.6825523",
"0.6821041",
"0.67719823",
"0.67679584",
"0.6755358",
"0.6702995",
"0.66381335",
"0.6636855",
"0.6563121",
"0.6555176",
"0.6546835",
"0.653526",
"0.6516619",
"0.6499136",
"0.6424626",
"0.6418448",
"0.6381148",
"0.63515",
"0.6339035",
"... | 0.6390251 | 19 |
adds a new comment line to the stanza a.add_comment("comment line 1") => "comment line 1\n" a.add_comment("comment line 2") => "comment line 1\ncomment line 2\n" | def add_comment(comment)
@comment += comment + "\n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end",
"def add_comment(comment)\n \"\\n+++++++++++++++++++++++++++++++++++++++++ #{comment} ++++++++++++++++++++++++++++++++++++++++++++++\\n\"\n end",
"def add_comment(comment); end",
"def add_comment(comment)\n comments << comment\n... | [
"0.78819287",
"0.78786945",
"0.7835293",
"0.74841195",
"0.71563196",
"0.7152581",
"0.7152581",
"0.7101909",
"0.7045158",
"0.7024612",
"0.7013899",
"0.69431204",
"0.69248134",
"0.6909941",
"0.68907017",
"0.68595535",
"0.6850955",
"0.6821757",
"0.6789889",
"0.6695835",
"0.66480... | 0.79182476 | 0 |
deletes the whole comment a.add_comment("comment line") => "comment line\n" a.del_comment => "" | def del_comment
@comment = ''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_comment\n Jhead.call(\"-dc\", @match, @pattern)\n end",
"def delete_comments\n end",
"def clear_comment\n @comment = ''\n end",
"def clear_comment\n @comment = nil\n end",
"def delete_comment(permlink)\n @operations << {\n type: :delete_comment,\n author... | [
"0.74403244",
"0.7317282",
"0.7172244",
"0.6778654",
"0.67666095",
"0.6747538",
"0.668822",
"0.6663774",
"0.64869255",
"0.64178973",
"0.6335278",
"0.63106674",
"0.63004947",
"0.62994826",
"0.62621725",
"0.62621725",
"0.6204798",
"0.6204798",
"0.6204798",
"0.6204798",
"0.62047... | 0.81099564 | 0 |
returns the value of the specified attribute v = a.get_attribute('check') | def get_attribute(name)
return @attrs[name] if attrs.key?(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute(name); end",
"def get_attribute(name); end",
"def get_attribute_value(attribute)\n data[attribute]\n end",
"def attribute_value(element,attribute_name)\n element.attribute_value(element,attribute_name)\n end",
"def attr_val(xpath)\n Utilities::attr_val(@entry, xpath)\n end... | [
"0.66421586",
"0.66421586",
"0.63884515",
"0.6163415",
"0.61432046",
"0.6122495",
"0.606357",
"0.6040753",
"0.6036353",
"0.60171807",
"0.6013283",
"0.59941906",
"0.5956427",
"0.59310615",
"0.5928786",
"0.5928759",
"0.5922613",
"0.5915168",
"0.5888726",
"0.5880625",
"0.5877002... | 0.60296535 | 9 |
returns an array with all defined attribute names | def attributes
@attrs.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_names\n names = []\n @attributes.each {|values| names << values.keys if values}\n names.flatten.uniq\n end",
"def attribute_names\n @name_to_definition.keys\n end",
"def attribute_names\n Array.new\n end",
"def attribute_names\n @attributes.k... | [
"0.8505624",
"0.84736454",
"0.84252155",
"0.8352495",
"0.8352495",
"0.8352495",
"0.8352495",
"0.83225507",
"0.8318437",
"0.8301183",
"0.8253476",
"0.8149641",
"0.8050792",
"0.8030455",
"0.8030455",
"0.7990227",
"0.79579973",
"0.7900929",
"0.7896835",
"0.78535855",
"0.77458996... | 0.7923086 | 17 |
returns an array with values of all defined attributes | def values
@attrs.values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_values\n attributes.values\n end",
"def attribute_values\n self.class.attributes.map{ |attr| self.send(attr) }\n end",
"def get_attribute_values() \n @attribute_values_flat\n end",
"def attribute_values\n @columns.map do |column|\n @attributes[column.to_sym]\n end\n... | [
"0.8428598",
"0.8252109",
"0.80586165",
"0.7900048",
"0.7869186",
"0.77861655",
"0.768842",
"0.7683403",
"0.7681068",
"0.7606674",
"0.7602948",
"0.7576233",
"0.7524324",
"0.752207",
"0.75210315",
"0.7489829",
"0.745894",
"0.74165",
"0.73908406",
"0.7385659",
"0.73841494",
"... | 0.8305699 | 1 |
returns a hash of all defined attributes and their values | def hash
@attrs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes\n self._attributes.inject({}) do |hash, attr|\n hash[attr.to_s] = send(attr)\n hash\n end\n end",
"def attributes\n self.attribute_keys.inject({}) do |hash, key|\n hash[key] = self.__send__(key) if self.__send__(key)\n hash\n end\n en... | [
"0.80528116",
"0.80184907",
"0.79381746",
"0.79381746",
"0.79156864",
"0.7883841",
"0.78540736",
"0.78540736",
"0.78382325",
"0.7722844",
"0.7633277",
"0.76304847",
"0.7627375",
"0.75675464",
"0.7539726",
"0.7530976",
"0.7530976",
"0.7530976",
"0.751265",
"0.75074893",
"0.750... | 0.796098 | 2 |
iterates over all attributes and their values of the stanza | def each # :yields: key, value
@attrs.each { |k, v| yield(k, v) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n attribute_nodes.each { |node|\n yield [node.node_name, node.value]\n }\n end",
"def each(&block)\n attributes.each_value(&block)\n end",
"def each_attribute(&block)\n attributes.each(&block)\n end",
"def each_value # :yields: value\n @at... | [
"0.7016488",
"0.6702836",
"0.6635908",
"0.6571965",
"0.6558202",
"0.65444684",
"0.65444684",
"0.6469031",
"0.6469031",
"0.6469031",
"0.6444459",
"0.6389196",
"0.6385704",
"0.6347323",
"0.6281575",
"0.62256867",
"0.5994635",
"0.59884393",
"0.595502",
"0.59475267",
"0.5945101",... | 0.6603074 | 3 |
iterates over all defined attributes of the stanza | def each_attribute # :yields: key
@attrs.each_key { |k| yield(k) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_attribute(&block)\n attributes.each(&block)\n end",
"def each_attribute(&block)\n\t\t @@attributes.each &block\n\t\tend",
"def each_attribute(&block)\n attributes.each_attribute(&block)\n end",
"def each(&block)\n attributes.each(&block)\n end",
"def each(&bloc... | [
"0.697392",
"0.69249916",
"0.6809585",
"0.6765727",
"0.6765727",
"0.6754741",
"0.6656659",
"0.65881854",
"0.65124506",
"0.65124506",
"0.65124506",
"0.6474743",
"0.6441365",
"0.64092124",
"0.63694936",
"0.63569",
"0.63235193",
"0.62999004",
"0.62546045",
"0.6199305",
"0.619576... | 0.67723835 | 3 |
iterates over values of all defined attributes | def each_value # :yields: value
@attrs.each_value { |v| yield(v) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each(&block)\n attributes.each_value(&block)\n end",
"def each_attribute(&block)\n\t\t @@attributes.each &block\n\t\tend",
"def each_attribute(&block)\n attributes.each(&block)\n end",
"def each(&block)\n attributes.each(&block)\n end",
"def each(&block)\n attr... | [
"0.7840875",
"0.7801646",
"0.7707179",
"0.75410813",
"0.75410813",
"0.75366783",
"0.7395516",
"0.7309664",
"0.72270757",
"0.7160881",
"0.71100175",
"0.70495236",
"0.6992391",
"0.6992391",
"0.6992391",
"0.69880444",
"0.69380045",
"0.6924982",
"0.6872758",
"0.68707085",
"0.6847... | 0.76103866 | 3 |
checks, if there are defined attributes in the stanza | def empty?
@attrs.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attributes?(dictname)\n self.attribute_dictionary(dictname) != nil || self.definition.attribute_dictionary(dictname) != nil\nend",
"def attributes?\n attributes.length > 0\n end",
"def attributes_exist?\n\tend",
"def has_attribute (attname)\n\n attname = OpenWFE::symbol_to_name(at... | [
"0.6667237",
"0.663154",
"0.6621138",
"0.6602748",
"0.6529551",
"0.64542085",
"0.64266586",
"0.6416513",
"0.63942903",
"0.63924587",
"0.63767976",
"0.6362387",
"0.6329119",
"0.6316705",
"0.62870085",
"0.6285805",
"0.6273722",
"0.6247211",
"0.62315756",
"0.6220304",
"0.6217878... | 0.57155925 | 74 |
checks, if the stanza has the named attribute | def attribute?(name)
@attrs.has_key(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attribute?(name)\n attributes.has_key?(name)\n end",
"def attribute_present?(name)\n @ldap_entry.attribute_names.include?(name)\n end",
"def has_attribute?(name)\n attribute_names.include?(name.to_str)\n end",
"def has_attribute (attname)\n\n attname = O... | [
"0.76009285",
"0.7487755",
"0.743086",
"0.7416144",
"0.7347288",
"0.7336513",
"0.73251325",
"0.7285576",
"0.7252058",
"0.7252058",
"0.72372365",
"0.7215799",
"0.7139017",
"0.7071151",
"0.70597833",
"0.70557064",
"0.7024301",
"0.6970203",
"0.69672847",
"0.6944751",
"0.69145226... | 0.7468452 | 2 |
run the action if valid and return true if successful | def execute
raise errors.to_sentences unless valid?
# default failing command
result = false
# protect command from recursion
mutex = Mutagem::Mutex.new('revenc.lck')
lock_successful = mutex.execute do
result = system_cmd(cmd)
end
raise "action failed, lock fil... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n return false if @action.nil?\n return false if @repeat.nil?\n true\n end",
"def perform\n\n r = validate\n return r unless r.success?\n\n process_hook\n\n end",
"def do_validation \n return true if self.ok\n set_ok\n self.ok\n end",
"def dete... | [
"0.7400286",
"0.71654207",
"0.6979898",
"0.6826977",
"0.68191534",
"0.67219174",
"0.66857904",
"0.6597611",
"0.6568028",
"0.6544408",
"0.6544408",
"0.6500844",
"0.6441684",
"0.6411995",
"0.6366991",
"0.6365401",
"0.6364009",
"0.6331249",
"0.6325392",
"0.6318473",
"0.62936914"... | 0.0 | -1 |
allow clarity in config files, instead of you can use | def mountpoint
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_files(override); end",
"def configurations; end",
"def test_no_overrides\n config = load_config('test_configs/good-config.conf')\n\n assert_equal(26214400, config.common.basic_size_limit)\n assert_equal(52428800, config.common.student_size_limit)\n assert_equal(2147483648, config.common.... | [
"0.6733022",
"0.6421451",
"0.6310899",
"0.6296636",
"0.6280822",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"0.62747645",
"... | 0.0 | -1 |
allow clarity in config files, instead of you can use | def mountpoint
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_files(override); end",
"def configurations; end",
"def test_no_overrides\n config = load_config('test_configs/good-config.conf')\n\n assert_equal(26214400, config.common.basic_size_limit)\n assert_equal(52428800, config.common.student_size_limit)\n assert_equal(2147483648, config.common.... | [
"0.6732138",
"0.6422101",
"0.6311787",
"0.62977695",
"0.6280734",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
"0.62746185",
... | 0.0 | -1 |
allow clarity in config files, instead of you can use | def source
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_files(override); end",
"def configurations; end",
"def test_no_overrides\n config = load_config('test_configs/good-config.conf')\n\n assert_equal(26214400, config.common.basic_size_limit)\n assert_equal(52428800, config.common.student_size_limit)\n assert_equal(2147483648, config.common.... | [
"0.6732277",
"0.64220226",
"0.63107705",
"0.6296296",
"0.6280866",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
"0.6274687",
... | 0.0 | -1 |
To acept invitation to friendship | def confirm_friend(user)
friendship = inverse_friendships.find { |friendship| friendship.user == user }
friendship.confirmed = true
friendship.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_invitation\n \n end",
"def invite_friend\n friend = params[:invite_friend]\n profile = User.find_by_id(friend[:user_id])\n\n UserMailer.send_invitation(friend, profile).deliver\n redirect_to profile_path(profile)\n end",
"def accept_contact_invitation(invitation)\n _sender = in... | [
"0.7644683",
"0.7343659",
"0.7231248",
"0.7128657",
"0.7126189",
"0.71250534",
"0.707319",
"0.69674605",
"0.69435585",
"0.68977493",
"0.68905014",
"0.68795186",
"0.68016803",
"0.6793625",
"0.67895955",
"0.6786706",
"0.67557013",
"0.6754776",
"0.67530483",
"0.67479306",
"0.670... | 0.6518691 | 47 |
To reject invitation to friendship | def reject_friend(user)
friendship = inverse_friendships.find { |friendship| friendship.user == user }
friendship.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject_invite(event)\n invite = Invite.where(user: self, event: event)\n invite.reject if invite.present?\n end",
"def reject_previa_invitation\n previa_invitation = PreviaInvitation.find(params[:previa_invitation_id])\n RejectPreviaInvitation.call(@previa_group, previa_invitation)\n\n respon... | [
"0.7332341",
"0.724284",
"0.7204649",
"0.7173549",
"0.7125725",
"0.7065963",
"0.69978875",
"0.69701207",
"0.69555736",
"0.6917505",
"0.68794364",
"0.6807458",
"0.6793481",
"0.67203224",
"0.6689658",
"0.6689658",
"0.6648929",
"0.6616457",
"0.6602841",
"0.6595286",
"0.65721095"... | 0.74859554 | 0 |
validate if user are already friends | def friend?(user)
friends.include?(user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_already_friends\n unless Friendship.find_friendship(requester_id, requestee_id).nil?\n errors.add(:base, \"You are already friends with this user\")\n end\n end",
"def is_friend\n friend_request_exists? && @friend.accepted?\n end",
"def user_already_friend(friend_id)\n @friend =... | [
"0.8543595",
"0.73915565",
"0.7255019",
"0.72174656",
"0.71600676",
"0.7110956",
"0.70729285",
"0.70638424",
"0.7062767",
"0.70569927",
"0.7050016",
"0.7038004",
"0.7016293",
"0.69127923",
"0.68870133",
"0.68792707",
"0.6837296",
"0.67978835",
"0.67828083",
"0.6766119",
"0.67... | 0.7074478 | 6 |
Adds a new user to room and if song is playing, puts them in wherever that song is | def get_time
response.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript
room = Room.find(params[:room_id])
current_song = Song.where(currently_playing: true, room_id: room.id).first # Finds currently playing song in room
# Add new user to user list
$redis.publish("add... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song\n \t# add this song to the users personal list (history)\n new_song = Song.create(title: params[:title], video_id: params[:video_id], status: \"added to MusiQ!\")\n current_user.songs << new_song\n\n # add this song to the player queue (tracks)\n Track.create(title: params[:title], video_... | [
"0.69721615",
"0.67123425",
"0.64039135",
"0.6402615",
"0.63491696",
"0.6322234",
"0.63052016",
"0.6274008",
"0.6230464",
"0.62278265",
"0.61834216",
"0.61598253",
"0.61360013",
"0.613043",
"0.6115356",
"0.6081806",
"0.6075316",
"0.6047358",
"0.6043348",
"0.603587",
"0.602003... | 0.0 | -1 |
When user closes window or leaves the page, removes them from the room | def remove_user
room = Room.find(params[:room_id].to_i)
user = current_user
room.users.delete(user) # Deletes user from room when they leave the browser window
# --- If no users remain in room, all data about the room deletes itself ---
if room.users.length == 0
room.songs.each do |song|
song.destroy
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # Clean up the windows\n (0...@menu_items).each do |x|\n CDK.deleteCursesWindow(@title_win[x])\n CDK.deleteCursesWindow(@pull_win[x])\n end\n\n # Clean the key bindings.\n self.cleanBindings(:MENU)\n\n # Unregister the object\n CDK::SCREEN.unregister(:... | [
"0.69395036",
"0.686205",
"0.684228",
"0.6835684",
"0.68020487",
"0.67303956",
"0.66811556",
"0.6676443",
"0.6663217",
"0.66451883",
"0.654129",
"0.6478907",
"0.64522594",
"0.6437403",
"0.6362682",
"0.6342758",
"0.633801",
"0.62715334",
"0.62715334",
"0.626089",
"0.62572986",... | 0.58235663 | 55 |
Adds song to the room playlist when user adds song | def add_song
response.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript
room = current_user.room
new_song_params = song_params
new_song_params[:added_by] = current_user.username
# --- If this is the first song, set it as currently playing ---
if room.songs.length == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song\n \t# add this song to the users personal list (history)\n new_song = Song.create(title: params[:title], video_id: params[:video_id], status: \"added to MusiQ!\")\n current_user.songs << new_song\n\n # add this song to the player queue (tracks)\n Track.create(title: params[:title], video_... | [
"0.78611034",
"0.7597087",
"0.7592497",
"0.7357058",
"0.73310965",
"0.7317709",
"0.72856754",
"0.7271371",
"0.7249549",
"0.7229898",
"0.7225565",
"0.7225565",
"0.7225565",
"0.7225565",
"0.7225565",
"0.7225565",
"0.7201938",
"0.7199865",
"0.71824867",
"0.7170738",
"0.7133339",... | 0.74751383 | 3 |
Controls which song is playing (whether queued or the first) | def change_song
response.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript
room = current_user.room
current_sc_ident = params[:current_sc_ident]
ended_song = Song.where(sc_ident: current_sc_ident, room_id: room.id).first # Finds ended song
# --- If a song ended, reset ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_song(sender)\n clicked_pos = self.songs_view.clickedRow\n if clicked_pos == -1 # first song or same song\n if @current_song.try(:song).try(:playing?) # same song\n clicked_pos = @current_song.position\n else\n clicked_pos = 0\n end\n end\n @current_song.song... | [
"0.73919517",
"0.69772655",
"0.6887195",
"0.68688834",
"0.67261654",
"0.6702406",
"0.66937894",
"0.66706854",
"0.66009235",
"0.6574403",
"0.65718836",
"0.6556441",
"0.64738536",
"0.64348006",
"0.64334714",
"0.6420932",
"0.6406642",
"0.63986206",
"0.6389006",
"0.63497716",
"0.... | 0.61286056 | 74 |
Action triggered when someone likes or dislikes a song | def like_or_dislike
response.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript
room = current_user.room
users = room.users.length
current_song = Song.where(currently_playing: true).first
likes = current_song.likes
dislikes = current_song.dislikes
# --- Increments e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def like!\n self.like_count = self.like_count + 1\n self.save\n logger.debug \"Song :: #{self.title} liked.\"\n end",
"def unlike!\n new_count = self.like_count - 1\n if new_count < 0\n logger.error \"Song :: #{self.attributes.inspect} unliked by 1 \" <<\n \"would result in... | [
"0.70407194",
"0.6779559",
"0.6720512",
"0.66005766",
"0.6572319",
"0.64721644",
"0.6470174",
"0.64518684",
"0.6428306",
"0.6384434",
"0.63829035",
"0.6369487",
"0.6353685",
"0.63347715",
"0.6308506",
"0.6308506",
"0.6308506",
"0.6277095",
"0.6239513",
"0.6223129",
"0.622277"... | 0.7183913 | 0 |
Leave a message in the room chatroom | def add_message
response.headers['Content-Type'] = 'text/javascript' # Tells Rails/Redis that content is JavaScript
room = current_user.room
message = params[:message]
# -- Add new message to chatroom ---
$redis.publish("add_message_#{room.id}", {message: message, author: current_user.username}.to_json)
# -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def local_leave(body)\n room = body.dup\n room = @var[:room] unless room.length >= 1\n room_hash = MD5::digest(room)[0,8]\n room_hash = EMPTY_ROOM if room == 'chat'\n unless room == 'chat'\n @connection.room_names.delete(room_hash)\n @connection.room_ids.delete(room)\n end\n _server_control('leave', r... | [
"0.74896914",
"0.7399422",
"0.7192206",
"0.68768543",
"0.68198234",
"0.6767671",
"0.6646908",
"0.6579945",
"0.64311045",
"0.6374302",
"0.63518375",
"0.6289329",
"0.6219885",
"0.6209548",
"0.6204505",
"0.6202172",
"0.61805",
"0.6106205",
"0.6090185",
"0.6084222",
"0.60237",
... | 0.0 | -1 |
Controls all redis subscriptions to each room | def events
response.headers['Content-Type'] = 'text/event-stream' # Starts a Redis event stream (thread)
room_id = params[:room_id]
sse = Streamer::SSE.new(response.stream) # Opens server sent event stream
redis ||= Redis.new # If the user doesn't already have a thread open, creates a new redis thread
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end",
"def subscriptions\n @subscriptions ||= get_roster || {}\n end",
"def subsc... | [
"0.669395",
"0.669395",
"0.669395",
"0.65512097",
"0.64849454",
"0.63987356",
"0.6394375",
"0.62831265",
"0.61796105",
"0.5994424",
"0.59377587",
"0.58995855",
"0.58623654",
"0.5860085",
"0.5835288",
"0.5780236",
"0.57313126",
"0.57241994",
"0.5687405",
"0.56284106",
"0.56012... | 0.59852093 | 10 |
Rails 4 strong parameters | def song_params
params.require(:song).permit(:title, :artist, :stream_url, :album_art, :sc_ident, :genre)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def strong_parameters\n\t\t\tattrs = self.attribute_names - [\"created_at\", \"updated_at\", \"id\"]\n\t\t\tattrs.push(:_color) if colored? # ... | [
"0.71559966",
"0.70680976",
"0.7047804",
"0.7003778",
"0.6958022",
"0.69249296",
"0.6912512",
"0.6893983",
"0.6862227",
"0.6831396",
"0.67965853",
"0.6783197",
"0.67789644",
"0.677275",
"0.67722774",
"0.6769185",
"0.6765082",
"0.67494696",
"0.67460316",
"0.6739571",
"0.673730... | 0.0 | -1 |
Default role is "Registered" | def setup_role
if self.role_ids.empty?
self.role_ids = self.roles.find_by_name(:registered).id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role; end",
"def role; end",
"def set_default_role\n add_role :user\n end",
"def check_default_role\n roles << :user if roles.empty?\n end",
"def set_default_role\n self.add_role :merchant\n end",
"def resource_name\n\t\t\"role\"\n\tend",
"def default_role\n self.role ||= Roles::US... | [
"0.7417596",
"0.7417596",
"0.7228715",
"0.71749336",
"0.7132338",
"0.70743525",
"0.70688635",
"0.7032179",
"0.7032179",
"0.7017553",
"0.6979593",
"0.69676715",
"0.69223356",
"0.6914152",
"0.6906071",
"0.6901876",
"0.6888237",
"0.68881744",
"0.68857217",
"0.68757975",
"0.68635... | 0.6774736 | 30 |
=begin Rule 1: If a word begins with a vowel sound, add an "ay" sound to the end of the word. Rule 2: If a word begins with a consonant sound, move it to the end of the word, and then add an "ay" sound to the end of the word. =end | def translate word
split = word.split(" ")
latin = ""
vowels = ["a", "e", "i", "o", "u"]
split.each do |string|
a = 0
consts = 0
while vowels.include?(string[a]) === false
consts = consts + 1
a = a + 1
end
if string[consts -1] === "q"
if string[consts] === "u"
consts = consts + 1
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_one_vowel( word )\n\n\t\t\t\tword + \"ay\"\n\n\tend",
"def translateForOneWord(msg)\n aryChar = msg.split(\"\")\n if aryChar[0].match(/a|e|i|o|u/)\n aryChar << \"ay\"\n elsif (not aryChar[0].match(/a|e|i|o|u/)) && aryChar[1] == \"q\" && aryChar[2] == \"u\" # consonant + q and u\n aryChar ... | [
"0.704367",
"0.69474435",
"0.686537",
"0.6815762",
"0.6800243",
"0.6773308",
"0.67237073",
"0.6701141",
"0.6693245",
"0.66295177",
"0.65545654",
"0.6541977",
"0.65395385",
"0.6536398",
"0.65240294",
"0.65121",
"0.6465527",
"0.63948023",
"0.6368642",
"0.6336968",
"0.63141274",... | 0.58664024 | 86 |
Creates a new instance of +Server+. Parameters: +sphinx+ an instance of Sphinx::Client. +host+ name of host where search is running (if +path+ is not specified). +port+ searchd port (if +path+ is not specified). +path+ an absolute path to the UNIX socket. | def initialize(sphinx, host, port, path)
@sphinx = sphinx
@host = host
@port = port
@path = path
@socket = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_server(host = T.unsafe(nil), port = T.unsafe(nil)); end",
"def start(host, port); end",
"def initialize(host, port)\n @server = TCPServer.new(host, port)\n @handlers = []\n end",
"def SetServer(host, port)\n assert { host.instance_of? String }\n assert { port.instance_of? Fixnum }\... | [
"0.5594412",
"0.5416286",
"0.5379824",
"0.5361775",
"0.5352438",
"0.52685624",
"0.5267949",
"0.52653223",
"0.5235736",
"0.5220261",
"0.52015823",
"0.51188904",
"0.5064516",
"0.5047714",
"0.50331616",
"0.5024376",
"0.49999025",
"0.4997495",
"0.49836528",
"0.4982807",
"0.492555... | 0.74168634 | 0 |
Closes previously opened socket. Pass socket retrieved with +get_socket+ method when finished work. It does not close persistent sockets, but if really you need to do it, pass +true+ as +force+ parameter value. | def free_socket(socket, force = false)
# Socket has not been open
return false if socket.nil?
# Do we try to close persistent socket?
if socket == @socket
# do not close it if not forced
if force
@socket.close unless @socket.closed?
@socket = nil
true
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close_socket\n raise \"no wrapped socket\" unless @socket\n return if @socket.closed?\n @socket.shutdown rescue nil\n @socket.read_nonblock(4*1024*1024) rescue nil # flush any in-flight crud\n @socket.close rescue nil\n end",
"def close\n @socket.close unless closed?\n en... | [
"0.74618447",
"0.7310552",
"0.72118384",
"0.72118384",
"0.7152151",
"0.7144353",
"0.7119173",
"0.71102536",
"0.7004869",
"0.6997891",
"0.6935172",
"0.6935172",
"0.6934835",
"0.6921245",
"0.6905767",
"0.6849411",
"0.68151766",
"0.67759395",
"0.6760862",
"0.6729074",
"0.6721646... | 0.7692072 | 0 |
Makes specified socket persistent. Previous persistent socket will be closed as well. | def make_persistent!(socket)
unless socket == @socket
close_persistent!
@socket = socket
end
@socket
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def establish_socket_server\n @socket_server = Uninterruptible::Binder.new(server_configuration.bind).bind_to_socket\n # If there's a file descriptor present, take over from a previous instance of this server and kill it off\n kill_parent if ENV[SERVER_FD_VAR]\n\n @socket_server.autoclose = fal... | [
"0.63120115",
"0.6288325",
"0.62532675",
"0.61098105",
"0.6006964",
"0.5955402",
"0.58841795",
"0.5821988",
"0.5801407",
"0.57869214",
"0.57677513",
"0.57537574",
"0.5750768",
"0.5743412",
"0.5699591",
"0.56778175",
"0.5670622",
"0.5670094",
"0.564836",
"0.5644338",
"0.558547... | 0.85184395 | 0 |
Gets a value indicating whether server has persistent socket associated. | def persistent?
!@socket.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def established?\n !! @socket\n end",
"def connected?\n !!@socket\n end",
"def connected?\n !!@socket\n end",
"def socket?() end",
"def keep_alive?\n !!@keep_alive && !@socket.closed?\n end",
"def server?\n return (server == true)\n end",
"def server?\r\n ... | [
"0.6897089",
"0.6770907",
"0.6770907",
"0.6674369",
"0.6578982",
"0.6525788",
"0.6471464",
"0.64440286",
"0.63950807",
"0.6365905",
"0.63500303",
"0.633994",
"0.6337248",
"0.63261163",
"0.6322125",
"0.63032234",
"0.62974536",
"0.62974536",
"0.62215644",
"0.62215644",
"0.62036... | 0.7811962 | 0 |
Returns a string representation of the sphinx server object. | def to_s
@path || "#{@host}:#{@port}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"<Sphinx::Server: %s%s>\" % [to_s, @socket ? '; persistent' : '']\n end",
"def server\n @server.to_s\n end",
"def inspect\n \"<Mongo::Client:0x#{object_id} cluster=#{cluster.addresses.join(', ')}>\"\n end",
"def inspect\n \"#<Mongo::Client:0x#{object_id} cluster=#{clus... | [
"0.76912266",
"0.6989526",
"0.61135745",
"0.6085807",
"0.60480475",
"0.5997308",
"0.5976979",
"0.5974297",
"0.58914876",
"0.5855073",
"0.58374804",
"0.5818098",
"0.5812243",
"0.58083534",
"0.5794526",
"0.57700896",
"0.5765284",
"0.5765284",
"0.57400686",
"0.5691846",
"0.56914... | 0.0 | -1 |
Returns a string representation of the sphinx server object. | def inspect
"<Sphinx::Server: %s%s>" % [to_s, @socket ? '; persistent' : '']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server\n @server.to_s\n end",
"def inspect\n \"<Mongo::Client:0x#{object_id} cluster=#{cluster.addresses.join(', ')}>\"\n end",
"def inspect\n \"#<Mongo::Client:0x#{object_id} cluster=#{cluster.summary}>\"\n end",
"def to_s\n \"#<#{self.class.name}:0x#{object_id.to_s(16).rjus... | [
"0.698706",
"0.6110169",
"0.6082418",
"0.6045813",
"0.5994401",
"0.59764504",
"0.59726906",
"0.5890999",
"0.58519346",
"0.583518",
"0.58178014",
"0.58101046",
"0.5806294",
"0.5793271",
"0.5768407",
"0.5763046",
"0.5763046",
"0.57369506",
"0.5690198",
"0.56896806",
"0.568849",... | 0.76900584 | 0 |
This is internal method which establishes a connection to a configured server. Method configures various socket options (like TCP_NODELAY), and sets socket timeouts. It does not close socket on any failure, please do it from calling code! | def establish_connection
if @path
sock = UNIXSocket.new(@path)
else
sock = TCPSocket.new(@host, @port)
end
io = Sphinx::BufferedIO.new(sock)
io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
if @sphinx.reqtimeout > 0
io.read_timeout = @sphinx.reqtime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect\n addr = Socket.getaddrinfo(@host, nil, Socket::AF_INET)\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n sock.setsockopt Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1\n\n if @ssl\n sock = OpenSSL::SSL::SSLSocket.new(sock)\n sock.sync_close = t... | [
"0.73289883",
"0.72589976",
"0.72395676",
"0.716428",
"0.7127931",
"0.7091727",
"0.69984835",
"0.6950984",
"0.6922471",
"0.6892458",
"0.6892458",
"0.67698824",
"0.6765563",
"0.6762129",
"0.672712",
"0.6717433",
"0.6710559",
"0.6684885",
"0.66308916",
"0.6627588",
"0.66207904"... | 0.58744425 | 81 |
RENDER AVATAR IMAGE FOR NAVIGATION (DEFAULT or USER) | def render_tiny_avatar_for(user)
if user.avatar?
image_tag(user.avatar.tiny.url).html_safe
else
image_tag('fallback/default.gif', height: '35px', width: '35px').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header_nav_avatar\n if current_user.role? :superadmin\n avatar = current_user.institution.institution_logo.url(:thumb)\n else\n avatar = current_user.user_avatar.url(:thumb)\n end\n\n image_tag(avatar, class: 'img-squared', id: 'nav-user-avatar')\n end",
"def linked_in_avatar(user)\n ... | [
"0.7659889",
"0.7007093",
"0.6948469",
"0.68974906",
"0.6771954",
"0.6755303",
"0.67031825",
"0.6667642",
"0.6667642",
"0.66435564",
"0.66362065",
"0.66104823",
"0.66044676",
"0.6549794",
"0.6544316",
"0.6536814",
"0.6529542",
"0.6511762",
"0.6511262",
"0.65027183",
"0.648695... | 0.69457936 | 3 |
REDNER AVATARS FOR ANSWERS SECTION | def render_answer_avatar_for(user)
if user.avatar?
image_tag(user.avatar.tiny.url, class: 'media-object tiny-thumbnail').html_safe
else
image_tag('fallback/default.gif', height: '30px', width: '30px', class: 'media-object tiny-thumbnail').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def aon; end",
"def draw_tactic_overview\n end",
"def analize!\n SpinningCursor.run do\n banner \"Analyzing\".yellow\n type :dots\n \n action do\n read_configs!\n load_config!\n ... | [
"0.5965053",
"0.5800742",
"0.5756517",
"0.5747528",
"0.5745034",
"0.56876093",
"0.56769323",
"0.5657678",
"0.5653859",
"0.5648731",
"0.5633586",
"0.5633586",
"0.5577147",
"0.5552252",
"0.55487543",
"0.5506087",
"0.54904497",
"0.54755634",
"0.5463444",
"0.54473704",
"0.5430049... | 0.0 | -1 |
RENDER AVATAR IMAGE FOR RELATED POSTS LISTS | def render_super_tiny_avatar_for(user)
if user.avatar?
image_tag(user.avatar.small.url, class: 'media-object thumbnail').html_safe
else
image_tag('fallback/default.gif', height: '35px', width: '35px', class: 'media-object thumbnail').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '150px', width: '150px', class: 'media-object thumbnail').html_safe\n end\n end",
"def render_tiny_a... | [
"0.66650856",
"0.6652538",
"0.6420207",
"0.6292995",
"0.6203664",
"0.61744326",
"0.6007594",
"0.5938135",
"0.5923969",
"0.59010375",
"0.5867756",
"0.580901",
"0.5802148",
"0.5790783",
"0.5790783",
"0.5772652",
"0.5762128",
"0.5761519",
"0.575918",
"0.5743462",
"0.5741312",
... | 0.5733952 | 21 |
RENDER AVATAR FOR ABOUT COMMENT SECTION | def render_comment_avatar_for(comment_user)
if comment_user.avatar?
image_tag(comment_user.avatar.profile.url, class: "media-object thumbnail").html_safe
else
image_tag('fallback/default.gif', height: '55px', width: '55px', class: 'media-object thumbnail').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n imag... | [
"0.68134946",
"0.650891",
"0.64730036",
"0.6379644",
"0.6348767",
"0.63084227",
"0.62504476",
"0.6227231",
"0.6213465",
"0.6213465",
"0.6204629",
"0.6198517",
"0.61867654",
"0.61599165",
"0.6144081",
"0.61018676",
"0.6022419",
"0.60143584",
"0.60129774",
"0.59999526",
"0.5974... | 0.6600763 | 1 |
RENDER AVATAR FOR ABOUT AUTHOR SECTION | def render_author_avatar_for(post_user)
if post_user.avatar?
image_tag(post_user.avatar.url, class: "media-object thumbnail").html_safe
else
image_tag('fallback/default.gif', height: '150px', width: '150px', class: 'media-object thumbnail').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def author_avatar\n anonymous? ? Avatar.default.url : user.profile.avatar.... | [
"0.70474756",
"0.6945093",
"0.6898101",
"0.6875072",
"0.6786553",
"0.6691355",
"0.66383195",
"0.6610875",
"0.6606187",
"0.6505367",
"0.6492023",
"0.64617276",
"0.6457469",
"0.6434366",
"0.6406835",
"0.6377766",
"0.6363128",
"0.6317321",
"0.62794596",
"0.62714565",
"0.62550104... | 0.67911756 | 4 |
RENDER TINY AVATAR FOR INDEX PAGES | def render_tiny_author_avatar_for(post_user)
if post_user.avatar?
image_tag(post_user.avatar.tiny.url).html_safe
else
image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def index\n @avatars = Avatar.all\n end",
"def index\n if current_user\n @sprites = current_user.sprites\n end\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @pictures=PictureSet.get ... | [
"0.61270094",
"0.61270094",
"0.60932976",
"0.596506",
"0.5800409",
"0.5796052",
"0.5780813",
"0.5734483",
"0.5713514",
"0.56922287",
"0.5668972",
"0.5657449",
"0.56554186",
"0.55905235",
"0.55602896",
"0.5547598",
"0.55355513",
"0.552031",
"0.55197096",
"0.55076605",
"0.54722... | 0.57239026 | 8 |
RENDER SMALL POST IMAGE FOR AUTHOR POSTS | def render_small_post_image_for(post)
if post.image?
image_tag(post.image_thumb.url, class: 'media-object thumbnail')
else
image_tag('fallback/default_image.jpg', class: 'media-object thumbnail', height: '50px', width: '75px')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n imag... | [
"0.6867476",
"0.6600203",
"0.6345198",
"0.61566204",
"0.5934144",
"0.58220816",
"0.58039284",
"0.57195777",
"0.57086766",
"0.57051134",
"0.5661391",
"0.56057125",
"0.5586914",
"0.5554712",
"0.5551011",
"0.55166495",
"0.5459921",
"0.54542637",
"0.54323417",
"0.5419206",
"0.541... | 0.64485556 | 2 |
Default hash function is extremely slow. | def hash
object_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash(*) end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def default_hash_function(plain_token)\n ::Digest::SHA256.hexdigest plain_token\n end",
"def gnu_hash(s)\n s.bytes.reduce(5381) { |... | [
"0.82528865",
"0.8251502",
"0.8251502",
"0.8251502",
"0.8251502",
"0.8251502",
"0.8251502",
"0.8251502",
"0.75883293",
"0.7556482",
"0.7555475",
"0.7552866",
"0.74530864",
"0.73865265",
"0.7378056",
"0.7342356",
"0.7342356",
"0.7297372",
"0.72404104",
"0.722893",
"0.714592",
... | 0.0 | -1 |
def checkmate?(color) king_pos = find_king_position(color) | def deep_dup
new_board = Board.new(false)
self.grid.each.with_index do |row, idx1|
row.each.with_index do |cell, idx2|
if self.grid[idx1][idx2].nil?
next
else
new_board.grid[idx1][idx2] = self.grid[idx1][idx2].dup
new_board.grid[idx1][idx2].board = new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check?(color)\n board.each do |line|\n a = line.find do |p|\n p != ' ' && p.type == 'king' && p.color == color\n end\n @king_position = a.position unless a.nil?\n end\n total_all_possible_moves(other_color(color)).include?(@king_position)\n end",
"def in_check?(color)\n own... | [
"0.81043154",
"0.79952204",
"0.7971358",
"0.79441386",
"0.785355",
"0.78392774",
"0.7802456",
"0.7782881",
"0.77545893",
"0.77477765",
"0.7736775",
"0.7729141",
"0.76488554",
"0.7631451",
"0.7630652",
"0.7611096",
"0.7601964",
"0.7568874",
"0.7567485",
"0.75366217",
"0.751441... | 0.0 | -1 |
attendee module end cron job | def cron_invite_email
@invites = Invite.find(:all, :conditions => ['draft=0 AND immediately=0'])
if @invites.count > 0
for inv in @invites
@eve = Event.find(inv[:event_id])
now_date = Time.now.strftime('%Y-%m-%d %H:%M')
@eve_date = @eve[:event_start_date_time]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# if min == 0\r\n# ret = ActiveRecord::Base.connection.execute(\"delete from invites where invitee_id is null and created_at < subdate(now(), interval 3 day)\")\r\n# puts \"recycle invites: #{... | [
"0.6317609",
"0.62255657",
"0.61401373",
"0.5907076",
"0.5888588",
"0.588666",
"0.58531326",
"0.58320904",
"0.581056",
"0.58069825",
"0.5797619",
"0.5769174",
"0.5762142",
"0.5743988",
"0.5738779",
"0.5730469",
"0.5668003",
"0.5643517",
"0.5632673",
"0.5626673",
"0.5620838",
... | 0.63816243 | 0 |
AWTonly (experimental) Add a border to the image and yield/return a new image. The following options are supported: width: How thick is the border (default: 3) color: Which color is the border (in rrggbb hex value) style: etched, raised, plain (default: plain) | def add_border(options = {})
border_width = options[:width].to_i || 2
color = hex_to_color(options[:color]) || hex_to_color("000000")
style = options[:style]
style = nil if style.to_sym == :plain
new_width, new_height = width + 2*border_width, height + 2*border_width
target = paint(BufferedImage... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_border(size=3,r=0,g=0,b=0)\n width = @x_size+2*size\n height = @y_size+2*size\n resampled = image_create_true_color(width,height)\n image_filled_rectangle(resampled,0,0,width,height, r, g, b)\n image_copy(@picture,resampled,size,size,0,0,@x_size,@y_size)\n image_destroy(@picture)\n ... | [
"0.7394333",
"0.71317846",
"0.69285035",
"0.6227763",
"0.62206155",
"0.6207315",
"0.61930245",
"0.61468846",
"0.5991667",
"0.5952157",
"0.58396745",
"0.5797284",
"0.5794232",
"0.57767475",
"0.5761508",
"0.574726",
"0.5744277",
"0.5664985",
"0.55991274",
"0.55198663",
"0.54612... | 0.83028764 | 0 |
Save using the format string (jpg, gif, etc..) to the open Java File instance passed in. | def save_impl(format, file)
ImageIO.write(@src, format, file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_impl(format, file)\n write_new_image format, FileImageOutputStream.new(file)\n end",
"def save_as(filename, size = :medium)\n format = size.to_sym == :original ? self.original_format : 'jpg'\n filename = \"#{filename}.#{format}\"\n\n if File.exists?(filename) or not self.url(size)\n fa... | [
"0.7340727",
"0.6647889",
"0.6472959",
"0.64016455",
"0.636578",
"0.636578",
"0.636578",
"0.6301097",
"0.61790663",
"0.6170129",
"0.61600435",
"0.61600435",
"0.615194",
"0.6096807",
"0.6096807",
"0.6090428",
"0.60626847",
"0.6043146",
"0.60198903",
"0.59080076",
"0.589191",
... | 0.74984217 | 0 |
Creates a viewable frame displaying current image within it. | def preview(&block)
frame = JFrame.new("Preview")
frame.add_window_listener WindowClosed.new(block)
frame.set_bounds 0, 0, width + 20, height + 40
frame.add JImagePanel.new(self, 10, 10)
frame.visible = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preview(&block)\n frame = JFrame.new('Preview')\n frame.add_window_listener WindowClosed.new(block)\n frame.set_bounds 0, 0, width + 20, height + 40\n frame.add JImagePanel.new(self, 10, 10)\n frame.visible = true\n end",
"def create_frame\n @frame = Sprite.new(@viewport)\n end",
"d... | [
"0.7013854",
"0.6389764",
"0.63075644",
"0.62819684",
"0.621159",
"0.6181154",
"0.58971006",
"0.5794337",
"0.56814384",
"0.56782615",
"0.5647494",
"0.5594491",
"0.55600834",
"0.5548629",
"0.55430186",
"0.55306965",
"0.549915",
"0.543778",
"0.54318213",
"0.54105943",
"0.540617... | 0.70043683 | 1 |
Determines the best colorspace for a new image based on whether the existing image contains an alpha channel or not. | def color_type
@src.color_model.has_alpha ? ARGB : RGB
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorspace\n return unless valid?\n\n case metadata[:colorspace].to_s\n when /rgb/i\n \"rgb\"\n when /cmyk/i\n \"cmyk\"\n when /gray/i, /b-w/i\n \"gray\"\n end\n end",
"def better?(new_image)\n image.size < MIN_GOOD_IMAGE_SIZE &&\n new_image.size ... | [
"0.5648848",
"0.54324985",
"0.52970994",
"0.52732193",
"0.5228494",
"0.5186173",
"0.51485044",
"0.4983638",
"0.49662283",
"0.49192905",
"0.49081498",
"0.48724866",
"0.4866522",
"0.48427555",
"0.48175856",
"0.48045373",
"0.477964",
"0.47504473",
"0.47404486",
"0.47212884",
"0.... | 0.47449672 | 18 |
Make a duplicate of the underlying Java src image | def dup_src
BufferedImage.new width, height, color_type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dup_src\n BufferedImage.new to_java.color_model, to_java.raster, true, nil\n end",
"def image_shallow_copy(another_image)\n\n java_import Java::edu.stanford.cfuller.imageanalysistools.image.ImageFactory\n\n ImageFactory.createShallow(another_image)\n\n end",
"def image_copy(another_image)\n\n ... | [
"0.78798985",
"0.71392083",
"0.70622176",
"0.64373237",
"0.63903433",
"0.62874836",
"0.6236427",
"0.6221529",
"0.6221529",
"0.61722434",
"0.6113216",
"0.6082461",
"0.60815096",
"0.6029008",
"0.59899586",
"0.59765214",
"0.59544057",
"0.59544057",
"0.5940828",
"0.5925561",
"0.5... | 0.7697969 | 1 |
Do simple AWT operation transformation to target. | def transform(operation, target=dup_src)
paint(target) do |g|
g.draw_image(@src, 0, 0, nil)
g.draw_image(operation.filter(target, nil), 0, 0, nil)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform\n # Pass through\n @target.transform\n end",
"def awt(*r,&k)\r\n if ctx = __cheri_ctx\r\n if k\r\n AWTFrame.new(ctx,*r,&k).run\r\n else\r\n ctx[:awt_proxy] ||= AWTProxy.new(ctx,*r)\r\n end\r\n end\r\n end",
"def update_weight(target, ouput, weight)\n ... | [
"0.58043313",
"0.54016024",
"0.5332452",
"0.5321281",
"0.5302768",
"0.52867466",
"0.51788974",
"0.51212746",
"0.5083985",
"0.5068018",
"0.50574136",
"0.504428",
"0.50268775",
"0.5003758",
"0.4991013",
"0.4987645",
"0.49795634",
"0.49687073",
"0.4961714",
"0.4944545",
"0.49428... | 0.6173792 | 0 |
DRY up drawing setup+teardown | def paint(src=dup_src)
yield src.graphics
src.graphics.dispose
ImageVoodoo.new src
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_drawing\n calculate_spread\n calculate_increment\n sort_data if @sort # Sort data with avg largest values set first (for display)\n set_colors\n normalize\n setup_graph_measurements\n sort_norm_data if @sorted_drawing # Sort norm_data with avg largest values set first (... | [
"0.6564684",
"0.6320498",
"0.6320498",
"0.62787896",
"0.6173565",
"0.61327124",
"0.60520595",
"0.6004469",
"0.6004469",
"0.6004469",
"0.5988544",
"0.5984453",
"0.59759766",
"0.59035057",
"0.5870969",
"0.5870969",
"0.5870969",
"0.5870969",
"0.5862021",
"0.58353555",
"0.5794976... | 0.0 | -1 |
Checks this item set against a basket and increases its support if it is present | def check_basket(basket)
increase_support if in_basket?(basket)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable?(item)\n CookingManager.quantity(item) > 0\n end",
"def large_one_itemsets\n database.each_with_object(counter) do |(_, itemset), support|\n itemset.each { |item| support[item] += 1 }\n end.\n select { |item, support| support >= @min_support }.\n map ... | [
"0.6320999",
"0.61593175",
"0.6154544",
"0.6085395",
"0.6002805",
"0.59871596",
"0.58596677",
"0.5849224",
"0.58295554",
"0.5825987",
"0.5818192",
"0.57908446",
"0.5783938",
"0.57453245",
"0.5725661",
"0.5725188",
"0.57243896",
"0.5723819",
"0.5710452",
"0.57074",
"0.5683635"... | 0.7984945 | 0 |
Returns all item ids in this item set | def all_item_ids
[id] + item_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids\n (1..get_item_count).map do |index|\n get_item_identifier index\n end\n end",
"def items\n if @items.nil?\n ids = tire_response.results.map { |item| item['id'] }\n items = klass.where(:id => ids).group_by(&:id)\n @items = ids.map{ |id| items[id.to_i] }.flatten.compact\n ... | [
"0.81906396",
"0.7213923",
"0.7131807",
"0.667638",
"0.66744614",
"0.66634125",
"0.6582505",
"0.65338326",
"0.64558303",
"0.6404498",
"0.6319025",
"0.63088334",
"0.6308638",
"0.6296291",
"0.62928915",
"0.6271769",
"0.62416077",
"0.62090385",
"0.6197463",
"0.6193781",
"0.61822... | 0.78227633 | 1 |
Returns true if item_ids are equal and ordered | def include_ids?(item_ids)
all_item_ids == item_ids
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_ids?(item_ids)\n all_item_ids.sort == item_ids.sort\n end",
"def has_ordered?(item_to_check)\n if item_to_check.class == Item\n @order.any? {|item| item.name == item_to_check.name}\n else \n false\n end \nend",
"def ==(other_item)\n \t@id == other_item.id\n end",
"def eql?(other)\n ... | [
"0.85511416",
"0.641939",
"0.64021605",
"0.6371631",
"0.6259871",
"0.61964846",
"0.6137264",
"0.61288667",
"0.6007504",
"0.59921145",
"0.5985862",
"0.5937609",
"0.5937609",
"0.5937522",
"0.59294206",
"0.5925852",
"0.589886",
"0.5878921",
"0.5878921",
"0.5848117",
"0.5844667",... | 0.7398208 | 1 |
Returns true if item_ids are equal | def same_ids?(item_ids)
all_item_ids.sort == item_ids.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def include_ids?(item_ids)\n all_item_ids == item_ids\n end",
"def eql?(other)\n items == other.items\n end",
"def ==(other_item)\n \t@id == other_item.id\n end",
"def === (item)\n puts \"self.object_id = #{self.object_id}\"\n puts \"item.object_id = #{item.object_id}\"\n if self.objec... | [
"0.8056097",
"0.70219827",
"0.67787105",
"0.63484627",
"0.63356435",
"0.62518877",
"0.6165358",
"0.60836273",
"0.6080658",
"0.60224956",
"0.6016768",
"0.59874225",
"0.5979917",
"0.5979917",
"0.5975429",
"0.5945927",
"0.59278446",
"0.58105314",
"0.5786587",
"0.57861054",
"0.57... | 0.88670975 | 0 |
String representation of ItemSet | def to_s
"#{all_item_ids} exists in #{@support} baskets"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n \"#<DataStructures::TreeSet {#{self.map { |val| val.inspect }.join(',')}}>\"\n end",
"def to_str\n str = \"Id: \" + @id.to_s + \"\\nName: \" + @name.to_s + \"\\nItem(s): \\n\"\n @items.each do |item|\n str += \">\" + item.to_s + \" \\n\"\n end\n str\n end",
"def to_s\n ... | [
"0.6951552",
"0.6855028",
"0.6771272",
"0.6480942",
"0.6366714",
"0.63237",
"0.6303738",
"0.62292916",
"0.62251437",
"0.61899793",
"0.6178105",
"0.61595285",
"0.61595285",
"0.6136479",
"0.6124384",
"0.6118876",
"0.60372984",
"0.6029769",
"0.60191584",
"0.60007274",
"0.5969541... | 0.0 | -1 |
Returns true if this item sets remaining items occurs in a given basket | def in_basket?(basket)
@item_ids.all? do |item_id|
basket.include?(item_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_basket(basket)\n increase_support if in_basket?(basket)\n end",
"def has_items?\n total_items > 0\n end",
"def has_items?\n total_items > 0\n end",
"def contain_item?(id)\n return item_quantity(id) > 0\n end",
"def empty?\n basket_items.none?\n end",
"def check_b... | [
"0.67670774",
"0.66739327",
"0.66739327",
"0.6512584",
"0.6492791",
"0.64432657",
"0.641367",
"0.641367",
"0.64074105",
"0.6395117",
"0.6380485",
"0.6370161",
"0.63353676",
"0.63249546",
"0.6295397",
"0.6259964",
"0.62510455",
"0.6189904",
"0.6188009",
"0.61422735",
"0.611414... | 0.7803558 | 0 |
Increases the support for this item set | def increase_support
@mutex.synchronize do
@support += 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_quality_by1(item)\n item.quality += 1\n end",
"def increase_used\n self[:numUsed] += 1\n end",
"def large_one_itemsets\n database.each_with_object(counter) do |(_, itemset), support|\n itemset.each { |item| support[item] += 1 }\n end.\n select { |item,... | [
"0.67003036",
"0.61460966",
"0.6082342",
"0.6076871",
"0.6027749",
"0.5940036",
"0.5940036",
"0.5841974",
"0.5777476",
"0.5707195",
"0.56769264",
"0.5660689",
"0.56351084",
"0.5551695",
"0.5547891",
"0.5535109",
"0.5519808",
"0.5513788",
"0.5509133",
"0.55039805",
"0.5475487"... | 0.67644835 | 0 |
Helper function; pulls relevant metadata on all songs in a room, saving and consolidating in a single JSON file. | def getSongs(groupid)
res = $conn.exec("SELECT songid,song,artist,album,aurl FROM #{groupid} ORDER BY placeid").values()
res.each do |song|
song[0]='{"key": "' + song[0] + '"'
song[1]='"trackname": "' + song[1] + '"'
song[2]='"artist": "' + song[2] + '"'
song[3]='"album": "' + s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_streaming_history(session)\n \n file = File.read(attachment.file.file)\n streaming_history = JSON.parse(file)\n \n streaming_history.each do |hash|\n \n track_name = hash[\"trackName\"]\n artist_name = hash[\"artistName\"]\n \n... | [
"0.5906651",
"0.57838094",
"0.5779006",
"0.57306856",
"0.567141",
"0.5647016",
"0.5643218",
"0.5623393",
"0.55640405",
"0.555099",
"0.5519774",
"0.55110717",
"0.5507345",
"0.54459256",
"0.5430965",
"0.5391329",
"0.5388155",
"0.5348547",
"0.53390086",
"0.53133893",
"0.5313316"... | 0.63816166 | 0 |
TODO: Shouldn't grab whole tree | def find_first_ancestor(type)
ancestors.find{|a| a.is_a?(type) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parsed_tree; end",
"def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right... | [
"0.7220263",
"0.6497108",
"0.6484533",
"0.64206696",
"0.64123946",
"0.63332164",
"0.62922966",
"0.6264361",
"0.62246764",
"0.6218065",
"0.6173988",
"0.61256117",
"0.610299",
"0.60883677",
"0.608762",
"0.60645896",
"0.6057101",
"0.6039085",
"0.6037297",
"0.60117394",
"0.600898... | 0.0 | -1 |
Resets the Elements children | def clear_children!
@children.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n\t\tself.state = \"off\"\n\t\tself.content_text = \"\"\n\t\tself.title_text = \"\"\n\t\tself.components.each do |c|\n\t\t\tc.reset\n\t\tend\n\tend",
"def reset\n @index = -1\n @element = nil\n @value = nil\n end",
"def clear\n @sizes = FloatRect.new 0, 0, 1, 1\n @... | [
"0.6744167",
"0.6715285",
"0.65804726",
"0.6315824",
"0.630249",
"0.6230557",
"0.598169",
"0.5952619",
"0.59005785",
"0.58965504",
"0.58885735",
"0.5873182",
"0.5865559",
"0.5855186",
"0.5827125",
"0.58118236",
"0.57917565",
"0.5784366",
"0.5762252",
"0.5719881",
"0.5716154",... | 0.6884584 | 0 |
Was this check successful? | def ok?
return @ok
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def success?() end",
"def successful?\n exit_code == 0\n end",
"def ok?\n @result.retval == 0\n end",
"def successful?\n @code == 0\n end",
"def successful?\n @successful\n end",
"def success?\n return true\n end",
"def success?\n @succeeded\n end... | [
"0.80425876",
"0.79750705",
"0.79525393",
"0.79467434",
"0.78860164",
"0.7872046",
"0.7864105",
"0.7791383",
"0.77904665",
"0.7739696",
"0.7739696",
"0.772289",
"0.77020943",
"0.76929516",
"0.7687311",
"0.7683401",
"0.7679857",
"0.76550776",
"0.7649307",
"0.76361346",
"0.7633... | 0.7219952 | 73 |
GET /provider/medicos GET /provider/medicos.json | def index
@provider_medico = Provider::Medico.new
if @provider_medico.verificar_empleado_externo?(current_user.id)
respond_to do |format|
if params[:search]
format.html { @provider_medicos = Provider::Medico.search(params[:search]).order("created_at DESC")}
format.json { @prov... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @provider_medico_provider = Provider::MedicoProvider.where(provider_medico_id: params[:id])\n end",
"def set_provider_medico\n @provider_medico = Provider::Medico.find(params[:id])\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # ... | [
"0.72727257",
"0.6760362",
"0.64186436",
"0.6114814",
"0.6054051",
"0.6050122",
"0.59130925",
"0.5884493",
"0.5844202",
"0.58382463",
"0.58314776",
"0.582401",
"0.58225894",
"0.5809688",
"0.5786486",
"0.57344353",
"0.5720196",
"0.57170427",
"0.5708382",
"0.5691705",
"0.569170... | 0.5671239 | 23 |
GET /provider/medicos/1 GET /provider/medicos/1.json | def show
@provider_medico_provider = Provider::MedicoProvider.where(provider_medico_id: params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_provider_medico\n @provider_medico = Provider::Medico.find(params[:id])\n end",
"def show\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @medio }\n end\n end",
"def show\n @medio_pago = MedioPago... | [
"0.6809254",
"0.6629128",
"0.6194134",
"0.61790746",
"0.6177419",
"0.6042901",
"0.59981346",
"0.5994704",
"0.5982367",
"0.5974058",
"0.5968675",
"0.5865739",
"0.58648646",
"0.58585936",
"0.5844556",
"0.5844556",
"0.58350813",
"0.58280164",
"0.58276117",
"0.5810337",
"0.580114... | 0.7298781 | 0 |
POST /provider/medicos POST /provider/medicos.json | def create
@provider_medico = Provider::Medico.new(provider_medico_params)
@provider_medico.user_created_id = current_user.id
inicializar_attr_accessor
respond_to do |format|
@people= People.where(identification_document: @provider_medico.people.identification_document).first
unless @people... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @medio = Medio.new(params[:medio])\n\n respond_to do |format|\n if @medio.save\n format.html { redirect_to @medio, :notice => 'Medio was successfully created.' }\n format.json { render :json => @medio, :status => :created, :location => @medio }\n else\n format.html... | [
"0.678427",
"0.6359553",
"0.63148123",
"0.6268969",
"0.6202059",
"0.6139837",
"0.6131191",
"0.60828495",
"0.594185",
"0.5906036",
"0.5889249",
"0.5862683",
"0.5840544",
"0.582647",
"0.5748429",
"0.5736002",
"0.57000476",
"0.56735307",
"0.56719446",
"0.56709015",
"0.56593764",... | 0.57940763 | 14 |
PATCH/PUT /provider/medicos/1 PATCH/PUT /provider/medicos/1.json | def update
$medicoProvider = Provider::Medico.find(params[:id])
params[:provider_medico][:provider_providers] ||=[]
inicializar_attr_accessor
@provider_medico.user_updated_id = current_user.id
respond_to do |format|
if @provider_medico.update(provider_medico_params)
if @provider_medico.verificar_em... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @provider = Provider.find(params[:id])\n\n if @provider.update(provider_params)\n head :no_content\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n f... | [
"0.60934716",
"0.60654473",
"0.6048369",
"0.6034577",
"0.59783006",
"0.59493303",
"0.59375703",
"0.5923241",
"0.5914438",
"0.5914438",
"0.5911531",
"0.586219",
"0.5848253",
"0.5843419",
"0.5843247",
"0.5805811",
"0.57531273",
"0.57285345",
"0.5726524",
"0.571953",
"0.5716212"... | 0.6385298 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_provider_medico
@provider_medico = Provider::Medico.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 provider_medico_params
params.require(:provider_medico).permit(
:code_medico,
:c_m_l,
:speciality_id,
:phone_medico,
:people_attributes => [
:id,
:first_name,
:surname,
:type_identification,
:identification_document,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
GET /actividads/1 GET /actividads/1.xml | def show
@actividad = Actividad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @actividad }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ads = Ad.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ads }\n end\n end",
"def index\n @ads = Ad.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ads.to_xml }\n en... | [
"0.71156603",
"0.70561266",
"0.7032288",
"0.7027711",
"0.6936573",
"0.68074733",
"0.672961",
"0.6659708",
"0.6603977",
"0.6603977",
"0.6550598",
"0.65482986",
"0.6541365",
"0.65404934",
"0.65315014",
"0.6395564",
"0.6382311",
"0.6303335",
"0.629186",
"0.62467074",
"0.6233953"... | 0.58607364 | 58 |
GET /actividads/new GET /actividads/new.xml | def new
@actividad = Actividad.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @actividad }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end",
"def new\n @ad = Ad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ad }\n end\n end",
"def new\n... | [
"0.7495561",
"0.7495561",
"0.7495561",
"0.7148773",
"0.7148773",
"0.7117841",
"0.70646256",
"0.69917965",
"0.6983394",
"0.69217706",
"0.691255",
"0.6894073",
"0.6890653",
"0.6853438",
"0.68145764",
"0.68047136",
"0.6758239",
"0.67524123",
"0.6747765",
"0.6746936",
"0.67121905... | 0.6571976 | 35 |
POST /actividads POST /actividads.xml | def create
@actividad = Actividad.new(params[:actividad])
respond_to do |format|
if @actividad.save
format.html { redirect_to(@actividad, :notice => 'Actividad was successfully created.') }
format.xml { render :xml => @actividad, :status => :created, :location => @actividad }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @ad = current_advertiser.ads.new(params[:ad])\n respond_to do |format|\n if @ad.save\n format.html { redirect_to(@ad, :notice => 'Ad was successfully created.') }\n format.xml { render :xml => @ad, :status => :created, :location => @ad }\n else\n format.html { ren... | [
"0.6636361",
"0.64035743",
"0.6321514",
"0.62912214",
"0.6164882",
"0.60500854",
"0.59088004",
"0.5857102",
"0.5838601",
"0.58305365",
"0.5774261",
"0.5756479",
"0.5740187",
"0.5703535",
"0.5695083",
"0.5666105",
"0.56270367",
"0.558181",
"0.5579123",
"0.5578319",
"0.55756766... | 0.0 | -1 |
PUT /actividads/1 PUT /actividads/1.xml | def update
@actividad = Actividad.find(params[:id])
respond_to do |format|
if @actividad.update_attributes(params[:actividad])
format.html { redirect_to(@actividad, :notice => 'Actividad was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action... | {
"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 update\n @advert = Advert.find(params[:id])\n\n respond_to do |format|\n if @advert.update_attributes(params[:advert])\n flash[:notice] = 'Advert was success... | [
"0.6761042",
"0.63818437",
"0.6347129",
"0.6237164",
"0.6223888",
"0.61992",
"0.61160225",
"0.6020719",
"0.59904593",
"0.5915882",
"0.5894785",
"0.5885105",
"0.5848581",
"0.5843723",
"0.583532",
"0.5791713",
"0.5781361",
"0.5779031",
"0.5774825",
"0.5770726",
"0.5763044",
"... | 0.5468178 | 56 |
DELETE /actividads/1 DELETE /actividads/1.xml | def destroy
@actividad = Actividad.find(params[:id])
@actividad.destroy
respond_to do |format|
format.html { redirect_to(actividads_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ad.destroy\n\n respond_to do |format|\n format.html { redirect_to(ads_url) }\n format.xml { head :ok }\n end\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end... | [
"0.69398135",
"0.6932666",
"0.6900057",
"0.6900057",
"0.6842481",
"0.68164265",
"0.6804925",
"0.6804925",
"0.6804925",
"0.6763316",
"0.6754082",
"0.6749621",
"0.6743685",
"0.66543305",
"0.6645038",
"0.66012627",
"0.6509263",
"0.6507167",
"0.64647394",
"0.64528424",
"0.6413216... | 0.68686885 | 4 |
Stop this job (if running) and remove it from the list of jobs. | def delete
job_resource.delete
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n interface.remove_new_job_listener(self)\n end",
"def stop\n interface.remove_new_job_listener(self)\n end",
"def destroy\n Sidekiq.redis do |conn|\n # delete from set\n conn.srem self.class.jobs_key, redis_k... | [
"0.751922",
"0.751922",
"0.69504946",
"0.6846804",
"0.6729563",
"0.66568005",
"0.64924526",
"0.6489911",
"0.6445834",
"0.6444591",
"0.6441897",
"0.6411163",
"0.64001",
"0.63843095",
"0.63653845",
"0.63584834",
"0.63565856",
"0.6333511",
"0.6256559",
"0.61899626",
"0.61639374"... | 0.57965857 | 39 |
Receive output from this job and pass them to the given block. | def output &block
events = []
wrapper = lambda do |e|
events << e
block[e] if block
end
follow_job_output(&wrapper)
events
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output\n b = block.output\n self<< b\n b\n end",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def capture_block(*args, &block) \n with_output_buffer { block_given? && block.call(*args) }\n end",
"def on_output(... | [
"0.6761317",
"0.66534054",
"0.6563165",
"0.64208066",
"0.6310987",
"0.6281908",
"0.62451506",
"0.6234139",
"0.621007",
"0.6184681",
"0.61744773",
"0.6156583",
"0.61444104",
"0.609402",
"0.6038207",
"0.599544",
"0.5990842",
"0.59874374",
"0.59712434",
"0.5968429",
"0.59609747"... | 0.6783955 | 0 |
TODO: Need to add some ways in here to save the metadata file once it's been edited. TODO: Also add a to_s or inspect methods to render the raw_yaml TODO: Also add a []= here that delegates to raw_yaml as well. | def initialize(piece_path)
@piece_path = piece_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump\n File.open(@meta_data_file_location,'w') { |f| f.write(YAML.dump(@meta_data))}\n end",
"def yaml_file?; end",
"def metadata_file; end",
"def metadata_file; end",
"def meta_data=( data )\n return if data.nil? and @meta_end.nil?\n\n seek 0\n lines = readlines\n\n truncate 0\n ... | [
"0.74364674",
"0.6947973",
"0.68382657",
"0.68382657",
"0.6661118",
"0.6658801",
"0.6657253",
"0.6516579",
"0.64808095",
"0.6476583",
"0.6466418",
"0.6440557",
"0.64197606",
"0.6372828",
"0.6305128",
"0.62967527",
"0.62886506",
"0.62833947",
"0.6257792",
"0.6255591",
"0.62464... | 0.0 | -1 |
Add mappings to include for all future mappings | def create_global_mapping
yield @request_builder, @response_builder, @scenario_builder
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_mapping\n # no additional parameters\n nil\n end",
"def mappings\n @mappings ||= mappings_from_files.merge!(mappings_from_dirs)\n end",
"def add_mapping(resource, options); end",
"def mappings(hash = {})\n @mappings.merge!(hash)\n end",
"def mappings\n ... | [
"0.7019745",
"0.67705214",
"0.676187",
"0.6747526",
"0.66982317",
"0.6673795",
"0.6444998",
"0.63369244",
"0.6181873",
"0.61125296",
"0.60520774",
"0.60520774",
"0.60343057",
"0.59800255",
"0.59746003",
"0.5948706",
"0.5912885",
"0.59115124",
"0.58750224",
"0.5856513",
"0.583... | 0.54550433 | 40 |
Set the WireMock url | def set_wiremock_url(url)
@wiremock_url = url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_url\n url 'set'\n end",
"def set_url\n @url = DEFAULT_URL\n end",
"def set_base_url(url)\r\n @http_client.base_url = url\r\n end",
"def url(url)\n @url = url\n end",
"def set_api_url(url)\n @api_url = url\n end",
"def url\n @url || Gandi::TEST_... | [
"0.7191062",
"0.7105403",
"0.6613373",
"0.6529426",
"0.63994753",
"0.63993084",
"0.63685",
"0.6346271",
"0.6346271",
"0.6346271",
"0.6346271",
"0.6346271",
"0.62656754",
"0.6245098",
"0.6192014",
"0.61797434",
"0.61797434",
"0.61257476",
"0.6110203",
"0.6107471",
"0.6097887",... | 0.8733785 | 0 |
Set the WireMock headers | def set_wiremock_headers(headers)
@wiremock_headers = headers
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def headers=(v)\n cfg_set(:headers, v)\n end",
"def set_headers # :nodoc:\n {\n 'User-Agent' => \"twm-ruby-#{VERSION}\",\n 'Content-Type' => 'application/json; charset=utf-8',\n 'Accept' => 'application/json'\n }\n end",
"def fill_header(response); end",
"def... | [
"0.6873841",
"0.68635696",
"0.6812924",
"0.6803256",
"0.67584056",
"0.6630113",
"0.66047484",
"0.6584113",
"0.6557829",
"0.6544907",
"0.65400547",
"0.65400547",
"0.65298885",
"0.6524209",
"0.6523432",
"0.6522587",
"0.6509152",
"0.648977",
"0.6488116",
"0.6486329",
"0.64801204... | 0.8162118 | 0 |
returns an integer with the difference between the current day and the project's expiration date | def days_to_go
(self.expiration_date.to_date - Date.today).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overdue_days\n (Time.now.utc.to_date - expires_at.to_date).to_i\n end",
"def days_remaining\n target_time = self.next_release[\"release_date\"].to_time\n current_time = Time.now\n \n difference_seconds = target_time - current_time\n difference_seconds.div(86400) # seconds in a ... | [
"0.7355807",
"0.71752423",
"0.7157953",
"0.7157953",
"0.704056",
"0.69785994",
"0.68434",
"0.68240577",
"0.6781981",
"0.67759496",
"0.67317194",
"0.6717978",
"0.6717522",
"0.67159355",
"0.6715632",
"0.6692911",
"0.6684021",
"0.6682706",
"0.6680826",
"0.6673353",
"0.66491944",... | 0.78049874 | 0 |
execute the code in the charge_backers_job.rb file once the expiration date is reached | def charge_backers_if_funded
ChargeBackersJob.set(wait_until: self.expiration_date).perform_later self.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_recurring_jobs\n EmbargoAutoExpiryJob.perform_later(account)\n LeaseAutoExpiryJob.perform_later(account)\n end",
"def verify_expiration; end",
"def verify_expiration; end",
"def do_job\r\n# disable recycle invites\r\n# min = Time.now.min\r\n# #recycle invites 1 min per hour\r\n# ... | [
"0.64018196",
"0.63157415",
"0.63157415",
"0.62852454",
"0.62269354",
"0.62067217",
"0.6190314",
"0.61885065",
"0.6173261",
"0.60994357",
"0.60492295",
"0.6027205",
"0.6027205",
"0.6004674",
"0.59984994",
"0.5987796",
"0.58575004",
"0.5848038",
"0.58222663",
"0.582163",
"0.58... | 0.8327273 | 0 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: split input list into array create new hash set default quantity iterate over array to create hash assigning default value to each key print the list to the console [can you use one of your other methods here?] output: [what data... | def new_list(list_items)
list_array = list_items.split(" ")
grocery_list = Hash.new
# Hash[(1..5).map { |num| [num, 0] }]
list_array.each { |item|
grocery_list[item] = 1
}
grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n e... | [
"0.7596862",
"0.7541496",
"0.72446114",
"0.69722",
"0.69098383",
"0.6840243",
"0.6813223",
"0.6780967",
"0.6776558",
"0.6773668",
"0.67681074",
"0.67460155",
"0.67325246",
"0.6700768",
"0.6692385",
"0.6690296",
"0.66892314",
"0.6650349",
"0.66445875",
"0.66178024",
"0.6594919... | 0.0 | -1 |
Method to add an item to a list input: list, item name and optional quantity steps: check keyset to see if item already exists IF it exists, update the value (call update method) ELSE add it to list. output: new list | def add_item(list, item_name, qty=1)
if list.has_key?(item_name)
list[item_name] += qty
else
list[item_name] = qty
end
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(item, quantity, list)\n\t# steps: \n\t# if the item is already in the list\n\tif list[item.to_sym] \n\t\t# add to the quantity\n\t\t#list[item.to_sym] = list[item.to_sym] + quantity\n\t\tlist[item.to_sym] += quantity\n\t# otherwise\n\telse\n\t\t# make a new key with the input quantity\n\t\tlist[item.t... | [
"0.816612",
"0.81380546",
"0.8092229",
"0.80621076",
"0.8050023",
"0.8045346",
"0.8008509",
"0.8004841",
"0.79563075",
"0.7953893",
"0.7953198",
"0.7936576",
"0.79242915",
"0.79242915",
"0.7919402",
"0.78893566",
"0.7885294",
"0.7884384",
"0.7884384",
"0.78806835",
"0.7869020... | 0.7662147 | 59 |
Method to remove an item from the list input: list, item name steps: check keyset IF item exists, remove it ELSE do nothing output: return updated hash | def remove_item(list, item_name)
if list.has_key?(item_name)
list.delete(item_name)
end
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_item(input_hash, item)\n# input: list, item name, and optional quantity\n# steps: use input item to delete key\n input_hash.delete(item)\n# output: hash data structure of key/value pairs\nreturn input_hash\nend",
"def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item na... | [
"0.8290856",
"0.8236729",
"0.8152958",
"0.8137674",
"0.7926525",
"0.7906368",
"0.78825366",
"0.7877077",
"0.7845352",
"0.7835607",
"0.7832429",
"0.7804725",
"0.7803246",
"0.7705932",
"0.7663121",
"0.76300365",
"0.76220953",
"0.7606073",
"0.7595092",
"0.7591929",
"0.7582759",
... | 0.7895211 | 6 |
Method to update the quantity of an item input: list, item_name, new qty steps: check keyset for item IF item exists, reassign value ELSE call add method output: updated hash | def update_item(list, item_name, new_qty)
if list.has_key?(item_name)
list[item_name] = new_qty
else
list = add_method(list, item_name, new_qty)
end
list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend",
"def update_qty(item_list, item, qty)\r\n item_list[item] = qty\r\n item_list\r\nend",
"def update_quantity(list, upd_item,... | [
"0.8189691",
"0.8080623",
"0.806156",
"0.8036457",
"0.8005069",
"0.7978625",
"0.79229754",
"0.7917771",
"0.7829826",
"0.7804599",
"0.77945554",
"0.7771206",
"0.77626806",
"0.77626806",
"0.7761976",
"0.77598196",
"0.77402896",
"0.77162445",
"0.77101594",
"0.76875186",
"0.76783... | 0.77739716 | 11 |
Method to print a list and make it look pretty input: list steps: loop over list [item: qty, newline] for each item output: string of items and quantities | def print_list(list)
grocery_list = "Grocery List" + "\n"
list.each do |item, qty|
grocery_list += "#{item} : #{qty}" + "\n"
end
puts grocery_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pretty_in_print(list)\n puts \"---------------------------------------\"\n puts \"These are the items we are gonna buy\"\n list.each {|item, qty| puts \"#{qty} pieces of #{item}\" }\nend",
"def pretty_list(list)\n\tlist.each { |item_name, item_quantity|\n\t\tputs \"You will need to purchase #{item_q... | [
"0.83657557",
"0.83628863",
"0.83207613",
"0.8260462",
"0.81620026",
"0.81620026",
"0.81221926",
"0.8097962",
"0.8078436",
"0.8038706",
"0.7953507",
"0.7953507",
"0.7941382",
"0.7885391",
"0.7756724",
"0.7740317",
"0.7724466",
"0.7636602",
"0.76167256",
"0.76016694",
"0.75952... | 0.7048359 | 56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.