Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am shartep on github.
* I am shartep (https://keybase.io/shartep) on keybase.
* I have a public key ASAmD-cYoomRPuMMiPnjR_mGfscK4BS5F6Ud3sw3ITBWQgo
To claim this, I am signing this object:
@shartep
shartep / gist:c9c922ef3091c1de3fd822334e5d340f
Created December 23, 2016 12:08 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@shartep
shartep / pg_interval_support_4_1.rb
Created December 22, 2016 15:28 — forked from Envek/pg_interval_support_4_1.rb
Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1 and 4.2
# Enables PostgreSQL interval datatype support (as ActiveSupport::Duration) in Ruby on Rails 4.1.
# Based on https://gist.github.com/clarkdave/6529610
require 'active_support/duration'
# add a native DB type of :interval
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:interval] = { name: 'interval' }
# add the interval type to the simplified_type list. because this method is a case statement
# we can't inject anything into it, so we create an alias around it so calls to it will call
*.DS_Store
@shartep
shartep / unscoped_associations.rb
Last active November 10, 2016 01:25 — forked from mesozoic/unscoped_associations.rb
Module which provides the ability to unscope associations
# Provides the ability to unscope associations, this solves problems described in
# http://stackoverflow.com/questions/1540645/how-to-disable-default-scope-for-a-belongs-to/11012633#11012633
#
# Examples
#
# class Document < ActiveRecord::Base
# default_scope where(deleted: false)
# end
#
# class Comment < ActiveRecord::Base