Skip to content

Instantly share code, notes, and snippets.

View dleavitt's full-sized avatar

Daniel Leavitt dleavitt

  • Allumia
  • Seattle, WA
View GitHub Profile
@dleavitt
dleavitt / gist:1182096
Created August 30, 2011 21:26
Deployment Script
### deploy.rb
# setup rvm
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require "rvm/capistrano"
set :rvm_ruby_string, 'ruby-1.9.2-p290'
set :rvm_bin_path, "#{rvm_path}/bin"
# setup bundler
require 'bundler/capistrano'
@dleavitt
dleavitt / tumblr.rb
Created September 1, 2011 01:17
Simple Tumblr v2 API
require 'httparty'
module Tumblr
class API
include HTTParty
attr_reader :api_key, :access_token
@dleavitt
dleavitt / gist:1199282
Created September 6, 2011 23:18
Olympus Disqus Embed
<script type="text/javascript">var disqus_url = "{Permalink}"; var disqus_title ="{block:PostTitle}{PostTitle}{/block:PostTitle}";</script>{block:Permalink}<div id="disqus_thread"></div>
<script type="text/javascript">
/**
* var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread]
*/
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://penready.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
@dleavitt
dleavitt / gist:1220878
Created September 16, 2011 00:28
Conditional Stylesheets
<!--[if lte IE 8]>
<link href="ie8.css" media="screen" rel="stylesheet" type="text/css" />
<![endif]-->
<!--[if IE 7]>
<link href="ie7.css" media="screen" rel="stylesheet" type="text/css" />
<![endif]-->
@dleavitt
dleavitt / gist:1246892
Created September 28, 2011 03:09
Facebook OAuth2 Instructions

Javascript

  • Basic approach is to do a project-wide search for FB. and do the below:
  • add oauth: true to FB.init call
  • in the response from FB.login, FB.getStatus, etc., change session to authResponse. It will be null if they user didn't allow, as with session.
  • replace all use of the terms perms with the term scope
  • Doesn't look like we can check permissions in the response?
  • Update all FB.event.subscribe calls listening for events with session in the name to listen for equivalent authResponse events.
  • session.uid is now authResponse.userID
  • session.access_token is now session.accessToken
  • whereas previously, when authenticating and making an API call on a subsequent page, the API call seemed to work immediately, with the access token passed along. This does not appear to be the case anymore - all API calls that require auth should be within an FB.login or FB.checkLoginStatus callback.
@dleavitt
dleavitt / API crossdomain.xml
Created January 19, 2012 22:30
Crossdomain Best Practices
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<!-- at /api/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="*"/>
</cross-domain-policy>
@dleavitt
dleavitt / open.xml
Created January 19, 2012 22:32
Open Crossdomain
<cross-domain-policy>
<site-control permitted-cross-domain-policies='master-only'/>
<allow-access-from domain='*'/>
</cross-domain-policy>
<div class="row clearfix">
<div class="field_with_errors">
<input class="input_text" data-validate="true" id="stream_search_query" name="stream_search[query]" size="30" type="text" value="crucible">
<label for="stream_search_query" class="message">can't be blank</label>
</div>
</div>
→ rvm get head
BASH 3.2.48 required (you have 3.2.48(1)-release)
Could not update RVM, get some help at #rvm IRC channel at freenode servers.
@dleavitt
dleavitt / MCBMD_fonts
Created June 10, 2012 21:16 — forked from jbartine/MCBMD_fonts
MC Benson MD - Fonts, colors, and sizes
GLOBAL
nav - SMG regular; 27, 89, 101; 11 pt
nav header - SMG regular; 255, 255, 255; 16 pt
page heading - SMG regular, 48, 121, 128; 22 pt
paragraph heading - SMG regular, 48, 121, 128; 18 pt
HOME PAGE