Skip to content

Instantly share code, notes, and snippets.

Donut Chart with D3

Using d3.js and custom html

@sagevann
sagevann / gist:4567118
Created January 18, 2013 18:42
GPT Example for Hark Top Leaderboard on Category page
<!-- GPT Asynchronous Header Code -->
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
<!-- GPT Asynchronous Header Code -->
<script type='text/javascript'>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
(function() {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
@sagevann
sagevann / gist:2704022
Created May 15, 2012 18:34
this is for removing the flash message crap
-111,7 +111,7 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga
111 111
<% [:confirmation, :notice, :warning, :error].each do |msg| %>
112 112
<% if flash[msg].present? %>
113 113
<div class="container alert <%= msg.to_s %>">
114
- <%= flash[msg] %>asdfasdf asdf as dfa
114
@sagevann
sagevann / gist:2698174
Created May 14, 2012 23:57
Hark chartbeat
<% if HARK_CONFIG.enable_chartbeat %>
<script type="text/javascript">
var _sf_async_config={uid:<%= HARK_CONFIG.chartbeat_uid %>, domain:<%= HARK_CONFIG.chartbeat_domain.inspect.html_safe %>};
(function(){
function loadChartbeat(){
window._sf_endpt = (new Date()).getTime();
var e = document.createElement('script');
e.setAttribute('language', 'javascript');
e.setAttribute('type', 'text/javascript');
e.setAttribute('src',
@sagevann
sagevann / gist:2491723
Created April 25, 2012 18:03
simple ruby needs meta ruby help
class ClipModel
attr_accessor :type, :owner, :time, :count, :title, :url, :description, :quote, :one_liner, :sponsored, :image, :characters, :actors
@@clip = {}
def initialize(clip)
@@clip = clip
end
def raw
@sagevann
sagevann / arrays_derefed
Created October 19, 2011 18:57
Array by Reference?
v = [ 1, 2, 3 ]
b = v
b = [ 2, 3, 4 ]
puts v
# expected output [ 2, 3, 4] actual output [ 1, 2, 3]
# in this case it appears that the [ ] operator does not overwrite the values in the
# array v as I would expect
v = [ 2, 5, 3 ]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
/* Rule 201 of /cache/stylesheets/all.css?1300904331 */ .partner_searches .partner_box { MARGIN: 0px 0px 25px} /* Rule 198 of /cache/stylesheets/all.css?1300904331 */ .partner_searches { CLEAR: both; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 10px; MARGIN: 0px 0px 30px; PADDING-TOP: 10px} /* Rule 91 of /cache/stylesheets/all.css?1300904331 */ #left { FLOAT: left; WIDTH: 644px} /* Rule 485 of /cache/stylesheets/all.css?1300904331 */ #left { MARGIN-TOP: 13px} /* Rule 129 of /cache/stylesheets/all.css?1300904331 */ #main { CLEAR: both; PADDING-RIGHT: 0px; PADDING-LEFT: 0px; MIN-HEIGHT: 510px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px} /* Rule 18 of /cache/stylesheets/all.css?1300904331 */ #content { TEXT-ALIGN: left} /* Rule 17 of /cache/stylesheets/all.css?1300904331 */ #wrap { MARGIN: 0px auto; WIDTH: 970px} /* Rule
<div style='width:644px; height:200px;'>
<div class="ad_container" id="endemic_panel3_success_arc">
<p id="wsfy_top_sponsor" class="ad_sponsored_top">Sponsored Links WSFY3</p>
<h2 id='wsfy_headline'>Other people searching for %%AAMGNRC1%% %%AAMGNRC2%%</h2>
<div id='wsfy_teaser_data'>
<h3 id='wsfy_teaser_count'>[[searchers_count]]+ people are searching for %%AAMGNRC1%% including...</h3>
<div id='wsfy_teaser_details_container'>
<div id='wsfy_teaser_repeat_placeholder'> </div>