Skip to content

Instantly share code, notes, and snippets.

@cannapages
cannapages / gist:6658c3cf96b3bc6ca5e2428fd904ff0a
Created March 11, 2018 22:30
Digital Ocean Spaces Signing Request
require 'openssl'
require 'base64'
require 'digest'
SECRET_KEY = "9qVrrCk/9OtL5tD9fLASOtFQvbDo74oRh6JUeb0zprQ"
ACCESS_KEY = "PXCXJJK6N7T3S4HSDKQH"
request_timestamp = Time.now.utc
canonicalRequest = ""
upstream ht_front_end {
server 0.0.0.0:3000;
server 0.0.0.0:3001;
server 0.0.0.0:3002;
server 0.0.0.0:3003;
}
server {
listen 80;
server_name hemptemps.com;
@cannapages
cannapages / gist:8c5af0c761e3d1e94c1a
Created August 19, 2015 16:17
Font Awesome Classes as array Aug 19th 2015
["bars", "flag", "caret-down", "flag", "diamond", "camera-retro", "hand-spock-o", "ship", "venus", "file-image-o", "spinner", "check-square", "credit-card", "pie-chart", "won", "file-text-o", "arrow-right", "play-circle", "github", "medkit", "caret-down", "flag", "envelope", "search", "glass", "music", "search", "envelope-o", "heart", "star", "star-o", "user", "film", "th-large", "th", "th-list", "check", "times", "search-plus", "search-minus", "power-off", "signal", "cog", "trash-o", "home", "file-o", "clock-o", "road", "download", "arrow-circle-o-down", "arrow-circle-o-up", "inbox", "play-circle-o", "repeat", "refresh", "list-alt", "lock", "flag", "headphones", "volume-off", "volume-down", "volume-up", "qrcode", "barcode", "tag", "tags", "book", "bookmark", "print", "camera", "font", "bold", "italic", "text-height", "text-width", "align-left", "align-center", "align-right", "align-justify", "list", "outdent", "indent", "video-camera", "picture-o", "pencil", "map-marker", "adjust", "tint", "pencil-square-o",
@cannapages
cannapages / gist:5a60907952a79d54c0df
Created May 8, 2015 08:42
Fresh Ubuntu/Ruby Todo
sudo apt-get update
sudo apt-get upgrade
\curl -sSL https://get.rvm.io | bash -s stable --rails
rvm install ruby 1.9 --default
sudo apt-get install build-essential libsdl2-dev libsdl2-ttf-dev libpango1.0-dev libgl1-mesa-dev libfreeimage-dev libopenal-dev libsndfile-dev libiconv-hook-dev libxml2-dev freeglut3 freeglut3-dev ImageMagick libmagickwand-dev
gem install faster_xml_simple
gem install gosu releasy texplay ashton gamebox chipmunk ruby-opengl rmagick
@cannapages
cannapages / gist:6639300f922cd5ea1b1b
Created January 23, 2015 00:05
Paypal payment object inspect at error point
#<PayPal::SDK::REST::DataTypes::Payment:0x00000008053310 @error=nil, @intent="sale", @payer=#<PayPal::SDK::REST::DataTypes::Payer:0x00000008052f78 @error=nil, @payment_method="credit_card", @funding_instruments=[#<PayPal::SDK::REST::DataTypes::FundingInstrument:0x0000000804ee28 @error=nil, @credit_card=#<PayPal::SDK::REST::DataTypes::CreditCard:0x0000000804ece8 @error=nil, @type="visa", @number="4111111111111111", @expire_month=1, @expire_year=2017, @cvv2="123", @first_name="Tyrel", @last_name="Richey", @billing_address=#<PayPal::SDK::REST::DataTypes::Address:0x0000000804dff0 @error=nil, @line1="12345 Fake St.", @city="Denver", @state="Colorado", @postal_code="80229", @country_code="US">>>]>, @transactions=[#<PayPal::SDK::REST::DataTypes::Transaction:0x0000000804d398 @error=nil, @amount=#<PayPal::SDK::REST::DataTypes::Amount:0x0000000804d258 @error=nil, @total="458.00", @currency="USD">, @description="Online course payment">], @request_id="5d0f973c-cdd6-435a-830b-67e10027e6e3", @header={}>
@cannapages
cannapages / transaction.rb
Created January 22, 2015 23:57
Transaction Model for hemptemps
class Transaction < ActiveRecord::Base
attr_accessor :card_number, :card_expiration_date, :card_cvv, :card_street_address, :card_city, :card_state, :card_zipcode, :is_online_cc
has_one :student_cart
belongs_to :student
belongs_to :user
include PayPal::SDK::REST
def submit_to_paypal
@payment = Payment.new({
:intent => "sale",
:payer => {
:s#_\(\l\)#\u\1#g
@cannapages
cannapages / gist:11298577
Last active August 29, 2015 14:00
Bjarne Stroustrup Exerpt
#include <iostream>
using namespace std;
int count_x(char* p, char x) {
if (p==nullptr) return 0;
int count = 0;
for (; *p!=0; ++p)
if(*p==x)
++count;
return count;
class OvsmSoundManager
constructor: ->
@sounds = []
sound: (id, sound) ->
{ id: id, sound: sound }
add_sound: ( id, url ) ->
sound = soundManager.createSound({}, url)
@sounds.push( @sound(id, sound) )
sound_for_id: (id) ->
@sounds.filter( (sound) ->
@cannapages
cannapages / gist:5392466
Last active December 16, 2015 06:38
Leaflet
jQuery ->
if $("#map").size() > 0
map = L.map('map').setView([30, 0], 3)
map.fitBounds([[-90, -180],[90, 180]])
cloud_made =
api_key: 'thekey'
style_id: '92877'
tile_size: '256'
minZoom: 3