Skip to content

Instantly share code, notes, and snippets.

View briandoll's full-sized avatar
😎
Helping companies market and sell more software

Brian Doll briandoll

😎
Helping companies market and sell more software
View GitHub Profile
class Hospital < AcitveRecord::Base
has_many :hospital_doctors
# Note: has_many_elsewhere is provided by the st-elsewhere gem
has_many_elsewhere :doctors, :through => :hospital_doctors
end
class HospitalDoctor < ActiveRecord::Base
belongs_to :hospital
belongs_to :doctor
end
@briandoll
briandoll / widget.js.erb
Created January 22, 2011 23:21
widget.js.erb
document.write("<div id='our-awesome-widget-target'></div>");
var receivedForm = function(data) {
$("#our-awesome-widget-target").html(data["html"]);
}
$.ajax({
url: 'http://example.com/something/<%= @some_key %>.json',
dataType: 'jsonp',
success: receivedForm
});
class SomeController < ApplicationController
# http://blog.jetthoughts.com/2010/12/22/allow-multiple-access-control-requests-for-rails/
before_filter :set_access_control_headers
def show
@thing = Thing.find(params[:id])
respond_to do |format|
format.html
format.json do
body = render_to_string(:locals => {:thing => @thing})
#!/usr/bin/env bash
# commit-derby
# Display a list of committers with the number of commits they have made in the last 30 days
#
COMMITTERS=`git log --format='%an' --since='30 days ago' | sort | uniq`
echo "In the last month, we've seen:"
for COMMITTER in ${COMMITTERS}; do
COMMITS=`git log --format='%an' --since='30 days ago' | sort | grep ${COMMITTER} | wc -l`
@briandoll
briandoll / README.md
Last active September 28, 2016 00:00
Scan all public repos of a GitHub org with SourceClear
@briandoll
briandoll / how.github.works.txt
Created June 26, 2013 18:30
The GitHub Way
This is Tom's thesis on Optimizing for Happiness, the core idea behind how we work:
http://tom.preston-werner.com/2010/10/18/optimize-for-happiness.html
Ryan has two really great pieces on GitHub management style and organization:
http://tomayko.com/writings/management-style
http://tomayko.com/writings/adopt-an-open-source-process-constraints
Zach has written and presented a ton on how GitHub works:
http://zachholman.com/talk/keeping-people/
http://zachholman.com/posts/chat/
@briandoll
briandoll / brian.dump.list.txt
Created December 26, 2012 21:44
Brain dump list for GTD review
Brain Dump List (GTD)
What is on your desk?
What is in your bag?
What is in those piles?
What notes did you make in meetings?
What notes did you make on documents?
What email caught your attention?
What is coming up on your calendar?
What projects are close to shipping?
<html>
<head>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="jquery.twitter.min.js"></script>
<style type="text/css">
body {background: #333; font-size: 64px; color: #999}
.twitter-posts {padding: 10px; list-style-type:none; border-bottom: 1px solid #000;}
.twitter-posts a {text-decoration:none; color: #FFF;}
</style>
<script type="text/javascript">
@briandoll
briandoll / correlations.rb
Created March 15, 2012 05:38
Correlation between terms in an array of arrays
class Correlations
# the dataset in question
attr_writer :dataset
# Count the number of instances an individual term appears
#
# Example:
# {"Ruby" => 3, "PHP" => 2, "C++" => 2}
attr_accessor :total_appearance_count
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.