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 |
|---|---|---|---|---|---|---|
finished survey answers, based on accessible journals | def survey_answers(options = {}) # params are not safe, should only allow page/per_page
page = options[:page] ||= 1
per_page = options[:per_page] ||= 100000
o = survey_answer_params(options)
params = options[:center] && {:conditions => ['center_id = ?', o[:center].id]} || {}
SurveyAnswer.fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_answered_surveys(journals, conditions = {:follow_up => 1})\n\t\tjournals.map {|j| [j.alt_id, j.title, j.answered_entries.where(conditions).map {|e| [e.survey.short_name, e.updated_at.to_s(:long)] }.sort ]}.sort_by &:first\n\tend",
"def finalise(_ = nil)\n self.submitted_at = Time.zone.now\n curren... | [
"0.7045358",
"0.6316942",
"0.62167305",
"0.6097718",
"0.60946053",
"0.60344",
"0.6000909",
"0.59207225",
"0.5894431",
"0.58893895",
"0.58255607",
"0.5820927",
"0.5820652",
"0.5818583",
"0.57984066",
"0.57949466",
"0.57893527",
"0.5766705",
"0.5753756",
"0.5707109",
"0.5698551... | 0.5525701 | 37 |
returns users that a specific user role is allowed to see | def get_users(options = {})
options[:include] = [:roles, :groups, :center]
options[:page] ||= 1
options[:per_page] ||= 20
users = if self.has_access?(:user_show_all) # gets all users which are not login-users
User.users.with_roles(Role.get_ids(Access.roles(:all_real_users))).paginate(options).un... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select\n @users ||= User.role_wise_users(params[:user][:role])\n authorize! :read, @user\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n ... | [
"0.7746413",
"0.71220624",
"0.71220624",
"0.71220624",
"0.71220624",
"0.703795",
"0.69693893",
"0.6922217",
"0.69072884",
"0.68998265",
"0.6880219",
"0.682677",
"0.6775408",
"0.668469",
"0.66667455",
"0.66659284",
"0.6655132",
"0.6643492",
"0.6641283",
"0.66177446",
"0.660580... | 0.0 | -1 |
roles a user can pass on | def pass_on_roles
r = self.all_roles
if self.has_access?(:superadmin)
r = Role.get(Access.roles(:all_users))
elsif self.has_access?(:admin)
r = Role.get(Access.roles(:admin_roles))
elsif self.has_access?(:centeradm)
r = Role.get(Access.roles(:center_users))
end
return (r.is_a?(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roles\n roles_from_users\n end",
"def pass_on_roles\n r = self.roles.to_a\n if self.has_access?(:superadmin)\n r = Role.get(Access.roles(:all_users)).to_a\n elsif self.has_access?(:admin)\n r = Role.get(Access.roles(:admin_roles)).to_a\n elsif self.has_access?(:centeradm)\n r =... | [
"0.7514087",
"0.7423563",
"0.73667574",
"0.7355985",
"0.7334542",
"0.7333381",
"0.7294102",
"0.7283768",
"0.7280385",
"0.7190873",
"0.71531147",
"0.71369123",
"0.71100485",
"0.707444",
"0.70627815",
"0.7051982",
"0.6986868",
"0.6947196",
"0.6944178",
"0.6930425",
"0.6914224",... | 0.7430562 | 2 |
Overriding this method to do some more validation: Password equals password_confirmation, state an password hash type being in the range of allowed values. | def validate
# validate state and password has type to be in the valid range of values
errors.add(:password_hash_type, "must be in the list of hash types.") unless User.password_hash_types.include? password_hash_type
# check that the state transition is valid
errors.add(:state, "must be in the l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_strength\n minimum_length = 8\n # Regex matches at least one lower case letter, one uppercase and one digit\n complexity_regex = /\\A(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/\n # When a user is updated but not its password, the password param is nil\n if password.present? &&\n (password.... | [
"0.69618165",
"0.6949028",
"0.6927688",
"0.69089085",
"0.68889356",
"0.6876192",
"0.68645114",
"0.68532985",
"0.68407696",
"0.68407696",
"0.6826347",
"0.6748832",
"0.6700682",
"0.6700682",
"0.66821414",
"0.66203946",
"0.6615254",
"0.6584911",
"0.65790904",
"0.65472955",
"0.65... | 0.73199856 | 2 |
Array equality matching taken from and modified to ignore the order of bindings | def insync?(is)
self.devfail "#{self.class.name}'s should is not array" unless @should.is_a?(Array)
# an empty array is analogous to no should values
return true if @should.empty?
# Look for a matching value, either for all the @should values, or any of
# them, depending on the configura... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(array)\n to_ary == array\n end",
"def array_equals(array1, array2)\n if array1 == array2\n return true\n else\n return false\n end\n\n if array1.hash.length == array2.hash.length\n return true\n elsif array1[0] == array2[0]\n return true\n end\n\nend",
"def assert_same_elements... | [
"0.68617356",
"0.6805858",
"0.6787483",
"0.6711796",
"0.6697633",
"0.66944766",
"0.66659695",
"0.66633534",
"0.6653062",
"0.6650795",
"0.6615026",
"0.6584579",
"0.6575157",
"0.6570471",
"0.65476316",
"0.6542388",
"0.652417",
"0.6479535",
"0.6477352",
"0.6471109",
"0.6456885",... | 0.0 | -1 |
I'll default to first session loaded unless options[:group] is specified | def setup
group.each do |name, windows|
next if options[:group] && name != options[:group]
setup_session(name)
windows.each_with_index do |win, i|
setup_window(win, i)
end
add_command(:screen, 'select %s', screen_group.primary_pos)
break
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_group\n session[:group] = params[:group] if params[:group]\n end",
"def group_sessions\n\t\n\tend",
"def render_group_selection_page\n # Remove any group_id param in the url\n saml_url_without_group_id = request.original_url.gsub(/(&group_id=[^&]*)/,\"\")\n\n # Build SAML replay u... | [
"0.661545",
"0.64088845",
"0.58466786",
"0.5830799",
"0.58212155",
"0.5776263",
"0.57633215",
"0.5750568",
"0.57018775",
"0.56911165",
"0.5654081",
"0.56333387",
"0.56117237",
"0.56117237",
"0.5578807",
"0.5561402",
"0.55346525",
"0.5479532",
"0.54631853",
"0.5441308",
"0.542... | 0.53512025 | 34 |
back to previous version | def down
change_column :feeds, :prompt, :string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback\n self.revert_to self.previous_version\n end",
"def previous_version!(steps_back = 0)\n prev_version = previous_version(steps_back)\n\n prev_version.save if prev_version.present?\n end",
"def revert_to(version)\n revert version\n self\n end",
"def rollback!\n ... | [
"0.78670007",
"0.78589714",
"0.7849208",
"0.7713974",
"0.7675076",
"0.74834377",
"0.74675584",
"0.7372161",
"0.72803384",
"0.7251042",
"0.7247545",
"0.7234486",
"0.7185319",
"0.69178313",
"0.69178313",
"0.688971",
"0.6888421",
"0.6881247",
"0.68720496",
"0.68720496",
"0.68480... | 0.0 | -1 |
Clusters of examples in the same example group, on the same nesting level that can be aggregated. | def example_clusters(all_examples)
all_examples
.select { |example| example_with_expectations_only?(example) }
.group_by { |example| metadata_without_aggregate_failures(example) }
.select { |_, examples| examples.count > 1 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_example_groups\n strategy.example_groups\n end",
"def example_clusters_for_autocorrect(example_node)\n examples_in_group = example_node.parent.each_child_node(:block)\n .select { |example| example_for_autocorrect?(example) }\n example_clusters(examples_in_group)\n... | [
"0.63703585",
"0.6191975",
"0.616592",
"0.6000599",
"0.58120203",
"0.5648828",
"0.54655147",
"0.5440212",
"0.5371916",
"0.5319355",
"0.5247466",
"0.52193713",
"0.51062685",
"0.5094271",
"0.50936425",
"0.50661325",
"0.5055874",
"0.5041699",
"0.49949315",
"0.49847606",
"0.49844... | 0.7027831 | 0 |
Clusters of examples that can be aggregated without losing any information (e.g. metadata or docstrings) | def example_clusters_for_autocorrect(example_node)
examples_in_group = example_node.parent.each_child_node(:block)
.select { |example| example_for_autocorrect?(example) }
example_clusters(examples_in_group)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def example_clusters(all_examples)\n all_examples\n .select { |example| example_with_expectations_only?(example) }\n .group_by { |example| metadata_without_aggregate_failures(example) }\n .select { |_, examples| examples.count > 1 }\n end",
"def all_example_groups... | [
"0.7277495",
"0.6121752",
"0.60698044",
"0.6059549",
"0.59697604",
"0.5653599",
"0.5617767",
"0.5616657",
"0.5483847",
"0.5463099",
"0.5422682",
"0.5410984",
"0.53879464",
"0.53755456",
"0.5300558",
"0.528586",
"0.5276972",
"0.5252579",
"0.5234734",
"0.52148396",
"0.5206303",... | 0.5907906 | 5 |
Extracts and transforms the body, keeping proper indentation. | def transform_body(node, base_indent)
"#{base_indent} #{new_body(node)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n migrated_body = @body.dup\n migrated_body.gsub!(/\\|[\\t ]*\\r?[\\n]/, \"|\\n\")\n migrated_body\n end",
"def cooked_body\n raw_body.preprocess\n end",
"def body\n content.gsub(/\\s*---\\s*/, \"\\n\\n\")\n end",
"def emit_body(body = body())\n unless body\n ... | [
"0.7045483",
"0.6857018",
"0.68387526",
"0.680847",
"0.67097473",
"0.6697756",
"0.6629362",
"0.65984017",
"0.6598341",
"0.64972043",
"0.64585465",
"0.6374709",
"0.63378733",
"0.62671524",
"0.6219898",
"0.6167684",
"0.61484796",
"0.6123015",
"0.6119147",
"0.6114263",
"0.607318... | 0.7009042 | 1 |
convert lbs to kg | def convert_to_metric(metric, conversion_factor)
return (metric * conversion_factor).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_lbs_to_kg(lbs_weight, kg_conversion)\n\tlbs_weight * kg_conversion\nend",
"def convert_lbs_to_kg(lbs_weight, kg_conversion)\n lbs_weight * kg_conversion\nend",
"def lbs_to_kg(lbs)\n\tkg = lbs * 0.46\nend",
"def convert_lbs_to_kg(weight)\n weight * 0.45\nend",
"def lbs_to_kilos lbs\n lbs * ... | [
"0.78684205",
"0.7821888",
"0.7804148",
"0.74833",
"0.7174558",
"0.645964",
"0.6434564",
"0.62469274",
"0.60136867",
"0.59944147",
"0.59307915",
"0.5910245",
"0.56793076",
"0.56635135",
"0.5607394",
"0.5579022",
"0.55061954",
"0.55060923",
"0.5500399",
"0.5473029",
"0.5398481... | 0.0 | -1 |
request is overridden and the request and response are stored as a hash that can be written to a cache file | def request(req, body = nil, &block)
response = alias_for_request(req, body)
path = "http://#{req.bauth if req.bauth}#{req['host']}#{req.path}"
if @@fakes[req.method][path]
@@fakes[req.method][path] << {:body => response.body.to_s}
else
@@fakes[req.method]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_request\n cache\n end",
"def write(request, response)\n key = cache_key_for(request)\n value = @serializer.dump(response.serializable_hash)\n @cache.write(key, value)\n end",
"def process\n # Do nothing if caching is off\n return nil unless data[:op... | [
"0.7143681",
"0.7005633",
"0.6942027",
"0.6909203",
"0.6712912",
"0.6508614",
"0.64269423",
"0.63569206",
"0.62408763",
"0.62315714",
"0.6215138",
"0.6215138",
"0.6215138",
"0.6215138",
"0.6215138",
"0.6215138",
"0.6215138",
"0.62036794",
"0.61886114",
"0.6088359",
"0.6051388... | 0.0 | -1 |
This method spawns the backend and sends an operation to connect to the backend to an EventMachine Thread. | def launch!(options = {})
@launch_time = Time.now
@connected_to_socket = false
@backend.spawn!
b = self
estabconn = proc do
b.establish_connection
end
estabconn_callback = proc do |res|
logger.info("Connecti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end",
"def start\n backend.start\n end",
"def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::... | [
"0.6478145",
"0.6271682",
"0.61103386",
"0.60353565",
"0.5988978",
"0.5943438",
"0.587333",
"0.5791636",
"0.5774868",
"0.57743883",
"0.575652",
"0.575376",
"0.5753246",
"0.57082826",
"0.564701",
"0.56035715",
"0.55826753",
"0.5577199",
"0.55698234",
"0.55328596",
"0.54813707"... | 0.6358439 | 1 |
I still wonder about this one. | def on_connect(&callback)
if block_given?
@on_connect = callback
elsif @on_connect
@on_connect.call
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def anchored; end",
"def schubert; end",
"def same; end",
"def offences_by; end",
"def internship_passed; end",
"def isolated; end",
"def isolated; end",
"def suivre; end",
... | [
"0.7501424",
"0.68406916",
"0.64882123",
"0.64882123",
"0.64882123",
"0.64882123",
"0.6382552",
"0.63569695",
"0.63107085",
"0.62642276",
"0.61644405",
"0.6124446",
"0.6124446",
"0.61068165",
"0.60816145",
"0.60814214",
"0.6009065",
"0.5987705",
"0.59848076",
"0.5977209",
"0.... | 0.0 | -1 |
Attempts to establish a connection to the backend without doing anything. The backend only sets up the socket once it has finished loading. So, if we can connect, we are pretty much ready except probably for any ruby AutoLoads of modules. | def establish_connection
@connecting_to_socket = true
start_time = Time.now
while(@timeout.nil? || Time.now - start_time < @timeout )
begin
b = self
srv = EventMachine::connect_unix_domain(self.socket, EventMachine::Connection, true) do |... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connect_if_connection_initialized\n connection.connect if connection.initialized?\n end",
"def connect\n force_connect unless @handler\n end",
"def connect!\n # Keep existing connections\n return unless @backend.nil?\n\n @backend = train_connection.connection\n @back... | [
"0.74360627",
"0.7127532",
"0.70564646",
"0.6885268",
"0.6885268",
"0.68445116",
"0.67930955",
"0.6710204",
"0.6693825",
"0.6666591",
"0.6641621",
"0.6597642",
"0.6526369",
"0.65137875",
"0.65100515",
"0.6506178",
"0.6469442",
"0.64653784",
"0.64425254",
"0.6437798",
"0.64101... | 0.70136195 | 3 |
We have a connection from the client. Establish a server for this connection to relay to the backend. We up the load on this backend as more an more connections get pushed onto it. The EM framework takes care of queueing connections and handing data. | def connect(conn)
b = self
conn.on_connect do
logger.debug "OnConnect for Backend ready at #{backend.socket} on Connection #{conn} load #{b.load}" if logger
b.on_connect
b.load += 1
end
conn.on_data do |data|
logger... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen2\n \n EM.run do\n AMQP.connect(:host => @host) do |connection |\n puts \"Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem...\"\n channel = AMQP::Channel.new(connection)\n exchange = channel.direct(@x_request)\n repl... | [
"0.65094334",
"0.6422464",
"0.6384678",
"0.63794357",
"0.6333081",
"0.63155293",
"0.62394065",
"0.6178696",
"0.6139015",
"0.6123306",
"0.6083452",
"0.59951603",
"0.59942985",
"0.5978883",
"0.59428287",
"0.59395015",
"0.5907565",
"0.59074956",
"0.5904766",
"0.5898607",
"0.5874... | 0.6086667 | 10 |
This server has gotten a connection from the client We decide which backend to give it to. TODO: A factory to recreate backends in the event that they die. | def on_connection(conn)
@backends.delete_if { |b| b.dead? }
logger.debug "Server:on_connection #{conn} backends #{@backends.count} loads #{@backends.map {|x| x.load}.inspect}" if logger
raise ::Heroku::Forward::Errors::BackendFailedToStartError.new if @backends.empty?
# Find the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backend\n @backend ||= self.class.backend\n end",
"def choose_server\n if @round_robin.empty?\n @round_robin = (0...@backend_connections.length).to_a\n end\n if @round_robin.empty? && @backend_connections.empty?\n discover_server_periodically\n raise NoServerAvaila... | [
"0.6753164",
"0.6577636",
"0.6532233",
"0.6489462",
"0.6369192",
"0.63583463",
"0.6268089",
"0.6193798",
"0.6186843",
"0.61848456",
"0.6177153",
"0.60130084",
"0.60123074",
"0.60071355",
"0.59558284",
"0.5909836",
"0.5902501",
"0.5882495",
"0.5848638",
"0.5829615",
"0.58228",... | 0.6485035 | 4 |
This method runs the forwarder. | def forward!(options = {})
logger.info "Launching Backends ..." if logger
i = 0
for backend in @backends
i += 1
backend.launch!
logger.info "Launching Backend #{i} at #{backend.socket}." if logger
end
if @delay && (delay = @delay.to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward()\n @forward\n end",
"def run\n LibZMQ.zmq_proxy @frontend, @backend, @capture\n end",
"def run\n @output.print \"Run, Forest, run!\"\n \n EM.synchrony do\n print \"Mapper has been started #{Time.now}\"\n AMQP.start do |connection|\n print \"AMQ... | [
"0.62773883",
"0.6218041",
"0.61654216",
"0.6161098",
"0.6097832",
"0.60413516",
"0.60413516",
"0.60009915",
"0.5990455",
"0.59418756",
"0.5883811",
"0.5842927",
"0.58409405",
"0.58328146",
"0.58237064",
"0.58146",
"0.58146",
"0.5780812",
"0.57699126",
"0.5766373",
"0.5764313... | 0.6084142 | 5 |
TODO: your code goes here! | def initialize
@entries = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def refutal()\n end",
"def suivre; end",
"def weber; end",
"def who_we_are\r\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def relatorios\n end",
"def custom; end",
"def custom; end",
... | [
"0.7593515",
"0.68356705",
"0.6791031",
"0.67424923",
"0.653012",
"0.6477385",
"0.6440916",
"0.6423885",
"0.6423885",
"0.6423885",
"0.6423885",
"0.6319567",
"0.62713826",
"0.62713826",
"0.6190752",
"0.6190752",
"0.6190752",
"0.6190752",
"0.6190752",
"0.6190752",
"0.6190752",
... | 0.0 | -1 |
Returns an array of words that rhyme with the submitted word | def rhyming
if !params[:word].empty?
rhymes = Rhymes.new
begin
rhyming_words = rhymes.rhyme(params[:word])
rescue StandardError => e
json_response({ err: e }, :not_found)
else
json_response({rhyming_words: rhyming_words}, :ok)
end
else
json_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rhymes_for word\n word = 'land' if word == 'and' # workaround for rhymes gem not finding any rhymes for \"and\"\n Rhymes.rhyme(word.gsub /\\W+/, '').map(&:downcase)\nrescue Rhymes::UnknownWord\n []\nend",
"def rhymes\n depth = self.arpabet_transcription.split(' ').size\n results = []\n \n whil... | [
"0.7238753",
"0.7020639",
"0.68317455",
"0.6764417",
"0.67600363",
"0.6754446",
"0.6731234",
"0.67311513",
"0.6707906",
"0.663187",
"0.6624555",
"0.66173553",
"0.6607508",
"0.6599746",
"0.658145",
"0.65294915",
"0.6501954",
"0.6472142",
"0.6469878",
"0.6452932",
"0.6447421",
... | 0.6598936 | 14 |
Returns the reversed equivalent of the submitted word | def reverse
if !params[:word].empty?
reversed_word = params[:word].reverse
json_response({ reversed_word: reversed_word }, :ok)
else
json_response({ message: 'Sorry, we couldn\'t process your submission' }, :unprocessable_entity)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_word(word)\n return word.reverse\n end",
"def reverse_string word\n\t\treturn word.reverse\nend",
"def rev(word)\n word.reverse\nend",
"def reverse_word(words)\n\twords.split(\" \").each {|word| word.reverse!}.join(\" \")\nend",
"def reverse_words(word)\n p word.reverse.split.reve... | [
"0.8682118",
"0.79880804",
"0.7850163",
"0.72817135",
"0.7265955",
"0.72258425",
"0.7209635",
"0.71842426",
"0.7171708",
"0.709574",
"0.7080853",
"0.7073776",
"0.7067323",
"0.7056388",
"0.703031",
"0.7016449",
"0.7007356",
"0.69886756",
"0.69873655",
"0.6977457",
"0.6968118",... | 0.81141716 | 1 |
Return records filtered by tags in interest context | def find_by_interest(interests)
# Fetch all readable
records = all
filtered_records = []
interests.each do |interest|
find_tag = ActsAsTaggableOn::Tag.find_by_name(interest)
if find_tag
records.each do |record|
taggings = ActsAsTaggableOn::Tagging.find_all_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_contextual_tags(context)\r\n tags.find(:all, :conditions => { 'taggings.context' => context})\r\n end",
"def filter_by_tag(tag)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_tag = []\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n ... | [
"0.6387828",
"0.63667345",
"0.6273765",
"0.62528795",
"0.621831",
"0.6197012",
"0.61835504",
"0.61249405",
"0.60354525",
"0.6034527",
"0.6033789",
"0.6033789",
"0.6030809",
"0.598651",
"0.5963303",
"0.59567934",
"0.5913712",
"0.5876275",
"0.58743185",
"0.58707273",
"0.5869444... | 0.72312474 | 0 |
Find all readable locations with findable content | def find_by_content
user = User.current_user
filtered_records = []
user_groups = []
tag = ActsAsTaggableOn::Tag.find_by_name('find')
if tag
# No need to bother without any find tags
location_hashes = []
# Omni is the default group even for non-logged in users
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end",
"def find(pattern)\n patterns= [pattern].flatten\n contents=[]\n self.each_pair do |path, content|\n patterns.each do |pattern|\n contents << content ... | [
"0.5932596",
"0.5904218",
"0.578692",
"0.57630295",
"0.576229",
"0.5734648",
"0.5713034",
"0.5689619",
"0.5650222",
"0.56432587",
"0.5558151",
"0.55372465",
"0.55372465",
"0.5525415",
"0.55245805",
"0.5523291",
"0.5517994",
"0.55153775",
"0.5437386",
"0.5425297",
"0.5376341",... | 0.69581056 | 0 |
Returns locations with content tagged with the given tags and findaccess, or readable locations tagged with the given tags. | def find_by_interest(interests)
user = User.current_user
filtered_records = []
interest_ids = []
user_groups = []
# Find tag used for content
find_tag = ActsAsTaggableOn::Tag.find_by_name('find')
# Read tag used for locations
read_tag = ActsAsTaggableOn::Tag.find_by_name(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_content\n user = User.current_user\n filtered_records = []\n user_groups = []\n tag = ActsAsTaggableOn::Tag.find_by_name('find')\n if tag\n # No need to bother without any find tags\n location_hashes = []\n \n # Omni is the default group even for non-logge... | [
"0.6188853",
"0.554828",
"0.54680103",
"0.5366887",
"0.5366887",
"0.53381765",
"0.53203005",
"0.5302834",
"0.5302834",
"0.5279737",
"0.5213404",
"0.5154241",
"0.50948757",
"0.4976723",
"0.49738288",
"0.4963278",
"0.4894427",
"0.48891053",
"0.4856378",
"0.4836933",
"0.48045266... | 0.47416824 | 25 |
Find all locations with publication access | def find_by_publish
user = User.current_user
filtered_records = []
user_groups = []
tag = ActsAsTaggableOn::Tag.find_by_name('publish')
# Always allow find access to owned location
if user
filtered_records << user.location
end
if tag
# No need to bother ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_locations # :nologin:\n query = create_query(:Location, :all, :by => :name)\n show_selected_locations(query, :link_all_sorts => true)\n end",
"def getAllLocations()\n coll = self.coll_locations\n puts coll.find()\n coll.find.each { |row| puts row.inspect }\n end",
"def list_locations\... | [
"0.6395409",
"0.62935424",
"0.6092034",
"0.6031619",
"0.5986446",
"0.5980575",
"0.5975652",
"0.5916873",
"0.5885908",
"0.58775836",
"0.58702874",
"0.5865079",
"0.5863278",
"0.58515996",
"0.58498913",
"0.5843417",
"0.579069",
"0.57828903",
"0.5761782",
"0.57586694",
"0.5754911... | 0.7609943 | 0 |
Loop to change each turn of game if not finish | def loop_turn(game)
while !game.is_end_game?
game.turn
end
game.winner
puts "Do you want to restart for the new round (Y/N)?"
choice = gets.chomp.upcase.strip
if choice == "Y"
game.new_round
loop_turn(game)
else
game.end_game
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n\t# while $game_end == false\n\t\t9.times { \n\t\t\tif $game_end == false\n\t\t\t\tturns\n\t\t\tend\n\t\t}\nend",
"def turns\n while @board.game_check == false\n player_process(@player1_name,@player1_symbol,@turn)\n break if @board.game_check == true\n\n player_process(@player2_name,@... | [
"0.7776339",
"0.76968545",
"0.76235586",
"0.7595073",
"0.74882567",
"0.7466615",
"0.74328244",
"0.7399344",
"0.7373631",
"0.7362378",
"0.73123926",
"0.7294004",
"0.72514564",
"0.72390854",
"0.722564",
"0.72202873",
"0.71993387",
"0.7196211",
"0.71710986",
"0.71585137",
"0.714... | 0.73913497 | 8 |
GET /subject_items GET /subject_items.json | def index
@subject_items = SubjectItem.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @subjects = @client.subjects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subjects }\n end\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subje... | [
"0.6752648",
"0.6722181",
"0.65690607",
"0.6554836",
"0.6489917",
"0.6487808",
"0.6477937",
"0.6477937",
"0.64605415",
"0.6459484",
"0.64564013",
"0.64022243",
"0.63919944",
"0.6390629",
"0.63820463",
"0.637233",
"0.6358386",
"0.6346682",
"0.63265866",
"0.63137186",
"0.629024... | 0.7712749 | 0 |
GET /subject_items/1 GET /subject_items/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @subject_items = SubjectItem.all\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def show\n \n id = params[:id].to_i\n \n if id == 0\n @subject = Subject.find_by_subje... | [
"0.7445165",
"0.6851272",
"0.6704284",
"0.6702521",
"0.6696862",
"0.6630645",
"0.6619234",
"0.6555257",
"0.64199364",
"0.6366328",
"0.63627195",
"0.6257719",
"0.62574196",
"0.6229789",
"0.6222555",
"0.6215207",
"0.6209789",
"0.6209789",
"0.62086356",
"0.61954355",
"0.61878395... | 0.0 | -1 |
POST /subject_items POST /subject_items.json | def create
@subject_item = SubjectItem.new(tutor_id: @tutor.id, subject_id: subject_item_params[:subject_id])
respond_to do |format|
if @subject_item.save
format.html { redirect_to @tutor, notice: 'Subject was successfully added.' }
format.json { render :show, status: :created, location: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subject_item_params\n params.require(:subject_item).permit(:tutor_id, :subject_id)\n end",
"def create\n @item = Item.new(params[:item])\n @item.subjects = Subject.find(params[:subject_ids]) if params[:subject_ids]\n @items = load_items(@item)\n \n @months = Month.where(['publish=?', t... | [
"0.7080272",
"0.66519874",
"0.6599536",
"0.64423496",
"0.6419254",
"0.6347628",
"0.6210532",
"0.61745447",
"0.6139128",
"0.60942936",
"0.6055369",
"0.6047245",
"0.6045664",
"0.6040998",
"0.6033356",
"0.59967774",
"0.59899014",
"0.59857047",
"0.59767276",
"0.59628016",
"0.5942... | 0.7472016 | 0 |
PATCH/PUT /subject_items/1 PATCH/PUT /subject_items/1.json | def update
respond_to do |format|
if @subject_item.update(subject_item_params)
format.html { redirect_to @subject_item, notice: 'Subject item was successfully updated.' }
format.json { render :show, status: :ok, location: @subject_item }
else
format.html { render :edit }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @title = \"Edit Subject\"\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { head :ok }\n else\n ... | [
"0.7036017",
"0.70272654",
"0.69999033",
"0.6922155",
"0.67726326",
"0.6755097",
"0.6708351",
"0.6705978",
"0.6705978",
"0.6636458",
"0.66009283",
"0.65854496",
"0.65701",
"0.6554151",
"0.6505301",
"0.6476819",
"0.6456636",
"0.6443394",
"0.6409047",
"0.63990456",
"0.635275",
... | 0.7448923 | 0 |
DELETE /subject_items/1 DELETE /subject_items/1.json | def destroy
@subject_item.destroy
tutor = Tutor.find(session[:user_id])
respond_to do |format|
format.html { redirect_to tutor, notice: 'Subject item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @subject = @client.subjects.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n flash[:notice] = 'Subject was successfully removed.' \n format.html { redirect_to(client_subjects_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ... | [
"0.729676",
"0.7241296",
"0.72329587",
"0.720648",
"0.7184549",
"0.70445526",
"0.70408845",
"0.7033601",
"0.70159286",
"0.7012966",
"0.6980766",
"0.69676524",
"0.6967476",
"0.69538194",
"0.6924403",
"0.69235224",
"0.68825793",
"0.6882027",
"0.68782824",
"0.6877595",
"0.687579... | 0.7242027 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_subject_item
@subject_item = SubjectItem.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 subject_item_params
params.require(:subject_item).permit(:tutor_id, :subject_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.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 |
PUT /profile/update/email to update email of the user | def updateEmail
if @user
if (@user.authenticate(update_params[:password]))
if @user.update(email: update_params[:email])
render json: @user
else
render json: @user.errors, status: :unprocessable_entity
end
else
render json: { message: "Authentication F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_profile_email\n user_profile.update_attribute(:email, email) if saved_change_to_email?\n end",
"def update_email(user_id:, email:)\n path = '/users/{userId}/email'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Excep... | [
"0.82530445",
"0.8190891",
"0.8003596",
"0.79421824",
"0.7805468",
"0.76511085",
"0.764096",
"0.7596916",
"0.73835754",
"0.73794913",
"0.7345478",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.7300535",
"0.73004043"... | 0.7664021 | 5 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
lowest_num = 0
lowest = nil
name_hash.each do |item, num|
if num <= lowest_num || lowest_num == 0
lowest_num = num
lowest = item
end
end
return lowest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585... | 0.0 | -1 |
comment out to see effects | def get_name
puts "What is your surname?:"
name = gets.chomp
print_thanks
if check_name_ok?(name)
then print_new_name(name) end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intermediate_effect(_effects); end",
"def draw_effect\n end",
"def final_effect(_effects); end",
"def show_effect\n puts \"Wow!\" * @wow_factor\n end",
"def do_effect(target)\n end",
"def virus_effects\r\n predicted_deaths()\r\n speed_of_spread()\r\n end",
"def virus_effects\r\n ... | [
"0.73943037",
"0.7262486",
"0.7062644",
"0.6772364",
"0.67430973",
"0.6519612",
"0.6518817",
"0.64960027",
"0.6483794",
"0.64336973",
"0.6429653",
"0.64063746",
"0.64063746",
"0.6386366",
"0.6382187",
"0.6377991",
"0.63539946",
"0.6352909",
"0.6352909",
"0.6352909",
"0.629378... | 0.0 | -1 |
1)Sanderfer 2)Tyler We spent [1.25] hours on this challenge. | def serving_size_calc(item_to_make, num_of_ingredients)
library = {"cookie" => 1, "cake" => 5, "pie" => 7}
raise ArgumentError.new("#{item_to_make} is not a valid input") unless library[item_to_make]
serving_size = library[item_to_make]
remaining_ingredients = num_of_ingredients % serving_size
not_exact_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n ... | [
"0.65968055",
"0.65174496",
"0.6488878",
"0.648805",
"0.63503504",
"0.63106984",
"0.6293267",
"0.6280895",
"0.6236727",
"0.62245095",
"0.6143357",
"0.6128865",
"0.6128178",
"0.6120335",
"0.6106738",
"0.6091272",
"0.6086362",
"0.6084534",
"0.60701275",
"0.6061215",
"0.60455716... | 0.0 | -1 |
Tries to get an ActiveRecord instance from url_in parameter | def active_record_instance
@active_record_instance ||=
options[:active_record_instance] ||
options[:ari] ||
Array(url_in).reverse.detect { |e| e.kind_of?(ActiveRecord::Base) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_param!(value, args={})\n param = permalink_options[:param]\n obj = find_by_param(value, args)\n raise ::ActiveRecord::RecordNotFound unless obj\n obj\n end",
"def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end",
"def find_object\n... | [
"0.5652703",
"0.56452566",
"0.55953413",
"0.552727",
"0.55226386",
"0.5481448",
"0.5451291",
"0.54134345",
"0.53774583",
"0.5279726",
"0.5231077",
"0.521255",
"0.52116174",
"0.5200394",
"0.518761",
"0.51328206",
"0.51282066",
"0.5102914",
"0.5101257",
"0.5062099",
"0.50352585... | 0.6346827 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_contributor
@contributor = Contributor.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def contributor_params
params.require(:contributor).permit(:name, :email, :zip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Shortcut to enable colors. | def colorize!; @colors = true; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colorize(*args)\n shell.set_color(*args)\n end",
"def start_color\n \"\\033[\"\n end",
"def color(*args)\n @instructions << Instruction.new(:color, args)\n self\n end",
"def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end",
"def open!\n @color = @@colors[:cyan]\n end... | [
"0.69776964",
"0.6632078",
"0.6556626",
"0.65120846",
"0.6443179",
"0.64119023",
"0.63609064",
"0.6333419",
"0.62767774",
"0.62282044",
"0.62190163",
"0.6206094",
"0.6189441",
"0.61824083",
"0.6174802",
"0.61576694",
"0.61439574",
"0.61432076",
"0.6130808",
"0.60988605",
"0.6... | 0.60823774 | 20 |
The IO stream Adapter classes should provide their own implementation of this method. | def stream
synchronize { open! if @stream.nil?; @stream }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_stream; end",
"def stream; end",
"def stream; end",
"def stream; end",
"def stream; end",
"def initialize_buffered_io; end",
"def get_input_stream\n raise NotImplementedError\n end",
"def io; end",
"def io; end",
"def io; end",
"def io; end",
"def io_out\n raise NotIm... | [
"0.714092",
"0.70868367",
"0.70868367",
"0.70868367",
"0.70868367",
"0.67839676",
"0.672545",
"0.66374236",
"0.66374236",
"0.66374236",
"0.66374236",
"0.6501277",
"0.6403201",
"0.6382499",
"0.63226604",
"0.63226604",
"0.6277563",
"0.62473685",
"0.6137359",
"0.6125696",
"0.611... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reset any or all installed ATS scripts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def reset(script_name = nil)
if script_name.is_a? (Symbol) # If script to reset specified
CONFIG[script_name].each_pair { |key, value|
self.send("#{key}=".to_sym, value)
$game_message.send("#{key}=".to_sym, value)
}
else # Reset all ATS scripts
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n\t\tdo_send('ARST 2')\n\tend",
"def reset_all\n clear_commands\n reset_colors\n @app_info = nil\n @app_exe = nil\n @verbose_parameters = true\n @@default_method = nil\n @@class_cache = {}\n end",
"def reset\r\n interpreter_reset\r\n compiler_reset\r\... | [
"0.6567418",
"0.6557343",
"0.6361322",
"0.6290051",
"0.61843383",
"0.61338586",
"0.6086463",
"0.60313576",
"0.60027665",
"0.59756714",
"0.59721196",
"0.5944987",
"0.5943459",
"0.5940743",
"0.5918453",
"0.5912767",
"0.58708745",
"0.5852822",
"0.58397985",
"0.5831743",
"0.58172... | 0.69128454 | 0 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Initialize any newly installed ATS scripts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def init_new_installs
CONFIG.keys.each { |script| reset(script) unless self.send(script) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_init_script; end",
"def perform_custom_initialization(_config)\n script_path = ENV[VAR_CUSTOM_INIT_SCRIPT]\n inform(\"Environment variable #{VAR_CUSTOM_INIT_SCRIPT}\") { \"'#{script_path}'\" }\n return if script_path.nil?\n return if script_path.empty?\n\n script_pathname = Pathname.getwd + script_p... | [
"0.7037716",
"0.66428393",
"0.6277894",
"0.6185009",
"0.6061125",
"0.6061125",
"0.605478",
"0.60016924",
"0.5984531",
"0.59386164",
"0.59193844",
"0.59101135",
"0.5884597",
"0.58547014",
"0.5848204",
"0.581349",
"0.5812293",
"0.5807351",
"0.5789853",
"0.5787119",
"0.5766025",... | 0.65399814 | 2 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ATS Next ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def ats_next(sym, *args, &block)
$game_message.send("#{sym}=".to_sym, *args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next()\n \n end",
"def next()\n \n end",
"def next() end",
"def next() end",
"def next\n end",
"def next\n end",
"def get_next\n\t\t\n\tend",
"def next\n @next\n end",
"def next\n connection.write(\"next\")\n end",
"def next\n connection.write(\"ne... | [
"0.69554687",
"0.69554687",
"0.6821971",
"0.6821971",
"0.6770178",
"0.6770178",
"0.66796094",
"0.6601583",
"0.6406033",
"0.6406033",
"0.64029545",
"0.64029545",
"0.64029545",
"0.64029545",
"0.64029545",
"0.64029545",
"0.6370629",
"0.63242084",
"0.62653804",
"0.6217872",
"0.62... | 0.5637879 | 49 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Format Paragraph ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def mapf_format_paragraph(text, max_width = contents_width)
text = text.clone
# Create a Dummy Contents - I wanted to boost compatibility by using the
# default process method for escape codes. It may have the opposite effect,
# for some :(
real_contents = contents # Preserve Real Contents
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_paragraph(x, y, width, paragraph)\n draw_formatted_text(x, y, width, paragraph, nil, true)\n end",
"def body_paragraph(num)\n puts \"#{num} little monkeys jumping on the bed,\nOne fell off and bumped his head,\nMama called the doctor and the doctor said,\n'No more monkeys jumping on the bed!'\n\n\"... | [
"0.74283004",
"0.73333645",
"0.7231976",
"0.7090387",
"0.7084163",
"0.70701325",
"0.6969416",
"0.69346744",
"0.69082177",
"0.6905839",
"0.685336",
"0.6766365",
"0.67542183",
"0.6724365",
"0.6717824",
"0.66917247",
"0.6683824",
"0.6650669",
"0.66403663",
"0.6639086",
"0.663409... | 0.70485014 | 6 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Format By Line ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def mapf_format_by_line(text, max_width = contents_width)
oline, nline, tw = "", "", 0
loop do
# Format each word until reach the width limit
oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)
return oline, nline, tw if done
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def formatter; end",
"def formatter; end",
"def formatter; end",
"def format!; end",
"def formats; end",
"def formats; end",
"def forma... | [
"0.7219819",
"0.7219819",
"0.7219819",
"0.7219819",
"0.7219819",
"0.7219819",
"0.7219819",
"0.7219819",
"0.70439434",
"0.70439434",
"0.70439434",
"0.6858765",
"0.6811896",
"0.6811896",
"0.6650409",
"0.6611564",
"0.6611564",
"0.6611564",
"0.6611564",
"0.6611564",
"0.6611564",
... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Format By Word ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def mapf_format_by_word(text, line, tw, max_width)
return line, line, tw, true if text.nil? || text.empty?
# Extract next word
if text.sub!(/([ \t\r]*)(\S*)([\n\f]?)/, "") != nil
prespace, word, line_end = $1, $2, $3
ntw = mapf_calc_line_width(word, tw, true)
pw = contents.text_size(prespa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format(text); end",
"def format_words\n return \"@words = #{@words.inspect}\"\n end",
"def mapf_format_by_word(text, line, tw, max_width)\n return line, line, tw, true if text.nil? || text.empty?\n # Extract next word\n if text.sub!(/([ \\t\\r\\f]*)(\\S*)([\\n\\f]?)/, \"\") != nil\n presp... | [
"0.69472384",
"0.632982",
"0.6138565",
"0.6122835",
"0.60531414",
"0.60531414",
"0.6031906",
"0.5981815",
"0.5969852",
"0.5969852",
"0.5969852",
"0.5969852",
"0.5969852",
"0.5969852",
"0.5969852",
"0.5969852",
"0.59410733",
"0.593856",
"0.5930017",
"0.5923433",
"0.5852678",
... | 0.6104782 | 4 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Same Message Conditions? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def maats_same_message_conditions?(list_index)
n_params = @list[list_index].parameters
if ($imported[:MA_CompositeGraphics] || $imported[:ATS_FaceOptions]) &&
@list[list_index + 1] && @list[list_index + 1].parameters[0][/^\\([AP])F\[(\d+)\]/i]
param = $2.to_i
actor = ($1 == 'A') ? $g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_to_check_message_against; end",
"def next_message; end",
"def next_message; end",
"def message( message )\n\tend",
"def message(message) end",
"def message_buffer; end",
"def processOtherMessage(line)\n #nothing to do with this message\nend",
"def process_message(message)\n end",
"d... | [
"0.66017014",
"0.65145534",
"0.65145534",
"0.64729655",
"0.64350003",
"0.6320764",
"0.6290593",
"0.62767935",
"0.6198616",
"0.6183351",
"0.6166625",
"0.61036325",
"0.6097782",
"0.6097782",
"0.6097782",
"0.6097782",
"0.6097782",
"0.6097782",
"0.60653615",
"0.60653615",
"0.6065... | 0.0 | -1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Paragraph New Line `````````````````````````````````````````````````````````````````````````` This adds processing for paragraph format and alignment to these methods ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def maatsf_paragraph_new_line(orig_method, text, pos, *args, &block)
tw = nil
tw = maatsf_set_next_line(text, pos) if $game_message.paragraph_format && !text.nil? && !text.empty?
orig_method.call(text, pos, *args, &block) # Call original Method
# Alignment
next_line = text[/^[^\n\f]*/]
align = m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrapped_by_paragraph; end",
"def add_paragraphs\n lines = seperate_lines\n max_index = lines.size - 1\n (1..(max_index)).each do |index|\n previous_line = lines[index -1]\n current_line = lines[index]\n next_line = lines[index + 1]\n if current_line[0] != (\"#\" || \"\\n\" || \"<... | [
"0.7374909",
"0.7259212",
"0.71753985",
"0.71305984",
"0.69739974",
"0.6784927",
"0.6753646",
"0.6701451",
"0.6673581",
"0.66603976",
"0.66479975",
"0.6623002",
"0.66152877",
"0.65632915",
"0.65354",
"0.65165323",
"0.6482665",
"0.6420647",
"0.64082515",
"0.63622874",
"0.63525... | 0.7701416 | 0 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Paragraph Line ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def maatsf_set_next_line(text, pos)
text.gsub!(/^[ \t\r\f]*/, "")
max_width = maatsf_total_line_width(pos[:y])
# Create a Dummy Contents
real_contents = contents # Preserve Real Contents
self.contents = Bitmap.new(24, 24)
self.contents.font = real_contents.font.dup
@atsf_testing = true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normal_line(text)\n end",
"def wrapped_by_paragraph; end",
"def paragraph; end",
"def test_paragraph(x, y, width, paragraph)\n draw_formatted_text(x, y, width, paragraph, nil, true)\n end",
"def paragraph_end; end",
"def maatsf_paragraph_new_line(orig_method, text, pos, *args, &block)\n tw ... | [
"0.73639584",
"0.726299",
"0.7122685",
"0.7118951",
"0.69556254",
"0.67733645",
"0.6766274",
"0.6720235",
"0.6712077",
"0.6616696",
"0.65940577",
"0.65917146",
"0.65533423",
"0.6536647",
"0.65277416",
"0.65140116",
"0.64560103",
"0.6418162",
"0.6417167",
"0.63961464",
"0.6383... | 0.0 | -1 |
If convert_escape_characters undefined in Window_Message, call super method | def convert_escape_characters(*args, &block)
maatsf_convert_escape_characters(super(*args, &block))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pbMessageDisplay(msgwindow,message,letterbyletter=true,commandProc=nil)\r\n return if !msgwindow\r\n oldletterbyletter=msgwindow.letterbyletter\r\n msgwindow.letterbyletter=(letterbyletter) ? true : false\r\n ret=nil\r\n commands=nil\r\n facewindow=nil\r\n goldwindow=nil\r\n coinwindow=nil\r\n battlep... | [
"0.6439922",
"0.567383",
"0.56521016",
"0.55995023",
"0.554996",
"0.5358541",
"0.53503287",
"0.5339467",
"0.5307572",
"0.52853596",
"0.52844334",
"0.5262819",
"0.5208526",
"0.5175463",
"0.5175463",
"0.5175463",
"0.5131433",
"0.51141703",
"0.5089249",
"0.5059724",
"0.5055082",... | 0.62722915 | 1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Total Line Width ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def maatsf_total_line_width(y = 0)
contents_width - new_line_x
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maatsf_total_line_width(y = 0)\n contents_width\n end",
"def width\n theWidth = 0\n @theLines.each { |l| theWidth = l.length if l.length > theWidth }\n theWidth\n end",
"def line_width(value=nil)\n set RGhost::LineWidth.new(value)\n end",
"def SetLineWidth(width)\n\t\t#Set line width\n\... | [
"0.7676694",
"0.72975683",
"0.72302496",
"0.7105381",
"0.7101817",
"0.7080289",
"0.70468587",
"0.6959782",
"0.68739796",
"0.6794996",
"0.67469746",
"0.67413634",
"0.6721577",
"0.67051935",
"0.6685614",
"0.6685614",
"0.66778404",
"0.66778404",
"0.66778404",
"0.66778404",
"0.66... | 0.7545833 | 1 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Total Line Width ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | def maatsf_total_line_width(y = 0)
contents_width
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maatsf_total_line_width(y = 0)\n contents_width - new_line_x\n end",
"def width\n theWidth = 0\n @theLines.each { |l| theWidth = l.length if l.length > theWidth }\n theWidth\n end",
"def line_width(value=nil)\n set RGhost::LineWidth.new(value)\n end",
"def SetLineWidth(width)\n\t\t#Set ... | [
"0.75441015",
"0.7295984",
"0.7228601",
"0.71050704",
"0.7100307",
"0.70795774",
"0.70452356",
"0.6958722",
"0.68743527",
"0.67948705",
"0.674711",
"0.67419297",
"0.6721032",
"0.67049164",
"0.6685234",
"0.6685234",
"0.66768324",
"0.66768324",
"0.66768324",
"0.66768324",
"0.66... | 0.7675139 | 0 |
GET /blocks/new GET /blocks/new.xml | def new
@block = Block.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @block }
format.json { render :json => @block }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n end\n end",
"def new\n @block = @site.blocks.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @block }\n ... | [
"0.79764307",
"0.79043686",
"0.7362495",
"0.7041933",
"0.68669087",
"0.68467206",
"0.68184406",
"0.6754742",
"0.67515993",
"0.67376524",
"0.6712373",
"0.66790575",
"0.6646599",
"0.66452545",
"0.6635554",
"0.6607159",
"0.660408",
"0.65948665",
"0.6543748",
"0.6515761",
"0.6505... | 0.7790666 | 2 |
POST /blocks POST /blocks.xml | def create
@block = Block.new(params[:block])
respond_to do |format|
if @block.save
flash[:notice] = 'Block was successfully created.'
format.html { redirect_to(@block) }
format.xml { render :xml => @block, :status => :created, :location => @block }
format.json { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block(user)\n post \"blocks/create/#{user}\"\n end",
"def create\n @block = Block.new(params[:block])\n\n respond_to do |format|\n if @block.save\n flash[:notice] = 'Block was successfully created.'\n format.html { redirect_to(@block) }\n format.xml { render :xml => @bloc... | [
"0.664912",
"0.65127015",
"0.64119333",
"0.6406925",
"0.6292165",
"0.6238698",
"0.6209981",
"0.61947894",
"0.6127339",
"0.60852873",
"0.6080232",
"0.6054923",
"0.60269314",
"0.60197276",
"0.6019498",
"0.6007451",
"0.59799886",
"0.5934087",
"0.5931148",
"0.5925653",
"0.5854966... | 0.6455815 | 2 |
PUT /blocks/1 PUT /blocks/1.xml | def update
@block = Block.find(params[:id])
respond_to do |format|
if @block.update_attributes(params[:block])
flash[:notice] = 'Block was successfully updated.'
format.html { redirect_to(@block) }
format.xml { head :ok }
format.json { head :ok }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @block = @site.blocks.find(params[:id])\n\n respond_to do |format|\n params[:block].delete :user_id\n if @block.update_attributes(params[:block])\n flash[:notice] = 'Block was successfully updated.'\n format.html { redirect_to([@site, @block]) }\n format.xml { hea... | [
"0.6791023",
"0.67624986",
"0.6409498",
"0.63707423",
"0.6269257",
"0.6265205",
"0.6265205",
"0.6250812",
"0.6246049",
"0.62313414",
"0.60601497",
"0.59712285",
"0.5956766",
"0.5954179",
"0.59444654",
"0.5913005",
"0.58284885",
"0.5809566",
"0.5808448",
"0.5796866",
"0.578667... | 0.6723634 | 2 |
DELETE /blocks/1 DELETE /blocks/1.xml | def destroy
@block = Block.find(params[:id])
@block.destroy
respond_to do |format|
format.html { redirect_to(blocks_url) }
format.xml { head :ok }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @block = @site.blocks.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to(blocks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n f... | [
"0.7689964",
"0.75159293",
"0.71450174",
"0.6970623",
"0.6813528",
"0.680572",
"0.680572",
"0.6799088",
"0.67906195",
"0.67797244",
"0.6750712",
"0.6641802",
"0.66046923",
"0.65442973",
"0.6486124",
"0.6469577",
"0.6467499",
"0.643577",
"0.6411512",
"0.6388532",
"0.6386038",
... | 0.7272832 | 2 |
Download all pending Taric and Chief updates | def download(event)
info "Finished downloading updates"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def download_response_files!\n files_downloaded = []\n File.makedirs(cache_location + '/returns')\n with_ftp do |ftp|\n files = ftp.list('*.csv')\n files.each do |filels|\n ... | [
"0.6269755",
"0.61464566",
"0.61320186",
"0.6123451",
"0.60829365",
"0.60718095",
"0.6063184",
"0.6006954",
"0.597319",
"0.59401906",
"0.59072053",
"0.5901555",
"0.58790785",
"0.5878561",
"0.58712655",
"0.5868958",
"0.5864501",
"0.5863256",
"0.5845576",
"0.5834762",
"0.582613... | 0.6115277 | 4 |
Sync variables were not set correctly | def config_error(event)
error "Missing: config/trade_tariff_backend_secrets.yml. Variables: username, password, host and email."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync=\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync=(p0) end",
"def old_sync=(_arg0); end",
"def sync=(arg0)\n end",
"def sync; end",
"def sync=(p1)\n #This is a stub, used for indexing\n end",
"def old_sync; ... | [
"0.7186197",
"0.70627177",
"0.70627177",
"0.70627177",
"0.7006593",
"0.7006593",
"0.7006593",
"0.69975203",
"0.68850344",
"0.6815183",
"0.6776929",
"0.67508775",
"0.64770776",
"0.6475906",
"0.6475906",
"0.623582",
"0.61167306",
"0.6000568",
"0.5985423",
"0.5884584",
"0.586476... | 0.0 | -1 |
There are failed updates (can't proceed) | def failed_updates_present(event)
error "TariffSynchronizer found failed updates that need to be fixed before running: #{event.payload[:file_names]}"
Mailer.failures_reminder(event.payload[:file_names]).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_failed?\n @update_failed\n end",
"def failed_update(event)\n error \"Update failed: #{event.payload[:update]}\"\n\n Mailer.exception(\n event.payload[:exception],\n event.payload[:update],\n event.payload[:database_queries]\n ).deliver\n ... | [
"0.8076558",
"0.7170215",
"0.7102859",
"0.68871844",
"0.68077314",
"0.655233",
"0.6290971",
"0.6260362",
"0.620096",
"0.6190606",
"0.6178817",
"0.6127422",
"0.60575765",
"0.60312873",
"0.60312873",
"0.6020213",
"0.60156244",
"0.60155845",
"0.60155845",
"0.60155845",
"0.601558... | 0.6571964 | 5 |
Apply all pending Taric and Chief updates | def apply(event)
info "Finished applying updates"
Mailer.applied(
event.payload[:update_names],
event.payload.fetch(:unconformant_records, [])
).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n verify_no_uncommitted_merge\n verify_valid_update\n \n check_unknown if force\n check_collision if false # case-insensitive file-system? seriously? (uh... mac os x ring a bell?)\n \n @actions = []\n \n f... | [
"0.62067306",
"0.60550046",
"0.58463615",
"0.5795878",
"0.57292384",
"0.57267946",
"0.57174236",
"0.56776804",
"0.5671043",
"0.56669116",
"0.56383353",
"0.5630319",
"0.5606241",
"0.56035095",
"0.5578929",
"0.5538054",
"0.55120903",
"0.5477128",
"0.5464815",
"0.54374975",
"0.5... | 0.60183847 | 2 |
Update failed to be applied | def failed_update(event)
error "Update failed: #{event.payload[:update]}"
Mailer.exception(
event.payload[:exception],
event.payload[:update],
event.payload[:database_queries]
).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_failed?\n @update_failed\n end",
"def correctly_update_status\n\t\terrors.add(:base, 'La transaccion no fue exitosa') if self.invalid_status\n\tend",
"def update_with_conflict_validation(*args)\n update(*args)\n rescue ActiveRecord::StaleObjectError\n self.lock_versi... | [
"0.7426594",
"0.6746862",
"0.6573984",
"0.650344",
"0.64806116",
"0.6425447",
"0.6425447",
"0.6425447",
"0.6425447",
"0.63983184",
"0.6351125",
"0.6351125",
"0.63241935",
"0.631716",
"0.6215678",
"0.62120163",
"0.61566263",
"0.61543804",
"0.61536634",
"0.612072",
"0.612072",
... | 0.6530472 | 3 |
Update rebuild from files present in the file system | def rebuild(event)
info "Rebuilding updates from file system"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_files\n @project.rebuild_files()\n end",
"def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\... | [
"0.8028572",
"0.6828397",
"0.6804391",
"0.6656891",
"0.6427092",
"0.6351059",
"0.61069727",
"0.61069113",
"0.60917705",
"0.60796887",
"0.6051734",
"0.60332197",
"0.59956187",
"0.59768885",
"0.5967135",
"0.5954807",
"0.5933286",
"0.59087414",
"0.58918357",
"0.5867245",
"0.5844... | 0.7600647 | 1 |
Update not found on file system | def not_found_on_file_system(event)
error "Update not found on file system at #{event.payload[:path]}"
Mailer.file_not_found_on_filesystem(event.payload[:path]).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(_show_output)\n @check_existing_files_for_update = true\n begin\n preheat_existing_files\n ensure\n @check_existing_files_for_update = false\n end\n []\n end",
"def update\n msg = FileOperations.id_exist?(self) ? FileOperations.update(self) : 'Product\n ... | [
"0.68786806",
"0.66237986",
"0.65430033",
"0.64686155",
"0.64525867",
"0.637731",
"0.62443024",
"0.61956364",
"0.6193628",
"0.61795163",
"0.61002594",
"0.60985816",
"0.60575044",
"0.6057094",
"0.600842",
"0.600842",
"0.600842",
"0.600842",
"0.600842",
"0.600842",
"0.600842",
... | 0.64424026 | 5 |
Query for TARIC update path | def get_taric_update_name(event)
info "Checking for TARIC update for #{event.payload[:date]} at #{event.payload[:url]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
... | [
"0.5335466",
"0.516965",
"0.50741315",
"0.50720954",
"0.50637573",
"0.50541604",
"0.50541604",
"0.50541604",
"0.50541604",
"0.50534266",
"0.50321203",
"0.50091255",
"0.4994746",
"0.49946097",
"0.49892533",
"0.49679884",
"0.49555257",
"0.49501088",
"0.49395704",
"0.49211293",
... | 0.5215424 | 1 |
Update file written to file system | def update_written(event)
info "Update file written to file system: #{File.join(Rails.root, event.payload[:path])} (size: #{event.payload[:size]})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file\n\n # file_edited is false when there was no match in the whole file and thus no contents have changed.\n if file_edited\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, :preserve => true)\n File.open(origina... | [
"0.7252965",
"0.7118828",
"0.7106673",
"0.6827268",
"0.6720466",
"0.6716073",
"0.66462094",
"0.66114247",
"0.65498036",
"0.6524849",
"0.64943326",
"0.6474829",
"0.6473883",
"0.64574367",
"0.6443731",
"0.6441723",
"0.64307344",
"0.64283603",
"0.64224136",
"0.64224136",
"0.6394... | 0.76991886 | 0 |
Update with blank content received | def blank_update(event)
error "Blank update content received for #{event.payload[:date]}: #{event.payload[:url]}"
Mailer.blank_update(event.payload[:url], event.payload[:url]).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n end",
"def update!(**args)\n... | [
"0.64012116",
"0.64012116",
"0.64012116",
"0.64012116",
"0.6272208",
"0.62252",
"0.62173927",
"0.6210104",
"0.6089417",
"0.60570306",
"0.60489565",
"0.6042076",
"0.6014099",
"0.599626",
"0.59823793",
"0.593566",
"0.5895777",
"0.58394176",
"0.58394176",
"0.5825998",
"0.5825998... | 0.6148696 | 8 |
Can't open file for writing | def cant_open_file(event)
error "Can't open file for writing update at #{event.payload[:path]}"
Mailer.file_write_error(event.payload[:path], "can't open for writing").deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opx_file_open_write(file)\n File.open(file, \"w\")\n rescue => e\n opx_err(\"Fatal failure of File.open for writing: #{file}\", e)\n end",
"def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end",
"def open_for_write\n end",
"def pr... | [
"0.78389776",
"0.7252785",
"0.723186",
"0.717112",
"0.6870705",
"0.6701323",
"0.6643193",
"0.66090834",
"0.6589885",
"0.6537884",
"0.6521407",
"0.65185994",
"0.6467818",
"0.6423561",
"0.640601",
"0.636157",
"0.6350857",
"0.63485414",
"0.6343063",
"0.6336272",
"0.63240236",
... | 0.6195075 | 30 |
Can't write to file | def cant_write_to_file(event)
error "Can't write to update file at #{event.payload[:path]}"
Mailer.file_write_error(event.payload[:path], "can't write to file").deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_file!\n file = File.new( path, \"w\")\n \n file.write(@source)\n file.close\n end",
"def write_file(path)\n File.open(path, 'w') {|f| write_io(f)}\n end",
"def opx_file_open_write(file)\n File.open(file, \"w\")\n rescue => e\n opx_err(\"Fatal failure of File.... | [
"0.74982363",
"0.72695863",
"0.7222334",
"0.7111142",
"0.7111142",
"0.70879155",
"0.7064601",
"0.7027815",
"0.7019941",
"0.6989055",
"0.69662935",
"0.6961607",
"0.69260114",
"0.6916663",
"0.6902381",
"0.68895185",
"0.68801236",
"0.68683606",
"0.6850256",
"0.68363863",
"0.6802... | 0.0 | -1 |
No permission to write update file | def write_permission_error(event)
error "No permission to write update to #{event.payload[:path]}"
Mailer.file_write_error(event.payload[:path], 'permission error').deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cant_write_to_file(event)\n error \"Can't write to update file at #{event.payload[:path]}\"\n\n Mailer.file_write_error(event.payload[:path], \"can't write to file\").deliver\n end",
"def test_stat_modifications\n @client.write(@file, '')\n\n [0745, 0600, 0443].each do |mode|\n @clien... | [
"0.6758229",
"0.65460443",
"0.6477445",
"0.63119525",
"0.6295586",
"0.62490463",
"0.6238712",
"0.6197235",
"0.61507285",
"0.6118208",
"0.6106413",
"0.6086426",
"0.60587597",
"0.60209334",
"0.5974847",
"0.59652126",
"0.59652126",
"0.595562",
"0.5950875",
"0.5931056",
"0.592505... | 0.6510157 | 2 |
We missed three update files in a row Might be okay for Taric, but most likely not ok for CHIEF this is precautionary measure | def missing_updates(event)
warn "Missing #{event.payload[:count]} updates in a row for #{event.payload[:update_type].to_s.upcase}"
Mailer.missing_updates(event.payload[:count], event.payload[:update_type].to_s).deliver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n ... | [
"0.6163748",
"0.60653526",
"0.59181386",
"0.58293533",
"0.5804927",
"0.5645523",
"0.5553005",
"0.55125684",
"0.54685336",
"0.5457828",
"0.5444733",
"0.5441109",
"0.54301536",
"0.5406548",
"0.54061824",
"0.5375468",
"0.53745115",
"0.5367447",
"0.53639036",
"0.5361431",
"0.5351... | 0.52066624 | 41 |
and returns a list of the digits in the number | def digit_list(num)
num.digits.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"def digit_list(number)\n number.to_s.chars.map(&:t... | [
"0.8550756",
"0.8550756",
"0.8550756",
"0.8550756",
"0.8550756",
"0.8457627",
"0.8449478",
"0.84437734",
"0.83892405",
"0.83892405",
"0.8342555",
"0.8314292",
"0.8202414",
"0.8192811",
"0.810716",
"0.80981356",
"0.80881625",
"0.8081823",
"0.8047179",
"0.80402076",
"0.80223566... | 0.77077705 | 34 |
This naming convention is for the frontend rubocop:disable Style/PredicateName | def is_admin
object.admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_predicate; end",
"def predicate(true_class, name=nil)\n name = name ? name.to_s : true_class.name.split('::')[-1]\n label = Purugin::StringUtils.camelcase_to(name, ' ')\n name = Purugin::StringUtils.camelcase_to(name, '_').downcase\n true_class.__send__(:define_method, :kind) { name }... | [
"0.70634884",
"0.67667675",
"0.66103804",
"0.6402422",
"0.63767564",
"0.63767564",
"0.6362238",
"0.6352039",
"0.62433684",
"0.61798114",
"0.61458755",
"0.61413336",
"0.612341",
"0.60455376",
"0.6008423",
"0.59763783",
"0.5961634",
"0.59405404",
"0.5921133",
"0.5918927",
"0.58... | 0.0 | -1 |
Recursive solution has linear space complexity or O(n): memory required is proportional to the number of function calls to f(n1) Recursive solution has factorial time complexity or O(2^n): the number of function calls (ie, operations) nearly doubles with each increase in input Iterative solution has constant space comp... | def fibonacci(n)
if n == nil || n < 0
raise ArgumentError
end
# base cases are 0 and 1 (0th place is 0, 1st place is 1)
if n < 2
return n
end
counter = 1
left = 0
right = 1
while counter < n
sum = left + right
left = right
right = sum
counter += 1
end
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_solution\n\n end",
"def factorial_iterative(n)\n result = 1\n while n > 1\n result *= n # mutation: changing result\n n -= 1 # mutation: changing n\n end\n\n result\nend",
"def factorial_recursive(n)\n\t\tif n == 1\n\t\t\treturn 1\n\t\telse\n\t\t\tn * factorial_recursive(n-1)\n\t\tend\... | [
"0.67174053",
"0.6462226",
"0.644731",
"0.64460635",
"0.6409598",
"0.640218",
"0.6396847",
"0.63866645",
"0.6386048",
"0.63847136",
"0.6367564",
"0.6345051",
"0.63386005",
"0.63386005",
"0.6333522",
"0.63315994",
"0.63315994",
"0.63315994",
"0.63315994",
"0.631952",
"0.631811... | 0.0 | -1 |
NumberSolitaire In a given array, find the subset of maximal sum in which the distance between consecutive elements is at most 6. | def solution(a)
d = 6
n = a.length
sums = [a[0]] * d
for i in 1...n do
sums[i % d] = sums.max + a[i]
end
sums[(n-1) % d]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_sub_sum(array)\n subsets = []\n i = 0\n while i < array.length\n j = i\n while j < array.length\n subsets << array[i..j]\n j += 1\n end\n i += 1\n end\n result = nil\n subsets.map {|subset| subset.inject(:+)}.each do |sum|\n result = sum if result.nil? || result < sum\n ... | [
"0.72675735",
"0.712554",
"0.704723",
"0.70090246",
"0.6951064",
"0.694695",
"0.69108707",
"0.6903129",
"0.6895288",
"0.6881985",
"0.68795335",
"0.6845279",
"0.6829856",
"0.68290997",
"0.68279064",
"0.6810578",
"0.6808935",
"0.6806377",
"0.6805946",
"0.6781419",
"0.6743866",
... | 0.6969544 | 4 |
POST for a message to a channel | def create
channel_sid = params[:channel_sid]
@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])
# Add the member
service = @client.chat.v2.services(ENV['service_sid'])
channel = service.channels(channel_sid)
message = channel.messages.create(body: params[:body])
puts message
resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( para... | [
"0.7434828",
"0.7390431",
"0.7327341",
"0.7151634",
"0.71134186",
"0.71134186",
"0.693118",
"0.6922547",
"0.69034815",
"0.68892187",
"0.6810558",
"0.68037987",
"0.6802893",
"0.67961264",
"0.6784116",
"0.6772133",
"0.6751085",
"0.6679517",
"0.66554695",
"0.6651984",
"0.6646668... | 0.68558955 | 10 |
GET for a particular message on a channel | def show
channel_sid = params[:channel_sid]
@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])
# Retrieve the member
service = @client.chat.v2.services(ENV['service_sid'])
channel = service.channels(channel_sid)
message = channel.messages(params[:id]).fetch
message_json = "{\n\"mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message(display_id, message_id)\n get \"commandcenter/displays/#{display_id}/messages/#{message_id}\"\n end",
"def message(message)\n get(\"inbox/messages/#{message}\").pop\n end",
"def get_message(id, options = nil)\r\n @client.raw('get', \"/content/messages/#{id}\",... | [
"0.7124201",
"0.69601244",
"0.6935595",
"0.69181937",
"0.671322",
"0.66202044",
"0.6562016",
"0.65429157",
"0.65429157",
"0.6514695",
"0.6472282",
"0.64578027",
"0.6432771",
"0.6408788",
"0.6397627",
"0.6389141",
"0.6388921",
"0.63592476",
"0.63592476",
"0.6252944",
"0.624380... | 0.6822979 | 4 |
PUT for a message on a channel | def update
# channel_sid = params[:channel_sid]
# message_sid = params[:id]
# @client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])
# # Update the message
# service = @client.chat.v2.services(ENV['service_sid'])
# channel = service.channels(channel_sid).fetch
# message = channel.messa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(message)\n message.recipient ||= self.tube_name\n raise \"message invalid: #{message.errors}\" unless message.valid?\n @tube.put message.to_json\n end",
"def update_channel(token, channel_id, name, topic, position = 0)\n request(\n __method__,\n :patch,\n \"#{api_base}... | [
"0.6946106",
"0.6944656",
"0.69036216",
"0.69036216",
"0.68871546",
"0.68871546",
"0.6773051",
"0.67661643",
"0.67109877",
"0.66462797",
"0.6625558",
"0.6618158",
"0.6537571",
"0.6512447",
"0.65027916",
"0.64921206",
"0.64287835",
"0.63944733",
"0.6384496",
"0.63714856",
"0.6... | 0.70001173 | 0 |
DELETE for a particular message on a channel | def destroy
channel_sid = params[:channel_sid]
message_sid = params[:id]
puts message_sid
@client = Twilio::REST::Client.new(ENV['account_sid'], ENV['auth_token'])
# Remove the member
service = @client.chat.v2.services(ENV['service_sid'])
channel = service.channels(channel_sid)
response = channel.messag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_message(message)\n API::Channel.delete_message(@bot.token, @id, message.resolve_id)\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n # delete a specific message\n end",
"def delete_msg()\n MsgUtil.delete_msg(params[:ch])\n end",
"def destr... | [
"0.8064188",
"0.7844669",
"0.76969266",
"0.76574665",
"0.7643629",
"0.76423514",
"0.7600592",
"0.7424202",
"0.7397454",
"0.7358405",
"0.7358405",
"0.7342368",
"0.7342257",
"0.7317985",
"0.73023295",
"0.7297658",
"0.7192619",
"0.7159431",
"0.71589255",
"0.71538657",
"0.7145479... | 0.76405597 | 6 |
TODO: Remove when Wraith patched Paths containing "path" in them break Wraith: | def path_would_break_wraith?(path)
path.include?('path')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def by_path(path); end",
"def path_without_name_and_ref(path); end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def paths; end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def path=(_); end",
"def... | [
"0.7065633",
"0.683689",
"0.6775847",
"0.6775847",
"0.6775847",
"0.6775847",
"0.6775847",
"0.6588977",
"0.6588977",
"0.6588977",
"0.6588977",
"0.6588977",
"0.6588977",
"0.6469716",
"0.6469716",
"0.6469716",
"0.64542437",
"0.63729465",
"0.6370049",
"0.6295972",
"0.6295972",
... | 0.63559365 | 19 |
2.2 Define New Method | def hello(name) #
"Hello, #{name}!" #
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"d... | [
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.80376136",
"0.78929746",
"0.7850222",
"0.7850222",
"0.7850222",
"0.7850222",
"0.7850222",
"0.77915114",
"0.7742244",
"0.77327156",
"0.76478755",
"0.74367374",
"0... | 0.0 | -1 |
The +String+ representation of campany | def to_s
self.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n full\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"... | [
"0.72978276",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72558916",
"0.72553045"... | 0.0 | -1 |
Returns a plaintext version of the markup contained by the document | def text
xpath("/html/body").inner_text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_plain_text\n html_src = ''\n begin\n html_src = @doc.at(\"body\").inner_html\n rescue; end\n\n html_src = @doc.to_html unless html_src and not html_src.empty?\n convert_to_text(html_src, @options[:line_length], @html_encoding)\n end",
"def html_markup_text(... | [
"0.7184621",
"0.6948818",
"0.6908176",
"0.6819864",
"0.6667514",
"0.6656082",
"0.6656082",
"0.66229236",
"0.6618958",
"0.6589591",
"0.6565336",
"0.65152735",
"0.6503421",
"0.649548",
"0.6487198",
"0.64802325",
"0.6478412",
"0.64748716",
"0.6455954",
"0.64175093",
"0.63673854"... | 0.57690036 | 85 |
the time complexity to search all edges will be, at worst case, O(v^2), assuming all vertices v are interconnected. This is because for each node visited, the entire associated row on the adjacency matrix has to be checked to confirm which edges are actual graph edges. Space Complexity: O(v) A couple arrays are create,... | def dijkstra(adjacency_matrix, start_node)
shortest_distances = Array.new(adjacency_matrix[0].length){Float::INFINITY}
parent_list = Array.new(shortest_distances.length){nil}
tracking_q = Queue.new
visited_nodes = Set.new
# start with start node
# start node has no previous node, marked as 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dfs\n visited = Hash.new(false)\n @v.each do |vertex| \n visited.merge(explore(vertex)) if !visited[vertex]\n end\n return visited\n end",
"def hash\n @node.sort.push(@edge).hash\n end",
"def findShortest(graph_nodes, graph_from, graph_to, ids, val)\n return -1 if ids.count(val)<=1... | [
"0.65657043",
"0.64722085",
"0.6290222",
"0.6273307",
"0.61397254",
"0.6122722",
"0.6059631",
"0.6001255",
"0.5962588",
"0.5947328",
"0.5942394",
"0.591465",
"0.5868019",
"0.58675504",
"0.5855855",
"0.58475274",
"0.5839288",
"0.5805984",
"0.5754373",
"0.57375926",
"0.5719804"... | 0.6298804 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_checkin
@checkin = Checkin.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def checkin_params
params.require(:checkin).permit(:slug, :username)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Public: Friendly version of the object. Examples | def to_s
"#{user}@#{host}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"... | [
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6571764",
"0.6238401",
"0.6157308",
"0.6157308",
"0.6157308",
"0.6157308",
"0.6157308",
"... | 0.0 | -1 |
Public: Close net/ssh connection. Examples | def close
connection.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_ssh\n puts \"Close connection\"\n @ssh.close unless @ssh.closed?\n end",
"def close\n @net_ssh.close\n @net_ssh = nil\n end",
"def close\n log 'closing connection'\n @ssh.close\n end",
"def close\n ssh.close if @_ssh\n end",
"def disconnect!\n @lo... | [
"0.8307158",
"0.81631994",
"0.8037048",
"0.7860843",
"0.7731862",
"0.7627006",
"0.76044524",
"0.7561339",
"0.7307816",
"0.7261524",
"0.72408575",
"0.71746355",
"0.7106204",
"0.7106204",
"0.70156515",
"0.67339677",
"0.6598663",
"0.6481655",
"0.64589304",
"0.6445016",
"0.643758... | 0.58278346 | 73 |
parse command, expects a string or array parse(['cd to/path', 'touch file']) => 'cd to/path && touch file' | def parse(command)
case command.class.name.downcase.to_sym #Array => :array
when :array
command.compact.join(' && ')
when :string
command.chomp
else
raise Trooper::MalformedCommandError, "Command Not a String or Array: #{command.inspect}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_parse(argv)\n end",
"def parse_cmd commands\n\t\t@commands = commands.split(//)\n\tend",
"def process_command(cmds)\n return \"\" if cmds.length == 0\n \n s = case cmds[0]\n when \"cat\" then run_cat(cmds)\n when \"cd\" then run_cd(cmds)\n when \"help\" then run_help... | [
"0.66149104",
"0.6401119",
"0.63406855",
"0.6239444",
"0.6168591",
"0.6142902",
"0.61056024",
"0.6032001",
"0.6008459",
"0.5990688",
"0.5908375",
"0.5840467",
"0.571661",
"0.5704717",
"0.5681029",
"0.56519324",
"0.55707806",
"0.5553119",
"0.5515522",
"0.5471196",
"0.5462859",... | 0.61340255 | 6 |
Return next token: [type, value]. | def advance
if @token_queue.any?
return @token_queue.shift
end
# Ugly, but dependent on Ragel output. Consider refactoring it somehow.
klass = self.class
_lex_trans_keys = klass.send :_lex_trans_keys
_lex_key_spans = klass.send :_lex_key_spans
_lex_index_offsets ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_token\n tokens.shift\n end",
"def next_token\n @tokens.shift\n end",
"def next_token; end",
"def next_token\n\t\t@tokens.next_token\n\tend",
"def next_token\n\t\tif ((tok = @tokensList.shift) != nil)\n\t\t\t@tokensAux << tok\n\t\t\treturn tok.idAndValue\n\t\telse\n\t\t\treturn nil\n\t\tend... | [
"0.7944097",
"0.7870718",
"0.7856996",
"0.7785234",
"0.76547515",
"0.7530356",
"0.74522233",
"0.74040484",
"0.73721534",
"0.7370245",
"0.7338048",
"0.73137796",
"0.7215096",
"0.71415097",
"0.7130478",
"0.710096",
"0.7085733",
"0.7061432",
"0.7041144",
"0.7017102",
"0.7015713"... | 0.0 | -1 |
=== LITERAL STACK === | def push_literal(*args)
new_literal = Literal.new(self, *args)
@literal_stack.push(new_literal)
next_state_for_literal(new_literal)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack; end",
"def stack; end",
"def stack(*args); end",
"def stack(new_scope = T.unsafe(nil)); end",
"def to_stack; end",
"def __stack\n @stack ||= []\n end",
"def sup_stack_list\n a = Array.[](\"rk\", \"rg\", \"rng\", \"rj\", \"rny\", \"rt\", \"rd\", \"rn\", \"rb\", \"rts\", \"rdz\"... | [
"0.74042875",
"0.74042875",
"0.70769715",
"0.6957554",
"0.6957461",
"0.67361563",
"0.6550813",
"0.6486157",
"0.64685434",
"0.6405866",
"0.63730806",
"0.63730806",
"0.6346312",
"0.63212234",
"0.63212234",
"0.63212234",
"0.628324",
"0.628324",
"0.628324",
"0.62535834",
"0.62338... | 0.0 | -1 |
Takes one aurgument as the index No input validations | def fibonacci_sequence index
if index == 0 || index == 1
return index
else
return fibonacci_sequence(index - 2) + fibonacci_sequence(index - 1)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def construct_index\n end",
"def index=(_arg0); end",
"def index\r\n build_index unless @index\r\n @index\r\n end",
"def add_index_field(*) super end",
"def require_index(name); end",
"def require_index(name); end",
"def [](index_or_name)\n end",
"def [](index_or_name)\n end",
"def inde... | [
"0.693124",
"0.673095",
"0.6629085",
"0.6503975",
"0.6500802",
"0.6500802",
"0.64888257",
"0.64888257",
"0.641386",
"0.63289636",
"0.6325154",
"0.6258596",
"0.62253356",
"0.6196851",
"0.6130844",
"0.6093591",
"0.6081661",
"0.6078784",
"0.6055974",
"0.6053",
"0.6041343",
"0.... | 0.0 | -1 |
Enqueue or run the callback as a job. | def cb_schedule(async: true, **opt)
async = false # TODO: remove when implementing async jobs
opt[:callback] = callback if callback.present?
async ? cb_perform_later(**opt) : cb_perform_now(**opt)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n run_callbacks :call do\n enqueue\n end\n end",
"def perform_callback(callback, **opt)\n job_warn { 'ignoring blank callback' } unless callback\n callback&.cb_schedule(**opt)\n end",
"def callback\n headers.clear\n if callbacks and not callbacks.empty?\n qu... | [
"0.74806356",
"0.7090121",
"0.7063796",
"0.6767465",
"0.66582894",
"0.6493735",
"0.6456236",
"0.6399371",
"0.6394418",
"0.6368598",
"0.63505197",
"0.6321099",
"0.62520987",
"0.61729836",
"0.61720896",
"0.6121226",
"0.6097225",
"0.6080017",
"0.6079146",
"0.60763645",
"0.607244... | 0.62726814 | 12 |
Run the callback as a synchronous job. | def cb_perform_now(**opt)
__debug { "#{__method__} | opt = #{opt.inspect}" } # TODO: remove
receiver.job_class.perform_now(receiver, meth, **opt)
true # TODO: return from #perform ???
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call\n run_callbacks :call do\n enqueue\n end\n end",
"def do_work(val)\n callback do\n puts \"did work #{val}\"\n end\n end",
"def execute(callback)\n unlock(:server)\n\n runtime_lock.execute(callback) do\n yield\n end\n end",
"def perfo... | [
"0.6583832",
"0.6439585",
"0.64185965",
"0.63929236",
"0.6339086",
"0.6311717",
"0.6277407",
"0.6254841",
"0.6181989",
"0.6178676",
"0.6169645",
"0.6155016",
"0.6116782",
"0.6078971",
"0.6074349",
"0.60108596",
"0.6010823",
"0.5971754",
"0.5965128",
"0.59534186",
"0.59342676"... | 0.5400493 | 61 |
Queue a job to run the callback asynchronously. | def cb_perform_later(**opt)
__debug { "#{__method__} | opt = #{opt.inspect}" } # TODO: remove
receiver.job_class.perform_later(receiver, meth, **opt).present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit(job)\n if @queue.length >= QUEUE_SIZE\n job[:callback].call(:error, 'System busy; ask again later.')\n return\n end\n\n @queue.push(job)\n end",
"def queue_job; end",
"def callback\n headers.clear\n if callbacks and not callbacks.empty?\n queue_name = callbacks.s... | [
"0.7122082",
"0.686105",
"0.67890656",
"0.661847",
"0.63763535",
"0.63728946",
"0.6309834",
"0.6296329",
"0.6268908",
"0.6262825",
"0.62506324",
"0.6248374",
"0.6172391",
"0.61540574",
"0.6098216",
"0.60608923",
"0.6057189",
"0.6032904",
"0.60191995",
"0.6000577",
"0.59980017... | 0.5849754 | 26 |
tmux's idea of 'vertical' and 'horizontal' are backward from vim's >.< | def tmux_split(along:, percent: 50)
flag =
case along.to_sym
when :| ; "-h"
when :- ; "-v"
end
cmd = %q( split-window %s -p %d ) % [ flag, percent ]
tmux_run cmd
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertical_bar\n unicode? ? \"\\u2503\" : '|'\n end",
"def flip_vertical\n @text_lines.reverse!\n @sltn_lines.reverse!\n end",
"def vertical\n column.include?(\"XXXX\") || column.include?(\"OOOO\") #true or false for 4 in a row x's or o's\n end",
"def horizontal\n return... | [
"0.6356098",
"0.61076957",
"0.59018975",
"0.57928",
"0.57638764",
"0.5751045",
"0.5705979",
"0.56888175",
"0.56787807",
"0.56662095",
"0.5638785",
"0.55686134",
"0.5542452",
"0.55143297",
"0.5512016",
"0.5490111",
"0.5481219",
"0.54050374",
"0.5404858",
"0.53591555",
"0.53414... | 0.0 | -1 |
[GET] Get all deal fields | def all_deal_fields(**args)
params = parameters(args) do
optional_params :start, :limit
end
request(:get, 'dealFields', params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end",
"def get_field_list\n return make_request(\"#{self.endpoint}/list/fields\")\n end",
"def fetch_fields\n @fields\n end",
"def show_fields(**params)\n get('fields', params)\n... | [
"0.7648133",
"0.7196636",
"0.7022869",
"0.6787738",
"0.678556",
"0.67246354",
"0.6710975",
"0.6551438",
"0.65250736",
"0.65082705",
"0.6499205",
"0.6468816",
"0.6467101",
"0.6461738",
"0.6444459",
"0.6433878",
"0.6429324",
"0.6424584",
"0.63950366",
"0.639352",
"0.63902247",
... | 0.80394125 | 0 |
[GET] Get one deal field | def deal_field(id:, **args)
params = parameters(args) do
optional_params
end
request(:get, "dealFields/#{id}", params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_deal\n @deal = Deal.find(params[:deal_id])\n end",
"def get_field(key,field)\n request :get, \"#{path_prefix}records/#{ue key}?field=#{ue field}\", :accept_404=>true, :force_encoding => \"ASCII-8BIT\", :raw_response => true\n end",
"def show_deal(id)\n get(\"deals/#{id}\")\n end... | [
"0.70055515",
"0.66270334",
"0.6513795",
"0.6080557",
"0.60783273",
"0.59439427",
"0.5933725",
"0.5925396",
"0.59127",
"0.5891762",
"0.5891762",
"0.5891762",
"0.58662343",
"0.58643174",
"0.5817658",
"0.5766744",
"0.57512414",
"0.5716511",
"0.5715943",
"0.571515",
"0.567884",
... | 0.7008962 | 0 |
[POST] Add a new deal field | def create_deal_field(**args)
params = parameters(args) do
required_params :name, :field_type
optional_params :name, :field_type, :options
end
request(:post, 'dealFields', params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_field(params = {})\n post(\"/fields\", params)\n end",
"def add_field(field)\n\t\tend",
"def create\n @company_dei_field = CompanyDeiField.new(company_dei_field_params)\n\n respond_to do |format|\n if @company_dei_field.save\n format.html { redirect_to @company_dei_field, ... | [
"0.65939313",
"0.63600934",
"0.6161486",
"0.614536",
"0.6081678",
"0.6076873",
"0.60689664",
"0.605963",
"0.6045875",
"0.60102373",
"0.5974278",
"0.59588647",
"0.5955035",
"0.59418845",
"0.59410113",
"0.5936404",
"0.5921606",
"0.591981",
"0.59149426",
"0.58971184",
"0.5882575... | 0.74960023 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.