From 161e337d04f03bff0ef024df50e2a28e629a2135 Mon Sep 17 00:00:00 2001 From: Mattias Ottosson Date: Fri, 23 Mar 2012 13:34:35 +0100 Subject: [PATCH] Whitespace cleanup dance --- config.yaml.sample | 6 +++--- lib/emoji_optimizer.rb | 40 ++++++++++++++++++++-------------------- public/index.html | 8 ++++---- public/libs.min.js | 8 ++++---- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/config.yaml.sample b/config.yaml.sample index 57de755..d939205 100644 --- a/config.yaml.sample +++ b/config.yaml.sample @@ -1,4 +1,4 @@ s3: - access_key_id: - secret_access_key: - bucket: + access_key_id: + secret_access_key: + bucket: diff --git a/lib/emoji_optimizer.rb b/lib/emoji_optimizer.rb index d054737..28fd7ba 100644 --- a/lib/emoji_optimizer.rb +++ b/lib/emoji_optimizer.rb @@ -6,7 +6,7 @@ module Emoji def self.tmp_dir @tmp_dir ||= Dir.mktmpdir 'emoji-optimization' end - + class Optimizer def initialize options = {} @@ -15,11 +15,11 @@ module Emoji @source = Source.new 'public/index.html' @sprite = Sprite.new @source.emoji_paths, @size, @padding end - + def optimize! &block - puts " ** Preparing for optimization" + puts " ** Preparing for optimization" prepare - + puts " ** Generating emoji sprite image" if @sprite.generate sprite_path puts " ** Generating css and updating markup" @@ -30,18 +30,18 @@ module Emoji yield - ensure + ensure puts " ** Cleaning up after optimization" cleanup end - + private - + def prepare FileUtils.cp 'public/index.html', File.join(Emoji.tmp_dir, 'index.html') FileUtils.cp 'public/emoji.css', File.join(Emoji.tmp_dir, 'emoji.css') end - + def generate_and_save update_source_markup @@ -49,7 +49,7 @@ module Emoji File.open('public/index.html','w') { |f| f.write @source.to_html } FileUtils.mv sprite_path, "public/graphics/#{digest_name}" end - + def cleanup FileUtils.mv File.join(Emoji.tmp_dir, 'index.html'), 'public/index.html' FileUtils.mv File.join(Emoji.tmp_dir, 'emoji.css'), 'public/emoji.css' @@ -58,7 +58,7 @@ module Emoji def css_rules [].tap do |rules| - rules << %Q{ + rules << %Q{ .emoji { display:inline-block; width:#{@size}px; @@ -81,10 +81,10 @@ module Emoji } end end - + def css_sprite_mapping index offset = @sprite.offset index - "#e_#{index+1} { background-position:-#{offset}px 0; }" + "#e_#{index+1} { background-position:-#{offset}px 0; }" end def sprite_path @@ -96,13 +96,13 @@ module Emoji end end - + class Source def initialize file @file = file end - + def emojis @emojis ||= doc.css('#content img').find_all { |img| img['src'] =~ /emojis/ } end @@ -110,17 +110,17 @@ module Emoji def emoji_paths @emoji_paths ||= emojis.map { |img| File.join 'public', img['src'] } end - + def create_element *args doc.create_element *args end - + def to_html doc.to_html end - + private - + def doc @doc ||= Nokogiri::HTML File.open(@file) end @@ -136,7 +136,7 @@ module Emoji end def offset index - ((@size + @padding * 2) * index) + @padding + ((@size + @padding * 2) * index) + @padding end def generate path @@ -149,7 +149,7 @@ module Emoji system "montage %s %s %s" % [ @files.join(' '), args, path ] optimize!(path) end - + private def optimize!(path) diff --git a/public/index.html b/public/index.html index da95af9..80149f8 100644 --- a/public/index.html +++ b/public/index.html @@ -24,11 +24,11 @@

Emoji cheat sheet

- Emoji emoticons are supported on - Campfire, - GitHub, + Emoji emoticons are supported on + Campfire, + GitHub, Basecamp Next - and Turntable.fm.
+ and Turntable.fm.
However some of the emoji codes are not super easy to remember, so here is a little cheat sheet.
Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

diff --git a/public/libs.min.js b/public/libs.min.js index 504db87..59b1b7d 100644 --- a/public/libs.min.js +++ b/public/libs.min.js @@ -1,14 +1,14 @@ /* * jNotify jQuery Plug-in * - * Copyright 2010 Giva, Inc. (http://www.givainc.com/labs/) - * + * Copyright 2010 Giva, Inc. (http://www.givainc.com/labs/) + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.