query
stringlengths
7
6.41k
document
stringlengths
12
28.8k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
5
10
document_rank
stringclasses
2 values
Fdbsql uses the :fdbsql database type.
def database_type :fdbsql end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_type\n :sqlite\n end", "def database_type\n :as400\n end", "def target_sql_mode=(_arg0); end", "def target_sql_mode; end", "def db_type\n @db_type || self.class.db_type\n end", "def db_type\n @db_type || self.class.db_type\n end", ...
[ "0.6397393", "0.604215", "0.5996489", "0.5943548", "0.59385914", "0.59385914", "0.5898608", "0.58415866", "0.5838211", "0.57997215", "0.57444364", "0.57379746", "0.5557093", "0.547032", "0.54473877", "0.54193515", "0.53765285", "0.53765285", "0.53765285", "0.53765285", "0.537...
0.89601046
0
the sql layer supports CREATE TABLE IF NOT EXISTS syntax,
def supports_create_table_if_not_exists? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_create_table_if_not_exists?\n false\n end", "def create_table (table_name)\r\n\t\"CREATE TABLE IF NOT EXISTS \" + table_name + \r\n\t\"(\r\n\tid INTEGER PRIMARY KEY,\r\n\ttitle VARCHAR(255),\r\n\tcode VARCHAR(255)\r\n\t)\"\r\nend", "def create_table?(*args, &block)\n create_table(...
[ "0.8040422", "0.7632495", "0.7609417", "0.75077343", "0.7254217", "0.7211834", "0.7152801", "0.7129732", "0.6953429", "0.69209707", "0.6855659", "0.6820497", "0.6820497", "0.67950547", "0.67753017", "0.67703146", "0.6757585", "0.6751867", "0.6739794", "0.6730278", "0.6709174"...
0.8158474
0
Fdbsql supports deferrable fk constraints
def supports_deferrable_foreign_key_constraints? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_deferrable_foreign_key_constraints?\n supports_deferrable_constraints?\n end", "def dump_add_fk_constraints(table, fks)\n sfks = String.new\n sfks << \"alter_table(#{table.inspect}) do\\n\"\n sfks << create_table_generator do\n fks.sort_by{|fk| fk[:columns]}.each do |fk...
[ "0.7005788", "0.6782233", "0.6541232", "0.644353", "0.644353", "0.643824", "0.6377952", "0.6377952", "0.6313464", "0.6297069", "0.6269491", "0.6268405", "0.6216627", "0.6186827", "0.6183074", "0.6169292", "0.6164011", "0.6159796", "0.6140732", "0.6051275", "0.60505587", "0....
0.7367376
0
the sql layer supports DROP TABLE IF EXISTS
def supports_drop_table_if_exists? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_drop_table_if_exists\n connection.create_table(:testings)\n assert connection.table_exists?(:testings)\n connection.drop_table(:testings, if_exists: true)\n assert_not connection.table_exists?(:testings)\n end", "def drop_table_sql(name, options)\n \"DROP ...
[ "0.76820403", "0.75718266", "0.74134815", "0.7249443", "0.7180579", "0.6973034", "0.6907691", "0.68981194", "0.6883002", "0.68058807", "0.67804927", "0.6772818", "0.67670506", "0.6731415", "0.669336", "0.6688118", "0.6688106", "0.6643568", "0.65976745", "0.6596095", "0.656162...
0.7899555
0
If the given type is DECIMAL with scale 0, say that it's an integer
def normalize_decimal_to_integer(type, scale) if (type == 'DECIMAL' and scale == 0) 'integer' else type end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_to_sql(type, limit = nil, precision = nil, scale = nil)\n return super unless type.to_s == 'integer'\n return 'integer' unless limit\n\n case limit\n when 1..8; 'integer'\n else raise(ActiveRecordError, \"No integer type has byte size #{limit}. Use a numeric with pre...
[ "0.6960126", "0.6769091", "0.6756799", "0.67336273", "0.6696981", "0.6696981", "0.66697484", "0.6666752", "0.6366592", "0.6357416", "0.6268736", "0.62412274", "0.62404037", "0.6236163", "0.62000674", "0.61211747", "0.6105078", "0.61037105", "0.60903883", "0.6048786", "0.60034...
0.8312664
0
Remove the cached entries for primary keys and sequences when a table is changed.
def remove_cached_schema(table) tab = quote_schema_table(table) Sequel.synchronize do @primary_keys.delete(tab) end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_cached_schema(table)\n tab = quote_schema_table(table)\n Sequel.synchronize do\n @primary_keys.delete(tab)\n @primary_key_sequences.delete(tab)\n end\n super\n end", "def clean\n disable_referential_integrity do\n tables_cache.keys.rev...
[ "0.7296072", "0.6630591", "0.65746415", "0.6339876", "0.63392925", "0.6294856", "0.62028897", "0.6157955", "0.61444277", "0.60552055", "0.60023355", "0.60008526", "0.5963297", "0.5955787", "0.59497863", "0.5938426", "0.59146667", "0.59047925", "0.5871068", "0.5853251", "0.584...
0.71739537
1
The SQL to use for an insert_select, adds a RETURNING clause to the insert unless the RETURNING clause is already present.
def insert_select_sql(*values) ds = opts[:returning] ? self : returning ds.insert_sql(*values) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = ...
[ "0.752074", "0.752074", "0.728627", "0.7261176", "0.71895057", "0.7147002", "0.71056527", "0.70052046", "0.6909159", "0.69071007", "0.6816865", "0.680355", "0.65624285", "0.65624285", "0.65499264", "0.6535304", "0.65157926", "0.6483761", "0.6463841", "0.642648", "0.6370401", ...
0.7738337
1
FDBSQL supports quoted function names
def supports_quoted_function_names? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def function_sql(f)\n args = f.args\n \"#{f.f}#{args.empty? ? '()' : literal(args)}\"\n end", "def irregular_function_sql(f)\n \"#{f.f}(#{literal(f.arg1)} #{f.joiner} #{literal(f.arg2)})\"\n end", "def name\n\t\t\"db_fun\"\n\tend", "def function(name, *args)\n SQL::Function.new(na...
[ "0.74136657", "0.717309", "0.66502213", "0.6449975", "0.64238733", "0.63221145", "0.6276276", "0.62616354", "0.61815345", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244", "0.6169244"...
0.72176206
1
Use USING to specify additional tables in a delete query
def delete_using_sql(sql) join_from_sql(:USING, sql) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_sql(opts = nil)\n opts = opts ? @opts.merge(opts) : @opts\n\n if opts[:group]\n raise Error::InvalidOperation, \"Grouped datasets cannot be deleted from\"\n elsif opts[:from].is_a?(Array) && opts[:from].size > 1\n raise Error::InvalidOperation, \"Joined datasets cannot be de...
[ "0.63203835", "0.6251078", "0.6079405", "0.60615814", "0.60326934", "0.6020745", "0.6006609", "0.59675026", "0.5950655", "0.5901165", "0.58806187", "0.5856725", "0.5830617", "0.58274776", "0.57967013", "0.5768996", "0.5765135", "0.5707902", "0.56950194", "0.5692454", "0.56786...
0.7621265
0
Use FROM to specify additional tables in an update query
def update_from_sql(sql) join_from_sql(:FROM, sql) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_table_sql(sql)\n sql << ' '\n source_list_append(sql, @opts[:from][0..0])\n end", "def update_from(from_table, *args, &block)\n\n configure_transfer(from_table, *args) { yield }\n\n @current_operation = StatusReport.instance.add_operation :source => @from_table,\n ...
[ "0.630731", "0.6088034", "0.5901598", "0.5883422", "0.5592899", "0.55487484", "0.5529329", "0.54990935", "0.5488189", "0.5416212", "0.5406827", "0.5382143", "0.5381436", "0.53802943", "0.5377935", "0.5377765", "0.53237104", "0.5322136", "0.5301938", "0.5299105", "0.5299105", ...
0.7206524
0
this method takes the password and makes a salt to it :arg: password => string :return: => string
def make_salt secure_hash("#Time.now.utc}--#{password}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_salt\n\t secure_hash(\"#{Time.now.utc}--#{password}\")\n\tend", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def make_salt\n secure_hash(\"#{Time.now.utc}--#{password}\")\n end", "def salt() 'monkeynutzzSfaKT7CwImCHCH8Ow' end", "def make_salt\r\n se...
[ "0.8338974", "0.82680583", "0.82680583", "0.8117357", "0.80791515", "0.80326694", "0.79911816", "0.79272264", "0.78991246", "0.7863014", "0.7764729", "0.7764729", "0.7764729", "0.7764729", "0.7764729", "0.7764729", "0.7758749", "0.7752166", "0.77381647", "0.7732968", "0.77141...
0.84173065
0
GET /therapists GET /therapists.json
def index @therapists = Therapist.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def artists\n if RESPONSE.code == 200\n # Return data to page\n JSON.parse(RESPONSE.to_s)['topartists']['artist']\...
[ "0.65641606", "0.61692816", "0.603311", "0.5904747", "0.5820933", "0.5701526", "0.56982607", "0.56810516", "0.56718695", "0.56535226", "0.56264454", "0.56256413", "0.55675966", "0.55339104", "0.55339104", "0.55339104", "0.54896927", "0.544006", "0.54180866", "0.54151976", "0....
0.67541265
1
POST /therapists POST /therapists.json
def create @therapist = Therapist.new(therapist_params) respond_to do |format| if @therapist.save format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' } format.json { render :show, status: :created, location: @therapist } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @therapist = Therapist.new(params[:therapist])\n\n respond_to do |format|\n if @therapist.save\n format.html { redirect_to @therapist, notice: 'Therapist was successfully created.' }\n format.json { render json: @therapist, status: :created, location: @therapist }\n else\...
[ "0.64040893", "0.61932355", "0.61631703", "0.575704", "0.56643975", "0.55949473", "0.5583514", "0.55344725", "0.55214167", "0.55214167", "0.55214167", "0.55214167", "0.5423171", "0.5403069", "0.53796643", "0.5350915", "0.53136873", "0.53136873", "0.5313048", "0.52832824", "0....
0.63288975
1
Find all Refs +repo+ is the Repo +options+ is a Hash of options Returns Grit::Ref[] (baked)
def find_all(repo, options = {}) refs = [] already = {} Dir.chdir(repo.path) do files = Dir.glob(prefix + '/**/*') files.each do |ref| next if !File.file?(ref) id = File.read(ref).chomp name = ref.sub("#{prefix}/", '') commit = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refs(repo)\n repo.refs_hash[id]\n end", "def refs\n select_branches(git.grit.refs)\n end", "def refs(ref=nil)\n prefix = ref ? \"#{path_prefix}/refs/#{ref}\" : \"#{path_prefix}/refs\"\n Ghee::API::Repos::Git::Refs::Proxy.new(connection, prefix)\n end", ...
[ "0.68228453", "0.66088945", "0.6487785", "0.6403994", "0.61406976", "0.611321", "0.60990113", "0.6053035", "0.5935454", "0.5913055", "0.5892811", "0.5866582", "0.5847642", "0.5822025", "0.5771191", "0.576539", "0.56901103", "0.5682118", "0.56734806", "0.56412035", "0.5636232"...
0.76897776
0
Instantiate a new Head +name+ is the name of the head +commit+ is the Commit that the head points to Returns Grit::Head (baked)
def initialize(name, commit) @name, @commit = name, commit @repo = @commit.instance_variable_get :@repo @git = @repo.git end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @commit = Commit.new\n\n #walker = Rugged::Walker.new(@repo)\n #\n #walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) # optional\n #\n #walker.push('HEAD')\n #walker.each { |c| \n # @commit = Commit.new(sha: c.oid, description:c.message,\n # aut...
[ "0.59315485", "0.58312094", "0.57680696", "0.5690183", "0.56891936", "0.5670653", "0.5655677", "0.5655677", "0.56328434", "0.5594977", "0.5531488", "0.5519572", "0.54861957", "0.5479035", "0.5451208", "0.5448432", "0.544129", "0.5386441", "0.53862643", "0.5366007", "0.5354199...
0.64931947
0
Checkout the this branch, do stuff and ensure that the old branch gets checked out afterwards. If message is set the index is commited. In this case the commit (baked) is returned.
def in_branch(message = nil) old_ref = @repo.head checkout yield @repo if message @repo.commit_index message @repo.head.commit end ensure old_ref.checkout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit!(msg=status)\n setup unless head\n \n sha = git.commit!(msg)\n index.write(sha)\n sha\n end", "def commit(branch, message)\n zombie_check\n on_worktree(branch) { |repo| repo.commit(message) }\n end", "def commit(message = nil)\n # Write current index bac...
[ "0.667466", "0.6631396", "0.65877306", "0.6577263", "0.62439597", "0.6230292", "0.613417", "0.61244905", "0.5992979", "0.5907079", "0.58546335", "0.5843525", "0.58400285", "0.58182776", "0.58151525", "0.5808778", "0.5788097", "0.5752447", "0.5719278", "0.5682486", "0.56772906...
0.76046836
0
Calculate the best score for the hand
def score handscore = possible_scores.sort.reverse handscore.detect { |value| value <= 21 } or handscore.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score\n flush = is_flush?\n straight = is_straight?\n pairs = pairs?\n\n return 45 if pairs.size == 1 && pairs[0][1] == 5\n return 44 if flush && straight\n return 31 + pairs[0][0] - 2 if pairs.size == 1 && pairs[0][1] == 4\n return 30 if pairs.size == 2 && (pairs[0][1] + pairs[1][1]) ...
[ "0.73825055", "0.73507476", "0.7343917", "0.7289284", "0.7254401", "0.72277933", "0.72188026", "0.72098553", "0.7180613", "0.70711607", "0.7068942", "0.70404804", "0.7001947", "0.7001947", "0.69822407", "0.6945378", "0.6939059", "0.69091046", "0.69039965", "0.6883085", "0.688...
0.7649342
0
Find the current card values
def card_values @cards.map(&:value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def our_values\n result = []\n \n @cards.each do |card|\n result << card.value\n end\n \n result\n end", "def current_value\n @top_card.value\n end", "def values\n keys = CARD::SYMBOLS\n i = 2\n keys.each do |key|\n @card_vals[key] = i\n i+...
[ "0.768456", "0.72897804", "0.6974268", "0.6771374", "0.67637086", "0.6629953", "0.6491739", "0.64523345", "0.6368571", "0.6355245", "0.6343335", "0.6338135", "0.6310429", "0.6296501", "0.62647414", "0.62573504", "0.6247666", "0.6233911", "0.6228666", "0.62258446", "0.62149876...
0.77004707
0
Determine all possible scores for this hand
def possible_scores card_values.inject([0]) do |memo, item| if ace_value?(item) added_one = memo.map { |score| score + 1 } added_one << (added_one.last + 10) else memo.map { |number| number + item.first } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score\n @score = [straight_flush, four_of_a_kind, full_house, flush, straight, three_of_a_kind, two_pair, one_pair, high_card]\n end", "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c'...
[ "0.71634835", "0.6738339", "0.6708187", "0.6697871", "0.6621211", "0.66054326", "0.6577067", "0.655834", "0.65501314", "0.6501872", "0.6498675", "0.64945376", "0.64523566", "0.64260864", "0.6366487", "0.6302778", "0.63014835", "0.62863266", "0.6268234", "0.6218535", "0.618561...
0.6996696
1
Add finder conditions as a hash of requirements, a Scope, a NSPredicate, or a predicate format string with an optional list of arguments. The conditions are added using `AND`.
def where(conditions, *formatArguments) sortDescriptors = @sortDescriptors case conditions when Hash predicate = NSCompoundPredicate.andPredicateWithSubpredicates(conditions.map do |keyPath, value| Predicate::Builder.new(keyPath) == value end) when Scope sortDe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditions\n [conditions_clauses.join(' AND '), *conditions_options]\nend", "def add_where(arr:)\n @where_conditions << \" AND (#{arr.first}) \" # put in parenthesis for good measure\n @where_params << arr[1..]\n @where_params.flatten!\n end", "def conditions\n\t\t[conditions_cla...
[ "0.6334001", "0.6320325", "0.63049686", "0.63049686", "0.62408847", "0.61936677", "0.6100323", "0.60753524", "0.60546917", "0.6035628", "0.60271174", "0.6014424", "0.600842", "0.60046554", "0.5990715", "0.59369695", "0.59291005", "0.5877825", "0.5826585", "0.5819352", "0.5818...
0.6700884
0
Sort ascending by a keypath, or a NSSortDescriptor.
def sortBy(keyPathOrSortDescriptor) if keyPathOrSortDescriptor.is_a?(NSSortDescriptor) scopeByAddingSortDescriptor(keyPathOrSortDescriptor) else sortBy(keyPathOrSortDescriptor, ascending:true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortBy(keyPath, ascending:ascending)\n scopeByAddingSortDescriptor(NSSortDescriptor.alloc.initWithKey(keyPath.to_s, ascending:ascending))\n end", "def sort_by_key(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(key, _)| key}')\n end", "def sort_data_ascending!(*sort_keys)\n ...
[ "0.78414714", "0.68320245", "0.66835326", "0.6584835", "0.6439362", "0.6358376", "0.6356101", "0.6322224", "0.61857694", "0.60765547", "0.5991983", "0.5989741", "0.59734154", "0.59150463", "0.5861683", "0.5841808", "0.57138723", "0.5702449", "0.5699067", "0.56573075", "0.5654...
0.7609315
1
Sort by a keypath.
def sortBy(keyPath, ascending:ascending) scopeByAddingSortDescriptor(NSSortDescriptor.alloc.initWithKey(keyPath.to_s, ascending:ascending)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_by_key(key = :name)\n sort do |x, y|\n x_value = x[key]\n y_value = y[key]\n x_value <=> y_value\n end\n end", "def sortBy(keyPathOrSortDescriptor)\n if keyPathOrSortDescriptor.is_a?(NSSortDescriptor)\n scopeByAddingSortDescriptor(keyPathOrSortDescriptor)\n else\n ...
[ "0.6859959", "0.6677621", "0.65983063", "0.6505867", "0.63873637", "0.62860024", "0.6242479", "0.61726564", "0.6138875", "0.6102139", "0.6023756", "0.59643865", "0.5823679", "0.57273304", "0.5701233", "0.5693502", "0.5663793", "0.5662849", "0.56465423", "0.56417567", "0.56223...
0.74980104
0
Applies the finder and sort conditions and returns the result as a set.
def setByApplyingConditionsToSet(set) if @predicate if set.is_a?(NSOrderedSet) # TODO not the most efficient way of doing this when there are also sort descriptors filtered = set.array.filteredArrayUsingPredicate(@predicate) set = NSOrderedSet.orderedSetWithArray(fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\n @results ||= begin\n _dataset = filtered_dataset.limit(per_page).offset(start)\n\n if sort_by\n options = self.class.sortable_attribute_options(sort_by.to_s)\n order =\n if sort_order == \"DESC\"\n Sequel.desc(sort_by.to_sym, ...
[ "0.57928956", "0.5764287", "0.5631771", "0.55819196", "0.55554444", "0.5553484", "0.5511102", "0.5451713", "0.53485817", "0.5309465", "0.5307991", "0.5291402", "0.526538", "0.5252723", "0.5249744", "0.5222968", "0.51997304", "0.5185922", "0.5184599", "0.5173142", "0.5170617",...
0.67326045
0
Returns a NSFetchRequest with the current scope.
def fetchRequest # Start with a predicate which selects those entities that belong to the owner. predicate = Predicate::Builder.new(inverseRelationshipName) == @owner # Then apply the scope's predicate. predicate = predicate.and(@predicate) if @predicate request = NSFetchRequest...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_request\n NSFetchRequest.new.tap do |req|\n req.predicate = predicate\n req.fetchLimit = limit if limit\n req.fetchOffset = offset if offset\n req.sortDescriptors = sort_descriptors unless sort_descriptors.empty?\n end\n end", "def current_scope\n @scope\n ...
[ "0.6243216", "0.57657003", "0.55761296", "0.55608773", "0.5507141", "0.54130316", "0.5355764", "0.5349593", "0.5242645", "0.5242645", "0.52333266", "0.5191489", "0.51608", "0.51608", "0.51608", "0.51608", "0.51608", "0.51608", "0.5123547", "0.51159704", "0.51062727", "0.509...
0.69120425
0
This is the same as the add_attendees method, but it actually commits the change back to Exchange
def add_attendees!(required, optional = [], resources = []) add_attendees(required, optional, resources) save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attendees=(value)\n @attendees = value\n end", "def update!(**args)\n @add_attendee_emails = args[:add_attendee_emails] if args.key?(:add_attendee_emails)\n end", "def sync\n @event.sync_pansci_attendees\n redirect_to event_attendees_path, not...
[ "0.6572286", "0.6363675", "0.6346066", "0.62782377", "0.6049229", "0.600585", "0.59483576", "0.5945074", "0.5892766", "0.5865848", "0.57516855", "0.56584775", "0.560961", "0.559153", "0.55761147", "0.55343926", "0.5520884", "0.55142003", "0.5491161", "0.5487344", "0.5474476",...
0.66796803
0
This is the same as the remove_attendees method, but it actually commits the change back to Exchange
def remove_attendees!(attendees) remove_attendees(attendees) save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_attendees(attendees)\n return false if attendees.empty?\n\n emails = attendees.is_a?(Array) ? attendees : attendees.values\n emails = emails.collect do |v|\n case v.class.to_s\n when 'String'\n v\n when /MailboxUser|Attendee/\n v.emai...
[ "0.64326286", "0.5831366", "0.5749672", "0.56391776", "0.5605864", "0.5583784", "0.55614394", "0.5546314", "0.55228573", "0.5519151", "0.55073166", "0.5499146", "0.54864585", "0.5453721", "0.54332316", "0.54097533", "0.53860116", "0.5366456", "0.53655803", "0.5351563", "0.532...
0.7444893
0
Transform RPN stack into a tree structure
def tree @stack = @rpn.clone get_tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_tree(tree, scope_stack)\n if Symbol === tree[0]\n case tree[0]\n when :assign, :massign\n lhs, rhs = tree[1..2]\n begin\n add_variables_from_node(lhs, scope_stack)\n rescue SyntaxError => err\n wrap_node_with_error(tree)\n e...
[ "0.64109385", "0.6341717", "0.63149357", "0.6183882", "0.61797726", "0.61518836", "0.6053279", "0.595644", "0.5882153", "0.5882028", "0.5880919", "0.5862221", "0.58246857", "0.58032733", "0.57731473", "0.5767849", "0.57599646", "0.57522815", "0.57339233", "0.5699383", "0.5695...
0.74538785
0
If given a setter method name, will assign the first argument to the +options+ hash with the method name (sans "=") as the key. If given a getter method name, will attempt to a value from the +options+ hash for that key. If the key doesn't exist, defers to +super+.
def method_missing(symbol, *args) if (method = symbol.to_s).sub!(/\=$/, '') options[method.to_sym] = args.first else options.fetch(method.to_sym, super) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args)\n if method.to_s =~ /^([^=]+)(=?)$/ && options.has_key?($1.to_sym)\n options[$1.to_sym] = args.first unless $2.empty?\n options[$1.to_sym]\n else\n super\n end\n end", "def method_missing(method_name, *args, &block)\n setter = method_name.to_s.end_w...
[ "0.6945483", "0.68276757", "0.68179095", "0.6796349", "0.6792224", "0.67806196", "0.67591125", "0.66724885", "0.66621745", "0.6537654", "0.65186465", "0.650214", "0.6479622", "0.64497715", "0.64246947", "0.6354327", "0.63507766", "0.63348866", "0.63128597", "0.63063866", "0.6...
0.7014332
0
This function will generate an OpenStudio OSW with all the measures in it, in the order specified in /resources/measureinfo.json
def generate_example_osw_of_all_measures_in_order() require 'openstudio' require_relative 'resources/helper_methods' puts "Updating example OSW..." model = OpenStudio::Model::Model.new osw_path = "workflows/create-model-example.osw" if File.exist?(osw_path) File.delete(osw_path) end workf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_measures\n exec_req_and_parse_response \"/measure/list\"\n end", "def save_measure(measure_dir, collection_name)\n measures = []\n component_dir = File.join(measure_dir, 'components')\n Dir.glob(File.join(measure_dir, '*.col')).each do |collection_file|\n create_col...
[ "0.59969825", "0.5912107", "0.57006294", "0.56931746", "0.56721294", "0.5664503", "0.5615846", "0.56082463", "0.55991113", "0.5597729", "0.5551636", "0.5529071", "0.55164045", "0.55159664", "0.5498433", "0.5427247", "0.541304", "0.5383406", "0.53796077", "0.536971", "0.536034...
0.7148386
0
This method updates the "Measure Order" table in the README.md
def update_readme(data_hash) puts "Updating README measure order..." table_flag_start = "MEASURE_WORKFLOW_START" table_flag_end = "MEASURE_WORKFLOW_END" readme_path = "README.md" # Create table table_lines = [] table_lines << "|Group|Measure|Dependencies*|\n" table_lines << "|:---|:---|:---|...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recalculate\n line_items = LineItem.where(\"order_id = '#{order.attrs['id']}'\")\n sub_total = 0\n line_items.map do |li|\n sub_total += li.attrs['amount'].to_f * li.attrs['quantity'].to_i\n end\n order.attrs = order.attrs.merge('sub_total' => sub_total)\n if sub_total > DISCOUNTABLE_AMO...
[ "0.5938708", "0.56920063", "0.56862503", "0.554217", "0.5530078", "0.53992", "0.53625476", "0.5347721", "0.5315882", "0.5308631", "0.53016055", "0.5293923", "0.52333575", "0.52303666", "0.5221564", "0.5213555", "0.5150846", "0.5148878", "0.5121417", "0.5111846", "0.5088464", ...
0.58267957
1
Initialize servers for each protocol
def initialize_servers @protocols.each do |protocol, _| server = @servers[protocol.protocol] block = server[:start] server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_protocols\n @protocols.each do |protocol, _|\n server = protocol.server\n @servers[protocol.protocol] = { server: server, port: @protocols[protocol], start: protocol.start_block }\n @channels[protocol.protocol] = EM::Channel.new\n end\n initialize_servers\n ...
[ "0.8374212", "0.707834", "0.70425564", "0.70425564", "0.702736", "0.6920478", "0.66507506", "0.6527547", "0.64457136", "0.64404315", "0.64178056", "0.6402554", "0.6393966", "0.63345534", "0.6322585", "0.6278023", "0.62294334", "0.6220077", "0.6187043", "0.618631", "0.6172295"...
0.9003514
0
Initialize protocols to be handled
def initialize_protocols @protocols.each do |protocol, _| server = protocol.server @servers[protocol.protocol] = { server: server, port: @protocols[protocol], start: protocol.start_block } @channels[protocol.protocol] = EM::Channel.new end initialize_servers initialize_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_servers\n @protocols.each do |protocol, _|\n server = @servers[protocol.protocol]\n block = server[:start]\n server[:server].start(server[:port], @routes[protocol.protocol], views: @views, channel: @channels[protocol.protocol], debug: @debug, &block)\n end\n end", ...
[ "0.698583", "0.6786298", "0.6399343", "0.6058737", "0.5911278", "0.5812554", "0.57406396", "0.5730747", "0.5697636", "0.5661856", "0.5640314", "0.5624252", "0.5617527", "0.5581305", "0.55739415", "0.55632615", "0.5550831", "0.55224305", "0.55033386", "0.54998946", "0.5481908"...
0.7679202
0
Sets the initial size of the threadpool
def initialize_threadpool EM.threadpool_size = @poolsize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def worker_pool_size=(_arg0); end", "def initialize(size = 2)\n raise ArgumentError if size < 1\n @pool = size\n end", "def pool_size=(pool_size)\n @pool.pool_size = pool_size\n end", "def worker_pool_size; end", "def initialize(_size, _thr_group = nil)\n @kill_worker_on_exception = f...
[ "0.7370924", "0.69052756", "0.68901116", "0.68571854", "0.65275824", "0.6496892", "0.6496892", "0.64521074", "0.641115", "0.634298", "0.6323468", "0.6267898", "0.61841255", "0.61641955", "0.6112717", "0.61003137", "0.60529554", "0.6006994", "0.59725213", "0.59706503", "0.5962...
0.77975255
0
Registers a route for a given protocol
def register_route(protocol, verb, match, args, block) @routes[protocol] ||= {} @routes[protocol][verb] ||= {} @routes[protocol][verb][match] = { block: block, args: args } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(route, command, action = nil)\n if @route_map.has_key?(route)\n raise(Imp::RouterError, \"Route name cannot be defined twice: #{route}\")\n end\n\n @route_map[route] = { :command => command, :action => action }\n nil\n end", "def add_route( verb, path, route...
[ "0.6660911", "0.66254836", "0.64849395", "0.6399384", "0.63087946", "0.62378913", "0.6225148", "0.613402", "0.6119021", "0.6109298", "0.6109298", "0.6109298", "0.6109298", "0.6109298", "0.6109298", "0.6109298", "0.6084958", "0.60807896", "0.6055179", "0.6048664", "0.6028611",...
0.8127909
0
Registers an agent for a given protocol
def register_agent(protocol, method) @agents[protocol] ||= [] @agents[protocol] << method end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_route(protocol, verb, match, args, block)\n @routes[protocol] ||= {}\n @routes[protocol][verb] ||= {}\n @routes[protocol][verb][match] = { block: block, args: args }\n end", "def addIntegratedAgent(agentType, number)\n sparkGetOrCreate(agentType, \"/usr/agent/behavior#{number}\")\...
[ "0.6175731", "0.60469025", "0.56989896", "0.5605349", "0.5595373", "0.5490863", "0.5482821", "0.5424783", "0.5400096", "0.5351687", "0.52645296", "0.5255932", "0.52305067", "0.5226975", "0.5182538", "0.516854", "0.51369965", "0.5130666", "0.51134086", "0.50905484", "0.50619",...
0.79970634
0
Search tweets by a given hashtag
def search_tweets(hashtag, limit=nil) response = @api_client.get(URI::SEARCH_TWEETS_URI, { q: hashtag }) parse(response["statuses"], Tweet, limit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_hashtag tag\r\n response = RestClient.get 'https://api.twitter.com/1.1/search/tweets.json', params: {q: tag, count: 100}, Authorization: 'Bearer AAAAAAAAAAAAAAAAAAAAAJr1YQAAAAAAHA%2FAKcuAEPhPSJgFqwcwKMU0wPk%3DwHtz3CIM3eluP3XQDNfXobhvApEBTpyYeWrJ31ZxUukMm1idUj'\r\n \r\n tweets = Array.new\r\n ...
[ "0.786559", "0.70724624", "0.7044038", "0.67189395", "0.6654703", "0.66081345", "0.64987886", "0.6498344", "0.64723086", "0.647077", "0.6418027", "0.6353146", "0.6273627", "0.6231163", "0.62058735", "0.61588436", "0.6149703", "0.6138472", "0.61268276", "0.611978", "0.6103617"...
0.8034926
0
Returns the trending topics of a specific location
def trending_topics(place_name) trend_place = trend_place place_name return [] unless trend_place response = @api_client.get(URI::TRENDS_PLACE_URI, { id: trend_place.woeid }) parse(response.first["trends"], TrendTopic) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trending_topics\n result = http_get(\"/services/data/v#{self.version}/chatter/topics/trending\")\n result = JSON.parse(result.body)\n result[\"topics\"].collect { |topic| topic[\"name\"] }\n end", "def trends_for_location(woeid)\n get(\"/trends/woeid.json\")\n end", "def get_top_t...
[ "0.7107592", "0.65736765", "0.6197617", "0.59110135", "0.58057374", "0.57532185", "0.57294875", "0.57120955", "0.5641747", "0.5546724", "0.5515667", "0.54465514", "0.53115684", "0.5264469", "0.52175075", "0.5210418", "0.52099556", "0.5202828", "0.51767147", "0.5164857", "0.51...
0.71070224
1
Gets a trending place by its name
def trend_place(name) result = trend_places.select { |place| place.name == name } result.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thermostat_by_name(name)\n get_thermostat_list[name]\n end", "def trend_places\n unless @trend_places\n response = @api_client.get(URI::TRENDS_AVAILABLE_URI)\n @trend_places = parse(response, TrendPlace)\n end\n @trend_places\n end", "def find_place_by_name(name)...
[ "0.63267267", "0.62826926", "0.5901371", "0.58887357", "0.58827543", "0.5746215", "0.55124944", "0.54633963", "0.5371115", "0.5334187", "0.53219926", "0.5285247", "0.5279488", "0.52783775", "0.5262516", "0.5180041", "0.5168695", "0.5143423", "0.51381654", "0.5133909", "0.5117...
0.8895687
0
Gets the list of available trending places
def trend_places unless @trend_places response = @api_client.get(URI::TRENDS_AVAILABLE_URI) @trend_places = parse(response, TrendPlace) end @trend_places end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_trends\n get(\"/trends/available.json\")\n end", "def trends_available\n get(\"/trends/available.json\")\n end", "def trend_place(name)\n result = trend_places.select { |place| place.name == name }\n result.first\n end", "def get_top_trends\n trend_info = TrendDa...
[ "0.7115518", "0.70925397", "0.6221117", "0.613681", "0.6134587", "0.6049063", "0.5965551", "0.5928157", "0.58572835", "0.5847778", "0.58309585", "0.5720882", "0.57152", "0.5708173", "0.5680905", "0.5561453", "0.5534669", "0.5534342", "0.55010283", "0.5491372", "0.54575056", ...
0.8330911
0
Write a method doubler(numbers) that takes an array of numbers and returns a new array where every element of the original array is multiplied by 2.
def doubler(numbers) for i in 0..numbers.length-1 numbers[i] = numbers[i] * 2 end return numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doubler(numbers)\n i = 0\n while i < numbers.length\n numbers[i] = numbers[i] * 2\n i += 1\n end\n return numbers\nend", "def doubler(numbers)\n\ti = 0\n \tarry = []\n while i < numbers.length\n arry[i] = (numbers[i] * 2)\n i += 1\n end\n return arry\nend", "def doub...
[ "0.8574097", "0.85129863", "0.8465674", "0.8351801", "0.8328212", "0.8328212", "0.83187604", "0.82634646", "0.8250204", "0.8225381", "0.8177026", "0.8117311", "0.8075488", "0.80465776", "0.7993254", "0.7940878", "0.79216826", "0.7864355", "0.78322417", "0.78284985", "0.782826...
0.8527882
1
=> [0, 1, 2, 3, 4, 5] Write a method even_nums(max) that takes in a number max and returns an array containing all even numbers from 0 to max
def even_nums(max) result = [] for i in 0..max if i % 2 == 0 result << i end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def even_nums(max)\n\tnums = []\n \n\ti = 0\n\twhile i <= max\n\t\tif i % 2 == 0\n\t\t\tnums << i\n\t\tend\n\t\ti += 1\n end\n \n\treturn nums\nend", "def even_nums(max)\n newArr = []\n i = 0\n while i <= max\n if i % 2 == 0\n newArr << i\n end\n i+=1\n ...
[ "0.898293", "0.8922356", "0.8877437", "0.8869091", "0.8843788", "0.87982416", "0.8775659", "0.8520126", "0.8483905", "0.8481901", "0.82940036", "0.7843022", "0.7834552", "0.7819242", "0.77006257", "0.76632875", "0.7618263", "0.7555351", "0.74703306", "0.7427411", "0.7410777",...
0.90669405
0
=> [0, 2, 4] Write a method range(min, max) that takes in two numbers min and max. The method should return an array containing all numbers from min to max inclusive.
def range(min, max) arr = [] for i in min..max arr << i end return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range(min, max)\n\trange = []\n\n\ti = min\n\twhile i <= max\n\t\trange << i\n\t\ti += 1\n end\n \n\treturn range\nend", "def range(min, max)\n range_array = []\n\n i = min\n while i <= max\n range_array << i\n i += 1\n end\n return range_array\nend", "def range(min, max)\n newArr = []\n ...
[ "0.8845579", "0.87488735", "0.8737674", "0.86709464", "0.8605762", "0.8596706", "0.85399276", "0.8503928", "0.85034466", "0.84849155", "0.8458498", "0.84506065", "0.8450415", "0.84041655", "0.8310817", "0.8255798", "0.82335085", "0.8197324", "0.8188142", "0.81831276", "0.8130...
0.908307
0
=> [13, 14, 15, 16, 17, 18, 19, 20] Write a method odd_range(min, max) that takes in two numbers min and max. The method should return an array containing all odd numbers from min to max (inclusive).
def odd_range(min, max) arr = [] for i in min..max if i % 2 != 0 arr << i end end return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def odd_range(min, max)\n odd_array = []\n\n i = min\n while i <= max\n if !(i % 2 == 0)\n odd_array << i\n end\n i += 1\n end\n return odd_array\nend", "def odd_range(min, max)\n\trange = []\n \n\ti = min\n\twhile i <= max\n\t\tif i % 2 != 0\n\t\t\trange << i\n\t\tend\n \ti += 1\n end\n\...
[ "0.91625875", "0.9149611", "0.91041297", "0.9104014", "0.90760964", "0.9059862", "0.90551066", "0.9053691", "0.90464216", "0.8996464", "0.8974433", "0.8859939", "0.86995274", "0.75627553", "0.75402725", "0.74536115", "0.7453113", "0.7441406", "0.74346805", "0.74079275", "0.73...
0.92094904
0
=> ["a", "b", "c"] Write a method factors_of(num) that takes in a num and returns an array of all positive numbers less than or equal to num that can divide num.
def factors_of(num) newArray = [] for i in 1..num if num % i == 0 newArray << i end end return newArray end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factors(num)\n arr = []\n (1..num).each do |el|\n arr << el if num % el == 0\n end\n arr\nend", "def get_factors(num)\n factors = []\n (1..num).each do |i|\n factors << i if num % i == 0\n end\n factors\nend", "def factors_of(num)\n factor_arr = []\n\n (1...num).reverse_each do ...
[ "0.85079217", "0.8405685", "0.8402973", "0.84005535", "0.8397201", "0.83905894", "0.83654016", "0.8344545", "0.8316149", "0.83086795", "0.8287173", "0.82860476", "0.8280745", "0.8278737", "0.8269172", "0.8258123", "0.8249336", "0.8240385", "0.82390684", "0.82041514", "0.82004...
0.8550452
0
=> [1, 2, 4, 8, 16] Write a method select_odds(numbers) that takes in an array of numbers and returns a new array containing the odd numbers of the original array.
def select_odds(numbers) odds = [] for i in 0..numbers.length-1 number = numbers[i] if number % 2 == 1 odds << number end end return odds end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_odds(numbers)\n i = 0\n newArr = []\n while i < numbers.length\n if numbers[i] % 2 != 0\n newArr << numbers[i]\n end\n i += 1\n end\n return newArr\n end", "def select_odds(numbers)\n odds = []\n \n i = 0\n while i < numbers.length\n num = numbers[i...
[ "0.8683489", "0.8666567", "0.8601302", "0.85997313", "0.857787", "0.85571694", "0.85410047", "0.8539657", "0.8506436", "0.84974676", "0.830998", "0.795029", "0.7807525", "0.7768047", "0.7726033", "0.77177083", "0.76140624", "0.7580739", "0.75426894", "0.75360376", "0.75264555...
0.8680838
1
=> ["coding"] Write a method fizz_buzz(max) that takes in a number max and returns an array containing all numbers greater than 0 and less than max that are divisible by either 4 or 6, but not both.
def fizz_buzz(max) newArray = [] for i in 0..max if (i > 0) && (i < max) if (i % 4 == 0) ^ (i % 6 == 0) newArray << i end end end return newArray end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizz_buzz(max)\n array = []\n i = 1\n while i < max\n if (i % 4 == 0 || i % 6 == 0) && !(i % 4 == 0 && i % 6 == 0)\n array << i\n end\n i += 1\n end\n return array\n end", "def fizz_buzz(max)\n\ti = 0\n\tnewArr = []\n \twhile i < max\n if (i % 4 == 0 || i % 6 == 0)...
[ "0.89253086", "0.8875855", "0.88595915", "0.8832928", "0.88128203", "0.88065135", "0.87962687", "0.8792733", "0.8760639", "0.87457", "0.8654584", "0.8654584", "0.8654584", "0.8651261", "0.8604999", "0.8590447", "0.8589591", "0.84957993", "0.838564", "0.83600163", "0.8152778",...
0.88931733
1
=> "dog" Write a method abbreviate_sentence that takes in a sentence string and returns a new sentence where every word longer than 4 characters has all of it's vowels removed.
def abbreviate_sentence(sent) arrSent = sent.split(" ") arrSent.each_with_index do |word, i| if (word.length > 4) arrSent[i] = removeVowels(word) end end return arrSent.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abbreviate_sentence(sent)\n\t# create an array of vowels\n \t# split the sent into an array of words\n \t# for each word check length\n \t# if the length is greater than 4\n \t# remove vowels\n \t# rejoin the words into a sentence\n \t# return the sentence\n \tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"...
[ "0.8526886", "0.84745854", "0.8461983", "0.82952803", "0.82261264", "0.8199499", "0.81776863", "0.8126281", "0.8047585", "0.79760015", "0.7659377", "0.7228922", "0.6995793", "0.6786302", "0.67667776", "0.67222613", "0.6653975", "0.66426134", "0.6618934", "0.65501225", "0.6527...
0.8528412
0
=> 1 Write a method two_d_Sum that takes in a two dimensional array and returns the sum of all elements in the array.
def two_d_sum(arr) sum = 0 arr.each do |subArray| subArray.each do |i| sum += i end end return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend", "def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Level: Looking at each element (these are also arrays)\n\tarr.each do |sub_arr|\n\t\t# 2nd Level: Looking at each elements of t...
[ "0.8416878", "0.83250797", "0.828084", "0.828084", "0.82185096", "0.8196308", "0.8163566", "0.8155042", "0.8144679", "0.8126444", "0.78893054", "0.78340685", "0.77643275", "0.77393425", "0.76521575", "0.7471453", "0.7455374", "0.7451549", "0.7399624", "0.73658746", "0.7276464...
0.8496795
0
=> 15 Write a method two_d_translate that takes in a 2 dimensional array and translates it into a 1 dimensional array. You can assume that the inner arrays always have 2 elements. See the examples.
def two_d_translate(arr) result = [] arr.each do |subArray| subArray[1].times do result.push(subArray[0]) end end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_d_translate(array)\n new_arr = []\n array.each do |arr|\n arr[1].times {new_arr << arr[0]}\n end\n new_arr\nend", "def two_d_translate(array)\n new_array = []\n array.each do |sub_array|\n num = sub_array[1]\n ele = sub_array[0]\n num.times { new_array << ele }\n end\n\n n...
[ "0.8242566", "0.81129843", "0.8007369", "0.7886983", "0.77109647", "0.696043", "0.64696956", "0.6413495", "0.6255781", "0.6198274", "0.6194414", "0.6185604", "0.59455556", "0.5884937", "0.58704716", "0.58655834", "0.5847222", "0.5801862", "0.5733307", "0.5714181", "0.5713297"...
0.81361765
1
Write a method array_translate that takes in an array whose elements alternate between words and numbers. The method should return a string where each word is repeated the number of times that immediately follows in the array.
def array_translate(array) translated = "" i = 0 while i < array.length array[i+1].times do translated += array[i] end i += 2 end return translated end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array_translate(array)\n repeatedWords = \"\"\n i = 0\n while i < array.length-1\n word = array[i]\n num = array[i+1]\n num.times { repeatedWords += word }\n i += 2\n end\n return repeatedWords\nend", "def array_translate(array)\n string = ''\n i = 0 \n while i < array.length\n word = ...
[ "0.8533519", "0.81096375", "0.809352", "0.77164215", "0.7497859", "0.67145693", "0.6661675", "0.6550794", "0.6483316", "0.6478313", "0.6466801", "0.63998264", "0.63459605", "0.63429517", "0.63153887", "0.62890804", "0.6263792", "0.62335104", "0.61760145", "0.61720103", "0.616...
0.8300302
1
Write a method pig_latin_word that takes in a word string and translates the word into pig latin. Pig latin translation uses the following rules: for words that start with a vowel, add 'yay' to the end for words that start with a nonvowel, move all letters before the first vowel to the end of the word and add 'ay'
def pig_latin_word(word) vowels = "a,e,i,o,u" if ( vowels.include?(word[0]) ) return word + "yay" end for i in (0...word.length) if (vowels.include?(word[i])) return word[i..-1] + word[0...i] + "ay" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pig_latin_word(word)\n vowels = ['a', 'e', 'i', 'o', 'u']\n new_word = \"\"\n if vowels.include?(word[0])\n return word + \"yay\"\n else\n word.each_char.with_index do |ch, i|\n if vowels.include?(ch)\n return word[i..-1] + word[0...i] + \"ay\"\n end\n end\n end\nend", "def pig...
[ "0.88183206", "0.8762925", "0.87556225", "0.874727", "0.87249637", "0.87059313", "0.8698528", "0.8697842", "0.8689196", "0.868914", "0.86884886", "0.8655124", "0.8622742", "0.86216134", "0.85121554", "0.8484406", "0.8476905", "0.84470737", "0.8441698", "0.83979356", "0.838734...
0.8815958
1
Creates a new site with the following hash of params
def new_site_create(params={}) study_study_sites.set params[:site_name] site_number.set params[:site_number] study_site_number.set params[:study_site_number] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def add_site(params = {})\n ...
[ "0.84066904", "0.76149136", "0.7341002", "0.7287444", "0.7101143", "0.70805013", "0.69474393", "0.69323605", "0.6917551", "0.68723804", "0.68667364", "0.6857505", "0.68564796", "0.6827238", "0.6804464", "0.67890376", "0.6784501", "0.6779655", "0.6774595", "0.6774595", "0.6774...
0.79995894
1
Click "Save" button on create new site page
def new_site_save active_submit.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_and_publish\n frm.button(:value=>\"Save Settings and Publish\").click\n PublishAssessment.new(@browser)\n end", "def save\n frm.button(:name=>\"modifyPartForm:_id89\").click\n EditAssessment.new(@browser)\n end", "def rcpstsave; det.button(:id, 'Save'); end", "def save\n frm.button(...
[ "0.7266189", "0.69730747", "0.67513955", "0.67185616", "0.6701944", "0.6529622", "0.65205586", "0.65205586", "0.65204567", "0.63999015", "0.6387916", "0.6387916", "0.6355929", "0.63298833", "0.63298833", "0.63298833", "0.63298833", "0.6311629", "0.62703526", "0.6241217", "0.6...
0.87496483
0
Click "Cancel" button on create new site page
def new_site_cancel inactive_submit.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_site_save\n active_submit.click\n end", "def cancel\n # renders static page\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "de...
[ "0.68436563", "0.67573017", "0.6535316", "0.6535316", "0.6535316", "0.6512621", "0.6444489", "0.6342136", "0.6310178", "0.6268724", "0.6231675", "0.6207267", "0.6205393", "0.6152787", "0.6152054", "0.61390066", "0.60782945", "0.6027824", "0.6023993", "0.602398", "0.6020167", ...
0.86551553
0
takes: yaml hash of challenge sideeffects: starts docker file assoc'd with challenge returns: port
def instance_for(challenge) instance_id = `docker run -P -d #{challenge['name']}`.chomp port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1] [instance_id, port] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_container(image, expose_port)\n container = Docker::Container.create('Image' => image, 'HostConfig' => {'PortBindings' => {\"#{expose_port}/tcp\" => [{}]}})\n container.start\n Container.new(container, expose_port)\nend", "def docker_port(internal_port, container_name = name)\n docker_runner = ...
[ "0.6083517", "0.5960663", "0.59486383", "0.5750025", "0.57488865", "0.57214546", "0.5659507", "0.5633942", "0.5603436", "0.5573363", "0.55502105", "0.55168486", "0.5438298", "0.5421741", "0.5386713", "0.53547376", "0.533725", "0.5334277", "0.53322923", "0.52907354", "0.525326...
0.68846923
0
returns a list of challenge_name, port pairs if challenge does not require a docker instance port is 'no_instance'
def spawn_instances(challenges) challenges.map do |name, challenge| if challenge["launch_docker_per_user"] instance_id, port = instance_for(challenge) [name, instance_id, port] else nil end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_for(challenge) \n instance_id = `docker run -P -d #{challenge['name']}`.chomp\n port = `docker port #{instance_id} #{challenge['port']}`.chomp.split(/:/)[1]\n [instance_id, port]\n end", "def parsed_host\n sockets = new_resource.host.split if new_resource.host.is_a?(String)\n so...
[ "0.76364493", "0.5691045", "0.5523591", "0.5472322", "0.5430002", "0.54140794", "0.5397674", "0.53830034", "0.5359004", "0.5315205", "0.5295982", "0.527089", "0.5264788", "0.5255176", "0.5226939", "0.5209415", "0.51996404", "0.5173631", "0.5170366", "0.5156287", "0.51230437",...
0.66988754
1
Estimates the value of a continued fraction _cfrac_, to _prec_ decimal digits of precision. Returns a BigDecimal. _cfrac_ must respond to _cfrac.a(n)_ and _cfrac.b(n)_ for integer _n_ >= 1.
def estimate(cfrac, prec) last_result = nil terms = prec loop do # Estimate continued fraction for _n_ from 1 to _terms_. result = cfrac.a(terms) (terms - 1).downto(1) do |n| a = BigDecimal cfrac.a(n) b = BigDecimal cfrac.b(n) digits = [b.div(result, 1).exponent + prec, 1].max ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def continued_fraction(n)\n a0 = Math.sqrt(n).floor\n cf = [a0]\n\n m = 0\n d = 1\n loop do\n m = d * cf.last - m\n d = (n - m**2)/d\n a = (a0 + m)/d\n cf << a\n\n break if a == 2 * a0\n end\n\n cf\nend", "def evaluate_continued_fraction(values)\n if values.size == 1\n Rational(...
[ "0.6617217", "0.59139323", "0.566841", "0.5384026", "0.5373698", "0.53725785", "0.52124274", "0.5207719", "0.51851255", "0.5183488", "0.5143063", "0.5135529", "0.5128044", "0.51021445", "0.51021445", "0.5093387", "0.5018731", "0.50061727", "0.49996945", "0.49890342", "0.49401...
0.7654763
0
save to either file or io Pass Filename as string or any io object
def save(file) case file when String io = File.open(file, 'wb') when IO , StringIO io = file else raise "must pass io or filename, not #{file}" end @object.write io io.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save_as(filename = T.unsafe(nil)); end", "def save filename = nil\n filename = find_free_name filename\n save! filename\n end", "def save(filename)\n File.open(filename,'w') { |file| file << to_strin...
[ "0.72708225", "0.72708225", "0.72708225", "0.7247019", "0.71765554", "0.71416116", "0.71416116", "0.70575243", "0.70312136", "0.70058525", "0.6928527", "0.68677425", "0.6857072", "0.68515587", "0.6849894", "0.68176895", "0.68174183", "0.6813219", "0.6791145", "0.675507", "0.6...
0.77595615
0
GET /fpgas GET /fpgas.json
def index @fpgas = Fpga.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: @fiestas\n end", "def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end", "def show\n @gpath = Gpath.find(params[:id])\n\n respond_to do |format|\n ...
[ "0.6058296", "0.60418195", "0.6038542", "0.6000679", "0.5980615", "0.5970825", "0.5965185", "0.5964151", "0.5939613", "0.5936798", "0.5930423", "0.59169227", "0.59005386", "0.58913964", "0.5889094", "0.5878221", "0.5869121", "0.5867815", "0.5858476", "0.58306587", "0.581683",...
0.6113216
0
Runs percolator on the given files
def run puts "\n--------------------------------" puts "Running Percolator...\n\n" database = extractDatabase(@type).chomp("fasta") + "yml" revDatabase = extractDatabase(@type + "-r").chomp("fasta.reverse") + "yml" @proteins = Hash.new @decoyProteins = Hash.new outputs = [] threads ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n puts \"\\n--------------------------------\"\n puts \"Running Percolator...\\n\\n\"\n \n outputs = []\n threads = []\n tab_files = []\n \n # The format of the following function was chosen to rersult in the fastest processing time.\n proteins = load_target(':')\n GC.start\n ...
[ "0.70603234", "0.6369424", "0.63514096", "0.59817255", "0.5940837", "0.5863181", "0.58582616", "0.5705252", "0.565932", "0.5659123", "0.56218797", "0.55434257", "0.5489917", "0.5481454", "0.5467607", "0.54624045", "0.54322773", "0.5398696", "0.5391146", "0.5369736", "0.536973...
0.66447777
1
Find a cell by coordinate on the board
def find_cell(coordinate) storage.select do |cell| cell.coord_x == coordinate[0] && cell.coord_y == coordinate[1] end.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_cell(cells, x, y)\n cells.detect{|cell| cell.x == x && cell.y == y }\nend", "def get_cell(x, y)\n get_cell_from_board(@board, x, y)\n end", "def lookup(x, y, coordinate_system=:row_col)\n @board[index_for(x, y, coordinate_system)]\n end", "def cell(pos_x, pos_y)\n @board[pos_y][pos_x]\n ...
[ "0.8151031", "0.79680717", "0.7894082", "0.7860361", "0.78399044", "0.7523307", "0.74035084", "0.73560625", "0.73275673", "0.73115057", "0.7307433", "0.71515334", "0.7138523", "0.7099288", "0.7098568", "0.7091417", "0.70903254", "0.7073382", "0.7033868", "0.7033689", "0.70180...
0.8263035
0
Build a ship with an index cell using ship size
def build_ship_with_index_cell(ship_size, index_cell) cells = Array.new ship_size.times do |index| find_cell = storage.select do |cell| cell.coord_x == index_cell.coord_x && (cell.coord_y == index_cell.coord_y + index) end.first cells.push(find_cell) end cells ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put_ship(ship_size)\n free_field = free_fields.select { |field| field.count >= ship_size }.sample\n random = rand(0..free_field.count - ship_size)\n @ships << free_field.slice(random, ship_size)\n @ships.last.each { |cell| cell.ship = '#' }\n end", "def place_ship(size)\n span = free_squa...
[ "0.70522326", "0.6887314", "0.6432356", "0.6208922", "0.6174889", "0.6095279", "0.6090535", "0.60760975", "0.58822155", "0.5852676", "0.5807895", "0.577525", "0.5761754", "0.5707262", "0.5637901", "0.56270236", "0.5619079", "0.5564727", "0.5533258", "0.5532601", "0.5518809", ...
0.84793395
0
Set cells used by placed ship then add the ship to the board
def set_ship_cells(ship, cells) cells.each do |cell| cell.occupied! neighbors = get_neighbors_from_cell(cell) neighbors.each(&:blocked!) end ship.set_cells(cells) ships.push(ship) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_board\n # Create first ship\n set_ship(Ship.new(3))\n\n # Create second ship\n set_ship(Ship.new(4))\n end", "def place_ships!\n\t\t[\n\t\t\t['T', 2],\n\t\t\t['D', 3],\n\t\t\t['S', 3],\n\t\t\t['B', 4],\n\t\t\t['C', 5]\n\t\t].each do |ship|\n\t\t\tplace_ship(ship[0], ship[1])\n\t\te...
[ "0.759084", "0.7227665", "0.709662", "0.7078387", "0.699122", "0.69646174", "0.69387335", "0.69312173", "0.6887131", "0.682901", "0.6719157", "0.6708912", "0.67059743", "0.6702846", "0.6671047", "0.6643987", "0.6619431", "0.6600872", "0.6588347", "0.6567192", "0.6553457", "...
0.79075795
0
Same as name_singular with an 's' added.
def name_plural() name_singular + 's' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singularize\n MotionSupport::Inflector.singularize(self)\n end", "def singularize\n @name.pluralize.singularize\n end", "def singularize\n ActiveSupport::Inflector.singularize(self)\n end", "def singularize\n self.class.new Inflector.singularize(self)\n end", "def singulariz...
[ "0.7518615", "0.75049955", "0.74250066", "0.73610586", "0.73610586", "0.7188112", "0.70627564", "0.7025423", "0.69575673", "0.6950278", "0.69395494", "0.6859542", "0.6851433", "0.6846285", "0.673525", "0.66250926", "0.65774214", "0.6536538", "0.6508258", "0.65030414", "0.6480...
0.7754006
0
Filters the elements from a list by their index according to the specified ordinal. Ordinal may be specified as an integer or symbol (see ORDINALS). Results are provided either as a returned list or code block accepting a single parameter. If a block is given the return value becomes the original, unaltered, list.
def every(ordinal, list, &block) ordinal = ORDINALS_SYM_TO_I.fetch(ordinal) if ordinal.kind_of?(Symbol) rval = if block list else block = lambda { |x| rval << x } [] end list.each_with_index do |value, index| block.call(value) if index % ordinal == 0 end rval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index list, &block #were taking a list, and a block we want to find, find_index = func name\n list.index(&block) #look in list using .index(&block) to find the index of the block \nend", "def find_indexes(val=nil, &block)\n block = lambda{|e| e == val} if val\n (0...self.size).inject([]) do |list...
[ "0.5359396", "0.5336973", "0.48787406", "0.48787406", "0.48121363", "0.47955716", "0.47613445", "0.4761271", "0.4729062", "0.47227165", "0.47140682", "0.46976498", "0.46613586", "0.46534428", "0.46332088", "0.46249124", "0.46236175", "0.46205404", "0.46200004", "0.45931235", ...
0.62230086
0
Find record by one of the uniq field
def find_uniqable(uid) where_uniqable(uid).take end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_uniqable!(uid)\n where_uniqable(uid).take!\n end", "def find_record_by_unique_index(klass, obj_hash)\n found_records = unique_indices_per_class(klass).map(&:columns).map do |fieldnames|\n next nil if fieldnames.is_a?(String) # occurs for custom indices like for User\n next nil unles...
[ "0.72822964", "0.6495372", "0.6425367", "0.6304579", "0.6217342", "0.6169262", "0.6075009", "0.60444903", "0.6005712", "0.59258187", "0.58808494", "0.5843646", "0.5818153", "0.5799763", "0.5765351", "0.57462764", "0.57255703", "0.57235754", "0.5690501", "0.56863904", "0.56668...
0.73105854
0
Store the given data in S3
def store(data) establish_s3_connection bucket = s3keys["bucket"] ensure_bucket_exists(bucket) conn = AWS::S3.new obj = conn.buckets[bucket].objects[key] obj.write(data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(key, value)\n s3_write key, value\n end", "def store(s3_path, body, bucket, options = {})\n params = {\n key: s3_path,\n body: body,\n bucket: bucket\n }\n options.merge!({server_side_encryption: 'aws:kms',\n ssekms_key_id: key_id,\n...
[ "0.78965175", "0.7684282", "0.7572167", "0.75063175", "0.7454877", "0.74477994", "0.74097615", "0.73709285", "0.7369064", "0.73604786", "0.7347515", "0.72825146", "0.7200517", "0.7185136", "0.71557814", "0.71548796", "0.70490384", "0.69394875", "0.6928463", "0.6866463", "0.68...
0.9074475
0
Default s3 bucket for storing content
def default_s3_bucket "hydra_uploads" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bucket; ::AWS::S3.new({ secure: true }).buckets[DC::SECRETS['bucket']]; end", "def bucket; ::AWS::S3.new( { :secure => false } ).buckets[DC::SECRETS['bucket']]; end", "def configure_s3_bucket\n connection = Fog::Storage.new(:provider => 'AWS',\n :aws_access_...
[ "0.7821481", "0.7743046", "0.7734353", "0.75157785", "0.7465646", "0.74517876", "0.73194146", "0.72449106", "0.72134787", "0.71518165", "0.71358925", "0.7130043", "0.7092709", "0.70809466", "0.7029298", "0.7026511", "0.7004966", "0.6969741", "0.69690806", "0.69523376", "0.695...
0.79679507
0
========= Aspect config ======================= The aspect configuration form
def config(context={}, aspect_model) app = context[:app] template_path = File.expand_path(File.join(File.dirname(__FILE__),'..', 'views','gallery_aspect_config.erb')) template = Tilt.new(template_path) the_render = template.render(app) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(context={}, aspect_model)\n \n app = context[:app]\n template_path = File.expand_path(File.join(File.dirname(__FILE__),'..',\n 'views','photo_aspect_config.erb'))\n template = Tilt.new(template_path)\n the_render = template.render(app) \n \n end", "...
[ "0.711802", "0.6866496", "0.68339485", "0.67765814", "0.65666956", "0.6306745", "0.6167719", "0.60866404", "0.6086066", "0.59739333", "0.59069926", "0.5901864", "0.5884718", "0.5884718", "0.5884718", "0.5884718", "0.5884718", "0.5853454", "0.5829833", "0.57943004", "0.5752607...
0.7047549
1
Based off of: Example ps output: " RSS\n223124\n"
def call `ps -o rss -p #{@pid}`.split("\n").last.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rss\n `ps -o rss= -p #{ppid}`.chomp.to_i\n end", "def get_rss_usage()\n rss = 0\n open(\"/proc/#{Process.pid}/status\").each do |line|\n if line.start_with?(\"Rss\")\n pieces = line.split\n rss += pieces[1].to_i\n end\n end\n rss\nend", "def plist(psname)\n counter = 0\...
[ "0.6970279", "0.684459", "0.67805004", "0.66735244", "0.66735244", "0.6411416", "0.63636315", "0.6324839", "0.6324839", "0.6318947", "0.62906307", "0.6252032", "0.6252032", "0.6097198", "0.60302484", "0.59134346", "0.59130347", "0.5904184", "0.5876068", "0.5874483", "0.583630...
0.7007512
0
Decide your next move (return 1, 2 or 3)
def move(cakes, last) last == 1 ? 2 : 1 # I'm not greedy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_move\n\t\tif @next_move.nil?\n\t\t\t@next_move = determine_next_move\n\t\tend\n\n\t\t@next_move\n\tend", "def move(cakes, last)\n #last == 1 ? 2 : 1 # I'm not greedy\n if cakes == 1\n \n elsif cakes == 2\n \n else\n\n end\n end", "def next_move(player,board,move)\n completed...
[ "0.78500605", "0.72943896", "0.72768456", "0.7099582", "0.7097728", "0.70590776", "0.70352685", "0.69308716", "0.69133854", "0.6908821", "0.6859586", "0.6840601", "0.6816907", "0.680583", "0.68007827", "0.6792865", "0.67622364", "0.6758038", "0.67280245", "0.67021286", "0.667...
0.73248845
1
Converts table contents to a csv
def to_csv str = '' str << ( columns.join(",") + "\n" ) rows.each { |row| next if is_hr(row) || !row_visible(row) str << ( row.map{|x| x = x.to_s x.gsub(/[\r\n]/, ' ').gsub(/\s+/, ' ').gsub('"', '""') }.map{|x| "\"#{x}\"" }.join(",") + "\n" ) } str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_export_rawtable(table_name, data_array, options = {})\n column_definitions = []\n eval(\"#{table_name}.content_columns\").each do |column|\n column_definitions << [column.name, column.name]\n end\n csv_export(column_definitions, data_array, options)\n end", "def to_csv()\n all = gene...
[ "0.69128674", "0.6827728", "0.674299", "0.6708439", "0.6590313", "0.6589519", "0.6587907", "0.65523446", "0.6549414", "0.65385073", "0.6520209", "0.6504549", "0.6504549", "0.64811087", "0.645232", "0.6441355", "0.63731843", "0.63567823", "0.63322973", "0.633063", "0.6302384",...
0.73409384
0
Returns the header string.
def header_to_s # :nodoc: if (header) pad = " " * headeri return pad + header + "\n" + pad + "=" * header.length + "\n\n" end return '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_str\n \"\"\n end", "def header_data\n\t\treturn self.normalized_headers.to_s\n\tend", "def header_str\n @columns.collect {|c|\n if @table[c]\n #{}\"%#{@table[c][:size]}s\" % [@table[c][:name]]\n format_data(c, @table[c][:name])\n els...
[ "0.8419348", "0.7490921", "0.7462197", "0.73519236", "0.7268557", "0.7264322", "0.72216374", "0.7194318", "0.7178805", "0.71160424", "0.71147853", "0.7101692", "0.7094892", "0.7090319", "0.70503753", "0.70127153", "0.699408", "0.6966611", "0.695525", "0.6930632", "0.692135", ...
0.82035524
1
Adds a row using the supplied fields.
def <<(fields) add_row(fields) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_row!(*args)\r\n insert_row!(*args)\r\n end", "def add_row(fields = [])\n if fields.length != self.columns.length\n raise RuntimeError, 'Invalid number of columns!'\n end\n formatted_fields = fields.map.with_index { |field, idx|\n # Remove whitespace and ensure String format\n ...
[ "0.7145123", "0.70748174", "0.7053133", "0.6977701", "0.68865824", "0.6787493", "0.6781129", "0.6641597", "0.6585408", "0.65741247", "0.65673804", "0.655008", "0.64791787", "0.6418872", "0.6374143", "0.63501894", "0.6333289", "0.6327329", "0.6277296", "0.6250221", "0.6237207"...
0.83547443
0
Adds a row with the supplied fields.
def add_row(fields = []) if fields.length != self.columns.length raise RuntimeError, 'Invalid number of columns!' end formatted_fields = fields.map.with_index { |field, idx| # Remove whitespace and ensure String format field = format_table_field(field.to_s.strip, idx) if (colprops[i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def <<(fields)\n add_row(fields)\n end", "def append_row!(*args)\r\n insert_row!(*args)\r\n end", "def add_row(row)\n raise('Cannot add a row. No parameters have been set.') if rows.empty?\n\n # A quick 'deep clone' so that the input isn't modified\n row = Marshal.load(Marshal.dump(row))...
[ "0.84009427", "0.71458554", "0.7097552", "0.70501184", "0.69653344", "0.68385553", "0.68095815", "0.6755349", "0.6680185", "0.6599183", "0.65664786", "0.6529298", "0.65225685", "0.6466996", "0.6466202", "0.6462145", "0.6373703", "0.63580865", "0.6357651", "0.63487023", "0.633...
0.73227704
1
Sorts the rows based on the supplied index of subarrays If the supplied index is an IPv4 address, handle it differently, but avoid actually resolving domain names.
def sort_rows(index = sort_index, order = sort_order) return if index == -1 return unless rows rows.sort! do |a,b| if a[index].nil? cmp = -1 elsif b[index].nil? cmp = 1 elsif a[index] =~ /^[0-9]+$/ and b[index] =~ /^[0-9]+$/ cmp = a[index].to_i <=> b[index].to_i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_IPv4(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise ArgumentError, \"Expected an Array for 'list' but got a #{list.class}.\"\n\t\tend\n\t\tfiltered = Util.filter_IPv4(list)\n\t\treturn Util.quick_sort(filtered)\n\tend", "def sort_IPv4Net(list)\n\t\tif ( !list.kind_of?(Array) )\n\t\t\traise Argumen...
[ "0.5655211", "0.5639586", "0.5565148", "0.5565148", "0.54122305", "0.5387263", "0.52985096", "0.52479786", "0.5035555", "0.4943402", "0.49273947", "0.49246857", "0.49051026", "0.48976138", "0.48833504", "0.48610497", "0.48606485", "0.48373657", "0.4813708", "0.47896516", "0.4...
0.69862515
0
Returns if a row should be visible or not
def row_visible(row) return true if self.scterm.nil? row_to_s(row).match(self.scterm) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visible?\n end", "def visible?\n true\n end", "def is_visible?\n visibility && ( visibility > 0 )\n end", "def visible?\n @visible\n end", "def visible?\n @visible\n end", "def visible?\n\t\t\t@visible\n\t\tend", "def is_visible? index\n j = index - @prow #@toprow\n ...
[ "0.7543711", "0.7418503", "0.7407635", "0.73985505", "0.73985505", "0.7343203", "0.72892845", "0.7118802", "0.708632", "0.7085849", "0.7052874", "0.7014173", "0.6986289", "0.6971023", "0.69638133", "0.6939938", "0.69335157", "0.6917227", "0.6917227", "0.6917227", "0.6861673",...
0.79553074
0
Checks to see if the row is an hr.
def is_hr(row) # :nodoc: return ((row.kind_of?(String)) && (row == '__hr__')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_hr\n rows << '__hr__'\n end", "def convert_hr(ke)\n check_that_no_text_run_is_active\n @rt_current_document.p do |p|\n @rt_current_block_node = p\n p.style(paragraph_style_mappings['hr'])\n inner(ke)\n @rt_current_block_node = nil\n end\n ...
[ "0.63142234", "0.58819723", "0.57393163", "0.5684382", "0.56374294", "0.56344247", "0.5536364", "0.5523998", "0.552124", "0.5483951", "0.54831636", "0.5476059", "0.5450012", "0.5431394", "0.5422432", "0.53391653", "0.5336687", "0.5291765", "0.5282595", "0.52674687", "0.525985...
0.87714815
0
Converts an hr to a string.
def hr_to_s # :nodoc: return "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end_hour\n hour = DateTime.parse(self.datep.to_s).hour\n hour_s = ''\n if(hour < 10)\n hour_s = '0'+hour.to_s\n else\n hour_s = hour.to_s\n end\n hour_s\n end", "def formatted_hours\n as_hours hours\n end", "def formatted_hours\n as_hours hours\n end", "def ge...
[ "0.66217285", "0.62707084", "0.62707084", "0.6223517", "0.61213875", "0.60912794", "0.60778815", "0.60722524", "0.60172856", "0.6004104", "0.5987606", "0.5964559", "0.5955592", "0.5950191", "0.5921668", "0.5915246", "0.5914264", "0.59082294", "0.5860239", "0.5846618", "0.5834...
0.80515796
0
Pads out with the supplied character for the remainder of the space given some text and a column index.
def pad(chr, buf, colidx, use_cell_pad = true) # :nodoc: # Ensure we pad the minimum required amount max = colprops[colidx]['MaxChar'] || colprops[colidx]['MaxWidth'] max = colprops[colidx]['MaxWidth'] if max.to_i > colprops[colidx]['MaxWidth'].to_i encoding = buf.encoding.name if not ["UTF-8", "ASC...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(text)\n printf \"%s %-#{(columns / 3) - 5}s \" % [V_SEP, text]\n end", "def pad_around(text, padding, fill: SPACE)\n fill * padding.left + text + fill * padding.right\n end", "def Columnize( text, width, indent )\n\treturn indent + text.scan(/(.{1,#{width}})(?: |$)/).join(\"\\n#{indent}\")...
[ "0.6608815", "0.65528196", "0.6547787", "0.6326865", "0.6322309", "0.6296412", "0.62562305", "0.6238309", "0.61115485", "0.6105857", "0.60791016", "0.6031761", "0.6018704", "0.6014027", "0.60041976", "0.5975474", "0.59180665", "0.5913023", "0.5897583", "0.58696896", "0.586959...
0.6742799
0
generates skeleton itemdef.csv file
def generate_itemdef_header(name) itemdef=File.new('itemdef.csv','w') itemdef << "Name," << name << "\n" itemdef << "algFile,algorithm.js" << "\n" itemdef << "name,path,type,isDataItemValue,isDrillDown" << "\n" itemdef << "Source,source,TEXT,true,false" << "\n" itemdef.close; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"\n itemdef.close;\n end", "def dumpAugmented\n item_fields = []\n Item.fields.keys...
[ "0.74486196", "0.61823916", "0.61808676", "0.61258775", "0.60321844", "0.5991572", "0.59141684", "0.5875398", "0.5840354", "0.582527", "0.58183634", "0.57518184", "0.57203877", "0.56773204", "0.56665426", "0.5644689", "0.56416684", "0.5603266", "0.5536592", "0.55298924", "0.5...
0.7422283
1
adds skeleton line to itemdef.csv file
def generate_itemdef_line(type,name,isData,isDrill) itemdef=File.new('itemdef.csv','a') itemdef << name.underscore.humanize << "," << name << "," << type << "," << isData << "," << isDrill << "\n" itemdef.close; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_itemdef_header(name)\n itemdef=File.new('itemdef.csv','w')\n itemdef << \"Name,\" << name << \"\\n\"\n itemdef << \"algFile,algorithm.js\" << \"\\n\"\n itemdef << \"name,path,type,isDataItemValue,isDrillDown\" << \"\\n\"\n itemdef << \"Source,source,TEXT,true,false\" << \"\\n\"\n ite...
[ "0.65240747", "0.5857686", "0.5794292", "0.5697538", "0.5658045", "0.5568507", "0.5464334", "0.5449815", "0.53882635", "0.5376982", "0.53716016", "0.53704953", "0.5346296", "0.5345487", "0.5345487", "0.532989", "0.532989", "0.5276551", "0.5274603", "0.5253408", "0.52206236", ...
0.74306417
0
call generate_itemdef_line to generate a drill definition
def generate_itemdef_drill(type,name) generate_itemdef_line(type,name,true,true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_itemdef_data(type,name)\n generate_itemdef_line(type,name,true,false)\n end", "def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"...
[ "0.74963003", "0.7405387", "0.6677449", "0.59932244", "0.5944993", "0.57248545", "0.57096076", "0.57096076", "0.5699061", "0.56378996", "0.5483982", "0.54663956", "0.5458279", "0.5455993", "0.54271746", "0.5381392", "0.53674096", "0.5353488", "0.5326702", "0.53213984", "0.523...
0.84996927
0
call generate_itemdef_line to generate a profile item value definition
def generate_itemdef_profile(type,name) generate_itemdef_line(type,name,false,false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_itemdef_data(type,name)\n generate_itemdef_line(type,name,true,false)\n end", "def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"...
[ "0.68653804", "0.6244464", "0.6046593", "0.5682035", "0.5532932", "0.5297316", "0.52790165", "0.5244308", "0.5138275", "0.5116199", "0.50822186", "0.5066484", "0.5054217", "0.5041308", "0.5024399", "0.5002181", "0.49802062", "0.49136063", "0.48929355", "0.4849832", "0.4841478...
0.8146554
0
call generate_itemdef_line to generate a data item value definition
def generate_itemdef_data(type,name) generate_itemdef_line(type,name,true,false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_itemdef_line(type,name,isData,isDrill)\n itemdef=File.new('itemdef.csv','a')\n itemdef << name.underscore.humanize << \",\" << name << \",\" << type << \",\" << isData << \",\" << isDrill << \"\\n\"\n itemdef.close;\n end", "def generate_itemdef_drill(type,name)\n generate_itemdef_line(...
[ "0.7157484", "0.6860546", "0.6513595", "0.61390656", "0.60934657", "0.59272546", "0.5829301", "0.5655926", "0.5604409", "0.5592674", "0.5537579", "0.5537579", "0.5528084", "0.5512944", "0.5509529", "0.5486864", "0.5468909", "0.546087", "0.5349819", "0.51991075", "0.51762694",...
0.81946003
0
generate skeleton item_spec.rb Rspec file
def generate_spec_header() aspec=File.new('item_spec.rb','w') specHeader=<<EOF TEST_ROOT=ENV['AMEE_TEST_ROOT'] if !defined? AMEE_TEST_ROOT raise 'Please set AMEE_TEST_ROOT in your environment to point to internal/tests/api' if TEST_ROOT==nil require TEST_ROOT+'/spec_helper.rb' folder=folder_category(__FILE_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_item(item)\n item\n end", "def test_generic_item(item:)\n @assertions[:assert].append([\n item.class == Item,\n 'generic_item is not working'\n ])\n end", "def init\n puts '####### Recon Snippets Marked For Testing #######'\n Dir.glob(\"**/\") do |directory|\n next ...
[ "0.59335834", "0.5882778", "0.58778495", "0.5724703", "0.56957734", "0.5639738", "0.55968946", "0.54831254", "0.5442853", "0.5411595", "0.53956604", "0.53695095", "0.5366842", "0.5359731", "0.53307843", "0.53280675", "0.53280675", "0.5321521", "0.5318035", "0.53126323", "0.52...
0.62620157
0
Compute which torrents can now be unqueued based on the state of running torrents. Parameter torrentDatas should be an array of TorrentData that the decision will be based off. At a minimum these items should respond to 'paused', 'queued', 'state', 'queued='
def dequeue(torrentDatas) numActive = 0 numIncomplete = 0 torrentDatas.each do |torrentData| next if torrentData.paused || torrentData.queued numIncomplete += 1 if incomplete?(torrentData) numActive += 1 end @logger.debug "incomplete: #{numIncomplete}/#{@maxIncomple...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_completed_torrents(active_torrents = Torrent.active.all)\n active_torrents.each do |active_torrent|\n if active_torrent.stop_seeding?(self.setting.ratio)\n if remove_torrent(active_torrent)\n active_torrent.set_state(:completed)\n active_torrent.save!\n end\n ...
[ "0.46597913", "0.4627431", "0.45208803", "0.45004153", "0.44203347", "0.41928092", "0.41878986", "0.41241577", "0.41241577", "0.4086956", "0.4080011", "0.40716782", "0.40249476", "0.40131876", "0.40129945", "0.4007463", "0.39884436", "0.39822796", "0.39356637", "0.39356637", ...
0.73865116
0
Attaches a ruby module's own public methods and attaches them to the object named js_parent_name SECURITY NOTE: Do not pass untrusted input for `js_parent_name`
def attach_rb_functions(js_parent_name, rb_mod) raise TypeError unless rb_mod.is_a? ::Module singleton = rb_mod.singleton_class meth_syms = rb_mod.public_methods(false).select {|meth| rb_mod.method(meth).owner == singleton } # NOTE: the disadvantage of `attach`ing a `Method` object or lamd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_js(mod)\n extend mod\n mod.public_instance_methods.each do |method_name|\n add_function(sym_to_css(method_name)) { |tree, cxt|\n send method_name.to_sym, unquote(cxt.toCSS())\n }\n end\n end", "def attach_outer_class_methods!(inherited = false)\n outer_modul...
[ "0.59256935", "0.58507836", "0.57674265", "0.5640397", "0.55270743", "0.5278217", "0.522401", "0.5201238", "0.5129151", "0.5071017", "0.50021076", "0.49930295", "0.49697825", "0.49697825", "0.49697825", "0.49697825", "0.49697825", "0.49647045", "0.4935795", "0.48682076", "0.4...
0.7321915
1
Returns the fully qualified (dotted) name to the `exports` object of the new module. SECURITY NOTE: Do not pass untrusted input for `js_mod_name`
def define_cached_module(js_mod_name) # use bracket-syntax to handle non-identifier chars, e.g. 'source-map' mod_qname = "#{JS_MOD}._cache[#{js_mod_name.inspect}]" @runtime.eval(%Q|#{mod_qname} = new #{JS_MOD}("#{js_mod_name}")|) "#{mod_qname}.exports" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_module_name\n self.to_method_name.gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end", "def module_name\n (i = name.index(\"::\")) ? name[0..i-1] : name\n end", "def module_name\n File.basename(File.dirname(__FILE__)).sub(/^[A-Za-z]*?-/, '')\nend", "def define_cache...
[ "0.64543813", "0.62646073", "0.61227727", "0.6117231", "0.6019172", "0.6005609", "0.5966307", "0.58737504", "0.58104116", "0.5802014", "0.5791562", "0.5754696", "0.57336086", "0.5723149", "0.5699712", "0.5693992", "0.56347257", "0.5619008", "0.5586735", "0.5555203", "0.554719...
0.6276471
1
Campus Solutions will send a date string (ex. 23MAY16) that Rails incorrectly parses as a UTC Time object. We want the time casted to Pacific with the same time preserved, so that other time zones will automatically convert to the correct time relative to Berkeley's Pacific time zone
def cast_utc_to_pacific(utc_time) # Depending on the time of the year, we can either be in Pacific Daylight Time or Pacific Standard Time time_zone = Time.zone.now.zone Time.parse(utc_time.strftime("%Y-%m-%d %H:%M:%S #{time_zone}")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_parse(time)\n Time.find_zone(\"UTC\").parse(time)\n end", "def nyc_time(time)\n TZInfo::Timezone.get('America/New_York').local_to_utc(Time.parse(time))\nend", "def parse_datetime(dt, tz)\n offset = \"+00:00\"\n case tz\n when \"EST\"\n offset = \"−05:00\"\n when \"CST\"\n ...
[ "0.63583666", "0.61982846", "0.61422116", "0.6090578", "0.6060634", "0.60091746", "0.5995099", "0.59793615", "0.5948187", "0.5898249", "0.58930635", "0.579805", "0.5781557", "0.5717653", "0.56954604", "0.56679", "0.56654763", "0.5664146", "0.5663129", "0.5650599", "0.5648815"...
0.7448587
0
DELETE /languages/1 DELETE /languages/1.json
def delete @language = Language.find(params[:id]) @language.destroy respond_to do |format| format.html { redirect_to root_url, notice: t(:language_deleted) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @language.destroy\r\n respond_to do |format|\r\n format.html { redirect_to languages_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @lang = Lang.find(params[:id])\n @lang.destroy\n\n respond_to do |format|\n format.html { redirect_to ...
[ "0.7776024", "0.7758681", "0.76657397", "0.7512597", "0.75000715", "0.74715155", "0.74715155", "0.74615216", "0.7442635", "0.7354793", "0.73471606", "0.73123074", "0.73119617", "0.7291266", "0.7253621", "0.7145588", "0.71434", "0.7126188", "0.7112562", "0.7074144", "0.7016684...
0.79292005
0
PUT /teasers/1 PUT /teasers/1.json
def update @teaser = Teaser.find(params[:id]) respond_to do |format| if @teaser.update_attributes(params[:teaser]) format.html { redirect_to @teaser, notice: 'Teaser was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @tercero.update(tercero_params)\n format.html { redirect_to @tercero, notice: 'Tercero was successfully updated.' }\n format.json { render :show, status: :ok, location: @tercero }\n else\n format.html { render :edit }\n format.json {...
[ "0.6206008", "0.5988498", "0.5949391", "0.5937724", "0.589229", "0.58921957", "0.5879037", "0.5820236", "0.58175313", "0.578224", "0.5769059", "0.57280135", "0.57065845", "0.56770873", "0.56761885", "0.5629739", "0.5610019", "0.560266", "0.56001383", "0.5598439", "0.5576992",...
0.6043397
1
DELETE /teasers/1 DELETE /teasers/1.json
def destroy @teaser = Teaser.find(params[:id]) @teaser.destroy respond_to do |format| format.html { redirect_to teasers_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 @tea = Tea.find(params[:id])\n @tea.destroy\n\n respond_to do |format|\n format.html { redirect_to teas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tea = Tea.find(params[:id])\n @tea.de...
[ "0.7219144", "0.70133674", "0.70133674", "0.6973811", "0.6939457", "0.6856517", "0.6856517", "0.68178153", "0.67424995", "0.6740668", "0.6740643", "0.6721285", "0.6717832", "0.6712263", "0.67119193", "0.67029816", "0.6687822", "0.6683853", "0.6679046", "0.66712344", "0.666792...
0.7026371
1
Validation rule. Check YAML in Rule Scheme (if it is not blank)
def correct_yaml_in_rule_scheme error = false begin yaml = YAML.load(self.rule_scheme.to_s) rescue error = true end error = true if !yaml.blank? && yaml.is_a?(String) if error errors.add(:rule_scheme, "You should specify correct YAML format") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_pre_run!\n check_if_yml_present!\n check_if_yml_has_correct_content!\n check_if_rubocop_command_exists!\n end", "def validate_hook(value, rule, path, errors)\n case rule.name\n when 'Answer'\n if value['answer'] == 'bad'\n reason = value['reason...
[ "0.65601546", "0.5970895", "0.593425", "0.58446276", "0.58343136", "0.5834046", "0.5833038", "0.5811622", "0.5799605", "0.57440275", "0.5724485", "0.5707565", "0.5700155", "0.5699438", "0.56625503", "0.5633993", "0.5622617", "0.56140053", "0.55892104", "0.55561954", "0.554704...
0.6859181
0
PATCH/PUT /sub_sub_categories/1 PATCH/PUT /sub_sub_categories/1.json
def update respond_to do |format| if @sub_sub_category.update(sub_sub_category_params) format.html { redirect_to @sub_sub_category, notice: 'Sub sub category was successfully updated.' } format.json { render :show, status: :ok, location: @sub_sub_category } else format.html { ren...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @home_categories_sub = Home::Categories::Sub.find(params[:id])\n\n respond_to do |format|\n if @home_categories_sub.update_attributes(params[:home_categories_sub])\n format.html { redirect_to @home_categories_sub, notice: 'Sub was successfully updated.' }\n format.json { head ...
[ "0.72147757", "0.7091495", "0.7066405", "0.6977916", "0.6842864", "0.67612803", "0.6730822", "0.67071426", "0.6648692", "0.6647482", "0.66253775", "0.6624214", "0.6605597", "0.65739816", "0.654839", "0.6519204", "0.64607394", "0.64457816", "0.64419705", "0.6390648", "0.636803...
0.7199764
1
DELETE /sub_sub_categories/1 DELETE /sub_sub_categories/1.json
def destroy @sub_sub_category.destroy respond_to do |format| format.html { redirect_to sub_sub_categories_url, notice: 'Sub sub category was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @home_categories_sub = Home::Categories::Sub.find(params[:id])\n @home_categories_sub.destroy\n\n respond_to do |format|\n format.html { redirect_to home_categories_subs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subcategory = @category.subcateg...
[ "0.751564", "0.7491786", "0.74336755", "0.73594123", "0.73594123", "0.72011846", "0.7128434", "0.7073326", "0.7073326", "0.7057994", "0.70555836", "0.70271766", "0.6981176", "0.6941269", "0.69075865", "0.68956715", "0.68732667", "0.6807976", "0.6766779", "0.6744736", "0.67172...
0.75167745
0
Connect to the PubSub broker on given host and port. Returns true or false depending on connection success.
def connect(host = DEFAULT_HOST, port = DEFAULT_PORT) self.socket = create_socket(host, port) identify remote_host = socket.peeraddr[3] remote_port = socket.peeraddr[1] logger.info("Connected to #{remote_host}:#{remote_port}.") return true rescue Errno::ECONNREFUSED logg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n return true if @status == :connected\n connection_options = {\n host: @host,\n port: @port,\n user: @user,\n password: @password,\n path: @path,\n use_ssl: @use_ssl,\n }\n @server = ::XMLRPC::Client.new3(connection_options)\n @status ...
[ "0.6422809", "0.6169719", "0.600425", "0.5923078", "0.59027356", "0.585295", "0.58402705", "0.58249784", "0.57965124", "0.5760494", "0.5759205", "0.57502747", "0.57294536", "0.57122433", "0.57022434", "0.56943727", "0.5686807", "0.567738", "0.567257", "0.56587154", "0.5603158...
0.7570429
0
GET shows a single poem and its metadata
def show @poem = Poem.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @poem = Poem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poem }\n end\n end", "def show\n @poem = Poem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :x...
[ "0.7318247", "0.7318247", "0.70196784", "0.63961214", "0.625902", "0.62487507", "0.6236731", "0.62362355", "0.61060625", "0.60678405", "0.6023562", "0.6014882", "0.6012251", "0.60064834", "0.60064834", "0.60014004", "0.5999183", "0.5996718", "0.59944695", "0.5979964", "0.5965...
0.7735775
0
this controller action checks for titles and shares the poem if it's already been moved from the guest user to the current user
def create_from_guest @poem = current_user.poems.last # update the user's word_count current_user.word_count += @poem.text.split.size # then check for titles if current_user @titles = check_for_titles(@poem) @titles.each do |title| current_user.titles << title end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @poem = Poem.create\n\n @poem.text = params[:text]\n source_user = params[:source_user]\n @poem.source_user = source_user.slice(1, source_user.length - 1)\n\n @poem.user = current_or_guest_user\n\n if @poem.save\n # update the user's word_count\n current_or_guest_user.wor...
[ "0.58200604", "0.58154607", "0.58120817", "0.5790054", "0.57834375", "0.5777425", "0.5735426", "0.57022256", "0.56689566", "0.5658274", "0.5590571", "0.5583033", "0.5582956", "0.55733734", "0.5571554", "0.55314285", "0.55256414", "0.55255353", "0.55179936", "0.54934007", "0.5...
0.6231803
0
DELETE deletes a poem, redirects to user profile?
def destroy Poem.find(params[:id]).destroy redirect_to("/users/#{current_user.id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @poem = Poem.find(params[:id])\n @poem.destroy\n\n respond_to do |format|\n format.html { redirect_to(poems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if current_user == @user || current_user.has_role?(:admin)\n @poem = @user.poems.find(params[:id]...
[ "0.77763677", "0.7770235", "0.772524", "0.75837624", "0.73662126", "0.734079", "0.7113282", "0.70083046", "0.6951038", "0.6902939", "0.68872184", "0.6875182", "0.6859212", "0.68573606", "0.6855501", "0.6850567", "0.6843055", "0.68136203", "0.68128866", "0.68101", "0.68101", ...
0.8296887
0