Skip to content

Instantly share code, notes, and snippets.

View bhardin's full-sized avatar
🍖
In meatspace

Brett Hardin bhardin

🍖
In meatspace
View GitHub Profile
@bhardin
bhardin / Cache_Snoop.pl
Created March 8, 2012 01:32
perl script to aid in cache snooping vulnerabilities
#!/usr/bin/perl
# cache_snoop.pl
# Developed by: Brett Hardin
$version = 1.0;
use Getopt::Long;
my $options = GetOptions (
"help" =>; \$help,
"save" =>; \$save,
"dns=s" =>; \$dns_server,
@bhardin
bhardin / evernote-clearly.css
Last active December 10, 2015 03:38
My settings for evernote-clearly.
/**
* CSS theme for the Clearly browser extension by Evernote.
* See: www.evernote.com/clearly/
*
* Additional options used alongside this CSS:
* Body font: Droid sans
* Header font: PT Serif
* Monospace font: Inconsolata
* Background: #EDEDED
* Foregound: #444444
@bhardin
bhardin / gist:7339955
Last active December 27, 2015 14:19
How @ messages in Hipchat should be used

The @ Symbol in Hipchat

At KISSmetrics, our team is distributed around the United States World. When we interview candidates a common question is, how do we like working remotely.

We love it. We use Hipchat as our water cooler, break room, and discussion area.

In Hipchat, anytime someone mentions you with an @ in front of your name the dock bounces and a sound goes off. This means that someone is attempting to bring something to your attention. There is also an @all that will ping everyone that is in the room, even if they are offline and an @here that will ping only those in the room that are active.

When using the @ symbol please remember that a person should be mentioned only when you need there attention. Not when you are talking about them and don't need there input. The symbol SHOULD ONLY be used when the person needs to be brought into the conversation. It SHOULD NOT be used when mentioning the person in general.

@bhardin
bhardin / gist:7416214
Last active December 28, 2015 00:49
Question for Avdi

When checking for valid input, we could raise an exception to make it more helpful to the developer doing the implementation.

Current code:

def initialize(params)
  super
 
  raise ArgumentError, "Must provide results base dir." unless params.has_key?("dir")
 @dir = params["dir"]
@bhardin
bhardin / gist:7470435
Created November 14, 2013 17:06
Writing RSpec Tests
Tests should test valid input first and then edge cases.
```ruby
describe 'when this happens' do
it "does good" do
end
end
describe 'when this other thing happens' do
it 'does something else' do
@bhardin
bhardin / Question
Created April 2, 2014 23:59
Optimization Report Confusion
Talked to Percy and the query https://gist.github.com/njm/3f0197b817e9c418c1e9, returns something like this?
```
[["variation-name"], [[1,2,3,4,5,6,7,8,9,10,11,12], [12,11,10,9,8,7,6,5,4,3,2,1]]]
```
__What do I return?__
_Option 1:_
{ "name" => variation_name, "totals" => 1, "conversions" => 12 }
@bhardin
bhardin / huge_if_statement.md
Last active August 29, 2015 14:00
Which way is better?

Option 1

if target.last_sent_at && target.last_sent_at >= Time.now - 23.hours && !ignore_rules
  next
end

Option 2

@bhardin
bhardin / blah.rb
Last active August 29, 2015 14:02
def group(cookies)
return @group if @group
current_set = set_size
i = 0
until @group
if seed <= current_set
@group = groups[i]
else

Unix Epoch to ISO 8601

Time.at(1419839999).to_datetime.iso8601
@bhardin
bhardin / gist:962761029555b68f95fa
Created February 18, 2016 17:11
Cool.io Installation Error
Installing cool.io 1.2.4 with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/bhardin/.rbenv/versions/2.0.0-p643/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_alone()... yes
checking for rb_str_set_len()... yes
checking for clock_gettime() in -lrt... no