Skip to content

Instantly share code, notes, and snippets.

View markprzepiora's full-sized avatar
🏠
Working from home

Mark Przepiora markprzepiora

🏠
Working from home
View GitHub Profile
@markprzepiora
markprzepiora / gist:61e7e6a3c06e9b573390
Created September 20, 2014 17:46
ActiveRecord 4.2 relationship + callback regression
# Models
class Post < ActiveRecord::Base
after_save :do_something_to_tags
has_many :post_tags, inverse_of: :post
has_many :tags, through: :post_tags
def do_something_to_tags
puts "The following line in Rails 4.2 incorrectly joins on post_id = NULL"
@markprzepiora
markprzepiora / copy_bower_components.sh
Last active January 4, 2016 10:09
copy_bower_components
#!/usr/bin/env bash
set -e
# copy_bower_components - A very simple bash script for copying your Bower
# components over to your rails vendor/assets folder.
#
# Copyright (c) 2013 Mark Przepiora
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@markprzepiora
markprzepiora / _undeprecate.sh
Last active December 21, 2015 00:59
One-liner for switching over to using "double" instead of "stub" to create test double, the latter of which is deprecated in RSpec 3. This should not touch actual stubbing (e.g. something.stub(awesome: true)), or stubbing of constants for example (e.g., stub_const "MyArray"...)
find spec -name '*.rb' | xargs sed -i '' -E 's/([^.]|^)stub([^_]|$)/\1double\2/g'