Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq
on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp
'use strict'; | |
exports.handler = (event, context, callback) => { | |
// Get request and request headers | |
const request = event.Records[0].cf.request; | |
const headers = request.headers; | |
// Configure authentication | |
const authUser = 'user'; | |
const authPass = 'pass'; |
Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq
on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp
@mixin animated { | |
-webkit-animation-fill-mode: both; | |
-moz-animation-fill-mode: both; | |
-ms-animation-fill-mode: both; | |
animation-fill-mode: both; | |
-webkit-animation-duration: 1s; | |
-moz-animation-duration: 1s; | |
-ms-animation-duration: 1s; | |
animation-duration: 1s; | |
} |
# /Library/Ruby/Gems/1.8/gems/pdfkit-0.5.2/lib/pdfkit/pdfkit.rb | |
# I kept getting invalid argument and file not found errors when creating a PDF | |
# from my showoff presentations. Changing a few lines fixed this behaviour. | |
# Thanks to clyfe (https://gist.github.com/1330326) for his optimized version! | |
class PDFKit | |
class NoExecutableError < StandardError | |
def initialize |
# First run: sudo apt-get install git | |
# Then clone this gist. | |
# Then run build.sh | |
# basics | |
sudo apt-get install g++ libcurl3-dev curl build-essential libxml2-dev libxslt-dev git mercurial bzr mongodb-clients | |
# python-software-properties, seems to already be there or something? | |
# Go - https://wiki.ubuntu.com/Go | |
mkdir $HOME/go |
# Simple bijective function | |
# Basically encodes any integer into a base(n) string, | |
# where n is ALPHABET.length. | |
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047 | |
ALPHABET = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//) | |
# make your own alphabet using: | |
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require "rubygems" | |
require 'amqp' | |
EventMachine.run do | |
connection = AMQP.connect(:host => '127.0.0.1') | |
puts "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..." |