Skip to content

Instantly share code, notes, and snippets.

Nathan Bertram nathanbertram

Block or report user

Report or block nathanbertram

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View mongo-db-sizes
function getReadableFileSizeString(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
};
var collectionNames = db.getCollectionNames(), stats = [];
View gist:97701b686db7d5fd03faca8abdaa2a0c
Verifying that +nathanbertram is my blockchain ID. https://onename.com/nathanbertram
View es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.11.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@nathanbertram
nathanbertram / arrangemyseat_iframe_snippet.html
Created Jun 27, 2013
Example of how to integrate your event registration page with an iframe on ArrangeMySeat.com
View arrangemyseat_iframe_snippet.html
<iframe width="960" height="1600" src="https://eventregistration.arrangemyseat.com/" frameborder="0" allowfullscreen></iframe>
View arrangemyseat_iframe_example
<iframe width="960" height="1600" src="https://eventregistration.arrangemyseat.com/" frameborder="0" allowfullscreen></iframe>
View gist:1411479
[3:32pm] gmarik: dhh and that guy are the 1%
[3:33pm] gmarik: haml-haters i mean
[3:35pm] YoMotha: citation needed
View gist:943587
ree-1.8.7-2010.02 > 500.times { |a| puts "a".object_id }
2246868800
2246868760
2246868720
2246868680
2246868640
2246868600
2246868560
2246868520
2246868480
View rgb2hex js
function rgb2hex(rgb){
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return ("0" + parseInt(rgb[1],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[2],10).toString(16)).slice(-2) + ("0" + parseInt(rgb[3],10).toString(16)).slice(-2);
}
View gist:767402
def method_a
puts "AA"
def method_b
puts "BB"
end
end
# ree-1.8.7-2010.02 > method_a
# AA
# => nil
View before_filter_force_www_rails.rb
# The lazy man way to force www if you don't want to touch apache configs
def force_www
redirect_to "http://www.#{request.env['HTTP_HOST']}#{request.env['PATH_INF0']}" unless request.env['SERVER_NAME'] =~ /^www./
end
You can’t perform that action at this time.