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
Never trust parameters from the scary internet, only allow the white list through.
def event_params params[:event].permit(:when, :body, :source, :image) 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
To exclude classes that have invalid class name, e.g. primary::SchemaMigration from Rails test
def invalid_class_name?(model_class) model_class.name.constantize false rescue NameError true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end", "def stripped_class_name\n name.demodulize\n end", "def to_class\n @migration_class ||= migration_class_name.constantize\n rescue NameError => e\n @name_error = true\n\n raise e unless e.mi...
[ "0.63559544", "0.6169546", "0.61659116", "0.6155963", "0.61371636", "0.6052975", "0.5959054", "0.59319746", "0.58163273", "0.57912296", "0.575814", "0.57039446", "0.5702761", "0.5694757", "0.56555057", "0.56418437", "0.56184244", "0.5617235", "0.55745715", "0.5560626", "0.555...
0.61428607
4
before_action :configure_account_update_params, only: [:update] GET /resource/sign_up
def new super do @token = params[:invite_token] @errors_service = [] return healthcheck_service unless @token.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_account_update_params\n devise_parameter_sanitizer.permit(\n :account_update, keys: authentication_params(type: :sign_up)\n )\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :las...
[ "0.7500589", "0.71697116", "0.7042744", "0.70023584", "0.6949216", "0.6949111", "0.69118834", "0.6850353", "0.6848748", "0.683178", "0.6811191", "0.67840844", "0.67645425", "0.6759307", "0.6754943", "0.6753964", "0.67464745", "0.67343247", "0.6732895", "0.67192256", "0.671875...
0.0
-1
If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params devise_parameter_sanitizer().permit(:sign_up, keys: [:name, :surname, :picture, :invite_token, :organization_name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat...
[ "0.6905034", "0.683687", "0.68280804", "0.67889357", "0.6674015", "0.66522104", "0.66448265", "0.6595933", "0.65606564", "0.64921725", "0.6489163", "0.64781183", "0.64483696", "0.64394945", "0.6419598", "0.6419251", "0.63999707", "0.63977224", "0.63977224", "0.63934815", "0.6...
0.0
-1
Baseline implementation for the disable_xpn_host REST call
def disable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_disable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"...
[ "0.74900347", "0.65866226", "0.6487242", "0.6405204", "0.62242097", "0.60866934", "0.60456496", "0.5968984", "0.588974", "0.5888264", "0.58156306", "0.5756981", "0.5699836", "0.56459945", "0.5637966", "0.56275225", "0.5570077", "0.55105084", "0.54867864", "0.5481838", "0.5469...
0.78032476
0
Baseline implementation for the disable_xpn_resource REST call
def disable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnResource\"\n body = request_pb.projects_disable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n u...
[ "0.76148224", "0.64701885", "0.6257961", "0.62534875", "0.62182504", "0.6121089", "0.61057836", "0.6075139", "0.60473377", "0.59914917", "0.59818035", "0.59754074", "0.5946178", "0.58969575", "0.5872311", "0.58631057", "0.5840956", "0.58352727", "0.581321", "0.5805529", "0.58...
0.76709634
0
Baseline implementation for the enable_xpn_host REST call
def enable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_enable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"...
[ "0.70874244", "0.6420996", "0.63731235", "0.63036346", "0.6262263", "0.6165541", "0.59492815", "0.5906526", "0.58198625", "0.5789588", "0.5729914", "0.56694514", "0.56039906", "0.55609286", "0.55609286", "0.5553002", "0.5544773", "0.55361956", "0.55023575", "0.54946643", "0.5...
0.7431035
0
Baseline implementation for the enable_xpn_resource REST call
def enable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnResource\"\n body = request_pb.projects_enable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri:...
[ "0.7172265", "0.6231739", "0.6006011", "0.5932258", "0.58999354", "0.588118", "0.5855175", "0.58359385", "0.5815846", "0.5690324", "0.56875044", "0.5579524", "0.55619884", "0.55097157", "0.5461821", "0.5456827", "0.5438458", "0.5396896", "0.53866416", "0.53780454", "0.5378045...
0.72756726
0
Baseline implementation for the get REST call
def get request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_request request_pb response = @client_stub.make_get_request( uri: uri, options: options ) result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get; end", "def _get\n http_method(:get)\n end", "def rest_endpoint; end", "def rest_get(base_uri,params)\n begin\n @response = RestClient.get(base_uri,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def http_method\n :get\n end", "def ...
[ "0.73324287", "0.7292981", "0.70138574", "0.693026", "0.6865241", "0.6816611", "0.6803572", "0.6795961", "0.6773166", "0.6773166", "0.6769716", "0.67421967", "0.6724426", "0.664156", "0.6633361", "0.66158813", "0.6603196", "0.65990484", "0.65990484", "0.65959835", "0.65769184...
0.0
-1
Baseline implementation for the get_xpn_host REST call
def get_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_xpn_host_request request_pb response = @client_stub.make_get_request( uri: uri, options: options ) result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnHost\"\n\n response = @client_stub.make_get_request(\n uri: uri,\n options: options,\n )\n\n result = ::Google::...
[ "0.7175156", "0.65536964", "0.6349638", "0.6277782", "0.6198358", "0.6165674", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.61478895", "0.60542005", "0.60414577", "0.60414577", "0.6010017", "0.6010017"...
0.70225894
1
Baseline implementation for the get_xpn_resources REST call
def get_xpn_resources request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_get_xpn_resources_request request_pb response = @client_stub.make_get_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::ProjectsGetXpnResources.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_resources request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnResources\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n ...
[ "0.6579212", "0.60368466", "0.5889131", "0.5756236", "0.5748071", "0.57277274", "0.5681401", "0.56520116", "0.5607179", "0.5588175", "0.55734694", "0.5544406", "0.5519638", "0.5487556", "0.543016", "0.54168254", "0.5416376", "0.5393172", "0.5328364", "0.53093916", "0.53086144...
0.63943833
1
Baseline implementation for the list_xpn_hosts REST call
def list_xpn_hosts request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_xpn_hosts request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/listXpnHosts\"\n body = request_pb.projects_list_xpn_hosts_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n ...
[ "0.74857867", "0.723118", "0.6974196", "0.6974196", "0.6974196", "0.67777866", "0.67777866", "0.671636", "0.66991603", "0.6595991", "0.6574017", "0.64809173", "0.6470523", "0.6466958", "0.6465235", "0.64368975", "0.64307463", "0.64129657", "0.63699335", "0.6310194", "0.629735...
0.7576346
0
Baseline implementation for the move_disk REST call
def move_disk request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_disk_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_disk request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveDisk\"\n body = request_pb.disk_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: ...
[ "0.70715916", "0.6548687", "0.6484039", "0.61993146", "0.60974747", "0.6041206", "0.6041206", "0.5995685", "0.5972715", "0.593383", "0.59021443", "0.58517075", "0.5839177", "0.5828931", "0.57950985", "0.5774989", "0.57248795", "0.57248795", "0.5713674", "0.5682578", "0.564203...
0.7306026
0
Baseline implementation for the move_instance REST call
def move_instance request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_instance_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_instance request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveInstance\"\n body = request_pb.instance_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n ...
[ "0.7261041", "0.68380046", "0.64573467", "0.6040252", "0.6040252", "0.5971018", "0.59322816", "0.58851117", "0.583903", "0.5821589", "0.58022183", "0.57998997", "0.5789968", "0.5789968", "0.5773893", "0.5762453", "0.5751228", "0.57282317", "0.5724356", "0.5676663", "0.5676663...
0.7474949
0
Baseline implementation for the set_common_instance_metadata REST call
def set_common_instance_metadata request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_common_instance_metadata_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_common_instance_metadata request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setCommonInstanceMetadata\"\n body = request_pb.metadata_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n...
[ "0.74214065", "0.59669435", "0.5650688", "0.5604885", "0.5567124", "0.5562294", "0.5514305", "0.54849464", "0.5435901", "0.5435901", "0.5379111", "0.53608197", "0.5331841", "0.53090143", "0.5303271", "0.52978647", "0.52880114", "0.52880114", "0.52880114", "0.52880114", "0.527...
0.7489561
0
Baseline implementation for the set_default_network_tier REST call
def set_default_network_tier request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_default_network_tier_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_network_tier request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setDefaultNetworkTier\"\n body = request_pb.projects_set_default_network_tier_request_resource.to_json\n\n response = @client_stub.make_post_request(\n ...
[ "0.77351016", "0.64955413", "0.5975011", "0.5937313", "0.58802915", "0.58199257", "0.579607", "0.5688632", "0.56367856", "0.5635349", "0.56249404", "0.5597112", "0.5568555", "0.5564882", "0.5563091", "0.5563091", "0.5545937", "0.55433923", "0.54807216", "0.5477234", "0.544526...
0.7897389
0
Baseline implementation for the set_usage_export_bucket REST call
def set_usage_export_bucket request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_usage_export_bucket_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usage_export_bucket request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setUsageExportBucket\"\n body = request_pb.usage_export_location_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri...
[ "0.7764203", "0.6104856", "0.6087291", "0.56268525", "0.5613061", "0.5583615", "0.5548671", "0.5513992", "0.54852957", "0.5484041", "0.54838175", "0.54838175", "0.54838175", "0.5476712", "0.54758847", "0.5384428", "0.5345993", "0.5324406", "0.5272792", "0.5270324", "0.5267032...
0.8040727
0
GET /index GET /index.json
def index $log.info "HomeController -> Index" @distances = {'1 Mile' => 1, '10 Miles' => 2, 'The World' => 3} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get('')\n end", "def index\n respond_to do |format|\n format.html {index_html}\n format.json {index_json}\n end\n end", "def index\n get\n end", "def index\n\t\trespond_to do |format|\n\t\t\tformat.html {html_index}\n\t\t\tformat.json {json_index}\n\t\tend\n\t...
[ "0.79490423", "0.7846905", "0.77262616", "0.768682", "0.7279624", "0.7236605", "0.7236605", "0.7210882", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", ...
0.0
-1
anagram("A", "a") Test for integer, nil, empty Length of Last Word Input: "Hello World" Output: 5 Input => " ", " abc"
def length_of_last_word(s) s = s.lstrip.split(" ") return 0 if s.empty? s.last.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_anagram(text)\n\nend", "def anagram(s)\n if s.length.even?\n substring1 = s[0..s.length/2 - 1].split('')\n substring2 = s[s.length/2..s.length-1].split('')\n i = 0\n while i <= substring1.length\n if substring2.index(substring1[i])\n char = substring1[i]\n substring1.del...
[ "0.77228796", "0.7393318", "0.7303564", "0.7229449", "0.7119977", "0.71055883", "0.70168483", "0.7015578", "0.69819427", "0.697843", "0.6961722", "0.6945478", "0.6944104", "0.6922502", "0.6912186", "0.68927425", "0.6884423", "0.68812084", "0.68798435", "0.68759716", "0.687476...
0.0
-1
Implement strStr() Return the index of the first occurrence of needle in haystack, or 1 if needle is not part of haystack. Input: haystack = "hello", needle = "ll" Output: 2
def str_str(haystack, needle) return 0 if needle.empty? pattern_length = needle.length i = 0 while i <= (haystack.length - pattern_length) do return i if needle == haystack.slice(i, pattern_length) i += 1 end return -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_str(haystack, needle)\n return 0 if needle == \"\"\n \n haystack.each_char.with_index do |char, idx|\n if char == needle[0]\n return idx if haystack[idx, needle.length] == needle\n end\n end\n -1\nend", "def str_str(haystack, needle)\n # 1. If needle is empty, ret...
[ "0.8743117", "0.8476452", "0.84484065", "0.8397843", "0.78311056", "0.7291298", "0.7257582", "0.70884967", "0.7051721", "0.7046752", "0.6984889", "0.6859701", "0.68522537", "0.67696816", "0.6744712", "0.6692133", "0.6664829", "0.66346425", "0.6586058", "0.65225255", "0.651897...
0.8221429
4
Power of Two Given an integer, write a function to determine if it is a power of two. Input: 1 Output: true Input: 16 Output: true Input: 218 Output: false
def is_power_of_two(n) return false if n < 1 return true if n == 1 power = 1 while power <= n power *= 2 return true if power == n end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_power_of_two?(num)\n if(Math::log(num, 2) % 1 != 0)\n return false \n end \n return true\nend", "def power_of_two?(x)\n x > 0 && x & (x - 1) == 0\nend", "def power_of_two?(num)\n product = 1\n while product < num\n product *= 2\n end\n\n num == product\nend", "def power_of_two?(n)\n n &...
[ "0.8393572", "0.83811665", "0.8316857", "0.82985485", "0.82923025", "0.82286066", "0.8220232", "0.82190204", "0.8190981", "0.81907594", "0.81744605", "0.81606585", "0.8158109", "0.81444865", "0.81435865", "0.8138326", "0.8118303", "0.8104718", "0.80180407", "0.79452604", "0.7...
0.8241116
5
Check if a binary tree is a binary search tree
def check_if_bst(node) if node.left unless node.left.value < node.value throw 'not bst' end end if node.right unless node.right.value > node.value throw 'not bst' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced_binary_tree?(root)\n is_balanced_rec(root) != -1\nend", "def is_bst?(node)\nend", "def binary_search_tree?(root, lower_bound = -Float::INFINITY, upper_bound = Float::INFINITY)\n if !root\n true\n elsif root.value >= upper_bound || root.value <= lower_bound\n false\n else\n binary_s...
[ "0.7561033", "0.7424401", "0.7258297", "0.71575105", "0.71522766", "0.70561254", "0.70270354", "0.70202255", "0.6994458", "0.6994143", "0.6994143", "0.69706833", "0.6869991", "0.67910755", "0.67492497", "0.67078835", "0.66818887", "0.65670866", "0.6539834", "0.6525104", "0.65...
0.6890111
12
rename local variable rrlv
def rename_local_variable # Start on either 'asdf', and do viw<leader>rrlv asdf = 10 p asdf # TODO: make this work without 'v' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_var(var_name, opts={})\n @renames[var_name] = scope.rename_var(var_name, opts)\n end", "def renamenx(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def rename_to_bob\n name = 'Bob'\n end", "def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend", "def relvar(na...
[ "0.6476713", "0.62236726", "0.62236726", "0.57593536", "0.562595", "0.5613587", "0.555546", "0.5552649", "0.5541816", "0.55172426", "0.55069834", "0.5469401", "0.5469401", "0.5453131", "0.5394255", "0.53650665", "0.535592", "0.53248", "0.5324194", "0.5324194", "0.53170234", ...
0.72910327
0
but this one is safe
def add_parameter one # <leader>rap[name of param] from here # FIXME: make this work with g:ruby_refactoring_sans_superfluous_syntax and # ditch RAddParameterNB (would cause <leader>rap to respond immediately) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def safe; end", "def safe_by_default; end", "def schubert; end", "def probers; end", "def suivre; end", "def safelist; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def safe=(_arg0); end", "def semact?; false; end", "def escaper=(_); end", "def used?; end", "...
[ "0.66718733", "0.630874", "0.5742951", "0.57395977", "0.57022834", "0.5695599", "0.56697464", "0.5625682", "0.56201065", "0.555713", "0.5528059", "0.55205166", "0.55148107", "0.5438746", "0.5414883", "0.5360013", "0.5339953", "0.53297186", "0.5303258", "0.5260695", "0.5251869...
0.0
-1
Note that meeting the requirements of said algorithm does not necessarily mean the card number is active.
def isvalid?(cc_num) cc_num = cc_num.reverse.split("").map! {|x| x.to_i} checkdig = cc_num[0] cc_num.delete_at(0) odds = [] sd_evens = [] dd_evens = [] total = 0 dd_evs_spl = [] cc_num.each_index { |x| if x % 2 == 1 odds << cc_num[x] elsif cc_num[x] < 5 sd_evens << cc_num[x] else dd_evens << cc_num[x] end } sd_evens.map! {|x| x * 2} dd_evens.map! {|x| (x * 2).to_s} dd_evens = dd_evens.join("").split("") dd_evens.map! {|x| x.to_i} odds.each {|x| total += x} sd_evens.each {|x| total += x} dd_evens.each {|x| total += x} check_dig = (total * 9) % 10 if checkdig == check_dig puts "The number is valid." else puts "The number is invalid." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_detection\n end", "def active_credit_card\n self.credit_cards.find_by(active: true)\n end", "def isAce(card_number)\n return true if (card_number % 13) == 1\nend", "def ace_check\n cards[index_of_11][:points] = 1 if index_of_11 && (total > 21)\n end", "def card\n false\n end", "d...
[ "0.71533257", "0.67501724", "0.66322875", "0.6628957", "0.65874517", "0.6577928", "0.6561504", "0.6542816", "0.6511552", "0.6468263", "0.6468263", "0.6461372", "0.64234483", "0.6412235", "0.63891506", "0.6375983", "0.62880963", "0.62880963", "0.6269367", "0.62391484", "0.6231...
0.0
-1
to keep our routines simple, we encrypt it also (needs to be tested... :D)
def initialize(comm) Puppet.debug("creating new object Puppet::PinasDNS") @dns = comm[:dns] @dnss = comm[:dnss] @dnsh = comm[:dnsh] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt; end", "def decrypt; end", "def _encrypt\n cryptor_files(@encrypting)\n end", "def crypt(p0) end", "def cipher; end", "def encrypt\n self\n end", "def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_passw...
[ "0.84360874", "0.74974084", "0.73315173", "0.72048116", "0.7124951", "0.70508885", "0.70360696", "0.69936615", "0.68230575", "0.68140155", "0.6813903", "0.6787745", "0.67809486", "0.67221636", "0.6704601", "0.66761625", "0.6668785", "0.6642568", "0.66328055", "0.66307056", "0...
0.0
-1
lookup a dns name by ip, if we find a mapped ip, give us the name.
def reverse_name_lookup(ip, type = :A) # look for all the zones type = type.to_sym if type.class != Symbol dns_name = String.new @dns.domains.each do |zone| @dns.domains.get(zone.id).records.each do | record | if record.data == ip and record.type.to_sym == type dns_name = record.name break end end end return dns_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ptr(ip)\n # use cache if ip was already resolved\n return @cache[ip] if @cache[ip]\n\n begin\n name = @hypedns.getname(ip).to_s\n @cache[ip] = name\n return name\n rescue Resolv::ResolvError, SocketError\n return nil\n end\n end", "def reverse_dns_looku...
[ "0.7518146", "0.7421847", "0.7065777", "0.69774175", "0.69774175", "0.6577427", "0.6483836", "0.6450193", "0.6407519", "0.6296571", "0.6146351", "0.61182237", "0.6105767", "0.6038563", "0.6034028", "0.60202956", "0.5984889", "0.59845454", "0.590961", "0.5900563", "0.5853043",...
0.738275
2
create a dns record
def create_record(fqdn, type, ipdata) unless @dnss.is_valid? Puppet.crit dns.cstatus end priority = {} # TODO: research how to implement priority for puppet # priority = priority[0] # if priority.nil? # priority = {} # else # priority = { :priority => priority.to_i } # end record = @dnss.create_record(fqdn, type, ipdata, priority) if record.nil? Puppet.err dns.cstatus end Puppet.notice "Created dns record '#{fqdn}' with id '#{record[:id]}'." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#...
[ "0.79111874", "0.7601401", "0.751647", "0.74093896", "0.7280565", "0.7247105", "0.715277", "0.7105436", "0.7097465", "0.70457083", "0.70249116", "0.69983387", "0.69115025", "0.68434876", "0.67359436", "0.66986054", "0.6695808", "0.66878504", "0.65433764", "0.65114814", "0.651...
0.80369395
0
get list of managed dns names does dns name exist
def zone_exist?(name) match = find_match(@dns.domains, name) if match != nil Puppet.notice "found dns zone #{match.name}" return true else Puppet.debug "zone not found : #{name}" return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def get_nameservers (host)\n\t\tputs \"Retrieve a list of authoritative name server for: #{host}\" if @verbose\n\t\tbegin\n\t\t\tdomain=get_domain_root(host)\n\t\t\tw=Wmap::Whois.new\n\t\t\tns = w.query(domain).nameservers.map! { |x| x.name }\n\...
[ "0.6982348", "0.6486663", "0.6458568", "0.6433711", "0.6415802", "0.6387529", "0.6387529", "0.6371843", "0.6368246", "0.6352938", "0.63450956", "0.6302255", "0.62767863", "0.62422323", "0.6147947", "0.6139751", "0.6135192", "0.60991794", "0.6093843", "0.60455513", "0.60195744...
0.57708126
37
determine if record exists
def record_exist?(fqdn, type) matches = find_match(@dnss.records, fqdn, true) if matches != nil record = nil matches.each do |record| Puppet.debug "inspecting #{record.hash_type} == #{type}" if record.hash_type.to_s == type.to_s Puppet.notice "found dns record : #{fqdn}, #{type}" return true end end else Puppet.debug "match found no record : #{fqdn}, #{type}" end Puppet.debug "record not found : #{fqdn}, #{type}" return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n load!\n true\n rescue RecordNotFound\n false\n end", "def has_record?(record)\n table.has_key?(lookup_key_for(record))\n end", "def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not ...
[ "0.81976396", "0.80839896", "0.7752192", "0.76036686", "0.75926435", "0.7587839", "0.746919", "0.746919", "0.7455745", "0.7446991", "0.7357543", "0.7344456", "0.73401487", "0.7338183", "0.7330477", "0.7326184", "0.73158324", "0.73088336", "0.7301359", "0.7296956", "0.7291184"...
0.69222325
50
get a dns record object
def get_record(fqdn, type) matches = find_match(@dnss.records, fqdn, true) if matches != nil record = nil matches.each do |record| Puppet.debug "inspecting #{record.hash_type} == #{type}" if record.hash_type.to_s == type.to_s Puppet.notice "found dns record : #{fqdn}, #{type}" return record end end else Puppet.debug "match found no record : #{fqdn}, #{type}" end Puppet.debug "record not found : #{fqdn}, #{type}" return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_record(fqdn)\n\n url = \"https://dnsapi.cn/Record.List\"\n\n h = HTTPClient.new()\n\n default_params = {\n :login_email => \"\"\n }\n params = {\n\n }.merge(default_params)\n\n res = h.post(url, params)\n records = JSON.parse(res.body)['records']\n\n\n # ...
[ "0.71340287", "0.68997043", "0.6855213", "0.67315835", "0.6587001", "0.6580899", "0.6540604", "0.64740884", "0.64225733", "0.6381819", "0.6371659", "0.6353926", "0.63450676", "0.6343346", "0.63272756", "0.6322495", "0.6267944", "0.62651867", "0.6238346", "0.6217513", "0.62006...
0.70954484
1
create a dns zone
def create_zone(zone, email, ttl) @dnsh.name = zone @dnsh.email = email @dnsh.ttl = ttl if @dnsh.save == true Puppet.notice "Created dns zone #{zone} with id #{@dnsh.id}" else Puppet.err @dnsh.cstatus raise @dnsh.cstatus end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n dns_service.create_zone(get_zone, get_email, get_ttl) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def zone_create(zone)\n ob...
[ "0.7931895", "0.739134", "0.7235577", "0.7179706", "0.698375", "0.6760779", "0.6733734", "0.6639063", "0.6634835", "0.6634155", "0.6612857", "0.6490288", "0.64193064", "0.6364734", "0.6350982", "0.63324004", "0.63143957", "0.6301615", "0.62735534", "0.62387955", "0.62060624",...
0.81226397
0
remove a dns zone
def remove_zone(zone_or_id) zone = get_zone(zone_or_id) # destroy the zones Puppet.notice "removing zone #{zone.name}" Puppet.debug "zone.name => #{zone.name}" Puppet.debug "zone.id => #{zone.id}" zone.destroy if zone_exist?(zone_or_id) Puppet.err "Failed to remove zone => #{zone_or_id}" raise "Failed to remove zone => #{zone_or_id}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done wit...
[ "0.79036623", "0.7475566", "0.7417273", "0.7274328", "0.72708243", "0.7064017", "0.7005779", "0.69378227", "0.6888122", "0.6855303", "0.68493116", "0.68198544", "0.6663066", "0.66160464", "0.6500788", "0.64389473", "0.64343834", "0.6367987", "0.63340586", "0.63256085", "0.626...
0.6823242
11
get a dns zone
def get_zone(zone) return find_match(@dns.domains, zone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hosted_zone()\n\t\tresp = @r53.get_hosted_zone(:id => @zone)\n\t\tresp[:hosted_zone]\n\tend", "def get_zone(zone)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetZone.new,\n :path => \"/api/1.1/zone...
[ "0.7621107", "0.7456592", "0.7333731", "0.730833", "0.7251321", "0.6871877", "0.6811838", "0.67660356", "0.6747667", "0.6747667", "0.66899514", "0.6667358", "0.66535854", "0.66006154", "0.65746117", "0.6572665", "0.6535256", "0.6501411", "0.6485206", "0.6485206", "0.64761746"...
0.7733444
0
items IS a method. attr_accessor creates two instance methods.reader and getter method. if we want to read specific properties from an instance, we need to initialize that method with a variable to hold the method
def initialize(discount = 0) @total = 0 @discount = discount @items = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items(**items)\n const_set(:ITEMS, items)\n item_names = items.keys\n attr_accessor *item_names\n end", "def get_items\n @items\n end", "def initialize(item)\n dm = GcpResourceDynamicMethods.new\n dm.create_methods(self, item)\n\n # Set the item as a property ...
[ "0.7242194", "0.6242292", "0.61954933", "0.61513776", "0.61238015", "0.61218935", "0.61102283", "0.610126", "0.6066452", "0.6066452", "0.5995553", "0.5991889", "0.5952791", "0.59464437", "0.59328246", "0.59289247", "0.5913085", "0.5913085", "0.5913085", "0.5913085", "0.591219...
0.0
-1
GET /users GET /users.json
def index @users = User.order(:name).page(params[:page]).per_page(20) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.73...
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) if @user.application_admin? && !current_user.application_admin? flash[:error] = "Error: since you are not logged in as an application admin user, you can't create a new application admin user." render :edit else #set a random password, but don't tell the user. They'll need to use the token to reset the password. random_pw = SecureRandom.hex(8) @user.password = random_pw @user.password_confirmation = random_pw if @user.save @user.generate_password_token! NotificationMailer.new_user_email(@user,current_user).deliver up = UserPermission.new(rulemaking: current_rulemaking, user: @user) up.save flash[:notice] = "An account for #{@user.name} was successfully created. They have been given permissions to this rulemaking, and a link to log in and set up their password has been emailed to them." redirect_to users_path else render :edit end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.application_admin? && user_params[:application_admin] != '1' && User.where(application_admin: true).count == 1 flash[:error] = "There must be at least one application admin user." format.html { redirect_to users_path } format.json { render json: @user.errors, status: "Error: there must be at least one application admin user." } elsif !@user.application_admin? && user_params[:application_admin] == '1' && !current_user.application_admin? flash[:error] = "Error: since you are not logged in as an application admin user, you can't edit a user to make them an application admin." format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } elsif @user.update(user_params) if @user == current_user format.html { redirect_to profile_edit_path, notice: 'Your profile was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { redirect_to users_path, notice: 'User successfully updated.' } format.json { render :show, status: :ok, location: @user } end else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.7224859", "0.7128554", "0.7003616", "0.690352", "0.6821481", "0.68151546", "0.6708411", "0.6692893", "0.6680146", "0.66730475", "0.66725844", "0.66651213", "0.66651213", "0.66596603", "0.66596603", "0.6655346", "0.6648638", "0.66431737", "0.66419953", "0.6634677", "0.66177...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy #any suggested changes assigned to this user will be set to assigned_to_id = null automatically by the foreign key constraint. respond_to do |format| if @user.application_admin? && User.where(application_admin?: true).count == 1 flash[:error] = "The last application admin user cannot be deleted." format.html { redirect_to users_path } format.json { render json: @user.errors, status: :unprocessable_entity } elsif ChangeLogEntry.where(user: @user).count > 0 flash[:error] = "This user can't be deleted, because there are one or more change log entries for actions they took. If this user no longer uses the application, try setting them to inactive instead." format.html { redirect_to users_path } format.json { render json: @user.errors, status: :unprocessable_entity } else @user.destroy format.html { redirect_to users_url, notice: 'User was successfully deleted. Any suggested changes assigned to this user are now assigned to no one.' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935"...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_self_as_user @user = self.current_user 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 user_params params.require(:user).permit(:name, :email, :application_admin, :active) 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
Use callbacks to share common setup or constraints between actions.
def set_house_purchase @house_purchase = HousePurchase.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Only allow a trusted parameter "white list" through.
def house_purchase_params params.require(:house_purchase).permit(:trade_day, :trade_type, :house_type, :house_address, :house_amount) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
checks that file exists TODO: use active support's delegate method ?
def check_for_file @ff.check_for_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exists\n end", "def exist; File.exist?(@fname); end", "def file_exists?(file)\n false\n end", "def file_exists?(path)\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def file_exists?(file)\n File.exists?(file)\n end", "def file_exist?\...
[ "0.85186595", "0.8347249", "0.8271966", "0.8260194", "0.7983861", "0.7979421", "0.79466254", "0.79173124", "0.79169804", "0.7881887", "0.7808925", "0.7808304", "0.78068596", "0.7799756", "0.7764423", "0.7722265", "0.7684597", "0.7680001", "0.76455075", "0.7637633", "0.7637431...
0.74490917
39
pulls info about the file
def file_stats @stats = @ff.get_stats end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_info(path)\n info File.read(path)\n end", "def get_info(filename)\n @octokit_client = @octokit_client_factory.call if @octokit_client.nil?\n @octokit_client.contents @fullname, path: filename\n end", "def info(command)\n if !command[1] || command[1].empty?\n puts \"please specif...
[ "0.7792083", "0.71775687", "0.7158657", "0.7034281", "0.6905487", "0.68901384", "0.6790478", "0.67184913", "0.66902345", "0.667823", "0.6673454", "0.6647459", "0.65786797", "0.6565178", "0.64748925", "0.64623564", "0.6428776", "0.6388954", "0.63585883", "0.6357946", "0.633669...
0.649796
14
the key attribute of a query
def initialize(lipid, mods=[]) @lipid = lipid @modifications = mods @mz = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def key_field\n 'key'\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n @key\n end", "def ke...
[ "0.787833", "0.77189225", "0.77189225", "0.7650753", "0.7471585", "0.7471585", "0.7457709", "0.7457709", "0.74514955", "0.7331824", "0.7331824", "0.73312074", "0.7317567", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.721...
0.0
-1
the unsigned m/z value
def mz _mz_signed = mz_signed _mz_signed >= 0 ? _mz_signed : -_mz_signed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def z\n return @z\n end", "def z_value\n @z_value ||= self.class.z_value\n end", "def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\...
[ "0.6043465", "0.6006474", "0.5899675", "0.5866685", "0.57574797", "0.57383895", "0.5709954", "0.57004696", "0.5652513", "0.55898327", "0.55563855", "0.55516213", "0.5547633", "0.5527039", "0.5519486", "0.5519486", "0.55054855", "0.55054855", "0.55045134", "0.54850674", "0.541...
0.6661136
0
GET /supplies_providers_loans/1 GET /supplies_providers_loans/1.json
def show @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html #...
[ "0.7412478", "0.71966857", "0.69355094", "0.6468367", "0.6468367", "0.6420029", "0.62445724", "0.62176585", "0.61988497", "0.6192699", "0.61271405", "0.6050038", "0.6038974", "0.6025539", "0.6025539", "0.6006675", "0.5911915", "0.59048086", "0.59004813", "0.58405393", "0.5834...
0.7729894
0
GET /supplies_providers_loans/new GET /supplies_providers_loans/new.json
def new @supplies_providers_loan = SuppliesProvidersLoan.new respond_to do |format| format.html # new.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html #...
[ "0.7858679", "0.7730011", "0.7593227", "0.7593227", "0.7569273", "0.73122126", "0.70767003", "0.7011588", "0.70106", "0.6993267", "0.69070226", "0.6868139", "0.68442243", "0.6826152", "0.680316", "0.6797949", "0.67949706", "0.67820007", "0.6753396", "0.6752861", "0.67484", ...
0.7965906
0
POST /supplies_providers_loans POST /supplies_providers_loans.json
def create @supplies_providers_loan = SuppliesProvidersLoan.new(params[:supplies_providers_loan]) @supply = Supply.find(@supplies_providers_loan.supply_id) @supply.stock_ini += @supplies_providers_loan.quantity @supplies_providers_loan.company_id = current_user.company_id respond_to do |format| if @supplies_providers_loan.save @supply.save format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully created.' } format.json { render json: @supplies_providers_loan, status: :created, location: @supplies_providers_loan } else format.html { render action: "new" } format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.h...
[ "0.68659556", "0.6658662", "0.5999306", "0.5947909", "0.5892493", "0.5863105", "0.58490545", "0.58364147", "0.5799118", "0.5791754", "0.5778713", "0.57750654", "0.57271034", "0.5725775", "0.5708938", "0.5701417", "0.5678862", "0.5665165", "0.5657129", "0.56388474", "0.5562539...
0.5731408
12
PUT /supplies_providers_loans/1 PUT /supplies_providers_loans/1.json
def update @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| if @supplies_providers_loan.update_attributes(params[:supplies_providers_loan]) format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_loan.update_attributes(params[:supplies_loan])\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.67771786", "0.62539315", "0.618528", "0.6084787", "0.6064328", "0.6016281", "0.59802955", "0.59668136", "0.5912985", "0.5900591", "0.5874986", "0.5874986", "0.5851251", "0.5841423", "0.581742", "0.5806443", "0.5799978", "0.57990664", "0.5798691", "0.5778461", "0.573745", ...
0.7066614
0
DELETE /supplies_providers_loans/1 DELETE /supplies_providers_loans/1.json
def destroy @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) @supplies_providers_loan.destroy respond_to do |format| format.html { redirect_to supplies_providers_loans_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destro...
[ "0.7558326", "0.6920013", "0.6920013", "0.6920013", "0.691344", "0.68868333", "0.68526495", "0.6796305", "0.6729628", "0.66929644", "0.66909593", "0.66909593", "0.66909593", "0.66542876", "0.6626142", "0.66153806", "0.66112024", "0.66065884", "0.6593572", "0.6592053", "0.6578...
0.7649287
0
Create a new minimizer
def initialize(lower, upper, proc) raise "first argument should be lower than second" if lower>=upper @lower=lower @upper=upper @proc=proc golden = 0.3819660; @expected = @lower + golden * (@upper - @lower); @max_iteration=MAX_ITERATIONS @epsilon=EPSILON @iterations=0 @log=[] @log_header=%w{I xl xh f(xl) f(xh) dx df(x)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n FiniteAutomaton.new \n end", "def minimize; end", "def min(expression)\n @objective = Objective.new(:minimize, expression)\n end", "def minimize\n # create a new one, or modif...
[ "0.6874386", "0.66997546", "0.648011", "0.64729565", "0.58447284", "0.5651434", "0.54799885", "0.5431681", "0.5418742", "0.53496504", "0.534537", "0.52192473", "0.51591676", "0.51274407", "0.5107791", "0.51020116", "0.504293", "0.501242", "0.49088362", "0.48684236", "0.481410...
0.0
-1
Iterate to find the minimum
def iterate raise "You should implement this" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def my_min(list)\n min = l...
[ "0.8006529", "0.7908942", "0.7890087", "0.78867567", "0.78739315", "0.7829374", "0.78068745", "0.7798616", "0.77788436", "0.7738859", "0.7732248", "0.7707186", "0.7694867", "0.7687151", "0.7677542", "0.7669644", "0.76679945", "0.765929", "0.7656066", "0.7653131", "0.76226556"...
0.0
-1
Start the minimization process If you want to control manually the process, use brent_iterate
def iterate k=0 bracketing if @do_bracketing while k<@max_iteration and (@x_lower-@x_upper).abs>@epsilon k+=1 result=brent_iterate raise FailedIteration,"Error on iteration" if !result begin @log << [k, @x_lower, @x_upper, @f_lower, @f_upper, (@x_lower-@x_upper).abs, (@f_lower-@f_upper).abs] rescue =>@e @log << [k, @e.to_s,nil,nil,nil,nil,nil] end end @iterations=k return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_rating_run\n @rating_run.process\n end", "def minimize; end", "def run\n while 1\n if step == 1 then break end\n end\n end", "def minimize(&block)\n @min_block = block\n Minuit.register_fcn(self)\n begin\n Minuit.migrad\n rescue Minuit::CommandEr...
[ "0.6143362", "0.5938945", "0.5543928", "0.5486886", "0.5454133", "0.5428745", "0.54168546", "0.541079", "0.5341115", "0.5298029", "0.52548355", "0.5242311", "0.52418405", "0.5219404", "0.5192127", "0.5189375", "0.51527756", "0.5152327", "0.5151647", "0.51488686", "0.51398736"...
0.0
-1
== Parameters: point: Coordinates of the point value: Function value at the point
def initialize(point, value) @point = point.clone @value = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end", "def contract_inside(center, point, gamma=0.5)\n p = center + ( point - center ) * ...
[ "0.62752974", "0.6051425", "0.6048171", "0.6048171", "0.6047147", "0.59952956", "0.5847952", "0.58306503", "0.5822637", "0.58110577", "0.57494825", "0.57016295", "0.5674655", "0.5629805", "0.5625533", "0.5616871", "0.5611975", "0.5608872", "0.5605202", "0.55977094", "0.558881...
0.0
-1
returns a copy of the point
def get_point_clone return @point.clone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def to_point\n if length == 2\n p = Point.new(*self)\n elsif length == 1\n p = self[0].clone\n end\n return p\n end", ...
[ "0.7704209", "0.73078203", "0.7215952", "0.71435744", "0.70725566", "0.7001392", "0.67546225", "0.67159456", "0.66975594", "0.66770905", "0.6642301", "0.6609255", "0.65990114", "0.6576018", "0.65734076", "0.6562474", "0.6559707", "0.6537596", "0.6490234", "0.63733876", "0.637...
0.87721944
0
increment iteration counter by 1
def increment_iterations_counter @iterations += 1 raise "iteration limit reached" if @iterations > @max_iterations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_iteration\n @iteration += 1\n end", "def inc\n $i + 1\n end", "def increment\n @counter = @counter + 1\n end", "def increase_index\n @i +=1\n end", "def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n ...
[ "0.8831108", "0.78934926", "0.7621582", "0.75952846", "0.7546926", "0.74968636", "0.74813884", "0.72551954", "0.71128196", "0.6923429", "0.69094497", "0.6895905", "0.6869051", "0.6825437", "0.67964745", "0.6777269", "0.67709917", "0.6759741", "0.6640851", "0.6631496", "0.6629...
0.78155714
2
compares 2 PointValuePair points
def compare(v1, v2) if v1.value == v2.value return 0 elsif v1.value > v2.value return 1 else return -1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(x, y); end", "def eql?(other_point)\n @x == other_point.x && @y == other_point.y\n end", "def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end", "def eq_for_coordinates(p, s, t)\n q, r = first_point, second_point\n s, t = s.to_s+\"_...
[ "0.66092783", "0.65819407", "0.6482415", "0.6312989", "0.62846106", "0.6251068", "0.62440825", "0.6167803", "0.6143469", "0.61307764", "0.6111861", "0.61116445", "0.6055054", "0.604694", "0.5974834", "0.5952699", "0.5909076", "0.58601165", "0.5855901", "0.5842174", "0.5786715...
0.0
-1
checks whether the function is converging
def converging? # check the convergence in a given direction comparing the previous and current values def point_converged?(previous, current) pre = previous.value curr = current.value diff = (pre - curr).abs size = [pre.abs, curr.abs].max return !((diff <= (size * @relative_threshold)) and (diff <= @absolute_threshold)) end # returns true if converging is possible atleast in one direction if @iterations > 0 # given direction is converged converged = true 0.upto(@simplex.length - 1) do |i| converged &= !point_converged?(@previous[i], @simplex[i]) end return !converged end # if no iterations were done, convergence undefined return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converge(state) ; end", "def converge_complete\n end", "def converge\n transition_to(:converge)\n end", "def converge\n transition_to(:converge)\n end", "def solvable?\n steps > 0\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def converge?(a, b)\n differe...
[ "0.6986648", "0.6911506", "0.6849328", "0.6849328", "0.6108658", "0.6070145", "0.606297", "0.6011228", "0.59503126", "0.57450545", "0.56002283", "0.55354744", "0.55287474", "0.5504217", "0.5498693", "0.5497953", "0.5497953", "0.54847443", "0.5481534", "0.54738367", "0.5472005...
0.7549439
0
only the relative position of the n vertices with respect to the first one are stored
def start_configuration=(steps) n = steps.length @start_configuration = Array.new(n) { Array.new(n, 0) } 0.upto(n - 1) do |i| vertex_i = @start_configuration[i] 0.upto(i) do |j| raise "equals vertices #{j} and #{j+1} in simplex configuration" if steps[j] == 0.0 0.upto(j) do |k| vertex_i[k] = steps[k] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@...
[ "0.6600981", "0.6527703", "0.6527703", "0.63610095", "0.6318691", "0.62971103", "0.6211614", "0.61948067", "0.6161065", "0.6149511", "0.6082587", "0.607094", "0.6035557", "0.5992011", "0.595214", "0.59265494", "0.5912111", "0.5870704", "0.58693504", "0.5868207", "0.58451927",...
0.0
-1
Build an initial simplex == Parameters: start_point: starting point of the minimization search
def build_simplex(start_point) n = start_point.length raise "dimension mismatch" if n != @start_configuration.length # set first vertex @simplex = Array.new(n+1) @simplex[0] = PointValuePair.new(start_point, Float::NAN) # set remaining vertices 0.upto(n - 1) do |i| conf_i = @start_configuration[i] vertex_i = Array.new(n) 0.upto(n - 1) do |k| vertex_i[k] = start_point[k] + conf_i[k] end @simplex[i + 1] = PointValuePair.new(vertex_i, Float::NAN) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_simplex(x1=ParameterSet.new(-4.0,-4.0),c=8)\n p= c/Math.sqrt(2) * (Math.sqrt(3)-1)/2\n q= ParameterSet.new(p,p)\n x2 = x1 + q + ParameterSet.new(1.0,0.0) * (c/Math.sqrt(2))\n x3 = x1 + q + ParameterSet.new(0.0,1.0) * (c/Math.sqrt(2))\n @simplex = [x1,x2,x3]\n end", "def ev...
[ "0.6069061", "0.5490917", "0.54820216", "0.53754777", "0.53543246", "0.5308169", "0.5261818", "0.5249094", "0.5223264", "0.51858115", "0.5159656", "0.51582664", "0.50935674", "0.50349516", "0.503476", "0.5029023", "0.49839765", "0.49836835", "0.49726254", "0.495024", "0.49359...
0.8126109
0
Evaluate all the nonevaluated points of the simplex
def evaluate_simplex # evaluate the objective function at all non-evaluated simplex points 0.upto(@simplex.length - 1) do |i| vertex = @simplex[i] point = vertex.point if vertex.value.nan? @simplex[i] = PointValuePair.new(point, f(point)) end end # sort the simplex from best to worst @simplex.sort!{ |x1, x2| x1.value <=> x2.value } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate\n SQ.inject { |x, n| x + (@colors[n] == @mx ? (PST[n] + VALUE[@pieces[n]]) :\n @colors[n] == @mn ? -(PST[n] + VALUE[@pieces[n]]) : 0) }\n end", "def solve!\n while empty_squares.any?\n square = empty_squares.detect { |square| legal_values_for_square(squa...
[ "0.5377877", "0.52260196", "0.51628906", "0.5126159", "0.50868887", "0.50844866", "0.504259", "0.5021839", "0.5016635", "0.5001472", "0.49847087", "0.4974209", "0.49550626", "0.49518788", "0.4950949", "0.49488753", "0.4925819", "0.49192926", "0.49045908", "0.49043077", "0.490...
0.79259807
0
Replace the worst point of the simplex by a new point == Parameters: point_value_pair: point to insert
def replace_worst_point(point_value_pair) n = @simplex.length - 1 0.upto(n - 1) do |i| if (compare(@simplex[i], point_value_pair) > 0) point_value_pair, @simplex[i] = @simplex[i], point_value_pair end end @simplex[n] = point_value_pair end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_point point\n add_to_point! point.dup\n end", "def evaluate_simplex\n # evaluate the objective function at all non-evaluated simplex points\n 0.upto(@simplex.length - 1) do |i|\n vertex = @simplex[i]\n point = vertex.point\n if vertex.value.nan?\n ...
[ "0.568733", "0.5383071", "0.5202251", "0.51968026", "0.51624954", "0.5158071", "0.51291203", "0.5086484", "0.5053831", "0.5042788", "0.4954", "0.49424553", "0.49386322", "0.49386322", "0.49313292", "0.4928575", "0.49139407", "0.48842263", "0.48108265", "0.47963923", "0.478787...
0.8584808
0
loads structure file csv, returns structure as array
def loadStructure(file) csv_text = File.read(file) return CSV.parse(csv_text, :headers => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_array(csv); end", "def csvReader(file, headers)\n begin\n csvTable = CSV.read(file, {col_sep:\"\\t\", quote_char:\"\\0\", headers:headers})\n rescue ArgumentError\n puts \"Error: Unsupported encoding, tabulated/CSV file must be in UTF-8 format.\"\n abort\n end\n parsed...
[ "0.68302494", "0.673602", "0.6607786", "0.659163", "0.6573549", "0.6573456", "0.65718514", "0.6570866", "0.6569528", "0.65678114", "0.65153396", "0.65033907", "0.6465346", "0.6458263", "0.6405393", "0.6377711", "0.6369217", "0.63432074", "0.6327245", "0.6321517", "0.6298861",...
0.76938415
0
returns array of children
def findChildren (parent, structure) #search for items in structure where item.manager = parent children = [] #puts parent structure.each do |employee| #puts '> ' + employee.join(', ') if employee[2].eql? parent #puts 'got it!' children << employee end end return children end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children\n return children\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n unless defined? @children\n @children...
[ "0.8727291", "0.8715515", "0.8715515", "0.8684842", "0.8684842", "0.8684842", "0.86330944", "0.86246854", "0.8581901", "0.8515485", "0.8479984", "0.84476614", "0.83356273", "0.8330258", "0.82925564", "0.8259395", "0.82534695", "0.8235405", "0.82339305", "0.8206533", "0.816763...
0.0
-1
Checks MRN number to see if we have seen patient before MRN is a life time ID for FH
def new_patient?(patient) return Patient.find_by_mrn(patient.mrn).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldr07_invalid?\n return true unless leader\n leader[7] !~ /[abcdims]/\n end", "def mnf?\n\t\tgame = Game.find(game_id)\n\t\t(game.game_time.to_datetime.utc - 4.hours).monday? ? true : false\n\t\t# removing four hours so that SNF games don't show up as MNF games\n\t\t# which they would in utc t...
[ "0.58972704", "0.56985015", "0.5395548", "0.526967", "0.51973104", "0.51459634", "0.5142374", "0.51226515", "0.51135284", "0.49679047", "0.49559268", "0.49558246", "0.4952661", "0.4949892", "0.49378726", "0.49257678", "0.49080813", "0.49079835", "0.48854214", "0.48752916", "0...
0.5040314
9
Records the original rvm environment and sets up a new gemset.
def setup_rvm @@rvm_original_env ||= RVM.current.expanded_name @@env = RVM::Environment.current @@env.gemset_create(app_name) @@env.gemset_use!(app_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_rvm\n @@env.use!(@@rvm_original_env)\n end", "def restore_env(env); end", "def gemset_initial\n rvm(:gemset, :initial).successful?\n end", "def env=(environment); end", "def env=(environment); end", "def finish\n super\n @_env[ENV_KEY] = self\n end", "def _e...
[ "0.69092965", "0.62419206", "0.5963159", "0.59286314", "0.59286314", "0.57703185", "0.5767454", "0.5766548", "0.5700036", "0.5684107", "0.5649919", "0.56323075", "0.55625874", "0.5482174", "0.54086643", "0.5397399", "0.5397006", "0.53675944", "0.53661716", "0.5351091", "0.534...
0.7845773
0
Reverts to the original rvm environment
def reset_rvm @@env.use!(@@rvm_original_env) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_env(env); end", "def restore\n end", "def restore_env(env)\n @src, @tree, @block_ial, @stack, @text_type = *env\n end", "def restore; end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def setup_rvm\n @@rvm_original_env ||= RVM.current.expan...
[ "0.7008531", "0.6195144", "0.60789096", "0.60209644", "0.5970747", "0.59668154", "0.59461004", "0.59411603", "0.58845127", "0.58845127", "0.58653486", "0.58198476", "0.5814897", "0.58031124", "0.57422304", "0.57039714", "0.5681587", "0.5634584", "0.562108", "0.56122756", "0.5...
0.8179662
0
Returns the rbenv ruby version
def rbenv_ruby `rbenv version`.split(' ').first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n if ruby = ENV['RUBY']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend", "def ruby_version\n\t\treturn RUBY_VERSIO...
[ "0.71018237", "0.7021712", "0.6862039", "0.677662", "0.67422354", "0.66946185", "0.65791935", "0.6559915", "0.6503853", "0.64653397", "0.64008373", "0.64001", "0.63920224", "0.6369104", "0.62895656", "0.62581515", "0.62406", "0.6203518", "0.618088", "0.60488933", "0.6047772",...
0.89887893
0
Returns the RVM ruby version
def rvm_ruby @@env.expanded_name.match(/([\w\-\.]+)/)[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n default = %x{ rvm current}.strip\n items = %x{ rvm ls strings }.split.compact\n\n ruby = menu_with_default \"RVM Ruby version to use for deployment:\", items,default\n ruby = ask \"Enter alternative RVM Ruby string: \" if ruby =~ /Other/\n ruby\n end", "def ruby_version\n ...
[ "0.79461366", "0.6698439", "0.6692845", "0.6652912", "0.66254026", "0.66031736", "0.6598809", "0.655525", "0.64827526", "0.64827526", "0.63912076", "0.6375008", "0.63747865", "0.6343658", "0.632626", "0.6312146", "0.62389517", "0.6225651", "0.6220597", "0.62051994", "0.619585...
0.755152
1
Returns true if rbenv is installed.
def rbenv_installed? @rbenv_installed ||= `which rbenv`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_virtualenv_installed(python)\n `#{python} -m virtualenv --help 2>&1`\n if (0 != $?.to_i)\n false\n else\n true\n end\n end", "def ruby?\n exist? 'Gemfile'\n end", "def python?\n exist? 'requirements.txt'\n end", "def installed?\n !IO.popen(\"which #{self}\")...
[ "0.77486736", "0.72765374", "0.6919784", "0.67822814", "0.651632", "0.648404", "0.6482359", "0.64690065", "0.6451853", "0.64186656", "0.6410398", "0.63503563", "0.6338802", "0.6338802", "0.6338802", "0.6336043", "0.630004", "0.6287065", "0.6255579", "0.6255579", "0.62461686",...
0.88057137
0
Returns true if RVM is installed.
def rvm_installed? @rvm_installed ||= `which rvm`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend", "def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",...
[ "0.83704555", "0.78068435", "0.73033595", "0.72069067", "0.7049136", "0.6857459", "0.6763749", "0.66081756", "0.6594433", "0.6593279", "0.6572746", "0.6558013", "0.6551827", "0.65492225", "0.65381473", "0.65381473", "0.6535947", "0.64989525", "0.6495354", "0.64644104", "0.645...
0.86571807
0
GET /chase_vehicles GET /chase_vehicles.json
def index @chase_vehicles = ChaseVehicle.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def show\n render json: @vehicle\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def index\n @vehicles = Vehicle....
[ "0.69964904", "0.69512826", "0.6920142", "0.6902806", "0.6787383", "0.67636365", "0.6747108", "0.66985935", "0.6606108", "0.6438546", "0.6360747", "0.6341063", "0.6323488", "0.63189006", "0.6306929", "0.62902707", "0.62902707", "0.6276853", "0.6272245", "0.6238601", "0.621447...
0.7339431
1
GET /chase_vehicles/1 GET /chase_vehicles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @vehicle\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end", "def index\n @chase_vehicles = ChaseVehicle.all\n end", "def index\n @chase_v...
[ "0.7163817", "0.710176", "0.7094259", "0.7094259", "0.69484675", "0.69316834", "0.6834217", "0.68270093", "0.6688323", "0.6676003", "0.66755193", "0.667411", "0.6647563", "0.6512315", "0.6512098", "0.6512098", "0.64661384", "0.6446154", "0.63971066", "0.6362867", "0.6317246",...
0.0
-1
POST /chase_vehicles POST /chase_vehicles.json
def create @chase_vehicle = ChaseVehicle.new(chase_vehicle_params) respond_to do |format| if @chase_vehicle.save format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' } format.json { render action: 'show', status: :created, location: @chase_vehicle } else format.html { render action: 'new' } format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def create_vehicles veh...
[ "0.726066", "0.72551686", "0.694362", "0.694362", "0.694362", "0.6789401", "0.669196", "0.6687901", "0.6627009", "0.6571046", "0.6530366", "0.6498463", "0.6489297", "0.644983", "0.64340776", "0.6402104", "0.6339483", "0.62834346", "0.6263557", "0.6261981", "0.62587154", "0....
0.7026579
3
PATCH/PUT /chase_vehicles/1 PATCH/PUT /chase_vehicles/1.json
def update respond_to do |format| if @chase_vehicle.set(chase_vehicle_params) format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n...
[ "0.7265345", "0.71993643", "0.7122561", "0.7122561", "0.7082296", "0.69862705", "0.69862705", "0.69862705", "0.69370764", "0.67699367", "0.6696247", "0.6612618", "0.6588545", "0.656046", "0.656046", "0.6551436", "0.6547223", "0.6524608", "0.65235007", "0.65010476", "0.6479677...
0.71813715
3
DELETE /chase_vehicles/1 DELETE /chase_vehicles/1.json
def destroy @chase_vehicle.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |forma...
[ "0.75328815", "0.7520184", "0.7520184", "0.73870677", "0.7347832", "0.7293985", "0.72215956", "0.72215956", "0.72215956", "0.72215956", "0.7196833", "0.7184534", "0.71619755", "0.71357685", "0.7115856", "0.70986724", "0.70986724", "0.70474255", "0.702127", "0.7010943", "0.699...
0.76296186
1
Use callbacks to share common setup or constraints between actions.
def set_chase_vehicle @chase_vehicle = ChaseVehicle.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 chase_vehicle_params params.require(:chase_vehicle).permit(:description, :ident, :mission_id, :chase_server_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
this function is used to get the node from feature files.
def get_target(host) case host when 'server' node = $server when 'ceos-minion' node = $ceos_minion when 'ssh-minion' node = $ssh_minion when 'sle-minion' node = $minion when 'sle-client' node = $client when 'sle-migrated-minion' node = $client else raise 'Invalid target.' end node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature\n child_node.feature\n end", "def feature\n child_node.feature\n end", "def get_node(fqn)\n node = @nodes.get_node(fqn)\n node if context?(node)\n end", "def get_node(node)\n\t\t\t@nodes[node]\n\t\tend", "def node\n @context.node\n end", "def file_node(path)\n ...
[ "0.71671754", "0.71671754", "0.6584795", "0.6537017", "0.6433615", "0.64158225", "0.6399734", "0.6399734", "0.6351271", "0.6351271", "0.6320524", "0.6295444", "0.62834597", "0.6276243", "0.62040997", "0.6200791", "0.6170005", "0.61695874", "0.61650485", "0.6151035", "0.615103...
0.0
-1
Strong params for FormTemplate
def form_template_params params.permit(:name, questions: [:text, :type_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end", "def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end", "def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end...
[ "0.68342626", "0.6702268", "0.669496", "0.66166705", "0.66152966", "0.6610921", "0.6606364", "0.6596509", "0.6568322", "0.6566678", "0.65468246", "0.6542152", "0.651745", "0.64934045", "0.6482077", "0.6482077", "0.64466614", "0.64424986", "0.6394971", "0.63904494", "0.6389594...
0.64548045
16
p my_min_1(list) O(n^2) Phase 2 my_min
def my_min_2(list) min = list.first list.each {|num| min = num if min > num } min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min ...
[ "0.8553666", "0.8295935", "0.82740265", "0.80466914", "0.8041372", "0.8035147", "0.8021097", "0.79902905", "0.79746145", "0.79696107", "0.79601043", "0.7930271", "0.7920284", "0.789237", "0.78777903", "0.7854581", "0.7834821", "0.7813584", "0.77767473", "0.776412", "0.7757376...
0.775831
20
O(n) p my_min_2(list) Largest_contiguous sum Phase 1
def largest_contiguous_subsum(list) subs = [] (0...list.length).each do |i| (i...list.length).each do |j| subs << list[i..j] end end subs.map {|el| el.sum}.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\...
[ "0.8553727", "0.84786344", "0.842758", "0.8403052", "0.8398605", "0.8373972", "0.8370883", "0.83707887", "0.8357327", "0.83568573", "0.8342328", "0.834114", "0.83287495", "0.8326551", "0.8312691", "0.8295603", "0.82616144", "0.82543004", "0.82452", "0.8230645", "0.8229102", ...
0.8153781
31
n^3 + n^2 => O(n^3) list = [5, 3, 7] p largest_contiguous_subsum(list) => 8 list = [5, 1, 3] p largest_contiguous_subsum(list) => 1 (from [1]) list = [2, 3, 6, 7, 6, 7] p largest_contiguous_subsum(list) => 8 (from [7, 6, 7]) Phase 2
def largest_contiguous_subsum_2(list) largest_sum = 0 current_sum = 0 list.each do |el| largest_sum = current_sum current_sum += el if current_sum < el current_sum = el end largest_sum = current_sum if largest_sum < current_sum end largest_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(...
[ "0.9279769", "0.92475915", "0.91537136", "0.91229916", "0.9107171", "0.9104064", "0.9073092", "0.9022264", "0.9003899", "0.8973464", "0.89464563", "0.8937978", "0.89025164", "0.89018273", "0.8894797", "0.88861483", "0.88847995", "0.88820446", "0.88765436", "0.88742787", "0.88...
0.88750684
19
Add a tag with the given key and data value to all collections matching the query condition. If append is true, this method will append the value to any existing data (if not already present), rather than overwriting it. The optional block gets passed Arrayuniq to determine whether a piece of data is already present in the tag. Newer versions of data will overwrite older ones.
def add_tag(key, value, condition, token, append=false, only_granules=true, &block) query = tag_condition_to_query(condition) # https://bugs.earthdata.nasa.gov/browse/CMR-2855 will fix the need for some of this logic # https://bugs.earthdata.nasa.gov/browse/CMR-2609 as well if value.present? || only_granules query_params = {include_tags: key, include_has_granules: true} response = json_query_collections(condition, token, query_params) return response unless response.success? && response.body['feed']['entry'].present? entries = response.body['feed']['entry'] entries = entries.select {|entry| entry['has_granules']} if only_granules assoc_data = nil if append data = Array.wrap(value) assoc_data = entries.map do |entry| tags = entry['tags'] data = Array.wrap(tags[key]['data']) + data if tags && tags[key] # Ensure no duplicate values and that newer values overwrite older ones data = data.reverse.uniq(&block).reverse {'concept-id' => entry['id'], 'data' => data} end elsif value.present? assoc_data = entries.map { |entry| {'concept-id' => entry['id'], 'data' => value} } else assoc_data = entries.map { |entry| {'concept-id' => entry['id']} } end if assoc_data.present? response = post("/search/tags/#{key}/associations", assoc_data.to_json, token_header(token)) end else response = post("/search/tags/#{key}/associations/by_query", query.to_json, token_header(token)) end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_with(name)\n prepare do\n document[field] = [] unless document[field]\n docs = document.send(field).concat(value.__array__)\n execute(name)\n docs\n end\n end", "def append(key, value); end", "def append(key, value); end", "def a...
[ "0.5391321", "0.52631164", "0.52631164", "0.5191369", "0.5191369", "0.5127608", "0.5097426", "0.5065116", "0.4988599", "0.49810627", "0.4977901", "0.4927516", "0.49184278", "0.49057356", "0.4896496", "0.4853333", "0.48265657", "0.47767368", "0.47651803", "0.47464642", "0.4726...
0.5498181
0
The number of citizen not engaged in color pass in args
def citizens_ready_in(color) citizens.where(:color => color, :engaged => false).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_pieces(color)\n color == \"red\" ? whites_count : reds_count\n end", "def lnbColor _args\n \"lnbColor _args;\" \n end", "def diversity\n color_count.keys\n end", "def students_with_brown_eyes(eye_colors)\n\tbrown_eyes = 0\n\n\teye_colors.each do |eye_color|\n \t\tif eye_colo...
[ "0.6854763", "0.6338841", "0.62112564", "0.61960584", "0.6104309", "0.60489833", "0.60388446", "0.5973139", "0.5876759", "0.5823264", "0.57989615", "0.57937104", "0.57759714", "0.5770552", "0.5724761", "0.5696262", "0.5661501", "0.5639451", "0.5629358", "0.56132853", "0.56058...
0.6579883
1
Engaged citizen of color and in number pass in args
def engaged_citizens(color, num) citizens.where(:color => color).limit(num).update_all(:engaged => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnbColor _args\n \"lnbColor _args;\" \n end", "def color(*values); end", "def color(*values); end", "def color(color); end", "def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend", "def qualified_color(candidates)\n candidates.each do |candidate| \n if experience...
[ "0.67970896", "0.6783184", "0.6783184", "0.6774985", "0.6691556", "0.6352747", "0.6285676", "0.62644666", "0.6262144", "0.62046254", "0.61578137", "0.61045384", "0.61030763", "0.61030763", "0.60950005", "0.6093154", "0.605942", "0.6049151", "0.6049151", "0.6049151", "0.600308...
0.59550256
22
Return the IP associated with this record if it can be deduced from the record name
def ip ip = nil unless valid? return nil end begin case name when /\.in-addr\.arpa$/ name_without_suffix = name.sub(/\.in-addr\.arpa$/, '') quads = name_without_suffix.split('.') if quads.size == 4 quads.reverse! ip = quads.join('.') end when /\.ip6\.arpa$/ name_without_suffix = name.sub(/\.ip6\.arpa$/, '') nibbles = name_without_suffix.split('.') nibbles.each do |nibble| if nibble.empty? raise DnsRecord::EmptyNibbleError end end if nibbles.size == 32 n = nibbles.reverse! ip = \ n[0..3].join('') + ":" + n[4..7].join('') + ":" + n[8..11].join('') + ":" + n[12..15].join('') + ":" + n[16..19].join('') + ":" + n[20..23].join('') + ":" + n[24..27].join('') + ":" + n[28..31].join('') ip = NetAddr::CIDR.create(ip).ip(:Short => true) end end rescue DnsRecord::EmptyNibbleError ip = nil end ip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n ip_address\n end", "def name\n ip_address\n end", "def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end", "def ptr(ip)\n # use cache if ip was already resolved\n return @cache...
[ "0.65940094", "0.63443494", "0.6335534", "0.6318545", "0.63108426", "0.62106514", "0.6176224", "0.6142758", "0.6051862", "0.6051862", "0.6042356", "0.6031375", "0.6025368", "0.5973925", "0.5969801", "0.5958472", "0.5955676", "0.595448", "0.5931934", "0.5925773", "0.59148896",...
0.6641284
0
2 soustraction : x y = c
def substract(a,b) a.to_i - b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end", "def c2= c; @c2 = (c == 1) ? 1 : 0; end", "def syyx\n @syy-@syx*@sxx.inverse*@sxy\n end", "def simplify\n super\n return CAS.invert(@y) if @x == CAS::Zero\n return @x if @y == CAS::Zero\n retu...
[ "0.6860843", "0.6215986", "0.6019119", "0.6018704", "0.5946082", "0.58559877", "0.5808389", "0.57946384", "0.5735949", "0.57329434", "0.57296306", "0.5715282", "0.5700401", "0.5689341", "0.5689341", "0.5649059", "0.56076866", "0.5589604", "0.5589604", "0.5589604", "0.5584544"...
0.0
-1
3 si array, additionner les chiffres de larray .to_f
def sum(array) array.map(&:to_i).reduce(0, :+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_float (arr)\n flo = arr.map(& :to_f)\n puts \"El array como flotantes #{flo}\" \nend", "def averagefloat(array)\n totalval = 0\n array.each { |x| totalval += x }\n totalval / array.length.to_f\nend", "def plusMinus(arr)\n lng = arr.length\n arr_resposta = []\n\n arr_resposta.push(a...
[ "0.66376704", "0.63747257", "0.62233114", "0.6161797", "0.61540073", "0.6107448", "0.6092757", "0.60675347", "0.59704846", "0.59388", "0.58571047", "0.58316696", "0.5820625", "0.58148926", "0.5804778", "0.577983", "0.57683444", "0.57408506", "0.5734051", "0.571604", "0.570734...
0.0
-1
+ multiplier : x;y = xy
def multiply(a,b) a.to_i * b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(x,y) \n\tx * y\t\nend", "def multiply(x, y)\n return x * y * 37\n x * y\nend", "def multiply(x,y)\n\tx*y\nend", "def multiply(y)\n @x * y\n end", "def multiply(x, y)\n\tx * y\nend", "def mult(x,y)\n\tx * y\nend", "def adjust _x, _y\n x += _x\n y += _y\n end",...
[ "0.67512953", "0.6715715", "0.6713855", "0.67032087", "0.66509914", "0.6589833", "0.6556257", "0.6513399", "0.6487746", "0.6487746", "0.6487746", "0.64401674", "0.6438239", "0.64354855", "0.64171946", "0.64171946", "0.63933194", "0.638575", "0.638575", "0.6353673", "0.6292075...
0.0
-1
4 puissance de : x;y = xy
def power(a,b) a.to_i ** b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xy\n [x, y]\n end", "def coords; {:x => @x, :y => @y} end", "def position=(point); end", "def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end", "def update_xy()\n if ((pxy=ref_xy) and (cs=column_space) and (rs=row_space) and (cr=colrow)...
[ "0.63143045", "0.6305882", "0.62820786", "0.62705386", "0.6258456", "0.6170505", "0.6148908", "0.61111575", "0.60721296", "0.60547215", "0.6048659", "0.6003661", "0.598377", "0.59816134", "0.59616053", "0.5956957", "0.5956515", "0.5956515", "0.5956515", "0.5956515", "0.595593...
0.0
-1
!!! Birol: don't think this is working...where is comparables set? before_action :set_comparisons_measures, only: [:edit] GET /result_statistic_sections/1/edit
def edit add_breadcrumb 'edit project', edit_project_path(@result_statistic_section.extraction.project) add_breadcrumb 'extractions', project_extractions_path(@result_statistic_section.extraction.project) add_breadcrumb 'work', work_extraction_path(@result_statistic_section.extraction, params: { eefpst1_id: @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1_id }, anchor: "panel-tab-#{ @result_statistic_section.eefps_result.id }") add_breadcrumb @result_statistic_section.result_statistic_section_type.name.downcase, :edit_result_statistic_section_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_comparison_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked].nil? ? [] : params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked].nil? ? [] : params[:previously_defined_checked]\n\t\tmeasures = params[:measures].n...
[ "0.6647048", "0.6490044", "0.6451081", "0.6401665", "0.61363214", "0.6094371", "0.60551697", "0.60022587", "0.60022587", "0.5980021", "0.594385", "0.58678436", "0.57674235", "0.57654464", "0.5712564", "0.5695426", "0.56824934", "0.5530345", "0.5506401", "0.5501154", "0.544265...
0.57076466
15
PATCH/PUT /result_statistic_sections/1 PATCH/PUT /result_statistic_sections/1.json
def update respond_to do |format| if @result_statistic_section.update(result_statistic_section_params) format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section), notice: t('success') } format.json { render :show, status: :ok, location: @result_statistic_section } format.js do @eefpst1 = @result_statistic_section .population .extractions_extraction_forms_projects_sections_type1 @extraction = @result_statistic_section.extraction @project = @result_statistic_section.project @extraction_forms_projects = @project.extraction_forms_projects @eefpst1s = ExtractionsExtractionFormsProjectsSectionsType1 .by_section_name_and_extraction_id_and_extraction_forms_project_id('Outcomes', @extraction.id, @extraction_forms_projects.first.id) end else format.html { render :edit } format.json { render json: @result_statistic_section.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @result_statistic_section.update(result_statistic_section_params)\n format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section),\n notice: t('success') }\n format.json { render :show, status: :ok, locati...
[ "0.7273932", "0.6620052", "0.62830526", "0.62604064", "0.6242381", "0.6073254", "0.6073254", "0.6072117", "0.59847325", "0.59212625", "0.5899397", "0.58261436", "0.57995874", "0.5789772", "0.57820976", "0.5774859", "0.5774859", "0.5770771", "0.57252145", "0.57252145", "0.5725...
0.70481396
1
check if all the join table entries are in place, create if needed def set_comparisons_measures
def set_arms @arms = ExtractionsExtractionFormsProjectsSectionsType1.by_section_name_and_extraction_id_and_extraction_forms_project_id('Arms', @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1.extractions_extraction_forms_projects_section.extraction.id, @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1.extractions_extraction_forms_projects_section.extraction_forms_projects_section.extraction_forms_project.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_comparison_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked].nil? ? [] : params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked].nil? ? [] : params[:previously_defined_checked]\n\t\tmeasures = params[:measures].n...
[ "0.6101307", "0.5152155", "0.5134087", "0.51013213", "0.50984734", "0.50966114", "0.50966114", "0.50818443", "0.50785035", "0.50704336", "0.50450724", "0.499043", "0.4987962", "0.4987284", "0.49813953", "0.49464554", "0.49459115", "0.49316037", "0.49247178", "0.49187773", "0....
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def result_statistic_section_params params.require(:result_statistic_section).permit( measures_attributes: [:id, :name, :_destroy], measure_ids: [], result_statistic_sections_measures_attributes: [measure_attributes: [:id, :name]], comparisons_attributes: [:id, :is_anova, comparate_groups_attributes: [:id, comparates_attributes: [:id, comparable_element_attributes: [:id, :comparable_type, :comparable_id]]]]) # # measure_ids: [], # comparisons_attributes: [ :id, :_destroy, :result_statistic_section_id, # comparisons_measures_attributes: [ :id, :_destroy, :comparison_id, :measure_id , # measurement_attributes: [ :id, :_destroy, :comparisons_measure_id, :value ] ], # comparate_groups_attributes: [ :id, :_destroy, :comparison_id, # comparates_attributes: [ :id, :_destroy, :comparate_group_id, :comparable_element_id, # comparable_element_attributes: [ :id, :_destroy, :comparable_type, :comparable_id, :_destroy ] ] ] ] ) 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
Need to initialize previous jobs for redis when starting
def initialize(robot) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_queue_redis(hash)\n puts \"init_queue_redis: \" + @all_test_files_to_run.length().to_s + \" tests\"\n num = KnapsackPro::Config::Env.redis_get_num\n puts num\n @redis.rpush(hash, @all_test_files_to_run)\n @redis.rpush(hash, Array.new(@ci_node_total * num) { |i| \"0\" })\n @r...
[ "0.6693309", "0.65638256", "0.64976406", "0.64892167", "0.64837646", "0.646808", "0.64358556", "0.642372", "0.6416032", "0.63979405", "0.6358606", "0.63431305", "0.6321785", "0.6284721", "0.6275184", "0.627383", "0.62643576", "0.62616605", "0.61974823", "0.6190755", "0.617745...
0.0
-1
GET /bugreports GET /bugreports.json
def index @bugreports = Bugreport.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end", "def index\n @client_...
[ "0.76676047", "0.72063714", "0.7001088", "0.69051296", "0.6784857", "0.6775383", "0.6775272", "0.6694479", "0.6641864", "0.6626144", "0.6589553", "0.65733415", "0.64788246", "0.6465023", "0.64266264", "0.6416724", "0.6384045", "0.6351989", "0.634446", "0.634347", "0.63366044"...
0.7198261
2
GET /bugreports/1 GET /bugreports/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end", "def index\n @bugrepo...
[ "0.7785067", "0.7535476", "0.7273095", "0.70029926", "0.6961255", "0.68328685", "0.67613167", "0.67452544", "0.67344683", "0.67278695", "0.67259914", "0.6688414", "0.6658645", "0.66565204", "0.66565204", "0.6648631", "0.6640628", "0.65899813", "0.65701747", "0.6542381", "0.65...
0.0
-1