Skip to content

Instantly share code, notes, and snippets.

@sfrdmn
sfrdmn / bar_chart.js
Created October 26, 2011 23:51
Polished Bar Chart
// If you rename your script, don't forget to change the <script> tag in the HTML file!!!
var w = 800; // width
var h = 300; // height
var marginT = 0;
var marginL = 75;
var marginB = 10;
var marginR = 20;
// this is relavant to my data only.
@sfrdmn
sfrdmn / index.html
Created November 30, 2011 22:17
Mouse over example in d3
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
</head>
<body>
<script type="text/javascript">
// width
var w = 800;
@sfrdmn
sfrdmn / index.html
Created November 30, 2011 22:24
Mouse over and out in d3
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over and Out</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
</head>
<body>
<script type="text/javascript">
// width
var w = 800;
@sfrdmn
sfrdmn / index.html
Created November 30, 2011 22:40
Mouse over and out w/ info box d3 example
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over and Out with Info Box</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
</head>
<body>
<p>Here is where we will say something.</p>
<script type="text/javascript">
@sfrdmn
sfrdmn / index.html
Created December 6, 2011 09:20
D3 Mouseover Example w/ trailing infobox
<html>
<head>
<meta charset="utf-8">
<title>Mouse Over and Out with Moving Infobox</title>
<script type="text/javascript" src="https://github.com/mbostock/d3/raw/fe671a70e236710412a514fa276e59f875f3c617/d3.js"></script>
<link type="text/css" rel="stylesheet" href="style.css">
</head>
<body>
<!-- I've only commented changes relevant to this mouse follow stuff -->
<!-- btw, this is what an html comment looks like -->
@sfrdmn
sfrdmn / bubble.js
Created December 12, 2011 22:29
Bubble chart w/ mouse over
/*
____________________________________
I___|___|___|___|___|__|____|___|__|_I
I_|___|___| |___|___|__I
)\ I___|__ | ..,a@@@a,a@@@a,.. |___|____I /(
( )) I_|__ .,;*;;@@@@@a@@@@@;;;;,. ___|__I (( )
: I__| ;;;;;;;;;a@@^@@a;;;*;;;;; __|_I :
,uU I_| ;;;;*;;;a@@@ @@@a;;;;*;;; |__I Uu.
:Uu I__|;;;;;;;a@@@@ .@@@@@;;;;;;;; __|I uU:
| | I_| ;;*;;;a@@@@@ @@'`@@@;;;;;*; _|_I | |
@sfrdmn
sfrdmn / render.js
Created January 17, 2012 07:34
render function in mustachio
var render = function(data){
// If Express is configured to cache views (app.set('cache views', true);),
// this render method will be cached.
if (logging) console.log("Rendering: ", helper);
if (options.partial && typeof options.partial == "function") {
var matchesPartial = /\{\{>[ ]{0,}(\w+)[ ]{0,}\}\}/g;
if (matchesPartial.test(str)) {
options.isPartial = true;
var partialStaches = str.match(matchesPartial);
require 'router'
use Rack::CommonLogger
use Rack::ShowExceptions
use Rack::Lint
use Rack::Static, :urls => ["/static"]
run Router.new
@sfrdmn
sfrdmn / gist:3391275
Created August 19, 2012 02:52
jsforcats intro

JavaScript is a programming language. That is, a means by which a computer is instructed to do things. Just the same as one controls humans with hisses and meows, one controls computers with statements written in a programming language. Virtually all web browsers understand JavaScript and you can take advantage of that to make web pages do crazy things! *

* And when you highlight crazy things, a spinning ball of yarn appears ;)

@sfrdmn
sfrdmn / settings.py
Last active October 11, 2015 19:48
django-cms bootstrap settings
# -*- coding: utf-8 -*-
import os
gettext = lambda s: s
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG