Skip to content

Instantly share code, notes, and snippets.

@sfrdmn
sfrdmn / LICENSE.txt
Created November 26, 2012 23:30
MIT License 2012
Copyright (C) 2012 Sean Fridman
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@sfrdmn
sfrdmn / cool_dude.js
Last active October 12, 2015 06:37
cool dude
a = document.createElement('div');
b = ['◡ ◡','⊙ ⊙'];
h = window.innerHeight;
w = window.innerHeight;
s = h*.8;
i = 0;
a.style.fontSize = s+'px';
a.style.position = 'fixed';
a.style.left = '0';
a.style.right = '0';
@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
@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 ;)

require 'router'
use Rack::CommonLogger
use Rack::ShowExceptions
use Rack::Lint
use Rack::Static, :urls => ["/static"]
run Router.new
@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);
@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 / 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 / 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 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;