Skip to content

Instantly share code, notes, and snippets.

View nathanbertram's full-sized avatar
🚀
Building

Nathan Bertram nathanbertram

🚀
Building
View GitHub Profile
# 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
def method_a
puts "AA"
def method_b
puts "BB"
end
end
# ree-1.8.7-2010.02 > method_a
# AA
# => nil
ree-1.8.7-2010.02 > 500.times { |a| puts "a".object_id }
2246868800
2246868760
2246868720
2246868680
2246868640
2246868600
2246868560
2246868520
2246868480
[3:32pm] gmarik: dhh and that guy are the 1%
[3:33pm] gmarik: haml-haters i mean
[3:35pm] YoMotha: citation needed
<iframe width="960" height="1600" src="https://eventregistration.arrangemyseat.com/" frameborder="0" allowfullscreen></iframe>
@nathanbertram
nathanbertram / arrangemyseat_iframe_snippet.html
Created June 27, 2013 02:43
Example of how to integrate your event registration page with an iframe on ArrangeMySeat.com
<iframe width="960" height="1600" src="https://eventregistration.arrangemyseat.com/" frameborder="0" allowfullscreen></iframe>
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
Verifying that +nathanbertram is my blockchain ID. https://onename.com/nathanbertram
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 = [];
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);
}