Skip to content

Instantly share code, notes, and snippets.

View vraravam's full-sized avatar

Vijay Aravamudhan vraravam

  • ThoughtWorks Inc.
  • Chennai, India
  • X @avijayr1
View GitHub Profile
@vraravam
vraravam / application.rb
Last active January 13, 2016 05:37
Rails Generator configuration
class Application < Rails::Application
config.generators do |g|
g.orm :active_record
g.template_engine :erb
g.stylesheets false
g.javascripts false
g.test_framework :rspec,
fixtures: true,
view_specs: false,
helper_specs: false,
@vraravam
vraravam / production.rb
Created January 13, 2016 05:39
LogRage configuration for production env in rails app
# config/environments/production.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
config.lograge.enabled = true
# add time to lograge
config.lograge.custom_options = lambda do |event|
{ time: event.time, params: event.payload[:params].except('controller', 'action', 'utf8', 'authenticity_token', 'commit') }
end
@vraravam
vraravam / database_cleaner.rb
Created January 13, 2016 05:41
If using database_cleaner gem in a rails app....
# spec/support/database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :truncation
end
@vraravam
vraravam / gist:bd1373abeaee41b422ed
Created February 22, 2016 04:48
Git commands to remove specific files from history
To find the blobs taking up the max space:
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -100 | awk '{print$1}')"
To delete blobs from history:
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch node_modules/* plugins/* platforms/* resources/ios/* resources/android/*' --tag-name-filter cat -- --all
git filter-branch -f --prune-empty --index-filter 'git rm -rf --cached --ignore-unmatch public/assets/*' --tag-name-filter cat -- --all
@vraravam
vraravam / application.rb
Created March 5, 2016 03:46
Rails generator configuration using rspec and factory_girl
# config/application.rb
class Application < Rails::Application
config.generators do |g|
g.orm :active_record
g.template_engine :erb
g.stylesheets false
g.javascripts false
g.test_framework :rspec,
fixtures: true,
view_specs: false,
@vraravam
vraravam / paranoia_helper.rb
Created February 21, 2017 15:35
Paranoia Helper for Parent-Child edit functionality
# frozen_string_literal: true
module ParanoiaHelper
extend ActiveSupport::Concern
module ClassMethods
private
# This method generates an instance method with the name: associated_sym.to_s.pluralize.
#
# Example:
@vraravam
vraravam / brunch-config.js
Last active March 25, 2017 06:01
brunch-config.js for smpallen99\contact_demo
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: {
"js/app.js": /^(web\/static\/js)|(node_modules)/,
"js/ex_admin_common.js": /^(web\/static\/vendor)|(deps)/,
"js/admin_lte2.js": /^(web\/static\/vendor)|(deps)/,
"js/jquery.min.js": /^(web\/static\/vendor)|(deps)/,
@vraravam
vraravam / .railsrc
Last active August 6, 2018 06:42
Rails configuration file (~/.railsrc)
# ~/.railsrc
#--template=http://example.com/my_app_template
#--database=postgresql
--webpack
--database=postgresql
--skip-action-cable
#--skip-action-mailer
#--skip-bundle
@vraravam
vraravam / init.coffee
Last active August 6, 2018 06:43
Atom init script - this is no longer necessary since treeview gives this functionality out of the box
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
# atom.workspaceView.eachEditorView (editorView) ->
@vraravam
vraravam / .rspec
Last active August 6, 2018 06:52
Rspec config file (~/.rspec)
--color
--order random
--profile
--backtrace
# --require rspec/instafail
# --format RSpec::Instafail
# --require fuubar
# --format Fuubar
# --format documentation
# --require rails_helper