Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
@mbleigh
mbleigh / gist:5703986
Created June 4, 2013 06:29
How to use Font Awesome in Divshot

How to Use Font Awesome in Divshot

  1. On the page, under Page Options select a Custom theme and use this URL: https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css
  2. In the source editor, switch to CSS and add this line: @import url(https://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.min.css)
  3. Now you should be able to add Font Awesome icons using the source editor.

Note: We aim to have more robust icon support in the future, but this is a workaround that should work for now!

@mbleigh
mbleigh / config.ru
Created April 8, 2013 23:34
Quick "Hello World" for running Grape and Sinatra together using Rack::Cascade.
# Put this in a new directory, then run `rackup`
require 'sinatra'
require 'grape'
class Web < Sinatra::Base
get '/' do
"Hello world."
end
end
@mbleigh
mbleigh / gist:3894298
Created October 15, 2012 18:45
How to use LetterOpener with Pony
require 'pony'
Pony.options = {
:via => :smtp,
:from => "Somebody <notifications@example.com>"
}
if ENV['RACK_ENV'] == 'development'
require "letter_opener"
Pony.options.merge!({
via: LetterOpener::DeliveryMethod,
@mbleigh
mbleigh / output.html
Created September 18, 2012 15:42
100% unmodified output from Divshot
<!doctype html>
<html>
<head>
<title>Divshot Demo Output</title>
<link rel="stylesheet" href="https://app.divshot.com/css/divshot-util.css">
<link rel="stylesheet" href="https://app.divshot.com/css/bootstrap.css">
<link rel="stylesheets" href="https://app.divshot.com/css/bootstrap-responsive.css">
</head>
@mbleigh
mbleigh / matchers.rb
Created September 7, 2012 16:53
RSpec matcher for JSON responses.
RSpec::Matchers.define :have_json_key do |expected_key|
match do |response|
@body = MultiJson.load(response.body)
result = @body.key?(expected_key.to_s)
result &&= @body[expected_key.to_s] == @expected_val if @val_provided
result
end
chain :with_value do |val|
@mbleigh
mbleigh / service_account.rb
Created May 16, 2012 20:48
Google OAuth 2.0 Service Account Authorization
require 'multi_json'
require 'base64'
require 'openssl'
require 'faraday'
now = Time.now.utc.to_i
def encode(hash)
Base64.urlsafe_encode64(MultiJson.dump(hash))
end
@mbleigh
mbleigh / welcome.html
Created May 1, 2012 03:19
This is real output from Divshot, the drag and drop editor that developers and designers can be proud to use.
<!doctype html>
<html>
<head>
<title>Divshot Welcome - Welcome to Divshot (Divshot Prototype)</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script type='text/javascript' src='http://divshot.dev/assets/preview.js'></script>
<link rel='stylesheet' href='http://divshot.dev/assets/preview.css' />
</head>
<body>
<div class='container-fluid'>
@mbleigh
mbleigh / bouncy.rb
Created March 29, 2012 15:31
A rough and naive declarative syntax for class reloading.
module Bouncy
def self.mappings
@@mappings ||= []
end
def self.bounce!
mappings.each(&:bounce!)
end
def self.runner(const_name)
@mbleigh
mbleigh / Gemfile
Created March 21, 2012 03:14
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
MyClass
This class is a simple class that does things. Notice that I'm
just using it as an example for potential documentation style.
.class_method
Does something at the class level.
@param options [Hash] A hash of options
.new
Creates a new instance of MyClass