Skip to content

Instantly share code, notes, and snippets.

@ufeanei
ufeanei / gist:336309e86e9ef1ff7439
Created December 17, 2015 13:49
octal challenge
class Octal
attr_accessor :octnum
def initialize(num)
@octnum = num
end
def not_valid?
octnum == '0' || octnum =~ /[A-Fa-f8-9]/
end
@ufeanei
ufeanei / gist:53255767d3664a0904c898d08518426e
Last active September 11, 2021 20:37
Mongo aggregation grouping by categories then grouping by subcategories
consider the collection shown below
[
{
_id: 1,
category: "A",
subCategory: "a1",
},
{