Here's an example of how to embed a Gist on GitHub Pages:
{% gist 5555251 %}
All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.
| # Requires ImageMagick | |
| # Converting the source from JPEG to PNG - if necessary | |
| convert my_src_image.jpg my_src_image.png | |
| # Option A | |
| # - Requires a temporary intermediate file | |
| # - Drill more than 10 might result in poor results |
Here's an example of how to embed a Gist on GitHub Pages:
{% gist 5555251 %}
All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'JSON' | |
| require 'digest/sha2' | |
| require 'pry' | |
| require 'bigdecimal' | |
| require 'bitcoin' # Because I need to cheat every now and then | |
| # Usage: | |
| # gem install pry json ffi ruby-bitcoin |
| # | |
| # see http://johnmacfarlane.net/pandoc/epub.html | |
| # | |
| # perl -i -0pe 's/^Insert\s*(.*)\.png\s*\n([^\n]*)$/!\[\2](..\/figures\/\1-tn.png)/mg' */*.markdown | |
| # | |
| # converted to "verbose" ruby | |
| # encoding: UTF-8 | |
| Dir['*/*.markdown'].each do |filename| |
| source :rubygems | |
| # We are not loading Active Record, nor Active Resources etc. | |
| # We can do this in any app by simply replacing the rails gem | |
| # by the parts we want to use. | |
| gem "actionpack", "~> 4.0" | |
| gem "railties", "~> 4.0" | |
| gem "tzinfo" | |
| # Let's use thin |
A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.
Running a local server for testing purposes:
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| require 'benchmark' | |
| require 'set' | |
| def to_boolean_eq(value) | |
| value == true || value == 'true' || value == 1 || value == '1' || value == 't' | |
| end | |
| def to_boolean_equal(value) | |
| value === true || value === 'true' || value === 1 || value === '1' || value === 't' | |
| end |
| def prepare_files | |
| unless File.exists?('original') && File.file?('original') && File.readable?('original') | |
| abort('There is not `original` file in current directory.') | |
| end | |
| File.delete('yaml') if File.exists?('yaml') | |
| [File.open('original'), File.new('yaml', 'w+')] | |
| end | |
| def translate_to_yml(original, yaml) | |
| original.each_line do |line| |
A short and very unscientific comparison of the performance of HexaPDF to other PDF utilities when reading, eventually optimizing and then writing a file.
When available, multiple compression modes are compares:
C - Compacting by removing unused and deleted objectsS - Usage of object and cross-reference streamsP - Recompression of page content streamsFor the HexaPDF tests, the hexapdf binary was used with different options for the optimization command: