Skip to content

Instantly share code, notes, and snippets.

View mbleigh's full-sized avatar

Michael Bleigh mbleigh

View GitHub Profile
var ENVS = {
prod: {firebase: {firebaseURL: 'https://my-app-prod.firebaseio.com'}},
staging: {firebase: {firebaseURL: 'https://my-app-staging.firebaseio.com'}},
dev: {firebase: {firebaseURL: 'https://my-app-dev.firebaseio.com'}},
}
window.__env = (function() {
switch(window.location.hostname) {
case 'localhost':
return ENVS.dev;
@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 / 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 / gist:6260675
Created August 18, 2013 09:09
Example Heroku post-commit payload
app=dumb-hook-example&user=michael%40intridea.com&url=http%3A%2F%2Fdumb-hook-example.herokuapp.com&head=dd615b2&head_long=dd615b2dff8c35abfcbd49b45fb4e9d2cb965874&prev_head=8a0e2c7&git_log=%20%20*%20Michael%20Bleigh%3A%20Add%20another.
@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 / comparison.md
Last active November 4, 2015 04:17
Comparing the features of Divshot and Firebase static web hosting.

Divshot/Firebase Hosting Feature Comparison

Feature Divshot Firebase
Global CDN
Custom Domains
SSL Supported
Command-Line Tools
Simple Rollback
Free w/ Firebase
@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 / 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)