Skip to content

Instantly share code, notes, and snippets.

View ledbettj's full-sized avatar
💤

John Ledbetter ledbettj

💤
View GitHub Profile
redis-del() {
redis-cli KEYS "$1" | awk '{ print "\"" $1 "\"" } ' | xargs redis-cli "DEL"
}
redis-get() {
redis-cli KEYS "$1" | awk '{ print "\"" $1 "\"" } ' | xargs -n 1 redis-cli "GET"
}
@ledbettj
ledbettj / gist:1793820
Created February 10, 2012 23:00
lsusb logitech solar
Bus 002 Device 012: ID 046d:c52b Logitech, Inc. Unifying Receiver
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 32
idVendor 0x046d Logitech, Inc.
bind "\e[1;5D" vi-prev-word
bind "\e[1;5C" vi-next-word
GIT_BASH_COMPLETE="/usr/local/Cellar/git/1.7.10/etc/bash_completion.d/git-completion.bash"
if [ -f "$GIT_BASH_COMPLETE" ]; then
. $GIT_BASH_COMPLETE
GIT_BRANCH='$(__git_ps1 "|\[\e[0;32m\]%s\[\e[m\]")'
fi
export PS1="\[\e[1;34m\]\u@\h:\[\e[m\]\w"$GIT_BRANCH"\$ "
function nameToCamel(name) {
words = name.split(/[-_]/);
for(var i = 0; i < words.length; ++i) {
words[i] = words[i].substr(0, 1).toUpperCase() + words[i].substr(1);
}
return words.join('');
}
var node = document.getElementById("test");
var attrs = {};
#include <ctype.h>
/* convert a string in place from dash/underscore delimited format
* to camel case. e.g. this-is-an_example => thisIsAnExample
*/
char* tocamel(char* str)
{
char* get = str;
char* put = str;
char c;
source 'https://rubygems.org'
gem 'hidat-ruby-echonest', git: 'git://github.com/hidat/ruby-echonest.git'
gem 'ruby-graphviz'
gem 'ruby-mp3info'
@ledbettj
ledbettj / README.md
Last active December 13, 2015 22:59 — forked from dwtkns/README.md

Faux-3d SVG globe using d3.geo.orthographic and a few radial gradients. Labels offset or hidden based on radians from current map center to enhance the effect.

Uncomment svg.append("g").attr("class","countries") for hover-able country outlines.

@ledbettj
ledbettj / gist:5454272
Created April 24, 2013 18:17
Ruby on Rails session modifying
#!/usr/bin/env ruby
require 'openssl'
require 'base64'
require 'cgi'
# you should snag this from the config/initializers/secret_token.rb
# which some people apparently think is a good idea to check into github.
# spoiler: not a good idea, especially if you're using the cookie session store.
SECRET_TOKEN = '7c795dafa8c781a502f6a636e39f9b5f508a3d49ea1d250c39bce61308beb6d68c8fabd928522dfdb57e26c06c8c9575244e0d7b0922c7756f6d4ca78386ab60'
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<h3>Rotating map with D3.js using Canvas</h3>
<p><a href="rotatingCanvasCode.html">source code</a></p>
<div id="map"></div>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>