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 = ""
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
@cannapages
cannapages / header.css.scss
Created April 15, 2013 22:21
Fixed nav html and css
$header_height: 100px;
.header {
position: fixed;
width: 100%;
height: $header_height;
background-color: $light_blue;
.container {
position: relative;
width: 950px;
height: $header_height;
@cannapages
cannapages / gist:5359221
Created April 10, 2013 23:04
Concerning an example
module Reversable
extend ActiveSupport::Concern
module ClassMethods
def do_it
puts "holly molly this is how to bootstrap"
all.each do |post|
post.revers_content
end
end
@cannapages
cannapages / gist:5358916
Last active December 16, 2015 01:59
A simple mention able model
class Post < ActiveRecord::Base
..
def content_for_view
content.html_safe
end
before_save :create_mentionable_links_in_post
def create_mentionable_links_in_post
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 / 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 => {