Skip to content

Instantly share code, notes, and snippets.

View adarsh's full-sized avatar

Adarsh Pandit adarsh

View GitHub Profile

Keybase proof

I hereby claim:

  • I am adarsh on github.
  • I am adarsh (https://keybase.io/adarsh) on keybase.
  • I have a public key whose fingerprint is 3AD5 8A1F 6013 C3F1 4719 4692 006C 9945 5D4E E5CA

To claim this, I am signing this object:

class User < ActiveRecord::Base
has_one :subscription, dependent: :destroy
end
class Subscription < ActiveRecord::Base
acts_as_paranoid
belongs_to :user
enum plan: ServicePlans.plan_names
AllCops:
Include:
- '**/Rakefile'
- '**/config.ru'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
- 'bin/**/*'
- 'vendor/bundle/**/*'
@adarsh
adarsh / ruby_refresher.rb
Last active August 29, 2015 14:02
Update OpenSSL using Homebrew, then uninstall and re-install all of your rbenv-managed rubies
class RubyRefresher
def install
`brew update && brew upgrade openssl`
rubies.each do |version|
unless /system/.match(version)
`rbenv uninstall #{version}`
`rbenv install #{version}`
end
end
@adarsh
adarsh / gist:4486943
Last active December 10, 2015 20:18
Installing chruby (and uninstalling rvm)

Installing chruby+ruby-build (and uninstalling rvm)

Motivation

  • RVM has given me a bunch of issues over time. Most recently, it wouldn't load for new shells. The cd hook also bothers me in a nonspecific way.
  • Also, we are testing chruby + ruby-build as an organization

System

@adarsh
adarsh / gist:4105603
Created November 18, 2012 14:38
Full backtrace for zeus error
Run options: include {:locations=>{"./spec/models/user_spec.rb"=>[91]}}
F
Failures:
1) User#expire_token sets the user access_token to EXPIRED
Failure/Error: user.expire_token
NoMethodError:
undefined method `read' for nil:NilClass
# /Users/adarsh/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/json/common.rb:300:in `load'
@adarsh
adarsh / gist:4068038
Created November 13, 2012 20:04
RegEx for converting `.md` to `.JSON` for use in https://github.com/thoughtbot/trail-map
s/\* \(.*\) \[\(.*\)\](\(http.*\)).*/{\r \"name\": \"\1 \2\",\r \"url\": \"\3\"\r},
@adarsh
adarsh / gist:4044104
Created November 9, 2012 06:47
Gabriel's Math Fun
" Type C-A after some math in insert mode to calculate the result
ino <C-A> <C-O>yiW<End>=<C-R>=<C-R>0<CR>
@adarsh
adarsh / gist:4040686
Created November 8, 2012 18:44
SF Vim Enthusiast Meetup Nov 2012
                               Adarsh Pandit
                                 developer

                           [email protected]
                                 @adarshp

                              OZOOOOOOOOOOOOO
                           OZOOOOOOOOOOOOOOOOOZO

ZOOOOO__---"""---__OOOOOZ

@adarsh
adarsh / anonymizer_source.rake
Created February 20, 2012 20:09
Code from blog post on anonymizing sensitive user data
task :env_checker do
unless Rails.env.development?
puts "Not in development environment, exiting!"
exit 1
end
end
namespace :app_name do
desc 'Anonymize user, company, and location information'
task :anonymize => [:environment, :env_checker] do