Skip to content

Instantly share code, notes, and snippets.

View jpsilvashy's full-sized avatar
🎯
Focusing

JP Silvashy jpsilvashy

🎯
Focusing
View GitHub Profile
@lmakarov
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
'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';
@vickash
vickash / README.md
Last active December 21, 2015 13:30
Simple message queue setup with dino.

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
@eanakashima
eanakashima / _animixins.scss
Created November 20, 2012 18:51
animation mixins
@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;
}
@NeQuissimus
NeQuissimus / pdfkit.rb
Created May 3, 2012 14:01
pdfkit.rb for working with showoff
# /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
@treeder
treeder / build.sh
Last active September 30, 2015 05:38
My new linux build script
# 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-propertie​s, seems to already be there or something?
# Go - https://wiki.ubuntu.com/Go
mkdir $HOME/go
@zumbojo
zumbojo / bijective.rb
Created July 9, 2011 22:09
Simple bijective function (base(n) encode/decode)
# 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..."