Skip to content

Instantly share code, notes, and snippets.

View bbhoss's full-sized avatar
🎯
Focusing

Preston bbhoss

🎯
Focusing
View GitHub Profile
calcBMI :: Float -> Float -> Float
calcBMI heightIn weightLbs = (weightLbs*703)/heightIn^2
promptFloat :: String -> IO Float
promptFloat question = do
putStrLn question
return =<< readLn
main = do
weight <- promptFloat "What is your weight in pounds?"
height <- promptFloat "What is your height in inches?"
putStrLn ("Your weight is " ++ show weight ++ "lbs. and your height is " ++ show height ++ "in.")
@bbhoss
bbhoss / ubuntu-12.04-lts.erb.sh
Created July 16, 2012 22:39 — forked from nkg/ubuntu-12.04-lts.erb.sh
chef ubuntu 12.04 LTS bootstrap
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get -y upgrade
apt-get install -y build-essential wget zlib1g-dev libssl-dev libffi-dev libncurses-dev libreadline-dev libyaml-dev libffi6 libssl0.9.8
wget https://s3.amazonaws.com/dev.ops/ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
dpkg -i ruby-1.9.3-p194-perf_without_psych_no_warnings_amd64.deb
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.23.tgz
@bbhoss
bbhoss / opener.c
Created July 26, 2012 04:06
Onity lock opener
#define CONSERVATIVE
int ioPin = 3;
#define BUFSIZE 200
unsigned char buf[BUFSIZE];
#define pullLow() pinMode(ioPin, OUTPUT)
#define pullHigh() pinMode(ioPin, INPUT)
unsigned char dbits[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0};
@bbhoss
bbhoss / interfaxer.rb
Created July 27, 2012 23:09
Quick library that uses HTTParty to talk to the Interfax faxing service.
# MIT License
class Interfaxer
include HTTParty
base_uri "https://rest.interfax.net"
headers 'Content-Type' => 'application/pdf'
def initialize(username, password)
self.class.basic_auth(username, password)
end
@bbhoss
bbhoss / reddit_enhancement_suite.user.js
Created November 18, 2012 23:34
Disable tips and new version popup to workaround chrome bug.
// ==UserScript==
// @name Reddit Enhancement Suite
// @namespace http://reddit.honestbleeps.com/
// @description A suite of tools to enhance reddit...
// @copyright 2010-2012, Steve Sobel (http://redditenhancementsuite.com/)
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html/
// @author honestbleeps
// @include http://redditenhancementsuite.com/*
// @include http://reddit.honestbleeps.com/*
// @include http://reddit.com/*
@bbhoss
bbhoss / D8D09AB6
Last active December 21, 2015 09:39
My public key
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.0
mQINBFITwD0BEADDnv+kGFTrmZ8Heilnup+zXF/xjpbBMQ4F7QdyQma0MVPHle0IOTB/WzPD
0hIjAiQCBWlqECbB8wSs2gFdJqBH9IVj0lQkyc14UB+MwgfGYJ8zjlmj8d9/ajNV6Lm0VOb8
aZWMoqIZ+KwwuRwORcUoy8JYyRnHiD19B9ns//+QvVB9VxowcQtANOMkgjt4Awy71YuXqQho
JZlzzQX2RU+P58tZYzkiFniIwqUbjVLZ43dm9HcUImc0KR6cH5Dxd1hV3hFmaleG8LMRsXAF
IUdMXWjEIddxniL3iXqLU6scbV+2GKtVEv5HIIKCB/bZJoQ6hijs4TaR18gvnN2CqAoq46A/
jpguuXk5pJvFiotBmnBRbPC3mTcA8mMKX9V61hgM7hsZ2tr7kqmA5H0KmXTNYYG1/Ncd1iRa
DrIYTKJTAAb6G+SAQrHs2E3zRjNxgXlgaPvk8J1O0KXR3aY3WRt/qAfQLlrCS6BGP6JML5No
@bbhoss
bbhoss / sidekiq_indexing.rb
Created October 8, 2013 07:25
Very basic hook into Sunspot::Rails to force it to index it using an alternative method, in this case Sidekiq. I decided to do it this way instead of writing a new session proxy because in this case it's more of an application concern instead of something as low as a session proxy. Will probably cause some weird issues if you don't have your sol…
module SidekiqIndexing
module SearchableOverride
extend ActiveSupport::Concern
module InstanceOverrides
def solr_index
SunspotIndexer.perform_async(self.class.to_s, self.id)
end
end
@bbhoss
bbhoss / xcode_emulation.patch
Last active December 28, 2015 04:09
patch to xcode_emulation for older (<v0.10.22) versions of node
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
index 806f92b..5256856 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -224,8 +224,7 @@ class XcodeSettings(object):
def _GetSdkVersionInfoItem(self, sdk, infoitem):
job = subprocess.Popen(['xcodebuild', '-version', '-sdk', sdk, infoitem],
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
@bbhoss
bbhoss / xcode_emulation.patch
Last active December 28, 2015 04:08
patch to xcode_emulation for node > v0.10.22
diff --git a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
index f9cec33..4b3c035 100644
--- a/tools/gyp/pylib/gyp/xcode_emulation.py
+++ b/tools/gyp/pylib/gyp/xcode_emulation.py
@@ -285,8 +285,14 @@ class XcodeSettings(object):
if sdk_root.startswith('/'):
return sdk_root
if sdk_root not in XcodeSettings._sdk_path_cache:
- XcodeSettings._sdk_path_cache[sdk_root] = self._GetSdkVersionInfoItem(
- sdk_root, 'Path')
@bbhoss
bbhoss / autopoker.js
Last active January 1, 2016 06:59
Automatically poke your friends back!
var autoPokerIndex = null;
var autoPoke = function() {
// LOL, do you even DOM bro?
document.evaluate('//*[text()="Poke Back"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE).snapshotItem(0).click();
}
var startAutoPoker = function() {
autoPokerIndex = setInterval(autoPoke, 2000);
}