Skip to content

Instantly share code, notes, and snippets.

@enthal
enthal / index.html
Last active November 14, 2020 02:55
D3/SVG "finger" articulation: https://bl.ocks.org/enthal/3a7e4923c274cb678f60
<!DOCTYPE html>
<meta charset="utf-8">
<style>
svg {
fill: none;
stroke: #300;
stroke-width: 4px;
stroke-linecap: round;
}
@enthal
enthal / index.html
Last active November 14, 2020 02:55
series normalization per mouse-x (D3.js): https://bl.ocks.org/enthal/060290a72e8c29d9f160
<!DOCTYPE html>
<title>series normalization per mouse-x (in d3.js)</title>
<style>
svg .chart {
fill: none;
stroke: #000;
stroke-width: 2px;
}
svg rect.mouse {
fill: none;
@enthal
enthal / openname
Created February 10, 2015 04:49
Verifying that +timjames is my openname (Bitcoin username). https://onename.com/timjames
Verifying that +timjames is my openname (Bitcoin username). https://onename.com/timjames
@enthal
enthal / Preferences.sublime-settings
Created September 5, 2014 19:00
Preferences.sublime-settings
{
"font_size": 17.0,
"ignored_packages": ["Vintage"],
"trim_trailing_white_space_on_save": true,
"tab_size": 2,
"translate_tabs_to_spaces": true,
"LOOK MA NO COMMA": true
}
@enthal
enthal / designer.html
Created July 12, 2014 15:41
designer
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@enthal
enthal / .profile
Last active February 17, 2017 23:44
.profile of ♡
echo bash
parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'; }
PS1="________________________________________________________\n\u@\h \w\[\e[0;33;49m\]\$(parse_git_branch)\[\e[0;0m\]\n\$ "
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
if [ -f `brew --prefix`/etc/bash_completion ]; then
@enthal
enthal / .initrc
Created June 12, 2012 19:07
fix ruby readline
bind "^R" em-inc-search-prev
bind ^I rl_complete
@enthal
enthal / safe_float.rb
Created June 2, 2012 02:10
SafeFloat: a half baked ruby way to change how math works in some interesting ways... probably a bad idea but at least the specs pass
# Provides JSON-safe division, === with a fudge factor, allowance of integer division
class SafeFloat
FUDGE = 0.0000001
def initialize v
@v = v
end
def / other
# p "#{@v} / #{other.to_f} == #{@v / other.to_f}"
self.class.new(@v / other.to_f) if other != 0 # nil instead of NaN
end
def mr
# total_sponsor_amount = sum{|d| d.amount * dollars_per_locale_currency_unit(d.locale)}
reduce = {
usd_per_could_sponsor: ->(d){d.usd / d.could_count},
usd_per_did_sponsor: ->(d){d.usd / d.did_count},
}
map = {
@enthal
enthal / rr.patch
Created April 24, 2012 01:50
added a failing test for a case when RR.mock breaks objects that use method_missing like Redis::Namespace
commit 56d2a064e942243cd601b3b5ac1ec48004a02664
Author: Jared Grippe and Rex Chung and Tim James <[email protected]>
Date: Mon Apr 23 18:35:27 2012 -0700
added a failing test for a case when RR.mock breaks objects that use method_missing like Redis::Namespace
diff --git a/spec/rr/double_injection/double_injection_spec.rb b/spec/rr/double_injection/double_injection_spec.rb
index be2109b..d9ade8c 100644
--- a/spec/rr/double_injection/double_injection_spec.rb
+++ b/spec/rr/double_injection/double_injection_spec.rb