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
Public: removes all nonprintable characters from string Examples "q\uFFFEw\uFFFFe\uFFF0r\uFDD0t\uFDEFy".remove_nonprintable! => "qwerty" Returns String
def remove_nonprintable! replace(remove_nonprintable) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_unprintable_characters(s)\n s.tr(8204.chr, \"\")\nend", "def remove_nonprintable\n gsub(/[^[:print:]\\n\\t]/i, '')\n end", "def strip_non_ascii_chars(s)\n # truncate the string at the first null character\n s = s[0, s.index(\"\\x00\")] if s.index(\"\\x00\")\n \n s.gsub(/[^\\x...
[ "0.8584826", "0.83130836", "0.7574637", "0.7334146", "0.72554606", "0.7100468", "0.67206943", "0.6474123", "0.6326734", "0.63235426", "0.62540805", "0.6234386", "0.6211393", "0.6171913", "0.6044709", "0.60360897", "0.6025293", "0.6007299", "0.59574765", "0.5927581", "0.592243...
0.7835777
2
Sends self as the single job to be executed to the engine and returns the result
def execute Engine.instance.execute([self])[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job \n @job\n end", "def job\n @job\n end", "def job\n @job\n end", "def execute\n begin\n JobDispatch.logger.info \"Worker executing job #{job_id}: #{target}.#{method}\"\n Thread.current[\"JobDispatch::Worker.job_id\"] = job_id\n @klass = t...
[ "0.70121723", "0.6956068", "0.6956068", "0.67247903", "0.67071325", "0.66809374", "0.6617091", "0.6610411", "0.6592878", "0.6484111", "0.64535236", "0.6343828", "0.6329839", "0.63290346", "0.6301766", "0.62349445", "0.62260985", "0.62157696", "0.6151637", "0.61048394", "0.608...
0.6236714
15
Sends self as the single job to be dispatched to the engine and returns the result
def dispatch Engine.instance.dispatch([self]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job \n @job\n end", "def job\n @job\n end", "def job\n @job\n end", "def execute\n begin\n JobDispatch.logger.info \"Worker executing job #{job_id}: #{target}.#{method}\"\n Thread.current[\"JobDispatch::Worker.job_id\"] = job_id\n @klass = t...
[ "0.69023603", "0.68426263", "0.68426263", "0.67254865", "0.66546303", "0.6606204", "0.6549766", "0.65487003", "0.65147567", "0.6456422", "0.64323735", "0.6411773", "0.6379197", "0.6329365", "0.62835515", "0.6204027", "0.61795896", "0.6172478", "0.61342764", "0.6027611", "0.60...
0.0
-1
Sets the repeatable frequency of execution of a given job
def schedule(cron) if !cron.is_a?(String) || cron.blank? raise InvalidArgumentError, "The cron passed to 'schedule' must be a non empty string" end Engine.instance.schedule([self], cron) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat=(repeat)\n return if @closed\n repeat = repeat.to_i\n check_result ::Libuv::Ext.timer_set_repeat(handle, repeat)\n reject(error) if error\n end", "def setRepeat(repeat)\r\n\t\t\t\t\t@repeat = repeat\r\n\t\t\t\tend", "def update_interval\n self....
[ "0.61215854", "0.6068074", "0.5942124", "0.590686", "0.5750267", "0.5702529", "0.566814", "0.5579904", "0.5570006", "0.5569157", "0.5563925", "0.55493295", "0.5449", "0.5428948", "0.5428504", "0.5410294", "0.5402873", "0.5389013", "0.5361478", "0.53481597", "0.5334954", "0....
0.0
-1
Get a service by key If the service is not set, returns `nil`.
def [](key) return @services[key].call(self) if @factories[key] if @procs[key] @services[key] = @services[key].call(self) @procs.delete(key) end @services[key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def [](key)\n\n if SERVICE_PREFIX.match(key)\n @services[key]\n else\n conf[key]\n end\n end", "def service_from_stats_key(stats_key)\n StatsParser.parse(stats_key, nil)[:service]\n rescue StatsParser::StatsKeyValueInvalid\n # This could happen with ...
[ "0.73725265", "0.69786", "0.6875914", "0.6823729", "0.663919", "0.6626194", "0.65036917", "0.6487875", "0.6411047", "0.6391967", "0.6354668", "0.6334587", "0.6251731", "0.62429416", "0.61758244", "0.615265", "0.6141954", "0.61220455", "0.61116636", "0.6106131", "0.60986525", ...
0.60496044
21
Set a service by key and value If `service` is a Proc, its return value will be treated as a singleton service meaning it will be initialized the first time it is requested and its valud will be cached for subsequent requests. Use the `set` method to allow using a block instead of a Proc argument. If `service` is not a function, its value will be stored directly.
def []=(key, service) set(key, service) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(key, service = nil, &block)\n create(key, service || block, @procs)\n end", "def set id, service\n @services ||= {}\n @services[id] = service\n end", "def []=(key, value)\n\n raise(\n ArgumentError.new('use context#add_service to register services')\n ) if SERVICE_PREFIX...
[ "0.83828557", "0.71610403", "0.71044296", "0.643677", "0.63134944", "0.61570674", "0.61521906", "0.6127713", "0.609841", "0.6049015", "0.6048996", "0.6027368", "0.6000374", "0.5986594", "0.5986199", "0.5913457", "0.5913457", "0.5913457", "0.5913457", "0.5913457", "0.5913457",...
0.7636548
1
Set a service by key and value Same as `[]=` except allows passing a block instead of a Proc argument.
def set(key, service = nil, &block) create(key, service || block, @procs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(key, service)\n set(key, service)\n end", "def []=(key, value)\n\n raise(\n ArgumentError.new('use context#add_service to register services')\n ) if SERVICE_PREFIX.match(key)\n\n @storage.put(conf.merge(key => value))\n # TODO blindly trust the put ? retry in case of fail...
[ "0.81341714", "0.74179924", "0.7248192", "0.6760171", "0.6706655", "0.6679158", "0.6658731", "0.6658731", "0.6523922", "0.6514466", "0.65099883", "0.6439423", "0.63787687", "0.62595385", "0.623371", "0.6221463", "0.61779124", "0.61425054", "0.61364764", "0.61095464", "0.60962...
0.8079845
1
Set a factory service by key and value If `factory` is a function, it will be called every time the service is requested. So if it returns an object, it will create a new object for every request. If `factory` is not a function, this method acts like `set`.
def factory(key, factory = nil, &block) create(key, factory || block, @factories) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_factory(key, factory)\n @assigned_factories[key] = factory\n end", "def register(key, &factory)\n @factories[key] = factory\n self\n end", "def assign_factory(key, factory); @assigned_factories[key] = factory; end", "def factory(key)\n @factories[key]\n end", "def assign...
[ "0.7512357", "0.74159646", "0.73980534", "0.67957395", "0.62714607", "0.6245585", "0.61333585", "0.6018949", "0.5975607", "0.58745605", "0.57580554", "0.5651817", "0.54903126", "0.5444073", "0.5443456", "0.5401156", "0.5390613", "0.5387146", "0.53413045", "0.53413045", "0.529...
0.70003796
3
Set a protected service by name and value If `service` is a function, the function itself will be registered as a service. So when it is requested with `get`, the function will be returned instead of the function's return value. If `service` is not a function, this method acts like `set`.
def protect(key, service = nil, &block) create(key, service || block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def []=(key, service)\n set(key, service)\n end", "def set id, service\n @services ||= {}\n @services[id] = service\n end", "def []=(key, value)\n\n raise(\n ArgumentError.new('use context#add_service to register services')\n ) if SERVICE_PREFIX.match(key)\n\n @storage.put(...
[ "0.7496243", "0.70550877", "0.7030076", "0.70250607", "0.694505", "0.6768842", "0.6617164", "0.65197814", "0.6511919", "0.63741606", "0.63424623", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0.63025755", "0....
0.59306884
46
Extends an existing service and overrides it. The `extender` block will be called with 2 arguments: `old_value` and `self`. If there is no existing `key` service, `old_value` will be nil. It should return the new value for the service that will override the existing one. If `extend` is called for a service that was created with `set`, the resulting service will be a singleton. If `extend` is called for a service that was created with `factory`, the resulting service will be a factory. If `extend` is called for a service that was created with `protect`, the resulting service will also be protected. If `extender` is not a function, this method will override any existing service like `set`.
def extend(key, extender = nil, &block) extender ||= block return set(key, extender) unless extender.is_a?(Proc) && @services.key?(key) extended = @services[key] call = @factories[key] || @procs[key] send(@factories[key] ? :factory : :set, key) do extender.call(self, call ? extended.call(self) : extended) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decorate(key, with: nil, &block)\n key = key.to_s\n original = _container.delete(key) do\n raise Error, \"Nothing registered with the key #{key.inspect}\"\n end\n\n if with.is_a?(Class)\n decorator = with.method(:new)\n elsif block.nil? && !with.respond_to?(...
[ "0.56621194", "0.5461402", "0.5280786", "0.5276669", "0.525871", "0.5186558", "0.5186558", "0.514413", "0.5113805", "0.50855637", "0.50816774", "0.50737554", "0.5004587", "0.498155", "0.48729464", "0.48213208", "0.47806597", "0.47739285", "0.47443607", "0.47168916", "0.471676...
0.8022898
0
Iterates over the service keys If a block is given, the block is called with each of the service keys If a block is not given, returns an `Enumerable` of the keys. The key order is undefined.
def each return @services.each_key unless block_given? @services.each_key { |key| yield key } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n keys.each(&block)\n end", "def each_key(&block)\n keys.each(&block)\n end", "def each(&block)\n @services.each { |c|\n yield c\n }\n end", "def each_key(&block)\n config.resolver.each_key(_container, &block)\n ...
[ "0.724164", "0.71762323", "0.67403895", "0.6739877", "0.67019475", "0.66617674", "0.66552293", "0.66501266", "0.6497394", "0.6445747", "0.6433977", "0.6413627", "0.6390177", "0.6268484", "0.6215433", "0.62092626", "0.61937034", "0.6094885", "0.60892045", "0.60496634", "0.6026...
0.8337317
0
Checks if a service for `key` exists.
def include?(key) @services.key?(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exist?(service)\n !service_list[service].nil?\n end", "def has_service?(service_name)\n\n service_name = service_name.to_s\n service_name = \"s_#{service_name}\" if ! SERVICE_PREFIX.match(service_name)\n\n @services.has_key?(service_name)\n end", "def exist?(key)\n with_client ...
[ "0.7530332", "0.7421192", "0.724203", "0.71405405", "0.7135885", "0.7054086", "0.70096576", "0.6923372", "0.6857317", "0.6848804", "0.6780158", "0.67602146", "0.67533195", "0.6741894", "0.6740208", "0.6704437", "0.668623", "0.6640178", "0.66009516", "0.6566105", "0.6548496", ...
0.7728192
0
Get the dimensions for the sheet. This is the upper bound of cells that might be parsed. (the document may be sparse so cell count is only upper bound)
def dimensions @dimensions ||= extract_dimensions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_width\n @cell_width ||= @doc.bounds.right / 7\n end", "def cell_height\n @cell_height ||= (@doc.bounds.top - 1.in) / number_of_weeks\n end", "def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end", "def get_dimensions\n...
[ "0.6755951", "0.6565951", "0.6521561", "0.6505773", "0.64139146", "0.6410647", "0.63868684", "0.6329168", "0.6294563", "0.62328815", "0.6169149", "0.61021936", "0.6094889", "0.60837865", "0.6075233", "0.60712445", "0.5984041", "0.594869", "0.5934137", "0.5931857", "0.59257877...
0.6375746
7
Yield each row xml element to caller
def each_row_streaming(&block) Roo::Utils.each_element(@path, 'row', &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_row\n @data.xml.group.elements.each do |chunk|\n # Set up for running this data chunk - prep timestamp and increment step from source xml\n ts = EGauge::parse_time(chunk['time_stamp'])\n step = chunk['time_delta'].to_i\n \n # Run each row in the chunk, and yield our...
[ "0.7269024", "0.68929625", "0.6876176", "0.68097144", "0.676589", "0.676589", "0.6756035", "0.6721626", "0.6713222", "0.66274005", "0.66194016", "0.65401226", "0.6489399", "0.6394634", "0.6390528", "0.63743263", "0.6356385", "0.6345656", "0.6302721", "0.62898314", "0.62825805...
0.7022274
1
Yield each cell as Excelx::Cell to caller for given row xml
def each_cell(row_xml) return [] unless row_xml row_xml.children.each do |cell_element| coordinate = ::Roo::Utils.extract_coordinate(cell_element["r"]) hyperlinks = hyperlinks(@relationships)[coordinate] yield cell_from_xml(cell_element, hyperlinks, coordinate) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_row(options = {})\n return enum_for(:each_row, options) unless block_given?\n\n sheet = options[:sheet] || @default_sheet\n validate_sheet!(sheet)\n\n cell_sheet = @cell[sheet]\n build_rows = cell_sheet.empty?\n worksheet = @workbook.worksheet(sheet_no(sheet))\n worksheet.each_with_in...
[ "0.70795065", "0.703225", "0.6957116", "0.68027097", "0.6592031", "0.65675807", "0.6461643", "0.64316535", "0.6385711", "0.63779086", "0.6238577", "0.6169556", "0.61293036", "0.6059579", "0.60579664", "0.6041514", "0.6013314", "0.6006663", "0.60001206", "0.59812343", "0.59423...
0.8275802
0
Internal: Creates a cell based on an XML clell.. cell_xml a Nokogiri::XML::Element. e.g. 22606 hyperlink a String for the hyperlink for the cell or nil when no hyperlink is present. coordinate a Roo::Excelx::Coordinate for the coordinate for the cell or nil to extract coordinate from cell_xml. empty_cell an Optional Boolean value. Examples cells_from_xml(, nil, nil) => Returns a type of .
def cell_from_xml(cell_xml, hyperlink, coordinate, empty_cell=true) coordinate ||= ::Roo::Utils.extract_coordinate(cell_xml["r"]) cell_xml_children = cell_xml.children return create_empty_cell(coordinate, empty_cell) if cell_xml_children.empty? # NOTE: This is error prone, to_i will silently turn a nil into a 0. # This works by coincidence because Format[0] is General. style = cell_xml["s"].to_i formula = nil cell_xml_children.each do |cell| case cell.name when 'is' content = cell.search('t').map(&:content).join unless content.empty? return Excelx::Cell.cell_class(:string).new(content, formula, style, hyperlink, coordinate) end when 'f' formula = cell.content when 'v' format = style_format(style) value_type = cell_value_type(cell_xml["t"], format) return create_cell_from_value(value_type, cell, formula, format, style, hyperlink, coordinate) end end create_empty_cell(coordinate, empty_cell) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xml(xml)\n xml[:c].title {\n unless @text.empty?\n xml[:c].tx {\n xml[:c].strRef {\n xml[:c].f Axlsx::cell_range([@cell])\n xml[:c].strCache {\n xml[:c].ptCount :val=>1\n xml[:c].pt(:idx=>0) {\n xml[:c]....
[ "0.58000886", "0.5727242", "0.5633242", "0.5628387", "0.56040394", "0.56010175", "0.55562013", "0.5434278", "0.54093367", "0.5309746", "0.527223", "0.5202897", "0.5151754", "0.50985426", "0.50699806", "0.49767706", "0.4974196", "0.4974196", "0.4974196", "0.495466", "0.4952777...
0.8548347
0
should be ordered by where in the string the substring begins. This means that all substrings that start at position 0 should come first, then all substrings that start at position 1, and so on. Since multiple substrings will occur at each position, the substrings at a given position should be returned in order from shortest to longest.
def substrings_at_start(str) index = 0 length = 1 arry = [] while length <= str.size arry << str[index, length] length += 1 end arry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }\nend", "def substrings_at_start(string)\n strings_array = (1..(string.length)).map { |idx| string[0, idx] }\n strings_array.sort_by { |string| string.length }...
[ "0.81236637", "0.81236637", "0.8016277", "0.7869252", "0.7736445", "0.77215767", "0.761477", "0.7301197", "0.72632027", "0.7150396", "0.712324", "0.71138793", "0.7085285", "0.7085285", "0.7075551", "0.7065341", "0.7065341", "0.7061169", "0.7059685", "0.7059685", "0.70356935",...
0.6736827
73
Function to get adjacent points from vector
def GetAdjacentPts(pts, i) res = [] if (i == 0) res[0] = pts[pts.length-1] else res[0]= pts[i-1] end res[1] = pts[i] if (i == pts.length-1) res[2]= pts[0] else res[2] = pts[i+1] end return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacent_traversible_points(point)\n\n left_point = [point[0] - 1, point[1]]\n right_point = [point[0] + 1, point[1]]\n top_point = [point[0], point[1] - 1]\n bottom_point = [point[0], point[1] + 1]\n\n [left_point, right_point, top_point, bottom_point].select do |n|\n (@space_points.includ...
[ "0.71070224", "0.684846", "0.674761", "0.671052", "0.66783327", "0.65903777", "0.65770507", "0.65627944", "0.6561748", "0.6517928", "0.6504357", "0.6473056", "0.6310063", "0.6256522", "0.61748487", "0.61395085", "0.60999095", "0.60946095", "0.606053", "0.6057586", "0.6056727"...
0.673853
3
Function to compute point at a certain radius away from a point
def add_outer_radius(p, outerRadius, angle) res = Geom::Point3d.new(p[0] + Math.cos(angle * Math::PI) * outerRadius, p[1] + Math.sin(angle * Math::PI) * outerRadius, 0) return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def earth_radius(point)\n a = EARTH_EQUATORIAL_RADIUS\n b = EARTH_POLAR_RADIUS\n latitude = point.latitude\n\n Math.sqrt(((a**2 * Math.cos(latitude))**2 + (b**2 * Math.sin(latitude))**2) / ((a * Math.cos(latitude))**2 + (b * Math.sin(latitude))**2))\n end", "def ellipso...
[ "0.6715478", "0.6705843", "0.66130054", "0.64644086", "0.63368064", "0.63186085", "0.6294184", "0.6287517", "0.62679935", "0.6256033", "0.62554336", "0.62470716", "0.6236859", "0.61801636", "0.617796", "0.61621976", "0.61581564", "0.6156688", "0.6143541", "0.6129727", "0.6119...
0.58563626
46
Function to determin the position of points of a triangle based on the length of the sides
def triangle_point(sPoint, a, b, c) pts = [] pts[0] = sPoint pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2]) a = a.to_f b = b.to_f c = c.to_f dx = (b*b - c*c + a*a) / (2*a) dy = Math.sqrt(b*b - dx*dx) pts[2] = Geom::Point3d.new(sPoint[0] + dx, sPoint[1] + dy, sPoint[2]) return pts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle_index()\n (Math.sqrt(1 + (8 * self)) - 1) / 2\n end", "def area_of_triangle(base, height)\n (base * height) / 2\nend", "def triangle\n self * ( self + 1 ) / 2\n end", "def find_triangle(counter)\n\t((counter*counter) + counter)/2\nend", "def area_of_triangle(base, height)\n 0.5*base*...
[ "0.6845657", "0.65587115", "0.65141773", "0.64877266", "0.64554524", "0.63466585", "0.6330036", "0.6298174", "0.62504953", "0.62225354", "0.6213443", "0.62047136", "0.6199224", "0.61923456", "0.6173526", "0.61341333", "0.61332643", "0.61146116", "0.6108108", "0.6075707", "0.6...
0.66626906
1
Function to determine the start and end position of a rod based on its length
def create_rod(sPoint, a) pts = [] pts[0] = sPoint pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2]) return pts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length\n @end - @start\n end", "def direction\n\t\tpoint_x = end_junction.position.x - start_junction.position.x\n\t\tpoint_y = end_junction.position.y - start_junction.position.y\n\t\t[point_x / @length, point_y / @length]\n\tend", "def find_start_and_end(move)\n mv_start = move[0..1].split('')\n ...
[ "0.62417305", "0.62064683", "0.6092083", "0.6084883", "0.5924003", "0.5900014", "0.58745193", "0.581301", "0.581301", "0.58100253", "0.58013254", "0.57267195", "0.57168055", "0.5669282", "0.56683296", "0.56533605", "0.563259", "0.5612779", "0.5603774", "0.55923134", "0.557938...
0.0
-1
Draw part based on a series of points (draws holes, curves on the corners, and connecting lines)
def draw_part(pts) # Draw holes for i in 0..(pts.length-1) draw_circle(pts[i], $normVec, $holeRadius) end # Loop through points for i in 0..(pts.length-1) # Get adjacent points adjPts = GetAdjacentPts(pts, i) # Compute start and end angles sAngle = angle_between_point_xy([adjPts[0],adjPts[1]]) eAngle = angle_between_point_xy([adjPts[1],adjPts[2]]) # Make adjustments sAngle = sAngle - 0.5 eAngle = eAngle - 0.5 if(eAngle < sAngle) eAngle = eAngle + 2 end # Draw curves draw_curve(adjPts[1], $normVec, $xaxis, $outerRadius, sAngle * Math::PI, eAngle * Math::PI) # Draw lines draw_line(add_outer_radius(adjPts[0],$outerRadius,sAngle),add_outer_radius(adjPts[1],$outerRadius,sAngle)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n @planning.draw\n @segments.each do |s|\n s.draw(@drawer)\n end\n @points.each do |p|\n @drawer.draw_circle(p.x, p.y, 3)\n end\n end", "def line(points, colour)\n\tpoints.each do |point|\n\t paint(point[0], point[1], colour)\n\tend\n end", "def bezier_curve(points, stroke...
[ "0.6360165", "0.63567644", "0.62653035", "0.6245588", "0.6221357", "0.6166168", "0.6153661", "0.6131572", "0.60835266", "0.60693717", "0.6017298", "0.59649676", "0.5955455", "0.5947367", "0.5939344", "0.59028864", "0.58746374", "0.5865512", "0.58624655", "0.57452786", "0.5734...
0.8284255
0
Function to draw the wheel that powers the motion
def draw_wheel(center, dist) draw_circle(center, $normVec, $axelRadius) draw_circle(center, $normVec, dist + $outerRadius) attachPoint = Geom::Point3d.new(center[0] + dist, center[1], center[2]) UI.messagebox attachPoint draw_circle(attachPoint, $normVec, $axelRadius) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wheel_count\n 2\n end", "def mill_pump_wheel(pCent_x, pCent_y)\r\n # # # # # # # # # # # # # #\r\n \r\n print \"(mill_pump_wheel material_type=\", material_type, \")\\n\"\r\n print \"(wheel_diam=\", wheel_diam, \" stock_z_len=\", stock_z_len, \")\\n\"\r\n \r\n if material...
[ "0.6012531", "0.5959307", "0.5808832", "0.5800313", "0.5800313", "0.579063", "0.57091784", "0.56751907", "0.5675175", "0.5674896", "0.55203736", "0.55203736", "0.547613", "0.5474374", "0.5472401", "0.5440014", "0.5428364", "0.54228383", "0.5396501", "0.5363929", "0.53593296",...
0.6720288
0
def validate_on_create end def validate_on_update end
def before_destroy if client_order_fulfillments.count != 0 return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_create; end", "def validate_on_create #:doc:\n end", "def before_validation_on_update\n before_validation_on_create\n end", "def validate_on_create=(_arg0); end", "def validate_on_update # :doc:\n end", "def validate_on_save(fields)\n end", "def valid_callbacks\n ...
[ "0.90799487", "0.8483447", "0.8341856", "0.8129967", "0.79692334", "0.7619833", "0.75458556", "0.74911004", "0.73709583", "0.73351824", "0.73351824", "0.7294401", "0.7268848", "0.721469", "0.72073716", "0.7168049", "0.71523297", "0.71523297", "0.71523297", "0.71523297", "0.70...
0.0
-1
Get all projects for your API key
def get CircleCi.request(conf, '/projects').get end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def projects\n request(method: 'getAllProjects')\n end", "def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end", "def get_projects\n me = request('/services/v5/me')\n me['projects']\n end", "def all_projects()\n @endpoint = \"/projects.jso...
[ "0.793461", "0.7881555", "0.78386337", "0.7798562", "0.77356833", "0.76783574", "0.7425945", "0.74038833", "0.73583245", "0.73396385", "0.73011947", "0.7210489", "0.7170315", "0.71037316", "0.7055906", "0.7018637", "0.7017901", "0.7015949", "0.7015949", "0.6950827", "0.694517...
0.700889
19
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. 3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below: 75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23
def problem18(r) h = r.length sum = 0 for i in 0..h-1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_sum_triangle\r\n\r\n\tnumber = \"75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 \"\r\n\tnumber += \"40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 \"\r\n\tnum...
[ "0.8300212", "0.77860487", "0.7455959", "0.71103215", "0.6866595", "0.6840474", "0.67089504", "0.6692266", "0.6577435", "0.64705265", "0.644249", "0.6431224", "0.64085037", "0.6393438", "0.63823754", "0.6381292", "0.6368434", "0.63467187", "0.63447917", "0.631052", "0.6303324...
0.0
-1
synchronizes controls at a regular interval def gettest service = MControl_x0020_Web_x0020_ServiceSoap.new extension = service.sendCommand(SendCommand.new(DEVICES["exterior_shades"], "GETEXTENSION 24")) logger.debug extension.inspect end PANELS
def index #check_threads logger.debug DEVICES.to_yaml # collect modes @modes = Mode.find(:all) @mode = Mode.find(1) # assign client id - how to differentiate between a touch panel and a connected laptop? how to stop other computers from accessing controls? force a local IP somehow? @client_id = "central" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meterpreter_service_list #gets\n\t\tserviceskey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\"\n\t\tthreadnum = 0\n\t\ta =[]\n\t\tservices = []\n\t\tbegin\n\t\t\tmeterpreter_registry_enumkeys(serviceskey).each do |s|\n \t\t\t\tif threadnum < 10\n\t\t\t\t\ta.push(::Thread.new(s) { |sk|\n\t\t\t\t\t\tbegi...
[ "0.53338414", "0.5136554", "0.51312125", "0.50486183", "0.5046782", "0.5032993", "0.5000972", "0.49835414", "0.49545968", "0.4947802", "0.49350974", "0.4907773", "0.48958516", "0.488924", "0.48880363", "0.48833933", "0.4874595", "0.48529005", "0.48403195", "0.4835029", "0.482...
0.45101464
73
these methods are needed by Juggernaut but don't have any content because all they require is a valid HTTP 200 code back
def push_subscription render :nothing => true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def status_code; end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def http_code\n '000'\n end", "def ok_status_code\n _undefined\n end", "def statu...
[ "0.7401004", "0.7401004", "0.7401004", "0.7401004", "0.72773254", "0.70130205", "0.70130205", "0.68967515", "0.68683916", "0.6858772", "0.6858772", "0.6858772", "0.6858772", "0.68346167", "0.6776525", "0.66954446", "0.66833454", "0.66169304", "0.66169304", "0.657771", "0.6559...
0.0
-1
calls Juggernaut initializer to relaunch it on error
def push_relaunch require "config/initializers/launch_juggernaut.rb" render :nothing => true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_init_script; end", "def initialize(options = nil) \n JubulaOptions::Fields.each { |x| eval(\"@#{x} = JubulaOptions::#{x}\") }\n options.each { |opt, val| eval( \"@#{opt} = '#{val}'\") } if options\n\t[\"#{@jubulaHome}/server/autagent*\",\n\t\"#{@jubulaHome}/#{@application}/#{@application}*\",\n\t\"...
[ "0.6097634", "0.5802814", "0.5789078", "0.5673273", "0.56170297", "0.55949455", "0.5556323", "0.5556323", "0.5547224", "0.5504073", "0.54789925", "0.54789925", "0.5477051", "0.5474023", "0.5469206", "0.5466398", "0.546106", "0.5456176", "0.54511094", "0.54511094", "0.54511094...
0.5407744
28
def set_mode logger.debug "setting mode to " + Mode.find(params[:id]).name render :nothing => true end
def optimize_shades service = MControl_x0020_Web_x0020_ServiceSoap.new # return exterior shades to optimized state (1..30).each do |blind_id| # clear tilt of every shade section service.sendCommand(SendCommand.new(DEVICES["exterior_shades"], "CLEARTILT #{blind_id}")) sleeper # clear extension of even shades if (blind_id % 2 == 0) service.sendCommand(SendCommand.new(DEVICES["exterior_shades"], "CLEAREXTENT #{blind_id}")) sleeper end end # start threaded timer to do a GET on the state (needs to be delayed since it takes a while for the shades to get there) # Thread.new { # sleep(60) # wait 60 seconds for shades to reach state # GETTILT and GETEXTENT on each # push updates to client # } render :nothing => true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_mode\n @mode = Mode.find(params[:id])\n end", "def set_mode\n @mode = Mode.find(params[:id])\n end", "def set_mode newmode\n @mode = newmode\n @view.set_mode newmode\n case newmode\n when :idle\n reset_all_stats\n end\n end", "def set_mode(m)\n @mode = m\n end", ...
[ "0.8203579", "0.81996626", "0.6942354", "0.6929116", "0.68726975", "0.68567", "0.68567", "0.67851573", "0.67792094", "0.6697696", "0.66944885", "0.6679745", "0.6679745", "0.6585303", "0.6577738", "0.6568877", "0.6554214", "0.6551343", "0.6539405", "0.6538016", "0.6526654", ...
0.0
-1
used to buffer commands to mControl at 200ms intervals prevents overlaod of the mControl buffer
def sleeper sleep(0.4) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buffer_command(cmd)\n @cmd_time ||= Time.now.to_f\n @cmds << cmd\n flush_commands if Time.now.to_f - @cmd_time > BUFFER_TIME\n end", "def throttle; end", "def draw_controls()\n startControlPos = (@ctrFrames / self.timeout).to_i * self.number\n if (startControlPos >= @ucControls.size)\n ...
[ "0.66128886", "0.59201396", "0.584733", "0.5796273", "0.5792167", "0.56916827", "0.5678777", "0.5678777", "0.5678777", "0.5564174", "0.55546933", "0.5517977", "0.55025357", "0.548298", "0.54638326", "0.5432479", "0.5426509", "0.54152924", "0.54114234", "0.53850466", "0.537339...
0.0
-1
Time Complexity O(log 10 n) Space Complexity O(log 10 n)
def super_digit(n) if 10 > n return n end last_digit = n % 10 sum = n / 10 + last_digit return super_digit(sum) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))...
[ "0.6392671", "0.6300254", "0.61776185", "0.61653966", "0.6111294", "0.6106336", "0.60364926", "0.6008911", "0.5977781", "0.5971729", "0.59337866", "0.5908713", "0.5878323", "0.58672017", "0.5847509", "0.58383983", "0.5830836", "0.582924", "0.5819441", "0.58187777", "0.5810941...
0.0
-1
first attempt with buildin method def super_digit(n) if 10 > n return n end return super_digit(n.digits.sum) end Time Complexity O(log 10 (nk)) Space Complexity O(log 10 (nk)) not sure how to improve the complexity ....
def refined_super_digit(n, k) super_digit(n*k) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super_digit(n)\n return n if n < 10\n return super_digit(n.digits.sum)\nend", "def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend", "def super_digit(n)\n return n if n < 10\n super_digit(n.digits.sum)\nend", "def super_digit(n)\n #has to be a single digit \n if n < 10 \n ...
[ "0.90576327", "0.90397584", "0.90397584", "0.9023338", "0.90007615", "0.8985274", "0.8972638", "0.89167404", "0.8909272", "0.8890653", "0.881303", "0.8808622", "0.8801016", "0.879906", "0.87966394", "0.87644696", "0.87581027", "0.87087107", "0.8679628", "0.8678175", "0.863562...
0.7819477
61
GET /mail_items GET /mail_items.json
def index @mail_items = MailItem.all respond_to do |format| format.html # index.html.erb format.json { render json: @mail_items } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mail_items = MailItem.all\n end", "def show\n @mail_item = MailItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mail_item }\n end\n end", "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n ...
[ "0.7293126", "0.72258043", "0.6714139", "0.664704", "0.64198714", "0.63550097", "0.6304952", "0.62823397", "0.62538373", "0.621761", "0.6211674", "0.6196516", "0.61483103", "0.61475027", "0.6138695", "0.61298037", "0.6121366", "0.61148703", "0.6113504", "0.61124825", "0.61095...
0.7651704
0
GET /mail_items/1 GET /mail_items/1.json
def show @mail_item = MailItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @mail_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @mail_items = MailItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mail_items }\n end\n end", "def index\n @mail_items = MailItem.all\n end", "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.h...
[ "0.7490583", "0.7011558", "0.69446474", "0.6473409", "0.6313826", "0.63127285", "0.6312361", "0.6261005", "0.62420434", "0.61174154", "0.60465384", "0.6030517", "0.6023118", "0.6023118", "0.60181093", "0.6016502", "0.6007266", "0.5983804", "0.5976974", "0.59757835", "0.597102...
0.75155437
0
GET /mail_items/new GET /mail_items/new.json
def new @mail_item = MailItem.new respond_to do |format| format.html # new.html.erb format.json { render json: @mail_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mail_item = MailItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def new\n @item = Item.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n ...
[ "0.7491689", "0.7407961", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "0.7386286", "...
0.82857317
0
POST /mail_items POST /mail_items.json
def create @mail_item = MailItem.new(params[:mail_item]) @mail_item.source_name = '人工添加' if @mail_item.source_name.nil? respond_to do |format| if @mail_item.save format.html { redirect_to "/home/email", notice: '电子邮箱添加成功.' } format.json { render json: @mail_item, status: :created, location: @mail_item } else format.html { render action: "new" } format.json { render json: @mail_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mail_item = MailItem.new(mail_item_params)\n\n respond_to do |format|\n if @mail_item.save\n format.html { redirect_to @mail_item, notice: 'Mail item was successfully created.' }\n format.json { render :show, status: :created, location: @mail_item }\n else\n forma...
[ "0.71302235", "0.6545291", "0.654164", "0.6472293", "0.64487183", "0.63682675", "0.6272237", "0.620462", "0.61366904", "0.6112281", "0.6073136", "0.6051604", "0.6015098", "0.599455", "0.5984642", "0.5963469", "0.5956783", "0.59474283", "0.5919786", "0.58928484", "0.5877305", ...
0.60843176
10
PUT /mail_items/1 PUT /mail_items/1.json
def update @mail_item = MailItem.find(params[:id]) respond_to do |format| if @mail_item.update_attributes(params[:mail_item]) format.html { redirect_to "/home/email", notice: '电子邮箱修改成功.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @mail_item.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @mail_item.update(mail_item_params)\n format.html { redirect_to @mail_item, notice: 'Mail item was successfully updated.' }\n format.json { render :show, status: :ok, location: @mail_item }\n else\n format.html { render :edit }\n for...
[ "0.7171027", "0.6876592", "0.66625714", "0.662893", "0.6622602", "0.6367358", "0.6305592", "0.62963754", "0.62634313", "0.62619126", "0.62549067", "0.62463486", "0.61846316", "0.61846316", "0.6163956", "0.6144667", "0.6126511", "0.61111426", "0.6106092", "0.6098727", "0.60903...
0.6898998
1
DELETE /mail_items/1 DELETE /mail_items/1.json
def destroy @mail_item = MailItem.find(params[:id]) @mail_item.destroy respond_to do |format| format.html { redirect_to mail_items_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mail_item.destroy\n respond_to do |format|\n format.html { redirect_to mail_items_url, notice: '删除成功.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mail_item.destroy\n respond_to do |format|\n format.html { redirect_to mail_items_url, notice: 'M...
[ "0.75712943", "0.7493663", "0.7385185", "0.7025722", "0.69447917", "0.69432837", "0.68838024", "0.6811013", "0.679576", "0.67302006", "0.6730189", "0.67204654", "0.67007226", "0.6683981", "0.6673742", "0.6668312", "0.6655646", "0.66553885", "0.66462314", "0.66454506", "0.6644...
0.7757632
0
Evaluates a given expression and returns a node set.
def evaluate(context) Parser.new(@expr).parse.evaluate(context) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(expression)\n @simpleParser.parse expression\n end", "def evaluate(expr)\n @api.function_for_object_method(self, :eval).call(@session, expr)\n end", "def evaluate(expr)\n TupleExpression.coerce(expr).evaluate(self)\n end", "def eval(expression, env = Environment.new)\n ...
[ "0.6736776", "0.65139353", "0.6497623", "0.63556397", "0.63183165", "0.6295939", "0.6265175", "0.62324274", "0.621142", "0.6168154", "0.6153822", "0.61191815", "0.6048109", "0.59764236", "0.5964093", "0.5963082", "0.5946149", "0.5934117", "0.5934117", "0.5918226", "0.5898654"...
0.6318134
5
Traverses DOM tree by a given expression, and returns a node set.
def query_selector_all(expr) Traverser.new(expr).evaluate(Context.new(node: self)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expr( path_stack, nodeset, context=nil )\n enter(:expr, path_stack, nodeset) if @debug\n return nodeset if path_stack.length == 0 || nodeset.length == 0\n while path_stack.length > 0\n trace(:while, path_stack, nodeset) if @debug\n if nodeset.length == 0\n path_stack.clear...
[ "0.6552604", "0.5984742", "0.597244", "0.58078814", "0.57152784", "0.56542706", "0.56497097", "0.5630961", "0.5626434", "0.55299306", "0.54919726", "0.53896517", "0.5377475", "0.5270012", "0.5263002", "0.5190479", "0.51840013", "0.5104191", "0.5093956", "0.5086338", "0.501749...
0.6307924
1
create object to keep track of players score
def initialize(player1, player2) @player1 = player1 @player2 = player2 @p1_score = 0 @p2_score = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(player_num)\n @player_num = player_num\n @score = 0\n end", "def initialize(name, player_scores)\n @name = name\n @score = player_scores.sum\n @num_players = player_scores.size\n end", "def get_score()\n score = Hash.new(0)\n players.each {|player| scor...
[ "0.7910634", "0.76300347", "0.75364685", "0.7473627", "0.7373576", "0.7268712", "0.7238933", "0.70622367", "0.7047886", "0.7040618", "0.6961589", "0.69505155", "0.691802", "0.6911747", "0.68889785", "0.6887771", "0.6885742", "0.6879775", "0.685825", "0.6841116", "0.6812969", ...
0.73678315
5
gives points to the correct player
def give_point if@current_player == @player1 @p1_score += 1 else @p2_score += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \"...
[ "0.737282", "0.71755326", "0.6881397", "0.6879811", "0.68570495", "0.676055", "0.67232466", "0.6720484", "0.67196715", "0.67137855", "0.6696563", "0.6661514", "0.6645029", "0.6644344", "0.6635006", "0.660566", "0.65807533", "0.6574021", "0.65684366", "0.65657663", "0.6516987"...
0.6988863
2
print message when game is over
def print_score puts 'Game Over' if @p1_score > @p2_score puts "Congrats #{@player1} wins with #{@p1_score} correct sets" else if @p2_score > @p1_score puts "Congrats #{@player2} wins with #{@p2_score} correct sets" else puts 'It a tie' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_over\n switch_player!\n puts \"#{@active_player.name} wins with #{@active_player.life}/3\"\n puts \"\\n\\n________ GAME OVER ________\"\n puts \"\\n\\n Good bye!\"\n end", "def actions_when_game_is_lost\n puts \"\"\n puts \"GAME OVER\".red\n self.quit_game = true\n end", "def ga...
[ "0.81252575", "0.80709463", "0.7911575", "0.78494936", "0.77745366", "0.76879025", "0.76860666", "0.76362425", "0.75942194", "0.7436924", "0.74070054", "0.7390352", "0.7387868", "0.73852104", "0.734065", "0.73317975", "0.7325848", "0.731156", "0.72490513", "0.72393006", "0.71...
0.0
-1
++ Created By: Chaitali Khangar Purpose: User for edit user details Created On: 5/05/2014
def edit if request.format.html? && current_user.email.blank? flash[:alert] = "Please add email address first" redirect_to :back and return end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit\r\n \t@user = current_user\r\n end", "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User...
[ "0.72605795", "0.7206914", "0.70688325", "0.7053782", "0.70474476", "0.7035139", "0.702805", "0.69857335", "0.6981418", "0.6978701", "0.6966446", "0.6965455", "0.696221", "0.69111824", "0.69110405", "0.6882444", "0.6882444", "0.6857347", "0.68431073", "0.68270606", "0.6814494...
0.0
-1
++ Created By: Chaitali Khangar Purpose: User sign up
def create (super and return) if request.format.html? user = User.new(allow_registration_parameters) if user.save render :json=> { :status => 201, :user => user , :token => user.authentication_token } return else warden.custom_failure! errors = user.errors.full_messages.join("<br/>").html_safe render :json=> {:status=>422,:message => errors} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup\n end", "def signup\n end", "def attemp_signup\n\n end", "def signup\r\n\t@title = \"Sign Up\"\r\n end", "def signup\n return set_session_user_id!(nil, 'Введите данные.') { render :signup_new } if params_valid?(:signup)\n LdapService.mutex.synchronize do\n ldap_result = LdapServic...
[ "0.86098784", "0.86098784", "0.791161", "0.77060664", "0.76671", "0.7644018", "0.7556399", "0.75413984", "0.7522957", "0.75095433", "0.74660444", "0.74547756", "0.7427573", "0.7414179", "0.73938835", "0.73900664", "0.73788816", "0.73671335", "0.7343888", "0.7310537", "0.73074...
0.0
-1
++ Created By: Chaitali Khangar Purpose: User sign up Usage: 127.0.0.1:3000/api/v1/edit?token=1gjMKdwWHfQy9zyd2zE22RaW9TAd5ZGpXQ&user[age_range]=1924&user[current_password]=Chaitali1&user[password]=Chaitali123&user[password_confirmation]=Chaitali123&user[name]=Chaitali Khangar Type: POST Created On: 5/05/2014
def update if request.format.html? && params["user"]["password"].present? && params["user"]["password"] == params["user"]["password_confirmation"] && params["user"]["password"] == params["user"]["current_password"] flash[:alert] = ERROR_MESSAGE_FOR_PASSWORD redirect_to edit_user_registration_path and return elsif request.format.html? super else @user = User.find_by_authentication_token(params[:token]) if !params[:user].nil? && !@user.blank? if params["user"]["password"].present? && params["user"]["password"] == params["user"]["password_confirmation"] && params["user"]["password"] == params["user"]["current_password"] render :json=> { :status => 404, :message => ERROR_MESSAGE_FOR_PASSWORD} and return end if @user.valid_password?(params[:user][:current_password]) @user.update_attributes(allow_registration_parameters) ? (render :json=> {:status => 200, :user => @user, :message => "User details updated."}) : (render :json=> {:status => 404,:message => @user.errors.full_messages.join("<br/>").html_safe}) return else render :json=> {:status => 404, :message => "Current password entered is wrong."} end else render :json=> {:status => 404, :message => "Invalid authentication token used."} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signup\n puts 'signup is happening here'\n permitted = params.require('signup').permit(['email', 'password', 'password_confirmation'])\n @newUser = User.new(permitted)\n if @newUser.save\n head :ok\n else\n render json:{\"reason\": \"could not create user\"}, status: 422\n end\n en...
[ "0.67006403", "0.663499", "0.65688694", "0.65682155", "0.65162474", "0.6506785", "0.65016925", "0.6500597", "0.6498688", "0.64711905", "0.6450603", "0.64468217", "0.6439517", "0.6435878", "0.6432564", "0.6418888", "0.64185536", "0.64185536", "0.6393651", "0.6392937", "0.63892...
0.6113814
100
Returns the provider name based on the MXer host names, or nil if not matched
def provider return @provider if defined? @provider Config.providers.each do |provider, config| if config[:exchanger_match] && matches?(config[:exchanger_match]) return @provider = provider end end @provider = :default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def provider\n EmailAddress::Config.providers.each do |name, defn|\n return name if EmailAddress::DomainMatcher.matches?(@host_name, defn[:domains])\n end\n nil\n end", "def provider_name\n return @provider_name\n end", "def provider_to_email(providerName)\t\t...
[ "0.7327111", "0.6249902", "0.61010617", "0.60816735", "0.60737723", "0.6037134", "0.5922607", "0.591748", "0.58939636", "0.58474773", "0.58394396", "0.58324945", "0.5823682", "0.5781659", "0.5765628", "0.57439494", "0.5728479", "0.5702885", "0.56999123", "0.56986636", "0.5684...
0.644899
1
Returns: [["mta7.am0.yahoodns.net", "66.94.237.139", 1], ["mta5.am0.yahoodns.net", "67.195.168.230", 1], ["mta6.am0.yahoodns.net", "98.139.54.60", 1]] If not found, returns [] Returns a dummy record when dns_lookup is turned off since it may exists, though may not find provider by MX name or IP. I'm not sure about the "0.0.0.0" ip, it should be good in this context, but in "listen" context it means "all bound IP's"
def mxers return [["example.com", "0.0.0.0", 1]] if @dns_disabled @mxers ||= Resolv::DNS.open { |dns| dns.timeouts = @config[:dns_timeout] if @config[:dns_timeout] ress = begin dns.getresources(@host, Resolv::DNS::Resource::IN::MX) rescue Resolv::ResolvTimeout [] end records = ress.map { |r| if r.exchange.to_s > " " [r.exchange.to_s, IPSocket.getaddress(r.exchange.to_s), r.preference] end } records.compact } # not found, but could also mean network not work or it could mean one record doesn't resolve an address rescue SocketError [["example.com", "0.0.0.0", 1]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def lookup_addresses(data)\n return @servers\n end",...
[ "0.72260964", "0.68006635", "0.6715229", "0.65149075", "0.6442387", "0.64291066", "0.6422017", "0.6337928", "0.6286145", "0.6197908", "0.6160962", "0.6131886", "0.61203796", "0.6085998", "0.6052903", "0.60528857", "0.60113066", "0.6009343", "0.59252137", "0.59252137", "0.5909...
0.7079511
1
Returns Array of domain names for the MX'ers, used to determine the Provider
def domains @_domains ||= mxers.map { |m| Host.new(m.first).domain_name }.sort.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mxers\n return [[\"example.com\", \"0.0.0.0\", 1]] if @dns_disabled\n @mxers ||= Resolv::DNS.open { |dns|\n dns.timeouts = @config[:dns_timeout] if @config[:dns_timeout]\n\n ress = begin\n dns.getresources(@host, Resolv::DNS::Resource::IN::MX)\n rescue Resolv::Res...
[ "0.7769803", "0.73688036", "0.68674725", "0.68578917", "0.68419605", "0.68391347", "0.6824519", "0.6824519", "0.66841286", "0.6567077", "0.6529312", "0.6524236", "0.6504131", "0.6471549", "0.64657605", "0.6464087", "0.6423409", "0.63911474", "0.63420063", "0.6318703", "0.6295...
0.7608635
1
Returns an array of MX IP address (String) for the given email domain
def mx_ips return ["0.0.0.0"] if @dns_disabled mxers.map { |m| m[1] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_domain(emails)\n domains = self.config[:domain]\n unless domains.empty?\n domains.each do |domain|\n matches = emails.select { |email| email.end_with?(domain) }\n return matches[0] unless matches.empty?\n end\n end\n nil\...
[ "0.6654061", "0.65998554", "0.6545133", "0.64605814", "0.6434847", "0.6375987", "0.63697094", "0.61985236", "0.61593896", "0.6149395", "0.6089926", "0.6040338", "0.6037141", "0.603641", "0.6035576", "0.6023255", "0.6019754", "0.60193247", "0.5978092", "0.59775656", "0.5915322...
0.6416964
5
Simple matcher, takes an array of CIDR addresses (ip/bits) and strings. Returns true if any MX IP matches the CIDR or host name ends in string. Ex: match?(%w(127.0.0.1/32 0:0:1/64 .yahoodns.net)) Note: Your networking stack may return IPv6 addresses instead of IPv4 when both are available. If matching on IP, be sure to include both IPv4 and IPv6 forms for matching for hosts running on IPv6 (like gmail).
def matches?(rules) rules = Array(rules) rules.each do |rule| if rule.include?("/") return rule if in_cidr?(rule) else each { |mx| return rule if mx[:host].end_with?(rule) } end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_matches?(cidr)\n return false unless ip_address\n return cidr if !cidr.include?(\"/\") && cidr == ip_address\n if cidr.include?(\":\") && ip_address.include?(\":\")\n return cidr if NetAddr::IPv6Net.parse(cidr).contains(NetAddr::IPv6.parse(ip_address))\n elsif cidr.include?(\".\")...
[ "0.6298562", "0.60401964", "0.60239756", "0.5997556", "0.5867892", "0.5703985", "0.5483708", "0.5424113", "0.542022", "0.540652", "0.53899175", "0.5374391", "0.5339066", "0.51165015", "0.51151633", "0.51069385", "0.5102254", "0.50718075", "0.5043955", "0.50109875", "0.5004068...
0.61266226
1
Given a cidr (ip/bits) and ip address, returns true on match. Caches cidr object.
def in_cidr?(cidr) if cidr.include?(":") c = NetAddr::IPv6Net.parse(cidr) return true if mx_ips.find do |ip| next unless ip.include?(":") rel = c.rel NetAddr::IPv6Net.parse(ip) !rel.nil? && rel >= 0 end elsif cidr.include?(".") c = NetAddr::IPv4Net.parse(cidr) return true if mx_ips.find do |ip| next if ip.include?(":") rel = c.rel NetAddr::IPv4Net.parse(ip) !rel.nil? && rel >= 0 end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_matches?(cidr)\n return false unless ip_address\n return cidr if !cidr.include?(\"/\") && cidr == ip_address\n if cidr.include?(\":\") && ip_address.include?(\":\")\n return cidr if NetAddr::IPv6Net.parse(cidr).contains(NetAddr::IPv6.parse(ip_address))\n elsif cidr.include?(\".\")...
[ "0.7634483", "0.7518279", "0.7374481", "0.7040265", "0.6913255", "0.69130594", "0.68541366", "0.67743963", "0.6740349", "0.6701287", "0.66992307", "0.6671792", "0.6587289", "0.6532276", "0.6519469", "0.6379981", "0.6329001", "0.6233475", "0.61330307", "0.6045671", "0.6021734"...
0.7211214
3
Returns the best know bound so far
def best_bound Cbc_wrapper.Cbc_getBestPossibleObjValue(@cbc_model) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upper_bound; end", "def lower_bound\n return 0 if total == 0\n \n (\n phat + dist_sq/(2*total) - dist * Math.sqrt((phat*(1-phat)+dist_sq/(4*total))/total)\n ) / (\n 1+dist_sq/total\n )\n end", "def find_most_restricted_variable()\n\n\t# Set min value to a value larger than any dom...
[ "0.7231546", "0.6727688", "0.64462095", "0.6431171", "0.6296354", "0.6294586", "0.6234097", "0.62191814", "0.6212546", "0.61933553", "0.6173527", "0.60940933", "0.6089694", "0.60686463", "0.6050455", "0.6047223", "0.6044203", "0.5984949", "0.59802544", "0.5889689", "0.586045"...
0.7497053
0
PROPS collect_on_change : Bool? will call collect immediately on change show_name : String? string that will act as input "placeholder" model : Model model which property will be populated from input attr : String | Symbol property name of model that will be populated NOT ALL LISTED
def __component_will_update__ ref("#{self}").value = "" if props.reset_value == true super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(model, name, options={}, &block)\n @name = name\n @data_type = model.columns_hash[name.to_s].try(:type) || :string\n @show_in_details = true\n @show_in_table = true\n @show_in_filters = true\n @editable = true\n @formatter = data_type\n @display_name = name.to...
[ "0.5528445", "0.53706384", "0.5112481", "0.509029", "0.5052403", "0.50433165", "0.50139475", "0.49640507", "0.48944622", "0.48872784", "0.48815092", "0.48800686", "0.48602167", "0.48461372", "0.48389083", "0.4823592", "0.47954395", "0.4790896", "0.47890353", "0.47498092", "0....
0.0
-1
attr_accessor :first_name, :last_name, :active, :salary
def initialize(input_options) @first_name = input_options[:first_name] @last_name = input_options[:last_name] @salary = input_options[:salary] @active = input_options[:active] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(first_name, last_name, salary, input_active_status)\n @first_name = first_name\n @last_name = last_name\n @salary = salary\n @input_active_status = input_active_status\n end", "def initialize(name = \"Anonymous\", salary = 0.00)\n self.name = name\n self.salary = salary\n end",...
[ "0.7511463", "0.6694902", "0.6498958", "0.64319426", "0.64054424", "0.640376", "0.6398572", "0.6398336", "0.6349353", "0.63131523", "0.6313062", "0.6300117", "0.62847215", "0.61763656", "0.6162527", "0.6162059", "0.61590254", "0.61193126", "0.61166745", "0.60709727", "0.60416...
0.6256869
13
this is because the method has no condition that stops the recursion
def move(n, from_array, to_array) return if n <= 0 to_array << from_array.shift # this mutates both arrays move(n - 1, from_array, to_array) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive => nil", "def recursive_solution\n\n end", "def recursive?\n false\n end", "def keep_going; end", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def factorial(number)\n if number == 1 # <-- BASE CASE: scenario that...
[ "0.749367", "0.6645614", "0.60703903", "0.5898329", "0.58040154", "0.57347745", "0.5688968", "0.5675665", "0.5638845", "0.5625659", "0.5625659", "0.5624995", "0.5617702", "0.5599962", "0.5583336", "0.5565923", "0.55511", "0.55386376", "0.55038023", "0.5472968", "0.54631996", ...
0.0
-1
load csv data for training assumes presence of headers and the last column values is target
def load_and_train(csv_file_name, model_options) input_data = CSV.read(csv_file_name, headers: true) num_fields = input_data[0].length # last column is target # all other are features target = input_data.map{|a| a[num_fields-1]} features = input_data.map{|a| a.fields((0...num_fields-1))} return train(features, target, model_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_csv_full\n \n end", "def load\n CSV.foreach(@csv_file, headers: :first_row, header_converters: :symbol) do |row|\n @data << Employee.new(row)\n end\n end", "def csv_to_table\n\t\tpath = File.join(Rails.root, \"db/seed_data\")\n\t\tDir.foreach(path) do |file|\n\t\t\tif file.include?(\...
[ "0.6548948", "0.64488196", "0.64370525", "0.64366394", "0.64345247", "0.6195291", "0.61851364", "0.60919756", "0.6049555", "0.6040929", "0.5998817", "0.5996317", "0.5992205", "0.5959378", "0.5919423", "0.5887642", "0.5877887", "0.58435786", "0.583991", "0.58108413", "0.579696...
0.7678283
0
if you want to save the model to a file to use elsewhere
def persist_model(model) joblib.dump(model, 'model.pkl') model = joblib.load('model.pkl') return model end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_model( model )\n file = model_filename model\n file_path = File.join(Dir.home,'tempo', file)\n File.delete( file_path ) if File.exists?( file_path )\n\n File.open( file_path,'a' ) do |f|\n model.index.each do |m|\n f.puts YAML::dump( m.freeze_dry )\n ...
[ "0.75370204", "0.73609114", "0.7133512", "0.71055114", "0.7001215", "0.7001215", "0.7001215", "0.7001215", "0.7001215", "0.7001215", "0.7001215", "0.7001215", "0.68300104", "0.6820178", "0.6820178", "0.6761886", "0.6743333", "0.6698595", "0.66874003", "0.66589844", "0.6650628...
0.7129187
3
FIXME skylight doesn't like number of allocations. Let's microoptimize! (not tested) let's change the code path so that if we don't find the user or have an error we exit immediately.
def perform(user_id) # only get attributes we need return unless (user = User.find_by(id: user_id, active: true).select(:id, :authorization_fails)) spotify = RSpotify::User.new(user.settings.to_hash) begin recent_track_ids = [] spotify.recently_played(limit: 50).each do |track| recent_track_ids.push([track.id, track.played_at]) end SaveTracksWorker.perform_async(user.id, recent_track_ids, "streamed") if recent_track_ids.any? rescue RestClient::Unauthorized, RestClient::BadRequest user.increment!(:authorization_fails) # Deactivate user if we don't have the right permissions and if their authorization has failed a crap ton of times user.update_attribute(:active, false) if user.authorization_fails >= 10 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_check(_user)\n (printf(\"\\nUser must be > 3 chars\\n\") ; raise \"\\nErro no nome de utilizador tem de conter > 3 chars\\n\") if _user.size<4\nend", "def find_user\n puts \"Please enter your name.\"\n name_input = gets.chomp\n system \"clear\"\n actual_user = User.find_by(name: name_input)...
[ "0.6261021", "0.62511885", "0.62488157", "0.5969623", "0.59212244", "0.58927494", "0.58735675", "0.5862932", "0.58538383", "0.5845554", "0.58200455", "0.5810581", "0.5802702", "0.5799016", "0.5794826", "0.5779234", "0.57687086", "0.57426816", "0.5728405", "0.5726314", "0.5726...
0.0
-1
line number validation for docos record
def line_positive_and_gt_zero errors.add(:line, "Line number must be a positive number and greater than 0") if line.blank? || line.to_f < 0.01 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_line(filename, line_number, line_content)\n\t\tend", "def valid?(line)\n true\n end", "def potential_line?(filename, lineno); end", "def unimportant_missing_cr?(index, last_line, line); end", "def line_num; end", "def valid_line_for line, regexp\n @has_id_col = nil\n @line_id =...
[ "0.690153", "0.6790746", "0.6754078", "0.65600365", "0.6522424", "0.6430357", "0.63590103", "0.63590103", "0.63590103", "0.63590103", "0.63590103", "0.63590103", "0.63590103", "0.6355947", "0.6302293", "0.6258826", "0.6258585", "0.6258585", "0.6251169", "0.62435675", "0.61099...
0.6055428
22
GET /sights GET /sights.json
def index @sights = Sight.all p '---------------------' iran = Country.find_by_title_fa( 'ایران') p @inner_sights = City.where(country_id: iran.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sights = Sight.all\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n en...
[ "0.7501582", "0.74947554", "0.7355275", "0.6709973", "0.6678872", "0.66003513", "0.65973884", "0.65631694", "0.6522554", "0.6519411", "0.6479151", "0.64058834", "0.6387501", "0.63781774", "0.6328898", "0.6241085", "0.62332696", "0.6174793", "0.61653984", "0.6153594", "0.61132...
0.0
-1
GET /sights/1 GET /sights/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n @sights = Sight.all\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def show\n @sighting = Sighting.find(params[:id])\n if @sighting\n rende...
[ "0.7377779", "0.7289196", "0.72182184", "0.67759264", "0.671965", "0.6686696", "0.6597406", "0.6580837", "0.65347695", "0.6359052", "0.6353892", "0.6349454", "0.63410234", "0.63272905", "0.6286595", "0.6251036", "0.6245386", "0.62126833", "0.62041175", "0.61806315", "0.615206...
0.0
-1
POST /sights POST /sights.json
def create @sight = Sight.new(sight_params) respond_to do |format| if @sight.save format.html { redirect_to @sight, notice: 'Sight was successfully created.' } format.json { render :show, status: :created, location: @sight } else format.html { render :new } format.json { render json: @sight.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n ...
[ "0.65492916", "0.6309055", "0.6250257", "0.6174766", "0.61281955", "0.6100779", "0.59748906", "0.58637434", "0.58273727", "0.5781141", "0.5736013", "0.5610694", "0.5560634", "0.5491858", "0.5491858", "0.5491858", "0.54893893", "0.5485493", "0.5459341", "0.543172", "0.53954583...
0.6497059
2
PATCH/PUT /sights/1 PATCH/PUT /sights/1.json
def update respond_to do |format| if @sight.update(sight_params) format.html { redirect_to @sight, notice: 'Sight was successfully updated.' } format.json { render :show, status: :ok, location: @sight } else format.html { render :edit } format.json { render json: @sight.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update\n if @sighting.update(sighting_params)\n render json: @sighting, status: :ok, location: @sighting\n ...
[ "0.64020216", "0.62485886", "0.6225763", "0.6199033", "0.6187144", "0.6176084", "0.6174826", "0.6167634", "0.6165028", "0.6147707", "0.6120886", "0.610215", "0.60817647", "0.6080629", "0.6072858", "0.60704476", "0.6069625", "0.606936", "0.6061251", "0.60567856", "0.6040478", ...
0.63823396
2
DELETE /sights/1 DELETE /sights/1.json
def destroy @sight.destroy respond_to do |format| format.html { redirect_to sights_url, notice: 'Sight was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @sighting = Sighting.find(params[:id])\n @sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to sightings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sour = @swit.sours.f...
[ "0.66813093", "0.6663661", "0.66383165", "0.6608746", "0.65466124", "0.6497393", "0.6489694", "0.6463662", "0.6455533", "0.64445704", "0.6421852", "0.6416876", "0.64084643", "0.64076173", "0.6399572", "0.6399572", "0.6388052", "0.6364104", "0.6356043", "0.63558793", "0.635139...
0.70787644
0
Use callbacks to share common setup or constraints between actions.
def set_sight @sight = Sight.friendly.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 sight_params params.require(:sight).permit(:title_fa, :title_en, :title_ar, :text_fa, :text_en, :text_ar, :city_id, photos_attributes: [:id, :image, :description_fa, :description_en, :description_ar, :sight_id, :_destroy, :_update] ) 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
work method receives message payload in raw format in our case it is JSON encoded string which we can pass to RecentPosts service without changes
def work(raw_event) event = JSON.parse(raw_event) EventManager.new.handle_event(event) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payload; message[:payload]; end", "def message_content\n JSON.parse(body).with_indifferent_access\n end", "def work(raw_post)\n email_params = JSON.parse(raw_post).with_indifferent_access\n send_simple_message(params)\n ack! # we need to let queue know that message was received\n end", "def...
[ "0.6269668", "0.61361134", "0.61132133", "0.5968319", "0.59393746", "0.5938449", "0.5887848", "0.5837939", "0.57821053", "0.5767772", "0.57567024", "0.5673264", "0.5659978", "0.56574976", "0.56304646", "0.56304646", "0.56197244", "0.5609312", "0.558436", "0.5518166", "0.55153...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_grant @grant = Grant.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
Only allow a trusted parameter "white list" through.
def grant_params params.require(:grant).permit(:user_id, :entry_id, :status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
GET /public_speakers GET /public_speakers.json
def index @public_speakers = PublicSpeaker.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @speakers = active_conference.speakers.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { speakers: json_attr(@speakers) }, :except => exceptions }\n format.js { render json: { speakers: json_attr(@speakers) }, :except => excepti...
[ "0.74441445", "0.71665287", "0.71665287", "0.6699242", "0.6529839", "0.6454885", "0.6354235", "0.63495004", "0.6316201", "0.6272479", "0.6213464", "0.6204027", "0.6197509", "0.6182698", "0.6181922", "0.6171502", "0.6138858", "0.61205107", "0.61120766", "0.6081198", "0.6029987...
0.80641097
0
GET /public_speakers/1 GET /public_speakers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @public_speakers = PublicSpeaker.all\n end", "def index\n @speakers = active_conference.speakers.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { speakers: json_attr(@speakers) }, :except => exceptions }\n format.js { ren...
[ "0.7689399", "0.7258227", "0.7105594", "0.7105594", "0.66959506", "0.6667026", "0.6606925", "0.66004616", "0.65069395", "0.6416742", "0.6392366", "0.62109464", "0.61796474", "0.6171838", "0.6171838", "0.6160914", "0.6155032", "0.61524487", "0.61054504", "0.61054504", "0.61010...
0.0
-1
POST /public_speakers POST /public_speakers.json
def create @public_speaker = PublicSpeaker.new(public_speaker_params) respond_to do |format| if @public_speaker.save format.html { redirect_to @public_speaker, notice: 'Public speaker was successfully created.' } format.json { render :show, status: :created, location: @public_speaker } else format.html { render :new } format.json { render json: @public_speaker.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n authorize! :create, Speaker\n @speaker = Speaker.new(speaker_params)\n \n respond_to do |format|\n if @speaker.save\n format.html { redirect_to admin_speakers_path, notice: 'Speaker was successfully created.' }\n format.json { render :show, status: :created, location: @...
[ "0.679476", "0.6698796", "0.6603757", "0.64131886", "0.6345205", "0.63059014", "0.6251582", "0.6231385", "0.6157938", "0.6148494", "0.60655177", "0.6006639", "0.5976942", "0.5976942", "0.5969508", "0.59653515", "0.58567536", "0.5842279", "0.58138394", "0.5802602", "0.57800585...
0.71254313
0
PATCH/PUT /public_speakers/1 PATCH/PUT /public_speakers/1.json
def update respond_to do |format| if @public_speaker.update(public_speaker_params) format.html { redirect_to @public_speaker, notice: 'Public speaker was successfully updated.' } format.json { render :show, status: :ok, location: @public_speaker } else format.html { render :edit } format.json { render json: @public_speaker.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @speaker = Speaker.find(params[:id])\n\n respond_to do |format|\n if @speaker.update_attributes(params[:speaker])\n format.html { redirect_to @speaker, notice: 'Speaker was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"...
[ "0.6928071", "0.6755097", "0.65320855", "0.6481286", "0.6354716", "0.6136915", "0.60430366", "0.6038923", "0.6032793", "0.5967451", "0.59585786", "0.59473795", "0.5944935", "0.5906165", "0.587676", "0.5871041", "0.58366483", "0.583497", "0.5795051", "0.57906836", "0.57871705"...
0.7040932
0
DELETE /public_speakers/1 DELETE /public_speakers/1.json
def destroy @public_speaker.destroy respond_to do |format| format.html { redirect_to public_speakers_url, notice: 'Public speaker was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @speaker = Speaker.find(params[:id])\n @speaker.destroy\n\n respond_to do |format|\n format.html { redirect_to speakers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @event_speaker.destroy\n respond_to do |format|\n format.html { redirect_to event_s...
[ "0.7492835", "0.728577", "0.72574276", "0.69779444", "0.697726", "0.6960967", "0.6908722", "0.68955004", "0.6885225", "0.68336165", "0.68006325", "0.68006325", "0.6761824", "0.6759822", "0.6753229", "0.67101413", "0.67079705", "0.6697022", "0.6683471", "0.667432", "0.6671458"...
0.76341957
0
Use callbacks to share common setup or constraints between actions.
def set_public_speaker @public_speaker = PublicSpeaker.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 public_speaker_params params.fetch(:public_speaker, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
This method should initialize the contact's attributes
def initialize(first_name, last_name, email, note = 'Nothing to note...yet.') @first_name = first_name @last_name = last_name @email = email @note = note @id = @@id @@id += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize #what attritubes\n\t\t@contacts = []\n\tend", "def initialize(attrs)\n super\n @ccapi = Ccontact.new()\n end", "def initialize contact_data\n #@message = message\n @contact_data = contact_data\n @type = type\n end", "def initialize(first_name, last_name, contact)\n\t\tsuper(fi...
[ "0.77149975", "0.7652614", "0.7594466", "0.7484944", "0.74375844", "0.7238327", "0.69206494", "0.68583614", "0.6828737", "0.68135303", "0.6807364", "0.6799754", "0.6706145", "0.6706145", "0.6690006", "0.6655524", "0.65979254", "0.6543551", "0.6477403", "0.647317", "0.647317",...
0.0
-1
This method should allow you to specify 1. which of the contact's attributes you want to update 2. the new value for that attribute and then make the appropriate change to the contact
def update(update_contact) found_contact = false @@contact_list.each do |info| if info == update_contact found_contact = true puts "Would you like to change the \'first name\', \'last name\', \'email\', or \'note\'? Please type it in below as one of the four choices. Please mind your spelling." answer = gets.chomp.downcase.to_s if answer == "first name" puts "What would you like to change the first name to?" @first_name = gets.chomp.to_s elsif answer == "last name" puts "What would you like to change the last name to?" @last_name = gets.chomp.to_s elsif answer == "email" puts "What would you like to change the email to?" @email = gets.chomp.to_s elsif answer == "note" puts "What would you like to change the note to?" @note = gets.chomp.to_s else puts "Your answer is invalid. Start over" break end end if found_contact == false puts "Your contact doesn't exist in your list." end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_contact(attribute_to_modify,contact_to_modify,new_value)\n\t\tif attribute_to_modify == \"id\" \n\t\t\t@database_array[@database_array.index {|x| \n\t\t\t\tcontact_to_modify==x.id||contact_to_modify==x.first_name||contact_to_modify==x.last_name||\n\t\t\t\tcontact_to_modify==x.email}].id = new_value\n\t\...
[ "0.7672399", "0.73870784", "0.73227787", "0.72729987", "0.71947646", "0.7194517", "0.7187717", "0.7133679", "0.7112021", "0.7104338", "0.70652664", "0.70529735", "0.70335096", "0.7025393", "0.7016715", "0.69919854", "0.69796723", "0.69766676", "0.6964968", "0.6939685", "0.692...
0.0
-1
This method should delete the contact HINT: Check the Array class docs for builtin methods that might be useful here
def delete @@contact_list.delete(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contact_delete(_args)\n raise NotImplementedError, 'Contacts are deleted with a garbage collector'\n end", "def delete\n\t\t#@@contacts -= [delete_id.to_i]\n\t\t@@contacts.delete(self)\n\tend", "def delete\n MoxiworksPlatform::Contact.delete(self.to_hash)\n end", "def delete\n @@contac...
[ "0.7630814", "0.76106274", "0.7607613", "0.7534675", "0.7534675", "0.7520688", "0.7438578", "0.7379505", "0.71864283", "0.7183316", "0.7129116", "0.7046041", "0.6978682", "0.6881417", "0.6848166", "0.6811091", "0.67802566", "0.66997105", "0.6692835", "0.6664411", "0.6620641",...
0.7454917
6
It is already tested so we can use it verify that everything parsed by the BasicRuleParser is the same as what is expected to be parsed.
def build(rule) Expr.build ArithmeticParser.new.parse(rule).to_sexp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parser_run\n Yay::PARSER_TESTS.each_pair { |input, expected|\n parser = Yay::Parser.new\n assert_equal expected, parser.parse(input), \"For |#{input}|\"\n }\n end", "def test_parser_valid_data\n \n assert Yay::PARSER_TESTS.kind_of? Hash\n\n Yay::PARSER_TESTS.each_pair { |input,...
[ "0.6261998", "0.618629", "0.618382", "0.6136477", "0.5908358", "0.5739664", "0.5647162", "0.5640814", "0.5625746", "0.5571209", "0.5559974", "0.54800445", "0.54436076", "0.54332495", "0.5401314", "0.5360046", "0.53328955", "0.53250486", "0.53154945", "0.5302139", "0.5296048",...
0.0
-1
We skip check when: adapter is not PostgreSQL column is not a primary key column type is not "uuid"
def preconditions ActiveRecord::VERSION::MAJOR >= 6 && Helper.postgresql? && primary_field? && column.sql_type.to_s.match(TARGET_COLUMN_TYPE) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_key(name, type = :primary_key, options = {})\n return super unless type == :uuid\n options[:default] = options.fetch(:default, 'uuid_generate_v4()')\n options[:primary_key] = true\n column name, type, options\n end", "def primary_key(name, type = :primary_ke...
[ "0.6528415", "0.6528415", "0.64169097", "0.6408489", "0.63957065", "0.6390777", "0.63812244", "0.6268343", "0.6216106", "0.620462", "0.6201972", "0.6121315", "0.6068474", "0.60188895", "0.59778064", "0.59676254", "0.59676254", "0.5856957", "0.5841608", "0.5838275", "0.5809111...
0.5308668
55
Table of possible statuses | defined `self.implicit_order_column` | status | | | | | yes | ok | | no | fail |
def check if implicit_order_column_defined? report_template(:ok) else report_template(:fail, error_slug: :implicit_order_column_missing) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def statuses\n return ['canceled', 'completed'] if self.status == 'paid'\n return ['canceled', 'paid'] if self.status == 'ordered'\n end", "def item_statuses\n # The previous mapping wasn't always in order\n # I18n.t(:history_actions).map { |key, value| [ value ] } \n # Retrieve translations and ...
[ "0.5997369", "0.59369886", "0.59192723", "0.5785167", "0.56816334", "0.5674328", "0.56679463", "0.5638988", "0.56182736", "0.56030804", "0.55986977", "0.55874664", "0.55645907", "0.55519223", "0.5540606", "0.55318826", "0.549301", "0.54556584", "0.544782", "0.5440892", "0.543...
0.6513788
0
GET /missos def index
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @misses = Miss.all\n end", "def index\n @mk_missatges = MkMissatge.all\n end", "def index\n get('')\n end", "def index\n get\n end", "def index\n @misions = Mision.all\n\n end", "def index\n @imakokos = Imakoko.all\n end", "def index\n\t\trender :nothin...
[ "0.73620063", "0.6996202", "0.6936143", "0.65956795", "0.6500022", "0.63694924", "0.63674825", "0.63485575", "0.63057876", "0.6289216", "0.62851375", "0.6282412", "0.6266816", "0.62472564", "0.62219363", "0.62163657", "0.62163657", "0.62163657", "0.62163657", "0.62163657", "0...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_misso @misso = Misso.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 misso_params hash = params.require(:misso).permit(:nome, :local, :nv_dific_id, :equipe_id, :preco) hash[:pessoa_id] = current_pessoa.id hash 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
GET /secrets GET /secrets.json
def index @secrets = Secret.recentSecrets(current_user, params[:about], params[:recent_update_at])#Secret.secretsIndex(current_user,params[:about],params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_id)\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def get_secrets(opts = {})\n data, _status_code, _headers = get_secrets_with_http_info(opts)\n data\n end", "def fetch_c...
[ "0.76156896", "0.720761", "0.71654236", "0.7148222", "0.6775067", "0.6775067", "0.6691048", "0.66759294", "0.663107", "0.656196", "0.65137374", "0.6445375", "0.6442586", "0.64127403", "0.63760686", "0.63760686", "0.635499", "0.6353137", "0.62987596", "0.62722194", "0.6269698"...
0.5980265
35
GET /secrets/1 GET /secrets/1.json
def show @secret.comments_count = @secret.comments.count @secret.likes_count = @secret.likes.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(secret_id)\n request('/accounts/' + account_id + '/secrets/' + secret_id)\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def fetch_current_secrets\n json_string = `kubectl get secret #{main_secret_name} --namespace #{app} -o json`\n json = JSON.p...
[ "0.7539332", "0.7082062", "0.70477796", "0.67599916", "0.67599916", "0.670315", "0.6676875", "0.667457", "0.6601018", "0.65531147", "0.6532548", "0.6527032", "0.63857937", "0.6382962", "0.637792", "0.6372945", "0.63515157", "0.628913", "0.62763625", "0.62719166", "0.62548053"...
0.0
-1
POST /secrets POST /secrets.json
def create @secret = current_user.secrets.build(secret_params)#Secret.new(secret_params) if @secret.save render json: @secret else render json: @secret.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @secret = Secret.new(secret_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @secret.save\n...
[ "0.79052186", "0.6656255", "0.6278286", "0.62605655", "0.6067236", "0.6035597", "0.60023504", "0.5998299", "0.59966063", "0.5945092", "0.5815102", "0.57816106", "0.57814705", "0.57814705", "0.57814705", "0.57814705", "0.57716864", "0.57673424", "0.57609797", "0.5740678", "0.5...
0.69976556
1
PATCH/PUT /secrets/1 PATCH/PUT /secrets/1.json
def update if @secret.update_attributes(secret_params) head :no_content else render json: @secret.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_secret\n resource.refresh_secret!\n\n respond_to do |format|\n format.json { render json: { secret: resource.secret } }\n end\n end", "def update\n authorize @secret, :update?\n\n respond_to do |format|\n if @secret.update(secret_params)\n format.html { redirect_to @se...
[ "0.71715254", "0.6479084", "0.6286628", "0.62474865", "0.62433225", "0.6239415", "0.61859953", "0.611054", "0.61083305", "0.6106203", "0.60786355", "0.5938654", "0.59026676", "0.59026676", "0.58769846", "0.58601123", "0.58601123", "0.58601123", "0.58601123", "0.56886685", "0....
0.65574133
1
DELETE /secrets/1 DELETE /secrets/1.json
def destroy @secret.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'El secreto se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secr...
[ "0.7273255", "0.72180283", "0.70998955", "0.70969665", "0.7079347", "0.70308673", "0.6769372", "0.6699198", "0.6509284", "0.64598536", "0.64365274", "0.6364762", "0.6335682", "0.62828255", "0.6274715", "0.6274715", "0.6225649", "0.62182057", "0.62130076", "0.6195524", "0.6169...
0.7118528
2
Use callbacks to share common setup or constraints between actions.
def set_secret @secret = Secret.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 secret_params params.require(:secret).permit(:content, :media_url, :about) 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
Get measurement sources Returns a list of all the apps from which measurement data is obtained.
def sources_get(opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: SourceApi#sources_get ..." end # resource path path = "/sources".sub('{format}','json') # query parameters query_params = {} query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token'] query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id'] query_params[:'name'] = opts[:'name'] if opts[:'name'] query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at'] query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at'] query_params[:'limit'] = opts[:'limit'] if opts[:'limit'] query_params[:'offset'] = opts[:'offset'] if opts[:'offset'] query_params[:'sort'] = opts[:'sort'] if opts[:'sort'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['quantimodo_oauth2'] result = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'inline_response_200_15') if Configuration.debugging Configuration.logger.debug "API called: SourceApi#sources_get. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_data_sources\n data_sources = []\n if self.current_contexts.size == 1\n the_context = self.current_contexts.first\n if the_context != ContextEnum.either\n the_data_source = self.inherited_data_source\n if the_data_source == DataSourceNone # top l...
[ "0.670446", "0.66318625", "0.6600105", "0.6375633", "0.6314729", "0.6239487", "0.6229459", "0.6222233", "0.6149328", "0.6063685", "0.60613275", "0.6006255", "0.59657526", "0.59426415", "0.59351337", "0.5933328", "0.5874616", "0.58657897", "0.5856188", "0.58503675", "0.5849750...
0.0
-1
Add a data source Add a lifetracking app or device to the QuantiModo list of data sources.
def sources_post(opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: SourceApi#sources_post ..." end # resource path path = "/sources".sub('{format}','json') # query parameters query_params = {} query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['quantimodo_oauth2'] result = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'inline_response_200_16') if Configuration.debugging Configuration.logger.debug "API called: SourceApi#sources_post. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addSequenceSource(sequence)\n @dataSources << sequence\n self\n end", "def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end", "def set_data_source\n @data_source = DataSource.find(params[:id])\n ...
[ "0.7009449", "0.64844644", "0.600246", "0.600246", "0.58502954", "0.58149797", "0.57993233", "0.57776153", "0.5659464", "0.561825", "0.5616467", "0.555571", "0.5514733", "0.5457693", "0.5375382", "0.53632295", "0.53330773", "0.5295198", "0.5283649", "0.52794945", "0.5252288",...
0.0
-1
Get Source Get Source
def sources_id_get(id, opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: SourceApi#sources_id_get ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling sources_id_get" if id.nil? # resource path path = "/sources/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['quantimodo_oauth2'] result = @api_client.call_api(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'inline_response_200_16') if Configuration.debugging Configuration.logger.debug "API called: SourceApi#sources_id_get. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source\n @source\n end", "def source\n @source\n end", "def source\n ap get_source\n end", "def source\n return @source\n end", "def source\n return @source\n end", "def source_get\n db_select 'source'\n end", "def sour...
[ "0.80728537", "0.80728537", "0.8003991", "0.79949635", "0.79949635", "0.76412445", "0.7540375", "0.75396425", "0.74696505", "0.7430892", "0.74154466", "0.73840666", "0.73583317", "0.7348473", "0.7348473", "0.7345548", "0.7288631", "0.72776264", "0.72379345", "0.72315913", "0....
0.0
-1
Update Source Update Source
def sources_id_put(id, opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: SourceApi#sources_id_put ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling sources_id_put" if id.nil? # resource path path = "/sources/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['quantimodo_oauth2'] result = @api_client.call_api(:PUT, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'inline_response_200_2') if Configuration.debugging Configuration.logger.debug "API called: SourceApi#sources_id_put. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_to(new_source)\n update_deps_from(new_source)\n update_files_from(new_source)\n update_metadata_from(new_source)\n end", "def update(source)\n copy(source, false)\n end", "def update!(**args)\n @source = args[:source] if args.key?(:source)\n ...
[ "0.7915614", "0.7750891", "0.7727919", "0.7727919", "0.77086705", "0.77086705", "0.7275052", "0.71441185", "0.70799214", "0.7022591", "0.7002718", "0.697988", "0.69593495", "0.6935163", "0.6910442", "0.6885033", "0.6878815", "0.68641967", "0.6854614", "0.685441", "0.68446374"...
0.0
-1
Delete Source Delete Source
def sources_id_delete(id, opts = {}) if Configuration.debugging Configuration.logger.debug "Calling API: SourceApi#sources_id_delete ..." end # verify the required parameter 'id' is set fail "Missing the required parameter 'id' when calling sources_id_delete" if id.nil? # resource path path = "/sources/{id}".sub('{format}','json').sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token'] # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['quantimodo_oauth2'] result = @api_client.call_api(:DELETE, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'inline_response_200_2') if Configuration.debugging Configuration.logger.debug "API called: SourceApi#sources_id_delete. Result: #{result.inspect}" end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n result = Base.redis.hdel(:sources, name)\n if result == 1\n delete_all_inputs\n Log.info \"Deleting Source object from Redis: #{name}\"\n else\n raise UnknownSource, \"Cannot delete non-existent Source object in Redis: #{name}\"\n end\n result\n end", ...
[ "0.7708859", "0.73535496", "0.7245892", "0.721529", "0.721529", "0.72146815", "0.72123003", "0.72123003", "0.72123003", "0.72123003", "0.7077893", "0.70686287", "0.7039674", "0.69920254", "0.693424", "0.6789409", "0.6784225", "0.6763639", "0.6750461", "0.6693524", "0.66465425...
0.6406396
40
Apparently CPK forgot to override this method
def touch(name = nil) attributes = timestamp_attributes_for_update_in_model attributes << name if name unless attributes.empty? current_time = current_time_from_proper_timezone changes = {} attributes.each do |column| changes[column.to_s] = write_attribute(column.to_s, current_time) end changes[self.class.locking_column] = increment_lock if locking_enabled? @changed_attributes.except!(*changes.keys) primary_key = self.class.primary_key #CPK #self.class.unscoped.update_all(changes, {primary_key => self[primary_key]}) == 1 where_clause = Array.wrap(self.class.primary_key).inject({}) { |hsh, key| hsh[key] = self[key]; hsh } self.class.unscoped.where(where_clause).update_all(changes) == 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def custom; end", "def custom; end", "def implementation; end", "def implementation; end", "def internal; end", "def overrides; end", "def tag; raise 'Override this method'; end", "def getc\n raise NotImplementedError\n end", "def probers; end", "def private_method\n...
[ "0.73985547", "0.6547246", "0.6547246", "0.647419", "0.647419", "0.6399421", "0.63377523", "0.622174", "0.616242", "0.6162149", "0.6060471", "0.6055866", "0.600114", "0.59578", "0.5911875", "0.5911875", "0.5911875", "0.588856", "0.58807623", "0.5862126", "0.5849963", "0.582...
0.0
-1