Skip to content

Instantly share code, notes, and snippets.

View bradleybuda's full-sized avatar

Bradley Buda bradleybuda

View GitHub Profile
Verifying my Blockstack ID is secured with the address 1LV55aTvr6a9rhDJJRUmywD3P82MKGtoBL https://explorer.blockstack.org/address/1LV55aTvr6a9rhDJJRUmywD3P82MKGtoBL
@bradleybuda
bradleybuda / keybase.md
Created April 7, 2015 23:12
Keybase Proof

Keybase proof

I hereby claim:

  • I am bradleybuda on github.
  • I am bradleybuda (https://keybase.io/bradleybuda) on keybase.
  • I have a public key whose fingerprint is 8832 2B33 BC46 DDD5 57DD 4997 5C51 B20A 7930 D211

To claim this, I am signing this object:

class AccountRequestApprovalToken < ActiveRecord::Base
belongs_to :user
belongs_to :account_request
validates_presence_of :user_id, :account_request_id
validates_uniqueness_of :value
validates_uniqueness_of :account_request_id, scope: :user_id
before_create :assign_token_value
def assign_token_value
# Fixes Rails 3.2.13 asset loading speed issues
# taken from: https://github.com/fredwu/rails/commit/687e68d88f5e1a7bb6a2d876fbbc5b8c4571d853#L0L162
class Sprockets::Helpers::RailsHelper::AssetPaths
raise "Do you still need this monkey with this Rails version?" unless Rails.version == "3.2.13"
if Rails.env.development?
def exact_match_present_with_speed?(source)
File.exists?(source) || exact_match_present_without_speed?(source)
end
angular.module('myApp')
.controller('MyCtrl', ['$scope', '$log', ($scope, $log) ->
for evt in ['$stateChangeStart', '$stateNotFound', '$stateChangeSuccess', '$stateChangeError', '$viewContentLoading', '$viewContentLoaded']
$scope.$on evt, ->
$log.debug evt, arguments
])
@bradleybuda
bradleybuda / benchmark.rb
Created August 3, 2013 23:02
Token masking benchmark
require 'benchmark'
require 'securerandom'
require 'base64'
require 'bcrypt'
BCrypt::Engine.cost = 1
length = 32
token_from_session = SecureRandom.base64(length)
class AppShare < ActiveRecord::Base
belongs_to :app
belongs_to :sharer, class_name: 'User'
belongs_to :sharee, class_name: 'User'
has_many :notifications, foreign_key: :notified_object_id, conditions: {notified_object_type: 'AppShare'}, dependent: :destroy
after_commit :create_notification, on: :create
def create_notification
@bradleybuda
bradleybuda / test.haml
Created April 22, 2013 00:02
Rails' Array#to_sentence for AngularJS
%span
%p {{ [] | toSentence }}
%p {{ ['my parents'] | toSentence }}
%p {{ ['my parents', 'Ayn Rand'] | toSentence }}
%p {{ ['my parents', 'Ayn Rand', 'God'] | toSentence }}
$ gem cert --add <(curl -Ls https://gist.github.com/bradleybuda/5078798/raw/024ae8ebc085ef009dd0a3ce8c5fa433c5bcb1f1/brad-meldium-public.pem)
Added '/CN=brad/DC=meldium/DC=com'
# Ironically(?) bundler itself isn't signed
$ gem install bundler --version=1.3.1 -P MediumSecurity
Successfully installed bundler-1.3.1
1 gem installed
# But this snazzy new gem is!
$ gem install bundler_signature_check -P HighSecurity
@bradleybuda
bradleybuda / brad-meldium-public.pem
Last active December 14, 2015 11:19
brad@meldium.com public key
-----BEGIN CERTIFICATE-----
MIIDYDCCAkigAwIBAgIBATANBgkqhkiG9w0BAQUFADA7MQswCQYDVQQDDAJtZTEX
MBUGCgmSJomT8ixkARkWB2V4YW1wbGUxEzARBgoJkiaJk/IsZAEZFgNjb20wHhcN
MTQwNDI4MDQ1ODQzWhcNMTUwNDI4MDQ1ODQzWjA7MQswCQYDVQQDDAJtZTEXMBUG
CgmSJomT8ixkARkWB2V4YW1wbGUxEzARBgoJkiaJk/IsZAEZFgNjb20wggEiMA0G
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDLIrDtZCsdyeWO0nigVTIt8g6L+4fv
VANXXlwreHGPmIVHyRhwtt+c4XHKTXaPvTdsM2Tx2G2VoKBJiUiF0bTb4nmEEvpd
hGDL2/6BQ2ILzQBCUdS6KxTFUWcNJq7hVLOqeIQsIZellWr8hJRuxTdiIANMAWux
uRqopxc2DXSfJZdB7yhkqhmr/n0c8aW8yiyqxB1w230mGxFUWyiqiyvN3bqTheHf
6MUJztjg8jaOnFf2biZFnb0jirU5/jVMhFVk5Hy7Sym+yW7p+4PGwYKYus1Dp4R1