This file contains 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
asdf |
This file contains 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 show | |
@random = Random.find(params[:id]) | |
respond_to do |format| | |
format.html | |
format.pdf { doc_raptor_send } | |
end | |
end |
This file contains 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 show | |
@random = Random.find(params[:id]) | |
respond_to do |format| | |
format.html | |
format.pdf { doc_raptor_send } | |
end | |
end | |
def doc_raptor_send(options = { }) | |
default_options = { |
This file contains 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
<%= show_for @random do |s| %> | |
<%= s.attribute :title %> | |
<% end %> | |
<%= link_to 'Edit', edit_random_path(@random) %> | | |
<%= link_to 'Back', randoms_path %> | |
<%= link_to("Download Random PDF", random_path(@random, format: :pdf)) %> |
This file contains 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
<style type="text/css"> | |
/* setup the page */ | |
@page { | |
size: US-Letter; | |
margin: 0 0 35mm 0; | |
background: #ffffff; | |
} | |
/* setup the footer */ | |
@page { |
This file contains 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
<style type="text/css"> | |
/* setup the page */ | |
@page { | |
size: US-Letter; | |
margin: 0 0 35mm 0; | |
background: #ffffff; | |
} | |
/* setup the footer */ | |
@page { |
This file contains 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
#This example will create a sample asynchronous pdf document with the authentication information as part of the POST data | |
curl -H "Content-Type:application/json" -d'{"user_credentials":"YOUR_API_KEY_HERE", "doc":{"name":"async_example.pdf", "document_type":"pdf", "async":"true", "test":"true", "document_url":"https://docraptor.com"}}' http://docraptor.com/docs > async_example.pdf | |
#Making an asynchronous request will return some JSON with a status_id key like '{"status_id":"123454321"}' | |
cat async_example.pdf | |
#You can then use the status_id key to check the status of your asynchronous job | |
curl http://docraptor.com/status/123454321 -H "Content-Type:application/json" -d '{"user_credentials":"YOUR_API_KEY_HERE"}' | |
#Once your job has completed, you will recieve a response that contains the download_url for your document |
This file contains 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
var request = require('request'); | |
var fs = require('fs'); | |
var content = "<html><body>TEST!</body></html>"; | |
config = { | |
url: 'https://docraptor.com/docs', | |
encoding: null, //IMPORTANT! This produces a binary body response instead of text | |
headers: { | |
'Content-Type': 'application/json' | |
}, |
This file contains 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
class Game | |
def initialize(start) | |
@quips = [ | |
"You died. You kind of suck at this.", | |
"Nice job! You died again!", | |
"What a loser!", | |
"I have a small puppy that's better at this." | |
] | |
@start = start |
This file contains 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 prompt | |
print "> " | |
end | |
def generate_mad_lib | |
puts "Bear with me. I'm going to need 18 singular @nouns." | |
prompt; | |
@noun1 = gets.chomp() | |
@noun2 = gets.chomp() | |
@noun3 = gets.chomp() |
OlderNewer