Skip to content

Instantly share code, notes, and snippets.

View gabetax's full-sized avatar

Gabe Martin-Dempesy gabetax

  • Zendesk
  • San Francisco
  • 11:03 (UTC -07:00)
View GitHub Profile
@gabetax
gabetax / gist:b81d097792364d88eff0
Created April 16, 2015 22:30
SSL Certificate subject collision with alternate public keys / subject key identifiers
-----BEGIN CERTIFICATE-----
MIIFLjCCBBagAwIBAgIQAw6VKU2uwSwDzzGrWwJx1zANBgkqhkiG9w0BAQUFADBv
MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFk
ZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYDVQQDExlBZGRUcnVzdCBF
eHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEwNDgzOFow
YjELMAkGA1UEBhMCVVMxITAfBgNVBAoTGE5ldHdvcmsgU29sdXRpb25zIEwuTC5D
LjEwMC4GA1UEAxMnTmV0d29yayBTb2x1dGlvbnMgQ2VydGlmaWNhdGUgQXV0aG9y
aXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5Lx+kjBtxtiOKwu8
Rs7gJ5be3vn6EtM8M3OzBC+8cYzln7YiYD5fXc4J/4IMG5pRUBomid3VYV0Z3BIP
LQqiQ10X0DSSIOpzzzgsBiYJenL3+lAy+MKT02miI85Bsczk1R820Yo6+Ixj4hRZ
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSpy v2008 sp1 (http://www.altova.com)-->
<tns:submission xsi:schemaLocation="aca ACASubmission.xsd" xmlns:tns="aca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<submissionYear>2011</submissionYear>
<business>
<businessType>Manufacturer</businessType>
<businessName>Business Name xyz</businessName>
</business>
<practitionerGroups>
<practitionerGroup>
@gabetax
gabetax / hacky_each_else.rb
Created January 13, 2014 03:03
Hacky alternative to ruby not having each/else. Object#presence provided by active_support.
a = %w(a b c)
a.each do |i|
puts i
end.presence || puts("the array was empty")
@gabetax
gabetax / deploy.rb
Last active December 27, 2015 05:19 — forked from blackcoat/deploy.rb
# http://gembundler.com/deploying.html
require 'bundler/capistrano'
# http://guides.rubyonrails.org/asset_pipeline.html
load 'deploy/assets'
# http://beginrescueend.com/integration/capistrano/
# Also add rvm-capistrano to your Gemfile
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_type, :system # Copy the exact line. I really mean :system here
@gabetax
gabetax / _form.html.erb
Created October 11, 2013 16:51
Javascript Page Object Example
<% @body_data = {
page_object: 'PostForm',
rails_env: Rails.env,
post_max_length: Post.column_types['title'].limit
}
%>
@gabetax
gabetax / .ackrc
Created September 27, 2013 21:22
ack configuration for ruby / rails developers
--type-add=html:ext:html.erb
--type-add=css:ext:sass,less,scss
--type-add=js:ext:js.erb,coffee
--type-add=rspec:match:/_spec.rb$/
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=coverage
--ignore-dir=public/assets
--ignore-dir=spec/fixtures/cassettes
module FeatureSpecMacros
module ExampleMethods
def successfully_visit(path)
visit path
successfully_on path
end
def successfully_on(path)
expect(page.current_path).to eq(path), "Expected: #{path} URL\nGot #{page.current_path}\n\nPage source:\n\n#{page.html}"
expect(page.status_code).to eq(200), "Expected: 200 status code\nGot #{page.status_code}\n\nPage source:\n\n#{page.html}"
@gabetax
gabetax / rspec-expect-stand-alone-matchers.md
Last active December 20, 2015 16:18
rspec expect-syntax, stand-alone operators, and you

rspec expect syntax and stand-alone operator matches

I recently started a new project using rspec's newer (and soon to be default) expect syntax, and encountered this error:

expect(5).to == 5
ArgumentError: The expect syntax does not support operator matchers, so you must pass a matcher to `#to`

"Why'd they take out operator matches? I've grown quite accustomed to them!", I thought. Digging around, the source of this change started in pull request 119 citing issue 138 as one of the root causes. Here's what's actually happening:

@gabetax
gabetax / pretzel.rb
Last active December 19, 2015 00:29
https://twitter.com/garybernhardt/status/349920138889404416
[1] pry(main)> class Object; alias_method :&, :method; end
=> Object
With standard symbol to proc, &:foo evaluates to:
{ |x| x.foo }
With the "pretzel bun", &foo&:bar evaluates to:
@gabetax
gabetax / Anchor.ino
Last active December 16, 2015 21:29 — forked from mganucheau/gist:5499453
// LPD8806 LED Code for our Yacht Club's Anchor
/*************************************************************************************/
#include "LPD8806.h" // Library Here: https://github.com/adafruit/LPD8806
#include "SPI.h"
int totalLEDs = 14;
int dataPin = 2;
int clockPin = 3;
LPD8806 strip = LPD8806(totalLEDs, dataPin, clockPin);