Skip to content

Instantly share code, notes, and snippets.

View blackrobot's full-sized avatar
🖖
coffee

Damon Jablons blackrobot

🖖
coffee
View GitHub Profile
var suite = {};
var UPDATE_INTERVAL = 33;
var LOAD_UPDATE_INTERVAL = 80;
var TOTAL_NOTES = 38;
var BPM_NORM = 145;
var MOUSE_SPEED_MIN = 70;
var MOUSE_SPEED_MAX = 1500;
var MOUSE_SPEED_RATIO_GRAB = 0.4;
var MOUSE_AVERAGE_COUNT = 5;
var TOTAL_THREADS = 8;
var head = document.getElementsByTagName('head')[0],
style = document.createElement('style'),
rules = document.createTextNode('* { text-shadow: -1px -1px hsl(0,100%,50%), 1px 1px hsl(5.4, 100%, 50%), 3px 2px hsl(10.8, 100%, 50%), 5px 3px hsl(16.2, 100%, 50%), 7px 4px hsl(21.6, 100%, 50%), 9px 5px hsl(27, 100%, 50%), 11px 6px hsl(32.4, 100%, 50%), 13px 7px hsl(37.8, 100%, 50%), 14px 8px hsl(43.2, 100%, 50%), 16px 9px hsl(48.6, 100%, 50%), 18px 10px hsl(54, 100%, 50%), 20px 11px hsl(59.4, 100%, 50%), 22px 12px hsl(64.8, 100%, 50%), 23px 13px hsl(70.2, 100%, 50%), 25px 14px hsl(75.6, 100%, 50%), 27px 15px hsl(81, 100%, 50%), 28px 16px hsl(86.4, 100%, 50%), 30px 17px hsl(91.8, 100%, 50%), 32px 18px hsl(97.2, 100%, 50%), 33px 19px hsl(102.6, 100%, 50%), 35px 20px hsl(108, 100%, 50%), 36px 21px hsl(113.4, 100%, 50%), 38px 22px hsl(118.8, 100%, 50%), 39px 23px hsl(124.2, 100%, 50%), 41px 24px hsl(129.6, 100%, 50%), 42px 25px hsl(135, 100%, 50%), 43px 26px hsl(140.4, 100%, 50%), 45px 27px hsl(145.8, 100%, 50%
@blackrobot
blackrobot / gist:2037434
Created March 14, 2012 15:54
Trippy Bookmarklet
javascript:var s=document.createElement('script');s.type='text/javascript';s.async=true;s.src='http://raw.github.com/gist/2037325/51ef08effd996cb1228bbaa65a6be3b20eb7a925/trippy.js';document.body.appendChild(s);
garden = Garden.objects.get(slug='garden')
season = Season.objects.get(slug='summer')
###
garden.plants.filter(seasons_of_interest_includes=season.id) <<====
###
@blackrobot
blackrobot / gist:2776810
Created May 23, 2012 18:20
Songs HTML/CSS
<style type="text/css">
/* CSS */
.team-member a {
display:block; left:0; position:absolute; top:0;
}
.team-member a span {
display:block; left:0; position:absolute; top:100%;
/* Make it so that even with padding or margin, the width is still 100% of
from django.db.models import Q
query = Q(name__istartswith='a')
for l in ['b', 'c', 'd', 'e', 'f']: # Should go all the way up
query |= Q(name__istartswith=l)
Artist.objects.filter(query)
@blackrobot
blackrobot / best.py
Created October 2, 2012 20:01
Best fit algorithm
def distance(points):
OPTIMAL = (75, 75)
x = points[0] - OPTIMAL[0]
y = points[1] - OPTIMAL[1]
return (x ** 2 + y ** 2) ** 0.5
values = [
(12, 88),
(56, 66),
(13, 79),
@blackrobot
blackrobot / ptpython_config.py
Last active October 13, 2015 15:27
pt-python config file
# Goes in .ptpython/config.py
from __future__ import unicode_literals
from prompt_toolkit.keys import Keys
from pygments.token import Token
__all__ = (
'configure',
)
<div class="registration_form">
<p> <h4>New Customer (Register for an Account) </h4></p>
{% if register_state %}
<div class="state">
*{{ register_state }}
</div>
{% endif %}
<form action="" method="post" class="form-horizontal" name="registerform">{% csrf_token %}
{{ registerform.non_field_errors }}
@blackrobot
blackrobot / grunt.js
Created December 14, 2012 18:54
Simple grunt setup
/*global module:false*/
module.exports = function(grunt) {
grunt.initConfig({
/* Handlebars Templates */
handlebars: {
whatever: {
options: {
wrapped: true,