query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
PUT /meetings/1 PUT /meetings/1.json
def update respond_to do |format| @meeting.assign_attributes(params[:meeting]) if @meeting.save format.js { head :no_content } format.html { redirect_to @meeting, notice: 'Meeting successfully updated.' } format.json { head :no_content } else format.js { render :json => { :errors => @meeting.errors.full_messages, :message => "Problem updating meeting" }, :status => :unprocessable_entity } format.html { render action: "edit" } format.json { render json: @meeting.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @meet = Meet.find(params[:id])\n\n respond_to do |format|\n if @meet.update_attributes(params[:meet])\n format.html { redirect_to @meet, notice: 'Meet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n...
[ "0.72705036", "0.7087441", "0.70748", "0.7035785", "0.7003606", "0.68186283", "0.6813398", "0.68023944", "0.6787627", "0.67767143", "0.67496496", "0.6708291", "0.67034614", "0.67008644", "0.67008644", "0.67008644", "0.67008644", "0.6624791", "0.66176903", "0.66145056", "0.661...
0.665047
17
Don't forget to edit routes if you're using RESTful routing resources :mitables,:only => [:index] do collection do post "post_data" end end
def post_data message="" mitable_params = { :id => params[:id],:name => params[:name] } case params[:oper] when 'add' if params["id"] == "_empty" mitable = Mitable.create(mitable_params) message << ('add ok') if mitable.errors.empty? end when 'edit' mitable = Mitable.find(params[:id]) message << ('update ok') if mitable.update_attributes(mitable_params) when 'del' Mitable.destroy_all(:id => params[:id].split(",")) message << ('del ok') when 'sort' mitables = Mitable.all mitables.each do |mitable| mitable.position = params['ids'].index(mitable.id.to_s) + 1 if params['ids'].index(mitable.id.to_s) mitable.save end message << "sort ak" else message << ('unknown action') end unless (mitable && mitable.errors).blank? mitable.errors.entries.each do |error| message << "<strong>#{Mitable.human_attribute_name(error[0])}</strong> : #{error[1]}<br/>" end render :json =>[false,message] else render :json => [true,message] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n end", "def post\r\n end", "def post; end", "def POST; end", "def post(action, **args); end", "def post!\n request! :post\n end", "def post #:doc:\n end", "def post_data; end", "def resources\n end", "def post(path, &block)\n route 'POST', path, &block\n end", "...
[ "0.6439683", "0.64208996", "0.63138205", "0.6310512", "0.5756737", "0.572568", "0.5692782", "0.5648987", "0.5638468", "0.5631488", "0.5602358", "0.55650145", "0.5497305", "0.5496314", "0.5492152", "0.5489555", "0.5469127", "0.54505086", "0.54271", "0.53854126", "0.53293496", ...
0.61198235
4
SMELL: not documented not used
def table_name_convention(a_string) # TODO: i dunnot know what I was thinking get_location unless String == a_string.class error "Expected a String #{location}" else unless a_string.valid_naming_convention? error "#{a_string} is not a supported naming convention #{location}" else @params[:table_name_convention] = a_string end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def internal; end", "def usage; end", "def usage; end", "def diagnostic; end", "def schubert; end", "def probers; end", "def refutal()\n end", "def weber; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal?; end", "def ...
[ "0.7762896", "0.6830991", "0.66511047", "0.66511047", "0.66358227", "0.66228867", "0.6590401", "0.65068626", "0.6412899", "0.63817376", "0.63817376", "0.63817376", "0.63817376", "0.6342607", "0.6308739", "0.6308739", "0.62979585", "0.62944484", "0.62944484", "0.62944484", "0....
0.0
-1
specify the naming convention to be used to column names.
def column_name_convention(a_string) # TODO: i dunnot know what I was thinking get_location unless String == a_string.class error "Expected a String #{location}" else unless a_string.valid_naming_convention? error "#{a_string} is not a supported naming convention #{location}" else @params[:column_name_convention] = a_string end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_column_name(name)\n name.to_s\n end", "def underscore_name_to_attr_name(uname)\n uname = uname.to_s\n \n column_family, column = uname.split('_', 2)\n if column\n \"#{column_family}:#{column}\"\n else\n \"#{column_family}:\"\n ...
[ "0.6531201", "0.6360271", "0.63457614", "0.6314111", "0.6234826", "0.6231589", "0.6200184", "0.6191714", "0.6184183", "0.6113845", "0.6110116", "0.60759825", "0.60666174", "0.605355", "0.5997282", "0.5993281", "0.59886813", "0.59879756", "0.59553677", "0.5925382", "0.5913659"...
0.69190717
0
identify the .xls file which is the source of data can be overriden on the command line TODO: add support for .xlsx and .csv files
def source(a_string) get_location unless String == a_string.class error "Expected a String #{location}" else a_path = Pathname.new(a_string.strip) unless a_path.absolute? a_path = configatron.config.parent + a_path end unless a_path.exist? error "File does not exist #{location}" else unless '.xls' == a_path.extname.to_s.downcase error "File is not of type *.xls #{location}" else @params[:source] = a_path end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isExcelFile(fileName,input_type)\n if ( input_type==\"excel\")\n return true\n end\n \n ext=fileName.split(\".\").last\n if(ext==\"xls\")\n return true\n end\n return false\n end", "def setup(g,file,rs_name = nil)\r\n systemos #Determine whether the OS is Chinese or Engl...
[ "0.6752331", "0.6442249", "0.63890976", "0.62581515", "0.6196474", "0.6097601", "0.6044729", "0.5967621", "0.5930815", "0.59044987", "0.58670294", "0.5848794", "0.583105", "0.58177036", "0.58028775", "0.57047826", "0.56566787", "0.55713993", "0.5540317", "0.5538132", "0.54758...
0.5586997
17
A title to use when generating filenames. optional. Can be derived from source
def title(a_string) get_location unless String == a_string.class error "Expected a String #{location}" else @params[:title] = a_string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title(title)\n filename(title)\n @methods[:title] = title\n end", "def generate_filename(title)\n \"#{formatted_current_timestamp}-#{slug_for(title)}.md\"\nend", "def title\n filename.nil? ? nil : File.basename(filename)\n end", "def title\n #Flip off the part after t...
[ "0.8092859", "0.80878985", "0.7883752", "0.7818617", "0.7780545", "0.770116", "0.7674418", "0.76554406", "0.7640373", "0.7605903", "0.76044273", "0.75839305", "0.7580371", "0.75526565", "0.7547637", "0.75407827", "0.7532925", "0.75247747", "0.751033", "0.7497945", "0.7495087"...
0.0
-1
add additional columns not found in the spreadsheet
def add_columns(*new_columns) options = Hash.new new_columns.each {|c| options[c] = true} @params[:add_columns] = FEATURE_DEFAULTS[:add_columns].merge(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increase_columns(column)\n @sheet_data.each do |r|\n r.size.upto(column) do\n r << nil\n end\n end\n end", "def exsiting_columns_for_audit\n columns_for_audit & self.column_names\n end", "def add_rows(sheet)\n # Do nothing\n end", "def columns\n super + [:extra_colu...
[ "0.64278793", "0.62962586", "0.61902595", "0.61566466", "0.6104712", "0.60735536", "0.5991677", "0.5903247", "0.5846993", "0.58414537", "0.58097345", "0.5790595", "0.57803655", "0.5778014", "0.5772491", "0.57579404", "0.5723472", "0.56683236", "0.5637034", "0.56285226", "0.56...
0.54912716
29
generate a model definition file
def model(options={}) get_location # TODO: validate options @params[:model] = FEATURE_DEFAULTS[:model].merge(options) @params[:model][:generate] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_file\n template 'model.rb.tt', model_file_path\n end", "def generate_model\n template 'model.rb.erb', \"app/models/#{file_name}.rb\"\n end", "def build_model\n \n return if skip_method(__method__)\n\n filename = singular_table_name + '.rb'\n \n template = File.read(t...
[ "0.76392025", "0.7538047", "0.74536633", "0.73998815", "0.7367192", "0.7337746", "0.71649206", "0.71416897", "0.67860687", "0.66943735", "0.6488221", "0.64414227", "0.6401163", "0.6392492", "0.63478696", "0.6347553", "0.6331017", "0.62633854", "0.62197584", "0.6201181", "0.61...
0.61764723
20
generate a migration file
def migration(options={}) get_location # TODO: validate options @params[:migration] = FEATURE_DEFAULTS[:migration].merge(options) @params[:migration][:generate] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_migration_file\r\n migration_template 'migration.rb', 'db/migrate/create_baby_dove_model_data.rb'\r\n end", "def create_migration_file\n migration_template \"migration.rb\", \"db/evolver/migrations/#{file_name}.rb\"\n end", "def create_migration_file\n return unless options[:m...
[ "0.79778904", "0.79759955", "0.79644233", "0.7916426", "0.7879745", "0.7842109", "0.78382653", "0.782617", "0.7809157", "0.7716621", "0.76108736", "0.75918347", "0.7554804", "0.7522433", "0.7454992", "0.7427676", "0.73597", "0.7343886", "0.7241023", "0.7237632", "0.72200286",...
0.65509725
42
generate a CSV file
def csv(options={}) get_location # TODO: validate options @params[:csv] = FEATURE_DEFAULTS[:csv].merge(options) @params[:csv][:generate] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_string\n CSV.generate do |csv|\n header.write_header csv\n records.each {|r| r.write_record csv}\n end\n end", "def generate_csv\n\n fields = @resource[:class].typus_fields_for(:csv).collect { |i| i.first }\n\n require 'csv'\n if CSV.const_defined?(:Reader)\n ...
[ "0.7835827", "0.7729191", "0.7663026", "0.7663026", "0.76504636", "0.75950533", "0.7575194", "0.75688905", "0.75613874", "0.7538122", "0.74804074", "0.7473622", "0.7433351", "0.74097836", "0.73781586", "0.73684597", "0.7357823", "0.7344197", "0.72960925", "0.72869474", "0.723...
0.68571746
64
generate an SQL file for create table
def sql(options={}) get_location # TODO: validate options @params[:sql] = FEATURE_DEFAULTS[:sql].merge(options) @params[:sql][:generate] = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\tsql = \"CREATE TABLE `#{@table}` (\"\n\t\t@columns.each do |column|\n\t\t\tsql += \"`#{column[:name]}` #{column[:type]}\"\n\t\t\tif(column[:not_null])\n\t\t\t\tsql += ' NOT NULL'\n\t\t\tend\n\n\t\t\tif(column[:primary_key])\n\t\t\t\tsql += ' PRIMARY KEY'\n\t\t\tend\n\n\t\t\tif(column[:auto_incremen...
[ "0.75927454", "0.7583499", "0.74196696", "0.7332496", "0.73186964", "0.72953784", "0.727687", "0.70110863", "0.6982844", "0.6889269", "0.68788713", "0.68707705", "0.6864758", "0.68628824", "0.6853274", "0.6824214", "0.6811196", "0.6790294", "0.6770594", "0.6760561", "0.674357...
0.0
-1
establish a usersupplied default converter procedure
def converter(a_lamda=nil, &block) if a_lamda.nil? if block_given? # TODO: same the block in such a way that it can be called @params[:converter] = block else error "converter statement without a procedure #{location}" end else unless Proc == a_lamda.class error "converter expects a proc/lamda but got a #{a_lamda.class} #{location}" else @params[:converter] = a_lamda end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converter\n end", "def converters=(_arg0); end", "def converter; end", "def converter\n\n end", "def converters; end", "def converters; end", "def converters; end", "def convert\n end", "def convert\n end", "def initialize(call=DefaultConverterPath)\n self.converter_call = ca...
[ "0.7275993", "0.70637184", "0.7014629", "0.6870548", "0.667293", "0.667293", "0.667293", "0.6536041", "0.6536041", "0.6502562", "0.6452198", "0.6413149", "0.6374017", "0.6122299", "0.6073457", "0.60251445", "0.5995404", "0.5992406", "0.5894581", "0.58886915", "0.5769406", "...
0.6359585
13
specify a columnspecific transformation support for null, name, type, converter procedure
def transform(a_string, a_hash) get_location unless String == a_string.class error "Expected a String for the column heading; got #{a_string.class} #{location}" else if @params[:transforms].include? a_string error "Duplicate transform for #{a_string} #{location}" else unless Hash == a_hash.class error "Expected a Hash; got #{a_hash.class} #{location}" else error_cnt = configatron.errors.size valid_keys = TRANSFORM_HASH_KEYS.keys a_hash.keys.each do |a_key| unless valid_keys.include? a_key error "#{a_key} is not one of #{valid_keys.join(', ')} #{location}" else unless TRANSFORM_HASH_KEYS[a_key].include?(a_hash[a_key].class) error "Expected type #{TRANSFORM_HASH_KEYS[a_key]} for #{a_key} value; got #{a_hash [ a_key].class} #{location}" end end end unless configatron.errors.size > error_cnt @params[:transforms][a_string] = a_hash end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_custom_transformation\n end", "def transformation\n end", "def column_transform_params\n params.require(:column_transform).permit(:internal, :external)\n end", "def set_column_transform\n @column_transform = ColumnTransform.find(params[:id])\n end", "def transformed_columns\n ...
[ "0.65987825", "0.60709643", "0.6014492", "0.59775317", "0.5904188", "0.58713573", "0.58507293", "0.5779768", "0.5753463", "0.5736417", "0.56975055", "0.56864214", "0.566941", "0.56242776", "0.5621884", "0.56113726", "0.56102103", "0.5594869", "0.5589561", "0.55715173", "0.557...
0.48511952
85
SMELL: don't think this is used
def convert_naming_convention(a_string) a_string.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def internal; end", "def used?; end", "def suivre; end", "def internship_passed; end", "def anchored; end", "def custom; end", "def custom; end", "def...
[ "0.7847085", "0.6980797", "0.66752625", "0.66752625", "0.66752625", "0.66752625", "0.66697454", "0.6550703", "0.6354891", "0.63427263", "0.63342303", "0.6318342", "0.62919796", "0.62919796", "0.624182", "0.624182", "0.6229345", "0.6229179", "0.62018406", "0.6196482", "0.61817...
0.0
-1
get the location within the config file that is current being processed
def get_location parts = caller[1].split(':') @location = "Near Line # #{parts[1]} in file #{parts[0]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end", "def path\n @path ||= File.dirname @config_file\n end", "def configuration_file_path; end", "def config_path\n @config_path ||= local_config_path\n end", "def config_file\n ...
[ "0.7557534", "0.7480502", "0.7424438", "0.73284256", "0.7303024", "0.7285054", "0.7229301", "0.71037644", "0.708567", "0.699112", "0.6958996", "0.6944672", "0.6908869", "0.68936354", "0.68599766", "0.68599766", "0.6850002", "0.6810245", "0.67984825", "0.6788488", "0.6772038",...
0.0
-1
return the last config file location processed
def location @location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end", "def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end", "def path\n @path ||= File.dirname @config_file\n end", ...
[ "0.7264904", "0.69395", "0.6727095", "0.67222595", "0.6699027", "0.6630023", "0.6612076", "0.65800345", "0.6571223", "0.6545441", "0.6415121", "0.64094603", "0.63483864", "0.63412905", "0.63031733", "0.6299691", "0.6267197", "0.6263434", "0.6213647", "0.6206153", "0.6151085",...
0.0
-1
return the params hash
def params @params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def params_to_hash\n {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def params\n @params ||= {}\n end", "def to_h\n @params\n end", "def get_params()\n return s...
[ "0.8148096", "0.7990319", "0.7990319", "0.79853725", "0.79853725", "0.7837303", "0.7821434", "0.75673616", "0.75623727", "0.75040096", "0.7497431", "0.74138546", "0.74138546", "0.74138546", "0.7402548", "0.7381414", "0.73599726", "0.7355713", "0.73541284", "0.73541284", "0.73...
0.7399008
15
the default converter is used for all columns that do not have a columnspecific converter
def default_converter(v) if v.respond_to?(:downcase) v = v.chomp.gsub("\n",' ').strip.downcase.gsub('"',"'") end return v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converters; end", "def converters; end", "def converters; end", "def converter\n end", "def converter\n\n end", "def converters=(_arg0); end", "def converter; end", "def apply_default_r_converters(obj)\n apply_converters(Engine.default_r_converters, obj)\n end", "def converters\...
[ "0.6945257", "0.6945257", "0.6945257", "0.6783187", "0.6697875", "0.6490601", "0.64075977", "0.6399055", "0.63362974", "0.62437856", "0.61486036", "0.6053007", "0.5967891", "0.5924754", "0.59141546", "0.5867479", "0.58334744", "0.579551", "0.56499106", "0.5647265", "0.5625567...
0.0
-1
whose first and second elements are 1. To generate further elements of the sequence we take the sum of the previous two elements. For example the first 6 f fibonacci numbers are 1, 1, 2, 3, 5, 8. Write a method fibonacci that takes in a number length and returns the fibonacci sequence up to the given length.
def fibonacci(length) if length == 0 return [] elsif length == 1 return [1] end sequence = [1, 1] while sequence.length < length sequence << sequence[-1] + sequence[-2] # last second to the last end return sequence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci(length)\n\tif length == 0\n \treturn []\n end\n \n \tif length == 1\n return [1]\n end\n \n \tseq = [1, 1]\n \n \t(2...length).each do |i|\n \tseq.push(seq[-1] + seq[-2])\n end\n \t\n \treturn seq\nend", "def fibonacci(length)\n if length == 0\n return []\n elsif le...
[ "0.87689537", "0.8719297", "0.8641708", "0.8603421", "0.859734", "0.8582378", "0.8532891", "0.8531202", "0.8452332", "0.8365866", "0.82785803", "0.82716393", "0.8226", "0.81604666", "0.8151344", "0.8133061", "0.8126566", "0.8111332", "0.81062204", "0.8103464", "0.80964255", ...
0.86506134
2
Only allow a list of trusted parameters through.
def room_message_params params.require(:room_message).permit(:message , :room_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
t.integer "big_decimal", :limit => 38, :precision => 38, :scale => 0
def test_schema_dump_keeps_id_column_when_id_is_false_and_id_column_added output = standard_dump match = output.match(%r{create_table "string_ids"(.*)do.*\n(.*)\n}) assert_not_nil(match, "string_ids table not found") assert_match %r((:id => false)|(id: false)), match[1], "no table id not preserved" assert_match %r{t.string[[:space:]]+"id",[[:space:]]+null: false$}, match[2], "non-primary key id column not preserved" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_limit; end", "def bigdecimal(n)\n return object(n.to_f) #, :as => :bigdecimal\n end", "def bigdecimals cols\n decode_values :bigdecimal, cols, true\n end", "def bigdecimal cols\n decode_values :bigdecimal, cols\n end", "def type_literal_generic_bigdecimal(column)\n type_lit...
[ "0.75374144", "0.68683285", "0.6844216", "0.67442083", "0.6625326", "0.6618025", "0.6475162", "0.6419278", "0.6343691", "0.62214506", "0.61576253", "0.6109943", "0.6070085", "0.60670084", "0.60356903", "0.59497964", "0.59302396", "0.5928317", "0.5905456", "0.58603513", "0.585...
0.0
-1
GET /driver_divisions GET /driver_divisions.json
def index @driver_divisions = DriverDivision.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end", "def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end"...
[ "0.76625097", "0.7011232", "0.692191", "0.6645468", "0.6504483", "0.6450532", "0.64086276", "0.63111514", "0.62673485", "0.62673485", "0.6221795", "0.6189193", "0.6189193", "0.6189193", "0.6113854", "0.601864", "0.59935415", "0.5991273", "0.5967308", "0.59471196", "0.5937042"...
0.7002434
2
GET /driver_divisions/1 GET /driver_divisions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n end\n end", "def index\n @driver_divisions = DriverDivision.all\n end", "def index\n @divisions = Division.all\n\n respond_to do |format|\n format.html # index.html.e...
[ "0.74812144", "0.70090455", "0.692394", "0.645352", "0.63907903", "0.63727635", "0.6368076", "0.63414", "0.63405716", "0.63232106", "0.6270652", "0.61569333", "0.6033211", "0.595528", "0.59528553", "0.5923576", "0.59072834", "0.58638686", "0.5859609", "0.585561", "0.58149326"...
0.0
-1
POST /driver_divisions POST /driver_divisions.json
def create @driver_division = DriverDivision.new(driver_division_params) respond_to do |format| if @driver_division.save format.html { redirect_to @driver_division, notice: 'Driver division was successfully created.' } format.json { render action: 'show', status: :created, location: @driver_division } else format.html { render action: 'new' } format.json { render json: @driver_division.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_division\n \t@division = @company.divisions.create(name: params[:division][:name])\n respond_to do |format|\n format.json { render json: @division }\n end\n end", "def division\n @divisions = @company.divisions\n respond_to do |format|\n format.json { render json: @divisions}\n...
[ "0.7089112", "0.6783945", "0.62043774", "0.6105622", "0.6083931", "0.6034409", "0.6003828", "0.6003489", "0.59626603", "0.5940203", "0.5922666", "0.58896863", "0.57982284", "0.5733271", "0.57291836", "0.5619491", "0.55585694", "0.5467834", "0.5459173", "0.54408324", "0.541030...
0.64614785
2
PATCH/PUT /driver_divisions/1 PATCH/PUT /driver_divisions/1.json
def update respond_to do |format| if @driver_division.update(driver_division_params) format.html { redirect_to @driver_division, notice: 'Driver division was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @driver_division.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @pagetitle = \"Edit division\"\n \n @division = Division.find(params[:id])\n \n @company = Company.find(@division[:company_id])\n \n @locations = @company.get_locations()\n\n respond_to do |format|\n if @division.update_attributes(params[:division])\n format.html { ...
[ "0.64860547", "0.6323063", "0.6301547", "0.6291269", "0.6053657", "0.59707314", "0.59505093", "0.59472597", "0.5863914", "0.5800904", "0.57763743", "0.5772624", "0.57699007", "0.5750951", "0.5747803", "0.57342106", "0.5663994", "0.5652498", "0.56029785", "0.55953664", "0.5588...
0.65110403
0
DELETE /driver_divisions/1 DELETE /driver_divisions/1.json
def destroy @driver_division.destroy respond_to do |format| format.html { redirect_to driver_divisions_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @division = Division.find(params[:id])\n @division.destroy\n\n respond_to do |format|\n format.html { redirect_to league_divisions_url(params[:league_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @team_division = TeamDivision.find(params[:id])\n ...
[ "0.7206395", "0.71708864", "0.7169035", "0.685216", "0.68418616", "0.6841087", "0.6831877", "0.68251693", "0.6824383", "0.68012637", "0.6796668", "0.675556", "0.6688383", "0.6607724", "0.65910894", "0.6583156", "0.6575403", "0.65703976", "0.656936", "0.65615416", "0.6544008",...
0.7746219
0
Use callbacks to share common setup or constraints between actions.
def set_driver_division @driver_division = DriverDivision.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def driver_division_params params.require(:driver_division).permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6979893", "0.6781746", "0.6746611", "0.6742344", "0.6735229", "0.6592651", "0.65027124", "0.6498011", "0.648163", "0.647716", "0.64556813", "0.64386255", "0.63784456", "0.63756156", "0.636574", "0.6319542", "0.63004524", "0.6299559", "0.62925464", "0.62923217", "0.6289894"...
0.0
-1
1,507,537 One million, five hundred and seven thousand, five hundred and thirty seven For each base unit, add a new segment of text if the unit is used The segment has: 1) a connective fragment 2) recursion of numbertoenglish 3) text of base unit Millions: No intro, "One ", "million" Thousands: ", ", "five hundred and seven" + " ", "thousand" Hundreds: ", ", "five ", "hundred" Thirties: " and ", No recursion, "thirty" Sevens: " ", No recursion, "seven" Convert from positive integer to English words
def english_number original_number current_number = original_number exploded_number = [] # Convert number into an array of multiples of base units CONVERSIONS.each do |base_pair| if current_number >= base_pair[:number] * 2 # Enter the multiple and the base unit as elements if necessary exploded_number << current_number / base_pair[:number] exploded_number << base_pair current_number %= base_pair[:number] elsif current_number >= base_pair[:number] # Enter just the base unit if there's no integer multiple exploded_number << base_pair current_number %= base_pair[:number] end # Otherwise enter nothing end # Eg array [{1000000}, 507, {1000}, 5, 100, 30, 7] # Reduce array to an English translation english_result = exploded_number.reduce(["",:start]) { |text_string, base_pair| # Add a space unless it's the start of the string text_string[0] += ' ' unless text_string[1] == :start # Convert current number to English if it's a multiple if base_pair.class == Integer text_string[0] += english_number(base_pair) text_string[1] = :multiple elsif base_pair[:number] >= ONE_PREFIX_BOUNDARY # Otherwise, if it's >= 100 and preceding unit is not a multiple add 'one' text_string[0] += 'one ' unless text_string[1] == :multiple text_string[0] += base_pair[:name] text_string[1] = :above_boundary else # Otherwise, if it's <100 and transitioning from >=100, add 'and' text_string[0] += 'and ' if text_string[1] == :above_boundary text_string[0] += base_pair[:name] text_string[1] = :below_boundary end text_string }[0] return english_result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_w # to_w is for 'to words'\n # Numbers up to 20 are quite irregular. We need a specific block of code for tens\n tens = lambda do |x|\n if x < 20\n @@english_numbers[x.to_s.to_sym]\n else\n decs = x.to_s[0] + '0'\n units = x.to_s[-1]\n \"#{@@english_numbers[decs.t...
[ "0.7343849", "0.7320311", "0.72288245", "0.717714", "0.7082865", "0.7051821", "0.7025093", "0.6945073", "0.6917222", "0.6911974", "0.6906785", "0.689075", "0.68855166", "0.68804485", "0.6837052", "0.6770351", "0.6766934", "0.67592335", "0.6753624", "0.6744613", "0.6736644", ...
0.76147616
0
translit if russian, arab ou greek
def translit_non_latin_lang(lang) case lang when "ar","ru","el" self.translit else self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latin\n @input = I18n.transliterate(@input)\n end", "def return_in_latin(input)\n input.tr('αβεηικμνορτχυζ'.upcase, 'abehikmnoptxyz'.upcase) \n end", "def to_french(string)\nend", "def return_in_greek(input)\n input.tr('abehikmnoptxyz'.upcase, 'αβεηικμνορτχυζ'.upcase)\n end", "def mozar...
[ "0.6839606", "0.6568888", "0.6503671", "0.6452151", "0.6376865", "0.63059545", "0.6303212", "0.6240042", "0.61692005", "0.61512625", "0.6116592", "0.6090438", "0.6070963", "0.60345054", "0.6025144", "0.6025144", "0.6025144", "0.5978489", "0.59733", "0.5958292", "0.595365", ...
0.6893539
0
basicly transform modern html to html3
def purify_html doc= Nokogiri::XML::DocumentFragment.parse(self.to_s) doc.search(".//strong").each do |e| e.swap "<b>#{e.inner_html}</b>" end doc.search(".//h4").each do |e| e.swap "<b>#{e.inner_html}</b>" end doc.search(".//h3").each do |e| e.swap "<b>#{e.inner_html}</b>" end doc.search(".//h2").each do |e| e.swap "<b>#{e.inner_html}</b>" end doc.search(".//h1").each do |e| e.swap "<b>#{e.inner_html}</b>" end doc.search(".//em").each do |e| e.swap "<i>#{e.inner_html}</i>" end doc.search(".//ul").each do |e| e.swap "#{e.inner_html}" end doc.search(".//ol").each do |e| e.swap "#{e.inner_html}" end doc.search(".//li").each do |e| e.swap "<p>#{e.inner_html}</p>" end doc.search(".//span").each do |e| e.swap "#{e.inner_html}" end doc.to_xml(:encoding => "UTF-8").gsub(/\n/," ").gsub(/\s+/," ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_html(text)\n auto_html text do\n html_escape :map => {\n '&' => '&amp;',\n '>' => '&gt;',\n '<' => '&lt;',\n '\"' => '\"'\n }\n image\n youtube :width => 510, :height => 332\n vimeo :width => 510, :height => 332\n link :target => :_blank\n ...
[ "0.6602241", "0.6492628", "0.60499495", "0.6017393", "0.59905297", "0.5936943", "0.59368366", "0.59282064", "0.5895091", "0.5895091", "0.5894633", "0.5833436", "0.5821649", "0.5821575", "0.5744255", "0.57253337", "0.5723425", "0.5696464", "0.56925154", "0.5646747", "0.5642935...
0.6336448
2
cut html to len
def clean_truncate_html(len=30, ellipsis="...") Nokogiri::HTML::DocumentFragment.parse(HTML_Truncator.truncate(self, len, :ellipsis => ellipsis, :length_in_chars => true)).to_xhtml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_chars\n html_remove.without_garbage.split(\"\\n\").join.split.join.length\n end", "def truncate_html(len = 30, opts = {})\n opts = {:word_cut => true, :tail => ' ...'}.merge(opts)\n p = REXML::Parsers::PullParser.new(self)\n tags = []\n new_len = len\n results...
[ "0.76808333", "0.72605026", "0.69666815", "0.6925993", "0.6787027", "0.6717881", "0.66864175", "0.6644896", "0.6635166", "0.6380679", "0.6162317", "0.60855633", "0.6036048", "0.59566635", "0.59394133", "0.5933162", "0.5918903", "0.5911518", "0.5901594", "0.58954906", "0.58135...
0.69560605
3
curl G d is "&api_key=ed08eba2bd5ef47bab6cb1944686fed2&country=de&cat_id=135&geo=53.66,10.1154"
def initialize(api_key=nil) @api_key = api_key @api_key ||= SocialMediaMonitoring.api_key @api_path = '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getToolsGeocode( building_number, address1, address2, address3, district, town, county, province, postcode, country)\n params = Hash.new\n params['building_number'] = building_number\n params['address1'] = address1\n params['address2'] = address2\n params['address3'] = address3\n params['dist...
[ "0.62340945", "0.6116737", "0.6074198", "0.5967966", "0.5939782", "0.59158045", "0.58426875", "0.57641244", "0.5710368", "0.5709127", "0.56927884", "0.56901276", "0.5671625", "0.56536895", "0.5650116", "0.56480366", "0.56368434", "0.5636644", "0.56345415", "0.5633469", "0.562...
0.0
-1
Highschool only. Returns a list of students in the educator's sections that have low grades, but haven't been commented on anywhere yet. The intention is that this information is immediately actionable for high school teachers. This method returns hashes that are the shape of what is needed in the product.
def students_with_low_grades_json(time_now, time_threshold, grade_threshold) all_assignments = assignments(time_now, time_threshold, grade_threshold) by_student = all_assignments.group_by(&:student) json = by_student.map do |student, assignments| { student: student.as_json(:only => [:id, :email, :first_name, :last_name, :grade, :house]), assignments: assignments.map {|assignment| serialize_assignment(assignment) } } end json.as_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_and_homeroom_grade_levels_now(school_id)\n return [] if @educator.homeroom.nil?\n homeroom_grade = @educator.homeroom.grade\n student_grades = @educator.homeroom.students\n .where(school_id: school_id)\n .active\n .map(&:grade)\n\n ([homeroom_grade] + student_grades).uniq\n ...
[ "0.5880035", "0.58608127", "0.57579565", "0.57356685", "0.56430817", "0.563222", "0.56047934", "0.5600773", "0.5598638", "0.5574871", "0.55423164", "0.5536688", "0.55308074", "0.5494664", "0.54908705", "0.5485164", "0.54522496", "0.54490167", "0.5420968", "0.53638744", "0.535...
0.6017889
0
Send down all field for UI
def as_json(assignments) assignments.map {|assignment| serialize_assignment(assignment) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ing_form; end", "def display_all_fields\n @@all_fields\n end", "def text_field; end", "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "def form_escolher\n lst_from.select 'London'\n lst_on.select 'December'\n ...
[ "0.59013623", "0.5822822", "0.57796556", "0.567234", "0.5641464", "0.5603545", "0.5584871", "0.5579258", "0.55744326", "0.5568157", "0.5530074", "0.5521647", "0.55049723", "0.5500864", "0.5489575", "0.5489575", "0.54673517", "0.5446852", "0.54312164", "0.5412727", "0.5412727"...
0.0
-1
Section assignments where a student is struggling. Does not respect authorization.
def assignments_below_threshold(student_ids, grade_threshold) educator_sections = @authorizer.authorized { @educator.sections } StudentSectionAssignment .includes(:student) .where(section: educator_sections.map(&:id)) .where(student_id: student_ids) .where('grade_numeric < ?', grade_threshold) .order(grade_numeric: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a default course, it shows up as a course here\n all_sections.map(&:course).compact.uniq\n end", "def restrict_to_stude...
[ "0.62098527", "0.61824495", "0.61726695", "0.6073467", "0.6070367", "0.60466045", "0.60127485", "0.59854484", "0.59832597", "0.59731954", "0.5904237", "0.5903872", "0.58644116", "0.5855133", "0.58189124", "0.58138573", "0.5807895", "0.5791123", "0.5766162", "0.5756051", "0.57...
0.55894494
36
Students who've commented recently
def recently_commented_student_ids(student_ids, time_threshold) recent_notes = EventNote .where(is_restricted: false) .where(student_id: student_ids) .where('recorded_at > ?', time_threshold) .where(event_note_type_id: @event_note_type_ids) recent_notes.map(&:student_id).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commenters # the user who commented on you\n self.comments.map do |comment|\n comment.user\n end\n end", "def recent_logged_in_student_count(x)\n if self.students.present?\n self.students.select { |s| s.current_sign_in_at > x.hours.ago.to_i if s.current_sign_in_at.present?}.size\n else...
[ "0.636527", "0.6206454", "0.59297645", "0.58138996", "0.5768315", "0.5719642", "0.5719642", "0.56944144", "0.5629152", "0.5626018", "0.56200254", "0.5574538", "0.5556375", "0.55541134", "0.55471903", "0.5483787", "0.54687417", "0.5458405", "0.5455283", "0.54450417", "0.543441...
0.68163073
0
TODO move these to config
def encode_options {invalid: :replace, undef: :replace, replace: '?'} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configurations; end", "def private; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; ...
[ "0.67437696", "0.65500736", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807", "0.65249807"...
0.0
-1
binding.pry stops execution at that point
def game_hash game_hash = { :home => { :team_name =>"Brooklyn Nets", :colors => ["Black", "White"], :players => [ { :player_name => "Alan Anderson", :number => 0, :shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, :blocks => 1, :slam_dunks => 1 }, { :player_name => "Reggie Evans", :number => 30, :shoe => 14, :points => 12, :rebounds => 12, :assists => 12, :steals => 12, :blocks => 12, :slam_dunks => 7 }, { :player_name => "Brook Lopez", :number => 11, :shoe => 17, :points => 17, :rebounds => 19, :assists => 10, :steals => 3, :blocks => 1, :slam_dunks => 15 }, { :player_name => "Mason Plumlee", :number => 1, :shoe => 19, :points => 26, :rebounds => 11, :assists => 6, :steals => 3, :blocks => 8, :slam_dunks => 5 }, { :player_name => "Jason Terry", :number => 31, :shoe => 15, :points => 19, :rebounds => 2, :assists => 2, :steals => 4, :blocks => 11, :slam_dunks => 1 } ] }, :away => { :team_name =>"Charlotte Hornets", :colors => ["Turquoise", "Purple"], :players => [ { :player_name => "Jeff Adrien", :number => 4, :shoe => 18, :points => 10, :rebounds => 1, :assists => 1, :steals => 2, :blocks => 7, :slam_dunks => 2 }, { :player_name => "Bismack Biyombo", :number => 0, :shoe => 16, :points => 12, :rebounds => 4, :assists => 7, :steals => 22, :blocks => 15, :slam_dunks => 10 }, { :player_name => "DeSagna Diop", :number => 2, :shoe => 14, :points => 24, :rebounds => 12, :assists => 12, :steals => 4, :blocks => 5, :slam_dunks => 5 }, { :player_name => "Ben Gordon", :number => 8, :shoe => 15, :points => 33, :rebounds => 3, :assists => 2, :steals => 1, :blocks => 1, :slam_dunks => 0 }, { :player_name => "Kemba Walker", :number => 33, :shoe => 15, :points => 6, :rebounds => 12, :assists => 12, :steals => 7, :blocks => 5, :slam_dunks => 12 } ] } } game_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pry\n # rubocop:disable Lint/Debugger\n binding.pry\n # rubocop:enable Lint/Debugger\n end", "def some_method\n binding.pry\n end", "def bad_method(msg)\n binding.pry\n puts \"=> #{msg}\" + 3\nend", "def testing_method(stuff)\n\tputs stuff[\"down\"]\n\n\tbinding.pry\n\n\tthe_ending = \"ca...
[ "0.7797513", "0.7607206", "0.7497005", "0.71993345", "0.7146127", "0.7089775", "0.7075648", "0.7047956", "0.69465846", "0.69181424", "0.68222904", "0.6799525", "0.67498326", "0.6723222", "0.6701834", "0.6647029", "0.6572831", "0.6541702", "0.6529853", "0.6521968", "0.6514664"...
0.0
-1
A specific edge from +v+ to +w+
def edge(v, w) (@from_store[v] || []).find{ |e| e.to == w } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(u, v, w)\n super(u,v)\n @weights[[u,v]] = w\n end", "def add_edge(v, w)\n if (!@vertices.include?(v))\n @vertices.push(v)\n @adjacency_list[@vertices.find_index(v)] = []\n end\n if (!@vertices.include?(w))\n @vertices.push(w)\n @adjacency_list[...
[ "0.71171457", "0.6833856", "0.6746564", "0.63329774", "0.6306467", "0.6250251", "0.62038517", "0.6148275", "0.61277384", "0.6091152", "0.6050118", "0.601923", "0.6011067", "0.59875375", "0.594521", "0.591421", "0.5899001", "0.5875689", "0.58334833", "0.5830305", "0.5813059", ...
0.7810205
0
Outedges from vertex +v+
def edges_from(v) @from_store[v] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_neighbors(vertex)\n\tend", "def remove_edge(u, v)\n raise NotImplementedError\n end", "def remove_redundant_edges(in_vtx, out_vtx, index)\n @edges.each do |edge|\n if edge && edge.index == index\n # when in-vertices are eq and out-vertices are substrings or vice versa\n if...
[ "0.7485977", "0.6791106", "0.6562114", "0.65548927", "0.64569926", "0.63984567", "0.6335572", "0.627307", "0.6267463", "0.62167084", "0.61558914", "0.61556965", "0.6146242", "0.6127339", "0.6119081", "0.6116818", "0.61055434", "0.6098937", "0.6078915", "0.6063757", "0.6058439...
0.56621057
40
Inedges to vertex +v+
def edges_to(v) @to_store[v] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_neighbors(vertex)\n\tend", "def inward_vertices(vertex, a_lists)\n inward = []\n adj_lists.each do |v|\n adj_vertices(v.name, a_lists).each do |adj_v|\n if adj_v == vertex\n inward << v.name\n break\n end\n end\n end\n inward\n end", "def out_neighb...
[ "0.65878916", "0.6541987", "0.6345443", "0.6326934", "0.63226306", "0.62278295", "0.6213754", "0.62014526", "0.61699903", "0.61472934", "0.61381596", "0.61234987", "0.61100435", "0.6104613", "0.60846996", "0.60743666", "0.6055282", "0.60518366", "0.6038563", "0.60078216", "0....
0.58433187
34
Adds a vertex if it doesn't already exist and returns it
def add_vertex(v) @from_store[v] ||= Set.new @to_store[v] ||= Set.new v end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex(vertex)\n @reversal = nil\n return false if vertex?(vertex)\n setup_vertex(vertex)\n true # don't return the VertexWrapper instance.\n end", "def add_vertex(vertex)\n raise TypeError, 'Argument is not an instance of Vertex' unless vertex.instance_of? Vertex\n r...
[ "0.7596828", "0.7498249", "0.7386513", "0.7386513", "0.7298791", "0.7295201", "0.7270029", "0.71932405", "0.71896744", "0.71784675", "0.7118932", "0.71140987", "0.71140987", "0.7082545", "0.7072336", "0.70068526", "0.697701", "0.69510514", "0.68556786", "0.6835569", "0.682685...
0.7196746
7
Adds an edge and associated vertices if they don't already exist and returns the edge
def add_edge(e) add_vertex(e.from); add_vertex(e.to) (@from_store[e.from].add?(e) && @to_store[e.to].add(e) && e) || edge(e.from, e.to) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_edge(start_vertex_name, end_vertex_name)\n\n # Check if graph is not empty\n if (@vertices.length == 0)\n raise GraphError.new('No edges can be added to an empty graph', GraphError::ERROR_ADD_EDGE_FAILURE)\n end\n\n first_vertex_index = find_index_for_vertex(start_vertex_name)\n second_...
[ "0.7166722", "0.7107564", "0.7083762", "0.70119345", "0.70088303", "0.6970929", "0.6942395", "0.6897316", "0.6786623", "0.6777823", "0.6766781", "0.67648494", "0.67354834", "0.6734479", "0.6643161", "0.66317827", "0.66287434", "0.6614208", "0.6580621", "0.65586925", "0.655098...
0.77113044
0
Yields each edge and its inverse to the provided block. Option to provide edges; default is all edges. A pair set is yielded only once (not again in reverse).
def with_each_edge_and_inverse(edges=nil, &block) edges ||= self.edges yielded_pairs = Set.new edges.each do |e| pair = Set.new([e.from, e.to]) if !yielded_pairs.include?(pair) e_inverse = edge(e.to, e.from) block.call(e, e_inverse) yielded_pairs << pair end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_edge(&block)\n\t\t\tedges.each(&block)\n\t\tend", "def each_edge\n return to_enum(__method__) { 2 * count } unless block_given?\n\n each_item do |item|\n yield item.begin\n yield item.end\n end\n end", "def each_edge #:yields: source, target, edge\n @pathway.relati...
[ "0.725836", "0.70139515", "0.66391414", "0.655889", "0.6534416", "0.6528237", "0.6312292", "0.62543124", "0.610579", "0.6056124", "0.5963803", "0.59067017", "0.5841646", "0.5817174", "0.57264334", "0.57185686", "0.5682891", "0.5610798", "0.55937785", "0.5539289", "0.5526904",...
0.8573993
0
Converts to an instance of EmailGraph::Undirected graph. The optional +edge_factory+ block should take a pair of an edge and its inverse (if it exists), and return either an undirected edgeish or if there should be no edge between the two vertices, then return nil. If no block is passed, an +UndirectedEdge+ will be created if both the edge and its inverse exist. Only adds vertices that have edges, i.e., no isolated vertices in result.
def to_undirected(&edge_factory) edge_factory ||= Proc.new{ |e1, e2| UndirectedEdge.new(e1.from, e1.to) if e1 && e2 } edges = Set.new with_each_edge_and_inverse do |e, e_inverse| new_edge = edge_factory.call(e, e_inverse) edges.add(new_edge) if new_edge end UndirectedGraph.new.tap do |g| edges.each{ |e| g.add_edge(e) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_each_edge_and_inverse(edges=nil, &block)\n edges ||= self.edges\n\n yielded_pairs = Set.new\n edges.each do |e|\n pair = Set.new([e.from, e.to])\n if !yielded_pairs.include?(pair)\n e_inverse = edge(e.to, e.from)\n block.call(e, e_inverse)\n yielded_...
[ "0.5853997", "0.5388858", "0.51793224", "0.51657605", "0.5121988", "0.51125735", "0.49904454", "0.49459395", "0.49176165", "0.4858425", "0.48456815", "0.47903588", "0.47382692", "0.4728843", "0.46916983", "0.4673952", "0.46615326", "0.46583882", "0.46208236", "0.45780295", "0...
0.69782895
0
If has_link_parser? returns +false+, this can be called to fetch the exception which was raised when trying to load LinkParser.
def lp_error ; @lp_error ; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linkparser_error ; @lp_error; end", "def parse_error?\n @parse_error ? true : false\n end", "def error_parser\n @error_parser || Error\n end", "def has_parser?(name); end", "def is_parser_for?(ical)\n begin\n parse_helper!(ical)\n true\n rescue\n false\n ...
[ "0.6316353", "0.61090267", "0.5531696", "0.549325", "0.5443207", "0.5438186", "0.5438186", "0.5416161", "0.52489084", "0.5119102", "0.5118571", "0.50600237", "0.5033951", "0.49827662", "0.4948584", "0.4948518", "0.49392334", "0.49233958", "0.49225658", "0.49101412", "0.487696...
0.0
-1
The instance of LinkParser used for all Linguistics LinkParser functions.
def lp_dict if @lp_error raise NotImplementedError, "LinkParser functions are not loaded: %s" % @lp_error.message end return @lp_dict ||= LinkParser::Dictionary.new( :verbosity => 0 ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser\n @parser ||= Parser.new(self)\n end", "def parser\n @parser ||= Parser.new(self)\n end", "def parser\n @parser ||= Parser.new(self)\n end", "def instance\n @instance ||= LanguageParser.new\n end", "def parse_link; end", "def parser\n @parser ||= Sa...
[ "0.644433", "0.644433", "0.6421409", "0.632754", "0.62904006", "0.62658274", "0.6162753", "0.61407334", "0.6074896", "0.5842361", "0.58255386", "0.5781034", "0.5642527", "0.56383157", "0.5635098", "0.5500703", "0.54711324", "0.539286", "0.53908837", "0.53852445", "0.5383093",...
0.55248314
15
Return a LinkParser::Sentence for the stringified +obj+.
def sentence( obj ) return Linguistics::EN::lp_dict.parse( obj.to_s ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence\n\t\treturn Linguistics::EN::LinkParser.lp_dict.parse( self.obj.to_s )\n\tend", "def to_s_safe(obj)\n if obj.respond_to?(:to_s)\n obj.to_s\n else\n 'to_s error'\n end\n end", "def Obj\r\n obj.cap_first\r\n end", "def object(options = {})\n kase = @subje...
[ "0.6177751", "0.5339527", "0.53028864", "0.5133456", "0.51323974", "0.5024723", "0.5023768", "0.49942622", "0.4980957", "0.4962594", "0.4923886", "0.4911943", "0.4791258", "0.47362435", "0.46894655", "0.46719554", "0.46606672", "0.4655494", "0.46140656", "0.45408654", "0.4539...
0.67216945
0
We need to make sure ranges are properly saved and duplicates are checked checks proper ranges for camp ids
def proper_ranges_camp camp_ids = Camp.all.active.map { |e| e.id } if camp_ids.include?(self.camp_id) return true else errors.add(:camp_id, "not a active camp id") return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def case_with_bad_decass_for_timeline_range_checks\n Time.zone = 'EST'\n vet = create_veteran\n cf_judge = User.find_by_css_id(\"BVABDANIEL\") || create(:user, :judge, :with_vacols_judge_record)\n cf_atty = User.find_by_css_id(\"BVABBLOCK\") || create(:user, :with_vacols_attorney_record)\n ...
[ "0.6149498", "0.59721786", "0.59282666", "0.5729479", "0.57199913", "0.56064004", "0.55831915", "0.55802846", "0.5532869", "0.553204", "0.5486303", "0.5483698", "0.5475342", "0.5434178", "0.5417616", "0.540973", "0.54096097", "0.5383236", "0.5381354", "0.5375185", "0.53641945...
0.7309005
0
checks proper ranges for instrcutor ids
def proper_ranges_instructor instructor_ids = Instructor.all.active.map { |e| e.id } if instructor_ids.include?(self.instructor_id) return true else errors.add(:instructor_id, "not an active instructor id") return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_id_condition\n result = nil\n if ids = parse_integer_ranges(:id)\n result = ids.map do |term|\n if term.is_a?(Range)\n \"#{model.table_name}.id >= #{term.begin} AND \" +\n \"#{model.table_name}.id <= #{term.end}\"\n else\n \"#{model.table_...
[ "0.6384764", "0.6376237", "0.61803234", "0.6091697", "0.6087528", "0.60481316", "0.59910923", "0.5943613", "0.59091145", "0.5890334", "0.5890334", "0.5859262", "0.5850654", "0.5850654", "0.58367", "0.58303183", "0.5789412", "0.57881147", "0.5769192", "0.5753522", "0.5742424",...
0.619353
2
checks duplicates for camp instructors
def check_dups CampInstructor.all.each do |e| if (e.instructor.id == self.instructor_id && e.camp.id == self.camp_id) errors.add(:camp_id, "camp instrctor obj already exists") return false end end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_ptainstructor(oldptainstructor)\n newptainstructor = oldptainstructor.dup\n newptainstructor.semester_id = self.id\n return false unless newptainstructor.save\n return true\n end", "def duplicate_ptainstructor_for_course(newcourse, oldptainstructor, ptainstructors_cloned)\n if ptain...
[ "0.6388355", "0.6228549", "0.61794597", "0.6140688", "0.6043761", "0.5993616", "0.59743106", "0.5922024", "0.5899208", "0.5888028", "0.5826094", "0.5824938", "0.57955265", "0.5770462", "0.5702056", "0.56982297", "0.56565297", "0.5653041", "0.56181353", "0.5613194", "0.5612520...
0.8155426
0
task that will link the given object files to a static lib
def convert_to_rake() object_multitask = prepare_tasks_for_objects() archiver = @tcs[:ARCHIVER] res = typed_file_task Rake::Task::LIBRARY, get_task_name => object_multitask do cmd = calc_command_line aname = calc_archive_name Dir.chdir(@project_dir) do FileUtils.rm(aname) if File.exists?(aname) # cmd.map! {|c| c.include?(' ') ? "\"#{c}\"" : c } rd, wr = IO.pipe cmd << { :err => wr, :out => wr } sp = spawn(*cmd) cmd.pop consoleOutput = ProcessHelper.readOutput(sp, rd, wr) process_result(cmd, consoleOutput, @tcs[:ARCHIVER][:ERROR_PARSER], "Creating #{aname}") check_config_file() end end res.tags = tags enhance_with_additional_files(res) add_output_dir_dependency(get_task_name, res, true) add_grouping_tasks(get_task_name) setup_rake_dependencies(res, object_multitask) return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_rake()\n object_multitask = prepare_tasks_for_objects()\n\n res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do\n cmd = calc_command_line\n Dir.chdir(@project_dir) do\n mapfileStr = @mapfile ? \" >#{@mapfile}\" : \"\"\n rd, wr = ...
[ "0.6768909", "0.6675143", "0.6161513", "0.6130426", "0.6073403", "0.60691684", "0.60406274", "0.6007141", "0.5999696", "0.5992596", "0.5888205", "0.5871522", "0.58633024", "0.5819137", "0.5816505", "0.5801524", "0.5775007", "0.5747417", "0.5745737", "0.5705843", "0.5687858", ...
0.5729076
19
This method builds carton and pallet template and label setup records if they do not exist already
def build_templates_and_labels #-------------------------------------------------------------- #Fetch data needed for build operations #-------------------------------------------------------------- self.production_schedule_code = self.carton_setup.production_schedule_code self.org = self.carton_setup.org self.color_percentage = self.carton_setup.color_percentage self.grade_code = self.carton_setup.grade_code self.std_count = self.carton_setup.standard_size_count_value self.sequence_number = self.carton_setup.sequence_number self.order_number = self.carton_setup.order_number @rmt_setup = RmtSetup.find_by_production_schedule_name(self.production_schedule_code) self.transaction do build_carton_template build_carton_label build_pallet_template build_pallet_label self.carton_setup.update end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_carton_template\n \n #target market and erp calculated fg_code\n begin\n carton_template = nil\n if self.carton_setup.carton_template != nil\n carton_template = self.carton_setup.carton_template\n else\n carton_template = CartonTemplate.new\n end\n \n if !self.carton_setu...
[ "0.73513323", "0.5935286", "0.57728404", "0.56749815", "0.5664946", "0.5656266", "0.5650539", "0.55169857", "0.5516064", "0.5499455", "0.543518", "0.54194385", "0.54168177", "0.53519493", "0.53142405", "0.5298806", "0.52910733", "0.52774113", "0.5273293", "0.526047", "0.52500...
0.77042186
0
Fields to add at runtime (run running time) pick ref production_schedule_no = our run number (schedule prepended)
def build_carton_template #target market and erp calculated fg_code begin carton_template = nil if self.carton_setup.carton_template != nil carton_template = self.carton_setup.carton_template else carton_template = CartonTemplate.new end if !self.carton_setup.carton_setup_update_timestamp self.carton_setup.update_time end carton_template.last_update_date_time = self.carton_setup.carton_setup_update_timestamp.last_update_timestamp carton_template.sell_by_code = self.retailer_sell_by_code carton_template.iso_week_code = self.carton_setup.production_schedule.iso_week_code carton_template.commodity_code = self.carton_setup.retail_item_setup.item_pack_product.commodity_code carton_template.carton_mark_code = self.carton_setup.trade_unit_setup.mark_code target_market = TargetMarket.find_by_target_market_name(self.target_market) carton_template.target_market_code = target_market.target_market_name + "_" + target_market.target_market_description @marketing_variety_description = MarketingVariety.find_by_marketing_variety_code_and_commodity_code(self.carton_setup.marketing_variety_code,@rmt_setup.commodity_code).marketing_variety_description.to_s carton_template.variety_short_long = self.carton_setup.marketing_variety_code + "_" + @marketing_variety_description carton_template.inspection_type_code = self.carton_setup.pallet_setup.inspection_type_code carton_template.carton_label_code = self.carton_setup.trade_unit_setup.standard_label_code carton_template.order_number = self.carton_setup.order_number actual_count_code = actual_count_code = self.carton_setup.retail_item_setup.item_pack_product.actual_count.to_s if !(self.carton_setup.retail_item_setup.item_pack_product.size_ref == "NOS"||self.carton_setup.retail_item_setup.item_pack_product.size_ref == nil) actual_count_code = self.carton_setup.retail_item_setup.item_pack_product.size_ref end carton_template.actual_size_count_code = actual_count_code carton_template.grade_code = self.carton_setup.grade_code #question carton_template.old_pack_code = self.carton_setup.trade_unit_setup.old_pack_code.to_s carton_template.treatment_code = self.carton_setup.retail_item_setup.item_pack_product.treatment_code carton_template.treatment_type_code = self.carton_setup.retail_item_setup.item_pack_product.treatment_type_code carton_template.class_code = self.carton_setup.retail_item_setup.item_pack_product.product_class_code carton_template.pc_code = "PC" + @rmt_setup.rmt_product.ripe_point.pc_code.pc_code + "_" + @rmt_setup.rmt_product.ripe_point.pc_code.pc_name carton_template.pc_code_num = @rmt_setup.rmt_product.ripe_point.pc_code.pc_code carton_template.track_indicator_code = @rmt_setup.output_track_indicator_code carton_template.cold_store_code = @rmt_setup.cold_store_code input_variety = RmtVariety.find_by_rmt_variety_code_and_commodity_code(@rmt_setup.variety_code,@rmt_setup.commodity_code) carton_template.erp_cultivar = input_variety.rmt_variety_code + "_" + input_variety.rmt_variety_description.to_s inventory = InventoryCode.find_by_inventory_code(self.inventory_code) carton_template.inventory_code = self.inventory_code + "_" + inventory.inventory_name carton_template.spray_program_code = @rmt_setup.treatment_code carton_template.quantity = 1 #------------------------------------------------------------------ #Calculation: #iso_week of current day(must be 2 chars: i.e '1' = '01' + weekday(1-7) + numeric value of pc_code + rightmost char of isoweek(i.e. '1' if '01' or '5' if '15') #------------------------------------------------------------------- carton_template.pick_reference = nil #can only be calculated at mw exec time carton_template.remarks = self.remarks carton_template.organization_code = self.carton_setup.org #------------------------------------------------------------------ #Calculation: #iso_week of current day #NB can only be calculated at mw exec time #------------------------------------------------------------------- #carton_template.iso_week_code = self.carton_setup.production_schedule.iso_week_code season = Season.find_by_season_code(self.carton_setup.production_schedule.season_code) carton_template.season_code = season.season carton_template.fg_product_code = self.fg_product_code @brand_code = Mark.find_by_mark_code(self.carton_setup.trade_unit_setup.mark_code).brand_code carton_template.fg_code_old = self.carton_setup.commodity_code + " " + self.carton_setup.marketing_variety_code + " " + @brand_code + " " + self.carton_setup.trade_unit_setup.old_pack_code.to_s + " " + carton_template.actual_size_count_code carton_template.carton_setup = self.carton_setup @extended_fg_record = ExtendedFg.find_by_extended_fg_code(self.extended_fg_code) raise "No extended fg record exists with code: " + self.extended_fg_code.to_s + " for carton setup: " + self.carton_setup.carton_setup_code if !@extended_fg_record carton_template.carton_fruit_nett_mass = @extended_fg_record.tu_nett_mass carton_template.extended_fg_code = @extended_fg_record.extended_fg_code carton_template.fg_mark_code = self.fg_mark_code carton_template.items_per_unit = self.carton_setup.retail_unit_setup.items_per_unit carton_template.units_per_carton = self.carton_setup.retail_unit_setup.units_per_carton carton_template.save @carton_template = carton_template rescue raise "Method 'build_carton_template' failed. Exception reported: <br>: " + $! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule\n \"#{frequency_quantity} #{frequency_type.name.pluralize} at #{execution_time}\"\n end", "def production_schedule_code\n puts \"psc attrib called\"\n if @production_schedule_code == nil\n @production_schedule_code = self.carton_setup.production_schedule_code\n end\n \n retur...
[ "0.62519646", "0.6119621", "0.6051876", "0.595793", "0.5928437", "0.58913416", "0.5694235", "0.56320274", "0.56320274", "0.56320274", "0.5620724", "0.5572276", "0.5505306", "0.5494739", "0.54493344", "0.5432082", "0.5415331", "0.5398025", "0.5386165", "0.53473264", "0.5335823...
0.0
-1
Pretty primitive, but mostly effective provided that tracking_base_url end in a query string (e.g.
def tracking_url if has_tracking_information? return "#{shipping_carrier.tracking_base_url}#{tracking_number}" else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_tracking_url\n self.tracking_url ||=\n courier.generate_tracking_url(\n consignment: consignment_number,\n postcode: postcode,\n order_number: order_number\n )\n end", "def base_url\n @url.to_s.split('?').first\n end", "def build_url(params)\n \"#{@b...
[ "0.6525844", "0.6398509", "0.6345949", "0.6261112", "0.6254992", "0.62299", "0.61724454", "0.6160489", "0.6159803", "0.61519754", "0.6136097", "0.612035", "0.6093696", "0.60855025", "0.6066443", "0.6064341", "0.60639447", "0.60524225", "0.6048511", "0.5992716", "0.5992716", ...
0.68350357
0
The same, but works with an existing OldOrder object
def old_order_lines_from_cart(cart) order = self cart.cart_lines.each do |cl| ol = OldOrderLine.create(cl.attributes) ol.cart_id = nil order.old_order_lines << ol end return order end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def original_order\n end", "def shift_up_orders()\n Feature.update_all('\"order\" = \"order\" - 1', '\"order\" > '+order.to_s)\n end", "def clone_from_order(order)\n if order.invoiced?\n raise ArgumentError, \"The supplied order is already invoiced.\"\n else\n self.user_id = order.u...
[ "0.64006114", "0.6168926", "0.6165589", "0.61419153", "0.61081403", "0.6066432", "0.6064158", "0.5994216", "0.5965801", "0.590311", "0.5844722", "0.58263624", "0.5820762", "0.5819846", "0.57826394", "0.5764064", "0.57604355", "0.574474", "0.57446265", "0.5704362", "0.5704038"...
0.62891966
1
This is used in validation. If neither address is filled in, validate both. If only the billing address is filled in, validate just that
def addressing_ok? if billing_address.nil? return false elsif billing_address.filled_in? and (shipping_address.nil? or !shipping_address.filled_in?) return true elsif billing_address.filled_in? and shipping_address.filled_in? return false else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_address_owners\n if complete?\n errors.add(:bill_address, 'Billing address should not have a user') if bill_address.try(:user_id)\n errors.add(:ship_address, 'Shipping address should not have a user') if ship_address.try(:user_id)\n else\n if bill_address && bill_address.valid? && !...
[ "0.7202016", "0.70464337", "0.7029054", "0.6960091", "0.69600064", "0.6780191", "0.67612666", "0.67405474", "0.6730197", "0.671161", "0.6705365", "0.6681294", "0.6657425", "0.66430044", "0.66150737", "0.660761", "0.6500052", "0.6496903", "0.6482849", "0.64693815", "0.63865983...
0.70593035
1
Alias for old_order_lines so that generic order|invoice.lines works
def lines old_order_lines end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoice_lines_from_order(order)\n invoice = self\n order.order_lines.each do |ol|\n # order_lines are static_document_lines, so they can be assigned to an invoice\n # at the same time, ensuring that the invoice always reflects the order 100%.\n ol.invoice = invoice\n ol.save\n end\...
[ "0.70739657", "0.6872941", "0.6593816", "0.6202083", "0.6121979", "0.59172904", "0.5907968", "0.5890642", "0.57553905", "0.57407534", "0.5724076", "0.5724076", "0.5688817", "0.5688817", "0.56818044", "0.56711143", "0.562817", "0.5541152", "0.5517298", "0.5507765", "0.5458273"...
0.70548165
1
A locked order's old_order_lines may not be changed anymore. This is to prevent invoiced orders from being changed, otherwise the invoice would no longer be correct. TODO: This is probably no longer necessary now that we save invoices as lists of independent text strings instead of using product references.
def locked? locked = false status_constant == OldOrder::UNPROCESSED ? locked = false : locked = true locked = true unless invoice.blank? return locked end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def old_order_lines_from_cart(cart)\n order = self\n cart.cart_lines.each do |cl|\n ol = OldOrderLine.create(cl.attributes)\n ol.cart_id = nil\n order.old_order_lines << ol\n end\n return order\n end", "def lines\n old_order_lines\n end", "def invoice_lines_from_order(order)\n ...
[ "0.6106204", "0.58814967", "0.58646923", "0.581833", "0.5540427", "0.5491373", "0.5439362", "0.5415615", "0.5383398", "0.53778243", "0.536901", "0.53562415", "0.53430766", "0.5332232", "0.5331891", "0.53134155", "0.52706456", "0.5158362", "0.5099857", "0.50645727", "0.5044596...
0.5541013
4
If the user doesn't actually have authorization for this payment method, e.g. a user who must prepay tries to order something on credit, the order can't be saved. It should actually never be possible for a user to pass an unauthorized payment type, but this check prevents errors e.g. from admins manipulating orders on the console.
def must_be_authorized_for_payment_method authorized_methods = [] authorized_methods << PaymentMethod.get_default authorized_methods += user.payment_methods if user unless authorized_methods.uniq.include?(payment_method) errors.add_to_base("User is not authorized for the chosen payment method.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_payment\n if !self.pending_purchase_order && self.payment_object\n order, payment = self.purchase_and_authorize\n if payment && payment.success?\n# self.payment_object = nil # remove payment object so we can re-validate\n self.purchase_orders.reload\n return payment....
[ "0.6435131", "0.63898414", "0.63538694", "0.62547576", "0.6203916", "0.6190521", "0.6123715", "0.6037808", "0.6025453", "0.5988225", "0.59849674", "0.5975501", "0.5957859", "0.5955256", "0.5946158", "0.5945051", "0.5910593", "0.590298", "0.5891208", "0.5877884", "0.58774227",...
0.72258335
0
UndirectedGraph is by definition undirected, always returns false
def directed?() false; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undirected?\n @undirected ? true : false\n end", "def directed?\n false\n end", "def directed?\n @undirected ? false : true\n end", "def graph?\n false\n end", "def directed_only?\n true\n end", "def directed?\n true\n end", "def valid?\n super && !directe...
[ "0.8576505", "0.7844235", "0.7771524", "0.77161527", "0.7643359", "0.7604951", "0.7544422", "0.7507702", "0.68771946", "0.68179053", "0.6790774", "0.6761809", "0.67616236", "0.6741875", "0.6723385", "0.67079574", "0.67050695", "0.66834676", "0.66692615", "0.6562415", "0.65107...
0.78295076
2
Redefine degree (default was sum)
def degree(v) in_degree(v); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def degree; end", "def degree\n self.in_degree + self.out_degree\n end", "def scale_degree(degree)\n \n end", "def degree(node)\n in_degree(node) + out_degree(node)\n end", "def degree(v)\n in_degree(v) + out_degree(v)\n end", "def << degree\n @degrees << degree\n self\n en...
[ "0.7282976", "0.6785797", "0.6751525", "0.6439162", "0.643387", "0.6339531", "0.6310245", "0.6050553", "0.5983939", "0.59774435", "0.59774435", "0.59556174", "0.5858384", "0.58288056", "0.58024603", "0.57992876", "0.5782255", "0.5709622", "0.57081836", "0.5705333", "0.5627553...
0.65760714
3
A vertex of an undirected graph is balanced by definition
def balanced?(v) true; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertex_up(vertex)\n @vertices[vertex] = true\n end", "def test_has_edges_vertices_only\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n graph = Graph.new\n graph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c)\n\n assert(graph.has_e...
[ "0.62512857", "0.6127867", "0.6125827", "0.60173815", "0.5887378", "0.584336", "0.5833955", "0.58175105", "0.58090895", "0.57891196", "0.5783001", "0.5719642", "0.57161176", "0.57115525", "0.57115525", "0.5707358", "0.57060456", "0.5675374", "0.5673391", "0.56584126", "0.5645...
0.5322281
57
UndirectedGraph uses Edge for the edge class.
def edge_class() @parallel_edges ? Plexus::MultiEdge : Plexus::Edge; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edge_class\n WeightedDirectedEdge\n end", "def get_edge(edge)\n return nil unless edge[:from][:name]\n return nil unless edge[:to][:name]\n\n #Get the type of the edge\n type = edge[:type] || Config::DEFAULT_TYPE\n edge[:type] = type\n\n #Check if the edge type exists\n ...
[ "0.7454891", "0.72857195", "0.70428705", "0.6899322", "0.68410194", "0.68329984", "0.66704327", "0.6571025", "0.65622705", "0.65576696", "0.65195495", "0.6505334", "0.6442574", "0.6442005", "0.6422385", "0.62803787", "0.62639517", "0.62029314", "0.6200917", "0.6200579", "0.61...
0.7501789
0
A triangulated graph is an undirected perfect graph that every cycle of length greater than three possesses a chord. They have also been called chordal, rigid circuit, monotone transitive, and perfect elimination graphs. Implementation taken from Golumbic's, "Algorithmic Graph Theory and Perfect Graphs" pg. 90
def triangulated? a = Hash.new {|h,k| h[k]=Set.new}; sigma=lexicograph_bfs inv_sigma = sigma.inject({}) {|acc,val| acc[val] = sigma.index(val); acc} sigma[0..-2].each do |v| x = adjacent(v).select {|w| inv_sigma[v] < inv_sigma[w] } unless x.empty? u = sigma[x.map {|y| inv_sigma[y]}.min] a[u].merge(x - [u]) end return false unless a[v].all? {|z| adjacent?(v,z)} end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangulate(vertices)\n\t\tedges = []\n tris = []\n # sort by X coord\n vertices = vertices.sort_by {|p|p.x}\n # center/radius cache used by circum_circle\n cc_cache = {}\n\n # Set up the supertriangle\n # This is a triangle which encompasses all the sample points.\n # The supertriangle...
[ "0.58347493", "0.5821273", "0.5763927", "0.574226", "0.5615114", "0.55114776", "0.54739445", "0.54175067", "0.5405773", "0.54008293", "0.53170687", "0.53088397", "0.5291326", "0.5251519", "0.5218188", "0.51923", "0.51888824", "0.5175062", "0.516105", "0.5144093", "0.5121637",...
0.48538318
54
An interval graph can have its vertices into onetoone correspondence with a set of intervals F of a linearly ordered set (like the real line) such that two vertices are connected by an edge of G if and only if their corresponding intervals have nonempty intersection.
def interval?() triangulated? and complement.comparability?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_combined_interval(interval_arr, left_edge, right_edge)\n p \"interval_arr: #{interval_arr}\"\n interval_arr.each do |interval| # get combined interval\n p \"interval: #{interval}\"\n p \"left_edge: #{left_edge} right_edge: #{right_edge}\"\n if interval[0] >= 0 && interval[0] < left_edge && in...
[ "0.5901188", "0.5844107", "0.5498375", "0.5430552", "0.5277519", "0.5261816", "0.5225667", "0.52219933", "0.5202917", "0.5177672", "0.5170396", "0.5154284", "0.50380075", "0.5017172", "0.50088865", "0.5000437", "0.49953637", "0.49907944", "0.4980776", "0.49637827", "0.4963312...
0.0
-1
A permutation diagram consists of n points on each of two parallel lines and n straight line segments matchin the points. The intersection graph of the line segments is called a permutation graph.
def permutation?() comparability? and complement.comparability?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line(p1, p2)\n xs = arrange(p1.first, p2.first)\n ys = arrange(p1.last, p2.last)\n\n xs = xs * ys.size if ys.size > xs.size\n ys = ys * xs.size if xs.size > ys.size\n\n xs.zip(ys).each{|point| draw(point) }\n end", "def solve_with_permutations(start_n:, minutes:)\n raise ArgumentError...
[ "0.59980065", "0.55559003", "0.5470914", "0.5463797", "0.5316278", "0.5306346", "0.52794296", "0.527623", "0.52506703", "0.52464396", "0.51985013", "0.51646453", "0.5159029", "0.5066653", "0.50331604", "0.5004937", "0.50044006", "0.5002991", "0.498646", "0.49828583", "0.49734...
0.0
-1
An undirected graph is defined to be split if there is a partition V = S + K of its vertex set into a stable set S and a complete set K.
def split?() triangulated? and complement.triangulated?; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partition_edges\n\n par = RangePartition.new\n\n stateSet = @start_state.reachable_states\n\n stateSet.each do |s|\n s.edges.each {|lbl,dest| par.addSet(lbl) }\n end\n\n par.prepare\n\n stateSet.each do |s|\n newEdges = []\n s.edges.each do |lbl, dest|\n ...
[ "0.5851505", "0.5834377", "0.5555102", "0.55092657", "0.5447799", "0.539857", "0.53582615", "0.53305507", "0.53251964", "0.5274365", "0.52732295", "0.52344537", "0.5180623", "0.5166993", "0.51471823", "0.514299", "0.5101216", "0.50995225", "0.5068833", "0.5034323", "0.5034038...
0.47890043
48
Implementation taken from Golumbic's, "Algorithmic Graph Theory and Perfect Graphs" pg. 99
def triangulated_chromatic_number chi = 1; s= Hash.new {|h,k| h[k]=0} sigma=lexicograph_bfs inv_sigma = sigma.inject({}) {|acc,val| acc[val] = sigma.index(val); acc} sigma.each do |v| x = adjacent(v).select {|w| inv_sigma[v] < inv_sigma[w] } unless x.empty? u = sigma[x.map {|y| inv_sigma[y]}.min] s[u] = [s[u], x.size-1].max chi = [chi, x.size+1].max if s[v] < x.size end end; chi end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem_107\n if false\n net = [ \"-,16,12,21,-,-,-\", \"16,-,-,17,20,-,-\", \"12,-,-,28,-,31,-\",\n \"21,17,28,-,18,19,23\", \"-,20,-,18,-,-,11\", \"-,-,31,19,-,-,27\",\n \"-,-,-,23,11,27,-\" ]\n net.map! {|line| line.split(/,/).map {|i| i == '-' ? nil : i.to_i}}\n else\n net = []\n op...
[ "0.6652481", "0.6546384", "0.6511197", "0.6380208", "0.632858", "0.6316726", "0.6307583", "0.626252", "0.6261194", "0.6216201", "0.62145925", "0.61828256", "0.61002755", "0.6086472", "0.60855794", "0.607775", "0.6077206", "0.6060549", "0.6059378", "0.60342944", "0.6001883", ...
0.0
-1
GET /obligation_rules/1 GET /obligation_rules/1.json
def show @obligation_rule = ObligationRule.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @obligation_rule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @obligation_rule = ObligationRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obligation_rule }\n end\n end", "def get_approval_rules()\n build_header_auth('/approval_rules', API_VERSION_1, 'GET')\n build_request()\n request = N...
[ "0.6696422", "0.6385354", "0.6383761", "0.6261074", "0.61815435", "0.61239725", "0.59848547", "0.5984406", "0.594214", "0.5941884", "0.59294397", "0.5894558", "0.5866554", "0.5841279", "0.5807202", "0.57937527", "0.5776777", "0.57341397", "0.57341397", "0.57341397", "0.573413...
0.7335633
0
GET /obligation_rules/new GET /obligation_rules/new.json
def new @obligation_rule = ObligationRule.new respond_to do |format| format.html # new.html.erb format.json { render json: @obligation_rule } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @obligation_rule = ObligationRule.new(params[:obligation_rule])\n\n respond_to do |format|\n if @obligation_rule.save\n format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully created.' }\n format.json { render json: @obligation_rule, status: :cre...
[ "0.7484239", "0.70171577", "0.6935286", "0.6923073", "0.68855786", "0.685202", "0.6842276", "0.66984016", "0.66947705", "0.6691267", "0.66788334", "0.6651849", "0.6604182", "0.65968037", "0.6591318", "0.65732783", "0.6572941", "0.6564214", "0.65450466", "0.6523151", "0.649346...
0.8075585
0
POST /obligation_rules POST /obligation_rules.json
def create @obligation_rule = ObligationRule.new(params[:obligation_rule]) respond_to do |format| if @obligation_rule.save format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully created.' } format.json { render json: @obligation_rule, status: :created, location: @obligation_rule } else format.html { render action: "new" } format.json { render json: @obligation_rule.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create rules\n raise ArgumentError.new('No rules provided') if rules.nil? || rules.empty?\n request = create_post_request(construct_rules(rules))\n response = fetch_data(request)\n return true if response.nil?\n return GnipApi::JsonParser.new.parse(response)\n end", "d...
[ "0.644622", "0.6202766", "0.61606556", "0.59759146", "0.5973099", "0.58763057", "0.586935", "0.58561486", "0.5848823", "0.58296233", "0.5823003", "0.58095694", "0.5799389", "0.57845545", "0.5761125", "0.57458246", "0.57341236", "0.5718239", "0.57004833", "0.5672914", "0.56605...
0.73543817
0
PUT /obligation_rules/1 PUT /obligation_rules/1.json
def update @obligation_rule = ObligationRule.find(params[:id]) respond_to do |format| if @obligation_rule.update_attributes(params[:obligation_rule]) format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @obligation_rule.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rules\n create_update_rules\n end", "def create\n @obligation_rule = ObligationRule.new(params[:obligation_rule])\n\n respond_to do |format|\n if @obligation_rule.save\n format.html { redirect_to @obligation_rule, notice: 'Obligation rule was successfully created.' }\n ...
[ "0.6641083", "0.6377537", "0.6191097", "0.61847496", "0.617248", "0.61296827", "0.6129034", "0.612694", "0.608904", "0.60529476", "0.6034582", "0.59800196", "0.5960629", "0.5921291", "0.5917046", "0.59037906", "0.59037906", "0.5882435", "0.5876073", "0.5868325", "0.57845986",...
0.72504973
0
DELETE /obligation_rules/1 DELETE /obligation_rules/1.json
def destroy @obligation_rule = ObligationRule.find(params[:id]) @obligation_rule.destroy respond_to do |format| format.html { redirect_to obligation_rules_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rule.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n return if @name.nil?\n delete_rest \"rules/#{@name}\"\n end", "def destroy\n @rule.destroy\n render json: {}\n\n end", "def destroy\n @rule.destroy\n r...
[ "0.6880518", "0.677957", "0.67583305", "0.67334604", "0.667338", "0.66655827", "0.6615995", "0.658493", "0.658182", "0.65638375", "0.65162396", "0.65071505", "0.6498865", "0.64956933", "0.64927864", "0.64580166", "0.6414248", "0.64103043", "0.63989305", "0.6389946", "0.638994...
0.74451745
0
challage def custon_max(_arr) arr.max end def custon_min(_arr) arr.min end
def custon_max(arr) return nil if arr.empty? max = arr[0] arr.each do |value| max = value if value > max end max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_range(array)\r\n\r\n array.max - array.min # max and min methods used\r\nend", "def min_max(list)\n list.minmax\nend", "def custom_max(array)\n array.max\nend", "def min_max(numbers)\n numbers.minmax { |a, b| a <=> b }\nend", "def min_max(lst)\n lst.minmax\nend", "def min_max(lst)\n lst.min...
[ "0.77653885", "0.77389413", "0.77076435", "0.7643276", "0.7589994", "0.7589994", "0.7589994", "0.7589994", "0.75639355", "0.75327146", "0.7515062", "0.7414424", "0.7337094", "0.7337094", "0.7273109", "0.72596025", "0.7258107", "0.7245189", "0.7244353", "0.71889734", "0.714933...
0.74836016
11
Generalized data access methods Record field access methods
def getNumQuestionDetailItems() return @sectionrec_config.size() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](field_name); end", "def field(name); end", "def read_field\n end", "def [](key); @data[\"@fields\"][key] end", "def method_missing method, *args, &block\n self.class.send(:define_method, method) do \n return @fields[method.to_sym]\n end\n self.send method, *args, &block\n e...
[ "0.7312281", "0.6970084", "0.692163", "0.67983365", "0.65288925", "0.6485997", "0.6434361", "0.6430033", "0.6430033", "0.6430033", "0.64033324", "0.6397794", "0.6391536", "0.6369924", "0.6365678", "0.6315334", "0.6288504", "0.628353", "0.6196882", "0.61510146", "0.61493325", ...
0.0
-1
These two methods are used by the EXCEL export to calculate how many rows and cols cells are involved
def getQuestionMatrixNCols(ridx) nmatrix = getNumQuestionMatrixConfig(ridx) nfields = getNumQuestionFieldConfig(ridx) ncols = 0 if nmatrix > 0 qrnames = getQuestionMatrixRowsConfig(ridx) qcnames = getQuestionMatrixColsConfig(ridx) cqfidx = 0 qcnames.each do |colname| showcol = getQuestionMatrixColFlag(ridx,cqfidx) if showcol.to_s == "1" ncols = ncols + 1 end cqfidx = cqfidx + 1 end else ncols = 1 end return ncols end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells_count\n rows_count * columns_count\n end", "def column_count\r\n assert_exists\r\n arr_cells = cells\r\n return arr_cells.length\r\n end", "def header_cells_count\n header_cells.count\n end", "def number_cells\n n = 1\n for row in 0...height\n ...
[ "0.82066905", "0.7450358", "0.74145854", "0.7063657", "0.697466", "0.6851617", "0.68043077", "0.67756474", "0.67146254", "0.6674162", "0.66432124", "0.6592519", "0.6590895", "0.65613145", "0.65236944", "0.650405", "0.6477849", "0.646643", "0.64576316", "0.64526093", "0.644889...
0.0
-1
If question is a matrix returns list of column names marked for display, otherwise returns empty Array
def getQuestionMatrixColNames(ridx) nmatrix = getNumQuestionMatrixConfig(ridx) nfields = getNumQuestionFieldConfig(ridx) colnames = Array.new if nmatrix > 0 qrnames = getQuestionMatrixRowsConfig(ridx) qcnames = getQuestionMatrixColsConfig(ridx) cqfidx = 0 qcnames.each do |colname| showcol = getQuestionMatrixColFlag(ridx,cqfidx) if showcol.to_s == "1" colnames << colname end cqfidx = cqfidx + 1 end end return colnames end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_headers\n return [] if self.choice_questions.empty?\n self.choice_questions.limit(1).first.choice_answers.map {|a| a.answer}\n end", "def getQuestionMatrixRowNames(ridx)\n nmatrix = getNumQuestionMatrixConfig(ridx)\n nfields = getNumQuestionFieldConfig(ridx)\n rownames = Ar...
[ "0.7481372", "0.6999003", "0.68237007", "0.67648274", "0.63783246", "0.633113", "0.6301941", "0.6261505", "0.62005776", "0.61096597", "0.60787034", "0.6043537", "0.6027998", "0.602566", "0.59499705", "0.593176", "0.58827096", "0.58733714", "0.5860805", "0.58601743", "0.585667...
0.77374977
0
If question is a matrix returns list of row names marked for display, otherwise returns empty Array
def getQuestionMatrixRowNames(ridx) nmatrix = getNumQuestionMatrixConfig(ridx) nfields = getNumQuestionFieldConfig(ridx) rownames = Array.new if nmatrix > 0 qrnames = getQuestionMatrixRowsConfig(ridx) qcnames = getQuestionMatrixColsConfig(ridx) for qfidx in 0..qrnames.size - 1 showcol = getQuestionMatrixRowFlag(ridx,qfidx) if showcol.to_s == "1" rownames << qrnames[qfidx] end end end return rownames end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_headers\n return [] if self.choice_questions.empty?\n self.choice_questions.limit(1).first.choice_answers.map {|a| a.answer}\n end", "def getQuestionMatrixColNames(ridx)\n nmatrix = getNumQuestionMatrixConfig(ridx)\n nfields = getNumQuestionFieldConfig(ridx)\n colnames = Ar...
[ "0.6865387", "0.67734796", "0.64695835", "0.6127159", "0.6028243", "0.6011852", "0.59260434", "0.5896473", "0.5757221", "0.5739902", "0.5718299", "0.56942636", "0.567926", "0.5677668", "0.5612921", "0.558604", "0.55855626", "0.55604166", "0.5544923", "0.5508986", "0.5484538",...
0.77896386
0
HTML Post Parameters Methods This method used to load user selections in params to determine which question/fields to render
def setSelections(params) setRecordDetailSelections(params) setFieldSelections(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quiz_params\n paramspermit(:answer)\n end", "def post_params\n params.require(:post).permit(:section1, :section2, :section3, :goal, :learning, :positive1, :positive2, :improvement1, :improvement2)\n end", "def question_type_javascript_params(question)\n if question.question_type == \"tex...
[ "0.61881816", "0.60828775", "0.6032944", "0.6011762", "0.59890515", "0.5986336", "0.59702563", "0.59702563", "0.59563637", "0.59502167", "0.59387374", "0.59339875", "0.5917229", "0.5869667", "0.58626765", "0.58428496", "0.5837169", "0.581824", "0.5807772", "0.5775625", "0.577...
0.0
-1
GET /reports GET /reports.json
def index authorize! :index, Report, :message => 'Acceso denegado.' @campuses=@university.campuses @campuses2=@university.campuses @campuses_modificable = getcampuses_user(current_user) @reports=find_reports_from_university(@university) if params[:search] @search=params[:search] if @search @reports_search=(Report.where("name like ?","%#{@search.capitalize}%") | Report.where("name like ?","%#{@search.downcase}%") | Report.where("name like ?","%#{@search.upcase}%")) @reports=@reports_search.select{|u| @reports.include?(u)} @searched=true end end if params[:campus] @search_campus=params[:campus] if @search_campus && params[:campus][:campus_id] @ids=params[:campus][:campus_id] if @ids!="" @campus_selected=Campus.find(params[:campus][:campus_id]) @reports=@reports.select{|u| u.campuses.include?(@campus_selected)} @campuses2=@campuses.select{|u| u===@campus_selected} end end end @reports=@reports & @reports @reports.sort_by!{|u| u.name} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.jso...
[ "0.7896447", "0.78636414", "0.77486503", "0.7707248", "0.7619338", "0.7569814", "0.75290066", "0.74211705", "0.73762834", "0.73735154", "0.73633385", "0.7334833", "0.733009", "0.72732675", "0.7264923", "0.7264923", "0.7264923", "0.7264923", "0.7264923", "0.7264923", "0.726492...
0.0
-1
GET /reports/1 GET /reports/1.json
def show @report = Report.find(params[:id]) authorize! :show, @report, :message => 'Acceso denegado.' respond_to do |format| format.html # show.html.erb format.json { render json: @report } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report(id)\n get(\"reports/#{id}\")\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n ...
[ "0.7748938", "0.75881416", "0.7431268", "0.73564404", "0.734049", "0.7336173", "0.7288342", "0.7271043", "0.7255433", "0.7255433", "0.7255433", "0.72416246", "0.71827865", "0.7157897", "0.7153644", "0.71511304", "0.71380997", "0.71221477", "0.70997465", "0.70631856", "0.70115...
0.0
-1
GET /reports/new GET /reports/new.json
def new @report = Report.new @campuses = getcampuses_user(current_user) respond_to do |format| format.html # new.html.erb format.json { render json: @report } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n end", "def new\n @report = Report.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @report }\n end\n...
[ "0.7989247", "0.7989247", "0.7989247", "0.7989247", "0.76830995", "0.76397383", "0.76298976", "0.76116025", "0.7447189", "0.74441576", "0.7383804", "0.7328984", "0.73283935", "0.7273767", "0.72064424", "0.71975446", "0.7190509", "0.716767", "0.71212983", "0.7101389", "0.70992...
0.7138295
18
POST /reports POST /reports.json
def create @report = Report.new(params[:report]) authorize! :create, @report, :message => 'Acceso denegado.' @campuses = getcampuses_user(current_user) respond_to do |format| if @report.save format.html { redirect_to [@university,@report], notice: 'La noticia fue creada con éxito' } format.json { render json: @report, status: :created, location: @report } else format.html { render action: "new" } format.json { render json: @report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end", "def create\n @report = Report.new(report_params)\n\n re...
[ "0.77267456", "0.71440965", "0.7033348", "0.70297456", "0.7006169", "0.6989695", "0.6989695", "0.698222", "0.6979302", "0.6979302", "0.6979302", "0.6961894", "0.6960234", "0.695844", "0.68224156", "0.6808665", "0.68054426", "0.67791307", "0.6777732", "0.67731243", "0.67679095...
0.0
-1
PUT /reports/1 PUT /reports/1.json
def update @report = Report.find(params[:id]) authorize! :update, @report, :message => 'Acceso denegado.' @campuses = getcampuses_user(current_user) campusReport = Report.find(params[:report_id][:campus_ids]) rescue [] @report.campuses=campusReport respond_to do |format| if @report.update_attributes(params[:report]) format.html { redirect_to [@university,@report], notice: 'La noticia fue modificada exitosamente.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @report.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @custom_report = CustomReport.find(params[:id])\n\n if @custom_report.update(params[:custom_report])\n head :no_content\n else\n render json: @custom_report.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @report.update(rep...
[ "0.691297", "0.68930006", "0.6880123", "0.6866398", "0.6830857", "0.6827557", "0.6824345", "0.6824345", "0.6786194", "0.67788744", "0.6769023", "0.6764582", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", "0.6762239", ...
0.5947377
97
DELETE /reports/1 DELETE /reports/1.json
def destroy @report = Report.find(params[:id]) authorize! :destroy, @report, :message => 'Acceso denegado.' @report.destroy respond_to do |format| format.html { redirect_to university_reports_path(@university) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @report.destroy!\n render json: {status: :ok}\n end", "def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @report.destroy\n respond_to do |format|\n ...
[ "0.78883916", "0.77925867", "0.7791945", "0.7791945", "0.7791945", "0.7768737", "0.7727435", "0.7727435", "0.7727435", "0.7727435", "0.7672675", "0.75966144", "0.75292933", "0.75292933", "0.75199825", "0.7518596", "0.7518159", "0.7505007", "0.7485241", "0.7485241", "0.7485241...
0.0
-1
Extract just the keys across all files first, then take a second pass and pull the data.
def execute(options={}) build_headers write_data(@output) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_files_in_main_dir\n ensure_file_open!\n @file.glob('*').map do |entry|\n next if entry.directory?\n\n entry_file_name = Pathname.new(entry.name)\n [entry_file_name, entry.get_input_stream(&:read)]\n end.compact.to_h\n end", "def key_files; end", "def extract_all\n fil...
[ "0.6606323", "0.6246731", "0.6100229", "0.6046526", "0.6046304", "0.60267127", "0.6002498", "0.5990401", "0.59502816", "0.5916756", "0.5898423", "0.5887303", "0.5871867", "0.58692694", "0.5800609", "0.5797893", "0.5767421", "0.5767421", "0.57370865", "0.57308203", "0.5730737"...
0.0
-1
With simple 'keys' we just add the key name to the keys array.
def handle_simple(value) @keys << @key_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] += keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def add_key(key)\n keys.add(key)\n end", "def with_key_for(keys = EMPTY_ARRAY)\n [*keys].join('_').upcase\n end", "de...
[ "0.74395525", "0.6817768", "0.6813404", "0.6813404", "0.6730317", "0.6645024", "0.6643218", "0.6427304", "0.64000833", "0.63536584", "0.6347097", "0.63128066", "0.6307218", "0.6301968", "0.6301968", "0.6301968", "0.6296774", "0.62633514", "0.62561977", "0.62509817", "0.621859...
0.67339367
5
callseq: namespace1 namespace2 Compares two namespace objects. Namespace objects are considered equal if their prefixes and hrefs are the same.
def <=>(other) if self.prefix.nil? and other.prefix.nil? self.href <=> other.href elsif self.prefix.nil? -1 elsif other.prefix.nil? 1 else self.prefix <=> other.prefix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unify_namespaces(ns1, ns2)\n return ns2, true if ns1 == '*'\n return ns1, true if ns2 == '*'\n return nil, false unless ns1 == ns2\n [ns1, true]\n end", "def same?(otherNs)\n if (otherNs.nsList == nil && @nsList == nil)\n return true\n end\n\n if (otherN...
[ "0.6953269", "0.6141664", "0.5884402", "0.56779456", "0.5663256", "0.5578726", "0.5548322", "0.54375726", "0.53242296", "0.5315439", "0.5232448", "0.5184069", "0.5175881", "0.51249015", "0.51142675", "0.5093885", "0.5093885", "0.5087424", "0.5084536", "0.50707", "0.50582165",...
0.50569665
21
callseq: namespace.to_s > "string" Returns the string represenation of a namespace. Usage: namespace.to_s
def to_s if self.prefix "#{self.prefix}:#{self.href}" else self.href end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str\n to_s\n end", "def to_s\n string\n end", "def to_s\n attr = ''\n\n namespaces = {}\n attributes.each do |a|\n namespaces[a.prefix] = a.namespaceURI if a.prefix\n end\n if @localname\n namespaces[@prefix] = @uri\n end\n\n ...
[ "0.64264417", "0.63743794", "0.6287418", "0.6281414", "0.6281414", "0.62331384", "0.62048376", "0.6178726", "0.6178376", "0.6178376", "0.6178156", "0.6178156", "0.61722815", "0.61680955", "0.61680955", "0.61680955", "0.61680955", "0.61680955", "0.61680955", "0.61680955", "0.6...
0.0
-1
GET /fdn/menus GET /fdn/menus.json
def index #@fdn_menus = Fdn::Menu.all @fdn_menu = Fdn::Menu.top_level.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @menus = @user.menus.all\n render json: @menus\n end", "def menu\n response[\"menu\"]\n end", "def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end", "def index\n @menus_pages, @menus = uhook_find_menus\n\n respond_to do |format|\n format.ht...
[ "0.7675045", "0.7392261", "0.7342322", "0.7329183", "0.7261866", "0.718737", "0.7169664", "0.7139594", "0.70759135", "0.705915", "0.7055035", "0.69831467", "0.69831467", "0.69831467", "0.69831467", "0.69831467", "0.69831467", "0.6940606", "0.691393", "0.6897669", "0.6884016",...
0.72411126
5
GET /fdn/menus/1 GET /fdn/menus/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @menus = @user.menus.all\n render json: @menus\n end", "def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end", "def show\n @menu = Menu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @menu }\n ...
[ "0.74930626", "0.7490742", "0.73288393", "0.7220118", "0.7193933", "0.71796155", "0.7172562", "0.71618557", "0.71419984", "0.71235085", "0.70631874", "0.70398027", "0.69718575", "0.6971734", "0.6958453", "0.6928578", "0.69050264", "0.67897993", "0.6782149", "0.675584", "0.674...
0.0
-1
POST /fdn/menus POST /fdn/menus.json
def create @fdn_menu = Fdn::Menu.new(fdn_menu_params) respond_to do |format| if @fdn_menu.save format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '功能菜单创建成功!') } format.json { render :show, status: :created, location: @fdn_menu } else format.html { render :new } format.json { render json: @fdn_menu.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_menu\n Rails.logger.warn params.to_s\n menu = Menu.create\n menu.published = false\n if !params[:odesk_id].blank?\n odesk = Odesk.where(access_token:params[:odesk_id]).first\n menu.odesk = odesk\n else\n restaurant = Restaurant.find(params[:restaurant_id])\n menu.resta...
[ "0.7152703", "0.6887779", "0.6839034", "0.6817374", "0.681483", "0.6777925", "0.67704886", "0.67704886", "0.67704886", "0.6747816", "0.6718197", "0.6687026", "0.668695", "0.6652038", "0.66131806", "0.65852594", "0.65315944", "0.650358", "0.6493068", "0.6482075", "0.64254755",...
0.7379104
0
PATCH/PUT /fdn/menus/1 PATCH/PUT /fdn/menus/1.json
def update respond_to do |format| if @fdn_menu.update(fdn_menu_params) format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '功能菜单更新成功!') } format.json { render :show, status: :ok, location: @fdn_menu } else format.html { render :edit } format.json { render json: @fdn_menu.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n if @api_v1_menu.update(api_v1_menu_params)\n render json: @api_v1_menu\n else\n render json: @api_v1_menu.errors\n end\n\n end", "def update\n @menu = Menu.find(params[:id])\n\n respond_to do |format|\n if @menu.update_attributes(params[:menu])\n form...
[ "0.6799328", "0.6693808", "0.6615372", "0.6614102", "0.6589614", "0.65680385", "0.6551415", "0.64472055", "0.6435947", "0.64277345", "0.64277345", "0.64277345", "0.64277345", "0.64138865", "0.63995945", "0.6362843", "0.6359686", "0.6356356", "0.6321748", "0.63182294", "0.6287...
0.6423782
13
DELETE /fdn/menus/1 DELETE /fdn/menus/1.json
def destroy @fdn_menu.destroy respond_to do |format| format.html { redirect_to fdn_menus_url, notice: 'Menu was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_v1_menu.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def delete_menu_item\n @menu_item = MenuItem.find(params[:menu_item_id])\n\n MenuItem.delete_menu_item @menu_item\n\n render :json => {:success => true}.to_json\n end", "def destroy\n @menu = Menu.f...
[ "0.7322866", "0.73039305", "0.7260947", "0.7256692", "0.72332525", "0.7153848", "0.71230936", "0.71201533", "0.7089642", "0.7066222", "0.7063819", "0.704467", "0.7027012", "0.701639", "0.7012851", "0.69902325", "0.69883215", "0.6987405", "0.6987405", "0.6987405", "0.6987405",...
0.7260606
3
Use callbacks to share common setup or constraints between actions.
def set_fdn_menu @fdn_menu = Fdn::Menu.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def fdn_menu_params params.require(:fdn_menu).permit! if params[:fdn_menu] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Initializes a new Client object
def initialize(options = {}) options.each do |key, value| instance_variable_set("@#{key}", value) end yield(self) if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t\tself.client = client\n\tend", "def initialize(client)\n\t self.client=client\n end", "def init_client; end", "def initialize(client)\n self.client=client\n\n\tend", "def initialize(**options)\n @config = Conf...
[ "0.81019163", "0.81019163", "0.8011371", "0.80019844", "0.79748154", "0.7866142", "0.78119975", "0.77765965", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604", "0.7726604...
0.0
-1
Returns the audio representation of the text
def create_speech(*options) CreateSpeech.new(self, options).run end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def audio; end", "def to_mp3(filename, params={})\n text = params[:text] || self\n raise \"to_mp3 language option still not implemented\" if params[:language]\n #system(\"echo \\\"#{text...
[ "0.73485214", "0.69357693", "0.6791217", "0.66965044", "0.664412", "0.6542465", "0.6498437", "0.63559586", "0.6313195", "0.61897004", "0.61816275", "0.6151726", "0.6100427", "0.60862577", "0.60758924", "0.60721487", "0.60591286", "0.60416764", "0.6039716", "0.6021507", "0.601...
0.0
-1