Skip to content

Instantly share code, notes, and snippets.

View ledbettj's full-sized avatar
💤

John Ledbetter ledbettj

💤
View GitHub Profile
#!/usr/bin/env bash
set -e
# see http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
PART_TYPE="4f68bce3-e8cd-4db1-96e7-fbcaf984b709"
if [ $# -ne 2 ]; then
echo "Usage: $0 <image-name> <image-size (mb)>"
exit 1
fi
@ledbettj
ledbettj / gist:8424836
Created January 14, 2014 20:14
find files in app or lib which don't have matching specs in spec/
#!/usr/bin/env bash
TOTAL=0
MISSING=0
for file in $(find lib app -name "*.rb"); do
BASE=$(dirname $file | sed s/app\\///); # no app folder in spec dir
SPEC="spec/$BASE/$(basename $file .rb)_spec.rb"
if [ ! -f "$SPEC" ]; then
echo -ne "$(tput setaf 1)"
Conditions of use for the whois service via port 43 for .es domains
Access will only be enabled for IP addresses authorised by Red.es. A maximum of one IP address per
user/organisation is permitted.
Red.es accepts no responsibility whatsoever for the availability of access to WHOIS, which may be
suspended at any time and without prior warning at the discretion of the public entity.
The service will be limited to the data established by Red.es.
<!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>
@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'
@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.

source 'https://rubygems.org'
gem 'hidat-ruby-echonest', git: 'git://github.com/hidat/ruby-echonest.git'
gem 'ruby-graphviz'
gem 'ruby-mp3info'
#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;
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 = {};
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"\$ "