Skip to content

Instantly share code, notes, and snippets.

View jqr's full-sized avatar

Elijah Miller jqr

View GitHub Profile
@jqr
jqr / DocRaptor.cs
Last active April 8, 2018 02:15 — forked from janxious/DocRaptor.cs
DocRaptor Examples Set 1 - Non-Ruby
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";
@jqr
jqr / gist:57524
Created February 3, 2009 13:30 — forked from anonymous/gist:57476
module ApplicationHelper
def self_url(options = {})
url_for(request.path_parameters.merge(options))
end
end
describe ApplicationHelper do
describe '#self_url' do
before(:each) do
# using params we can easily detect a reverse merge with
irb(main):001:0> thing
NameError: undefined local variable or method `thing' for main:Object
from (irb):1
irb(main):002:0> defined? thing
=> nil
irb(main):003:0> thing = thing
=> nil
irb(main):004:0> thing
=> nil
irb(main):005:0> defined? thing
require 'rubygems'
require 'httparty'
require 'time'
require 'active_support'
File.read("#{ENV['HOME']}/.gitconfig").match(/token = (\w+)/)
TOKEN = $1
class Github
include HTTParty
# Spawned from this thread: http://rubyflow.com/items/1990
module Enumerable
# Wraps an enumerable in an easy interface for selecting subsets. Comparison
# and method calls are supported.
#
# [0, 1, 2, 3].filter > 1 # => [2, 3]
# [0, 1, 2, 3].filter.zero? # => [0]
#
# Warning: Do not use this with the != operator, use filter_not instead.
class FilterableEnumerable
def initialize(original)
@original = original
end
def ==(value)
@original.select { |v| v == value }
end
def method_missing(sym, *args, &block)
module Breadcrumb
def breadcrumbs
if parent
parent.breadcrumbs << self
else
[self]
end
end
end
# This example will create a sample asynchronous pdf document with the authentication information as part of the POST data
curl http://docraptor.com/docs \
--fail --silent --show-error \
--header "Content-Type: application/json" \
--data '{
"user_credentials": "YOUR_API_KEY_HERE",
"doc": {
"name": "async_example.pdf",
"document_type":"pdf",
"async":"true",
@jqr
jqr / setup-statsd.sh
Created July 6, 2011 02:04 — forked from howardr/setup-statsd.sh
Minor changes to statsd installation
# install git
sudo apt-get install -y g++ curl libssl-dev apache2-utils
sudo apt-get install -y git-core
mkdir ~/src
cd ~/src
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
@jqr
jqr / README.md
Created February 28, 2014 21:51 — forked from mbostock/.block