prettyprint กับ bootstrap-wysiwyg DIY

ไม่มีอะไรมาก ใช้มุก replace

            <script>
                jQuery(function($) {
                    $('#article_body_editor').on('keyup keypress blur change', function() {
                        article_body_editor = $('#article_body_editor').html()
                            .replace(/\[prettyprint\]/g, '<pre class="prettyprint">')
                            .replace(/\[prettyprint linenums\]/g, '<pre class="prettyprint linenums">')
                            .replace(/\[\/prettyprint\]/g, '</pre>')
                            .replace(/\[code\]/g, '<code>')
                            .replace(/\[\/code\]/g, '</code>');
                        $('#article_body').val(article_body_editor);
                    });
                });
            </script>

Fix Paperclip: “has an extension that does not match its content” error on windows

เพิ่มบรรทัดด้านล่าง config/environments/development.rb

Paperclip.options[:command_path] = "C:/Program Files/ImageMagick-6.8.9-Q16/"


เพิ่มไฟล์ config/initializers/paperclip.rb
require 'paperclip/media_type_spoof_detector'
module Paperclip
  class MediaTypeSpoofDetector
    def spoofed?
      false
    end
  end
end

paperclips fix : has an extension that does not match its contents

ระหว่างทำ gallery เจอ error message ว่า
has an extension that does not match its contents
แต่... บน ubuntu ไม่เป็น งงเบย เป็นเฉพาะ windows
สร้างไฟล์ config/initializers/paperclips.rb
require 'paperclip/media_type_spoof_detector'
module Paperclip
  class MediaTypeSpoofDetector
    def spoofed?
      false
    end
  end
end

ยังไม่จบ แก้ไฟล์ config/enviroments/development.rb (สำหรับ run แบบ development)
...
Paperclip.options[:command_path] = "C:/Program Files/ImageMagick-6.8.9-Q16/"
...

ibatt's blog version3

ทำเล่น ทำหัว มาเรื่อยๆ ตอนนี้มาถึง version 3 แล้ว

ปรับปรุง ปรับเปลี่ยน มาเรื่อยๆ ตาม technology
ยังทำตามจุดประสงค์เดิม คือ จดแล้วแบ่ง ...

และ version 3 นี้ ยังใช้ Ruby on Rails เหมือนเดิม

version 1


version 2