<commit_before>module SocialButtons
  module Helper
    # Pinterest button
    # http://pinterest.com/about/goodies/
    def pin_it_button(options={})
      params = options.slice(:url, :media, :description)
      params[:url] ||= request.url
      img = tag :img, :src => "//assets.pinterest.com/images/PinExt.png", :title => "Pin It", :border => "0" 
      content_tag :a, img, "href" => "http://pinterest.com/pin/create/button/?#{params.to_query}", 
                                "class" => "pin-it-button",
                                "count-layout" => "none"
    end

    # Facebook like button
    # http://developers.facebook.com/docs/reference/plugins/like/
    def fb_like_button(options={})
      href = options[:url] || request.url
      params = options.slice(:layout, :send, :width, :height, :show_faces, :action, :colorscheme, :font, :appId)

      params = {
        :href => href,
        :layout => 'button_count',
        :send => false,
        :width => 450,
        :height => 21,
        :show_faces => false,
        :action => 'like', 
        :colorscheme => 'light',
        :font => 'verdana'
      }.merge(params)

      style = "border:none; overflow:hidden; width:#{params[:width]}px; height:#{params[:height]}px;"

      content_tag :iframe, '', :src => "//www.facebook.com/plugins/like.php?#{params.to_query}",
                               :scrolling => 'no',
                               :frameborder => 0,
                               :allowTransparency => true,
                               :style => style
    end

    # Twitter button
    # https://twitter.com/about/resources/buttons
    # Options: url, via, lang, size, related, hashtags, count
    def twitter_share_button(options={})
      options = Hash[options.map {|k, v| ["data-#{k}", v] }]
      options.merge!({:href => 'https://twitter.com/share', :class => 'twitter-share-button'})<commit_msg>use reverse_merge to merge options for facebook button<commit_after>module SocialButtons
  module Helper
    # Pinterest button
    # http://pinterest.com/about/goodies/
    def pin_it_button(options={})
      params = options.slice(:url, :media, :description)
      params[:url] ||= request.url
      img = tag :img, :src => "//assets.pinterest.com/images/PinExt.png", :title => "Pin It", :border => "0" 
      content_tag :a, img, "href" => "http://pinterest.com/pin/create/button/?#{params.to_query}", 
                                "class" => "pin-it-button",
                                "count-layout" => "none"
    end

    # Facebook like button
    # http://developers.facebook.com/docs/reference/plugins/like/
    def fb_like_button(options={})
      href = options[:url] || request.url
      params = options.slice(:layout, :send, :width, :height, :show_faces, :action, :colorscheme, :font, :appId)
      params.reverse_merge!({:href => href,
                             :layout => 'button_count',
                             :send => false,
                             :width => 450,
                             :height => 21,
                             :show_faces => false,
                             :action => 'like', 
                             :colorscheme => 'light',
                             :font => 'verdana'
                            })

      style = "border:none; overflow:hidden; width:#{params[:width]}px; height:#{params[:height]}px;"

      content_tag :iframe, '', :src => "//www.facebook.com/plugins/like.php?#{params.to_query}",
                               :scrolling => 'no',
                               :frameborder => 0,
                               :allowTransparency => true,
                               :style => style,
                               :class => 'fb-like-btn'
    end

    # Twitter button
    # https://twitter.com/about/resources/buttons
    # Options: url, via, lang, size, related, hashtags, count
    def twitter_share_button(options={})
      options = Hash[options.map {|k, v| ["data-#{k}", v] }]
      options.merge!({:href => 'https://twitter.com/share', :class => 'twitter-share-button'})
{'fraction_non_alphanumeric': 0.15847395451210564, 'fraction_numerical': 0.0034238200048911714, 'mean_word_length': 1.8521617852161785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 48, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4864872', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1164, 'n_words': 236}