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 add_cpoint method is used to create a construction point.
def add_cpoint(point) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_point\n end", "def addPoint( x, y) \n point = PVector.new(x, y)\n @points.push(point)\n end", "def add(point)\n if point.class == ControlPoint\n @controlpoints << point\n else\n raise TypeError, 'Point should be type of ControlPoint'\n end\n end", "def add_poin...
[ "0.620884", "0.6018313", "0.5898276", "0.5827222", "0.5796931", "0.5739868", "0.5739868", "0.55395424", "0.5524788", "0.5494856", "0.546308", "0.5453075", "0.5438829", "0.54255205", "0.5365418", "0.53540194", "0.5337275", "0.5303954", "0.52858835", "0.52385014", "0.52236414",...
0.8374009
0
The add_curve method is used to create a curve from a collection of edges. The arguments are either Points or an Array of Points. At least 2 points are required.
def add_curve(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_bezierpath_withcp1_cp2_endpoint(controlPoint1: { :x => 0.0,\n :y => 0.0 }, \n controlPoint2: { :x => 9.0,\n :y => 9.0 }, \n ...
[ "0.59552974", "0.59411335", "0.56921977", "0.5678162", "0.5596444", "0.54808456", "0.547696", "0.54009044", "0.54009044", "0.5387943", "0.53176993", "0.5272498", "0.5225896", "0.52054524", "0.516832", "0.5137809", "0.51266843", "0.5114433", "0.5099677", "0.50885504", "0.50857...
0.7172665
0
The add_dimension_radial method adds a radial dimension (i.e arc/circle radius/diameter dimension) to the entities.
def add_dimension_radial(arc_curve, leader_break_pt) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radial(gradient, sx=@width/2, sy=@height/2, er=@width/2, ex=sx, ey=sy, sr=0.0)\n #options = KCGGradientDrawsBeforeStartLocation\n #options = KCGGradientDrawsAfterEndLocation\n CGContextDrawRadialGradient(@ctx, gradient.gradient, NSMakePoint(sx, sy), sr, NSMakePoint(ex, ey), er, gradient.pre + gr...
[ "0.47272795", "0.42956868", "0.42830494", "0.40558127", "0.40501666", "0.39372614", "0.38690415", "0.38416234", "0.3786328", "0.37771162", "0.37769103", "0.37181687", "0.37181687", "0.37153387", "0.37059188", "0.3695941", "0.36771247", "0.3646932", "0.36344904", "0.36033562", ...
0.6036537
0
The add_face method is used to create a face. You can call this method a number of ways: entities.add_face(edge1, edge2, edge3, ...) entities.add_face(edgearray) entities.add_face(pt1, pt2, pt3, ...) entities.add_face([pt1, pt2, pt3,...]) entities.add_face(curve) For the last form that takes a Curve, the curve must be closed like a circle.
def add_face(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_attached_face(vertex_array, num_edges)\n vertex_array_check(vertex_array)\n num_edges_check(num_edges)\n # Make the vertices into a line\n vertex_line = confirm_vertex_line(vertex_array)\n # This finds the \"ends\" of the vertex line\n end_vertices = [vertex_line.first, vertex...
[ "0.607945", "0.60227543", "0.5995705", "0.5837093", "0.5825671", "0.5808011", "0.57096916", "0.56808853", "0.56699985", "0.5653808", "0.5548002", "0.5521735", "0.55049133", "0.54570574", "0.5452992", "0.5452992", "0.54105735", "0.53751147", "0.53482234", "0.5342139", "0.53377...
0.73204786
0
The add_group method is used to create an empty group or a group with entities.
def add_group(*args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_group( group )\n type_check( group, Elements::Group )\n assert( !name_defined?(name), \"name [#{name}] is already in use\" )\n \n @groups[group.name] = group\n end", "def add_group!( group )\n save if add_group( group )\n end", "def add_group(group, gid=nil)...
[ "0.78047645", "0.7677617", "0.7557781", "0.7521314", "0.73256797", "0.7212642", "0.7210618", "0.70623183", "0.704614", "0.7026123", "0.70187205", "0.6972481", "0.697163", "0.69654095", "0.6946533", "0.6923229", "0.6923229", "0.69113827", "0.6904953", "0.6870857", "0.68462944"...
0.7453941
4
The add_image method is used to add an image to the collection of entities. The width and height are measured in model units (i.e. inches). If the height is not given, then it is computed from the width to preserve the aspect ratio of the image.
def add_image(path, point, width, height = 0.0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(image, width:, height:, row:)\n img = Image.read(image[:filename]).first.resize_to_fill(width, height)\n @rows[row] ||= ImageList.new\n @rows[row].push(img)\n end", "def add(image_name, type)\n image = Image.read(@folder+\"/\"+image_name)[0]\n # @width ||= image.columns\n # @height ||=...
[ "0.67709774", "0.66723883", "0.65400517", "0.64525163", "0.6210892", "0.61730367", "0.6156595", "0.6053683", "0.60005337", "0.5987973", "0.59079516", "0.59069675", "0.58782625", "0.58615", "0.5793552", "0.5763738", "0.5761043", "0.5760526", "0.56819385", "0.56551224", "0.5641...
0.65669537
2
The add_instance method adds a component instance to the collection of entities.
def add_instance(definition, transform) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_instance(instance)\n self.save unless self.persisted?\n instance.ie = self\n self.instances << instance\n instance.save && self.save\n end", "def add_component(component)\n\t\t@components << component\n\tend", "def add_component(component)\n add_to(component, @components)\n end", ...
[ "0.70564353", "0.6376215", "0.61957175", "0.59978765", "0.5875745", "0.58658016", "0.57949764", "0.5740524", "0.5708422", "0.5647735", "0.5628591", "0.5605202", "0.55653596", "0.55653596", "0.55502313", "0.5512318", "0.55114806", "0.54937786", "0.54903364", "0.54449373", "0.5...
0.551347
15
The add_line method is used to add an edge to the collection of entities. This is not to be confused with the concept of a "line" from a geometric sense, which is an invisible object represented by an Array of a point and a vector. (See the Array class for more information on geometric lines in SketchUp.) This method is the same as add_edges method, but returns a single edge.
def add_line(point1, point2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_line(line)\n @lines << line\n line\n end", "def add_line(line)\n\t\t@lines << line\n\tend", "def add_edge(e)\n @edges[e.from] << e\n end", "def add_line\n @layout.add_widget(HLine.new)\n end", "def add_line_item(args=nil)\n line_item = Wheretocard::Line...
[ "0.6186641", "0.6117533", "0.6075791", "0.6063363", "0.60037655", "0.5978198", "0.59622014", "0.5943116", "0.59406054", "0.5815336", "0.5799128", "0.57898295", "0.57838506", "0.56966764", "0.5694128", "0.56643456", "0.5600377", "0.5590597", "0.5576941", "0.5545393", "0.554375...
0.6305823
0
The add_ngon method is used to create a multisided polygon.
def add_ngon(center, normal, radius, numsides = 24) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_polygon(options)\n polygon = Google::OptionsHelper.to_polygon(options)\n \n self.add_overlay polygon\n polygon.added_to_map self\n \n unless polygon.encoded?\n self.extend_track_bounds polygon.vertices\n end\n \n polygon\n end", "def test_is_polygon_...
[ "0.6050541", "0.5236279", "0.52342427", "0.52223665", "0.51577336", "0.50539905", "0.5018183", "0.50071836", "0.5003961", "0.49998453", "0.4993382", "0.4926919", "0.49248546", "0.49017492", "0.4863987", "0.4862236", "0.48568124", "0.4855763", "0.48097065", "0.4762247", "0.476...
0.65977114
0
The add_section_plane method adds a section plane object to the entities.
def add_section_plane(plane) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_plane(plane)\n @planes << plane\n end", "def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end", "def active_section_plane=(sec_plane)\n end", "def add_section_with_http_info(firewall_section, opts ...
[ "0.74655074", "0.6930494", "0.5915646", "0.5457149", "0.54046077", "0.5373522", "0.5364024", "0.5331536", "0.52687496", "0.52687496", "0.5228261", "0.5190453", "0.51862484", "0.5051143", "0.504725", "0.5021157", "0.49847895", "0.488438", "0.48611373", "0.48524427", "0.4842374...
0.8068956
0
The clear! method is used to remove all entities from the collection of entities.
def clear! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear\n @dao.collection.remove\n end", "def clear\n return self if empty?\n\n entities = @entities.dup\n inverse_metadata = metadata.inverse_metadata\n\n @entities.clear\n\n entities.each do |deleted|\n if inverse_metadata\n deleted.send(inverse_metada...
[ "0.7814463", "0.76319367", "0.75952125", "0.756631", "0.7449117", "0.7440509", "0.74106777", "0.7398808", "0.73742366", "0.73490655", "0.73130244", "0.7295041", "0.7252483", "0.7195889", "0.7173491", "0.71661794", "0.71569973", "0.71354115", "0.7090501", "0.7082043", "0.70763...
0.6771032
55
The intersect_with method is used to intersect an entities, component instance, or group object with a entities object.
def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersects_with(&block)\n [:intersects_with, block]\n end", "def intersects_with(&block)\n [:intersects_with, block]\n end", "def intersect(tenant_id,entity_type_id_1,entity_id_1,entity_type_id_2,strict_number)\n @instance.intersect(tenant_id,entity_type_id_1,entity_id_1,entity_t...
[ "0.64842725", "0.64842725", "0.59735906", "0.58747905", "0.5810154", "0.5734227", "0.5639444", "0.55327284", "0.5342367", "0.52856725", "0.5261538", "0.5208548", "0.5147041", "0.50624955", "0.503874", "0.4997759", "0.49476013", "0.484487", "0.4839971", "0.47795996", "0.472273...
0.5907767
3
The model method is used to retrieve the model that contains the collection of entities.
def model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model\n return @model\n end", "def model\n return @model\n end", "def model\n return @model\n end", "def model\n @model ||= Model.new(self)\n end", "def model\n @model\n end", "def model\n ...
[ "0.76461667", "0.764185", "0.764185", "0.74050045", "0.72520393", "0.72520393", "0.72520393", "0.72520393", "0.7201894", "0.7195283", "0.71876884", "0.7071273", "0.7071273", "0.69585973", "0.6912392", "0.6906445", "0.68518835", "0.6836928", "0.6827868", "0.6805163", "0.680504...
0.62577885
60
The parent method is used to retrieve the parent or object that contains the collection of entities. A parent can be either a Model or ComponentDefinition object.
def parent end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent\n o = Object.const_get(parent_model) rescue nil\n o && o.get(parent_id)\n end", "def parent\n self\n end", "def parent\n _parent\n end", "def parent\n return @parent\n end", "def parent\n @parent\n end", "def parent\n @parent\n ...
[ "0.7400933", "0.7380317", "0.7379695", "0.7371369", "0.7333313", "0.7333313", "0.7333313", "0.7333313", "0.73116726", "0.7306924", "0.7280754", "0.7201338", "0.71324664", "0.71219975", "0.71219975", "0.7095051", "0.7070756", "0.70679814", "0.706707", "0.696214", "0.69466484",...
0.6705777
52
The transform_entities method is used to apply a transform to several subentities all at once. If you are transforming entities in the active drawing context or any of its parent drawing contexts, the transformation will be interpreted as relative to the global coordinate system. Otherwise the transformation will be interpreted as being on the local coordinate system.
def transform_entities(transform, entities) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_entities( transformation, entities )\r\n if @vertex_cache.empty?\r\n raise 'No verticed cached!'\r\n end\r\n unless transformation.is_a?( Geom::Transformation )\r\n raise ArgumentError, 'Not a transformation.'\r\n end\r\n return false if entities.empty?\r\n ...
[ "0.7570289", "0.64129245", "0.55503327", "0.53404963", "0.52807957", "0.5140464", "0.5129187", "0.5115216", "0.510098", "0.50695354", "0.49524334", "0.4950563", "0.4940448", "0.49188778", "0.49122536", "0.4902287", "0.4886456", "0.4856752", "0.4849546", "0.4842377", "0.479469...
0.74724543
1
scope :all_boys, > select("")
def full_name "#{first_name} #{last_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_all; end", "def for_dropdown\n ActiveRecord::Base.connection.select_all(\n select('brands.name, brands.id').group('1, 2').order('1').to_sql\n ).map { |r| [r['name'], r['id']] }\n end", "def select_all\n\t\treturn self.clone( :select => [] )\n\tend", "def select_all\n clone...
[ "0.68538845", "0.6361582", "0.6218723", "0.6181595", "0.6164318", "0.60797745", "0.59027886", "0.5865492", "0.57511795", "0.5698874", "0.56713897", "0.5662996", "0.564028", "0.564028", "0.55843306", "0.55749255", "0.55706054", "0.5568498", "0.5555624", "0.55348027", "0.550376...
0.0
-1
Clearly these user_ and user_token_ methods should be extracted to... a) Token class? b) Auth module/class?
def user_present? user_token_present? && User.find_by(auth_token: user_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend", "def token_auth(*args, &block); end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n ...
[ "0.67964697", "0.6784665", "0.6580735", "0.64821875", "0.6389003", "0.63376534", "0.63287437", "0.63265795", "0.6316272", "0.6305606", "0.6304899", "0.6282124", "0.62708926", "0.62708926", "0.6241428", "0.62406737", "0.6239061", "0.62383944", "0.62111104", "0.6211065", "0.619...
0.0
-1
having to tail a log in a separate terminal window.
def redirect_log(options={}) ActiveRecord::Base.logger = Logger.new(options.fetch(:to, STDERR)) ActiveRecord::Base.clear_active_connections! ActiveRecord::Base.colorize_logging = options.fetch(:colorize, true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tail_last\n log_name = last_log\n File.open log_name do |f|\n f.extend File::Tail\n f.interval = 2\n f.backward(2)\n f.return_if_eof = true\n loop do\n f.tail { |line| color_print line }\n break unless last_log == log_name\n end\n end\nend", "def logs tail=nil\n f = tail...
[ "0.71181077", "0.64701957", "0.6277213", "0.6242394", "0.62088513", "0.59615064", "0.5923595", "0.58777505", "0.5807328", "0.57833517", "0.578311", "0.57165396", "0.56639725", "0.56601095", "0.5655332", "0.5630369", "0.560447", "0.559708", "0.5585493", "0.55460757", "0.552894...
0.0
-1
GET /categories GET /categories.json
def index @parent_categories = ParentCategory.all.order(:display_order) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter:...
[ "0.83888507", "0.8327856", "0.83211476", "0.78072983", "0.7742051", "0.75669324", "0.75111455", "0.74151826", "0.7386452", "0.7369945", "0.7369187", "0.73691803", "0.73691803", "0.73457074", "0.73304063", "0.7316772", "0.72851175", "0.72663945", "0.72275496", "0.7220998", "0....
0.0
-1
GET /categories/1 GET /categories/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n ...
[ "0.7877821", "0.7864903", "0.7848852", "0.78426903", "0.7415118", "0.7408382", "0.73079324", "0.7307346", "0.7307346", "0.7282616", "0.7236084", "0.71876353", "0.7159534", "0.71334624", "0.71235555", "0.7066964", "0.7043923", "0.7037928", "0.7035486", "0.7032399", "0.70130795...
0.0
-1
POST /categories POST /categories.json
def create @category = Category.new(category_params) respond_to do |format| if @category.save format.html { redirect_to admin_category_path(@category), notice: 'Category was successfully created.' } format.json { render action: 'show', status: :created, location: @category } else format.html { render action: 'new' } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n json_create(category_params, Category)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATE...
[ "0.7738549", "0.74339235", "0.72349083", "0.71634054", "0.7124031", "0.70645165", "0.705568", "0.695861", "0.6956783", "0.6903891", "0.6838659", "0.6821712", "0.68190134", "0.6807838", "0.678525", "0.66138625", "0.6566919", "0.65661913", "0.65567696", "0.6523676", "0.65186286...
0.6220316
78
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json
def update respond_to do |format| if @category.update category_params format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.doci...
[ "0.76931995", "0.7600433", "0.721346", "0.6943123", "0.6914936", "0.6817601", "0.67816055", "0.6713112", "0.66984165", "0.6693479", "0.66566056", "0.66523254", "0.6651486", "0.6645902", "0.66068524", "0.65989816", "0.6571709", "0.6571709", "0.65543723", "0.65349466", "0.65002...
0.63583905
44
DELETE /categories/1 DELETE /categories/1.json
def destroy @category.destroy respond_to do |format| format.html { redirect_to admin_categories_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteCategory id\n \n APICall(path: \"categories/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @category.destroy\n render json: @category, status: :ok\n end", "def destroy\n @category = Category.find(params[:id])\n @category.destroy\n\n respond_to do |f...
[ "0.78272814", "0.77353686", "0.76392984", "0.7488916", "0.74731207", "0.74233276", "0.7399541", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7385346", "0.7378597", "0.7378597"...
0.73254865
28
Use callbacks to share common setup or constraints between actions.
def set_category @category = Category.find(params[:id]) @category.orderable :display_order, :parent_category_id # I'm already calling this in Category::initialize, but apparently `find` doesn't ever `initialize` - be a lot cooler if it did... 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.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def category_params params.require(:category).permit(:display_order, :name, :description, :parent_category_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
Given the key of the specific error and the options hash, translate the message. Options: key: The key of the error in the locales. options: The objects to pass to create the message. Returns: A localized error message string.
def translate(key, options) I18n.translate("#{BASE_KEY}.#{key}", options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_for(key,options={})\n handwritten_message || I18n.translate(key, {:scope => 'activerecord.errors.messages'}.merge(options))\n end", "def translate(key, **options)\n I18n.t key, **options.merge(scope: :quo_vadis, raise: true) rescue nil\n end", "def translate(key, options = {})\n...
[ "0.7858783", "0.74747014", "0.72703904", "0.6889381", "0.6810696", "0.6759146", "0.67536944", "0.67536944", "0.66990995", "0.665439", "0.66344583", "0.6633339", "0.6593224", "0.6520598", "0.6435967", "0.6392365", "0.6316432", "0.62642884", "0.62631667", "0.62213683", "0.61493...
0.74233496
2
3.3 Test and build the show action create the show action in the app/controllers/profiles_controller.rb the route /users/:user_id/profile add the :user_id part of the url to the params
def show @profile = Profile.find(:first, :conditions => {:user_id => params[:user_id]}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n # @profile = Profile.find(params[:id])\n redirect_to user_page_url(@profile.user)\n end", "def user\n\n \n @profile = Profile.find_by_user_id(params[:id])\n\n\nend", "def show\n p params\n p \"just herer for checking\"\n #@profile = Profile.find(params[:id])\n @user = User.fi...
[ "0.7740533", "0.7578568", "0.75608444", "0.7509444", "0.7373195", "0.7369203", "0.73151875", "0.7293107", "0.7261913", "0.72493964", "0.7239749", "0.7235664", "0.7212736", "0.7168155", "0.7154388", "0.7126662", "0.7126662", "0.7126662", "0.7126662", "0.7126662", "0.7126662", ...
0.7872587
0
3.4 Test and build the new action create the new action in app/controller/profiles_controller.rb
def new @profile = Profile.new @profile.user = User.find(params[:user_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n build_profile\n end", "def new\n super\n resource.build_profile\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save...
[ "0.73560566", "0.7221418", "0.68720424", "0.6814507", "0.6808517", "0.67369163", "0.6715498", "0.67121977", "0.6704698", "0.6701511", "0.6682644", "0.66610426", "0.6642058", "0.6606612", "0.66063887", "0.66026026", "0.6599262", "0.6597627", "0.65861255", "0.65685076", "0.6566...
0.0
-1
3.5 Test and build the create action create the create action in the app/controllers/profiles_controller.rb
def create user = User.find(params[:user_id]) @profile = Profile.new(params[:profile]) @profile.user = user if @profile.save redirect_to user_profile_path(params[:user_id]) else flash[:alert] = @profile.errors.full_messages.join(",") render :template => "profiles/new" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_crea...
[ "0.7368892", "0.7281008", "0.725927", "0.715911", "0.715303", "0.71288437", "0.712776", "0.7120326", "0.71195096", "0.710331", "0.70945865", "0.7083587", "0.70573777", "0.70516586", "0.70354134", "0.70191014", "0.7003004", "0.6989452", "0.69835776", "0.6982259", "0.6982148", ...
0.68932724
55
3.6 Test and build the edit action create the edit action in the profiles_controller remember that the user_id comes from the url /users/123/profile/edit
def edit user = User.find(params[:user_id]) @profile = user.profile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n @user = User.find(params[:user_id])\n @profile = @user.profile\n \n end", "def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n ...
[ "0.82292175", "0.8139889", "0.80937594", "0.80321246", "0.7968097", "0.7961251", "0.7933089", "0.785956", "0.7831531", "0.77892554", "0.7725336", "0.76898813", "0.76276433", "0.7627627", "0.7610835", "0.75770247", "0.75492406", "0.75257677", "0.75079554", "0.74738127", "0.746...
0.8153776
1
3.7 Test and build the update action create the update action in the app/controllers/profiles_controller.rb
def update @profile = Profile.find_by_user_id params[:user_id] if @profile.update_attributes(params[:profile]) redirect_to user_profile_path(params[:user_id]) else flash[:alert] = @profile.errors.full_messages.join(",") render :template => "profiles/edit" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @profile = Profile.find params[:profile_id]\n @update = @profile.updates.new(update_params)\n\n respond_to do |format|\n if @update.save\n format.html { redirect_to update_path(@update), notice: 'Update was successfully created.' }\n format.json { render :show, status: :cre...
[ "0.723548", "0.72085047", "0.70737624", "0.7049775", "0.70371795", "0.7011227", "0.69912785", "0.69685876", "0.6962347", "0.68755186", "0.6830007", "0.68136936", "0.68051493", "0.6794946", "0.6781554", "0.6780863", "0.6779092", "0.67680085", "0.67679304", "0.6767008", "0.6755...
0.6672205
34
Adds a string as an additional private credential to be combined in the collection.
def add_private(private_str='') additional_privates << private_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(new_creds)\n @credentials.merge!(new_creds) { |_, old_val, new_val| old_val + new_val }\n end", "def addCredentials(credential)\n\t\t@credentials.push(credential)\n\tend", "def add_restricted_string(string)\n @restricted_strings.push(string)\n end", "def add_credential(db, username, passw...
[ "0.65300107", "0.6401049", "0.59690285", "0.5925183", "0.56813645", "0.56536406", "0.5582447", "0.5550284", "0.55226195", "0.5417151", "0.541112", "0.540005", "0.5381424", "0.52727056", "0.5145717", "0.5123634", "0.5064708", "0.49927512", "0.4960606", "0.49416938", "0.4937117...
0.7572148
0
Returns true when each will have no results to iterate
def empty? prepended_creds.empty? && !has_privates? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?\n self.results.empty?\n end", "def hasResults?\n ! @results.empty?\n end", "def empty?\n @iterator.nil?\n end", "def empty?\n iterator.nil?\n end", "def my_none?\n status = true\n self.my_each do |item|\n if (yield item) == true\n status ...
[ "0.7608348", "0.7486262", "0.72782457", "0.72603536", "0.7162861", "0.7084586", "0.7045953", "0.7011792", "0.7011498", "0.69935656", "0.69506454", "0.6936981", "0.692555", "0.6878075", "0.6857555", "0.68537855", "0.6832348", "0.68179005", "0.67823243", "0.6773387", "0.6751802...
0.0
-1
Returns true when there are any private values set
def has_privates? password.present? || pass_file.present? || !additional_privates.empty? || blank_passwords end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end", "def has_known_value?\n all?(&:has_known_value?)\n end", "def all_private\n \treturn is_name_private && is_message_private && is_amount_private\n end", "def __empty?\n return false unless super\n __empty(__v...
[ "0.687254", "0.681967", "0.66989005", "0.6663614", "0.6648296", "0.6613189", "0.65909714", "0.6511552", "0.6488604", "0.645253", "0.64206475", "0.64181036", "0.64173543", "0.6408487", "0.63624", "0.635655", "0.6355741", "0.6338612", "0.63228446", "0.6306921", "0.62918204", ...
0.61004925
45
Analyze a private value to determine its type by checking it against a known list of regular expressions
def private_type(private) if private =~ /[0-9a-f]{32}:[0-9a-f]{32}/ :ntlm_hash elsif private =~ /^md5([a-f0-9]{32})$/ :postgres_md5 else :password end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_value_matcher; end", "def allow_matcher; end", "def methods_matching(re); end", "def private_nets_regex; end", "def typematch(strict, key, params, _component, value)\n errors = []\n ctx1 = Rsec::ParseContext.new value, \"source\"\n case key\n when :VERSION\n r...
[ "0.62569076", "0.60274065", "0.5947168", "0.5878101", "0.5812691", "0.57527083", "0.5734143", "0.5708198", "0.5636059", "0.5636059", "0.5607261", "0.5586464", "0.5564149", "0.55613583", "0.55613583", "0.55553705", "0.55553705", "0.5552359", "0.55498874", "0.55366397", "0.5526...
0.0
-1
Adds a string as an additional public credential to be combined in the collection.
def add_public(public_str='') additional_publics << public_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_private(private_str='')\n additional_privates << private_str\n end", "def addCredentials(credential)\n\t\t@credentials.push(credential)\n\tend", "def add_restricted_string(string)\n @restricted_strings.push(string)\n end", "def add(new_creds)\n @credentials.merge!(new_creds) { |_, ol...
[ "0.68462294", "0.62559134", "0.62259746", "0.61817056", "0.59006923", "0.5748912", "0.57230186", "0.5545442", "0.54890907", "0.5410406", "0.5409817", "0.5360466", "0.5281468", "0.52598274", "0.5255729", "0.52484703", "0.52007586", "0.51919246", "0.51739335", "0.5161569", "0.5...
0.72316724
0
Returns true when each will have no results to iterate
def empty? prepended_creds.empty? && !has_users? || (has_users? && !has_privates?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty?\n self.results.empty?\n end", "def hasResults?\n ! @results.empty?\n end", "def empty?\n @iterator.nil?\n end", "def empty?\n iterator.nil?\n end", "def my_none?\n status = true\n self.my_each do |item|\n if (yield item) == true\n status ...
[ "0.7608348", "0.7486262", "0.72782457", "0.72603536", "0.7162861", "0.7084586", "0.7045953", "0.7011792", "0.7011498", "0.69935656", "0.69506454", "0.6936981", "0.692555", "0.6878075", "0.6857555", "0.68537855", "0.6832348", "0.68179005", "0.67823243", "0.6773387", "0.6751802...
0.0
-1
Returns true when there are any user values set
def has_users? username.present? || user_file.present? || userpass_file.present? || !additional_publics.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end", "def value_set?\n @value_set == true\n end", "def has_known_value?\n all?(&:has_known_value?)\n end", "def value_set?\n @value_set\n end", "def complete_flag_values?\n @complete_flag_values\n ...
[ "0.71596587", "0.70534754", "0.699063", "0.6981047", "0.69351137", "0.6909376", "0.68466896", "0.6749543", "0.66543704", "0.6652924", "0.6652313", "0.6642557", "0.6584787", "0.6556851", "0.6550875", "0.65311265", "0.6495459", "0.6477065", "0.6475786", "0.64717776", "0.6455629...
0.63699543
26
Returns true when there are any private values set
def has_privates? super || userpass_file.present? || user_as_pass end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete?\r\n cur_values.all{ |value| value!=nil }\r\n end", "def has_known_value?\n all?(&:has_known_value?)\n end", "def all_private\n \treturn is_name_private && is_message_private && is_amount_private\n end", "def __empty?\n return false unless super\n __empty(__v...
[ "0.687254", "0.681967", "0.66989005", "0.6663614", "0.6648296", "0.6613189", "0.65909714", "0.6511552", "0.6488604", "0.645253", "0.64206475", "0.64181036", "0.64173543", "0.6408487", "0.63624", "0.635655", "0.6355741", "0.6338612", "0.63228446", "0.6306921", "0.62918204", ...
0.0
-1
Shows index name in Delayed::Jobname.
def display_name "#{self.class.name} for #{indices.join(', ')}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_name\n get_key('ALGOLIA_INDEX_NAME', 'index_name')\n end", "def index_name\n @index_name ||= @options[:index_name] ||\n __get_class_value(:index_name) ||\n DEFAULT_INDEX_NAME\n end", "def index_name\n models.map { |m| m.index_na...
[ "0.66772175", "0.64888126", "0.645598", "0.6331186", "0.6311525", "0.624574", "0.6224369", "0.62141246", "0.6211352", "0.62047786", "0.6204091", "0.62003213", "0.62003213", "0.6136164", "0.61107945", "0.6090453", "0.6088368", "0.60810727", "0.6009568", "0.6009568", "0.5974734...
0.64142406
3
Runs Sphinx's indexer tool to process the index. Currently assumes Sphinx is running.
def perform index true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform\n config = ThinkingSphinx::Configuration.instance\n \n output = `#{config.bin_path}#{config.indexer_binary_name} --config #{config.config_file} --rotate #{index}`\n puts output unless ThinkingSphinx.suppress_delta_output?\n \n true\n end", "def index(options = {})\n system(\...
[ "0.69802433", "0.6724148", "0.6644357", "0.6502688", "0.6477452", "0.6365644", "0.6262395", "0.6260822", "0.6159486", "0.6153946", "0.61057174", "0.60655636", "0.6059642", "0.6022898", "0.60181665", "0.6005722", "0.59887016", "0.59227896", "0.59220713", "0.5909556", "0.589890...
0.5341289
67
GET /docderivaciones GET /docderivaciones.json
def index @docderivaciones = Docderivacione.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end", "def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end", "def getDoc(doc)\n uri = URI.parse(\"https://api.figma.com/v1/files/#{doc[\...
[ "0.6441894", "0.63214195", "0.60927546", "0.6063289", "0.5955682", "0.5637765", "0.55295205", "0.5497133", "0.54547197", "0.54527336", "0.5411118", "0.5392355", "0.5382574", "0.53776795", "0.537531", "0.5343551", "0.5338128", "0.5320747", "0.53071207", "0.53033966", "0.529029...
0.76148593
0
GET /docderivaciones/1 GET /docderivaciones/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @docderivaciones = Docderivacione.all\n end", "def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end", "def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end", "def create\n...
[ "0.76613003", "0.68103784", "0.63388824", "0.6336488", "0.6323652", "0.61583567", "0.58821476", "0.575896", "0.57555586", "0.57349676", "0.5717576", "0.5708986", "0.56768644", "0.56713486", "0.5644072", "0.5637579", "0.5635437", "0.5608392", "0.55983305", "0.5589454", "0.5587...
0.0
-1
POST /docderivaciones POST /docderivaciones.json
def create @docderivacione = Docderivacione.new(docderivacione_params) respond_to do |format| if @docderivacione.save format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully created.' } format.json { render :show, status: :created, location: @docderivacione } else format.html { render :new } format.json { render json: @docderivacione.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def docderivacione_params\n params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado)\n end", "def index\n @docderivaciones = Docderivacione.all\n end", "def set_docderivacione\n @docderivacione = Docderivacione.find(params[:id])\n end", "def update\n...
[ "0.7072325", "0.6475485", "0.63414633", "0.61643094", "0.58071005", "0.5706033", "0.5676506", "0.56693447", "0.56190854", "0.5597035", "0.5562291", "0.5488476", "0.54817027", "0.5479422", "0.5451929", "0.54373866", "0.5420097", "0.5409644", "0.54018664", "0.5400603", "0.53773...
0.7329176
0
PATCH/PUT /docderivaciones/1 PATCH/PUT /docderivaciones/1.json
def update respond_to do |format| if @docderivacione.update(docderivacione_params) format.html { redirect_to @docderivacione, notice: 'Docderivacione was successfully updated.' } format.json { render :show, status: :ok, location: @docderivacione } else format.html { render :edit } format.json { render json: @docderivacione.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @doc.refused = false\n @doc.logs += \"Документ отредактирован #{DateTime.now}. <br> Документ повторно отправлен на подпись #{@doc.signer.name_with_initial}<br>\"\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully u...
[ "0.6633506", "0.64857626", "0.6472843", "0.6454058", "0.6446523", "0.642279", "0.6361423", "0.6348208", "0.62918496", "0.6282565", "0.62794197", "0.62763816", "0.6246639", "0.62454915", "0.6241526", "0.6237541", "0.62311083", "0.62249064", "0.6208386", "0.6154303", "0.6149894...
0.707577
0
DELETE /docderivaciones/1 DELETE /docderivaciones/1.json
def destroy @docderivacione.destroy respond_to do |format| format.html { redirect_to docderivaciones_url, notice: 'Docderivacione was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @doc.destroy\n respond_to do |format|\n format.html { redirect_to docs_url, notice: 'Документ был удалён' }\n format.json { head :no_content }\n end\n end", "def delete\n @client.delete_document(@path)\n end", "def destroy\n @ficha_doc.destroy\n respond_t...
[ "0.7239966", "0.71952367", "0.70715845", "0.7060022", "0.7048746", "0.7036805", "0.7006747", "0.7006268", "0.6970322", "0.69347113", "0.69215626", "0.6897966", "0.6861335", "0.6811945", "0.6811423", "0.67984647", "0.67976826", "0.67974615", "0.67974615", "0.67974615", "0.6797...
0.770392
0
Use callbacks to share common setup or constraints between actions.
def set_docderivacione @docderivacione = Docderivacione.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 docderivacione_params params.require(:docderivacione).permit(:camino_id, :descripcion, :docvalor, :presento, :estado) 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.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
before_save :ensure_authentication_token validates_format_of :email, :with => Configuration::EMAIL_CHECK Include default devise modules. Others available are: :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable Setup accessible (or protected) attributes for your model
def user_kind UserKind.find(user_kind_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_save_user\n self.encrypted_password.encode! 'utf-8'\n\n # If demo is enabled, demo user cannot change email or password nor be locked\n if Feedbunch::Application.config.demo_enabled\n demo_email = Feedbunch::Application.config.demo_email\n if email_changed? && self.email_was == demo_e...
[ "0.6453975", "0.6439959", "0.6416453", "0.6392954", "0.63522303", "0.6340321", "0.62730765", "0.6260867", "0.6226619", "0.621187", "0.61856496", "0.61786246", "0.6165335", "0.61544305", "0.6131984", "0.6122918", "0.611076", "0.6102844", "0.6083457", "0.6057489", "0.6046848", ...
0.0
-1
method to get the number of data values specified by the values of the domain object
def number_of_values Integer((@upper - @lower) / @step) + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count; @value.size; end", "def value_count\n values.count\n end", "def count\n @data.size\n end", "def count\n @valueset.length\n end", "def count(data)\n return data.length\n end", "def length\n @values.length\n end", "def count\n values.i...
[ "0.77504927", "0.75499654", "0.739095", "0.72951", "0.709219", "0.70900136", "0.70258766", "0.6947495", "0.693233", "0.6901595", "0.6877374", "0.6866073", "0.6854823", "0.68457043", "0.68240345", "0.68150157", "0.67930543", "0.67907363", "0.6783369", "0.67362374", "0.67362374...
0.0
-1
Exercise Example input_prices = [19,19,19,17,17,17] Set of prices where there is no apporiate time to buy. input_prices = [66,65,64,63,55,17,3,6,9,15,21,3,8,2,6,21,3,1,10] crazy array
def stock_picker (array) b = [] # Contains index of all valid max numbers palce_holder = [] valid_max = nil max_finder = 0 min = nil max = nil if array.length == 0 puts "No Data Available." return nil end if array.max == array[0] while array[max_finder] == (array[max_finder..array.length-1]).max if (array[max_finder..array.length-1]).max == array.min puts "An investment strategy could not be formulated based on the information supplied." return nil end max_finder += 1 end valid_max = array[max_finder..array.length-1].max else valid_max = array.max end #unless valid_max == array.min 0.upto(array.length-1) do |x| if array[x] == valid_max b << x end end max = b.last min = array.index(array[0..max].min) puts "#{[min,max]} for a profit of $#{array[max] - array[min]}" [min,max] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_picker(prices)\n combinations = prices.combination(2).to_a\n profits = combinations.map { |days| days[1] - days[0] }\n (0...prices.size).to_a.combination(2).to_a[profits.index(profits.max)]\nend", "def stock_picker(array)\n\n#store 2 numbered arrays that consist of every combination of numbers in th...
[ "0.6788952", "0.65283084", "0.650083", "0.64897037", "0.64808506", "0.64540464", "0.641136", "0.63882864", "0.6378258", "0.63720065", "0.63666344", "0.63421804", "0.6329192", "0.632665", "0.6311838", "0.6305009", "0.6283879", "0.6270574", "0.6264901", "0.62637025", "0.6260511...
0.5692081
83
Takes the urls from the enhancement, gets labels and types for them, and generates some html and RDF
def make_html_and_rdf(valscount) puts "Making RDF and html" types = {} labels = {} types_urls = {} puts "\nFound #{valscount.length} URLs" if (use_store()) require 'lib/four_store/store' store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/' valscount.each_key do |url| q = "SELECT distinct ?label ?type WHERE { <#{url}> <http://www.w3.org/2000/01/rdf-schema#label> ?label .}" q2 = "SELECT distinct ?label ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}" puts "Enhancing #{url}\n\n#{q}\n#{q2}\n" response = store.select(q) sleep 2 response2 = store.select(q2) sleep 2 # Get types response2.each do |r| ty = r["type"] types[url] = ty if(types_urls[ty]==nil) arr = Array.new arr.push(url) types_urls[ty]=arr else arr = types_urls[ty] arr.push(url) end end # Get labels response.each do |r| label = r["label"] labels[url] = label end end else valscount.each_key do |url| puts "valscount url is #{url}" #serivces are problematic in the url retrival case so we bypass them #genres can also be problematic # http://www.bbc.co.uk/programmes/genres/comedy/ if url.match("service") label = url.gsub(/\#.*/,"") label = label.gsub(/http:\/\/www\.bbc\.co\.uk\//,"") ty = "http://purl.org/ontology/po/Service" types[url]=ty labels[url]=label if(types_urls[ty]==nil) arr = Array.new arr.push(url) types_urls[ty]=arr else arr = types_urls[ty] arr.push(url) end elsif url.match("genres") label = url.gsub(/\#.*/,"") label = label.gsub(/http:\/\/www\.bbc\.co\.uk\/programmes\/genres\//,"") ty = "http://purl.org/ontology/po/Genre" types[url]=ty labels[url]=label if(types_urls[ty]==nil) arr = Array.new arr.push(url) types_urls[ty]=arr else arr = types_urls[ty] arr.push(url) end else uu = url.gsub(/\#.*$/,".rdf") m = ModelFactory.createDefaultModel() m.read(uu) q = "SELECT distinct ?label WHERE { <#{url}> <http://purl.org/dc/elements/1.1/title> ?label .}" q2 = "SELECT distinct ?type WHERE {<#{url}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type .}" qexec = QueryExecutionFactory.create(q, m) ; qexec2 = QueryExecutionFactory.create(q2, m) ; response = qexec.execSelect() response2 = qexec2.execSelect() # ResultSetFormatter.out(java.lang.System.out, response) # ResultSetFormatter.out(java.lang.System.out, response2) # Get types response2.each do |r| ty = r.get("type").to_s types[url] = ty if(types_urls[ty]==nil) arr = Array.new arr.push(url) types_urls[ty]=arr else arr = types_urls[ty] arr.push(url) end end # Get labels response.each do |r| label = r.get("label").to_s labels[url] = label end end end end # pp valscount # Make the html cc = 0 str = "<html><body>" types_urls.each_key do |t| str = str + "<h3>" + t + "</h3>\n<p>" u = types_urls[t] u.each do |uu| label = labels[uu] c = valscount[uu] cc = cc + c str = "#{str} <a href='#{uu}'>#{label}</a>: #{c} <br />\n" end str = str + "</p>\n" end str = str + "</body></html>" # Now the rdf topstr = "<rdf:RDF xmlns:owl=\"http://www.w3.org/2002/07/owl#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:foaf=\"http://xmlns.com/foaf/0.1/\" xmlns:wi=\"http://xmlns.notu.be/wi#\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\" xmlns:tl=\"http://perl.org/NET/c4dm/timeline.owl#\" xmlns:days=\"http://ontologi.es/days#\" xmlns:po=\"http://purl.org/ontology/po/\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" > <foaf:Person> " endstr = " </foaf:Person> <wi:Context rdf:about=\"#default\"> <wi:timePeriod> <days:DayInterval> <!-- i.e. every day, all day --> <tl:at rdf:datatype=\"http://www.w3.org/2001/XMLSchema#time\">00:00:00</tl:at> <tl:end rdf:datatype=\"http://www.w3.org/2001/XMLSchema#time\">23:59:59</tl:end> </days:DayInterval> </wi:timePeriod> </wi:Context> </rdf:RDF> " totalnums = cc.to_f str2 = topstr valscount.each_key do |u| t = types[u] label = labels[u] label.gsub!("&","and") c = valscount[u].to_f weight = c puts "weight is #{c} #{totalnums}" tmpl = " <wi:preference> <wi:WeightedInterest> <wi:topic rdf:resource=\"#{u}\" /> <rdf:type rdf:resource=\"#{t}\"/> <rdfs:label>#{label}</rdfs:label> <wi:weight>#{weight}</wi:weight> <wi:scale>0..#{cc}</wi:scale> <wi:reason>You watched #{weight} of a total of #{cc} items in topic #{label}</wi:reason> <wi:context rdf:resource=\"#default\" /> </wi:WeightedInterest> </wi:preference> " str2 = str2 + tmpl end str2 = str2 + endstr return str,str2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_url url, text\n if url =~ /^rdoc-label:([^:]*)(?::(.*))?/ then\n type = \"link\"\n elsif url =~ /([A-Za-z]+):(.*)/ then\n type = $1\n else\n type = \"http\"\n end\n\n if (type == \"http\" or type == \"https\" or type == \"link\") and\n url =~ /\\.(gif|png|jpg|jpeg|bmp)$/...
[ "0.59719193", "0.59663725", "0.5683812", "0.56199765", "0.55774945", "0.54888636", "0.54784566", "0.54565483", "0.5448286", "0.5396483", "0.53901935", "0.537453", "0.5353635", "0.5343655", "0.53160065", "0.53033465", "0.52974087", "0.52973413", "0.52867323", "0.52809066", "0....
0.6599654
0
This uses the programmes RDF to find interesting information about a programme Channel, category, Series / Brand (this also covers people) could also use the endpoint
def enhance_data(arr) puts "Enhancing data" valscount = {} #### if (use_store()) require 'lib/four_store/store' store = FourStore::Store.new 'http://dbtune.org/bbc/programmes/sparql/' arr.each do |pid| q = "SELECT ?vals WHERE {{<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/masterbrand> ?vals .} UNION {<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/category> ?vals . } UNION {<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/genre> ?vals . } UNION {?vals <http://purl.org/ontology/po/episode> <http://www.bbc.co.uk/programmes/#{pid}#programme> . }}" puts "Making query for #{pid}\n#{q}" response = store.select(q) response.each do |r| url = r["vals"] if(valscount[url]==nil) valscount[url]=1 else count = valscount[url] count = count+1 valscount[url]=count end end sleep 2 end else #not store arr.each do |pid| url = "http://www.bbc.co.uk/programmes/#{pid}.rdf" puts "pid url is #{url}" #occassionally we get a duff pid m = ModelFactory.createDefaultModel() begin m.read(url) q = "SELECT ?vals WHERE {{<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/masterbrand> ?vals .} UNION {<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/category> ?vals . } UNION {<http://www.bbc.co.uk/programmes/#{pid}#programme> <http://purl.org/ontology/po/genre> ?vals . } UNION {?vals <http://purl.org/ontology/po/episode> <http://www.bbc.co.uk/programmes/#{pid}#programme> . }}" puts "Making query for #{pid}\n#{q}" qexec = QueryExecutionFactory.create(q, m) ; response = qexec.execSelect() # ResultSetFormatter.out(java.lang.System.out, response) response.each do |r| url = r.get("vals").to_s puts "got result #{url}" if(valscount[url]==nil) valscount[url]=1 else count = valscount[url] count = count+1 valscount[url]=count end end rescue puts "duff url, continuing" end sleep 2 end end pp valscount #### return valscount end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extractData()\n\n @es_client = Elasticsearch::Client.new host: 'http://192.168.59.103:9200/', log: true\n gr = RDF::Vocabulary.new(\"http://purl.org/goodrelations/v1#\")\n s = RDF::Vocabulary.new(\"http://schema.org/address\")\n v = RDF::Vocabulary.new(\"http://www.w3.org/2006/vcard/ns#\")\n l =...
[ "0.60540897", "0.58985424", "0.5818628", "0.5775839", "0.56452876", "0.56423736", "0.56393725", "0.5596244", "0.5564488", "0.5506046", "0.5482427", "0.546571", "0.54532784", "0.5434789", "0.5406931", "0.54031247", "0.53856945", "0.53853494", "0.5355324", "0.5338014", "0.53362...
0.58116037
3
Get url (assumed to be json) and returns the parsed json
def get_json_url(url) useragent = "NotubeMiniCrawler/0.1" u = URI.parse url req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent}) begin res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) } end j = nil begin j = JSON.parse(res.body) rescue OpenURI::HTTPError=>e case e.to_s when /^404/ raise 'Not Found' when /^304/ raise 'No Info' end end return j end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend", "def json_get(url)\n get url, :parse=>true\n end", "def get_json(url)\n JSON.parse(get(url, :json, :json))\n end", "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query...
[ "0.8395543", "0.814876", "0.80368215", "0.7899679", "0.7781885", "0.7708647", "0.76706815", "0.76151866", "0.7569689", "0.7558275", "0.7536204", "0.751677", "0.7497337", "0.7491255", "0.7409972", "0.7403708", "0.7396908", "0.73769325", "0.7362471", "0.7347227", "0.7314235", ...
0.78328633
4
GET /search_terms/1 GET /search_terms/1.xml
def show @search_term = SearchTerm.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @search_term } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_terms(params)\n send_get \"get_terms\", params\n end", "def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end", "def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{...
[ "0.6574636", "0.6375503", "0.6367965", "0.6323818", "0.6308117", "0.62936616", "0.62091875", "0.62091875", "0.610542", "0.6101538", "0.6101538", "0.60521615", "0.6046374", "0.6009986", "0.599756", "0.5984967", "0.5963555", "0.5939905", "0.5915151", "0.59011525", "0.58886755",...
0.6267797
6
GET /search_terms/new GET /search_terms/new.xml
def new @search_term = SearchTerm.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @search_term } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", "def new\n @term = Term.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @term }\n end\n end", ...
[ "0.73089087", "0.73089087", "0.73089087", "0.7301739", "0.7143303", "0.69809717", "0.6979882", "0.69009393", "0.6839215", "0.68262756", "0.67831194", "0.6743191", "0.67383206", "0.6631693", "0.6629398", "0.6629212", "0.6597764", "0.65628123", "0.6554148", "0.65103936", "0.649...
0.7513866
0
POST /search_terms POST /search_terms.xml
def create params[:search_term][:name] = params[:search_term][:new_name].strip params[:search_term].delete :new_name @search_term = SearchTerm.new(params[:search_term]) respond_to do |format| if @search_term.save format.html { redirect_to(search_terms_path, :notice => 'SearchTerm was successfully created.') } format.xml { render :xml => @search_term, :status => :created, :location => @search_term } else format.html { render :action => "new" } format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_terms(params)\n send_get \"add_terms\", params\n end", "def terms_post(opts = {})\n data, _status_code, _headers = terms_post_with_http_info(opts)\n data\n end", "def search_params\n params.permit(:search_terms)\n end", "def search_terms=(value)\n @sear...
[ "0.65566725", "0.63603777", "0.63334906", "0.63238597", "0.6291281", "0.61020565", "0.6014546", "0.5922155", "0.5909578", "0.58918905", "0.58918905", "0.5858409", "0.5766691", "0.5738655", "0.5663866", "0.56549513", "0.56113076", "0.5610413", "0.56029993", "0.55888176", "0.55...
0.62503314
5
PUT /search_terms/1 PUT /search_terms/1.xml
def update @search_term = SearchTerm.find(params[:id]) respond_to do |format| if @search_term.update_attributes(params[:search_term]) format.html { redirect_to(@search_term, :notice => 'SearchTerm was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @search_term.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n\n respond_to do |format|\n if @seo_search_term.update_attributes(params[:seo_search_term])\n flash[:notice] = 'Seo::SearchTerm was successfully updated.'\n format.html { redirect_to seo_search_terms_path }\n format....
[ "0.63365084", "0.6113838", "0.6043445", "0.5992252", "0.5980859", "0.5970105", "0.5969134", "0.587131", "0.58451706", "0.58374506", "0.57851374", "0.5755232", "0.5734693", "0.5720603", "0.5666318", "0.5601305", "0.55901706", "0.5560446", "0.5553743", "0.5534108", "0.55134183"...
0.5994832
3
DELETE /search_terms/1 DELETE /search_terms/1.xml
def destroy @search_term = SearchTerm.find(params[:id]) @search_term.destroy respond_to do |format| format.html { redirect_to(search_terms_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @seo_search_term = Seo::SearchTerm.find(params[:id])\n @seo_search_term.destroy\n\n flash[:notice] = 'Seo::SearchTerm was successfully destroyed.'\n respond_to do |format|\n format.html { redirect_to(seo_search_terms_url) }\n format.xml { head :ok }\n end\n end", "def des...
[ "0.68005186", "0.66285855", "0.66285855", "0.65842533", "0.6573328", "0.64561653", "0.6427755", "0.6420135", "0.6385023", "0.6385023", "0.6372914", "0.63645303", "0.6353844", "0.6336281", "0.63288444", "0.6311669", "0.62850726", "0.628109", "0.6264655", "0.6259841", "0.624909...
0.7074731
0
making this a named Proc greatly increases overhead why??
def test_string_size ary = [] (1..10000000).each do |i| i.to_s.size if i.odd? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_proc()\n #This is a stub, used for indexing\n end", "def proc\n if block_given?\n super\n else\n NamedProc::Proxy::Proc\n end\n end", "def to_proc() end", "def to_proc() end", "def to_proc() self ; end", "def proc\n return $PROC\n end", "def fr...
[ "0.6855848", "0.6758657", "0.6729047", "0.6729047", "0.6636546", "0.65417796", "0.6481292", "0.64400357", "0.63636404", "0.63330483", "0.6301346", "0.6251738", "0.6247141", "0.6219427", "0.6218368", "0.6204301", "0.6181915", "0.6140355", "0.613529", "0.61195683", "0.61155576"...
0.0
-1
Overwrite this method in subclasses to return the result value of this evaluation context.
def evaluation_result raise NoMethodError, "override me in sub-classes" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluation_result\n return @evaluation_result\n end", "def value\n @value || __eval\n end", "def result\n @result ||= calculate_result\n end", "def to_expr\n return self.return_value\n end", "def evaluation_result=(value)\n @eva...
[ "0.7553132", "0.6969988", "0.6875267", "0.67620724", "0.671921", "0.67026365", "0.66520625", "0.65721554", "0.65540594", "0.6550486", "0.6474332", "0.646867", "0.64310485", "0.6409766", "0.6396446", "0.63723046", "0.6367275", "0.6362992", "0.6360221", "0.6339122", "0.63364756...
0.7622572
0
Extra Credit Try writing a few of your own functions and have them return some values. You can return anything that you can put to the right of an =.
def Add_mult (a,b,c) puts "REMEBER RIGHT TO LEFT!!, this multiples #{c} and #{b} and then adds #{a}" a + (b * c) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_something\n x = 100\n y = 101\n z = 110\nend", "def return_a_value\n \"Nice\"\nend", "def metodo_con_return\n return 2 + 5\nend", "def plus(x, y)\n z = x + y\n return z\nend", "def method_and_value; end", "def return_guess\n# puts \"What will be the return value here?\"\n\nen...
[ "0.6628795", "0.64531004", "0.6342673", "0.6189537", "0.60703874", "0.606514", "0.60595864", "0.6055378", "0.6016425", "0.60072124", "0.60071677", "0.5995293", "0.5990686", "0.5975642", "0.59693676", "0.595011", "0.5943823", "0.5917932", "0.5912468", "0.59107715", "0.5907008"...
0.0
-1
def user_username=(username) if username != nil self.user = User.find_by(username: username) end end
def user_username if self.user != nil self.user.username end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user\n @User = User.find_by_username(params[:username])\n end", "def set_user\n @user = User.find(username: params[:username])\n end", "def username= username\n\t\t\tcheck_username username\n\t\t\t@username = username\n\t\tend", "def set_user\n @user = User.find_by(\"username = ?\", pa...
[ "0.8444221", "0.8411429", "0.84073454", "0.8396008", "0.83611816", "0.830984", "0.82962525", "0.82962525", "0.8292394", "0.82283586", "0.8216151", "0.8213223", "0.8186529", "0.80877125", "0.79969746", "0.7985642", "0.79478276", "0.7946476", "0.7933914", "0.7908043", "0.785554...
0.0
-1
displays the page of current user or the user being viewed
def show @currentUser= User.find_by_id(session[:remember_token]) @dreamlist = Dream.all @likeList = Like.all @requestlist = Array.new @requestlist = Request.find_all_by_target_id(@currentUser.id) @user = User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n if(current_user)\n render 'layouts/loggedin'\n else\n render \"layouts/guest\"\n end\n end", "def index\n if current_user\n render_home_page\n else\n render_welcome_page\n end\n end", "def show\n redirect_to(default_url) unless logged_in? ||...
[ "0.75281733", "0.727853", "0.7238252", "0.7199717", "0.71333027", "0.7075708", "0.7044425", "0.6983534", "0.6952598", "0.6943665", "0.69023", "0.689972", "0.68532753", "0.6814814", "0.6782111", "0.6758511", "0.6751849", "0.6748803", "0.6732889", "0.6729591", "0.6721392", "0...
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render :json => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ...
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0...
0.0
-1
validates parameters of a new signup form and stores the user in the table a user must have a name, email, password and optionally a picture
def create @user = User.new(params[:user]) if not_sensitive(params[:user][:name]) #1 if - start if verify_recaptcha(request.remote_ip, params)[:status] == 'false' #2 if - start @notice = "captcha incorrect" respond_to do |format| format.html { render :action => "new" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end else #2 if - else: captcha right, go on if @user.save! #3 if -start @pic = Pic.new(:user_id => @user.id, :url => "../images/default.gif" ) @pic.save! redirect_to :controller => 'sessions', :action => 'new' else #3 if - else: user is not saved in the db for some reason, explore why if User.find_by_email(@user.email) != nil flash.now[:error1]= "*User email already exists." end if @user.name == nil or @user.email == nil or @user.password == nil or @user.password_confirmation == nil flash.now[:error2]= "*Info not correct! Make sure you your filled up all the info." end if @user.password_confirmation != @user.password flash.now[:error3]= "*Password and confirmation don't match." end if @user.check == 0 flash.now[:error3]= "*You need to agree to the Website's policies to register." end render'new' end #3 end end #2 end else #1 else flash.now[:error3]= "*Please don't use names that could cause confusion :P sorry." render'new' end #1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new(params.require(:user).permit(:first_name,:last_name,:email,:password,:password_confirmation,:profile_pic))\n if @user.save\n redirect_to '/mainpage'\n else\n redirect_to '/signup' \n end\n end", "def signup(params)\n begi...
[ "0.74499196", "0.7374185", "0.73502374", "0.7298143", "0.72451013", "0.7201371", "0.71904814", "0.71831906", "0.7175687", "0.71575797", "0.71575797", "0.7155236", "0.715271", "0.7117982", "0.7088857", "0.7086601", "0.70855665", "0.7070454", "0.7029328", "0.70188516", "0.70119...
0.0
-1
action end filters usernames that should be used in a username
def not_sensitive(myString) if ["Admin","admin","Administrator","ADMIN","ADMINISTRATOR"].include? myString false else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_with_filter\n\t\treturn @unf\n\tend", "def check_username\n @user=User.where('username=?',params[:username])\n @user=[] if user_signed_in? && @user && @user.first==current_user # this means they are editing their username and its themselves, that is ok\n end", "def search_by_username(searc...
[ "0.7411617", "0.6860443", "0.6765954", "0.67236686", "0.66645545", "0.66540366", "0.66232586", "0.65374655", "0.65186363", "0.6513202", "0.6488171", "0.64869845", "0.64705473", "0.6470224", "0.6466029", "0.6462796", "0.6454437", "0.64347446", "0.6400982", "0.638115", "0.63742...
0.0
-1
fires a request to the server to change password
def change_password @user = User.find_by_id(session[:remember_token]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_password(username, password)\n perform_request({:action => \"client-updatepassword\", :username => username, :password => password})\n statusmsg.match /success/i\n end", "def change_password\r\n \r\n end", "def change_password(username, new_password)\n perform_request({:action ...
[ "0.78023684", "0.7743745", "0.7643223", "0.7634875", "0.7544805", "0.73943174", "0.72121555", "0.71316266", "0.7126693", "0.71133095", "0.7048918", "0.7007678", "0.6962668", "0.6962668", "0.6962668", "0.69566095", "0.69213647", "0.6886813", "0.6886473", "0.6879206", "0.687609...
0.0
-1
Updates user info based on input (scaffolding)
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, :notice => 'User was successfully updated.' } format.json { head :ok } else format.html { render :action => "edit" } format.json { render :json => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n clear_screen\n puts \"Please enter a new username\".colorize(:yellow)\n user_input = gets.chomp.downcase\n #binding.pry\n self.user.update(name: user_input)\n # user.name = new_name\n puts \"Your new username is #{user_input}\".colorize(:green)\n puts \"Enter any key to return back to ...
[ "0.7229527", "0.6956531", "0.69048595", "0.6856542", "0.65341365", "0.6497263", "0.6437425", "0.63885206", "0.638058", "0.63600695", "0.6330888", "0.6285693", "0.6279032", "0.6246253", "0.6235097", "0.6206364", "0.6204562", "0.6188513", "0.6184168", "0.61820275", "0.61696464"...
0.0
-1
DELETE /users/1 DELETE /users/1.json deletes a user, by first deleting data (dreams, comments etc.) associated with the user
def destroy @user = User.find(params[:id]) if !@user.dreams.nil? @user.dreams.each do |d| d.destroy end end if !@user.friends.nil? @user.friends.each do |f| f.destroy end end if !@user.requests.nil? @user.requests.each do |r| r.destroy end end if !Request.find_all_by_target_id(@user.id).nil? Request.find_all_by_target_id(@user.id).each do |t| t.destroy end end @user.comments.all.each do |c| c.destroy end @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n ...
[ "0.7878458", "0.7515236", "0.75021076", "0.74629927", "0.74484795", "0.7419005", "0.7388561", "0.73814195", "0.73557687", "0.7346719", "0.7339103", "0.73115444", "0.72999364", "0.7292922", "0.72923154", "0.7290053", "0.7287718", "0.7287718", "0.72800785", "0.7250926", "0.7250...
0.72968185
13
adds a pic to the user's profile
def addpic @user = User.find_by_id(session[:remember_token]) @photo = params[:user][:pic] if @user.pic != @photo @user.update_attributes(:pic => @photo) render 'home/loggedin' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end", "def update\n current_user.update(user_params_with_profile_picture)\n\n expose current_user\n end", "def attachprofilepicture\n current_use...
[ "0.7656146", "0.7345806", "0.73139536", "0.7227781", "0.7208167", "0.7203044", "0.72013706", "0.71973735", "0.71411794", "0.7132607", "0.70486164", "0.7016035", "0.70130724", "0.6984113", "0.69822097", "0.6934895", "0.69249046", "0.6870301", "0.6854374", "0.6844526", "0.68184...
0.76705986
0
Optimizations can be: :mobile_number => associated to the message, so that it does not need to be read when completing missing fields
def infer_custom_attributes(optimizations = {}) address = self.kind_of?(AoMessage) ? to : from return unless address.try(:protocol) == 'sms' number = address.mobile_number # Infer country from phone number unless self.country countries = Country.all.select{|x| number.start_with? x.phone_prefix} if countries.length > 0 # Slipt countries with and without area codes with_area_codes, without_area_codes = countries.partition{|x| x.area_codes.present?} # From those with area codes, select only the ones for which the number start with them with_area_codes = with_area_codes.select{|x| x.area_codes.split(',').any?{|y| number.start_with?(x.phone_prefix + y.strip)}} # If we find matches with area codes, use them. Otherwise, use those without area codes countries = with_area_codes.present? ? with_area_codes : without_area_codes if countries.length == 1 ThreadLocalLogger << "Country #{countries[0].name} (#{countries[0].iso2}) was inferred from prefix" self.country = countries[0].iso2 else self.country = countries.map do |c| ThreadLocalLogger << "Country #{c.name} (#{c.iso2}) was inferred from prefix" c.iso2 end end end end # Infer carrier from phone number (if country is present) if self.country and not self.carrier countries = self.country countries = [countries] unless countries.kind_of? Array countries = countries.map{|x| Country.find_by_iso2_or_iso3 x} carriers = [] countries.each do |c| next unless c cs = Carrier.find_by_country_id c.id cs.each do |carrier| next unless carrier.prefixes.present? prefixes = carrier.prefixes.split ',' if prefixes.any?{|p| number.start_with?(c.phone_prefix + p.strip)} ThreadLocalLogger << "Carrier #{carrier.name} was inferred from prefix" carriers << carrier end end end self.carrier = carriers.length == 1 ? carriers[0].guid : carriers.map(&:guid) unless carriers.empty? end # Infer country and carrier from stored MobileNumber, if any mob = optimizations[:mobile_number] || (MobileNumber.find_by_number number) mob.complete_missing_fields self if mob end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sms_number_attribute(sms_number)\n # Sometimes Telerivet will return SMS numbers without a \"+\". When we figure\n # out why, remove this workaround.\n if sms_number[0] != '+'\n sms_number = \"+#{sms_number}\"\n end\n\n @sms_number_attribute_cache ||= {}\n @sms_number_attribute_cache[sms...
[ "0.604683", "0.5911435", "0.58908224", "0.57916653", "0.57662237", "0.5667378", "0.56544393", "0.5648933", "0.55333394", "0.55319816", "0.55071", "0.5497148", "0.5490483", "0.5425102", "0.5425102", "0.53891736", "0.53792125", "0.5366751", "0.53635323", "0.53623897", "0.534114...
0.6365193
0
Detects whether DynamicPULSE Agent can attach
def detect dynamicpulse_remote_xml = File.join(@app_dir, 'WEB-INF/dynamicpulse-remote.xml') if File.exist?(dynamicpulse_remote_xml) doc = REXML::Document.new(open(dynamicpulse_remote_xml)) @url = doc.elements['dynamicpulse-remote/centerUrl'].text @system_id = doc.elements['dynamicpulse-remote/systemId'].text @logger.debug("url=#{@url}") @logger.debug("system_id=#{@system_id}") return 'DynamicPULSE-3.+' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agent?\n true\n end", "def agent?\n false\n end", "def free_agent?\n type == \"free_agent\"\n end", "def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end", "def attached?\n\t\tCommon.device_status(@handle)...
[ "0.6566977", "0.6432048", "0.6125815", "0.6015897", "0.5879132", "0.5862358", "0.58021617", "0.5801306", "0.57894063", "0.5718899", "0.56837744", "0.5639697", "0.5635936", "0.55782056", "0.5576682", "0.55494636", "0.55494636", "0.5440355", "0.54350835", "0.54216427", "0.54096...
0.0
-1
Downloads and places the DynamicPULSE JARs
def compile if @url.nil? || @system_id.nil? raise "url #{@url}, or systemId #{@system_id} is not available, detect needs to be invoked" end dp_home = File.join(@app_dir, '.dynamic_pulse_agent') FileUtils.mkdir_p(dp_home) download_and_unzip(@url, @system_id, 'dynamicpulse-agent.zip', dp_home) FileUtils.mv(File.join(dp_home, 'dynamicpulse.jar'), @lib_directory) FrameworkUtils.link_libs([@app_dir], @lib_directory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n #python executable files\n end", "def tailor_package_to_platform\n @package.app('Dropbox')\n @package.volumes_dir('Dropbox Installer')\n @package.source(URI.encode(\"file://#{download_dest}\"))\n end", "def install\n libexec.install \"phyutility.jar\"\n ...
[ "0.5832175", "0.57193285", "0.5714784", "0.5633345", "0.5625683", "0.5536673", "0.5443501", "0.5388589", "0.5387417", "0.5326837", "0.5325343", "0.5315711", "0.5313322", "0.5282778", "0.52585924", "0.5248945", "0.5240402", "0.52303493", "0.52268946", "0.5222545", "0.52156854"...
0.6323254
0
Append VM options to java_opts
def release @java_opts << '-javaagent:/home/vcap/app/.dynamic_pulse_agent/aspectjweaver.jar' @java_opts << '-Dorg.aspectj.tracing.factory=default' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorate_java_opts(java_opts)\n java_opts\n end", "def java_args=(args)\n Buildr.application.deprecated \"Use ENV['JAVA_OPTS'] instead\"\n ENV['JAVA_OPTS'] = Array(args).join(' ')\n end", "def jvm_options(arg = nil)\n set_or_return(:jvm_options, arg, kind_of: String)\n end", ...
[ "0.75858617", "0.69976497", "0.69608134", "0.67900294", "0.6231088", "0.59903437", "0.57705724", "0.57705724", "0.56569254", "0.56348896", "0.5618846", "0.55961907", "0.55826974", "0.5519571", "0.5482722", "0.5439303", "0.5412641", "0.53961307", "0.5395842", "0.536357", "0.53...
0.5743371
8
Downloads ZIP file from specified url
def download_and_unzip(base_url, system_id, filename, save_to_dir) download_url = File.join(base_url, system_id, filename) LibertyBuildpack::Util.download_zip('3.+', download_url, 'DynamicPULSE Agent', save_to_dir) rescue => e raise "[DynamicPULSE] Can't download #{filename} from #{download_url}. Please check dynamicpulse-remote.xml. #{e.message}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(url)\n base.get(url, @file_path)\n end", "def download\n open(download_url, \"rb\")\n end", "def download(url)\n Net::HTTP.get_response(url)\n end", "def download!(source_url, destination_file); end", "def download_file(url)\n\t\t\tf = Tempfile.new(File.basename(url))\n...
[ "0.7571589", "0.74389625", "0.731503", "0.7263454", "0.71225715", "0.7115583", "0.7067918", "0.7065795", "0.70417625", "0.70291936", "0.7015135", "0.69531184", "0.69345987", "0.69157714", "0.6902937", "0.68869", "0.68745154", "0.6872318", "0.68510014", "0.6792038", "0.6758725...
0.6893747
15
view_file :: symbol > string
def view_file(type) if (type == :html) "#{DirMap.html_views}/fields/image.html.erb" else "#{DirMap.html_views}/fields/image.html.erb" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_string_from_view(view_file)\n end", "def render_string_from_view(view_file)\n end", "def current_file\n @view[@cursor]\nend", "def view_file(type)\n if (type == :html)\n \"#{DirMap.html_views}/entries/cv.html.erb\"\n else\n \"#{DirMap.html_views}/entries/cv.html.erb\"\n e...
[ "0.7521457", "0.7521457", "0.6807137", "0.67920536", "0.67034245", "0.67034245", "0.66717064", "0.6573521", "0.65572613", "0.65494925", "0.64311475", "0.6403776", "0.64000905", "0.6382687", "0.63780075", "0.636775", "0.6365856", "0.63655585", "0.63294274", "0.6324249", "0.632...
0.6374109
15
Create a replication request
def create_replication(request, &block) post "/replicate/", request, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_replication_request request_pb\n query_string_params = if query_string_param...
[ "0.77556616", "0.6345245", "0.61897504", "0.6185618", "0.6121208", "0.59140223", "0.5831481", "0.5817684", "0.5785764", "0.5746391", "0.5610842", "0.56090087", "0.56039417", "0.5579938", "0.5559646", "0.55029815", "0.55015385", "0.5482988", "0.5482678", "0.5471468", "0.542942...
0.8101763
0
Update a replication request
def update_replication(request, &block) put "/replicate/#{request[:replication_id]}/", request, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_replication_request request_pb\n query_string_params = if query_string_param...
[ "0.7440423", "0.7303998", "0.66813946", "0.66813946", "0.66813946", "0.66813946", "0.66558594", "0.65778977", "0.65778977", "0.65778977", "0.65778977", "0.6329283", "0.6260008", "0.6260008", "0.6166248", "0.6166248", "0.6092129", "0.6085541", "0.6068225", "0.6068225", "0.6033...
0.825009
0
This method is being called on 'NameOwnerChanged', which helps us stop the app when Skype stops (a reconnect is needed after Skype restarts).
def name_owner_changed(msg) raise "Skype has stopped running." if msg.params.first == "com.Skype.API" and msg.params[1].to_s.match(/^:\d\.\d+$/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_disconnect\n # Let others know that the user left\n broadcast :_send_message, {event: :chat, from: '', at: Time.now, message: \"#{params[:name]} left the chatroom.\"}.to_json if params[:name]\n end", "def disconnect!\n app.speakers.ID(@id).disconnect_from\n connected?\n end", "def st...
[ "0.5930037", "0.5813527", "0.52246225", "0.51997715", "0.5192085", "0.51686966", "0.5165151", "0.51442504", "0.51423913", "0.5141903", "0.51403093", "0.5075189", "0.4965968", "0.49373475", "0.49194047", "0.49001288", "0.4898153", "0.48843244", "0.48813084", "0.48813084", "0.4...
0.72943395
0
This method is called, when the GnomeScreensaver locks or unlocks.
def gnome_screensaver_status(msg) val = msg.params.first if val == true puts "Detected screenlock by Gnome Screensaver - logging out of Skype." self.skype_status_offline else puts "Detected screenlock unlock by Gnome Screensaver - going online on Skype." self.skype_status_online end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onScreenLocked\n Util.log.debug 'Screen locked'\n Info.locked = true\n Info.start_time = NSDate.date unless Info.start_time\n Util.send_pushover('Locked')\n end", "def onScreenUnlocked\n Util.log.debug 'Screen unlocked'\n Info.locked = false\n self.displayDiff\n end", "def lock_scree...
[ "0.7572191", "0.7189657", "0.670182", "0.6492404", "0.58944213", "0.55779976", "0.5543611", "0.5527484", "0.5501582", "0.5501582", "0.5486032", "0.54489285", "0.5406625", "0.53914165", "0.53221726", "0.5274225", "0.52736765", "0.52697337", "0.5268061", "0.5245089", "0.5206389...
0.642254
4
This listens for the connected events and blocks the thread calling it.
def listen main = DBus::Main.new main << @bus main.run nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_connected(&block)\n @on_connected_procs << block\n end", "def listen\n Thread.new do\n while true\n retrieve_messages\n sleep (0.1)\n end\n end\n end", "def listen\n loop do\n self.listen_loop\n \n #Break out if...
[ "0.63488406", "0.63252324", "0.6272153", "0.61944103", "0.6144928", "0.60300845", "0.60275453", "0.60125875", "0.5902169", "0.5889862", "0.5889367", "0.5886719", "0.58764803", "0.5833371", "0.58282495", "0.58163905", "0.5800977", "0.5771189", "0.5754785", "0.5752643", "0.5742...
0.0
-1
Tells Skype to go offline.
def skype_status_offline ret = @skype_obj.Invoke("SET USERSTATUS OFFLINE").first raise "Couldnt go offline: '#{ret}'." if ret != "USERSTATUS OFFLINE" nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offline()\n set_status(\"OFFLINE\")\n end", "def skype_status_online\n ret = @skype_obj.Invoke(\"SET USERSTATUS ONLINE\").first\n raise \"Couldnt go online: '#{ret}'.\" if ret != \"USERSTATUS ONLINE\"\n nil\n end", "def offline\n end", "def offline?\n status == :offline...
[ "0.66431695", "0.64580077", "0.6376998", "0.61214316", "0.5895095", "0.5845045", "0.58369833", "0.5835884", "0.5806407", "0.57812124", "0.57335633", "0.5690763", "0.56801784", "0.5656047", "0.56333905", "0.556071", "0.55389917", "0.5513177", "0.5504552", "0.54677373", "0.5443...
0.75717777
0
Tells skype to go online.
def skype_status_online ret = @skype_obj.Invoke("SET USERSTATUS ONLINE").first raise "Couldnt go online: '#{ret}'." if ret != "USERSTATUS ONLINE" nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skype_status_offline\n ret = @skype_obj.Invoke(\"SET USERSTATUS OFFLINE\").first\n raise \"Couldnt go offline: '#{ret}'.\" if ret != \"USERSTATUS OFFLINE\"\n nil\n end", "def online_friends\n Skype.find_users_of_type \"ONLINE_FRIENDS\"\n end", "def on_online(m, user)\n user.send \"...
[ "0.6325465", "0.63063765", "0.61073524", "0.5774053", "0.5738971", "0.5688078", "0.5627564", "0.5548597", "0.55452466", "0.5535574", "0.5525581", "0.5522469", "0.5512164", "0.5508814", "0.55005", "0.54268765", "0.54020166", "0.53914374", "0.5383166", "0.53728586", "0.5348382"...
0.719727
0
allows addition of new planets via user input
def initialize @planets = [gallifrey, xander] # initialize hard coded planets #@planets.push(@new_planet) # adds new planets via user input to planets array @number_planets = @planets.length #counts planets by counting array elements @formation_year = rand(-3000000..2015) @age_of_system = 2015 - @formation_year end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_planet\n\t\tputs \"Would you like to add a planet? Enter Y/N\".colorize(:blue)\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"y\"\n\t\t\tputs \"Great! Please enter the name of planet.\"\n\t\t\tname = gets.chomp\n\t\t\tputs \"Now enter the diameter of your planet.\"\n\t\t\tdiameter = gets.chomp\n\t\t...
[ "0.77926093", "0.7662715", "0.7625709", "0.7587153", "0.75847554", "0.75192356", "0.7412618", "0.73809373", "0.7355027", "0.731311", "0.731311", "0.731311", "0.731311", "0.72560114", "0.7239589", "0.717869", "0.70506656", "0.6970573", "0.6950583", "0.6935959", "0.6913078", ...
0.56150377
96
optional user input section, can be expanded to condiational loops for all planet info
def add_planet puts "Would you like to add a planet? Enter Y/N".colorize(:blue) answer = gets.chomp.downcase if answer == "y" puts "Great! Please enter the name of planet." name = gets.chomp puts "Now enter the diameter of your planet." diameter = gets.chomp puts "What is the mass of your new planet?" mass = gets.chomp puts "How many moons?" moons = gets.chomp puts "Is there life on your planet? Please enter \"Y\" or \"N\"." life = gets.chomp.downcase if life == "y" life = true else life = false end puts "Finally, what is the solar rotation of your planet?" rotation = gets.chomp @new_planet = Planet.new(name: name, diameter: diameter, mass: mass, moons: moons, life: life, rotation: rotation) @planets.push(new_planet) puts "Great! #{name} is born!".colorize(:blue) else puts "Fine. I didn't want your planets anyway.".colorize(:blue) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_planet\n puts \"Hello! What planet do you want to learn about?\"\n puts \"Select 1:Mercury, 2:Venus, 3:Earth, 4:Mars, 5:Jupiter, 6: Saturn, 7:Uranus, 8:Neptune, 9:Pluto, 10:Exit\"\n while user_input = gets.chomp.downcase\n if user_input == \"1\"\n puts \"Mercury, Mass: 0.330 e24 kg,...
[ "0.7300773", "0.72111565", "0.7177272", "0.70079106", "0.70054543", "0.68816864", "0.680891", "0.678106", "0.67653525", "0.6682004", "0.6666443", "0.6663065", "0.66600007", "0.6611106", "0.6598263", "0.6597968", "0.6555879", "0.65370893", "0.649104", "0.64682066", "0.6443618"...
0.5711827
61
Return an error message if the name is invalid. Return nil if name is valid.
def error_for_list_name(name) if !(1..100).cover? name.size "The list name must be between 1 and 100 characters." elsif session[:lists].any? { |list| list[:name] == name } "The list name already exists. list name must be unique." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_invalid\n errors.add(:name, :unknown)\n end", "def name_is_valid\n errors.add(:name,\"Invalid string for name.\") unless name_is_valid?\n end", "def valid_name!\n return unless @name.blank?\n\n @success = false\n @error = 'Error: site name must be present'\n end", "def name...
[ "0.79094726", "0.7621115", "0.74599296", "0.7410516", "0.72915965", "0.72062385", "0.7199446", "0.7144117", "0.70809036", "0.70197594", "0.70103854", "0.69986826", "0.6928774", "0.688518", "0.6864018", "0.6820561", "0.67747974", "0.669889", "0.669889", "0.6663252", "0.6654922...
0.5932944
73
include all helpers, all the time See ActionController::RequestForgeryProtection for details Uncomment the :secret if you're not using the cookie session store protect_from_forgery :secret => '5573f03012baec0f2fa0d045e67711db' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password
def admin_required if cookies[:admin_token] @admin = Administrator.find :first, :conditions => {:token => cookies[:admin_token].to_s} unless @admin redirect_to :controller => 'login' and return end else redirect_to :controller => 'login' and return end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protect_from_forgery\n end", "def protect_against_forgery?; end", "def token_secret; end", "def token_secret; end", "def token_secret; end", "def csrf_secret\n key = session[csrf_options[:key]] ||= SecureRandom.base64(32)\n Base64.strict_decode64(key)\n end", "def client_s...
[ "0.65121925", "0.64344543", "0.6155684", "0.6155684", "0.6155684", "0.61281526", "0.61204755", "0.6103816", "0.6096282", "0.6093415", "0.6076882", "0.60258645", "0.6017564", "0.60139734", "0.59962493", "0.5923889", "0.590281", "0.583732", "0.583732", "0.583732", "0.583732", ...
0.0
-1
the empty queue will be represented by an empty array katz_deli = [] build the line method showing everyone their current place in line if nobody is in line puts "The line is currently empty."
def line(katz_deli) if katz_deli.length == 0 puts "The line is currently empty." else current_line = [] katz_deli.each.with_index(1) do |name,index| current_line << "#{index}. #{name}" end puts "The line is currently: #{current_line.join(" ")}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(katz_deli)\n current_position = []# current position is to show the line is empty.\n if katz_deli.empty?# if the line is currently empty\n puts \"The line is currently empty.\"#print the phrase\n else\n !katz_deli.empty?# If the line is not empty. this line is not required in the code but helps m...
[ "0.73385406", "0.7319243", "0.7079681", "0.70733166", "0.7047779", "0.6982036", "0.69818467", "0.69634646", "0.69307137", "0.69243515", "0.69175434", "0.6915717", "0.68882", "0.6868713", "0.6867419", "0.68508756", "0.6806643", "0.6786489", "0.678612", "0.6775239", "0.6761315"...
0.7315305
2
build the take_a_number method for new customers entering the deli the take_a_number methods takes two arguments new costumer will use whenentering the deli array for current people in line (katz_deli) and a string containingthe name of the person joining the end of the line
def take_a_number(katz_deli, name) #the take_a_number method should puts the person's name along with their postion in line --use .push(element) to add a person's name to the line katz_deli.push(name) puts "Welcome, #{name}. You are number #{katz_deli.length} in line." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_a_number(katz_deli, name) # Takes deli line and a new customer name as input.\n katz_deli.push(name) # Add new customer to deli line.\n puts \"Welcome, #{name}. You are number #{katz_deli.size} in line.\" # Returns the required string.\nend", "def take_a_number(katz_deli, customer)\n katz_deli.push...
[ "0.78277344", "0.76995254", "0.7348603", "0.69303256", "0.69198495", "0.6896787", "0.6736563", "0.67131376", "0.6689049", "0.66882133", "0.66882133", "0.66144294", "0.66144294", "0.6606437", "0.6602855", "0.6578228", "0.65700084", "0.65516794", "0.653228", "0.6458751", "0.644...
0.6850672
6
Iteriate through the array to see if the index_target is in it If it is in it print the index number for the number in the array If not print nill
def search(array, index_target) index = 0 while index < array.length if array[index] == index_target return index else nil end index += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slow_dance(target, array)\n\n array.each.with_index do |phrase, i|\n return i if array[i] == target \n end \n end", "def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend", "def search_array2(ary, target)\n i = 0\n match ...
[ "0.6865924", "0.6762055", "0.6740984", "0.6730617", "0.6705163", "0.64897907", "0.6388038", "0.6355746", "0.63256085", "0.63026637", "0.63014174", "0.62558657", "0.6234249", "0.6189509", "0.61868083", "0.6184662", "0.617837", "0.6175081", "0.6173761", "0.6172494", "0.61543906...
0.663969
5
Method that takes a number If number is 1 or 0 number is equal to 1 Using that number 1 and number 2 those being the two numbers for the number add those together Add together using method Put results in an array
def the_fib(number) fib_array = Array.new if number == 0 return fib_array = [] elsif number == 1 return fib_array = [0] elsif number == 2 return fib_array = [0, 1] else fib_array = [0, 1] end while fib_array.length < number fib_array[fib_array.length] = fib_array[-1] + fib_array[-2] end return fib_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_binary(a,b)\r\n sum = a + b\r\n arr = []\r\n if sum == 1\r\n p \"1\"\r\n else #if sum != 1\r\n arr.push(sum % 2) \r\n while sum / 2 != 0\r\n sum = sum / 2\r\n arr.push(sum % 2)\r\n end\r\n p arr.revers...
[ "0.65721047", "0.638382", "0.6352161", "0.6332787", "0.6292354", "0.6289748", "0.62592745", "0.6249493", "0.6236138", "0.62356275", "0.62122947", "0.621155", "0.6196082", "0.6183608", "0.617591", "0.6169475", "0.6161633", "0.6148501", "0.61147755", "0.6111805", "0.6095814", ...
0.0
-1
Initializes a new CloudLB::ConnectionThrottle object
def initialize(load_balancer) @connection = load_balancer.connection @load_balancer = load_balancer @lbmgmthost = @connection.lbmgmthost @lbmgmtpath = @connection.lbmgmtpath @lbmgmtport = @connection.lbmgmtport @lbmgmtscheme = @connection.lbmgmtscheme populate return self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(params={})\n @throttle = params[:throttle] || 1\n end", "def initialize(conn = nil)\n self.conn = conn || self.class.default_conn\n @system_profiler = SystemProfiler.new\n @last_request_metrics = nil\n end", "def initialize(host, load_balancer, port: nil)\n @ho...
[ "0.7316389", "0.63279444", "0.61783844", "0.60958725", "0.5965339", "0.5951048", "0.59050643", "0.58712894", "0.5819138", "0.5725264", "0.57148325", "0.5713244", "0.5704391", "0.56653994", "0.56653994", "0.5664847", "0.56647635", "0.5661572", "0.5646782", "0.56369966", "0.563...
0.61185896
3
Returns true if the health monitor is defined and has data, returns false if not.
def enabled? @enabled end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitoring?\n if Agent.config[:monitor_mode]\n true\n else\n ::NewRelic::Agent.logger.warn('Agent configured not to send data in this environment.')\n false\n end\n end", "def healthy?\n @healthy\n end", "def datadog_monitors?\n all_...
[ "0.666299", "0.6502841", "0.6386893", "0.6342271", "0.6327593", "0.6315199", "0.62654036", "0.62654036", "0.6232689", "0.62026983", "0.6196804", "0.6188114", "0.6174651", "0.6159554", "0.6155269", "0.613572", "0.6084604", "0.60260946", "0.6000993", "0.5974146", "0.5973497", ...
0.0
-1
Updates (or creates) the health monitor with the supplied arguments To create a health monitor for the first time, you must supply all required options. However, to modify an existing monitor, you need only supply the :type and whatever it is that you want to change. Options include: :type The type of health monitor. Can be CONNECT (simple TCP connections), HTTP, or HTTPS. The HTTP and HTTPS monitors require additional options. required :delay The minimum number of seconds to wait before executing the health monitor. required :timeout Maximum number of seconds to wait for a connection to be established before timing out. required :attempts_before_deactivation Number of permissible monitor failures before removing a node from rotation. required For HTTP and HTTPS monitors, there are additional options. You must supply the :path and either the :status_regex or :body_regex :path The HTTP path that will be used in the sample request. required :status_regex A regular expression that will be used to evaluate the HTTP status code returned in the response :body_regex A regular expression that will be used to evaluate the contents of the body of the response.
def update(options={}) data = Hash.new data[:type] = options[:type].upcase if options[:type] data[:delay] = options[:delay] if options[:delay] data[:timeout] = options[:timeout] if options[:timeout] data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation] data[:type].upcase! if data[:type] if ['HTTP','HTTPS'].include?(data[:type]) data[:path] = options[:path] if options[:path] data['statusRegex'] = options[:status_regex] if options[:status_regex] data['bodyRegex'] = options[:body_regex] if options[:body_regex] end response = @connection.lbreq("PUT",@lbmgmthost,"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor",@lbmgmtport,@lbmgmtscheme,{},data.to_json) CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/) populate true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_monitor monitor_name, path, up_code, type, interval, timeout\n type = type == 'https-ecv' ? 'HTTPS' : 'HTTP-ECV'\n response = put(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/#{monitor_name}\",\n {\n :monitor => {\n ...
[ "0.57288927", "0.55282456", "0.5400732", "0.5327977", "0.53158706", "0.5265992", "0.5265992", "0.5171749", "0.5149279", "0.51091206", "0.5098056", "0.50638926", "0.49821052", "0.49805206", "0.4927622", "0.48656437", "0.4865102", "0.48300874", "0.48254964", "0.48219615", "0.48...
0.6127089
0
Convenience method to update the delay value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise.
def delay=(value) return false unless @enabled update(:type => self.type, :delay => value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay=(value)\n\t\t\t@delay = value\n\t\tend", "def delay=(value)\n\t\t\t@delay = value\n\t\tend", "def delay(value)\n model.delay = value\n end", "def delay(value)\n model.delay = value\n end", "def delay=(sec)\n raise ArgumentError, 'Delay sec can not be a negative number.'...
[ "0.6375577", "0.6375577", "0.62466025", "0.62466025", "0.6113928", "0.5905484", "0.5884957", "0.5884759", "0.58710164", "0.5836823", "0.5800068", "0.5772453", "0.5683087", "0.56367815", "0.5580363", "0.5548741", "0.55480635", "0.55040777", "0.5486695", "0.54744035", "0.546027...
0.76008743
0
Convenience method to update the timeout value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise.
def timeout=(value) return false unless @enabled update(:type => self.type, :timeout => value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end", "def timeout=(value)\n @timeout = value\n end", "def set_Timeout(value)\n set_i...
[ "0.6387167", "0.6320286", "0.6293514", "0.6293514", "0.6293514", "0.6293514", "0.6293514", "0.62935054", "0.62709504", "0.61344004", "0.6111855", "0.6101756", "0.6014903", "0.6008131", "0.598254", "0.5968755", "0.5887144", "0.58627725", "0.5858353", "0.58574563", "0.5796059",...
0.7589935
0
Convenience method to update the attempts before deactivation value for the current type. Returns false if the health monitor is not enabled, the new value if it succeeds, and raises an exception otherwise.
def attempts_before_deactivation=(value) return false unless @enabled update(:type => self.type, :attempts_before_deactivation => value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrease_health\n @health.update { |v| v - 1 }\n end", "def update_failure\n logger.exception(\"Failed to connect to broker #{@alias}\")\n if @last_failed\n @retries += 1\n else\n @last_failed = true\n @retries = 0\n @failure_stats.update\n end\n t...
[ "0.52857697", "0.52756804", "0.50676745", "0.4954168", "0.49498412", "0.4931652", "0.49115565", "0.48515567", "0.48400283", "0.48356387", "0.48162517", "0.47837314", "0.4777499", "0.47665495", "0.47601292", "0.47513783", "0.4739015", "0.47219634", "0.47132018", "0.47027725", ...
0.7389904
0
Convenience method to update the path value for the current type. Returns false if the health monitor is not enabled or not an http monitor, the new value if it succeeds, and raises an exception otherwise.
def path=(value) return false unless @enabled && ['HTTP','HTTPS'].include?(self.type) update(:type => self.type, :path => value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path=(new_path)\n super\n if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior\n @path = path.sub(%r|^/+|,'')\n @normalized_path = nil\n validate\n end\n path\n end", "def path=(new_path)\n location = self.class.new...
[ "0.5558059", "0.54584795", "0.5338232", "0.53381765", "0.5329982", "0.5273695", "0.5248962", "0.522556", "0.51991975", "0.51991975", "0.51991975", "0.5161691", "0.5122184", "0.50500774", "0.50167704", "0.50167704", "0.50096226", "0.49993393", "0.49993393", "0.49993393", "0.49...
0.65689397
0
Convenience method to update the delay value for the current type. Returns false if the health monitor is not enabled or is not an http monitor, the new value if it succeeds, and raises an exception otherwise.
def status_regex=(value) return false unless @enabled && ['HTTP','HTTPS'].include?(self.type) update(:type => self.type, :status_regex => value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delay=(value)\n return false unless @enabled\n update(:type => self.type, :delay => value)\n end", "def delay=(value)\n\t\t\t@delay = value\n\t\tend", "def delay=(value)\n\t\t\t@delay = value\n\t\tend", "def delay(value)\n model.delay = value\n end", "def delay(value)\n ...
[ "0.6881016", "0.60747814", "0.60747814", "0.58633035", "0.58633035", "0.5763408", "0.5615827", "0.5606361", "0.56048846", "0.559388", "0.55915123", "0.5565341", "0.5530756", "0.53681034", "0.5338312", "0.5326239", "0.53157055", "0.5288863", "0.52751464", "0.5271809", "0.52403...
0.0
-1