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 |
|---|---|---|---|---|---|---|
helper function for comparing expected and actual results from PG | def compare_db_results(e, sequel_result, debug = false)
results = sequel_result.all
if (debug)
puts("Expected:")
puts(e.length)
p(e)
puts("Actual:")
puts(results.length)
p(results)
end
expect(results.length).to eq(e.length)
(0...e.length).each do |i|
a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_result(test, result)\n if @per_test_insert\n expected = translate_column_names(test['expected'])\n else\n expected = test['expected']\n end\n expected.each do |key, value|\n if value == 'ignore'\n next\n end\n\n if !compare_values(value, result[key])\n ... | [
"0.6573694",
"0.6414299",
"0.6414299",
"0.63763076",
"0.62354004",
"0.62318707",
"0.61211604",
"0.6109978",
"0.6048446",
"0.5977581",
"0.59645647",
"0.59595454",
"0.59418577",
"0.5860062",
"0.58597517",
"0.58374834",
"0.58336806",
"0.5825132",
"0.58116394",
"0.57940125",
"0.5... | 0.62813056 | 4 |
Helper to initialize database connection and create table | def init_conn_table(table_name)
# Create destination table
sql = <<SQL
drop table if exists #{table_name};
create table #{table_name} (
day timestamp,
id int,
value int,
dw_created timestamp,
dw_updated timestamp
);
SQL
conn.run(sql)
return conn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize config\n connect config\n create_table_if_not_exists!\n end",
"def init_database\n\t\tif(!@DB.table_exists?(:events))\n\t\t\t@DB.create_table :events do\n\t\t\t\tprimary_key :id\n\t\t\t\tString :name\n\t\t\t\tString :description\n\t\t\t\tString :date\n\t\t\tend\n\t\tend\n\n\t\tif(!@DB... | [
"0.7799938",
"0.77681005",
"0.7494587",
"0.7380015",
"0.7375607",
"0.73120916",
"0.7167481",
"0.7121444",
"0.7031116",
"0.70247144",
"0.6988752",
"0.6958354",
"0.6957707",
"0.69486684",
"0.6940495",
"0.69292206",
"0.6918952",
"0.6902981",
"0.6884017",
"0.68803304",
"0.6878156... | 0.750001 | 2 |
returns that many members of the fibonacci sequence. Use iteration for this solution. | def fibs(n)
return n if n <= 1
fibs(n - 1) + fibs(n - 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci(how_many_numbers)\n fibonacci_sequence = []\n count = 0\n while count < how_many_numbers\n if count == 0\n fibonacci_sequence << 0\n count += 1\n elsif count == 1\n fibonacci_sequence << 1\n count += 1\n else\n fibonacci_sequence << fibonacci_sequence[-1] + fibona... | [
"0.7796675",
"0.7742691",
"0.77038544",
"0.7628859",
"0.75892806",
"0.7560036",
"0.7548928",
"0.75433344",
"0.75307757",
"0.7525715",
"0.7516844",
"0.7497686",
"0.7492167",
"0.74832314",
"0.7475806",
"0.7462867",
"0.7460665",
"0.7457687",
"0.7457687",
"0.7457687",
"0.7457687"... | 0.0 | -1 |
Now write another method fibs_rec which solves the same problem recursively. This can be done in just 3 lines (or 1 if you're crazy, but don't consider either of these lengths a requirement... just get it done.) | def fibs_rec(n)
n <= 1 ? n : fibs_rec(n - 1) + fibs_rec(n - 2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibs_rec(num, fib = [0,1])\n if num == 1\n 0\n elsif num == fib.length\n fib\n else\n result = fib[fib.length - 2] + fib[fib.length - 1]\n fib.push(result)\n fibs_rec(num, fib)\n end\nend",
"def fibs_rec(n, result = [0, 1])\n\tif n > 1\n\t\tresult << result[-2] + result[-1]\n\t\tfibs_rec(n... | [
"0.8328329",
"0.819133",
"0.8170088",
"0.81561714",
"0.8052181",
"0.8049899",
"0.8036583",
"0.8005314",
"0.79706144",
"0.79233366",
"0.7918479",
"0.7886011",
"0.7873229",
"0.7857108",
"0.78426147",
"0.77860034",
"0.77229196",
"0.77218443",
"0.7714668",
"0.76915365",
"0.768952... | 0.7943038 | 9 |
This is for 'finish' button when user want to terminate the reservation | def update
@reservation = current_user.current_reservation
@reservation.update(end_time: DateTime.now)
current_user.current_reservation = nil
@spot = @reservation.spot
@spot.current_reservation = nil
if @spot.end_time && @spot.end_time > DateTime.now
@spot.availability = true
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finalize\n @reservation = @current_user.person.equipment_reservations.find(params[:id])\n # if @reservation.submitted?\n # flash[:error] = \"This reservation is already submitted, so you cannot change the details of it.\"\n # return redirect_to :action => \"staff\"\n # end\n \n @reserv... | [
"0.6620213",
"0.63096935",
"0.6171886",
"0.61653626",
"0.6080374",
"0.60722536",
"0.60352683",
"0.6005448",
"0.5965653",
"0.59597516",
"0.59557205",
"0.59420687",
"0.59138155",
"0.59068525",
"0.58948547",
"0.58647066",
"0.5842841",
"0.58279455",
"0.5824159",
"0.57448643",
"0.... | 0.0 | -1 |
Start the observer with the given callback. | def initialize(button_pins, callback)
@button_pins = button_pins
@callback = callback
@thread = Thread.new do
begin
run
rescue => e
puts "Thread died: #{e}"
puts e.backtrace
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_callback\n lambda {\n self.start\n }\n end",
"def fire\n @callback.call\n end",
"def on_start=(callback)\n weak = WeakRef.new(self)\n\n Dispatch::Queue.main.async do\n if weak\n callback.call unless weak.isCancelled\n end\n end\n en... | [
"0.7344309",
"0.6470073",
"0.645712",
"0.6426398",
"0.6303319",
"0.6170976",
"0.6151529",
"0.60846835",
"0.6019945",
"0.60142195",
"0.6013147",
"0.59864557",
"0.58804506",
"0.58422714",
"0.58043593",
"0.5722089",
"0.56912357",
"0.56724626",
"0.5654737",
"0.56491125",
"0.56284... | 0.0 | -1 |
optional hash or Traject::Indexer::Settings object of settings. | def initialize(arg_settings = {})
@settings = Settings.new(arg_settings)
@index_steps = []
@after_processing_steps = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings\n @settings ||= settings_class&.new(self)\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def settings\n @settings ||=... | [
"0.7350843",
"0.7303714",
"0.7269185",
"0.72641355",
"0.72641355",
"0.72530293",
"0.72530293",
"0.70887345",
"0.7007493",
"0.6995799",
"0.6995799",
"0.6953434",
"0.69514364",
"0.6838883",
"0.6813263",
"0.6805815",
"0.6754336",
"0.6692567",
"0.6688758",
"0.6682291",
"0.6622974... | 0.0 | -1 |
Part of DSL, used to define an indexing mapping. Register logic to be called for each record, and generate values for a particular output field. | def to_field(field_name, aLambda = nil, &block)
@index_steps << ToFieldStep.new(field_name, aLambda, block, Traject::Util.extract_caller_location(caller.first) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map\n fn = \"function() { \"\n fn << \"this.#{@field_name.to_s}.forEach(function(value) { \"\n fn << \"emit(value, 1); \"\n fn << \"}); \"\n fn << \"}\"\n end",
"def map\n fn = \"function() { \"\n fn << \"emit (this.#{@map_key}... | [
"0.64089024",
"0.58863586",
"0.567102",
"0.56481665",
"0.5529278",
"0.5529278",
"0.54600453",
"0.5367223",
"0.5235283",
"0.52237326",
"0.5222113",
"0.5199648",
"0.5176701",
"0.50926495",
"0.50926495",
"0.50844663",
"0.503973",
"0.503418",
"0.50229484",
"0.4994064",
"0.4986715... | 0.5145615 | 14 |
Part of DSL, register logic to be called for each record | def each_record(aLambda = nil, &block)
@index_steps << EachRecordStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process *args, &block\n raise \"override the process method in your implementation: it should process each record.\"\n end",
"def run(&block)\n case @sproc_type\n when :select, :all\n all(&block)\n when :first\n first\n when :insert\n insert\... | [
"0.61461794",
"0.58852786",
"0.57171947",
"0.56771815",
"0.56771815",
"0.56771815",
"0.5663324",
"0.56552714",
"0.5621044",
"0.56096345",
"0.5495354",
"0.549137",
"0.548174",
"0.54655904",
"0.54472065",
"0.5434642",
"0.53956556",
"0.53922284",
"0.5371275",
"0.53628904",
"0.53... | 0.5244267 | 30 |
Part of DSL, register logic to be called once at the end of processing a stream of records. | def after_processing(aLambda = nil, &block)
@after_processing_steps << AfterProcessingStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_stream\n end",
"def process(record, &emit)\n yield record\n end",
"def record_all\n proc do |on|\n record_block\n record_callback(on, *on.callbacks)\n end\n end",
"def after_processing\n end",
"def postprocess(readers, writers); end",
"def pr... | [
"0.63008225",
"0.6086243",
"0.5871616",
"0.5755261",
"0.5739872",
"0.5724893",
"0.5675148",
"0.56736326",
"0.56093776",
"0.5582437",
"0.5510382",
"0.54925686",
"0.5461659",
"0.5454138",
"0.5434203",
"0.5406993",
"0.5393824",
"0.53935826",
"0.5381434",
"0.5379415",
"0.53276336... | 0.0 | -1 |
Create logger according to settings | def create_logger
logger_level = settings["log.level"] || "info"
# log everything to STDERR or specified logfile
logger = Yell::Logger.new(:null)
logger.format = logger_format
logger.level = logger_level
logger_destination = settings["log.file"] || "STDERR"
# We intentionally repeat the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_logger(settings)\n settings[:VERSION] = `rake runerb:get_version`.chomp.gsub!('\"', '')\n FileUtils.mkdir_p(\"#{FileUtils.pwd}/assets/log\")\n settings[:LOG_FILE_PATH] = \"#{FileUtils.pwd}/assets/log/rune_rb-#{Time.now.strftime('%Y-%m-%d').chomp}.log\".freeze\n settings[:LOG_FILE] = Logger.new... | [
"0.72647625",
"0.7085629",
"0.70308495",
"0.7005693",
"0.69883096",
"0.69707096",
"0.6937268",
"0.6928796",
"0.68672216",
"0.68672216",
"0.6852717",
"0.68337595",
"0.6813493",
"0.68041384",
"0.676406",
"0.676406",
"0.676406",
"0.6722384",
"0.6696182",
"0.6669812",
"0.66558236... | 0.76381004 | 1 |
Processes a single record according to indexing rules set up in this indexer. Returns the output hash (a hash whose keys are string fields, and values are arrays of one or more values in that field) This is a convenience shortcut for map_to_context! use that one if you want to provide addtional context like position, a... | def map_record(record)
context = Context.new(:source_record => record, :settings => settings)
map_to_context!(context)
return context.output_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_to_context!(context)\n @index_steps.each do |index_step|\n # Don't bother if we're skipping this record\n break if context.skip?\n\n context.index_step = index_step\n accumulator = log_mapping_errors(context, index_step) do\n index_step.execute(context) # will always return []... | [
"0.6218562",
"0.6218562",
"0.5916252",
"0.5447128",
"0.53862727",
"0.5248293",
"0.5229041",
"0.51859045",
"0.5135533",
"0.5085319",
"0.5072168",
"0.50700504",
"0.5040612",
"0.49047402",
"0.48868957",
"0.48581654",
"0.48421338",
"0.48326722",
"0.4829031",
"0.48275065",
"0.4797... | 0.68535346 | 1 |
Maps a single record INTO the second argument, a Traject::Indexer::Context. Context must be passed with a source_record and settings, and optionally a position. Context will be mutated by this method, most significantly by adding an output_hash, a hash from fieldname to array of values in that field. Pass in a context ... | def map_to_context!(context)
@index_steps.each do |index_step|
# Don't bother if we're skipping this record
break if context.skip?
context.index_step = index_step
accumulator = log_mapping_errors(context, index_step) do
index_step.execute(context) # will always return [] for an each... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_record(record)\n context = Context.new(:source_record => record, :settings => settings)\n map_to_context!(context)\n return context.output_hash\n end",
"def map_record(record)\n context = Context.new(:source_record => record, :settings => settings)\n map_to_context!(context)\n return c... | [
"0.67632484",
"0.67632484",
"0.5285639",
"0.507032",
"0.48805055",
"0.47837982",
"0.47326806",
"0.47262493",
"0.47163123",
"0.46794453",
"0.4629945",
"0.45002034",
"0.43924063",
"0.43656623",
"0.4348574",
"0.4348574",
"0.4338866",
"0.43061334",
"0.42832175",
"0.42816854",
"0.... | 0.7239814 | 1 |
just a wrapper that captures and records any unexpected errors raised in mapping, along with contextual information on record and location in source file of mapping rule. Reraises error at the moment. log_mapping_errors(context, index_step) do all_sorts_of_stuff that will have errors logged end | def log_mapping_errors(context, index_step)
begin
yield
rescue Exception => e
msg = "Unexpected error on record id `#{context.source_record_id}` at file position #{context.position}\n"
msg += " while executing #{index_step.inspect}\n"
msg += Traject::Util.exception_to_log_message(e)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_mapping_errors(context, index_step)\n begin\n yield\n rescue Exception => e\n msg = \"Unexpected error on record id `#{id_string(context.source_record)}` at file position #{context.position}\\n\"\n msg += \" while executing #{index_step.inspect}\\n\"\n msg += Traject::Util.exc... | [
"0.8729325",
"0.712504",
"0.712504",
"0.5446814",
"0.5382868",
"0.5382868",
"0.5382868",
"0.5246573",
"0.52225184",
"0.52114296",
"0.5203857",
"0.5174501",
"0.51352197",
"0.49789098",
"0.49778923",
"0.49524096",
"0.49517342",
"0.49138662",
"0.49069947",
"0.48941982",
"0.48939... | 0.87283075 | 1 |
Processes a stream of records, reading from the configured Reader, mapping according to configured mapping rules, and then writing to configured Writer. returns 'false' as a signal to command line to return nonzero exit code for some reason (reason found in logs, presumably). This particular mechanism is open to comple... | def process(io_stream)
settings.fill_in_defaults!
count = 0
start_time = batch_start_time = Time.now
logger.debug "beginning Indexer#process with settings: #{settings.inspect}"
reader = self.reader!(io_stream)
writer = self.writer!
processing_threads = settings["processing_thr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postprocess(readers, writers)\n true\n end",
"def postprocess(readers, writers); end",
"def process_records(source, format, marc, test) \n STDOUT.puts \"Processing...\"\n source = resolve_source(source) || source\n # Set encoding based on format or file extension.\n if format == \"oclc\"\n e... | [
"0.58041674",
"0.5350505",
"0.5299674",
"0.52447325",
"0.50710154",
"0.4991733",
"0.49899864",
"0.49896684",
"0.48966113",
"0.48201105",
"0.48140222",
"0.47851476",
"0.476965",
"0.47618902",
"0.4744237",
"0.47100046",
"0.4667263",
"0.46528745",
"0.46506703",
"0.4636478",
"0.4... | 0.46508393 | 18 |
Log that the current record is being skipped, using data in context.position and context.skipmessage | def log_skip(context)
logger.debug "Skipped record #{context.position}: #{context.skipmessage}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_skip(_entity); end",
"def skip(*args)\n log(*args)\n skip_now\n end",
"def skipped(message)\n log << \"[SKIPPED] #{message}\"\n false\n end",
"def skip()\n lines = send_message(\"SKIP\", message)\n end",
"def skip\n @skip = true\n end",
"def... | [
"0.76515055",
"0.70229304",
"0.69466597",
"0.6733945",
"0.662227",
"0.6541632",
"0.6541632",
"0.6513041",
"0.6513041",
"0.6443317",
"0.64112556",
"0.63299316",
"0.63299316",
"0.6326623",
"0.6253472",
"0.6243388",
"0.6243388",
"0.61962706",
"0.6180818",
"0.6134476",
"0.6111985... | 0.9064724 | 1 |
Instantiate a Traject Reader, using class set in reader_class, initialized with io_stream passed in | def reader!(io_stream)
return reader_class.new(io_stream, settings.merge("logger" => logger))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(reader)\n @reader = reader\n end",
"def initialize(input)\n @io = if input.respond_to?(:read)\n input\n else\n ::Kernel.open(input, \"rb\")\n end\n\n unless Archive::Tar::Minitar.seekable?(@io, :rewind)\n raise Archive::Tar::Minitar::NonSeekable... | [
"0.6532753",
"0.6338582",
"0.629143",
"0.6104468",
"0.6084724",
"0.6070433",
"0.6057416",
"0.6002067",
"0.5938708",
"0.593692",
"0.5907763",
"0.58873373",
"0.5852875",
"0.5842583",
"0.56795245",
"0.566474",
"0.5664126",
"0.5651325",
"0.5645832",
"0.5642272",
"0.56420577",
"... | 0.7950214 | 1 |
Instantiate a Traject Writer, suing class set in writer_class | def writer!
return writer_class.new(settings.merge("logger" => logger))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writer_class\n writer_class_name.constantize\n end",
"def create_writer(klass, member); end",
"def writer_instance!(additional_settings = {})\n writer_class.new(writer_settings.merge(additional_settings))\n end",
"def initialize(real_writer)\n @real_writer = real_writer\n end",
"def... | [
"0.74036396",
"0.7206777",
"0.70965046",
"0.6434763",
"0.63411915",
"0.62289965",
"0.6175118",
"0.6074263",
"0.60382795",
"0.6017051",
"0.59047425",
"0.5852368",
"0.57999814",
"0.5741819",
"0.5726267",
"0.5725542",
"0.5636652",
"0.5571724",
"0.55099016",
"0.5504",
"0.54981595... | 0.72484773 | 2 |
Set the fact that this record should be skipped, with an optional message | def skip!(msg = '(no message given)')
@skipmessage = msg
@skip = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip=(reason)\n @skip = reason\n end",
"def markSkipped message = nil\n raise SkippedTest, message\n end",
"def skipped(message)\n log << \"[SKIPPED] #{message}\"\n false\n end",
"def skip()\n lines = send_message(\"SKIP\", message)\n end",
"def skipped!\n ... | [
"0.70330554",
"0.7022437",
"0.6762402",
"0.6569356",
"0.6472955",
"0.6392169",
"0.6354277",
"0.6354277",
"0.62443334",
"0.61968267",
"0.61788774",
"0.6143206",
"0.61359674",
"0.60513735",
"0.59953874",
"0.59653056",
"0.59653056",
"0.59653056",
"0.59653056",
"0.59653056",
"0.5... | 0.74242777 | 1 |
Should we skip this record? | def skip?
@skip
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skip?\n false \n end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skip\n @skip = true\n end",
"def skipped; end",
"def skip!\n @skip ||= true\n end",
"def skipped!; end",
"def skip_during; end",
"def skip_duri... | [
"0.736085",
"0.7216086",
"0.7216086",
"0.7216086",
"0.7216086",
"0.717034",
"0.7086507",
"0.7075451",
"0.7072918",
"0.70246816",
"0.70246816",
"0.7002317",
"0.6991728",
"0.6991728",
"0.697209",
"0.68917555",
"0.68001324",
"0.6776245",
"0.677441",
"0.674987",
"0.67408097",
"... | 0.70964825 | 8 |
Useful for describing a record in a log or especially error message. May be useful to combine with position in output messages, especially since this method may sometimes return empty string if info on record id is not available. Returns MARC 001, then a slash, then output_hash["id"] if both are present. Otherwise may ... | def source_record_id
marc_id = if self.source_record &&
self.source_record.kind_of?(MARC::Record) &&
self.source_record['001']
self.source_record['001'].value
end
output_id = self.output_hash["id"]
return [marc_id, output_id].compact.join("/")
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def record_id(item)\n result = (item.to_s if item.nil?)\n result ||= (item.to_s.strip if item.is_a?(String) || item.is_a?(Symbol))\n result ||= get_value(item, :emma_recordId)\n result ||=\n if (repo = get_value(item, :emma_repository))\n rid = get_value(item, :emma_repositoryRecordId)... | [
"0.6211348",
"0.59867764",
"0.5922545",
"0.57894343",
"0.57486165",
"0.57026273",
"0.5669848",
"0.56672466",
"0.55836725",
"0.5494914",
"0.54746056",
"0.54346436",
"0.5389314",
"0.538039",
"0.53402966",
"0.5291826",
"0.5288617",
"0.5269603",
"0.52684003",
"0.52388024",
"0.521... | 0.62732023 | 0 |
raises if bad data | def validate!
unless self.lambda or self.block
raise ArgumentError.new("Missing Argument: each_record must take a block/lambda as an argument (#{self.inspect})")
end
[self.lambda, self.block].each do |proc|
# allow negative arity, meaning variable/optional, trust em on that.
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_data_format\n unless data.is_a?(Array)\n raise DataFormatError, \"Data set(s) should be given as an array\"\n end\n end",
"def validate_input(data)\r\n @field_names[1..-1].each do |f|\r\n next if data[f].nil?\r\n\r\n raise 'Invalid data %s for column ... | [
"0.68372416",
"0.67586285",
"0.6346781",
"0.62736756",
"0.62681",
"0.62231123",
"0.6184236",
"0.61296123",
"0.6104812",
"0.6104812",
"0.610327",
"0.60456526",
"0.6013586",
"0.6010854",
"0.5991197",
"0.59502566",
"0.59159994",
"0.5909324",
"0.59081674",
"0.59016263",
"0.590094... | 0.0 | -1 |
For each_record, always return an empty array as the accumulator, since it doesn't have those kinds of side effects | def execute(context)
[@lambda, @block].each do |aProc|
next unless aProc
if aProc.arity == 1
aProc.call(context.source_record)
else
aProc.call(context.source_record, context)
end
end
return [] # empty -- no accumulator for each_record
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accumulate record\n end",
"def my_collect(array)\n new_array = []\n # if array.size == 0\n # return 0\n # else\n counter = 0\n while counter < array.length\n new_array << yield(array[counter])\n counter += 1\n end\n \n new_array\nend",
"def each_record\n ... | [
"0.6644168",
"0.60818756",
"0.60174114",
"0.598964",
"0.5949989",
"0.5918654",
"0.5913881",
"0.58363706",
"0.5824105",
"0.58153594",
"0.5764571",
"0.5734521",
"0.5729436",
"0.57249814",
"0.5707868",
"0.56767",
"0.5674749",
"0.5633168",
"0.5599985",
"0.559108",
"0.5541606",
... | 0.5365214 | 43 |
Override inspect for outputting error messages etc. | def inspect
"(each_record at #{source_location})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect; message; end",
"def inspect!\n $stderr.puts(self.inspect)\n end",
"def inspect!\n $stderr.puts(self.inspect)\n end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"d... | [
"0.6977127",
"0.6877321",
"0.6877321",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6856375",
"0.6825646",
"0.6825646",
"0.6822008",
"0.6822008",
"... | 0.0 | -1 |
Override inspect for developer debug messages | def inspect
"(to_field #{self.field_name} at #{self.source_location})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inspect\n redacted_string(:inspect)\n end",
"def inspect\n redacted_string(:inspect)\n end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def inspect() end",
"def i... | [
"0.7685368",
"0.7685368",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.7352383",
"0.72437483",
"0.72437483",
"0.72437483",
"0.72437483",
"0.72437483"... | 0.0 | -1 |
after_processing steps get no args yielded to their blocks, they just are what they are. | def execute
[lambda, block].each do |aProc|
next unless aProc
aProc.call
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_processing\n end",
"def after_processing(aLambda = nil, &block)\n @after_processing_steps << AfterProcessingStep.new(aLambda, block, Traject::Util.extract_caller_location(caller.first))\n end",
"def after_processing(aLambda = nil, &block)\n @after_processing_steps << AfterProcessingStep.new... | [
"0.74970764",
"0.72075295",
"0.72075295",
"0.700263",
"0.6653561",
"0.6625222",
"0.6508962",
"0.6432722",
"0.6328933",
"0.6323418",
"0.63043535",
"0.63043535",
"0.6198786",
"0.61313474",
"0.61048377",
"0.6040502",
"0.60365176",
"0.6031231",
"0.60118353",
"0.6009486",
"0.60074... | 0.0 | -1 |
Declare a controller method as a helper. For example, the following makes the +current_user+ and +logged_in?+ controller methods available to the view: class ApplicationController < ActionController::Base helper_method :current_user, :logged_in? def current_user | def helper_method(*meths)
meths.flatten!
self._helper_methods += meths
meths.each do |meth|
_helpers.class_eval <<-ruby_eval, __FILE__, __LINE__ + 1
def #{meth}(*args, &blk) # def current_user(*args, &blk)
controller.send(%(#{met... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helper(_method)\n ActionController::Base.helpers.method(_method)\n end",
"def helper_method(*methods)\n methods.flatten.each do |method|\n master_helper_module.module_eval <<-end_eval\n def #{method}(*args, &block) # def current_user(*args, &block)\n ... | [
"0.73517233",
"0.71757925",
"0.69414794",
"0.6830623",
"0.6765251",
"0.67111456",
"0.66804403",
"0.66804403",
"0.6529591",
"0.6529591",
"0.64029646",
"0.63581634",
"0.6356335",
"0.6324207",
"0.6286097",
"0.6286097",
"0.6263884",
"0.6262295",
"0.6242461",
"0.6242461",
"0.62424... | 0.7518108 | 0 |
Clears up all existing helpers in this class, only keeping the helper with the same name as this class. | def clear_helpers
inherited_helper_methods = _helper_methods
self._helpers = Module.new
self._helper_methods = Array.new
inherited_helper_methods.each { |meth| helper_method meth }
default_helper_module! unless anonymous?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_helpers; end",
"def delete_all\n @loaded_constants.each do |const_name|\n if Object.const_defined?(const_name)\n Object.send(:remove_const, const_name)\n end\n end\n Ichiban::HTMLCompiler::Context.clear_user_defined_helpers\n end",
"def regenerate_helpers!; en... | [
"0.83842075",
"0.64552313",
"0.63485813",
"0.6162843",
"0.6150138",
"0.60889643",
"0.5976233",
"0.5945249",
"0.5922105",
"0.5846599",
"0.5841766",
"0.5826189",
"0.5804584",
"0.57777303",
"0.5767368",
"0.5700531",
"0.5679006",
"0.5675151",
"0.5665146",
"0.56645024",
"0.5660211... | 0.8517355 | 0 |
Returns a list of modules, normalized from the acceptable kinds of helpers with the following behavior: String or Symbol:: :FooBar or "FooBar" becomes "foo_bar_helper", and "foo_bar_helper.rb" is loaded using require_dependency. Module:: No further processing After loading the appropriate files, the corresponding modul... | def modules_for_helpers(args)
args.flatten.map! do |arg|
case arg
when String, Symbol
file_name = "#{arg.to_s.underscore}_helper"
begin
require_dependency(file_name)
rescue LoadError => e
raise AbstractController::Helpers::Missi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modules_for_helpers(args); end",
"def modules_for_helpers(modules_or_helper_prefixes); end",
"def modules_for_helpers(args)\n args += all_application_helpers if args.delete(:all)\n super(args)\n end",
"def all_application_helpers\n map = []\n helpers_dirs.each do |helpers... | [
"0.7325955",
"0.6930389",
"0.67073184",
"0.6547244",
"0.64392066",
"0.6309612",
"0.6176882",
"0.61695683",
"0.61474067",
"0.60197186",
"0.5951823",
"0.594979",
"0.5919576",
"0.5901131",
"0.587827",
"0.58396626",
"0.57906294",
"0.57667184",
"0.5729324",
"0.5674949",
"0.5649252... | 0.8266362 | 0 |
Makes all the (instance) methods in the helper module available to templates rendered through this controller. ==== Parameters module The module to include into the current helper module for the class | def add_template_helper(mod)
_helpers.module_eval { include mod }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def helper( *modules )\n machine.helper *modules\n end",
"def helpers\n ActionController::Base.helpers # you can also try @template.helpers OR self.class.helpers OR include ActionView::Helpers\n end",
"def helpers\n ApplicationController.helpers\n end",
"def helpers\n ApplicationContr... | [
"0.6860397",
"0.68534636",
"0.67200017",
"0.67200017",
"0.6717953",
"0.66985023",
"0.6676727",
"0.6676727",
"0.6676727",
"0.667007",
"0.6657417",
"0.6649286",
"0.65985584",
"0.65985584",
"0.6595232",
"0.6584226",
"0.657271",
"0.6551387",
"0.6531497",
"0.6475325",
"0.6462327",... | 0.62703526 | 32 |
GET /titulaciones GET /titulaciones.json | def index
@titulaciones = Titulacion.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def show\n @territorio = Territori... | [
"0.67853206",
"0.66951555",
"0.6461879",
"0.6391292",
"0.6391292",
"0.63771373",
"0.6323062",
"0.6293985",
"0.6259345",
"0.6215708",
"0.61942494",
"0.6174936",
"0.61621416",
"0.61518675",
"0.6136736",
"0.6136438",
"0.6128584",
"0.6118624",
"0.60922575",
"0.60895807",
"0.60729... | 0.70618427 | 0 |
GET /titulaciones/1 GET /titulaciones/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @titulaciones = Titulacion.all\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_... | [
"0.6900861",
"0.6772973",
"0.673874",
"0.673874",
"0.66934127",
"0.6675985",
"0.6469128",
"0.6431939",
"0.64156085",
"0.63800895",
"0.6367623",
"0.63501716",
"0.6304004",
"0.62657434",
"0.6251451",
"0.6215498",
"0.62135416",
"0.6207468",
"0.6201112",
"0.61865777",
"0.6182361"... | 0.0 | -1 |
POST /titulaciones POST /titulaciones.json | def create
@titulacion = Titulacion.new(titulacion_params)
respond_to do |format|
if @titulacion.save
format.html { redirect_to @titulacion, notice: 'Titulacion was successfully created.' }
format.json { render action: 'show', status: :created, location: @titulacion }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @titulacao = Titulacao.new(titulacao_params)\n\n respond_to do |format|\n if @titulacao.save\n format.html { redirect_to titulacaos_path, notice: 'Titulo criado com successo.' }\n format.json { render :index, status: :created, location: titulacaos_path }\n else\n f... | [
"0.6809625",
"0.65834534",
"0.6459392",
"0.6382375",
"0.6345635",
"0.62793034",
"0.6276493",
"0.6262516",
"0.6259413",
"0.62280923",
"0.62166536",
"0.6184544",
"0.61795366",
"0.61705124",
"0.61610776",
"0.613942",
"0.61192125",
"0.6097666",
"0.6083767",
"0.60734636",
"0.60663... | 0.65726435 | 2 |
PATCH/PUT /titulaciones/1 PATCH/PUT /titulaciones/1.json | def update
respond_to do |format|
if @titulacion.update(titulacion_params)
format.html { redirect_to @titulacion, notice: 'Titulacion was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @titul... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @titulacao.update(titulacao_params)\n format.html { redirect_to titulacaos_path, notice: 'Titulo atualizado com successo.' }\n format.json { render titulacaos_path, status: :ok, location: titulacaos_path }\n else\n format.html { render :edi... | [
"0.6711077",
"0.6591094",
"0.658786",
"0.6474874",
"0.64645946",
"0.6417776",
"0.639301",
"0.6366236",
"0.6359895",
"0.6356877",
"0.6343164",
"0.63239443",
"0.63200456",
"0.63178045",
"0.62938976",
"0.62907314",
"0.627185",
"0.6259466",
"0.6247213",
"0.62360156",
"0.62306356"... | 0.6635284 | 1 |
DELETE /titulaciones/1 DELETE /titulaciones/1.json | def destroy
@titulacion.destroy
respond_to do |format|
format.html { redirect_to titulaciones_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirec... | [
"0.7271772",
"0.72215825",
"0.72215825",
"0.72215825",
"0.721289",
"0.72005916",
"0.7131126",
"0.712068",
"0.707003",
"0.7067595",
"0.706322",
"0.7032607",
"0.70317006",
"0.70252323",
"0.69950384",
"0.69949687",
"0.6993641",
"0.69873863",
"0.6980205",
"0.6980089",
"0.6976706"... | 0.7404273 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_titulacion
@titulacion = Titulacion.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def titulacion_params
params.require(:titulacion).permit(:descripcion, :sigla)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /veiculos/1 GET /veiculos/1.json | def show
@veiculo = Veiculo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @veiculo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Segu... | [
"0.6936008",
"0.69231653",
"0.68086135",
"0.6782455",
"0.6777369",
"0.67309624",
"0.671171",
"0.6709448",
"0.6694477",
"0.6684926",
"0.66729003",
"0.6647848",
"0.66398925",
"0.66389644",
"0.66378057",
"0.66183436",
"0.6603148",
"0.66009134",
"0.6589715",
"0.6589715",
"0.65730... | 0.7134144 | 0 |
GET /veiculos/new GET /veiculos/new.json | def new
@veiculo = Veiculo.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @veiculo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @peso = Peso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n e... | [
"0.7624485",
"0.7614375",
"0.7614356",
"0.7598046",
"0.75815606",
"0.7571458",
"0.7563813",
"0.75609934",
"0.75559336",
"0.7540302",
"0.75386447",
"0.75381577",
"0.7524643",
"0.7495828",
"0.74907345",
"0.7488687",
"0.7487214",
"0.7478384",
"0.74745303",
"0.7472125",
"0.746530... | 0.77229667 | 0 |
POST /veiculos POST /veiculos.json | def create
@veiculo = Veiculo.new(params[:veiculo])
respond_to do |format|
if @veiculo.save
format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully created.' }
format.json { render :json => @veiculo, :status => :created, :location => @veiculo }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @livro = Livro.new(livro_params)\n\n ... | [
"0.66741854",
"0.6661533",
"0.6519863",
"0.6472379",
"0.6441638",
"0.6441252",
"0.6383521",
"0.6370031",
"0.6354665",
"0.63531446",
"0.6327806",
"0.63184935",
"0.6312415",
"0.63099724",
"0.6288051",
"0.628489",
"0.62794334",
"0.6271405",
"0.626894",
"0.6259644",
"0.62583524",... | 0.669045 | 0 |
PUT /veiculos/1 PUT /veiculos/1.json | def update
@veiculo = Veiculo.find(params[:id])
respond_to do |format|
if @veiculo.update_attributes(params[:veiculo])
format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully... | [
"0.66077566",
"0.65193635",
"0.64007616",
"0.6337991",
"0.6308123",
"0.62969446",
"0.62698",
"0.62689465",
"0.624237",
"0.623351",
"0.62320626",
"0.620354",
"0.61952573",
"0.61925685",
"0.6184307",
"0.6182275",
"0.6178033",
"0.6167103",
"0.616506",
"0.61543274",
"0.6153688",
... | 0.66878384 | 0 |
DELETE /veiculos/1 DELETE /veiculos/1.json | def destroy
@veiculo = Veiculo.find(params[:id])
@veiculo.destroy
respond_to do |format|
format.html { redirect_to veiculos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuest... | [
"0.73583484",
"0.7241913",
"0.7240996",
"0.7220415",
"0.72189504",
"0.7165703",
"0.71645427",
"0.7162205",
"0.7162205",
"0.7162205",
"0.7162096",
"0.7160176",
"0.71561146",
"0.7154359",
"0.7153302",
"0.713854",
"0.7137056",
"0.71326494",
"0.71202195",
"0.7112066",
"0.7108492"... | 0.74547493 | 0 |
This code is here to help nodes communicate about models in each others systems. because ids wouldn't be unique | def tax_profile_sku=(sku)
sym = _get_id_field_from("tax_profile_sku=")
model = TaxProfile.where(:sku => sku).first
if model then
self.update_attribute :tax_profile_id,model.id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_model_sys_id(model)\n query_data = URI::encode(model)\n url = \"#{@service_now_url}/table/cmdb_hardware_product_model?sysparm_query=display_name%3D#{query_data}\"\n sys_id = get_record_sys_id(url)\n sys_id\n end",
"def setup\n @models.each do |model|\n print \"ADDING S... | [
"0.5841533",
"0.5674921",
"0.54656094",
"0.5415571",
"0.5396723",
"0.53938967",
"0.53637826",
"0.53576165",
"0.5343618",
"0.52821916",
"0.52721316",
"0.52320826",
"0.5213818",
"0.5203749",
"0.515785",
"0.51472414",
"0.5146636",
"0.51401556",
"0.51302934",
"0.5123274",
"0.5121... | 0.0 | -1 |
Public: click view website Example | def click_view_website
view_website_link.click
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def click\n p [ :app_click ]\n view.click\n end",
"def click(link); end",
"def click; end",
"def click; end",
"def click; end",
"def click\n @mech.click self\n end",
"def acessar\n visit \"/\"\n click_on \"EXPERIMENTE AGORA\"\n end",
"def click_on_event option\n visits ... | [
"0.72786057",
"0.7026195",
"0.6840865",
"0.6840865",
"0.6840865",
"0.6526373",
"0.6301085",
"0.62889147",
"0.6267065",
"0.6228753",
"0.6169665",
"0.61655",
"0.61451507",
"0.60634786",
"0.60483766",
"0.60006505",
"0.59848386",
"0.59680766",
"0.59558815",
"0.59469634",
"0.59427... | 0.78537315 | 0 |
Open up the team selection for the user (if necessary). If the user is in multiple teams, a team selection is shown. The user can then select a team by entering the number | def select_team(portal_team_id: nil, tunes_team_id: nil, team_name: nil)
return if client.nil?
client.select_team(portal_team_id: portal_team_id, tunes_team_id: tunes_team_id, team_name: team_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_team\n return $prompt.select(\"Select team\", $nbl_league.print_team_names)\nend",
"def select_team(page, url)\n\t form = page.form_with(:name => 'saveTeamSelection')\n\t if form\n\t page = select_team_radiobutton(form, page)\n \t if page.nil?\n \t \tpage = select_team_dropbox... | [
"0.76979107",
"0.7020519",
"0.6560055",
"0.653068",
"0.653068",
"0.653068",
"0.6501419",
"0.6500467",
"0.6485764",
"0.64565915",
"0.6430537",
"0.6379399",
"0.63670677",
"0.630015",
"0.6271432",
"0.62639904",
"0.62286735",
"0.6206548",
"0.6193917",
"0.6190549",
"0.61729634",
... | 0.0 | -1 |
GET /timeslots GET /timeslots.xml | def index
@timeslots = current_event.timeslots.find(:all, :order=>'slot_date, start_time')
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @timeslots }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @timeslot = current_event.timeslots.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @timeslot }\n end\n end",
"def index\n @timeslots = Timeslot.all\n end",
"def index\n @timeslots = Timeslot.all\n end",
"def new... | [
"0.6933306",
"0.67315817",
"0.67315817",
"0.64885694",
"0.6329284",
"0.62587124",
"0.62584126",
"0.6241521",
"0.61410546",
"0.60744894",
"0.5892315",
"0.5884356",
"0.5880026",
"0.5841047",
"0.58395463",
"0.5823377",
"0.5794617",
"0.57839483",
"0.5778582",
"0.57417935",
"0.574... | 0.7425273 | 0 |
GET /timeslots/1 GET /timeslots/1.xml | def show
@timeslot = current_event.timeslots.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @timeslot }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @timeslots = current_event.timeslots.find(:all, :order=>'slot_date, start_time')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @timeslots }\n end\n end",
"def show\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|... | [
"0.7015034",
"0.63970155",
"0.63584554",
"0.6144708",
"0.6144708",
"0.6094768",
"0.6047725",
"0.598931",
"0.59776306",
"0.5913894",
"0.5912961",
"0.58531886",
"0.5825394",
"0.58186805",
"0.5814487",
"0.57953906",
"0.57934964",
"0.5788226",
"0.5762958",
"0.5756701",
"0.5755405... | 0.69365484 | 1 |
GET /timeslots/new GET /timeslots/new.xml | def new
@timeslot = current_event.timeslots.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @timeslot }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @time_slot = TimeSlot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_slot }\n end\n end",
"def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ti... | [
"0.7243136",
"0.69178843",
"0.68725955",
"0.68698275",
"0.6739397",
"0.6705211",
"0.6691499",
"0.6683763",
"0.66770756",
"0.6625056",
"0.6605071",
"0.6559518",
"0.65143883",
"0.6505452",
"0.6494407",
"0.64694476",
"0.6468579",
"0.6465904",
"0.6444275",
"0.6433934",
"0.6416834... | 0.79303396 | 0 |
POST /timeslots POST /timeslots.xml | def create
@timeslot = current_event.timeslots.new(params[:timeslot])
respond_to do |format|
if @timeslot.save
flash[:notice] = 'Timeslot was successfully created.'
format.html { redirect_to(timeslots_url) }
format.xml { render :xml => @timeslot, :status => :created, :locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @timeslot = current_event.timeslots.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @timeslot }\n end\n end",
"def create\n @timeslot = Timeslot.new(timeslot_params)\n @timeslot.save!\n render :json => @timeslot.as_json\n end",
... | [
"0.6273224",
"0.61147845",
"0.58647555",
"0.5822951",
"0.58115023",
"0.5739481",
"0.56277895",
"0.5574992",
"0.5562782",
"0.5541541",
"0.5526379",
"0.5501423",
"0.54985785",
"0.54769474",
"0.54337835",
"0.54137605",
"0.5407134",
"0.5407083",
"0.5401719",
"0.538536",
"0.532544... | 0.6801945 | 0 |
PUT /timeslots/1 PUT /timeslots/1.xml | def update
@timeslot = current_event.timeslots.find(params[:id])
respond_to do |format|
@timeslot.start_time_will_change!
@timeslot.slot_date_will_change!
if @timeslot.update_attributes(params[:timeslot])
flash[:notice] = "Timeslot was successfully updated."
format.html { redir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @time_slot = TimeSlot.find(params[:id])\n\n respond_to do |format|\n if @time_slot.update_attributes(params[:time_slot])\n flash[:notice] = 'TimeSlot was successfully updated.'\n format.html { redirect_to(@time_slot) }\n format.xml { head :ok }\n else\n for... | [
"0.6214063",
"0.5826983",
"0.58257306",
"0.5807214",
"0.5742165",
"0.5704131",
"0.5701674",
"0.5677164",
"0.5647852",
"0.5596503",
"0.5484004",
"0.54742324",
"0.5461948",
"0.5455186",
"0.5431925",
"0.53784865",
"0.53747493",
"0.5364896",
"0.5362189",
"0.5362189",
"0.5362189",... | 0.6313105 | 0 |
DELETE /timeslots/1 DELETE /timeslots/1.xml | def destroy
@timeslot = current_event.timeslots.find(params[:id])
@timeslot.destroy
respond_to do |format|
format.html { redirect_to(timeslots_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @eventtime = Eventtime.find(params[:id])\n @eventtime.destroy\n\n respond_to do |format|\n format.html { redirect_to(eventtimes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to ... | [
"0.65076816",
"0.6482698",
"0.64758",
"0.6397162",
"0.63733315",
"0.6291392",
"0.6289257",
"0.62364644",
"0.6229881",
"0.6208612",
"0.61473674",
"0.6144716",
"0.6122041",
"0.61137956",
"0.61072457",
"0.6099653",
"0.6087404",
"0.6082619",
"0.6073826",
"0.60614365",
"0.60614365... | 0.7063378 | 0 |
eval, executes code in string format binding remembers the context it came from and makes it available to you in different context | def evaluator(str,binding)
a_value = 123
eval(str,binding) #outputs 321
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context_for_eval; end",
"def current_eval(string, ebinding=Mission.eval_binding)\n ebinding = ebinding.call if ebinding.is_a?(Proc)\n eval(string, ebinding)\n end",
"def eval(str)\n end",
"def eval(string, binding=nil, filename=nil, lineno=1)\n if binding\n if binding.kind_o... | [
"0.7071479",
"0.7035791",
"0.6952938",
"0.669381",
"0.6682134",
"0.65282685",
"0.6481775",
"0.64776415",
"0.6449816",
"0.6436448",
"0.64135295",
"0.63914937",
"0.63697845",
"0.63586456",
"0.63583213",
"0.63255113",
"0.6308455",
"0.62932533",
"0.62912625",
"0.6290449",
"0.6253... | 0.69334704 | 3 |
GET /troubletickets GET /troubletickets.json | def index
add_breadcrumb 'Trouble Ticket'
if current_user.admin == true
@troubletickets = Troubleticket.all
@pagy, @troubletickets = pagy(Troubleticket.all.order(:created_at))
else
@troubletickets =
Troubleticket.where('user_id =?', current_user.id).order(
'created_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end",
"def GetTickets p... | [
"0.64653766",
"0.6464067",
"0.6455772",
"0.6359689",
"0.63478744",
"0.63439363",
"0.6331347",
"0.62699074",
"0.62330073",
"0.62287027",
"0.6216062",
"0.6212101",
"0.6202369",
"0.6159709",
"0.61573654",
"0.614479",
"0.6134413",
"0.6122955",
"0.611965",
"0.60961133",
"0.6092573... | 0.6004188 | 26 |
GET /troubletickets/1 GET /troubletickets/1.json | def show
add_breadcrumb 'Trouble Ticket'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_troubleticket\n @troubleticket = Troubleticket.find(params[:id])\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end",
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.htm... | [
"0.67624813",
"0.6416226",
"0.6387477",
"0.6232811",
"0.6227361",
"0.6227361",
"0.6218183",
"0.6182222",
"0.61790216",
"0.61693925",
"0.6114553",
"0.6099059",
"0.60823095",
"0.6066829",
"0.60614574",
"0.6058647",
"0.60566676",
"0.6047878",
"0.6040438",
"0.6034711",
"0.6020637... | 0.0 | -1 |
POST /troubletickets POST /troubletickets.json | def create
add_breadcrumb 'New Trouble Ticket'
@troubleticket = Troubleticket.new(troubleticket_params)
respond_to do |format|
if @troubleticket.save
format.html do
redirect_to @troubleticket,
notice: 'Trouble ticket was successfully created.'
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_troubleticket\n @troubleticket = Troubleticket.find(params[:id])\n end",
"def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end",
"def create\n @timetable = Timetable.new(timetable_params)\n @timetable.save\... | [
"0.6226425",
"0.6126834",
"0.61230993",
"0.6116936",
"0.605668",
"0.60015696",
"0.594939",
"0.5911395",
"0.58806133",
"0.5805732",
"0.5796007",
"0.57943285",
"0.57403594",
"0.57215244",
"0.5697053",
"0.5692029",
"0.56868184",
"0.5675313",
"0.5675193",
"0.56738335",
"0.5670543... | 0.6820488 | 0 |
PATCH/PUT /troubletickets/1 PATCH/PUT /troubletickets/1.json | def update
add_breadcrumb 'Update Trouble Ticket'
respond_to do |format|
if @troubleticket.update(troubleticket_params)
format.html do
redirect_to @troubleticket,
notice: 'Trouble ticket was successfully updated.'
end
format.json { render :show,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n respond_to do |format|\n if @ithelpticket.update(ithelpticket_params)\n format.html { redirect_to @ithelpticket, notice: 'IT Help Ticket was succ... | [
"0.66117996",
"0.63321346",
"0.6260249",
"0.62036276",
"0.6177392",
"0.6173851",
"0.6116711",
"0.6102479",
"0.6088484",
"0.60863477",
"0.60834724",
"0.6041484",
"0.6012044",
"0.59910667",
"0.59876215",
"0.5987127",
"0.59847784",
"0.59847784",
"0.59847784",
"0.59847784",
"0.59... | 0.70131147 | 0 |
DELETE /troubletickets/1 DELETE /troubletickets/1.json | def destroy
@troubleticket.destroy
respond_to do |format|
format.html do
redirect_to troubletickets_url,
notice: 'Trouble ticket was successfully destroyed.'
end
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url ... | [
"0.72501427",
"0.7218138",
"0.71329546",
"0.7123016",
"0.70805",
"0.7077367",
"0.7072105",
"0.7040383",
"0.70133007",
"0.69871354",
"0.6985047",
"0.6979434",
"0.6973017",
"0.6972895",
"0.6961732",
"0.6959355",
"0.69581735",
"0.69544345",
"0.69513917",
"0.69422156",
"0.6938059... | 0.74505883 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_troubleticket
@troubleticket = Troubleticket.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 list of trusted parameters through. | def troubleticket_params
params.require(:troubleticket).permit(
:user_id,
:status,
:campaign,
:subject,
:message
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69480115",
"0.6813417",
"0.68023044",
"0.67950493",
"0.67457634",
"0.6741017",
"0.65274155",
"0.6519536",
"0.6491671",
"0.64317423",
"0.64317423",
"0.64317423",
"0.63975054",
"0.6354703",
"0.63543284",
"0.6346128",
"0.63437325",
"0.63382536",
"0.6327421",
"0.6327421",
"0.6... | 0.0 | -1 |
Save canned article data | def scrape_article
url="http://sbs.feedsportal.com/c/34692/f/637303/index.rss"
open(url) do |rss|
feed = RSS::Parser.parse(rss)
feed.items.each do |item|
temp_article=Article.new
temp_article.author=item.author
temp_article.title=item.title
# input was in form of se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @article = Article.new(params[:article])\n\n f = open(\"info.txt\", \"w\")\n f.write( params )\n f.write( \"\\n\" )\n f.write( params[:article] )\n f.write( \"\\n\" )\n f.write( @article.author_id )\n f.write( \"\\n\" )\n f.write( @article.edit_count )\n error = true\n ... | [
"0.63325804",
"0.6200524",
"0.613487",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6123348",
"0.6055734",
"0.60193574",
"0.60193574",
"0.6017806",
"0.59965307",
"0.5966198",
"0.59602517",
"0.5950575",
"0.59020406",
"0.5880486"... | 0.0 | -1 |
Instantiates the tag list. | def initialize(include_head = true)
@include_head = include_head
@list = build_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(taglist_entry=\"\") \n create(taglist_entry)\n end",
"def initialize\n # Variable miembro que contiene los tags procesados\n @tags = Hash.new(0)\n end",
"def initialize\n @tags = {}\n @public_ids = []\n end",
"def list\n ::MachineTag::Set.new(read_tag_file(@tag_f... | [
"0.7499158",
"0.72090924",
"0.6533504",
"0.64137495",
"0.63881",
"0.627418",
"0.62669045",
"0.62545824",
"0.6251037",
"0.6250996",
"0.62327665",
"0.62217724",
"0.6183233",
"0.6163169",
"0.61550075",
"0.61143565",
"0.61118907",
"0.6091459",
"0.6084485",
"0.6075808",
"0.6072282... | 0.60361034 | 26 |
Returns the most recent tag in the git repository, or the sha1 of the initial commit if there is no tag. | def latest_tag
# Index 0 is HEAD
# Index 1 is most recent tag or first commit
@list[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_stable_tag\n tags = `git tag`.strip.split(\"\\n\").map do |v|\n begin\n Semantic::Version.new(v)\n rescue ArgumentError\n nil\n end\n end.compact.sort.reverse\n (tags.find {|t| !t.pre} || tags.first).to_s\n end",
"def git_tag\n return @git_tag if @git_tag\n ... | [
"0.7733755",
"0.73430496",
"0.7196709",
"0.7126388",
"0.70794874",
"0.70313305",
"0.70214856",
"0.69477636",
"0.69109976",
"0.69091046",
"0.6891366",
"0.68486303",
"0.68436",
"0.6812563",
"0.6803727",
"0.68011206",
"0.6775557",
"0.6756936",
"0.6741475",
"0.67110527",
"0.66869... | 0.7850321 | 0 |
Returns the sha1 of the initial commit. In fact, this function returns all parentless commits of the repository. Usually there should be not more than one such commit. See | def get_initial_commit
`git rev-list --max-parents=0 HEAD`.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_commit_initial\n author = {:email => \"admin@localhost\", :name => \"admin\", :time => Time.now.utc}\n\n Rugged::Commit.create(\n repo,\n :message => \"Initial Commit\",\n :parents => [],\n :tree => index.write_tree(repo),\n :update_ref... | [
"0.6488707",
"0.63598275",
"0.6338401",
"0.62428135",
"0.6238694",
"0.6237438",
"0.620445",
"0.60926723",
"0.60451585",
"0.59997",
"0.5978581",
"0.59782434",
"0.59741443",
"0.59088516",
"0.59048486",
"0.578873",
"0.57828796",
"0.57043433",
"0.5593378",
"0.5571105",
"0.5555537... | 0.77697074 | 0 |
Builds a list of Git tags and encloses it with HEAD and the Sha1 of the initial commit. | def build_list
tags = []
tags << get_initial_commit
tags += `git tag --sort v:refname`.split("\n").map { |s| s.rstrip }
tags << "HEAD" if @include_head
tags.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_tag_list\n `git tag --list 'v*' --format='%(tag) %(taggerdate:short)'`\n end",
"def git_tags\n git(\"log --tags --simplify-by-decoration --pretty='format:%ai %d'\")\n # TODO: fix\n end",
"def get_tags\n @logger.info(\"#{__method__}: Getting tags from git\")\n output = `cd #... | [
"0.6360247",
"0.6242644",
"0.6109931",
"0.59068793",
"0.58215773",
"0.5799606",
"0.5786401",
"0.5674364",
"0.56502277",
"0.5645533",
"0.56057733",
"0.5597117",
"0.5480373",
"0.5441841",
"0.54310274",
"0.5423749",
"0.53997964",
"0.53767604",
"0.532905",
"0.53223765",
"0.530713... | 0.7987375 | 0 |
we use the aggregate subject and more if multiple actions have taken place ie type_count > 1 if more the one user was involved distinct_aggregate_count > 1 then we sub 'was' with 'were' | def get_subject
out = ''
if aggregate_count > 1 #multiple records of any type
if type_count > 1 #multiple types of records
if distinct_aggregate_count > 1 #multiple profiles
others = (distinct_aggregate_count-1)
out << "and #{pluralize(others, 'other')} "
out << subj... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agg_count\n @agg_count ||= count_unique_related @role_aggregate.agg_fieldname\n end",
"def aggregate_after_grouping?; @aggregate_after_grouping; end",
"def supports_count_distinct?\n true\n end",
"def visit_axiom_aggregate_count(count)\n unary_prefix_operation_sql(COUNT, co... | [
"0.6278365",
"0.5778465",
"0.5646634",
"0.55795646",
"0.5556417",
"0.549195",
"0.5440112",
"0.54067373",
"0.53273296",
"0.52527463",
"0.5245796",
"0.52385485",
"0.5235113",
"0.52332354",
"0.52214533",
"0.5212166",
"0.5212114",
"0.51952624",
"0.5190969",
"0.51499",
"0.5129262"... | 0.5666494 | 2 |
if more than one action as occurred by any number of profiles then append the aggregate_texts | def get_more
out = ''
if aggregate_count > 1 #multiple records of any type
if type_count > 1 #multiple types of records
if distinct_aggregate_count > 1
out << more_aggregate.sub('was ','were ')
else
out << more_aggregate
end
else
out << more
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_subject\n out = ''\n if aggregate_count > 1 #multiple records of any type\n if type_count > 1 #multiple types of records\n if distinct_aggregate_count > 1 #multiple profiles\n others = (distinct_aggregate_count-1)\n out << \"and #{pluralize(others, 'other')} \"\n ... | [
"0.5533255",
"0.526533",
"0.5222985",
"0.5117198",
"0.5069091",
"0.502259",
"0.4952371",
"0.4914589",
"0.4896637",
"0.48954165",
"0.48796728",
"0.48792198",
"0.4863678",
"0.48478922",
"0.48369494",
"0.47528917",
"0.4743745",
"0.47433466",
"0.47420368",
"0.472188",
"0.47158512... | 0.53921205 | 1 |
First collect all types with sensuctl provider that come from this module For each sensuctl type, set the class variable 'chunk_size' used by each provider to list resources Return empty array since we are not actually generating resources | def generate
sensuctl_types = []
Dir[File.join(File.dirname(__FILE__), '../provider/sensu_*/sensuctl.rb')].each do |file|
type = File.basename(File.dirname(file))
sensuctl_types << type.to_sym
end
sensuctl_types.each do |type|
provider_class = Puppet::Type.type(type).provider(:sensuctl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resources\n resources = []\n\n default_storage = {\n 'swift_zone' => 100,\n 'object_port'=>6000,\n 'container_port'=>6001,\n 'account_port'=>6002,\n 'mountpoints'=> \"1 1\\n2 1\",\n 'weight'=> 100,\n 'types'=>['container', 'object', 'account'],\n }\n\n self[:stora... | [
"0.6338384",
"0.56983155",
"0.5615717",
"0.55063254",
"0.5486882",
"0.5478105",
"0.54663056",
"0.54451007",
"0.5442798",
"0.54379135",
"0.5387426",
"0.5381267",
"0.53757614",
"0.53752655",
"0.536192",
"0.53246635",
"0.5296073",
"0.5268835",
"0.5256478",
"0.52468836",
"0.52089... | 0.6655962 | 0 |
Works like with_scope, but discards any nested properties. | def with_exclusive_scope(method_scoping = {}, &block)
if method_scoping.values.any? { |e| e.is_a?(ActiveRecord::Relation) }
raise ArgumentError, <<-MSG
New finder API can not be used with_exclusive_scope. You can either call unscoped to get an anonymous scope not bound to the default_scope:
User.unscoped... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nested_set_scope_without_default_scope(options = {})\n add_scope_conditions_to_options(options)\n\n self.class.base_class.unscoped.nested_set_scope options\n end",
"def without(key)\n chain.tap { |new_scope| new_scope.scope.delete(key) }\n end",
"def unscoped\n clone... | [
"0.652055",
"0.63327956",
"0.6053838",
"0.60382515",
"0.5975946",
"0.5776204",
"0.5728168",
"0.5720601",
"0.56211793",
"0.5568774",
"0.5535945",
"0.5494859",
"0.54154867",
"0.53101987",
"0.528099",
"0.52225417",
"0.5208605",
"0.51505923",
"0.51399046",
"0.51318014",
"0.512488... | 0.5277453 | 15 |
GET /encounters_types GET /encounters_types.json | def index
@active = User.find(session[:user_id]).try :touch
@encounters_types = EncountersType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @incident_types = IncidentType.all\n end",
"def set_encounters_type\n @encounters_type = EncountersType.find(params[:id])\n end",
"def index\n @counter_service_types = CounterServiceType.all\n end",
"def index\... | [
"0.6871301",
"0.6598723",
"0.6502692",
"0.64340556",
"0.6410699",
"0.6295207",
"0.6265392",
"0.62236446",
"0.62141883",
"0.6206328",
"0.61588156",
"0.61532474",
"0.6146791",
"0.6121371",
"0.6117",
"0.61127555",
"0.60804486",
"0.6078361",
"0.60733217",
"0.6072533",
"0.60438675... | 0.0 | -1 |
GET /encounters_types/1 GET /encounters_types/1.json | def show
@active = User.find(session[:user_id]).try :touch
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_encounters_type\n @encounters_type = EncountersType.find(params[:id])\n end",
"def index\n @incident_types = IncidentType.all\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n @counter_service_types = CounterServiceType.all\n end",
"def index\... | [
"0.67524433",
"0.6548111",
"0.64162093",
"0.6374464",
"0.6318842",
"0.62872905",
"0.62263197",
"0.6178902",
"0.6149039",
"0.61218536",
"0.6117198",
"0.6105387",
"0.6077923",
"0.6075922",
"0.6051686",
"0.60396016",
"0.6037589",
"0.6034824",
"0.6031103",
"0.5986846",
"0.5960258... | 0.0 | -1 |
POST /encounters_types POST /encounters_types.json | def create
@active = User.find(session[:user_id]).try :touch
@encounters_type = EncountersType.new(encounters_type_params)
respond_to do |format|
if @encounters_type.save
format.html { redirect_to @encounters_type, notice: 'Encounters type was successfully created.' }
format.json { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encounters_type_params\n params.require(:encounters_type).permit(:name, :description, :creator, :date_created, :retired, :retired_by, :date_retired, :retire_reason, :uuid)\n end",
"def set_encounters_type\n @encounters_type = EncountersType.find(params[:id])\n end",
"def create\n @incide... | [
"0.66303325",
"0.64762866",
"0.63362354",
"0.6303407",
"0.62472624",
"0.6165293",
"0.6165293",
"0.6156452",
"0.6153198",
"0.6153198",
"0.60896623",
"0.6008475",
"0.590575",
"0.58567584",
"0.5788688",
"0.578859",
"0.5784797",
"0.5782337",
"0.57671976",
"0.57623684",
"0.5750394... | 0.63100624 | 3 |
PATCH/PUT /encounters_types/1 PATCH/PUT /encounters_types/1.json | def update
@active = User.find(session[:user_id]).try :touch
respond_to do |format|
if @encounters_type.update(encounters_type_params)
format.html { redirect_to @encounters_type, notice: 'Encounters type was successfully updated.' }
format.json { render :show, status: :ok, location: @enc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n el... | [
"0.6682595",
"0.66295487",
"0.6440262",
"0.6326325",
"0.6278551",
"0.6231351",
"0.6224614",
"0.6212419",
"0.61923987",
"0.61775255",
"0.6153656",
"0.6136073",
"0.6131213",
"0.61296916",
"0.61248213",
"0.6080293",
"0.60704505",
"0.6066946",
"0.6055853",
"0.60492325",
"0.604892... | 0.6463529 | 2 |
DELETE /encounters_types/1 DELETE /encounters_types/1.json | def destroy
@active = User.find(session[:user_id]).try :touch
@encounters_type.destroy
respond_to do |format|
format.html { redirect_to encounters_types_url, notice: 'Encounters type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n fo... | [
"0.72714084",
"0.71157694",
"0.7033736",
"0.69119567",
"0.690472",
"0.6865134",
"0.68519086",
"0.6849904",
"0.6825248",
"0.6822417",
"0.68223786",
"0.6798489",
"0.67880154",
"0.6778112",
"0.6760838",
"0.67507035",
"0.67397124",
"0.6739297",
"0.6733477",
"0.6733122",
"0.669939... | 0.674624 | 16 |
Use callbacks to share common setup or constraints between actions. | def set_encounters_type
@encounters_type = EncountersType.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 encounters_type_params
params.require(:encounters_type).permit(:name, :description, :creator, :date_created, :retired, :retired_by, :date_retired, :retire_reason, :uuid)
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
register the current user as wanting to follow the user passed in | def follow_user
output = ''
if params[:user_id].present?
x = Notification.add_follow_user(current_user.id, params[:user_id])
if x
output = 'success!'
else
output = "error: #{x.errors.full_message}"
end
else
output = 'please provide a user to follow'
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follow(user)\n user.add_follower(self)\n self\n end",
"def follow\n if current_user\n update_and_decorate # Generate a FeedEntryDecorator as @feed_entry and prepares it for editing\n if current_user.follows? @user\n current_user_or_guest.followees.delete @user\n msg = \"You'... | [
"0.81078535",
"0.7984137",
"0.7939807",
"0.7916025",
"0.7905751",
"0.79007924",
"0.79001135",
"0.7853434",
"0.7853434",
"0.7853434",
"0.7853434",
"0.7853434",
"0.7853434",
"0.784744",
"0.7824568",
"0.7792542",
"0.7775769",
"0.77296156",
"0.7683688",
"0.7640932",
"0.7615408",
... | 0.6952496 | 89 |
view invitations that are currently on record for this user | def invitations
@invitations = Invitation.pending_by_user(current_user.id)
respond_to do |format|
format.html
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user = User.find(session[:user_id])\n @user_invitees = Invitation.where(user: User.find(session[:user_id])).where(invited: true)\n @user_invitors = Invitation.where(invitee: User.find(current_user)).where(invited: true)\n @invitors = Invitation.where(invited: User.find(curre... | [
"0.79558927",
"0.7832586",
"0.772375",
"0.7572735",
"0.75500154",
"0.7257913",
"0.72330385",
"0.70511544",
"0.7032043",
"0.7032043",
"0.7032043",
"0.70141953",
"0.7009202",
"0.69842154",
"0.6960684",
"0.69376487",
"0.6874572",
"0.68473214",
"0.6842568",
"0.681261",
"0.6799484... | 0.782099 | 2 |
accept the invitation that has the key in the url | def accept_invitation
accepted = false
inv = Invitation.find_by_key(params[:key])
if inv.present?
s = Story.is_not_deleted.find_by_id(inv.story_id)
if inv.accepted_at.blank?
if s.present?
s.users << current_user
inv.accepted_at = Time.now
inv.save
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_invitation\n \n end",
"def accept_invite(_token)\n # stub\n end",
"def accept_invite(requestor_id)\n respond_to_invite(requestor_id, true)\n end",
"def accept_invite3\n # find the invitation\n @invitation = Invitation.find_by_verify_email_token(params[:... | [
"0.7592476",
"0.7024638",
"0.6870241",
"0.6826506",
"0.6798499",
"0.67649454",
"0.6743167",
"0.6736376",
"0.6682845",
"0.6636519",
"0.661541",
"0.6586653",
"0.65841573",
"0.6536653",
"0.65217036",
"0.6442873",
"0.6426977",
"0.63918895",
"0.637317",
"0.63533485",
"0.63415575",... | 0.75411695 | 1 |
delete the invitation that has the key in the url | def decline_invitation
deleted = false
inv = Invitation.find_by_key(params[:key])
if inv.present?
inv.destroy
deleted = true
redirect_to settings_invitations_path, :notice => t('app.msgs.invitation.declined')
end
if !deleted
redirect_to settings_invitations_path, :notice =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(_url)\n # do nothing since we can't find the key by url\n end",
"def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :no_conte... | [
"0.70322984",
"0.6896569",
"0.68911767",
"0.6873876",
"0.68561184",
"0.68561184",
"0.68561184",
"0.68561184",
"0.68561184",
"0.68383074",
"0.6809145",
"0.67984164",
"0.6789423",
"0.6777951",
"0.6777951",
"0.6759596",
"0.6619479",
"0.6615846",
"0.66061836",
"0.65639806",
"0.65... | 0.71840435 | 0 |
Returns triplets of (user, role name, observation) | def triples
requesters, approvers, observers = partitioned_roles
requesters = requesters.map { |role| [role.user, "Requester", nil] }
approvers = approvers.map { |role| [role.user, "Approver", nil] }
observers = observers.map { |role| [role.user, nil, observation_for(role.user)] }
requesters + appr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_roles_and_users\n chorus_object_roles.map(&:role).uniq.map do |r|\n [r.name, users_for_role(r).map(&:username)]\n end\n end",
"def triples\n requesters, approvers, observers = self.partitioned_roles\n requesters = requesters.map { |r| [r.user, \"Requester\", nil] }\n approvers = app... | [
"0.64845634",
"0.6427077",
"0.60423476",
"0.59704876",
"0.5779692",
"0.572158",
"0.5720179",
"0.5719181",
"0.5688009",
"0.56235987",
"0.5571886",
"0.54770446",
"0.5461219",
"0.54588693",
"0.54546624",
"0.54434156",
"0.5432787",
"0.5430582",
"0.5406696",
"0.5406696",
"0.539938... | 0.6758166 | 0 |
The default sorting, if no known fields are found in the parameters. Default sorting is specified by name/direction, using an array. Example: | def default
@default ||= "#{fields.first.sql} ASC"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_array_by_fields(array, default_order = \"launched_on\")\n sort_by = self.class::SORT_FIELDS[params[:order_by] || default_order]\n array = array.sort(&sort_by)\n\n params[:order_dir] != Sortable::DIRECTION_ASC ? array.reverse : array\n end",
"def default_sort\n 'name asc'\n end",
"def sor... | [
"0.75003034",
"0.7477702",
"0.74440026",
"0.74440026",
"0.7400199",
"0.730659",
"0.730659",
"0.730271",
"0.72968936",
"0.7207958",
"0.7087563",
"0.7087563",
"0.7087563",
"0.7081991",
"0.7051952",
"0.7015245",
"0.6999488",
"0.6980134",
"0.694584",
"0.6928063",
"0.6908319",
"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def request_item_params
# Rails 4+ requires you to whitelist attributes in the controller.
params.fetch(:request_item, {}).permit(:quantity, :item_id, :request_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
not working just loading def deals_pt2 url = ' b = Watir::Browser.new(:phantomjs) b.goto url doc = Nokogiri::HTML(b.html) b.element(:id => 'dealTitle').wait_until_present(timeout=10) b = doc.css('widgetContent') puts b end dont work either def deals_pt3 agent = Mechanize.new agent.user_agent_alias = 'Mac Safari' page =... | def economists
b = Watir::Browser.new(:phantomjs)
begin
b.goto 'http://www.economist.com/'
doc = Nokogiri::HTML(b.html)
# def one
begin
a = doc.css('.hero-item-1')
b = doc.css('.hero-item-1 a')[1]['href']
url = 'http://www.theeconomist.com' + b.to_s
puts url
c = doc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createBorwser(url,browser)\n begin\n driver=Watir::Browser.new browser.to_sym \n driver.goto url\n timer(driver) { |driver|\n if driver.input(:id=>$elementIdTextBox).present?\n driver.input(:id=>$elementIdTextBox).send_keys(\"watir webdriver\")\n ... | [
"0.6679859",
"0.6404945",
"0.63390917",
"0.6227901",
"0.6226064",
"0.6158492",
"0.6146017",
"0.61365247",
"0.6113619",
"0.6107237",
"0.61054814",
"0.6062761",
"0.6042283",
"0.60327333",
"0.603199",
"0.60227185",
"0.5976237",
"0.5966481",
"0.596078",
"0.59012586",
"0.5890905",... | 0.62549603 | 3 |
Writes a debug message to the console. | def debug(message, important = false)
puts "[DEBUG : #{Thread.current[:discordrb_name]} @ #{Time.now.strftime(LOG_TIMESTAMP_FORMAT)}] #{message}" if @debug || important
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(message)\n $stdout.puts \"D #{message}\" if @debug\n end",
"def debug(message)\n ostream.puts message if $DEBUG\n end",
"def debug(message)\n puts message if debug?\n end",
"def debug(msg)\n STDERR.puts msg if @debug\n end",
"def debug(msg)\n ... | [
"0.8037287",
"0.7978308",
"0.7964691",
"0.7949875",
"0.7888673",
"0.76446193",
"0.75420475",
"0.75390524",
"0.7526552",
"0.74869335",
"0.74869335",
"0.7481363",
"0.7392136",
"0.73690856",
"0.7361165",
"0.73404855",
"0.7265162",
"0.7206406",
"0.7167055",
"0.7144118",
"0.714226... | 0.68424934 | 44 |
Logs an exception to the console. | def log_exception(e, important = true)
debug("Exception: #{e.inspect}", important)
e.backtrace.each { |line| debug(line, important) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_exception ex\n logger.error ex\n logger.error ex.class\n logger.error ex.backtrace.join(\"\\n\")\n end",
"def log_error(title, exception)\n RAILS_DEFAULT_LOGGER.error \"#{title}: #{exception}\\n#{exception.backtrace.join(\"\\n\")}\"\n end",
"def log_error(message)\n Rails.log... | [
"0.7114469",
"0.7112015",
"0.70766336",
"0.70601",
"0.7036577",
"0.7030633",
"0.697124",
"0.6944502",
"0.69263035",
"0.6884178",
"0.6846214",
"0.68328524",
"0.6748613",
"0.669286",
"0.66060305",
"0.65996385",
"0.65816754",
"0.65721226",
"0.65467966",
"0.6476486",
"0.6472709",... | 0.0 | -1 |
returns a boolean array with the log info of the last 5 days | def current_streak
log_history = self.days.map {|day| day.logs_date }
log_history.sort! {|a, b| b <=> a }
log_history = log_history[0..4]
days_since_habit_creation = (Time.now.to_date - self.created_at.to_date).to_i
max_streak = days_since_habit_creation >= 5 ? -4 : -days_since_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logs_by_date(date)\n my_logs.select{|log| log.date == date}\n end",
"def logs_by_date(date)\n my_logs.select{|log| log.date == date}\n end",
"def todays_calories\n array = self.daily_logs.map do |log|\n if log.date == Date.today\n return log.calories \n ... | [
"0.6189947",
"0.6189947",
"0.60978043",
"0.60421413",
"0.5999349",
"0.56812197",
"0.5572792",
"0.55478257",
"0.5547098",
"0.5501107",
"0.54854214",
"0.54816055",
"0.54798764",
"0.54567844",
"0.5401228",
"0.53995854",
"0.53907865",
"0.5387124",
"0.5382961",
"0.5378022",
"0.537... | 0.5041566 | 79 |
GET /rtc_infos GET /rtc_infos.json | def index
@rtc_infos = RtcInfo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @rtc_info = RtcInfo.find_by_users_id(current_user.id)\n end",
"def set_rtc_info\n @rtc_info = RtcInfo.find(params[:id])\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def create\n @rtc_info = RtcInfo.new(rtc_info_params)\n ... | [
"0.70636",
"0.64317554",
"0.6155322",
"0.6134918",
"0.6058979",
"0.6027324",
"0.5965631",
"0.5953426",
"0.5945171",
"0.5933794",
"0.59099686",
"0.58507025",
"0.58090687",
"0.5765219",
"0.5765219",
"0.57593155",
"0.5755133",
"0.57479084",
"0.57473487",
"0.57360345",
"0.5723841... | 0.7626427 | 0 |
GET /rtc_infos/1 GET /rtc_infos/1.json | def show
@rtc_info = RtcInfo.find_by_users_id(current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @rtc_infos = RtcInfo.all\n end",
"def set_rtc_info\n @rtc_info = RtcInfo.find(params[:id])\n end",
"def show\n render :json => @timecard.to_json(:include => :time_entry), status: :ok\n end",
"def show\n @receiver_time = ReceiverTime.find(params[:id])\n\n respond_to do |forma... | [
"0.74293184",
"0.65994424",
"0.62307674",
"0.61656547",
"0.6135328",
"0.6132041",
"0.6064792",
"0.60107523",
"0.6001254",
"0.5950557",
"0.59465784",
"0.59300774",
"0.5901133",
"0.5897678",
"0.5886973",
"0.5868826",
"0.586816",
"0.5866166",
"0.5843073",
"0.5841653",
"0.5830403... | 0.6932015 | 1 |
POST /rtc_infos POST /rtc_infos.json | def create
@rtc_info = RtcInfo.new(rtc_info_params)
@rtc_info.users_id= current_user.id
respond_to do |format|
if @rtc_info.save
format.html { redirect_to @rtc_info, notice: 'Rtc info was successfully created.' }
format.json { render :show, status: :created, location: @rtc_info }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rtc_info\n @rtc_info = RtcInfo.find(params[:id])\n end",
"def rtc_info_params\n params.require(:rtc_info).permit(:username, :password, :user_id)\n end",
"def index\n @rtc_infos = RtcInfo.all\n end",
"def update\n respond_to do |format|\n if @rtc_info.update(rtc_info_params... | [
"0.63266826",
"0.6317533",
"0.62836283",
"0.6203567",
"0.57083005",
"0.56605405",
"0.54400074",
"0.54183275",
"0.5371193",
"0.53526527",
"0.53513694",
"0.533669",
"0.5301264",
"0.5282766",
"0.5282766",
"0.52489",
"0.5247258",
"0.52243316",
"0.5204114",
"0.51954204",
"0.517440... | 0.7302498 | 0 |
PATCH/PUT /rtc_infos/1 PATCH/PUT /rtc_infos/1.json | def update
respond_to do |format|
if @rtc_info.update(rtc_info_params)
format.html { redirect_to @rtc_info, notice: 'Rtc info was successfully updated.' }
format.json { render :show, status: :ok, location: @rtc_info }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rtc_info\n @rtc_info = RtcInfo.find(params[:id])\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info ... | [
"0.6333548",
"0.6288214",
"0.6171444",
"0.61254054",
"0.6032647",
"0.5999655",
"0.5976095",
"0.596744",
"0.59496963",
"0.59296316",
"0.5925663",
"0.59179074",
"0.5903058",
"0.59007525",
"0.5890622",
"0.5883153",
"0.5843632",
"0.5842563",
"0.5825597",
"0.5823819",
"0.58090293"... | 0.7326742 | 0 |
DELETE /rtc_infos/1 DELETE /rtc_infos/1.json | def destroy
@rtc_info.destroy
respond_to do |format|
format.html { redirect_to rtc_infos_url, notice: 'Rtc info was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.... | [
"0.6861016",
"0.6735655",
"0.67128134",
"0.66434634",
"0.6604468",
"0.6591323",
"0.65196085",
"0.65148824",
"0.65122503",
"0.64973533",
"0.64959466",
"0.6491007",
"0.6482196",
"0.6476205",
"0.64706194",
"0.6465727",
"0.64534676",
"0.6452141",
"0.64195013",
"0.6419438",
"0.639... | 0.76263165 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_rtc_info
@rtc_info = RtcInfo.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def rtc_info_params
params.require(:rtc_info).permit(:username, :password, :user_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
def finance_normal? is_finance_junior? or is_finance_senior? end | def email_required?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_cross_company?\n super && !is_anniversary?\n end",
"def for_profit?\n !foreign? && !facility_code.nil? && facility_code[0] == \"2\"\n end",
"def senior_member?\n\t\tsenior != true\n\tend",
"def finance_office?\n current_user.role && current_user.role.upcase.split(',').include?('CO') && curr... | [
"0.6746407",
"0.6737688",
"0.67115307",
"0.66460776",
"0.6505127",
"0.6476556",
"0.64709073",
"0.6398463",
"0.6384096",
"0.63417375",
"0.6296728",
"0.6250867",
"0.6233789",
"0.61349547",
"0.61294216",
"0.61049503",
"0.6088944",
"0.60879534",
"0.6086584",
"0.60772306",
"0.6074... | 0.0 | -1 |
hash for building mypicks view | def locked_mds
locked_mds = {}
Matchday.all.each do |m|
locked_mds[m.week] = m.locked
end
locked_mds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash()\n #This is a stub, used for indexing\n end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; end",
"def hash; e... | [
"0.64922774",
"0.64922774",
"0.64922774",
"0.64922774",
"0.64922774",
"0.64922774",
"0.64922774",
"0.64004356",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.6393176",
"0.624123",
"0.6235298",
"0.623529... | 0.0 | -1 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
#make an argument for your name
user_name = OpenStudio::Ruleset::OSArgument::makeStringArgument("user_name",true)
user_name.setDisplayName("What is your name?")
args << user_name
#make an argument to add new space true/f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.7374333",
"0.7374333",
"0.7374333",
"0.70872897",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
"0.70077103",
... | 0.63583964 | 44 |
end the arguments method define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
#use the built-in error checking
if not runner.validateUserArguments(arguments(model), user_arguments)
return false
end
#assign the user inputs to variables
user_name = runner.getStringArgumentValue("user_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure=(_arg0); end",
"def measure(*args, &b)\n end",
"def measure; end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def run(model, runner, user_argument... | [
"0.7513744",
"0.6952832",
"0.6925082",
"0.62926763",
"0.62926763",
"0.622369",
"0.622369",
"0.622369",
"0.61478853",
"0.61192423",
"0.6115819",
"0.604246",
"0.5981343",
"0.59791523",
"0.59720784",
"0.59661543",
"0.5962138",
"0.5956811",
"0.5947899",
"0.59065133",
"0.59065133"... | 0.0 | -1 |
Implement any sorting algorithm. Bonus: keep it concise | def sort(arr)
arr.reduce([]) do |sorted, element|
index = sorted.find_index do |item|
element< item
end
index ||= sorted.length
sorted.insert(index, element)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bigSorting(unsorted)\n\nend",
"def stable_sort_by(list); end",
"def sorting(numbers)\n numbers.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)... | [
"0.7762338",
"0.7724149",
"0.7343161",
"0.73383725",
"0.73383725",
"0.7258672",
"0.7255803",
"0.7255803",
"0.7255803",
"0.7229955",
"0.7169792",
"0.7105094",
"0.7103302",
"0.7077084",
"0.7069555",
"0.70584303",
"0.7045476",
"0.7045393",
"0.7003792",
"0.69868755",
"0.6937877",... | 0.0 | -1 |
Function to compare SSH keys | def compareKeys(abuser)
if ! abuser.nil? || ! abuser.empty?
sshkey = `knife data bag show users #{abuser} 2>/dev/null |grep -w 'ssh_keys:'|cut -d':' -f2`
else
$sshkey = ''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_host_keys(hosts_stat, verbose = false)\n\n #\n # 1. Remove keys from known_hosts, using ssh-keygen -R <host>\n #\n\n hosts_stat.each do |hs|\n\n hs[:names].each do |hn|\n system(\n \"ssh-keygen -f \\\"#{$known_hosts}\\\" -R #{hn} > /dev/null 2> /dev/null\" )\n end\n\n end\n\n #\n ... | [
"0.6472894",
"0.6101879",
"0.6029829",
"0.5969653",
"0.5959884",
"0.5959884",
"0.5959884",
"0.5953673",
"0.59414",
"0.5899806",
"0.57811105",
"0.5709078",
"0.56092954",
"0.56008273",
"0.5536941",
"0.5535111",
"0.55345327",
"0.55113786",
"0.5503012",
"0.5497096",
"0.54939467",... | 0.6838832 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_pasta
@pasta = Pasta.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.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.