Skip to content

diclophis/centerology

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Models
  Person
    nickname
    email
    site
    has_many :images :through => :findings

  Image
    title
    src
    exif

  Finding
    person_id
    image_id
    note
    position
    private



"quoted from" / "via"
"first found by"


How many other people have saved this image 

"most active people"
"recent active people"

"flag image as bad"

"popular images $date"

"recent images $date"
"recent images from $person"
"recent images from $domain"

"popular tags"
"infinite scroll"


# finders
user.friends_for_me
user.friends_by_me
user.pending_friends_for_me
user.pending_friends_by_me
user.friends
user.pending_friends
user.pending_or_accepted_friends
user.friendship friend

# testers
user.is_friends_with? friend
user.is_pending_friends_with? friend
user.is_friends_or_pending_with? friend

# crud
user.request_friendship_with friend
user.delete_friendship_with friend
user.accept_friendship_with friend
user.become_friends_with! friend
<h1>
  Welcome to Centerology
</h1>

You are: <%=@current_person.nickname%>
<br/>

You have: <%=@current_person.images.length%>

<% tag_cloud(@current_person.findings.tag_counts, %w(css1 css2 css3 css4)) do |tag, css_class| %>
  <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class => css_class %>
<% end %>

<% form_tag({:controller => :findings, :action => :create}) do %>
  <%=text_field_tag(:title)%>
  <%=text_field_tag(:src)%>
  <%=text_field_tag(:tag_list)%>
  <%=submit_tag(:go)%>
<% end %>

<br/>

<% form_tag({:controller => :findings, :action => :duplicate}) do %>
  <%=text_field_tag(:image_id)%>
  <%=text_field_tag(:tag_list)%>
  <%=submit_tag(:go)%>
<% end %>

<% Image.find(:all).each { |image| %>
  <%=image.findings.first.person.nickname%>
<% } %>

<%=Person.find(:all, :include => :findings)%>

<%=h(@recent_images.inspect)%>

<%=will_paginate(@recent_images)%>


mysql> SELECT people.id FROM `findings` JOIN people ON people.id = findings.person_id ORDER BY findings.created_at DESC LIMIT 0, 10;
+----+
| id |
+----+
|  1 |
|  2 |
|  2 |
|  2 |
|  2 |
|  2 |
|  2 |
|  2 |
|  2 |
|  2 |
+----+
10 rows in set (0.00 sec)

mysql> SELECT DISTINCT people.id FROM `findings` JOIN people ON people.id = findings.person_id ORDER BY findings.created_at DESC LIMIT 0, 10;
+----+
| id |
+----+
|  2 |
|  1 |
+----+
2 rows in set (0.00 sec)

            <div class="similar">
              <ul>
                <li>
                  <p>
                    is similar to...
                  </p>
                </li>
                <% ImageSeek.find_images_similar_to(1, image.id, 3).each { |image_id, similarity| %>
                  <li>
                    <%=image_tag(Image.find(image_id).icon_permalink) unless image.id == image_id%>
                  </li>
                <% } %>
              </ul>
            </div>

            <!--
            <div class="similar">
              <ul>
                <li>
                  <p>
                    is similar to...
                  </p>
                </li>
                <% ImageSeek.find_images_similar_to(1, image.id, 3).each { |image_id, similarity| %>
                  <li>
                    <%=image_tag(Image.find(image_id).icon_permalink) unless image.id == image_id%>
                  </li>
                <% } %>
              </ul>
            </div>
            -->
            <!--
            <div class="similar">
              <ul>
                <li>
                  <p>
                    <%=image.findings.first.person.nickname%> recently found...
                  </p>
                </li>
                <% image.findings.first.person.last_three_images.each { |latest_image_from_person| %>
                  <li>
                    <%=image_tag(latest_image_from_person.icon_permalink) unless image.id == latest_image_from_person.id%>
                  </li>
                <% } %>
              </ul>
            </div>
            -->
            <li>
              <% if image.findings.count > 1 then %>
                found by <%=image.findings.count%> other people
              <% end %>
            </li>
            <li>
              <% unless image.findings.first.tag_list.blank? then %>
                <%=image.findings.first.person.nickname%>
                tagged this as
                <% image.findings.first.tags.each { |tag| %>
                  <%=link_to(tag.name, {:controller => :findings, :action => :tagged, :id => tag.name})%>
                <% } %>
              <% end %>
            </li>

This is Google's cache of http://artcode.sajonara.de/index.php?tag=most-tagged. It is a snapshot of the page as it appeared on Jun 24, 2008 07:59:09 GMT. The current page could have changed in the meantime. Learn more

Text-only version
These search terms are highlighted: acts_as_taggable_on_steroids tag_counts font size log  
Art at Code

No frolf, no city planning, no marine biology
acts_as_taggable_on_steroids (and zinc) - font size calculation

Jul 14, 2007 in Plugins, Rails | wong it!

Most of you know acts_as_taggable and acts_as_taggable_on_steroids. The last one provides support for tag clouds. But there ist no support for font size calculation.

I don’t want to fork the project so if you need font size calculation just copy & paste the following code somewhere inside the “module SingletonMethods” of your acts_as_taggable_on_steroids plugin (vendor/acts_as_taggable_on_steroids/lib/acts_as_taggable.rb).
def tag_cloud_with_font_size(min_font_size, options={})
  tags = tag_counts(options)
         
  number_of_tags = tags.length
  number_of_tag_instances = 0
  tags.each do |tag|
    number_of_tag_instances += tag.count
  end
  avarage_tag_instances = (number_of_tag_instances / number_of_tags).to_f
         
  tags_with_font_size = tags.map do |tag|
    instances_of_this_tag = tag.count
    font_size = min_font_size
    instance_deviation = (instances_of_this_tag - avarage_tag_instances).to_f
    font_size_deviation = (2.5 * Math.log( 1 + instance_deviation.abs ) ).round.to_i
    if instance_deviation > 0
      font_size += font_size_deviation
    elsif
      font_size -= font_size_deviation
    end
    {:tag => tag, :font_size => font_size}
  end         
end

Usage:
tag_cloud = Article.tag_cloud_with_font_size(11, :limit => 100)

tag_cloud.each do |t|
  link_to_tag(t[:tag], :style => 'font-size: #{t[:font_size]}px;')
end

This works like the method “tag_counts” except for the first parameter, which is the minimum font size.

Credit for the calculation belongs to akxl

      /*
        .<%=cloud_class%> { font-size: <%=(((i.to_f+1.0)/(cloud_classes.length-1)) * 100.0)%>%; }
      */
  <li>
    <% unless @image.findings.first.tag_list.blank? then %>
      <%=@image.findings.first.person.nickname%>
      tagged this as
      <% @image.findings.first.tags.each { |tag| %>
        <%=link_to(tag.name, {:controller => :findings, :action => :tagged, :id => tag.name})%>
      <% } %>
    <% end %>
  </li>
  select join_type, images.permalink, rimages.permalink, image_id, similar_image_id, rating from similarities join images on image_id=images.id join images as rimages on similar_image_id=rimages.id where join_type="and" group by image_id, similar_image_id order by rating desc limit 20;
  +-----------+--------------------------------------+--------------------------------------+-


person_id,image_id,finding_id,tag,rating

totally :highest_something_positive ? rank of positive higher than negative
definatly not :highest_something_not_negative
never :anything_else

18.68

About

a broken image bookmarking site

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published