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
Method that is applied to an error object and prints out appropriate error. Ruby actually has its own error class that you can use, when you grow up.
def do_it if @type == "multiple_answer_error" then puts "Error: Item #{@holder} raised #{@type} in #{@method}" elsif @type == "not_found_error" then puts "Error: #{@holder} was #{@type} in #{@method}" else puts "Error: Have been given an unknown error type: #{@type}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_error(error)\n puts \"Message: \" + error.message\n puts \"HTTP Status: \" + error.status.to_s\n puts \"Developer Message: \" + error.developer_message\n puts \"More Information: \" + error.more_info\n puts \"Error Code: \" + error.code.to_s\nend", "def print_error\n puts @error_text if @er...
[ "0.7640079", "0.7515694", "0.730703", "0.7172205", "0.717041", "0.7149323", "0.7134413", "0.71138424", "0.70400244", "0.69706714", "0.69466585", "0.69424254", "0.6939746", "0.69082445", "0.68537945", "0.68537945", "0.6840201", "0.68277895", "0.67874557", "0.67750317", "0.6767...
0.0
-1
Uses the regular expression to attempt to extract the domain from a given email address
def get_address_domain(address) match = @domain_regex.match(address) if !match.nil? return match[1] else return "UNKNOWN DOMAIN" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain_name_from_email_address(email)\nemail.scan(/@(\\w+)/)[0].pop\nend", "def get_domain_name_from_email_address(email)\n med = email[/[@].*[.]/]\n domain = med[1..-2]\nend", "def get_domain_name_from_email_address(email)\n\temail = 'alex@makersacademy.com'\n\tn = email.gsub(/.+@([^.]+).+/, '\\1')\...
[ "0.8524555", "0.8494678", "0.808919", "0.7971241", "0.78179795", "0.77714086", "0.77439356", "0.7704656", "0.74191445", "0.7368138", "0.7354432", "0.7207682", "0.72059804", "0.72059804", "0.7174674", "0.7174674", "0.7158803", "0.7114898", "0.70151746", "0.6903005", "0.6873387...
0.6643903
29
Installs a package using aptget.
def package(name, version=nil, options={:q => true, :y => true}) name = "#{name}=#{version}" unless version.to_s.strip.empty? execute "apt-get install", name, options chain_proxy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apt_install(packages)\n packages = packages.split(/\\s+/) if packages.respond_to?(:split)\n packages = Array(packages)\n sudo_with_input(\"#{apt_get_preamble} install #{packages.join(\" \")}\", /\\?/, \"\\n\")\n end", "def apt_install(packages)\n packages = packages.split(/\\s+/) if packages.res...
[ "0.80722576", "0.79114604", "0.7757424", "0.77511096", "0.7736303", "0.77338994", "0.7545438", "0.7376181", "0.73249406", "0.7306136", "0.72100246", "0.706957", "0.70678246", "0.70434123", "0.70215595", "0.7017306", "0.6988163", "0.6987009", "0.6936564", "0.68868697", "0.6862...
0.72299826
10
helper method to have the current_tenant available in the controller
def current_tenant MultiTenant.current_tenant end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_tenant\n if params[:tenant_id].present?\n tenant = Tenant.find(params[:tenant_id])\n else\n Tenant.last\n end\n end", "def current_tenant\n ActsAsTenant.current_tenant\n end", "def current_tenant\n ActsAsTenant.current_tenant\n end", "de...
[ "0.8494968", "0.84311706", "0.84311706", "0.84311706", "0.8267592", "0.8187753", "0.7869459", "0.78283554", "0.7706752", "0.7702003", "0.7576368", "0.75749445", "0.75432473", "0.7459893", "0.7436782", "0.7392886", "0.73838705", "0.73373723", "0.73350674", "0.7328225", "0.7250...
0.7915873
6
Clear current tenant after the request is completed
def verify_tenant_access begin yield MultiTenant.pending_verification.each do |pending| rec, model = pending curr_id = MultiTenant.current_tenant.id multi_tenant_incr(rec) rec_tenant = rec.send(model) if rec_tena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_tenant_scope_to_default \n put(\"/tenants.json/scope/clear\")\nend", "def reset\n return unless default_tenant\n\n Apartment.connection.execute \"use `#{default_tenant}`\"\n end", "def unauth\n #raise Apartment::TenantNotFound\n nil\n end", "def log_out_tenant\n \t\...
[ "0.7154913", "0.6796006", "0.679283", "0.67533785", "0.65627456", "0.64049053", "0.63780695", "0.6335689", "0.6318703", "0.624151", "0.62376356", "0.6127232", "0.6087192", "0.6037639", "0.6015842", "0.6011408", "0.59561986", "0.5936159", "0.5930959", "0.5907196", "0.58900225"...
0.0
-1
Creates and initializes a new instance of the Gateway class.
def initialize(client) @client = client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gateway\n @gateway ||= PAYMENT_CLASS.new(\n :login => PAYMENT_LOGIN,\n :password => PAYMENT_PASSWORD,\n :signature => PAYMENT_SIGNATURE # Ignored for some gateway types; see \"config/payment_gateway.yml\"\n )\n end", "def initialize_braintree_obj\n @gateway = ::Braintree::Gate...
[ "0.70985025", "0.6958692", "0.6669053", "0.6656347", "0.6448966", "0.63805974", "0.61728054", "0.61680436", "0.6102379", "0.60838", "0.59610957", "0.5929251", "0.5898957", "0.586481", "0.5855079", "0.5847421", "0.5820124", "0.57909226", "0.5782672", "0.57582355", "0.5702576",...
0.0
-1
The url to show the picture. Takes all values like +name+ and crop sizes (+crop_from+, +crop_size+ from the build in graphical image cropper) and also adds the security token. You typically want to set the size the picture should be resized to. === Example: essence_picture.picture_url(size: '200x300', crop: true, forma...
def picture_url(options = {}) return if picture.nil? picture.url(picture_url_options.merge(options)) || "missing-image.png" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def picture_url(size)\n \tself.picture.url(size)\n \tend", "def picture_url(options = {})\n return if picture.nil?\n routes.show_picture_path(picture_params(options))\n end", "def thumbnail_url\n return if picture.nil?\n\n crop = crop_values_present? || content.settings[:crop]\n ...
[ "0.7555057", "0.7480185", "0.7403815", "0.713476", "0.7056369", "0.70536995", "0.7046399", "0.6997752", "0.6942302", "0.68373525", "0.6825836", "0.6805213", "0.6745317", "0.67345285", "0.6651991", "0.6625736", "0.66154444", "0.65577304", "0.6551389", "0.6521068", "0.650598", ...
0.6943971
8
Picture rendering options Returns the +default_render_format+ of the associated +Alchemy::Picture+ together with the +crop_from+ and +crop_size+ values
def picture_url_options return {} if picture.nil? { format: picture.default_render_format, crop_from: crop_from.presence, crop_size: crop_size.presence, size: content.settings[:size], }.with_indifferent_access end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def picture_options\n {purpose: nil, variant: nil}\n end", "def photo_format; end", "def displayPicture_styles(card)\n if card.picture?\n \"color:#{card.foreground_color};\n background-color:#{card.background_color};\n background-image: url(\\\"#{card.picture.url}\\\");\n backgrou...
[ "0.671159", "0.6239732", "0.6090312", "0.5934442", "0.5924926", "0.59131306", "0.5899313", "0.57022476", "0.5630242", "0.56174195", "0.559202", "0.55745524", "0.55549175", "0.55547273", "0.5540967", "0.5533583", "0.5532295", "0.55215514", "0.55215514", "0.55215514", "0.552155...
0.73427445
0
Returns an url for the thumbnail representation of the assigned picture It takes cropping values into account, so it always represents the current image displayed in the frontend.
def thumbnail_url return if picture.nil? crop = crop_values_present? || content.settings[:crop] size = render_size || content.settings[:size] options = { size: thumbnail_size(size, crop), crop: !!crop, crop_from: crop_from.presence, crop_size: crop_size.presence...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thumbnail_url\n company.image.url(:thumbnail)\n end", "def thumbnail_url\n return self.endpoint.thumbnail_url(self.id)\n end", "def display_picture_url\n\t\tdisplay_picture.url(:original)\n\tend", "def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n orig_imag...
[ "0.78127867", "0.7811403", "0.77241665", "0.7638596", "0.7573385", "0.7573385", "0.75528914", "0.7530814", "0.7506756", "0.7465374", "0.74471396", "0.73997426", "0.73920757", "0.73262143", "0.72444063", "0.72196645", "0.72065234", "0.7183544", "0.7150571", "0.7119122", "0.710...
0.8259031
0
The name of the picture used as preview text in element editor views.
def preview_text(max = 30) return "" if picture.nil? picture.name.to_s[0..max - 1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview_name\n name.sub(/Preview$/, '').underscore\n end", "def preview_name\n name.delete_suffix(\"Preview\").underscore\n end", "def preview_text(max = 30)\n return \"\" if picture.nil?\n picture.name.to_s[0..max-1]\n end", "def name\n I18n.t('gallery.image')\n...
[ "0.74521095", "0.7333827", "0.73182875", "0.6994889", "0.6868945", "0.6584532", "0.64141077", "0.64071816", "0.6367663", "0.63403094", "0.63389266", "0.63275576", "0.6319825", "0.6319606", "0.63059926", "0.6300277", "0.6296442", "0.6283167", "0.62812686", "0.62812686", "0.628...
0.73326206
3
A Hash of coordinates suitable for the graphical image cropper.
def cropping_mask return if crop_from.blank? || crop_size.blank? crop_from = point_from_string(read_attribute(:crop_from)) crop_size = sizes_from_string(read_attribute(:crop_size)) point_and_mask_to_points(crop_from, crop_size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coords; {:x => @x, :y => @y} end", "def hash\n [height, is_column_break, width, x, y].hash\n end", "def determine_coordinates\n coordinates = Hash.new()\n coordinates[:x] = @scaled_meta.domain_x.lower +\n calculated_dimension_delta(@scaled_meta.domain_x)\n coordinates[...
[ "0.7039246", "0.70001984", "0.697469", "0.6926561", "0.67618984", "0.6641944", "0.63984424", "0.63962436", "0.63851047", "0.61633563", "0.6161334", "0.60872376", "0.60703146", "0.6036482", "0.6030559", "0.6025312", "0.5948381", "0.5933494", "0.59275657", "0.5868657", "0.58607...
0.0
-1
Returns a serialized ingredient value for json api
def serialized_ingredient picture_url(content.settings) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredient_name\n return ingredient.name\n end", "def ingredient_data\n respond_to do |format|\n format.json { render json: helpers.get_ingredient(params[:ingredient_type], params[:ingredient_id]) }\n end\n end", "def ingredient_params\n ActiveModelSerializers::Deserialization.jsonapi_...
[ "0.70084465", "0.6840459", "0.6679195", "0.66463417", "0.65006465", "0.65006465", "0.6493842", "0.63797", "0.63789135", "0.633268", "0.6308933", "0.6292051", "0.62481344", "0.6235422", "0.61548287", "0.6126719", "0.6124603", "0.60956836", "0.60282964", "0.60092676", "0.598359...
0.7085267
1
Show image cropping link for content
def allow_image_cropping? content && content.settings[:crop] && picture && picture.can_be_cropped_to?( content.settings[:size], content.settings[:upsample], ) && !!picture.image_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop\n return unless model.can_be_cropped?\n manipulate! do |image|\n image.combine_options do |command|\n command.crop(model.magick_thumbnail_coordinates)\n end\n image\n end\n end", "def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end", "d...
[ "0.6451354", "0.61369926", "0.6086403", "0.6055637", "0.59966254", "0.5984848", "0.5984174", "0.59375453", "0.5920397", "0.5920397", "0.5920397", "0.5920397", "0.5920397", "0.5920397", "0.59199566", "0.590111", "0.5899262", "0.58893096", "0.5872651", "0.5866322", "0.58568174"...
0.5716441
28
an empty array accessible to all methods
def interactive_menu loop do print_menu # read input and pass to process_selection() method process_selection(STDIN.gets.chomp) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array\n raise \"Not implemented\"\n end", "def another; return []; end", "def all\n []\n end", "def __array__; self; end", "def to_ary\n\t []\n\tend", "def variables\n EMPTY_ARRAY\n end", "def array\n @@array\n end", "def initialize; @ary = []; end", "def to_a; []...
[ "0.7333832", "0.7154037", "0.7039252", "0.6940241", "0.6856035", "0.68303096", "0.6773408", "0.6772932", "0.67691904", "0.67568547", "0.6744243", "0.6719722", "0.66809475", "0.66171765", "0.66171765", "0.66171765", "0.66171765", "0.6610879", "0.65427655", "0.6529448", "0.6520...
0.0
-1
see if this model is joiner of some model Example:
def joiner_of?(model) 0 < self.joinees.by_model(model).limit(1).count * model.joiners.by_model(self).limit(1).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_joined_model?(model)\n has_base_model?(model) || has_aggregated_model?(model)\n end", "def joined?\n meta[:joined].equal?(true)\n end", "def joinable?(other)\n kind_of?(other.class) || other.kind_of?(self.class)\n end", "def joinable?\n left.eql?(right.rename(...
[ "0.77149063", "0.721608", "0.7164149", "0.67069983", "0.65602726", "0.64072716", "0.6394754", "0.6394754", "0.6349926", "0.63453513", "0.6282006", "0.6271474", "0.6253579", "0.62485677", "0.61792755", "0.61574906", "0.6143889", "0.6128146", "0.6102674", "0.6070272", "0.606681...
0.7987175
0
return true if self is joining some models Example:
def joining? 0 < self.joinees.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_joined_model?(model)\n has_base_model?(model) || has_aggregated_model?(model)\n end", "def joiner_of?(model)\n 0 < self.joinees.by_model(model).limit(1).count * model.joiners.by_model(self).limit(1).count\n end", "def joined?\n meta[:joined].equal?(true)\n end", "def has...
[ "0.7940379", "0.7335683", "0.73128647", "0.7051919", "0.689668", "0.6880473", "0.6745247", "0.67426986", "0.67277825", "0.67027247", "0.6701745", "0.6693023", "0.6686169", "0.6673002", "0.6632255", "0.6628705", "0.6550174", "0.65422547", "0.65196913", "0.6505314", "0.6468227"...
0.62484074
37
get all the joinees of this model, same with classmethod joinees_of Example:
def all_joinees rebuild_instances(self.joinees) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joinees_count\n self.joinees.count\n end", "def common_joinees_with(model)\n rebuild_instances(self.joinees) & rebuild_instances(model.joinees)\n end", "def joinees_by_type(type)\n rebuild_instances(self.joinees.by_type(type))\n end", "def index\n @joas = Joa.all\n end",...
[ "0.64142174", "0.61297375", "0.610918", "0.58055127", "0.5701124", "0.56578785", "0.5614785", "0.5556686", "0.5546785", "0.5546272", "0.55128056", "0.54822135", "0.5480634", "0.54654884", "0.54470444", "0.54468584", "0.5434223", "0.5434223", "0.5432043", "0.5422818", "0.54146...
0.68520963
0
get all the joinees of this model in certain type Example:
def joinees_by_type(type) rebuild_instances(self.joinees.by_type(type)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def joinees_count_by_type(type)\n self.joinees.by_type(type).count\n end", "def get_all_jiras(type, temporal)\n jiras = []\n @jiras.each do |state, jira_obj|\n jira_obj.jiras.each do |jira|\n if jira.type == type && jira.temporal == temporal\n ...
[ "0.6311222", "0.6196251", "0.60260737", "0.5899373", "0.5819316", "0.5815273", "0.5678379", "0.56170416", "0.5616047", "0.56033236", "0.555413", "0.5344186", "0.5313346", "0.53107715", "0.53024", "0.5297688", "0.5295412", "0.5275516", "0.5270902", "0.52393574", "0.52321404", ...
0.7409869
0
get the number of joinees Example:
def joinees_count self.joinees.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_jewels_in_stones(j, s)\n s.count(j)\nend", "def joke_count # {{{\n\n @log.message :debug, \"Entering count function\"\n\n jokes = Joke.all\n sources = Hash.new\n\n sources[ \"Total\" ] = jokes.length\n sources[ \"M...
[ "0.6746986", "0.66242903", "0.6551087", "0.6544905", "0.6508781", "0.6317069", "0.61305904", "0.60380054", "0.60376936", "0.6032578", "0.5995821", "0.5995821", "0.5983247", "0.5955329", "0.59552497", "0.59400994", "0.5935966", "0.5923197", "0.5923197", "0.5923197", "0.5916707...
0.7656967
0
get the number of joiners in certain type Example:
def joinees_count_by_type(type) self.joinees.by_type(type).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_many_on_bus\n return @passengers.length\n end", "def get_num_of_join(state)\n count = 0\n @joined.each_value do |v|\n count += 1 if v == state\n end\n return count\n end", "def number_of_broadcasters(login=nil)\n count_by_frbr(login, :is_broadcasted_by, :how_m...
[ "0.6753377", "0.6636676", "0.6588916", "0.6573275", "0.65560746", "0.65542805", "0.6415003", "0.64146006", "0.6390654", "0.6354544", "0.63523", "0.6347321", "0.63166964", "0.62976533", "0.6270523", "0.62688076", "0.6255662", "0.62447673", "0.62447673", "0.6210172", "0.6200430...
0.63628167
9
return if there is any common joinees Example:
def common_joinees?(model) 0 < (rebuild_instances(self.joinees) & rebuild_instances(model.joinees)).length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common?\n self.sightings.size > 30\n end", "def carnivore_species_fighting?\n @carnivores.uniq.count > 1\n end", "def multiple_pieces?\n 1 < all_coords.count { |coord| self[coord] != :empty }\n end", "def included_once (haystack, needle)\n acc = 0\n haystack.each do |word|\n if word ...
[ "0.6545591", "0.6210442", "0.6019947", "0.60061675", "0.5972384", "0.59283984", "0.5900129", "0.58693504", "0.5853074", "0.58528703", "0.5815355", "0.58093905", "0.5787189", "0.57555586", "0.57460105", "0.57399577", "0.57118714", "0.5699522", "0.5687403", "0.56794655", "0.567...
0.7356922
0
get common joinees with some model Example:
def common_joinees_with(model) rebuild_instances(self.joinees) & rebuild_instances(model.joinees) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_joinees?(model)\n 0 < (rebuild_instances(self.joinees) & rebuild_instances(model.joinees)).length\n end", "def common_likes_with(model)\n model_likes = get_likes_of(model)\n self_likes = get_likes_of(self)\n\n self_likes & model_likes\n end", "def related_models\n via_...
[ "0.6590691", "0.5776083", "0.54867834", "0.54201263", "0.54057837", "0.53954357", "0.53540766", "0.5294467", "0.5273932", "0.52336526", "0.52277464", "0.5205364", "0.5182474", "0.5164421", "0.50906503", "0.5065205", "0.49928838", "0.49898973", "0.4989728", "0.49868107", "0.49...
0.77184695
0
GET /secret_codes GET /secret_codes.json
def index @secret_codes = SecretCode.paginate(page: params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n \t@secret_codes = SecretCodes.includes(:user).all\n\tend", "def get_secret_code\n response = []\n 4.times do\n response << LEGAL_COLORS.sample\n end\n response\n end", "def index\n logger.debug(\"get secret page\")\n end", "def secret_code_params\n params.require...
[ "0.69134605", "0.639364", "0.6334834", "0.63335854", "0.63189673", "0.62974685", "0.62613374", "0.6256939", "0.6210445", "0.61844116", "0.6116453", "0.61012816", "0.6044346", "0.60178244", "0.60062313", "0.59004974", "0.58671546", "0.58357143", "0.5754203", "0.575383", "0.573...
0.6981423
0
GET /secret_codes/1 GET /secret_codes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @secret_codes = SecretCode.paginate(page: params[:page])\n end", "def index\n \t@secret_codes = SecretCodes.includes(:user).all\n\tend", "def show\n render :json => @secret_key.to_json({})\n end", "def get_secret_code\n response = []\n 4.times do\n response << LEGAL_COLORS....
[ "0.6767406", "0.6718206", "0.6409585", "0.63397515", "0.63344735", "0.63044125", "0.62953347", "0.62872005", "0.6274251", "0.6263749", "0.6261443", "0.6127622", "0.6049846", "0.6040054", "0.5986805", "0.5954199", "0.5949402", "0.59074104", "0.58406675", "0.58394665", "0.58297...
0.0
-1
POST /secret_codes POST /secret_codes.json
def create @secret_code = SecretCode.new(secret_code_params) respond_to do |format| if @secret_code.save format.html { redirect_to @secret_code, notice: 'Secret code was successfully created.' } format.json { render :show, status: :created, location: @secret_code } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def secret_code_params\n params.require(:secret_code).permit(:secret_code, :user_id)\n end", "def create\n token = code_params.fetch(:is_private) == '1' ? SecureRandom.hex(32) : nil\n @code = Code.new(code_params.merge!({token: token}))\n respond_to do |format|\n if @code.save\n unl...
[ "0.6972984", "0.6863496", "0.6681925", "0.6582866", "0.62784547", "0.61074084", "0.6102882", "0.60635924", "0.6040825", "0.6029489", "0.6007682", "0.5999521", "0.5978913", "0.5925716", "0.5876895", "0.5844902", "0.58399284", "0.58269954", "0.57919085", "0.57819194", "0.577835...
0.73566604
0
PATCH/PUT /secret_codes/1 PATCH/PUT /secret_codes/1.json
def update respond_to do |format| if @secret_code.update(secret_code_params) format.html { redirect_to @secret_code, notice: 'Secret code was successfully updated.' } format.json { render :show, status: :ok, location: @secret_code } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n code_parameters = code_params\n if code_parameters[\"new_secret\"] == \"1\"\n puts \"New Secret Param Set\"\n @code.secret = @code.new_secret\n @code.save\n code_parameters = code_parameters.except(\"secret\")\n end\n code_parameters = code_parameters.except(\"new_secre...
[ "0.7641928", "0.6914317", "0.68070304", "0.65923774", "0.65478206", "0.6478739", "0.628955", "0.6280239", "0.61650914", "0.612415", "0.6093138", "0.6062799", "0.6051703", "0.6051703", "0.6051703", "0.6051703", "0.5960944", "0.59472036", "0.5918912", "0.5846875", "0.58387434",...
0.7221017
1
DELETE /secret_codes/1 DELETE /secret_codes/1.json
def destroy @secret_code.destroy respond_to do |format| format.html { redirect_to secret_codes_url, notice: 'Secret code was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'El secreto se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret_key.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.7342452", "0.7258272", "0.7105474", "0.70857316", "0.6977628", "0.69203955", "0.6918432", "0.69046396", "0.6898982", "0.6852204", "0.68432707", "0.6834751", "0.68301195", "0.6749168", "0.66680706", "0.6652205", "0.66396725", "0.66387016", "0.6609097", "0.66001946", "0.6600...
0.7685258
0
Use callbacks to share common setup or constraints between actions.
def set_secret_code @secret_code = SecretCode.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def secret_code_params params.require(:secret_code).permit(:secret_code, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
returns a hash of memorynames => memorysizes
def list names = {} @memories.each { |m| names[m.name] = m.size } return names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_memory\n result = @info[:memory] = {}\n\n free_cmd = \"free -m|awk '$1 ~ /Mem/ {print $2, $2-$6-$7}; $1 ~ /Swap/ \" \\\n \"{print $3}'|xargs\"\n mem = @shell.query('MEMORY', free_cmd)\n total, used, swap = mem.split(/\\s+/)\n\n result[:total] = total.to_i\n ...
[ "0.7347266", "0.68660027", "0.6724577", "0.671169", "0.6665197", "0.66637444", "0.6458116", "0.64514494", "0.63596064", "0.6304287", "0.62830764", "0.6256192", "0.6156389", "0.6139671", "0.61211926", "0.610988", "0.61079925", "0.61060464", "0.6105218", "0.6101677", "0.60976",...
0.6879102
1
stocker URL des mairies dans le tableau mairie_val_d_oise
def get_all_the_urls_of_val_doise_townhalls mairie_val_d_oise = Array.new page = Nokogiri::HTML(open("http://annuaire-des-mairies.com/val-d-oise.html")) links = page.css('a.lientxt') links.each do |mairie| mairie_val_d_oise << mairie['href'] end return mairie_val_d_oise end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_link\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n faux_liens_villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |lien|\n faux_liens_villes << lien.values[1]\n end\n liens_villes = faux_liens_villes.map{ |el| \"htt...
[ "0.6474429", "0.63358843", "0.6191788", "0.6129222", "0.59864783", "0.5912964", "0.587341", "0.5849819", "0.58386827", "0.5814903", "0.5794587", "0.57823503", "0.57436293", "0.57337385", "0.56936926", "0.5687823", "0.56865895", "0.56477827", "0.5637706", "0.55577445", "0.5540...
0.5837145
9
Assumptions You can assume you will be given an integer input. You can not assume that the integer will be only positive. You may be given negative numbers as well (or 0).
def isPrime(num) # Your code here return false if num < 2 && num > -2 if num < 0 num *= -1 end ((2..(Math.sqrt(num)))).each do |i| return false if num % i == 0 end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_integer\n valid_input = false\n input = 0\n until valid_input do\n user_input = gets.chomp.to_i\n if user_input > 0 && user_input.kind_of?(Integer)\n valid_input = true\n input += user_input\n clear\n break\n else\n puts \"Incorrect input, please enter an integer g...
[ "0.6953015", "0.6952274", "0.69006693", "0.6889478", "0.6834022", "0.68012947", "0.6792452", "0.6773905", "0.6766722", "0.6738879", "0.6731908", "0.67309576", "0.67140293", "0.66829574", "0.6630769", "0.6591422", "0.65871704", "0.6571695", "0.65712065", "0.65553796", "0.65470...
0.0
-1
duration_type is a timing helper for use in queries. e.g. Run.where.not(duration_type(timing) => 0)
def duration_type(timing) case timing when REAL :realtime_duration_ms when GAME :gametime_duration_ms else Rollbar.error("Invalid timing #{timing}") :realtime_duration_ms end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n \"#{duration.capitalize} Quest\"\n end", "def query_duration sql, type = true, waiting_time = 10\n start = Time.now\n if type\n result = query_wait(sql, waiting_time)\n else\n result = query_empty(sql, waiting_time)\n end\n finish = Time.now\n msecs = (f...
[ "0.60173064", "0.6004062", "0.5747186", "0.57047254", "0.56823593", "0.5613858", "0.55576956", "0.5496174", "0.5485136", "0.54236966", "0.54185003", "0.54185003", "0.54185003", "0.54185003", "0.5351309", "0.5325837", "0.52963334", "0.5274061", "0.52729076", "0.52666855", "0.5...
0.6736405
0
Return a random run. As a special case for development setups, if no runs exist a fake run with a fake ID is returned.
def random Run.offset(rand(Run.count)).first || Run.new(id: 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run(run_id)\n testrail_api_client.send_get(\"get_run/#{run_id}\")\n end", "def random_experiment\n @running_experiments = if not current_user.nil?\n current_user.get_running_experiments\n elsif not sm_user.nil?\n ...
[ "0.6103659", "0.59165704", "0.5913727", "0.55351466", "0.5510195", "0.55048984", "0.5486252", "0.5486252", "0.5486252", "0.5486252", "0.54670036", "0.54207623", "0.54182506", "0.54182506", "0.54182506", "0.54182506", "0.5390905", "0.53689206", "0.5320886", "0.531416", "0.5279...
0.7539038
0
If we don't have a user assigned but we do have a speedrun.com run assigned, try to fetch the user from speedrun.com. For this to work that user must have their Twitch account tied to both Splits.io and speedrun.com.
def discover_runner return if user.present? DiscoverRunnerJob.perform_later(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_user\n user = Twitter.user(screen_name)\n Lead.from_twitter(user)\n end", "def loaded_user\n user_type == 'MeetupUser' ? meetup_user : bridgetroll_user\n end", "def find_member\n @trello.find_member_by_username(users[@selected_commander][:trello_name])\n end", "def get_user_id(lo...
[ "0.57685924", "0.5711612", "0.55516917", "0.55142933", "0.5466745", "0.5379309", "0.537015", "0.53667986", "0.5339794", "0.5314829", "0.5308881", "0.5306483", "0.5302786", "0.5285702", "0.527229", "0.5264332", "0.5248355", "0.5227981", "0.521973", "0.5219593", "0.51995695", ...
0.5124188
33
Calculate the various statistical information about each segments history once in the database for the whole run instead of individually for each segment (N queries)
def segment_history_stats(timing) stats = SegmentHistory.joins(segment: :run) .without_statistically_invalid_histories_for_run(self, timing) .where(segment: {runs: {id: id}}) .where.not(Run.duration_type(timing) => [0, nil]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_segment_stat_hist_detail\n @instance = prepare_param_instance\n @time_selection_start = params[:time_selection_start]\n @time_selection_end = params[:time_selection_end]\n @owner = params[:owner]\n @object_name = params[:object_name]\n @subobject_name = params[:subobj...
[ "0.6846605", "0.68385684", "0.6297817", "0.61820465", "0.5952967", "0.5908088", "0.5883374", "0.5825677", "0.57961816", "0.5717683", "0.571376", "0.56856024", "0.5652272", "0.5613757", "0.5571729", "0.55406964", "0.5469943", "0.5455853", "0.5441266", "0.53960645", "0.53920186...
0.6901753
0
split tries to split this run by filling in the first unfilled segment with a time. If more is true and this split would cause the run to complete, a new segment will be created at the end of the run and left blank for the next split to fill. This can be used to perform blind runs where the runner doesn't know how many...
def split(more: false, realtime_end_ms: nil, gametime_end_ms: nil) # rubocop:todo Metrics/AbcSize Metrics/CyclomaticComplexity Metrics/MethodLength prev_segment = segments.order(segment_number: :asc).where(realtime_end_ms: nil).first if prev_segment.nil? && more prev_segment = segments.order(segment_numbe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_split()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_skip_split(@handle.ptr)\n end", "def split_or_start()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Nati...
[ "0.5462323", "0.5421333", "0.53909224", "0.5326534", "0.51280403", "0.49136317", "0.4890706", "0.48208836", "0.47085539", "0.47027415", "0.4691666", "0.46738824", "0.46705312", "0.4662228", "0.46246845", "0.46192148", "0.46106", "0.46078637", "0.4600756", "0.45835268", "0.456...
0.6822814
0
Internal: Deliver the results of an Asq query by routing to one of three private methods for reports, alarms, and allclears. The specifics of what we communicate may be different for all three of these types. Examples delivery.deliver => nil Doesn't return anything.
def deliver return false unless meets_requirements? _deliver true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver_alarm\n # In the base stub class, just route these to the report method.\n deliver_report\n end", "def deliver_clear\n # In the base stub class, just route these to the report method.\n deliver_report\n end", "def deliver_report\n # The base class is just a stub and doesn't need to...
[ "0.6080965", "0.57196075", "0.55810106", "0.55656093", "0.53975165", "0.5361724", "0.53273386", "0.5276977", "0.5263316", "0.5258581", "0.5249404", "0.5241906", "0.52327305", "0.52011794", "0.5178609", "0.51544416", "0.5121207", "0.5092068", "0.50797397", "0.5071003", "0.5069...
0.0
-1
Method used to determine if a delivery should archive a file. Defaults to true, is meant to be overwritten by implementing deliveries if needed. Must remain public.
def should_archive_file? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_archive?\n @is_archive\n end", "def archive_ok?\n #todo, we lack any real heuristic for this.\n true\n end", "def archived?(file)\n temp = file_command(file)\n temp.include? ARCHIVE_STRING\n end", "def archival?\n false\n end", "def archival?\n false\n end", ...
[ "0.731756", "0.7122447", "0.7073154", "0.7033566", "0.7033566", "0.6981579", "0.69740003", "0.6952072", "0.68881947", "0.68560666", "0.6765377", "0.6759707", "0.66626734", "0.6662647", "0.66182363", "0.65766364", "0.65413016", "0.65038663", "0.64755154", "0.6443511", "0.64214...
0.7890026
0
Method used to determine if a delivery should logged. Defaults to true, is meant to be overwritten by implementing deliveries if needed. Must remain public.
def should_log? return false if @skip_logging true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delivery?\r\n\tif !current_user.delivery\r\n\t\treturn false;\r\n\telse\r\n\t\treturn true;\r\n\tend\r\nend", "def is_delivery\n profile.delivery\n end", "def delivered?\n @delivered\n end", "def needs_delivery?\n # can write logic here for delivery methods\n false\n end", "def log?\...
[ "0.666749", "0.65994734", "0.65080845", "0.64492637", "0.6374722", "0.6352301", "0.6244336", "0.6214881", "0.6166133", "0.61584425", "0.61584425", "0.61584425", "0.6123122", "0.60821754", "0.60820854", "0.6070645", "0.5952903", "0.5899618", "0.58932495", "0.58932495", "0.5892...
0.6423164
4
Internal: Deliver the results of an Asq query of the report type. Examples delivery.deliver_report => nil Doesn't return anything.
def deliver_report # The base class is just a stub and doesn't need to do anything. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver_clear\n # In the base stub class, just route these to the report method.\n deliver_report\n end", "def addressbook_query_report(report)\n depth = @server.http_depth(0)\n\n if depth == 0\n candidate_nodes = [@server.tree.node_for_path(@server.request_uri)]\n\n fa...
[ "0.5760608", "0.5701935", "0.56906223", "0.55662745", "0.55337083", "0.55019224", "0.54482603", "0.5439069", "0.54117155", "0.54075724", "0.53829324", "0.5370517", "0.536525", "0.5356732", "0.5352174", "0.53093195", "0.5289834", "0.5232222", "0.5228635", "0.52061623", "0.5192...
0.6529631
0
Internal: Deliver the results of an Asq query of the monitor type when the alarm conditions are met. Examples delivery.deliver_alarm => nil Doesn't return anything.
def deliver_alarm # In the base stub class, just route these to the report method. deliver_report end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_alarm( send_help, sensor_check )\n alarm_sensors = []\n disconnected_sensors = []\n # This ensures a ONE-TIME alarm start\n if send_help\n alarm_sensors = [\"alexa\"]\n else\n # Long way to determine alarm\n ...
[ "0.52984846", "0.52070236", "0.51886266", "0.5185337", "0.50761276", "0.50733083", "0.49618942", "0.49339998", "0.49274418", "0.49183297", "0.478192", "0.4777541", "0.4774351", "0.47308567", "0.47283652", "0.4702812", "0.46930835", "0.46684995", "0.46499938", "0.46261337", "0...
0.63184065
0
Internal: Deliver the results of an Asq query of the monitor type when the alarm conditions indicate no alarm. Examples delivery.deliver_clear => nil Doesn't return anything.
def deliver_clear # In the base stub class, just route these to the report method. deliver_report end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deliver_alarm\n # In the base stub class, just route these to the report method.\n deliver_report\n end", "def clear\n if in_alert?\n self.status = 'clear_new'\n log('info', 'Asq alert has cleared')\n elsif operational_error?\n self.status = 'clear_new'\n log('info', 'Asq ope...
[ "0.6015599", "0.56911796", "0.5289995", "0.520989", "0.5024536", "0.49078164", "0.4888354", "0.48713025", "0.4865216", "0.4855851", "0.47605783", "0.47386056", "0.47233877", "0.47208273", "0.47182953", "0.4717287", "0.4714357", "0.470448", "0.46977314", "0.46885988", "0.46562...
0.5628194
2
Adds an individual delivery to the asq's delivery collection
def create_delivery Delivery.create( deliverable: self, asq: asq ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_delivery_item\n @delivery_item = Shop::DeliveryItem.find(params[:id])\n end", "def deliver\n @queue << self\n end", "def set_delivery\n @delivery = Delivery.find(params[:id])\n end", "def set_delivery\n @delivery = Delivery.find(params[:id])\n end", "def set_...
[ "0.6432248", "0.6394737", "0.634492", "0.634492", "0.634492", "0.634492", "0.634492", "0.634492", "0.634492", "0.62933517", "0.6289641", "0.62590903", "0.623103", "0.61090225", "0.59952515", "0.59597343", "0.59246266", "0.58446634", "0.58393073", "0.5798685", "0.57978594", ...
0.7133435
0
Destroys this delivery's "parent" delivery so that we don't have Email
def destroy_delivery Rails.logger.info "Attempting to destroy deliverable_id = #{id} " \ "AND deliverable_type = '#{self.class}'" Delivery.where("deliverable_id = #{id} AND deliverable_type = " \ "'#{self.class}'").each(&:destroy) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end", "def removeFromParent\n @parent.remove(self) if @parent\n end", "def remove\n transaction do\n destroy!\n order.remove_delivery_service_if_invalid\n self\n end\n end", "def...
[ "0.6045901", "0.6020338", "0.6011372", "0.58976513", "0.58808064", "0.5871196", "0.5836129", "0.5807707", "0.5786874", "0.57818305", "0.57741034", "0.57205796", "0.56888515", "0.5685355", "0.56530607", "0.5650162", "0.5620402", "0.56079316", "0.55685776", "0.55651397", "0.556...
0.6823299
0
But for instances of the base class, you just use the module regularly since they're not singleton
def catch puts "This is an instance method" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate!; end", "def instance; end", "def instance; end", "def instance; end", "def inherited(sub_klass)\n super\n Singleton.__init__(sub_klass)\n end", "def inherited(base)\n unless base == Billomat::SingletonBase\n Billomat.resources << base\n base.timeout ...
[ "0.69090074", "0.6832708", "0.6832708", "0.6832708", "0.6813566", "0.6627382", "0.6601738", "0.6572998", "0.65689373", "0.6562793", "0.6560641", "0.65482366", "0.64611185", "0.6398553", "0.6395939", "0.63737637", "0.63616353", "0.63530576", "0.6344837", "0.63134927", "0.63134...
0.0
-1
Processmethod for the 'numeric'method.
def cmd_numeric(obj) return handle_return_object(obj[:val].to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_numeric; end", "def on_numeric(n)\n n\n end", "def on_numeric(n)\n n\n end", "def numeric(attrs, klass = Integer)\n unless [Integer, Float].include?(klass)\n raise ArgumentError, 'Either Integer or Float allowed for #numeric validation'\n end\n\n Array(attrs).each do...
[ "0.6872777", "0.65870804", "0.65870804", "0.65838706", "0.653996", "0.6450594", "0.638628", "0.6375947", "0.63698053", "0.63387644", "0.63132155", "0.6184124", "0.6105587", "0.6057534", "0.6044501", "0.60439485", "0.60439485", "0.6019105", "0.60061085", "0.60061085", "0.59568...
0.6196441
11
strong parameters for security
def shop_params params.require(:shop).permit( :name, :location ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and ....
[ "0.7175822", "0.7106813", "0.7102372", "0.7085396", "0.69009024", "0.6887187", "0.6883119", "0.685227", "0.67542756", "0.6748084", "0.674027", "0.6738404", "0.66713667", "0.665174", "0.6632344", "0.6621212", "0.66190284", "0.66147286", "0.65997654", "0.6594334", "0.6551936", ...
0.0
-1
GET /suggestion_user_comments GET /suggestion_user_comments.json
def index @suggestion_user_comments = SuggestionUserComment.all document_id = params[:document_id] @document = Document.find(document_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_comments\n render :json => User.find(params[:user_id]).comments\n end", "def get_comments(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getComments')\n return get(uri)\n end", "def suggestion_user_comment_params\n params.require(:suggestion_user_comment).permit(:user_id, :su...
[ "0.69141626", "0.68668824", "0.6840103", "0.6760511", "0.67520803", "0.664407", "0.66111714", "0.65144753", "0.6491466", "0.64800733", "0.63541573", "0.63389415", "0.6267707", "0.62341607", "0.6182608", "0.6182608", "0.61728156", "0.61661106", "0.6165711", "0.6152677", "0.613...
0.6425906
10
GET /suggestion_user_comments/1 GET /suggestion_user_comments/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_suggestion_user_comment\n @suggestion_user_comment = SuggestionUserComment.find(params[:id])\n end", "def show\n user = User.find_by({token: env['HTTP_TOKEN']})\n render json: user.comments.find(params[:id])\n end", "def all_comments\n render :json => User.find(params[:user_id]).c...
[ "0.69464296", "0.6902396", "0.68225056", "0.6768761", "0.6675554", "0.6642492", "0.660055", "0.65421146", "0.65269774", "0.65134233", "0.644794", "0.6428461", "0.64161414", "0.6412304", "0.62993187", "0.62890625", "0.61776334", "0.6167632", "0.6157398", "0.6100894", "0.610036...
0.0
-1
POST /suggestion_user_comments POST /suggestion_user_comments.json
def create @suggestion_user_comment = SuggestionUserComment.new(suggestion_user_comment_params) respond_to do |format| if @suggestion_user_comment.save format.html { redirect_to document_suggestion_path(params[:document_id],id: params[:suggestion_id]), notice: 'Suggestion user comment was successf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suggestion_user_comment_params\n params.require(:suggestion_user_comment).permit(:user_id, :suggestion_id, :comment)\n end", "def set_suggestion_user_comment\n @suggestion_user_comment = SuggestionUserComment.find(params[:id])\n end", "def create\n @user_comment = UserComment.new(user_co...
[ "0.7448655", "0.6873578", "0.64456534", "0.63475066", "0.63013405", "0.6292213", "0.62723625", "0.62264997", "0.6202623", "0.62007606", "0.60653406", "0.605653", "0.6038107", "0.60008824", "0.59979415", "0.5989579", "0.59767324", "0.59757656", "0.58967865", "0.5894509", "0.58...
0.6864965
2
PATCH/PUT /suggestion_user_comments/1 PATCH/PUT /suggestion_user_comments/1.json
def update new_comment = suggestion_user_comment_params[:comment] respond_to do |format| if @suggestion_user_comment.update(comment: new_comment) format.html { redirect_to document_suggestion_path(params[:document_id],id: params[:suggestion_id]), notice: 'Suggestion user comment was successfully u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n user = User.find_by({token: env['HTTP_TOKEN']})\n comment = user.comments.find(params[:id])\n comment.update(comment_params)\n render json: comment\n end", "def set_suggestion_user_comment\n @suggestion_user_comment = SuggestionUserComment.find(params[:id])\n end", "de...
[ "0.69008565", "0.68394786", "0.6628928", "0.66047645", "0.658298", "0.650295", "0.6441062", "0.6418071", "0.6331739", "0.6328914", "0.62753326", "0.6207141", "0.61755437", "0.61631775", "0.6161214", "0.61322117", "0.6123439", "0.60704446", "0.60345584", "0.6014116", "0.600607...
0.73825884
0
DELETE /suggestion_user_comments/1 DELETE /suggestion_user_comments/1.json
def destroy comment = SuggestionUserComment.find(params[:id]) comment_creator = comment.user if comment_creator == current_user @suggestion_user_comment.destroy respond_to do |format| format.html { redirect_to document_suggestion_path(params[:document_id],id: params[:suggestion_id]), not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_comment_tag = UserCommentTag.find(params[:id])\n @user_comment_tag.destroy\n\n respond_to do |format|\n format.html { redirect_to user_comment_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_comment.destroy\n\n respond_to do |forma...
[ "0.67894775", "0.673911", "0.6733998", "0.6666565", "0.66315293", "0.6615294", "0.6614425", "0.6584997", "0.6546455", "0.6544592", "0.6535465", "0.653406", "0.6517576", "0.6510241", "0.64778286", "0.6445177", "0.6444711", "0.6430447", "0.64260787", "0.6403235", "0.6401804", ...
0.7094735
0
Use callbacks to share common setup or constraints between actions.
def set_suggestion_user_comment @suggestion_user_comment = SuggestionUserComment.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def suggestion_user_comment_params params.require(:suggestion_user_comment).permit(:user_id, :suggestion_id, :comment) 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_education_art_culture7 @education_art_culture7 = EducationArtCulture7.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def education_art_culture7_params params.require(:education_art_culture7).permit(:Programmes, :APPROVED_AWP_and_B, :Fund_Released_by_GOI, :Fund_Released_by_GOB, :Total_Fund_Released, :Total_Expenditure, :Expenditure_as_Percentage_of_AWP_and_B, :Year) 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
GET /projects GET /projects.json
def index @projects = Project.where.not({status: 9}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8575075", "0.8387044", "0.8356366", "0.80636895", "0.8038036", "0.80036354", "0.7858538", "0.78343743", "0.783193", "0.7800142", "0.77796274", "0.7748832", "0.77152216", "0.77012956", "0.7696217", "0.76950663", "0.76950663", "0.76950663", "0.76950663", "0.76950663", "0.769...
0.0
-1
GET /projects/1 GET /projects/1.json
def show @number_of_project = Project.where({name: @project.name}).size respond_to do |format| format.html { render :show } format.pdf { render :pdf => 'show', :layout => 'application.pdf' } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7868971", "0.76979554", "0.7680216", "0.7611453", "0.75334454", "0.75258976", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74926496", "0.74924207", "0.7484109", "0.7479275", "0.7444873", "0.74294627", "0.74224764", "0.7414947", "0....
0.0
-1
POST /projects POST /projects.json
def create @project = Project.new(project_params) @nameEverExist = Project.find_by name: @project.name if @nameEverExist == nil || (@nameEverExist.user == current_user && @nameEverExist.is_re_fundable) @project.user = current_user @project.status = 0 respond_to do |format| if @proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338948", "0.73139244", "0.7308003", "0.7299582", "0.7227503", "0.7225945", "0.71982473", "0.71170384", "0.7104803", "0.7095263", "0.7070636", "0.70408624", "0.70358187", "0.7024969", "0.70191896", "0.7009597", "0.698481", "0.697517", "0.6963753", "0.6963096", "0.6948756",...
0.0
-1
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json
def update if (current_user == @project.user && (@project.status == 0 || @project.pending?)) || current_user.role == 1 respond_to do |format| if @project.update(project_params) format.html { redirect_to @project, :flash => { success: 'Projet correctement mis à jour' } } format.json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\...
[ "0.70004326", "0.69119745", "0.6911138", "0.6889052", "0.6888448", "0.6878091", "0.68675476", "0.6857582", "0.685334", "0.685334", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68...
0.0
-1
DELETE /projects/1 DELETE /projects/1.json
def destroy if current_user == @project.user || current_user.role == 1 @project.objectives.each do |obj| obj.objective_validations.destroy_all obj.destroy end @project.destroy respond_to do |format| format.html { redirect_to projects_url, :flash => { success: 'Projet ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.7894983", "0.78589386", "0.77775395", "0.7771137", "0.7758355", "0.77305937", "0.77302146", "0.77302146", "0.77302146", "0.77302146", "0.77302146", "0.7724", "0.7717915", "0.7717915", "0.7717915", "0.7717915", "0.77042484", "0.77042484", "0.77042484", "0.77042484", "0.7704...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.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 project_params params.require(:project).permit(:name, :description, :spices, :comment, :status, :passed, :user, :git_hub, objectives_attributes: [:id, :name, :date, :description, :objective_type, :_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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
GET /conflicts GET /conflicts.json
def index @conflicts = Conflict.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def index\n @conflict_illnesses = ConflictIllness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @conflict_illnesses }\n end\n end", "def confl...
[ "0.69941837", "0.69941837", "0.62516606", "0.59520674", "0.5913865", "0.5887752", "0.5882883", "0.58457", "0.58321375", "0.58016056", "0.5770288", "0.57561594", "0.57476324", "0.570809", "0.5699054", "0.5609534", "0.5561468", "0.55568385", "0.5544554", "0.5474675", "0.54421",...
0.72338516
0
GET /conflicts/1 GET /conflicts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @conflicts = Conflict.all\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def conflict(exception)\n # had to remove as gives away details of our db structure.\n # TODO: come up with solution to give further details\n...
[ "0.7060807", "0.65131736", "0.65131736", "0.6116277", "0.60858196", "0.60456836", "0.59877104", "0.598211", "0.5912597", "0.5848424", "0.57815444", "0.5741731", "0.56887484", "0.567344", "0.56543136", "0.5648833", "0.5592025", "0.5512193", "0.55070907", "0.5505068", "0.550144...
0.0
-1
POST /conflicts POST /conflicts.json
def create @conflict = Conflict.new(conflict_params) respond_to do |format| if @conflict.save format.html { redirect_to @conflict, notice: 'Conflict was successfully created.' } format.json { render :show, status: :created, location: @conflict } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conflict_params\n params.require(:conflicts).permit(:date, :member_id)\n end", "def conflicts\n @conflicts ||= []\n end", "def conflicts\n @conflicts ||= []\n end", "def conflict_params\n params.require(:conflict).permit(:responsibility_id, :control_id)\n end", "def inde...
[ "0.6940358", "0.6516004", "0.6516004", "0.65004", "0.6481829", "0.60930586", "0.6086501", "0.6057802", "0.5946816", "0.5919245", "0.5911843", "0.57434016", "0.5737503", "0.56757724", "0.55879015", "0.55842155", "0.5578964", "0.5578964", "0.5519386", "0.5478527", "0.54688996",...
0.6766617
1
PATCH/PUT /conflicts/1 PATCH/PUT /conflicts/1.json
def update respond_to do |format| if @conflict.update(conflict_params) format.html { redirect_to @conflict, notice: 'Conflict was successfully updated.' } format.json { render :show, status: :ok, location: @conflict } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n format_time_input\n check_input\n respond_to do |format|\n # TODO: Duplication\n if @conflicts.any?\n respond_to_conflicts :edit, format\n elsif @reservation.update(reservation_params)\n notify_approval_needed\n respond_to_update format\n else\n ...
[ "0.58870023", "0.582783", "0.57835555", "0.57713825", "0.56535864", "0.56192297", "0.56113684", "0.5605151", "0.5549736", "0.5481177", "0.54706365", "0.54497933", "0.5429618", "0.5416762", "0.54062515", "0.5388375", "0.53878254", "0.53764284", "0.5371609", "0.53687876", "0.53...
0.6572372
0
DELETE /conflicts/1 DELETE /conflicts/1.json
def destroy @conflict.destroy respond_to do |format| format.html { redirect_to conflicts_url, notice: 'Conflict was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @conflict_illness = ConflictIllness.find(params[:id])\n @conflict_illness.destroy\n\n respond_to do |format|\n format.html { redirect_to conflict_illnesses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @violation.destroy\n respond_to do |format|\...
[ "0.6774196", "0.6446722", "0.6288047", "0.6089015", "0.6083939", "0.6083939", "0.6073036", "0.60519016", "0.59801006", "0.5970667", "0.59656703", "0.5946147", "0.59449", "0.5934481", "0.59267795", "0.59256345", "0.58927083", "0.58927083", "0.58902776", "0.58725226", "0.586200...
0.7129199
0
Use callbacks to share common setup or constraints between actions.
def set_conflict @conflict = Conflict.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Only allow a list of trusted parameters through.
def conflict_params params.require(:conflict).permit(:responsibility_id, :control_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Import all records from artwork table and test regression
def test_import Log.remove(ArtworkDataPlugin.log_name) query = 'SELECT * FROM artwork' sth = $dbh_pg.execute(query) while row = sth.fetch ArtworkDataPlugin.new('data', row) end ArtworkDataPlugin.flush_logs Log.test_regression(ArtworkDataPlugin.log_name) ArtworkDataPlugin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import(filename=\"import/study_units.csv\")\n require 'csv'\n CSV.foreach(filename, headers: true) do |row|\n @row = row.to_hash\n @study_unit = StudyUnit.where(study_id: id, name: @row[\"study_unit.name\"]).first ||\n StudyUnit.create(study_id: id, name: @row[\"study_unit.na...
[ "0.6635963", "0.6101732", "0.5979593", "0.5973883", "0.5915375", "0.5851756", "0.5799302", "0.57915014", "0.57793015", "0.5763952", "0.57380736", "0.5709747", "0.5705292", "0.5685237", "0.5646612", "0.5635467", "0.5597847", "0.55923826", "0.5590993", "0.55859464", "0.55798346...
0.73870355
0
Mismo ejemplo que versionado_define_method, pero usando class_eval y def's
def versionar(clase) clase.class_eval do def versionar @numeroVersion = self.version + 1 end def version @numeroVersion || 0 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk ...
[ "0.68732846", "0.68732846", "0.6827245", "0.6827245", "0.67172915", "0.6703206", "0.6703206", "0.66869575", "0.66869575", "0.66741717", "0.6624417", "0.66037256", "0.66037256", "0.66037256", "0.66037256", "0.66037256", "0.66037256", "0.6603658", "0.65721065", "0.65624326", "0...
0.6045912
67
Performs MySQL database setup based on the username and password provided. Also updates Rails config/database.yml file with database username and password
def stage_database(db_names, admin_password, db_user_name, db_password) sql_command = "" db_names.each do |name| db_name = ActiveRecord::Base.configurations[name]['database'] sql_command += "drop database if exists #{db_name}; " << "create database #{db_name}; grant all privileges on #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_db\n return unless File.exist?(\"#{Jets.root}/config/database.yml\")\n\n db_configs = Jets.application.config.database\n # DatabaseTasks.database_configuration for db:create db:migrate tasks\n # Documented in DatabaseTasks that this is the right way to set it when\n # using Activ...
[ "0.7179201", "0.69342476", "0.6618507", "0.65107435", "0.6397988", "0.6389726", "0.63659227", "0.6279558", "0.62448967", "0.62373936", "0.61475426", "0.6137164", "0.6137164", "0.6106023", "0.61025393", "0.6042534", "0.6040061", "0.6035342", "0.60297525", "0.5968502", "0.59592...
0.6530819
3
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.user_new_item_confirmation.subject
def user_new_item_confirmation @greeting = "Hi" mail to: "to@example.org", subject: "Item Confirmation" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_subject=(value)\n @message_subject = value\n end", "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\...
[ "0.6798064", "0.66707826", "0.666015", "0.6619629", "0.65436226", "0.6495671", "0.6484247", "0.64807343", "0.6466205", "0.6464936", "0.64324427", "0.6405458", "0.6403885", "0.6398281", "0.63798976", "0.6374256", "0.63668245", "0.6351364", "0.6233046", "0.6233046", "0.6233046"...
0.6210722
25
Returns an array of [x, y] if the two segments (given by arrays of [x1, y1, x2, y2]) intersect. Returns nil if the segments are parallel or do not intersect.
def segment_intersection(seg1, seg2) x1, y1, x2, y2 = seg1 x3, y3, x4, y4 = seg2 line1 = segment_to_line(*seg1) line2 = segment_to_line(*seg2) xmin = [[x1, x2].min, [x3, x4].min].max xmax = [[x1, x2].max, [x3, x4].max].min ymin = [[y1, y2].min, [y3, y4].min].max ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segments_intersect?(line_one, line_two)\n x1 = line_one[:x]\n y1 = line_one[:y]\n x2 = line_one[:x2]\n y2 = line_one[:y2]\n\n x3 = line_two[:x]\n y3 = line_two[:y]\n x4 = line_two[:x2]\n y4 = line_two[:y2]\n\n uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-...
[ "0.71440566", "0.71158874", "0.70748", "0.70499504", "0.6670899", "0.6542848", "0.6478945", "0.64641744", "0.64529705", "0.64529705", "0.64529705", "0.64415133", "0.6436069", "0.641937", "0.6389872", "0.629124", "0.6243652", "0.6229362", "0.6185363", "0.6160173", "0.615529", ...
0.75548726
0
Generates an arbitrary segment for the given line a x + b y = c. Possibly useful for working with vertical or horizontal lines via the dot product. Returns [x1, y1, x2, y2].
def line_to_segment(a, b, c) raise 'Invalid line (a or b must be nonzero)' if a == 0 && b == 0 if a == 0 y = c.to_f / b [0.0, y, 1.0, y] elsif b == 0 x = c.to_f / a [x, 0.0, x, 1.0] else [0.0, c.to_f / b, 1.0, (c - a).to_f / b] e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_to_line(x1, y1, x2, y2)\n raise 'Need two distinct points to define a segment' if x1 == x2 && y1 == y2\n\n # Vertical/horizontal/oblique lines\n if y1 == y2\n [0.0, 1.0, y1]\n elsif x1 == x2\n [1.0, 0.0, x1]\n else\n [y1 - y2, x2 - x1, x2 * ...
[ "0.72314006", "0.66461056", "0.6461749", "0.622428", "0.619712", "0.61579174", "0.6154776", "0.61352336", "0.61240214", "0.61216253", "0.6078332", "0.60716075", "0.6071261", "0.60657346", "0.60599184", "0.6053505", "0.6053505", "0.6053505", "0.6048115", "0.60478085", "0.60005...
0.7909225
0
Finds the general form of a line intersecting the given points. Returns [a, b, c] where a x + b y = c.
def segment_to_line(x1, y1, x2, y2) raise 'Need two distinct points to define a segment' if x1 == x2 && y1 == y2 # Vertical/horizontal/oblique lines if y1 == y2 [0.0, 1.0, y1] elsif x1 == x2 [1.0, 0.0, x1] else [y1 - y2, x2 - x1, x2 * y1 - x1 * y2] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_intersection(x1, y1, x2, y2, x3, y3, x4, y4)\n # calculate vector products\n d1 = (x3 - x1) * (y4 - y1) - (x4 - x1) * (y3 - y1)\n d2 = (x3 - x2) * (y4 - y2) - (x4 - x2) * (y3 - y2)\n d3 = (x1 - x3) * (y2 - y3) - (x2 - x3) * (y1 - y3)\n d4 = (x1 - x4) * (y2 - y4) - (x2 - x4) * (y1 ...
[ "0.65062493", "0.63629186", "0.62981087", "0.6292593", "0.6240016", "0.6240016", "0.6240016", "0.6215883", "0.6067539", "0.6053847", "0.6038315", "0.6023242", "0.597806", "0.5974584", "0.5964264", "0.59022033", "0.5899363", "0.5888557", "0.58714104", "0.5823138", "0.5822319",...
0.5710412
25
Returns the area of a 2D polygon with the given +vertices+ in order of connection, each of which must be a 2D coordinate (an array of two numbers). If vertices are given clockwise, the area will be negative. Uses the formula from
def polygon_area(vertices) raise "A polygon must have 3 or more vertices, not #{vertices.length}" unless vertices.length >= 3 area = 0 # Rely on Ruby's circular array indexing for negative indices vertices.size.times do |idx| x2, y2 = vertices[idx] x1, y1 = vertices...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def area\n return @area if defined?(@area)\n\n sum = 0.0\n (0...vertices.length).each do |i|\n prev = vertices[i - 1]\n curr = vertices[i]\n\n sum += ((prev.x * curr.y) - (prev.y * curr.x))\n end\n\n @area = sum / 2\n @area\n end", "def ar...
[ "0.7038388", "0.63054305", "0.62939185", "0.62453157", "0.5905287", "0.58388865", "0.5816228", "0.57865775", "0.57140166", "0.5698102", "0.5620551", "0.5561298", "0.55471003", "0.55470765", "0.5524854", "0.54429966", "0.542703", "0.54131556", "0.5390527", "0.5368021", "0.5336...
0.84996164
0
Dot product of two vectors (x1, y1) and (x2, y2). Using Ruby's Vector class (from require 'matrix') is probably a better option, when possible.
def dot(x1, y1, x2, y2) x1 * x2 + y1 * y2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot_product(vector2)\n self.class.dot_product(self, vector2)\n end", "def dot( vector )\n (@x * vector.at(0)) + (@y * vector.at(1))\n end", "def dotProduct( vector2 )\n i = @i * vector2.i\n j = @j * vector2.j\n \n pt = Point2D.new(i, j)\n vectorDotProduct = Vector2D.new( 0, 0 )\n ...
[ "0.82463324", "0.79715735", "0.7809462", "0.7621926", "0.74693274", "0.7468777", "0.7449062", "0.7446805", "0.73145306", "0.7208924", "0.7168547", "0.715428", "0.69918203", "0.6973586", "0.6953007", "0.67989594", "0.6650362", "0.66218626", "0.6616824", "0.65903336", "0.654232...
0.8219671
1
Computes a bounding box for the given 2D +points+ (an array of twoelement arrays), returned as [xmin, ymin, xmax, ymax]. If +expand+ is given and greater than 0.0, then the bounding box dimensions will be multiplied by (1.0 + +expand+).
def bounding_box(points, expand = nil) raise ArgumentError, 'No points were given' if points.empty? xmin = Float::INFINITY ymin = Float::INFINITY xmax = -Float::INFINITY ymax = -Float::INFINITY points.each do |x, y| xmin = x if xmin > x ymin = y if y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box\r\n unless with_z\r\n [Point.from_x_y(@x,@y),Point.from_x_y(@x,@y)]\r\n else\r\n [Point.from_x_y_z(@x,@y,@z),Point.from_x_y_z(@x,@y,@z)]\r\n end\r\n end", "def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, F...
[ "0.57173854", "0.56779337", "0.5670768", "0.5605406", "0.55550337", "0.55404013", "0.55098736", "0.54298294", "0.54016644", "0.5355793", "0.53417796", "0.5330086", "0.5318793", "0.5173397", "0.5127159", "0.5127159", "0.5048882", "0.5036792", "0.5017669", "0.50073373", "0.4975...
0.9051869
0
Clips a segment to a bounding box. Returns the clipped segment as an array with [x1, y1, x2, y2]. TODO: Delete this if it is never used and no tests are written.
def clip_segment(segment, box) xmin, ymin, xmax, ymax = box x1, y1, x2, y2 = segment new_segment = [] if x1 >= xmin && x1 <= xmax && y1 >= ymin && y1 <= ymax new_segment += [x1, y1] end if x2 >= xmin && x2 <= xmax && y2 >= ymin && y2 <= ymax new_seg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clipping\n x1 = FFI::MemoryPointer.new(:pointer)\n y1 = FFI::MemoryPointer.new(:pointer)\n x2 = FFI::MemoryPointer.new(:pointer)\n y2 = FFI::MemoryPointer.new(:pointer)\n\n ::GD2::GD2FFI.send(:gdImageGetClip, image_ptr, x1, y1, x2, y2)\n [x1.read_int, y1.read_int, x2.read_int, y2....
[ "0.67674553", "0.6283875", "0.59850967", "0.59337443", "0.58906364", "0.5763904", "0.55480975", "0.55041534", "0.5396875", "0.5382916", "0.5358088", "0.5345493", "0.5308989", "0.52042925", "0.51553196", "0.5139078", "0.51151496", "0.5062058", "0.5045855", "0.5032553", "0.5013...
0.7054479
0
Returns the distance from the line described by ax + by = c to the point (x, y). Based on the formula from
def distance_to_line(a, b, c, x, y) # Using -c instead of +c due to moving C across the equals sign (a * x + b * y - c).abs.to_f / Math.sqrt(a * a + b * b) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to_line(line)\n numer = Vector.construct_with_two_points(self, line.point).cross_product(line.vector)\n numer.length / line.vector.length\n end", "def distance_line_segment_point_squared(bx, by, cx, cy, px, py)\n\t\tmx = cx - bx\n\t\tmy = cy - by\n\t\thx = px - bx\n\t\thy = py - by\n\t\tt0 = ...
[ "0.72611165", "0.69447076", "0.68763757", "0.657719", "0.64958996", "0.6460315", "0.6441213", "0.6406781", "0.6354374", "0.6337831", "0.63252634", "0.62652016", "0.6256042", "0.61754256", "0.6153512", "0.61520946", "0.61418515", "0.61402196", "0.6137297", "0.6117083", "0.6095...
0.81606853
0
Returns a line that is the perpendicular bisector of the given segment as [a, b, c], where a x + b y = c. Based on the derivation from
def perpendicular_bisector(x1, y1, x2, y2) [ x2 - x1, y2 - y1, 0.5 * (x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1) ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perpendicular_segment(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n return point if self.contains?(point)\n \n l = self.perpendicular_line(point)\n p = Line.new(self.p1,...
[ "0.69158757", "0.6457546", "0.64348984", "0.6374801", "0.6138538", "0.6124244", "0.6083864", "0.59846926", "0.59111303", "0.5863408", "0.5863408", "0.5837711", "0.57815176", "0.5729315", "0.57211614", "0.5687519", "0.5646202", "0.5557813", "0.55038285", "0.54949534", "0.54776...
0.7053307
0
Returns the circumcenter of the triangle defined by the given three points as [x, y]. Returns nil if the points are collinear. The circumcenter of a polygon is the center of the circle that passes through all the points of the polygon. See also circumcircle.
def circumcenter(x1, y1, x2, y2, x3, y3) b1 = perpendicular_bisector(x1, y1, x2, y2) b2 = perpendicular_bisector(x2, y2, x3, y3) x, y = line_intersection(b1, b2) return nil if x.nil? || y.nil? [x, y] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circumcircle(x1, y1, x2, y2, x3, y3)\n x, y = circumcenter(x1, y1, x2, y2, x3, y3)\n return nil if x.nil? || y.nil?\n\n dx = x - x1\n dy = y - y1\n rsquared = dx * dx + dy * dy\n\n [x, y, rsquared]\n end", "def circumcenter\n return @circumcenter if defin...
[ "0.70629513", "0.6916676", "0.5775677", "0.5635085", "0.56080467", "0.5548691", "0.5466031", "0.5402948", "0.5371488", "0.52954197", "0.52371186", "0.5040119", "0.5034846", "0.50287", "0.50245094", "0.50220776", "0.4978401", "0.49398747", "0.49131563", "0.49086457", "0.488559...
0.7846099
0
Returns the circumcircle of the triangle defined by the given three points as [x, y, rsquared]. Returns nil if the points are collinear.
def circumcircle(x1, y1, x2, y2, x3, y3) x, y = circumcenter(x1, y1, x2, y2, x3, y3) return nil if x.nil? || y.nil? dx = x - x1 dy = y - y1 rsquared = dx * dx + dy * dy [x, y, rsquared] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def circumcenter(x1, y1, x2, y2, x3, y3)\n b1 = perpendicular_bisector(x1, y1, x2, y2)\n b2 = perpendicular_bisector(x2, y2, x3, y3)\n\n x, y = line_intersection(b1, b2)\n return nil if x.nil? || y.nil?\n\n [x, y]\n end", "def circum_circle(p, p1, p2, p3, cache = nil)\n ...
[ "0.6642543", "0.6260155", "0.58365005", "0.5540622", "0.5515215", "0.54588574", "0.5346128", "0.53388083", "0.50415283", "0.50379163", "0.50363654", "0.49863884", "0.49670875", "0.49522167", "0.4949144", "0.49210766", "0.49147356", "0.4906049", "0.49048743", "0.48928946", "0....
0.74192303
0
Returns the average of all of the given points. Each point should have the same number of dimensions. Returns nil if no points were given.
def centroid(points) return nil if points.empty? sum = points.reduce([0] * points.first.size) { |acc, point| acc.size.times do |i| acc[i] += point[i] end acc } sum.map { |v| v.to_f / points.size } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(points)\n points.reduce(V.new) { |sum, point| sum += point } / points.size\n end", "def average_points\n if ratings.count > 0\n ratings.collect(&:points).sum / ratings.count\n else\n 0\n end\n end", "def average(*values)\n v = values.compact # remove nil values du...
[ "0.77775866", "0.67886364", "0.6425447", "0.63575995", "0.63038576", "0.62577623", "0.6215396", "0.6167383", "0.61463743", "0.61376005", "0.60696673", "0.6018041", "0.6017102", "0.6003304", "0.5966446", "0.5924679", "0.58948326", "0.5879435", "0.5856759", "0.5845495", "0.5837...
0.6245535
6
Returns a Matrix that will rotate augmented 2D vectors by +:radians+ around the point (+:xcenter+, +:ycenter+).
def rotation_matrix(radians:, xcenter: 0, ycenter: 0) pre_translate = Matrix[ [1, 0, -xcenter], [0, 1, -ycenter], [0, 0, 1] ] r = radians.rotation rotation = Matrix[[*r.row(0), 0], [*r.row(1), 0], [0, 0, 1]] post_translate = Matrix[ [1, 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate(radians)\n sin = Math.sin radians\n cos = Math.cos radians\n Vector.new cos * @x - sin * @y, sin * @x + cos * @y\n end", "def rotation_matrix(r, v)\n v = vector_normalize(v)\n cosr = Math.cos(r)\n sinr = Math.sin(r)\n vx, vy, vz = v\n new_matrix(4, 4, [ cosr + (1-cosr)*vx*vx, ...
[ "0.6814149", "0.6145391", "0.6031592", "0.5968643", "0.5913871", "0.5895651", "0.5892563", "0.586359", "0.5772455", "0.57610047", "0.5728573", "0.5726861", "0.56845963", "0.56527555", "0.5642861", "0.5637428", "0.5634873", "0.5598002", "0.55377907", "0.5524577", "0.54788417",...
0.7223537
0
Returns a Matrix that will scale 2D vectors by +:xscale+/+:yscale+ (each defaults to copying the other, but at least one must be specified) centered around the point (+:xcenter+, +:ycenter+). Multiply with an augmented Vector to apply the transformation. Example: v = Vector[2, 2, 1] Third/augmented element (w) must be ...
def scale_matrix(xscale:, yscale: nil, xcenter: 0, ycenter: 0) raise "Specify at least one of :xscale and :yscale" if !(xscale || yscale) xscale ||= yscale yscale ||= xscale Matrix[ [xscale, 0, -xcenter * (xscale - 1)], [0, yscale, -ycenter * (yscale - 1)], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(scale_val, objectify = false)\n scaled = Array.new(@n) { Array.new(@m) }\n 0.upto(@n - 1) do |i|\n 0.upto(@m - 1) do |j|\n scaled[i][j] = scale_val * @matrix[i][j]\n end\n end\n return VectorMatrix.new(nil, nil, nil, scaled) if objectify\n scaled\n end",...
[ "0.6726251", "0.6007732", "0.5942673", "0.58392304", "0.56958634", "0.56193405", "0.5503318", "0.54586047", "0.54336834", "0.5382285", "0.53345704", "0.5282323", "0.52728695", "0.5260187", "0.5243101", "0.5238946", "0.5213795", "0.51658994", "0.5105939", "0.5052133", "0.50441...
0.73729503
0
Only allow a list of trusted parameters through.
def activity_params params.require(:activity).permit(:name, :difficulty) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6948629", "0.6813401", "0.68012834", "0.67958814", "0.6745398", "0.67409563", "0.6526744", "0.65207636", "0.6492359", "0.6433316", "0.6433316", "0.6433316", "0.639903", "0.6355392", "0.63544166", "0.63463736", "0.6344045", "0.6337686", "0.632862", "0.632862", "0.632862", ...
0.0
-1
GET /admin/apps GET /admin/apps.json
def index add_breadcrumb :index, :index @admin_apps = initialize_grid(App, per_page: 20) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def get_applist\n return get_response(\"applist\", :json)\n end", "def all_a...
[ "0.7827419", "0.77226716", "0.74892265", "0.7447903", "0.73796636", "0.73469746", "0.7290302", "0.720858", "0.718418", "0.7149974", "0.71159965", "0.7108975", "0.7108975", "0.7108975", "0.7108975", "0.7108975", "0.7101501", "0.70745844", "0.70725346", "0.7049786", "0.70288", ...
0.62383604
84
GET /admin/apps/1 GET /admin/apps/1.json
def show add_breadcrumb :show, :show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def applications_list\n get \"applications\"\n end", "def index\n @app = App.new\n @apps = App.all\n\n respond_to do |format|\n ...
[ "0.76414216", "0.7261605", "0.7199408", "0.70960736", "0.7060289", "0.7004644", "0.69918215", "0.69918215", "0.69918215", "0.6945509", "0.6927588", "0.69035167", "0.69035167", "0.69035167", "0.69035167", "0.69035167", "0.68601555", "0.6836399", "0.6805661", "0.6800343", "0.67...
0.0
-1
POST /admin/apps POST /admin/apps.json
def create @admin_app = App.new(admin_app_params) respond_to do |format| if @admin_app.save format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully created.' } format.json { render :show, status: :created, location: [:admin, @admin_app] } else format.ht...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @app = App.new(app_params)\n\n if @app.save\n render json: @app, status: :created, location: @app\n else\n render json: @app.errors, status: :unprocessable_entity\n end\n end", "def create\n # Avoid double provisioning: previous url would be \"/provision/new?apps[]=vtiger&o...
[ "0.73910666", "0.71222717", "0.7048033", "0.69740015", "0.69740015", "0.6971155", "0.6832115", "0.68010896", "0.66720176", "0.66382015", "0.6601423", "0.6542726", "0.653144", "0.652905", "0.6493756", "0.6487761", "0.64377415", "0.6423022", "0.6420283", "0.64017624", "0.640176...
0.745982
0
PATCH/PUT /admin/apps/1 PATCH/PUT /admin/apps/1.json
def update respond_to do |format| if @admin_app.update(admin_app_params) format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' } format.json { render :show, status: :ok, location: @admin_app } else format.html { render :edit } format.json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @app = @client.app(params[:id])\n\n respond_to do |format|\n if @app.update_attributes(params[:app]) # FIXME\n format.html { redirect_to @app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\...
[ "0.70691895", "0.69762504", "0.69001406", "0.6797158", "0.6787368", "0.6787368", "0.67785794", "0.67785794", "0.67785794", "0.67267936", "0.6651899", "0.6651899", "0.65734726", "0.65717727", "0.65717727", "0.65717727", "0.65717727", "0.65717727", "0.6556151", "0.6516997", "0....
0.70680326
1
DELETE /admin/apps/1 DELETE /admin/apps/1.json
def destroy @admin_app.destroy respond_to do |format| format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @client.app_destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end", "def admin_delete_app\n\n # Get Current App\n app = MailfunnelsUtil.get_app\n\n # If the User is not an admin redirect to ...
[ "0.76432055", "0.7476972", "0.7401371", "0.7401371", "0.7276964", "0.7276964", "0.72743875", "0.72743875", "0.72743875", "0.72684795", "0.7237131", "0.70974267", "0.7065954", "0.70575005", "0.70575005", "0.70575005", "0.70575005", "0.70238847", "0.70099455", "0.6968982", "0.6...
0.7451589
2
Use callbacks to share common setup or constraints between actions.
def set_admin_app @admin_app = App.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.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def admin_app_params params.require(:app).permit(:name, :access_key, :secret_key, :permission_level, :enable) 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 custom retention policy
def set_retention_policy(policy_name) @retention_policy = policy_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_retention\n @retention = Retention.find(params[:id])\n end", "def lock_retention_policy bucket_name:\n # The ID of your GCS bucket\n # bucket_name = \"your-unique-bucket-name\"\n\n require \"google/cloud/storage\"\n\n storage = Google::Cloud::Storage.new\n bucket = storage.bucket bucket_nam...
[ "0.6719424", "0.62378466", "0.6166551", "0.5953095", "0.5919104", "0.59007066", "0.5698444", "0.56261057", "0.5601996", "0.5591914", "0.5591914", "0.5527815", "0.54497004", "0.5295964", "0.5295964", "0.5240323", "0.5240323", "0.5063046", "0.5055217", "0.50469345", "0.5041013"...
0.6625114
1
Use custom database for this metrics
def set_database(database) @database = database end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db\n @db ||= InfluxDB::Client.new(::INFLUX_DB_NAME, DEFAULT_PRECISION)\n end", "def use_database(db)\n self.database = db\n end", "def use(name)\n with(database: name)\n end", "def use(name)\n with(database: name)\n end", "def database\n @database ...
[ "0.671798", "0.6712745", "0.6438234", "0.6438234", "0.6435302", "0.6185821", "0.6103876", "0.61014396", "0.60840213", "0.60556453", "0.60440165", "0.60175765", "0.600637", "0.6005074", "0.5996417", "0.5992288", "0.59738386", "0.595649", "0.5880004", "0.5880004", "0.5848697", ...
0.565793
40
Use custom precision for this metrics
def set_precision(precision) @precision = precision end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precision=(val)\n self['precision'] = val\n end", "def precision; end", "def precision\n self['precision']\n end", "def precision\n min.precision || max.precision\n end", "def conversion_precision; end", "def precision\n @values.fetch(:tp) / Float(@values.fetch(:tp) + @valu...
[ "0.78811264", "0.7782583", "0.7604682", "0.7471463", "0.7430827", "0.73726296", "0.7157226", "0.70412487", "0.702356", "0.7017504", "0.6980504", "0.6980504", "0.6922709", "0.6893149", "0.68580437", "0.682374", "0.679224", "0.67119527", "0.6564114", "0.6563148", "0.6528229", ...
0.7501123
3