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 Array | |
alias :orig_uniq__ :uniq | |
def uniq(attr = nil) | |
return orig_uniq__ if attr.nil? | |
[].tap do |c| | |
found = [] | |
self.each_with_index do |el, i| | |
val = el.send(attr) | |
unless found.include? val | |
found << val |
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 function is based on code found: | |
// http://www.filamentgroup.com/lab/jquery_plugin_for_requesting_ajax_like_file_downloads/ | |
// to easily make a form and POST it | |
var download = function(url, data, method){ | |
//url and data options required | |
if( url && data ){ | |
jQuery('<form style="display: none" id="dr_submission" action="' + url | |
+ '" method="' + (method||'post') + '">' | |
+ '</form>').appendTo('body'); | |
//credentials |
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
<html lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Untitled Document</title> | |
<style type="text/css"> | |
@page { size: A4; } | |
@page cover { size: A6 portrait; background-color: rgb(243,241,224); } | |
#cover { page: cover; } | |
</style> | |
</head> |
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
<html lang="en-US"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
<title>Ampersand Test</title> | |
</head> | |
<body> | |
<h1>Stuff & Things</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.</p> | |
<h1>Stuff & Things</h1> | |
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue.</p> |
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
Any of these should be runnable at the command line by `ruby <filename>` |
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
Any of these should be runnable at the command line by `ruby <filename>`. |
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
require 'rubygems' | |
require 'wrest' | |
Wrest.logger = Logger.new(STDOUT) | |
Wrest.logger.level = Logger::DEBUG # Set this to Logger::INFO or higher to disable request logging | |
response = | |
'https://docraptor.com/docs?user_credentials=YOUR_API_KEY_HERE'.to_uri. | |
post_form(:doc => | |
{ |
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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Net; | |
using System.Web; | |
namespace DocRaptorConsoleExample { | |
class DocRaptor { | |
private const string PostFormat = "doc[{0}]={1}&doc[name]={2}&doc[document_type]={3}&doc[test]={4}"; | |
private const string ApiKey = @"YOUR API KEY HERE"; |
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
require 'rubygems' | |
require 'doc_raptor' | |
TEN_SECONDS = 10 | |
FIVE_MINUTES = 300 | |
DocRaptor.api_key "YOUR_API_KEY_HERE" | |
pdf_html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html lang="en"><body><a href="http://google.com">google</a></body></html>' |
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
<html> | |
<head> | |
<title>Referral-based Document!</title> | |
</head> | |
<body> | |
<p> | |
Here is some sample text. Click the link below to generate a PDF of this page. | |
<br /> | |
<a href='http://docraptor.com/docs/from_site/?name=example_pdf&strict=none&document_type=pdf'>Referral-based Document Generation Example</a> | |
</p> |