This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Role.define "guest", | |
| :permissions => [:read_questions] | |
| Role.define "basic", | |
| :permissions => [:read_answers, :answer_questions] | |
| Role.define "premium", | |
| :parent => "basic", | |
| :permissions => [:hide_advertisements] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The Traveling Hacker -------------------- | |
| Today you will be building a tool for a travel agency that determines the | |
| total distance traveled on a tour with many stops. As luck would have it, some | |
| of the core functionality you need has already been implemented, and you won't | |
| need to worry about coding a mileage and routing system from scratch. | |
| But there's a catch: The mileage and routing system you'll be using lies on | |
| the other side of a service boundary, and only minimal work has been done on | |
| the client side. Essentially, all that has been written so far is a bit of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -module(ttfunk). | |
| -define(uint8, 8/unsigned-big-integer). | |
| -define(int8, 8/signed-big-integer). | |
| -define(uint16, 16/unsigned-big-integer). | |
| -define(int16, 16/signed-big-integer). | |
| -define(uint32, 32/unsigned-big-integer). | |
| -define(int32, 32/signed-big-integer). | |
| -export([parse/1]). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| acc += (e.is_a?(Hash) && e.has_key?(:colspan)) ? e[:colspan] : 1 | |
| cell_text = cell.is_a?(Hash) ? cell[:text] : cell.to_s | |
| if cell.is_a?(Hash) && cell[:colspan] | |
| text = e.is_a?(Hash) ? e[:text] : e.to_s | |
| width = if e.is_a?(Hash) && e.has_key?(:colspan) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IMAGE_TYPES = %w( image/jpeg image/png image/pjpeg image/x-png image/gif ) | |
| validates_attachment_content_type :image, :content_type => IMAGE_TYPES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "prawn/core" | |
| class Prawn::Document | |
| def go_to_page(k) | |
| jump_to = @store.pages.data[:Kids][k] | |
| @current_page = jump_to.identifier | |
| @page_content = jump_to.data[:Contents].identifier | |
| end | |
| def number_pages(string, position) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "prawn/core" | |
| class Prawn::Document | |
| def go_to_page(k) | |
| jump_to = @store.pages.data[:Kids][k] | |
| @current_page = jump_to.identifier | |
| @page_content = jump_to.data[:Contents].identifier | |
| end | |
| def number_pages(string, position) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def build_jpg_object(data, jpg) | |
| color_space = case jpg.channels | |
| when 1 | |
| :DeviceGray | |
| when 3 | |
| :DeviceRGB | |
| when 4 | |
| :DeviceCMYK | |
| else | |
| raise ArgumentError, 'JPG uses an unsupported number of channels' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RGhost::Document.new do |doc| | |
| doc.matrix_grid do |g| | |
| g.column 'row' | |
| g.column 'name' | |
| g.column 'race' | |
| g.style(:border_lines) | |
| g.data(@data_array) | |
| end | |
| doc.render :pdf, :filename => 'rghost.pdf' | |
| end |