Top Level Namespace

Includes:
Wuclan::Grok::TweetRegexes, Wuclan::Models, Wukong::Datatypes

Defined Under Namespace

Modules: TwitterApi, TwitterFriends, Wuclan Classes: FoBin, FrBin, JsonTweetWithUser, JsonUserWithTweet, NbhdBalBin, NbhdSizeBin, TinyInt, TwDayBin, TwDayRecentBin, TwitterFakeFetcher, TwitterRequestStream, TwitterSearchFakeFetcher, TwitterSearchJob, TwitterSearchRequestStream

Constant Summary collapse

TWEETS_SAMPLED_FRACTION =

Sampling Multiplier

2.62

Constants included from Wuclan::Models

Wuclan::Models::USER_SCRAPING_CONTEXTS

Instance Method Summary collapse

Instance Method Details

#from_html(html_colour) ⇒ Object

File lib/color/rgb.rb, line 45



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wuclan/twitter/model/twitter_user/style/color_to_hsv.rb', line 12

def from_html(html_colour)
  html_colour = html_colour.gsub(%r{[#;]}, '')
  case html_colour.size
  when 3
    colours = html_colour.scan(%r{[0-9A-Fa-f]}).map { |el| (el * 2).to_i(16) }
  when 6
    colours = html_colour.scan(%r<[0-9A-Fa-f]{2}>).map { |el| el.to_i(16) }
  else
    raise ArgumentError
  end
  colours
end

#octave3(i) ⇒ Object



20
21
22
# File 'lib/wuclan/metrics/user_metrics.rb', line 20

def octave3 i
  10.0 ** round1(i.to_f / 3.0)
end

#round1(f) ⇒ Object



17
18
19
# File 'lib/wuclan/metrics/user_metrics.rb', line 17

def round1 f
  (10 * f.to_f).round / 10.0
end

#to_hsl(r, g, b) ⇒ Object

File lib/color/rgb.rb, line 167



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/wuclan/twitter/model/twitter_user/style/color_to_hsv.rb', line 27

def to_hsl r, g, b
  min   = [ r, g, b ].min
  max   = [ r, g, b ].max
  delta = (max - min).to_f

  lum   = (max + min) / 2.0

  if delta <= 1e-5  # close to 0.0, so it's a grey
    hue = 0
    sat = 0
  else
    if (lum - 0.5) <= 1e-5
      sat = delta / (max + min).to_f
    else
      sat = delta / (2 - max - min).to_f
    end

    if r == max
      hue = (g - b) / delta.to_f
    elsif g == max
      hue = (2.0 + b - r) / delta.to_f
    elsif (b - max) <= 1e-5
      hue = (4.0 + r - g) / delta.to_f
    end
    hue /= 6.0

    hue += 1 if hue < 0
    hue -= 1 if hue > 1
  end
  [ hue, sat, lum ]
end