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
The class of the resource that the controller handles
def controller_resource ProjectEvaluation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class\n @resource_class ||= self.controller_name.singularize.classify.constantize\n end", "def resource_class\n @resource_class ||= self.class.to_s.split(\":\").last\n end", "def resource_klass\n resource_klass_name.constantize\n end", "def class_of_resource\n @class_o...
[ "0.83064103", "0.80881983", "0.8082002", "0.8019689", "0.8018521", "0.8013433", "0.7973236", "0.7904059", "0.7852093", "0.78449255", "0.78449255", "0.78449255", "0.7835738", "0.78215885", "0.7792966", "0.7792966", "0.7792966", "0.7791172", "0.77491", "0.77283365", "0.7700869"...
0.0
-1
GET /bookings GET /bookings.json
def index @bookings = Booking.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n ...
[ "0.8231102", "0.80365145", "0.80220497", "0.80220497", "0.80220497", "0.7619097", "0.7607287", "0.7501954", "0.7437335", "0.74355394", "0.736671", "0.73389894", "0.73331183", "0.73266363", "0.73217666", "0.72310644", "0.7227939", "0.71933675", "0.71933675", "0.71933675", "0.7...
0.7473071
19
GET /bookings/1 GET /bookings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |f...
[ "0.7793375", "0.76496434", "0.76496434", "0.76496434", "0.76409495", "0.76042414", "0.75729305", "0.73645985", "0.73645985", "0.73645985", "0.73645985", "0.7241474", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.720...
0.0
-1
POST /bookings POST /bookings.json
def create @booking = Booking.new(booking_params) @tour = Tour.find(booking_params[:tour_id]) @booking_waitlisted = Booking.new(booking_params) if (@tour.seats.to_i >= booking_params[:seats_booked].to_i) seats = @tour.seats.to_i - booking_params[:seats_booked].to_i @tour.seats = seats ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_i...
[ "0.7352903", "0.72284335", "0.6861232", "0.6782861", "0.6782861", "0.67668116", "0.6642335", "0.66400397", "0.6624518", "0.65150934", "0.6509452", "0.6509452", "0.6509452", "0.64890003", "0.6432718", "0.63778627", "0.634703", "0.6325285", "0.6296925", "0.62891", "0.62781", ...
0.0
-1
PATCH/PUT /bookings/1 PATCH/PUT /bookings/1.json
def update # if booking_params[:seats_booked].to_i < @booking.seats_booked.to_i tp = params.fetch(:booking).permit(:customer_id,:tour_id,:seats_booked,:preference) seats = @booking.seats_booked.to_i - booking_params[:seats_booked].to_i @tour = Tour.find(@booking.tour_id) @tour.seats = @tour...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booki...
[ "0.7066941", "0.70359373", "0.69522876", "0.69305456", "0.69305456", "0.69305456", "0.69264215", "0.68737555", "0.6790091", "0.67386323", "0.67108357", "0.66946954", "0.66946954", "0.66946954", "0.6679139", "0.6656559", "0.66391355", "0.6634592", "0.6627814", "0.66257364", "0...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_booking @booking = Booking.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 booking_params params.fetch(:booking).permit(:customer_id,:tour_id,:seats_booked,:preference) 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
Do a shelllike path lookup for prog_script and return the results. If we can't find anything return prog_script.
def whence_file(prog_script) if prog_script.index(File::SEPARATOR) # Don't search since this name has path separator components return prog_script end for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do prog_script_try = File.join(dirname, prog_script) return prog_script_try if File.exist?(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whence_file(prog_script)\n if prog_script.index(File::SEPARATOR)\n # Don't search since this name has path separator components\n return prog_script\n end\n for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do\n prog_script_try = File.join(dirname, prog_script)\n return prog_s...
[ "0.7780434", "0.6989591", "0.69886225", "0.6239696", "0.61683714", "0.60768193", "0.6011705", "0.6010599", "0.60050213", "0.5948889", "0.59437", "0.59130657", "0.5908372", "0.5908372", "0.58705324", "0.5841371", "0.5841371", "0.5822527", "0.5817532", "0.58142436", "0.5806768"...
0.7816255
0
We want to tightly control where users end up after signing in. If they hit a protected resource, devise has stored the location they were attempting If they volunteer to sign in, we've previously stored the location using after_filters in the devise cookie If they were on the front page, we want to redirect them to th...
def after_sign_in_path_for(resource_or_scope) s = stored_location_for(resource_or_scope) # nb returns and deletes if s && s[0] == '/' && s != '/' s.slice!(0) # remove the leading slash if current_user.remembered_group? # is there a cleaner way than using root_url? root_url(protocol: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_redirect\n redirect_to('https://carto.com/signin/') if CartoDB.extract_subdomain(request) == 'developers'\n end", "def after_sign_in_path_for(resource)\n if resource.class == 'Group'\n # root_url(:subdomain => current_user.subdomain)\n root_url\n else\n root_url\n end\n en...
[ "0.7011853", "0.6853818", "0.6796222", "0.6787892", "0.67426574", "0.6688203", "0.64581573", "0.6443813", "0.642449", "0.63669264", "0.631931", "0.6283086", "0.6258228", "0.6254703", "0.6230609", "0.6215867", "0.6187013", "0.6187013", "0.61580753", "0.6154273", "0.6131496", ...
0.6517001
6
continuously store the location, for redirecting after login
def store_location if request.get? && request.format.html? && !request.xhr? && !devise_controller? session[:"user_return_to"] = request.fullpath end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_location\n session[:redirect_after_login] = request.request_uri\n end", "def store_location\n session[:redirect] = request.url\n end", "def store_location\n session[:redirect_path] = request.path\n end", "def store_location\n # store last url - this is needed for post-login r...
[ "0.813832", "0.80018675", "0.7855478", "0.7767238", "0.7731841", "0.76595783", "0.76313734", "0.7618655", "0.7618125", "0.75935334", "0.75348276", "0.7532169", "0.7530031", "0.75239414", "0.7518145", "0.74875134", "0.7485756", "0.74762434", "0.7448181", "0.7448181", "0.744818...
0.0
-1
A method to convert an openlayersformat bbox string into an rgeo bbox object
def bbox_from_string(string, factory) return unless string minlon, minlat, maxlon, maxlat = string.split(',').collect { |i| i.to_f } bbox = RGeo::Cartesian::BoundingBox.new(factory) bbox.add(factory.point(minlon, minlat)).add(factory.point(maxlon, maxlat)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bbox(left, bottom, right, top)\n raise TypeError.new('\"left\" value needs to be a number between -180 and 180') unless(left.kind_of?(Float) && left >= -180 && left <= 180)\n raise TypeError.new('\"bottom\" value needs to be a number between -90 and 90') unless(bottom.kind_of?(Float) ...
[ "0.60862356", "0.6003337", "0.58920217", "0.5798198", "0.5747368", "0.57424223", "0.57411665", "0.5593428", "0.55598086", "0.55468273", "0.5448083", "0.5251661", "0.5244827", "0.52320683", "0.51605576", "0.51529425", "0.5119328", "0.5119328", "0.5106917", "0.5088977", "0.5013...
0.6811537
0
Formatting grabbed from ruby stdlib
def timestamp_with_usec time = Time.now time.strftime('%Y-%m-%dT%H:%M:%S.') + format('%06d ', time.usec) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats; end", "def formats; end", "def format(text); end", "def formatters; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def formatting\n return \"\\e[0;32m%c/%C |%b>%i|...
[ "0.6762508", "0.6762508", "0.67479676", "0.65355206", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6465209", "0.642774", "0.642774", "0.642774", "0.6353579", "0.6340045", "0.6304138", "0.62105876", "0.62105876", ...
0.0
-1
Oh, rails, how I hate your shielding of Logger formatters from me
def debug_msg(msg) "[#{timestamp_with_usec}] #{msg}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_formatter; end", "def log_formatter; end", "def colorize_logging; end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def formatter; end", "def formatter; end", "def formatter; end", "def formatters; end", "def colorize_logging=(_arg0); end", "def formatter \n ...
[ "0.8651695", "0.8651695", "0.77396566", "0.77388036", "0.77388036", "0.7530439", "0.7530439", "0.7530439", "0.7402015", "0.703038", "0.6957565", "0.6928898", "0.68877023", "0.68877023", "0.68877023", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997"...
0.0
-1
Method: walk_automation_objects Purpose: Recursively walk and record the automation object hierarchy from $evm.root downwards Arguments: service_object Returns: A completed Struct::ServiceObject data structure
def walk_automation_objects(service_object) automation_object = Struct::ServiceObject.new(service_object.to_s, "", Array.new) if service_object.to_s == $evm.root.to_s automation_object.position = 'root' elsif service_object.to_s == $evm.parent.to_s automation_object.position = 'parent' elsif service_obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy...
[ "0.6170826", "0.58349305", "0.52400583", "0.5162253", "0.49944493", "0.49401417", "0.49225986", "0.485547", "0.47778556", "0.47574612", "0.47574612", "0.4657206", "0.46291947", "0.45374662", "0.45239592", "0.451452", "0.44957012", "0.44923642", "0.44308883", "0.44273072", "0....
0.89353615
0
End of walk_object_hierarchy Method: print_automation_objects Purpose: recursively walk & dump the service object hierarchy discovered by walk_automation_objects Arguments: hierarchy: the service object hierarchy indent_level: the indentation string Returns: Nothing
def print_automation_objects(indent_level, hierarchy) case hierarchy.position when 'root' print_line(indent_level, "#{hierarchy.obj_name} ($evm.root)") when 'parent' print_line(indent_level, "#{hierarchy.obj_name} ($evm.parent)") when 'object' print_line(indent_level, "#{hierarchy.obj_name} ($evm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end", "def walk_automation_objects(service_object)\n automation_object = Struct::ServiceObject.new(service_object.to_s, \"\", Array.new)\n if service_object.to_s == $evm.root.to_s\n automation_object.position = 'root'\n elsif ser...
[ "0.6505712", "0.64134264", "0.6296363", "0.59506553", "0.5782438", "0.56913894", "0.56465787", "0.56415635", "0.55538833", "0.5416576", "0.5406604", "0.5405907", "0.54033494", "0.53748494", "0.53709364", "0.53589237", "0.53528774", "0.5324307", "0.5299967", "0.52920884", "0.5...
0.8389056
0
End of walk_object_hierarchy Method: print_line Purpose: Wraps $evm.log(:info....) Arguments: indent_level: the indentation string string: the actual message to print Returns: Nothing
def print_line(indent_level, string) $evm.log("info", "#{$method}:[#{indent_level.to_s}] #{string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy...
[ "0.6409883", "0.58165276", "0.58151895", "0.5685281", "0.5683016", "0.5590414", "0.5551198", "0.55332106", "0.5520638", "0.55091083", "0.550132", "0.54611546", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54080385", "0.53998536", "0.5...
0.7413576
0
End of print_linedumps Method: type Purpose: Returns a string containing the type of the object passed as an argument Arguments: object: object to be type tested Returns: string
def type(object) if object.is_a?(DRb::DRbObject) string = "(type: #{object.class}, URI: #{object.__drburi()})" else string = "(type: #{object.class})" end return string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typeOf _args\n \"typeOf _args;\" \n end", "def inspect\n list = kwargs.empty? ? [*args] : [*args, **kwargs]\n list << codeblock.to_s if codeblock\n list = list.map(&:inspect).join ', '\n the_type = type ? type.inspect : ''\n \"#{the_type}[#{list}]\"\n end", "def whatami(...
[ "0.6857546", "0.68416905", "0.6573879", "0.65488", "0.64716697", "0.6441205", "0.6404657", "0.63842934", "0.6382238", "0.6338627", "0.62704116", "0.6268481", "0.6240276", "0.62342095", "0.6226654", "0.61991847", "0.6177927", "0.6137269", "0.61289823", "0.61289823", "0.6128602...
0.6753028
2
End of ping_attr Method: str_or_sym Purpose: format a string containing the argument correctly depending on whether the value is a symbol or string Arguments: value: the thing to be stringformatted Returns: string containing either ":value" or "'value'"
def str_or_sym(value) value_as_string = "" if value.is_a?(Symbol) value_as_string = ":#{value}" else value_as_string = "\'#{value}\'" end return value_as_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is_a?(String)\n \"'#{arg}'\"\n else\n arg.to_s\n end\n end", "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is...
[ "0.6580558", "0.6580558", "0.64290214", "0.6374447", "0.6177938", "0.6117355", "0.59964705", "0.5992098", "0.5968117", "0.59486246", "0.58951235", "0.5872423", "0.5849036", "0.58371663", "0.5740083", "0.5713309", "0.5711262", "0.56904596", "0.5686483", "0.5686483", "0.5686483...
0.7422172
0
End of str_or_sym Method: print_attributes Purpose: Print the attributes of an object Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped Returns: None
def print_attributes(object_string, this_object) begin # # Print the attributes of this object # if this_object.respond_to?(:attributes) print_line($recursion_level, "Debug: this_object.inspected = #{this_object.inspect}") if $debug if this_object.attributes.respond_to?(:keys) if t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n ...
[ "0.7548576", "0.7003994", "0.6802647", "0.6730234", "0.6509097", "0.6490177", "0.646289", "0.63599765", "0.62217087", "0.61246246", "0.5999873", "0.59849334", "0.59399784", "0.59260106", "0.59260106", "0.5909143", "0.58688456", "0.58434194", "0.57736546", "0.5770615", "0.5770...
0.8148297
0
End of print_attributes Method: print_virtual_columns Purpose: Prints the virtual_columns_names of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped this_object_class : the class of the object whose assoc...
def print_virtual_columns(object_string, this_object, this_object_class) begin # # Only dump the virtual columns of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the virtual columns of this object # virtual_col...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_virtual_columns(my_object, my_object_name)\n if my_object.respond_to?(\"virtual_column_names\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.virtual_columns\")\n my_object.virtual_column_names.sort.each { |vcn| self.log(:info, \"#{my_object_name} Virtual Column - #{vcn}\")}\n se...
[ "0.8149296", "0.6227594", "0.6227594", "0.6129865", "0.60626733", "0.5890227", "0.5839619", "0.56068194", "0.5594218", "0.5587403", "0.5437805", "0.5437374", "0.5411703", "0.5389679", "0.5375347", "0.5261109", "0.5257295", "0.5251589", "0.5241231", "0.5229373", "0.52264297", ...
0.8270801
0
End of print_virtual_columns Method: is_plural? Purpose: Test whether a string is plural (as opposed to singular) Arguments: astring: text string to be tested Returns: Boolean
def is_plural?(astring) astring.singularize != astring end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_plural(word)\n\treturn word[-1] === 's' ? true : false\nend", "def plural?\n self == self.pluralize\n end", "def is_plural?(value)\n\t(value > 1) || (value < 1)\nend", "def plural?(is_plural,term)\n singular_plural = term.split('/')\n if singular_plural.size == 1\n sin...
[ "0.73216754", "0.73002934", "0.72870815", "0.70495206", "0.69248646", "0.69102776", "0.69025254", "0.6902409", "0.6580795", "0.6542817", "0.6453487", "0.62955916", "0.6260426", "0.6239439", "0.6238155", "0.6212102", "0.62064564", "0.61395943", "0.6068515", "0.6041791", "0.598...
0.807028
0
End of is_plural? Method: walk_association Purpose: Walks the association into the object passed to it Arguments: object_string : friendly text string name for the object association : friendly text string name for the association associated_objects : the list of objects in the association Returns: None
def walk_association(object_string, association, associated_objects) begin # # Assemble some fake code to make it look like we're iterating though associations (plural) # number_of_associated_objects = associated_objects.length if is_plural?(association) assignment_string = "#{object_string}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_association(object, associations); end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print th...
[ "0.64756316", "0.62145936", "0.595618", "0.5784524", "0.57229745", "0.57071847", "0.5684734", "0.56623", "0.5527177", "0.5404729", "0.53927237", "0.53807807", "0.52848095", "0.5259393", "0.5220017", "0.519091", "0.51880175", "0.51679283", "0.5161598", "0.5147637", "0.5104444"...
0.8364309
0
End of walk_association Method: print_associations Purpose: Prints the associations (if any) of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose associations are to be dumped this_object_class : the class of the object whose associations are...
def print_associations(object_string, this_object, this_object_class) begin # # Only dump the associations of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the associations of this object according to the # $walk_asso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{o...
[ "0.73037016", "0.72469294", "0.6449096", "0.62647194", "0.6179434", "0.60254383", "0.5854516", "0.58438015", "0.5754523", "0.565204", "0.5524142", "0.55054826", "0.54988396", "0.5494011", "0.54886574", "0.54662234", "0.5437204", "0.53831834", "0.5371586", "0.53678095", "0.534...
0.81122863
0
End of print_associations Method: print_methods Purpose: Prints the methods (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose methods are to be dumped Returns: None
def print_methods(object_string, this_object) begin # # Only dump the methods of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ print_line($recursion_level, "Class of remote DRb::DRbObject is: #{this_object.method_missing(:c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n ...
[ "0.7377751", "0.6756606", "0.6730689", "0.62736297", "0.6253588", "0.6224839", "0.6133456", "0.6084404", "0.59996593", "0.5978311", "0.5966865", "0.5933512", "0.58986175", "0.58985925", "0.58644646", "0.58452266", "0.5844996", "0.5842908", "0.58336425", "0.5799953", "0.579359...
0.7420266
0
End of print_methods Method: print_tags Purpose: Prints the tags (if any) of the object class passed to it Arguments: this_object : the Ruby object whose tags are to be printed this_object_class : the class of the object whose associations are to be dumped Returns: None
def print_tags(this_object, this_object_class) begin if this_object.respond_to?(:taggable?) if this_object.taggable? tags = Array.wrap(this_object.tags) if tags.length.zero? print_line($recursion_level, "--- no tags ---") else print_line($recursion_level, "--- tag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info...
[ "0.67090267", "0.62940216", "0.6273373", "0.6164496", "0.586712", "0.5850494", "0.5811628", "0.58027494", "0.5792961", "0.57860476", "0.5784236", "0.5771969", "0.57497245", "0.57469445", "0.57342416", "0.57162094", "0.5714655", "0.56722635", "0.5669556", "0.5601797", "0.55572...
0.8307177
0
End of print_tags Method: print_custom_attributes Purpose: Prints the custom attributes (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose tags are to be printed Returns: None
def print_custom_attributes(object_string, this_object) begin if this_object.respond_to?(:custom_keys) custom_attribute_keys = Array.wrap(this_object.custom_keys) if custom_attribute_keys.length.zero? print_line($recursion_level, "--- no custom attributes ---") else print_line($r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys...
[ "0.74974066", "0.7122771", "0.69482476", "0.6200635", "0.6074842", "0.5990056", "0.5946502", "0.5888241", "0.5779293", "0.56118345", "0.5611337", "0.55958146", "0.54379874", "0.5406638", "0.5398406", "0.5379504", "0.5338478", "0.5294797", "0.5294797", "0.5271711", "0.52399147...
0.8780458
0
End of print_custom_attributes Method: walk_object Purpose: Prints the details of the object passed to it Arguments: indent_level : the numeric value to use to indicate output indent (represents recursion depth) object_string : friendly text string name for the object this_object : the Ruby object to be dumped Returns:...
def walk_object(object_string, this_object) begin # # Make sure that we don't exceed our maximum recursion level # $recursion_level += 1 if $recursion_level > $max_recursion_level print_line($recursion_level, "*** exceeded maximum recursion level ***") $recursion_level -= 1 retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n ...
[ "0.7560727", "0.7017619", "0.6732748", "0.6185369", "0.609328", "0.6090988", "0.58785987", "0.584458", "0.57857746", "0.57305235", "0.5726411", "0.5608725", "0.5607093", "0.55077946", "0.5441575", "0.5428698", "0.54253703", "0.5412108", "0.5394367", "0.53773934", "0.53701174"...
0.7258275
1
http_basic_authenticate_with name: ENV["USERNAME"], password: ENV["PASSWORD"], except: [:index, :show, :update_score, :custom, :add_to_custom]
def index @game = Game.new(0,0) @users = User.all session[:republican_default] ||= User.find_by(name: "Donald J. Trump").name session[:democrat_default] ||= User.find_by(name: "Hillary Clinton").name session[:jerseyshore_default] ||= User.find_by(name: "DJ Pauly D").name render 'home/index' en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_with_http_basic\n nil\n end", "def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"...
[ "0.83460575", "0.8159651", "0.8076092", "0.80427486", "0.803855", "0.7972355", "0.7964747", "0.79357034", "0.7866257", "0.78562534", "0.7806435", "0.7803062", "0.7776832", "0.7726358", "0.76879585", "0.7628929", "0.7611913", "0.75904727", "0.74858415", "0.74801254", "0.747189...
0.0
-1
draw_tiles(num) returns num number of random tiles, removes the tiles from the default set
def draw_tiles(num) # puts "Length of default_tiles: " + @tile_bag.length.to_s # print @tile_bag # # puts if num > 7 raise ArgumentError end letters_picked = @tile_bag.sample(num) letters_picked.each do |tile| @tile_bag.delete_at(@tile_bag.index(tile)) end # pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_tiles (num)\n tiles_drawn = @bag_of_tiles.sample(num)\n tiles_drawn.each do | tile |\n @bag_of_tiles.slice!(@bag_of_tiles.index(tile))\n end\n return tiles_drawn\n end", "def draw_tiles(num)\n random_tiles = @tiles.sample(num)\n random_tiles.each do |letter|\n @t...
[ "0.86820465", "0.86295307", "0.8612073", "0.7949857", "0.7522328", "0.7329977", "0.6906661", "0.65693945", "0.6539872", "0.65116554", "0.64489454", "0.6424747", "0.6195311", "0.60963607", "0.6067721", "0.6057823", "0.60171074", "0.60163486", "0.59250975", "0.5908385", "0.5901...
0.8365043
3
def category_attributes=(categories_attributes) category_attributes.values.each do |category_attribute| category = Category.find_or_create_by(category_attribute) self.post_categories.build(category: category) end end
def comments_count self.comments.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_attributes=(categories)\n \tcategories.each do |index, category_hash|\n \t\tif category_hash[:name].present?\n\t\t\tcategory = Category.find_or_create_by(name: category_hash[:name])\n\t\t\tif !self.categories.include?(category)\n\t\t\t self.post_categories.build(:category => category) \n\t\t\te...
[ "0.9196664", "0.8975524", "0.8964696", "0.88729185", "0.8813736", "0.8779456", "0.86788046", "0.86400026", "0.8604089", "0.85728335", "0.8567538", "0.84818256", "0.8350258", "0.8240415", "0.8079144", "0.78853565", "0.78066444", "0.7540729", "0.6951708", "0.6667189", "0.659118...
0.0
-1
create a Module, Class, and lambda
def setup super @append_a = Module.new @append_a.define_singleton_method(:call) do |thing| thing << 'a' thing end @append_b = Class.new @append_b.define_singleton_method(:call) do |thing| thing << 'b' thing end @append_c = lambda do |thing| thing << 'c' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_module(name, &block)\n mod = Module.new(&block)\n @managed.const_set(name, mod)\n mod\n end", "def make_function(exp, register = true)\n name = map_name exp.shift\n args = exp.shift\n ruby_args = args.deep_clone\n ruby_args.shift # :args\n\n @method_name = name\n @c...
[ "0.63208824", "0.61317605", "0.6110549", "0.6006771", "0.5958146", "0.58892477", "0.5883861", "0.58518064", "0.5778411", "0.57108635", "0.5655776", "0.56211364", "0.56196415", "0.5612172", "0.5612172", "0.5586633", "0.55772567", "0.5567233", "0.5558745", "0.5558745", "0.55587...
0.5784309
8
No shirt, no shoes, no problem
def test_noops_with_no_composites pipeline = Class.new(Pipeline) result = pipeline.process([]) assert_equal([], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shovel\n if @satchel.contents.include?(\"fragment1\") && @satchel.contents.include?(\"fragment2\") && @satchel.contents.include?(\"fragment3\")\n @house.last_move_message = \"You've collected all three paper fragments. When you put them all together, you see this message: 'Buried in the garden.'...
[ "0.56777275", "0.5550387", "0.55290455", "0.55221635", "0.55044913", "0.55044913", "0.5431501", "0.54129106", "0.5361606", "0.5352056", "0.5344399", "0.5315415", "0.5315415", "0.5315415", "0.52978647", "0.52878416", "0.5276686", "0.5268935", "0.52494806", "0.52153194", "0.520...
0.0
-1
filters returns the filters
def test_filters_accessor pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b assert_equal([@append_a, @append_b], pipeline.filters) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters\n end", "def filters; end", "def filters; end", "def filters\n @filters ||= {}\n end", "def filters\n @filters ||= {}\n end", "def filters\n mentos(:get_all_filters)\n end", "def filters\n @filters ||= {}\n end", "def filters\n @filters ||= Fi...
[ "0.8456019", "0.845181", "0.845181", "0.8269123", "0.8269123", "0.8209427", "0.801745", "0.797463", "0.79453737", "0.79149646", "0.7739799", "0.77340585", "0.77235585", "0.75622326", "0.7509202", "0.7498318", "0.74026656", "0.7327405", "0.7327405", "0.73237115", "0.73045784",...
0.0
-1
Single call to ::use
def test_with_one_composite pipeline = Class.new(Pipeline) pipeline.use @append_a result = pipeline.process([]) assert_equal(['a'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*args, &block); end", "def use(*)\n super\n end", "def use *args, &block\n @app_builder.use(*args, &block)\n end", "def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :ar...
[ "0.7716489", "0.732768", "0.6622747", "0.62691236", "0.6262655", "0.6259941", "0.61921793", "0.6112874", "0.6057813", "0.60483676", "0.5994351", "0.59628904", "0.5937051", "0.5875306", "0.5856312", "0.57930684", "0.57675695", "0.57536083", "0.57299566", "0.56837475", "0.56675...
0.0
-1
Single call to ::use with multiple classes are chained in the order they are added
def test_with_multiple_composites pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b result = pipeline.process([]) assert_equal(['a', 'b'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*)\n super\n end", "def uses(*classes)\n class_helpers.push(*classes).uniq!\n end", "def use(*args, &block); end", "def use(klass, options=nil)\n @ustack ||= []\n @ustack << [klass, options]\n end", "def use(middleware_class, *middleware_args)\n @stack.use(middleware...
[ "0.6976594", "0.69018763", "0.6592517", "0.63450384", "0.61621755", "0.585968", "0.57918954", "0.5784724", "0.57833844", "0.571004", "0.5686177", "0.56314397", "0.5618399", "0.55834126", "0.55242056", "0.54829216", "0.5463985", "0.5443967", "0.5409996", "0.54028064", "0.53910...
0.0
-1
Multiple calls to ::use are chained in the order they are added
def test_with_multiple_compositions pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b pipeline.use @append_c result = pipeline.process([]) assert_equal(['a', 'b', 'c'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*)\n super\n end", "def use(*args, &block); end", "def use *args, &block\n @app_builder.use(*args, &block)\n end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end", "def use(middleware, *args, &block)\n @build...
[ "0.7466485", "0.72019905", "0.6407717", "0.62412554", "0.6098602", "0.6064689", "0.60187584", "0.59936553", "0.58786577", "0.58250964", "0.57923037", "0.576246", "0.57579744", "0.5709693", "0.570244", "0.56762785", "0.5671006", "0.5603355", "0.5594693", "0.5593962", "0.558315...
0.0
-1
GET /officers GET /officers.json
def index @officers = Officer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.70120776", "0.68085766", "0.67574185", "0.6749666", "0.6535951", "0.6460695", "0.64397985", "0.643415", "0.6344507", "0.6323022", "0.63114", "0.62589526", "0.62439644", "0.6226215", "0.6191653", "0.6174885", "0.61508185", "0.6139957", "0.6135376", "0.61279106", "0.61194783...
0.68126833
2
GET /officers/1 GET /officers/1.json
def show # No implementation needed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb...
[ "0.7046348", "0.7001572", "0.69504637", "0.6497077", "0.6497077", "0.6368807", "0.6278744", "0.6259181", "0.6184809", "0.6145527", "0.6118715", "0.60677445", "0.60526764", "0.6042264", "0.60311687", "0.6016174", "0.6015207", "0.60082424", "0.5998717", "0.5947594", "0.5926632"...
0.0
-1
POST /officers POST /officers.json
def create user = User.initialize_user(params[:email]) @officer = Officer.new(name: params[:name], surname: params[:surname], user: user) if @officer.save otp = Devise.friendly_token(20) user.update(password: otp) OfficerMailer.with(user: user, current_pass: otp).credential_mail.deliver_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location...
[ "0.6437128", "0.6412024", "0.6352317", "0.59724355", "0.58118606", "0.5808218", "0.57724", "0.5758419", "0.57167304", "0.57057893", "0.5701031", "0.569019", "0.56374997", "0.56293696", "0.561928", "0.5607093", "0.5592523", "0.5548167", "0.5545246", "0.55001366", "0.54948425",...
0.5384809
25
PATCH/PUT /officers/1 PATCH/PUT /officers/1.json
def update respond_to do |format| if @officer.update(officer_params) format.html { redirect_to @officer, notice: 'Officer was successfully updated.' } format.json { render :show, status: :ok, location: @officer } else format.html { render :edit } format.json { render json...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, :notice => 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render...
[ "0.68309736", "0.6799758", "0.67633224", "0.6350563", "0.625601", "0.622225", "0.61765367", "0.6139897", "0.6112186", "0.6004454", "0.59752643", "0.5971121", "0.59509224", "0.59173036", "0.59173036", "0.5878323", "0.58642566", "0.5848602", "0.5843612", "0.583796", "0.58325344...
0.6686386
4
DELETE /officers/1 DELETE /officers/1.json
def destroy @officer.destroy respond_to do |format| format.html { redirect_to officers_url, notice: 'Officer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |format|\n format.html { redirect_to officers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |fo...
[ "0.7247002", "0.7247002", "0.71190375", "0.6972263", "0.69123363", "0.69038635", "0.6731143", "0.6599067", "0.65580136", "0.6528185", "0.64996713", "0.6478702", "0.6469267", "0.64634544", "0.6461432", "0.6461195", "0.646096", "0.6459006", "0.6459006", "0.6459006", "0.6459006"...
0.6990993
3
Use callbacks to share common setup or constraints between actions.
def set_officer @officer = Officer.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 officer_params params.fetch(:officer, {}).permit(:name, :surname) 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
Generate the "official" name for the 7600B form, comprised of the GTC number, the order number , and the mod number, both padded to 4 digits and all separated by dashes.
def name "#{gtc_number}-#{name_str(order_number)}-#{name_str(mod_number)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name_with_digit (digit)\n char_array = ('a'..'z').to_a + ('0'..'9').to_a + ['_'] # char_array.length is 37\n\n quotient = digit\n queue = []\n while true do\n queue.push quotient % N_CHAR\n quotient = (quotient / N_CHAR).round - 1\n if quotient <= -1\n break\n en...
[ "0.6776644", "0.6734847", "0.66660166", "0.66488355", "0.6537759", "0.6443229", "0.6412352", "0.63953155", "0.63953155", "0.6392567", "0.6337869", "0.6336105", "0.6314855", "0.6234735", "0.62131804", "0.6210511", "0.620397", "0.618064", "0.6172254", "0.6171528", "0.6165391", ...
0.74425554
0
Returns the estimated amount obligated based on the platform fee and entered usage across the associated integrations. Pricing parameters are managed in the environment
def cost_to_date total_auths = integration_usages.pluck(:auths).sum auth_cost = total_auths * Figaro.env.per_auth_cost.to_f ial2_user_cost = ial2_users * Figaro.env.per_ial2_user_cost.to_f platform_fee + auth_cost + ial2_user_cost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end", "def sum_835_amount (opt=true)\n net_835_amt = 0\n if @client.name.upcase == \"GOODMAN CAMPBELL\"\n @checks.each do |check|\n total_835_amt = 0\n get_gcbs_insurance_eobs(check)\n total_835_amt = ...
[ "0.6326531", "0.6326295", "0.6258577", "0.6238494", "0.61906135", "0.61848503", "0.61620903", "0.6155133", "0.6148863", "0.6096127", "0.6091699", "0.60597026", "0.6053281", "0.6047944", "0.6047944", "0.60253364", "0.6011668", "0.59706074", "0.596953", "0.59604234", "0.5950950...
0.6072137
11
HELPERS DRY: DO NOT REPEAT YOURSELF; WET == 'WE ENJOY TYPING' adhere to Single Responsibility Principle
def get_players game_hash[:away][:players] += game_hash[:home][:players] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_input; end", "def set_text_input(input); end", "def start_typing(data); end", "def start_typing(data); end", "def collect_and_validate_input(msg, type)\n input = prompt msg\n \n if valid?(input, type)\n return input.upcase\n else\n system(\"clear\")\n puts \"INVALID INPUT: Please try ...
[ "0.66188717", "0.6610209", "0.6604494", "0.6604494", "0.65815634", "0.65446305", "0.6416158", "0.64000434", "0.63606197", "0.6356474", "0.63379884", "0.632745", "0.6321558", "0.6312647", "0.6309214", "0.6287033", "0.6273473", "0.62026846", "0.6191361", "0.6176728", "0.6175700...
0.0
-1
^Takes in raw keystrokes to read Arrow Drectional Keys and the RETURN key for entry
def tab_carrot(l) "^" * l end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ctrl_l() send_keys(:ctrl_l) end", "def control_key_down\r\n command 'controlKeyDown'\r\n end", "def read_single_key\n c = read_char\n\n case c\n\n when \"\\r\"\n return \"RETURN\"\n when \"\\e\"\n return \"SAVE\"\n when \"\\e[A\"\n return \"w\"\n when \"\\e[B\"\n r...
[ "0.6991457", "0.6985522", "0.69753957", "0.67441577", "0.67225677", "0.67162484", "0.6692415", "0.6681015", "0.66220427", "0.66190857", "0.65800613", "0.65413874", "0.6534051", "0.6529701", "0.6469654", "0.6448625", "0.64306074", "0.6424091", "0.6414777", "0.6399707", "0.6377...
0.0
-1
Searchs by collection_id not item ID
def show @item = Item.all.where(collection_id: params[:id]) render :json => @item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_by_id_collection(collection)\n FinderClass.match_by_data(@items.all, collection, :id)\n end", "def invoice_items_by_id_collection(collection)\n FinderClass.match_by_data(@invoice_items.all, collection, :id)\n end", "def find_item_in_collection(collection:, item:)\n collection.find(item)\n ...
[ "0.7667439", "0.7332168", "0.7266454", "0.7150835", "0.669353", "0.6650188", "0.6621962", "0.65737414", "0.6531809", "0.65317297", "0.6478626", "0.64216155", "0.62852824", "0.62078995", "0.61886036", "0.6167842", "0.60767937", "0.60709524", "0.60289854", "0.59846294", "0.5976...
0.6005691
19
additive inverse of each. Each positive becomes negatives, and the negatives become positives.
def invert(list) for i in 0..list.length-1 list[i] *= -1 unless list[i] == 0 end list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_all!(collection)\r\n collection.each do |point|\r\n inverse!(point)\r\n end\r\n collection\r\n end", "def invert() end", "def inverse_all(collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\...
[ "0.7145653", "0.6845122", "0.67997533", "0.67911917", "0.67911917", "0.6713504", "0.65575975", "0.65408677", "0.6412548", "0.63524204", "0.63486546", "0.63275796", "0.632646", "0.6321055", "0.6319893", "0.62782186", "0.62137294", "0.61885965", "0.6167924", "0.6123479", "0.611...
0.6761776
5
Method to handle record not found errors.
def path_not_found render json: { error: 'No route matches.' }, status: :not_found end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_not_found\n raise ActiveRecord::RecordNotFound\n end", "def record_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/record_not_found\"\n end", "def record_not_found(error)\n render json: {\n success: false,\n message: error.message...
[ "0.8250229", "0.79091203", "0.76344144", "0.75092155", "0.7508313", "0.74981034", "0.7496555", "0.74548435", "0.74529165", "0.7434027", "0.74247783", "0.7420021", "0.73500806", "0.73294985", "0.7307254", "0.7307107", "0.7274329", "0.7250984", "0.7165259", "0.711203", "0.70942...
0.0
-1
GET /mercadoria GET /mercadoria.json
def index @mercadoria = Mercadorium.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n...
[ "0.7064855", "0.70645344", "0.6935587", "0.6920939", "0.69089544", "0.6897663", "0.68728936", "0.67873573", "0.67429346", "0.66999227", "0.66941893", "0.6685317", "0.6668537", "0.6668537", "0.66670257", "0.6656401", "0.6595273", "0.65823984", "0.6568594", "0.65684265", "0.656...
0.6640198
16
GET /mercadoria/1 GET /mercadoria/1.json
def show @volumecont20 = 27 @volumepeca = @mercadorium.altura * @mercadorium.largura * @mercadorium.comprimento @multiplicador = @mercadorium.imposto/100.to_f @a = @volumepeca /3 @quantcont = (27/0.036176).round @quantporcbm = (1/0.036176).round(2) @precofobcont = (@quantcont * @mercadoriu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @mo...
[ "0.711845", "0.7077771", "0.7061761", "0.7009957", "0.7008972", "0.70059913", "0.6951583", "0.6859146", "0.6814255", "0.67654616", "0.6758554", "0.6748133", "0.6718281", "0.67146385", "0.67146385", "0.66921794", "0.66721404", "0.6657802", "0.6653208", "0.6642004", "0.6641008"...
0.0
-1
POST /mercadoria POST /mercadoria.json
def create @mercadorium = Mercadorium.new(mercadorium_params) respond_to do |format| if @mercadorium.save format.html { redirect_to @mercadorium, notice: 'Mercadorium was successfully created.' } format.json { render action: 'show', status: :created, location: @mercadorium } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n form...
[ "0.67477256", "0.6739276", "0.6739165", "0.6694551", "0.6689389", "0.6677803", "0.66533107", "0.6601493", "0.6569048", "0.65583456", "0.65311676", "0.6509675", "0.64973515", "0.6495338", "0.6489573", "0.64755064", "0.6461316", "0.64568335", "0.6423191", "0.6420336", "0.641851...
0.6381713
24
PATCH/PUT /mercadoria/1 PATCH/PUT /mercadoria/1.json
def update respond_to do |format| if @mercadorium.update(mercadorium_params) format.html { redirect_to @mercadorium, notice: 'Mercadorium was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { ren...
[ "0.6534382", "0.6483613", "0.6428888", "0.6423829", "0.6415252", "0.6411362", "0.63959414", "0.638086", "0.6361599", "0.6352019", "0.6350865", "0.6341838", "0.63382775", "0.6337906", "0.633349", "0.63049495", "0.6301073", "0.62753534", "0.62697166", "0.62685114", "0.62628907"...
0.6128896
53
DELETE /mercadoria/1 DELETE /mercadoria/1.json
def destroy @mercadorium.destroy respond_to do |format| format.html { redirect_to mercadoria_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format...
[ "0.7356539", "0.7196844", "0.7193584", "0.7070339", "0.7066652", "0.7063075", "0.70554215", "0.7050196", "0.7041964", "0.7037224", "0.7035154", "0.70142454", "0.7003566", "0.6983386", "0.69828165", "0.69826126", "0.6982392", "0.69792145", "0.69763863", "0.6974049", "0.6969273...
0.7224526
1
Use callbacks to share common setup or constraints between actions.
def set_mercadorium @mercadorium = Mercadorium.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 mercadorium_params params.require(:mercadorium).permit(:image, :fabricante, :nome, :descricao, :preco, :precoumcbm, :precomeiodevinte, :altura, :largura, :comprimento, :precofrete, :imposto, :precodevenda, :precodaconco, :vendamensal, :outroscustosdevenda, :precooriginal) 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
Pundit's core `authorize` helper always raises an error, but also lets the controller know an authorization has been performed. Sometimes it is preferrable to flag that an authorization check has been made, but return boolean rather than raise. So this uses an exception rescue for flow control, which is not optimal but...
def authorized?(record, query=nil) begin authorize(record, query) rescue Pundit::NotAuthorizedError false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n render :text => \"Authorization error\", :status => 401\n false\n end", "def authenticate!\n current_user ? true : raise(Pundit::NotAuthorizedError)\n end", "def authorized?(**args)\n super && (!defined?(Pundit) || current_user || raise(Pundit::NotAuthorizedError))\n...
[ "0.6995548", "0.69605553", "0.6957514", "0.692206", "0.68917584", "0.68425024", "0.68425024", "0.68425024", "0.68248475", "0.6808626", "0.67907614", "0.67276007", "0.66958606", "0.66624707", "0.663759", "0.6618322", "0.6602031", "0.6591941", "0.6587434", "0.658231", "0.655836...
0.63599473
46
The current user permissions can be policy checked in views:
def can?(query, record) query = "#{query}?" policy = Pundit.policy!(pundit_user, record) !! policy.public_send(query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end", "def user_permission\n has_controller_permission?('user')\n end", "def custom_permissions\n ...
[ "0.8114332", "0.7601134", "0.73948526", "0.7345559", "0.72514397", "0.72437453", "0.72036165", "0.7143711", "0.7127735", "0.7100951", "0.70516586", "0.705126", "0.70386326", "0.7028502", "0.7014997", "0.7005093", "0.6963206", "0.69574267", "0.6933564", "0.6930712", "0.6928344...
0.0
-1
If you implement you MUST remove the action from skip_authorization_check above!
def index # look up by messageable type and id head :not_implemented end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_authorization; end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def skip_authorization\n @_authorization_performed = true\n end", "def authorize_una...
[ "0.8585479", "0.8154678", "0.791911", "0.74044746", "0.7338426", "0.7254241", "0.72048473", "0.7202056", "0.7192164", "0.7164608", "0.7164608", "0.71039855", "0.70464736", "0.7004046", "0.6995758", "0.698332", "0.69416654", "0.6937841", "0.69256955", "0.6925487", "0.69239426"...
0.0
-1
GET /permits GET /permits.json
def index if params[:category].blank? @permits = Permit.all.order("created_at DESC") else @category_id = Category.find_by(category_name: params[:category]).id @permits = Permit.where(:category_id => @category_id).order("created_at DESC") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permits\n return @permits if changed?\n @permits = loader.permits\n end", "def abilities\n get('/ability/')\n end", "def index\n permits = Permit.select('id, permit_type, applicant_name, start_date, end_date, address, application_data, city_name, ST_AsGeoJSON(geometry) AS ge...
[ "0.6468166", "0.64317036", "0.63783944", "0.6343692", "0.6298317", "0.6157982", "0.60996604", "0.6054717", "0.6009847", "0.6006947", "0.5958866", "0.5920648", "0.58385533", "0.58214986", "0.5737014", "0.57287884", "0.5726562", "0.570388", "0.5697023", "0.5682268", "0.56757617...
0.5915161
12
GET /permits/1 GET /permits/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_permit\n @permit = Permit.find(params[:id])\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Per...
[ "0.6687496", "0.6633081", "0.64910364", "0.6151438", "0.6097908", "0.6030518", "0.60210127", "0.60129726", "0.60122436", "0.5946877", "0.59093624", "0.59013546", "0.58755577", "0.5848156", "0.577358", "0.57587016", "0.57269484", "0.56988317", "0.5671168", "0.56572044", "0.562...
0.0
-1
POST /permits POST /permits.json
def create @permit = Permit.new(permit_params) @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.save format.html { redirect_to @permit, notice: 'Permit was successfully created.'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html...
[ "0.7121574", "0.6456046", "0.6390089", "0.6292707", "0.61748934", "0.6170476", "0.6135272", "0.6074082", "0.60365325", "0.6006201", "0.5979559", "0.59678626", "0.5920976", "0.5881255", "0.58673215", "0.5848935", "0.58320343", "0.58314365", "0.58283794", "0.5823748", "0.581901...
0.658533
1
PATCH/PUT /permits/1 PATCH/PUT /permits/1.json
def update @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.update(permit_params) format.html { redirect_to @permit, notice: 'Permit was successfully updated.' } format.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n form...
[ "0.7037591", "0.6089023", "0.5942867", "0.592158", "0.5903526", "0.5898621", "0.5896345", "0.58882254", "0.58475435", "0.5841189", "0.5823558", "0.5815913", "0.5815889", "0.5787355", "0.57859033", "0.5783836", "0.5781662", "0.576887", "0.57535344", "0.5747716", "0.5733261", ...
0.62426394
1
DELETE /permits/1 DELETE /permits/1.json
def destroy @permit.destroy respond_to do |format| format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehiclepermit.destroy\n respond_to do |format|\n format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect...
[ "0.7002032", "0.69629705", "0.679106", "0.6709306", "0.6706271", "0.6676756", "0.66675395", "0.66483545", "0.66381675", "0.66159225", "0.660326", "0.6602588", "0.65897876", "0.6589017", "0.65862536", "0.6574142", "0.6567747", "0.65636426", "0.65345496", "0.6531613", "0.650761...
0.77983844
0
Use callbacks to share common setup or constraints between actions.
def set_permit @permit = Permit.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 permit_params params.require(:permit).permit(:permitid, :filename, :category_id, :site_id, :employee_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
Checkse if devfile has any user added observers and sends notification to those nodes
def checkForObservers(devfile) begin path = "/user/" + params[:username] + "/device/" + params[:devicename] + "/files" + devfile.path + devfile.name devfile.file_observers.each do |fo| begin if fo XmppHelper::notificationToNode(fo, devfile, "Content updated!") end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifiable_via_jabber?\n user.watch(self) unless user.dont_watch_new_torrents?\n end\n end", "def listeners...
[ "0.6577711", "0.63400346", "0.6026646", "0.6013105", "0.59164107", "0.59164107", "0.58937824", "0.58516836", "0.58486545", "0.58194673", "0.58098394", "0.58038056", "0.5787016", "0.576124", "0.57510984", "0.57427704", "0.5741569", "0.57150155", "0.5703422", "0.5702", "0.56673...
0.7739362
0
Method is used to get metadata of device's files.
def getMetadata #:doc: if @device == nil return false end puts "SENDING XMPP *****" # try to reach device through XMPP XmppHelper::sendXmppMessage(@device.xmppname, "list") @device.update_attribute(:xmpp_request_sent, DateTime.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_metadata; end", "def metadata_file; end", "def metadata_file; end", "def obtain_file_metadata(file_id)\n begin\n metadata = @drive_manager[file_id].get\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n ...
[ "0.67700547", "0.6737775", "0.6737775", "0.66766864", "0.66589314", "0.6640562", "0.649501", "0.64556533", "0.644948", "0.644641", "0.6441036", "0.6434258", "0.6418977", "0.6418977", "0.6397409", "0.63751686", "0.63662493", "0.63662493", "0.6338634", "0.6327756", "0.6327756",...
0.0
-1
Updates file's metadata to db parameters: f filehash commit the commit the file belongs to
def updateDevfile(f, commit) #:doc: dev_file = nil begin # Checks if there is any changes in files. f_filedate = DateTime.strptime(f['filedate'], "%T %F") f_filedate = f_filedate.strftime('%F %T').to_s now = DateTime.now.strftime('%F %T') puts "name: #{f['name']}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "def update_file_in_db(file_id, filename, public_status, folder_id)\n $db.execute(\"UPDATE files SET file_name = ?, public_status = ?, folder_id = ? WHERE file_id = ?\",...
[ "0.6721979", "0.6275223", "0.62125784", "0.6174687", "0.609163", "0.6052312", "0.6048062", "0.6019263", "0.6007592", "0.5907478", "0.5837032", "0.5811534", "0.5783385", "0.5722229", "0.5706745", "0.56770873", "0.5673615", "0.5644141", "0.5643654", "0.5631918", "0.56115127", ...
0.6593738
1
Creates metadata of a new file to db parameters: f file commit the commit the file belongs to
def createDevfile(f, commit) #:doc: dev_file = nil blob = nil b_in_c = nil # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled) begin dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what...
[ "0.6870998", "0.6798961", "0.65737253", "0.6544489", "0.64065665", "0.64065665", "0.6313486", "0.63081837", "0.6294408", "0.6251297", "0.61757946", "0.61673397", "0.6143448", "0.6133419", "0.60675824", "0.6066988", "0.60098356", "0.6008737", "0.59878284", "0.59601647", "0.593...
0.6989372
0
add blobs from prev_commit to commit ignoring blobs in changed_files parameters: prev_commit The previous commit commit new commit changed_files list of files to ignore
def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc: # sql = "select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};" # devfiles_of_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n ...
[ "0.61535835", "0.585526", "0.58034074", "0.57718384", "0.575526", "0.57442135", "0.57291794", "0.57283944", "0.56657636", "0.5635432", "0.5591248", "0.5588017", "0.555051", "0.55259734", "0.54503167", "0.5441464", "0.5440389", "0.5426088", "0.54245037", "0.5422818", "0.542196...
0.83637303
0
Tests if the device is reachable through http. If device is reachable, marks to db the ipaddress where the request came from, and value direct_access to true. If device was not reachable marks direct_access as false. parameters: Method needs digest, the ipaddress where the request came from and port.
def test_request(digest, rem_ip, port) device = Device.find_by_id_digest(digest) puts "-- Test_request on device " + device.dev_name + " (" + device.id.to_s + ")" address = nil i = 0 while i < 2 do begin address = "http://" << rem_ip uri = URI.parse(address) if port != nil ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doi_server_reachable?\n # Invoke the API and get response\n true\n end", "def check_availability_by_http_request(host, port)\n uri = URI(\"http://#{host}:#{port}/info\")\n request = Net::HTTP::Get.new(uri)\n request[Datadog::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST] = '...
[ "0.6042585", "0.59668314", "0.5897502", "0.5796055", "0.5670178", "0.5597566", "0.55771816", "0.5515116", "0.5515116", "0.54601616", "0.5452217", "0.5439537", "0.541121", "0.5387958", "0.5355659", "0.53249204", "0.5293428", "0.52518976", "0.52444285", "0.52243257", "0.5216779...
0.5191332
21
check if commit is missing (some of) it's thumbnails. Sends xmppmessages to the device for the missing thumbnails. parameters: commit the commit in question
def checkForThumbs(commit) #:doc: prev_commit_blob_ids = Array.new prev_commit = Commit.find(:first, :conditions => ["id = ?", commit.previous_commit_id]) if prev_commit prev_commit.blobs.find_each(:batch_size => 1500) do |pb| prev_commit_blob_ids.push(pb.id) end end blobs_w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_com...
[ "0.56348634", "0.55705476", "0.54291606", "0.539609", "0.5383907", "0.5365913", "0.53337544", "0.5283248", "0.52613395", "0.52486324", "0.52453136", "0.5227515", "0.52217984", "0.5221655", "0.5173013", "0.5149498", "0.51455617", "0.5126359", "0.51229066", "0.51177406", "0.511...
0.7809339
0
Checks that all necessary http parameters are given. parameters: username, password, devicename and dev_type. port is optionla, but if given must be a number. Returns false is some of the parameters is missing or is in wrong form. Returns true if parameters are fine. register uses this method.
def check_params #:doc: if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or (params[:port] != nil and params[:port] !~ /\d{1,10}/) return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n ...
[ "0.65269417", "0.649987", "0.62674534", "0.6239871", "0.6229742", "0.62291175", "0.621783", "0.6102586", "0.60032976", "0.59961194", "0.599198", "0.59414464", "0.590808", "0.58970714", "0.58827436", "0.58732766", "0.58732766", "0.5827013", "0.5811307", "0.5790262", "0.5785052...
0.7656105
0
before_action :authenticate_user! CRUD on users
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorise\n unless User.find_by_id(session[:user_id]) || (self.controller_name == 'users' && (self.action_name == 'new' || self.action_name == 'create'))\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login!\"\n redirect_to login_url\n end\n end", "def authen...
[ "0.6736386", "0.6728403", "0.668388", "0.6618737", "0.652342", "0.6512651", "0.6499058", "0.6483792", "0.6476901", "0.6444685", "0.64351386", "0.6434935", "0.6430866", "0.6414968", "0.6414968", "0.6412905", "0.641211", "0.64091873", "0.6405783", "0.64007723", "0.6395581", "...
0.0
-1
Executes queries using the replica database. Fails over to primary if no replica is found. if you want to execute a block of code on the replica you can go: Account.on_replica do Account.first end the first account will be found on the replica DB For oneliners you can simply do Account.on_replica.first
def on_replica(&block) on_primary_or_replica(:replica, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_replica(&block)\n on_master_or_replica(:replica, &block)\n end", "def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end", "def enable_replica\n begin\n ActiveRecord::Base.connection.enable_replica\n ...
[ "0.7477597", "0.668392", "0.6670695", "0.65752465", "0.608348", "0.608348", "0.60500693", "0.5932167", "0.59185046", "0.58502245", "0.5722108", "0.5598713", "0.5598639", "0.55542797", "0.5521975", "0.55065924", "0.55016047", "0.54923815", "0.5486671", "0.54787755", "0.5448023...
0.7675419
0
Make these few schema related methods available before having switched to a shard.
def with_default_shard(&block) if is_sharded? && current_shard_id.nil? && table_name != ActiveRecord::SchemaMigration.table_name on_first_shard(&block) else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n raise NotImplementedError\n end", "def functional_update_schema # abstract\n raise 'abstract'\n end", "def shard; end", "def skip_schema_queries; end", "def is_schemaless(options = {})\n options = { }.merge(options)\n # Add class-methods\n extend ...
[ "0.6222472", "0.59928584", "0.5924963", "0.5776597", "0.5715524", "0.56666434", "0.56666434", "0.56666434", "0.56666434", "0.56546825", "0.5568859", "0.5504111", "0.54901856", "0.54901856", "0.5479614", "0.54578036", "0.545367", "0.5418144", "0.5410225", "0.54036254", "0.5380...
0.0
-1
GET /companies GET /companies.xml
def index @title = "Customer Relation Management" @companies = Company.all @contacts = Contact.all @opportunities = Opportunity.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @companies } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render...
[ "0.75398785", "0.75327474", "0.75327474", "0.75327474", "0.75327474", "0.7497508", "0.7146844", "0.6935157", "0.6935157", "0.6935157", "0.69347507", "0.6854752", "0.6850258", "0.6823983", "0.6816815", "0.67808086", "0.6750553", "0.6741065", "0.67320025", "0.67320025", "0.6732...
0.68223643
14
GET /companies/1 GET /companies/1.xml
def show @company = Company.find(params[:id]) @title = @company.name respond_to do |format| format.html # show.html.erb format.xml { render :xml => @company } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml ...
[ "0.7401719", "0.7401719", "0.7401719", "0.7401719", "0.73485667", "0.734687", "0.71413237", "0.7129088", "0.7129088", "0.7129088", "0.7043135", "0.6897895", "0.6831758", "0.681194", "0.67071956", "0.6641179", "0.6620508", "0.6617118", "0.6612846", "0.6560536", "0.6478701", ...
0.676628
14
GET /companies/new GET /companies/new.xml
def new @title = "Create a Company" @company = Company.new render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format...
[ "0.795994", "0.78861517", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.7652966", "0.7507527", "0.74248517", "0.7414509", "0.72888076", "0.7282765", "0.72074085", "0.71907026", "0.7183615", "0.718282", "0.7162448", "0.715...
0.0
-1
POST /companies POST /companies.xml
def create @company = Company.new(params[:company]) if @company.save flash[:success] = "Company was successfully created." redirect_to crm_path else render :action => 'new'# Clear page end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n ...
[ "0.6599383", "0.6599383", "0.6599383", "0.6528881", "0.64868504", "0.6303317", "0.6256015", "0.62385666", "0.62341565", "0.6211788", "0.61972684", "0.6196382", "0.6196382", "0.6196382", "0.6196382", "0.6196382", "0.61924773", "0.6191616", "0.6191616", "0.6191616", "0.6191616"...
0.59223866
43
PUT /companies/1 PUT /companies/1.xml
def update @company = Company.find(params[:id]) if @company.update_attributes(params[:company]) flash[:success] = @company.name + " was successfully updated." redirect_to crm_path else @title = "Edit " + @company.name render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action...
[ "0.6664095", "0.66459405", "0.6639532", "0.6639532", "0.66363287", "0.66337687", "0.64504045", "0.6405931", "0.63770616", "0.6320883", "0.6316433", "0.6304934", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.62998307", "0.6288434", "0.6284823...
0.5869893
66
DELETE /companies/1 DELETE /companies/1.xml
def destroy @company = Company.find(params[:id]) @company.destroy flash[:success] = "Company was successfully deleted." redirect_to crm_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n...
[ "0.7353038", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.72816765", "0.7240932", "0.70299447", "0.69667876", "0.6966431", "0.68465614", "0.67923546", "0.66653526", "0.66401255", "0.66267467", "0.6621424", "0.66155344", "0.6595...
0.686581
13
if more exist, use the select method or unique method or create a hash storing frequencies (although this takes up space)
def duplicate_number(array) raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) } array.detect{ |number| array.count(number) > 1 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def highest...
[ "0.7189087", "0.6992958", "0.6767406", "0.66592675", "0.65767807", "0.6547761", "0.6528727", "0.63719213", "0.63680774", "0.636455", "0.6290753", "0.6278185", "0.6274773", "0.6265522", "0.62090176", "0.6205272", "0.6203006", "0.61979276", "0.61768025", "0.616995", "0.6163011"...
0.0
-1
puts duplicate_number([1,2,2,2,4,5]) => 2 puts duplicate_number([1,2,3,'4'])
def first_non_repeat_char(string) raise ArgumentError, 'Parameter must be a string' unless string.is_a? String char_array = string.upcase.chars unique = char_array.select { |char| char_array.count(char) == 1 } unique.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_number(array)\n raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array\n raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) }\n\n array.detect{ |number| array.count(number) > 1 }\nend", "def find_dup(array_of_integers)\n arr...
[ "0.78283864", "0.74921274", "0.7293659", "0.7271644", "0.7268328", "0.719596", "0.7164671", "0.7142791", "0.71152014", "0.7110459", "0.7054195", "0.70180225", "0.6986368", "0.69740325", "0.6923069", "0.69219524", "0.6907931", "0.690389", "0.6875038", "0.68579787", "0.6796342"...
0.0
-1
If a block is passed in, it is given self.
def initialize(program_prefix = $0) @options = {} @order = [] @program_prefix = program_prefix @banner = nil @saved = nil if (block_given?) yield self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_block\n @_block.call(self) if @_block\n end", "def call(&block)\n block.call(self) if block_given?\n self\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block...
[ "0.79832894", "0.79593563", "0.78062487", "0.77270114", "0.77270114", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003"...
0.0
-1
Enable saving of unknown barewords. With this, the only way to terminate parsing is to hit the end of the parse or with . You can retrieve the saved words from saved.
def save_unknown! @saved = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_save\n save = load_save\n @word = save.word\n @hints = save.hints\n @incorrect = save.incorrect\n @lives = save.lives\n end", "def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n ...
[ "0.55728436", "0.5509204", "0.5457359", "0.533028", "0.523965", "0.52024263", "0.5179901", "0.5171566", "0.5164827", "0.51511115", "0.5146599", "0.51216525", "0.5108772", "0.50983286", "0.509507", "0.508494", "0.50693476", "0.50689787", "0.5053207", "0.502266", "0.5001643", ...
0.5656883
0
This defines a command line argument that takes a value.
def argument(short_name, long_name, description, default_value, validate = nil, &block) return define_value(short_name, long_name, description, false, default_value, validate || block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_arg(name, value)\n arg = @args.add_element(REXML::Element.new(\"argument\"))\n add_key_to_element(arg, \"name\", name)\n add_key_to_element(arg, \"value\", value)\n end", "def arg(key, default = nil)\n args.fetch(key.to_s, default)\n end", "def cli=(value); end", ...
[ "0.71850204", "0.67392343", "0.6381029", "0.6299818", "0.62333435", "0.6207733", "0.6207733", "0.6207733", "0.61628455", "0.61445284", "0.61251587", "0.59197974", "0.5889618", "0.5849626", "0.5841008", "0.58346695", "0.58346695", "0.58009326", "0.5742393", "0.57342243", "0.57...
0.6377714
3
This defines a command line argument that's either on or off based on the presense of the flag.
def flag(short_name, long_name, description, &block) return define_value(short_name, long_name, description, true, false, block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_option(arg)\n if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition\n @switches[arg] || @switches[\"--#{match}\"]\n else\n @switches[arg]\n end\n end", "def test_stringflag_with_false_default\n @p.opt :log, \"desc\", :type => :stringflag, ...
[ "0.666847", "0.6568296", "0.65617126", "0.6463394", "0.64377344", "0.6414854", "0.6394696", "0.6347101", "0.6332239", "0.6208723", "0.61391586", "0.61237323", "0.6078607", "0.6063073", "0.59903824", "0.594665", "0.5921182", "0.59109354", "0.5905872", "0.5879348", "0.5854362",...
0.0
-1
This produces a gap in the output of the help display but does not otherwise affect the argument parsing.
def gap(count = 1) 1.upto(count) { @order.push(nil) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_help\n\t\t\t\t# Print app name\n\t\t\t\tif @app_name then\n\t\t\t\t\tprint \"#{@app_name}\"\n\t\t\t\t\tprint \" #{@app_version}\" if @app_version > 0\n\t\t\t\t\tprint \" - #{@description}\" if @description\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\n\n\t\t\t\t# Print usage\n\t\t\t\tprint \"#{@messages[\"pre_u...
[ "0.67150533", "0.6650175", "0.66409653", "0.66179556", "0.651318", "0.64973545", "0.647828", "0.6446684", "0.6446684", "0.64186716", "0.63993746", "0.63486326", "0.63253415", "0.63253415", "0.63143826", "0.62979066", "0.62922305", "0.62797105", "0.62716347", "0.625714", "0.62...
0.0
-1
returns either the banner set with banner= or a simple banner like "Usage: $0 [arguments]"
def banner @banner || "Usage: #{program_prefix} [arguments]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n end\n @banner\n end", "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "def banner(arg=nil)\n arg.nil? ? @option_parser.banner : (@...
[ "0.843943", "0.8028383", "0.78630704", "0.7684364", "0.7683354", "0.7680522", "0.7669488", "0.76071167", "0.7602126", "0.7580503", "0.7570065", "0.7433965", "0.7418849", "0.7418849", "0.718152", "0.716194", "0.71595234", "0.71306896", "0.7129929", "0.70811784", "0.70571995", ...
0.86538833
0
Outputs a help screen. Code largely taken from the awesome, but not quite right for my needs, Clip (
def to_s out = "" out << banner << "\n" @order.each {|option| if (option.nil?) out << "\n" next end line = sprintf("-%-2s --%-#{longest+6}s ", option.short_name, option.long_name + (option.flag ? "" : " [VAL]")) out << l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def help\r\n end", "def help\r\n end", "def help\n end", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stde...
[ "0.7576363", "0.7412535", "0.7412535", "0.7386542", "0.73505324", "0.7348062", "0.73433924", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.72921073", "0.7243393", "0.7234204", "0.7218127", "0.7217866", "0.7216112", "0.72073686",...
0.0
-1
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity); "SELECT projects.title, sum( pledges.amount) FROM projects JOIN pledges where projects.id=pledges.project_id group by projects.title order by proj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category_from_projects\n\"SELECT category FROM projects;\"\nend", "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi...
[ "0.9197518", "0.706776", "0.69898534", "0.6650572", "0.6621777", "0.6515018", "0.64854777", "0.6322148", "0.6059388", "0.5941603", "0.59389925", "0.593695", "0.59016377", "0.5880613", "0.5871285", "0.585486", "0.58529305", "0.5841195", "0.58199084", "0.5782777", "0.57827556",...
0.5265008
96
Check if there's an event trigger in front of the player (when he presses A)
def check_event_trigger_there(triggers) return false if $game_system.map_interpreter.running? result = false d = @direction new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0) + (@direction == 4 ? slope_check_left(false) : @direction == 6 ? slope_check_right(false...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caught_by_player?\n return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)\n end", "def check_event_trigger_here(triggers)\n persona_check_event_trigger_here(triggers)\n $persona.set_transparent($game_player.screen_x > 450) if $persona != nil\n end", "def check_event_trigger_at(x, y)\n # get ...
[ "0.7001514", "0.6990527", "0.6971675", "0.68726254", "0.6768065", "0.6698392", "0.6646353", "0.66405004", "0.66021943", "0.65949994", "0.65643847", "0.65324986", "0.65050185", "0.6500237", "0.63973325", "0.6389508", "0.6387996", "0.63854766", "0.6378297", "0.6371732", "0.6365...
0.6252339
28
Check the common event call
def check_common_event_trigger_there(new_x, new_y, z, d) sys_tag = system_tag # Dive if terrain_tag == 6 && DIVE_TILE.include?(sys_tag) $game_temp.common_event_id = Game_CommonEvent::DIVE # Headbutt elsif $game_map.system_tag(new_x, new_y) == HeadButt $game_temp.common_event_id = Game_Co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_event_reserved?\n !@reserved_common_events.empty?\n end", "def check_common_event\r\n SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?\r\n end", "def common_event_reserved?\r\n @common_event_id > 0\r\n end", "def common_event_reserved?\n @common_event_id > 0\n ...
[ "0.72238475", "0.7169871", "0.71307796", "0.7073174", "0.7018544", "0.65973693", "0.6570707", "0.6568004", "0.6531229", "0.6474965", "0.6459335", "0.641363", "0.63844293", "0.6358794", "0.63273466", "0.6326735", "0.6306446", "0.6302359", "0.6250972", "0.6243473", "0.617714", ...
0.6283751
18
Check the follower common event call
def check_follower_trigger_there(new_x, new_y) if @follower.x == new_x && @follower.y == new_y if @follower.is_a?(Game_Event) @follower.start else @follower.turn_toward_player $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH end return true end r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following? subject\n has_event? 'follow', subject\n end", "def follow\n\n end", "def followers?\n following?\n end", "def notify_followers_if_necessary\n if state == MERGE_STATE['merge']\n notify_followers(jingle.id, child_jingle.user.id)\n end\n end", "def followed_by?(follower)\n...
[ "0.68459976", "0.6474227", "0.64201474", "0.63934547", "0.62816536", "0.6272473", "0.62413573", "0.62138695", "0.6174677", "0.61198324", "0.61060584", "0.6092439", "0.60899925", "0.6089084", "0.607554", "0.606005", "0.6048661", "0.6039396", "0.60291326", "0.60284", "0.5996545...
0.70777076
0
Check if the player touch an event and start it if so
def check_event_trigger_touch(x, y) return false if $game_system.map_interpreter.running? result = false z = @z $game_map.events.each_value do |event| next unless event.contact?(x, y, z) && [1, 2].include?(event.trigger) next if event.jumping? || event.over_trigger? event.start ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_trigger_touch(x, y)\n return if $game_map.interpreter.running?\n if @trigger == 2 and $game_player.pos?(x, y)\n start if not jumping? and @priority_type == 1\n end\n end", "def check_event_trigger_touch(x, y)\r\r\n return if $game_map.interpreter.running?\r\r\n if @trigger ==...
[ "0.7232688", "0.7051653", "0.6952872", "0.67571384", "0.67202485", "0.66883785", "0.66378367", "0.66156673", "0.6557029", "0.6439099", "0.63776046", "0.6367831", "0.6356335", "0.63454074", "0.6293763", "0.6194261", "0.60882723", "0.607761", "0.60332024", "0.58780277", "0.5868...
0.63218766
14
Execute a contentEditable command
def edit(command, value=nil) command = command.gsub(/_./) { |i| i[1].upcase } focus if value `#{document}.native.execCommand(#{command}, false, #{value})` else `#{document}.native.execCommand(#{command}, false)` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(content, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), content: content).open\n end", "def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend", "def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end", "de...
[ "0.67016417", "0.6207169", "0.6111128", "0.6016891", "0.6016891", "0.5993504", "0.5877074", "0.58044064", "0.57612485", "0.5753503", "0.569014", "0.5690111", "0.565304", "0.5607638", "0.55949473", "0.5586556", "0.55719775", "0.5546431", "0.5538674", "0.55344945", "0.55237323"...
0.7324193
0
GET /reuniaos GET /reuniaos.json
def index if params[:q] !=nil @reuniaos = Reuniao.created_between(params[:q],params[:o]) else @reuniaos = Reuniao.buscaTitulo(params[:p]) #@pessoa = Pessoa.all end #@reuniaos=Reuniao.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @reuniaos } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @ores = Ore.all\n \n respond_to...
[ "0.66942984", "0.6679619", "0.6664429", "0.66605556", "0.66023844", "0.65374935", "0.65137815", "0.6484795", "0.64548063", "0.63460666", "0.6318742", "0.6283837", "0.62751997", "0.6229841", "0.62151563", "0.6205752", "0.61935174", "0.6166426", "0.6164358", "0.6151002", "0.612...
0.0
-1