Skip to content

Instantly share code, notes, and snippets.

Avatar
🕵️‍♂️
Looking for bugs 🦟

प्रथमेश Sonpatki prathamesh-sonpatki

🕵️‍♂️
Looking for bugs 🦟
View GitHub Profile
View gist:1229657
root@spandan:/opt/Rails-project-For-Student-Forum# heroku run rake db:migrate
Running rake db:migrate attached to terminal... up, run.5
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (can't activate pg (~> 0.11, runtime), already activated pg-0.10.0. Make sure all dependencies are added to Gemfile.)
Tasks: TOP => db:migrate => db:load_config
(See full trace by running task with --trace)
root@spandan:/opt/Rails-project-For-Student-Forum#
How to Solve this error ?
@prathamesh-sonpatki
prathamesh-sonpatki / y2g.rb
Created Jun 29, 2012
Program to convert yacc files to grammar files (.y to to .grammar)(Incomplete)(Section#1 and Section#2 are completed, Working on Section# 3)
View y2g.rb
def match_package(str)
str.match /package\s.*;/
end
def match_import(str)
str.match /import\s.*;/
end
def match_class(str)
@prathamesh-sonpatki
prathamesh-sonpatki / y2g.rb
Created Jul 20, 2012
script to convert .y to .grammar
View y2g.rb
def match_package(str)
str.match(/package\s.*;/)
end
def match_import(str)
str.match(/import\s.*;/)
end
def match_class(str)
str.match(/class\s*[A-Z]\w*/)
View gist:3227798
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
group_base: dc=corp, dc=xyz, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
required_groups:
View gist:3227799
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
group_base: dc=corp, dc=xyz, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
required_groups:
View gist:3227807
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> LDAP Configuration
config.ldap_logger = true
config.ldap_create_user = true
# config.ldap_update_password = true
#config.ldap_config = "#{Rails.root}/config/ldap.yml"
config.ldap_check_group_membership = true
# config.ldap_check_attributes = false
View kindj.rb
until STDIN.eof?
puts gets.scan(/\w+/).length
end
View ldap.yml
## Authorizations
# Uncomment out the merging for each enviornment that you'd like to include.
# You can also just copy and paste the tree (do not include the "authorizations") to each
# enviornment if you need something different per enviornment.
authorizations: &AUTHORIZATIONS
#group_base: dc=corp, dc=betterlabs, dc=net
## Requires config.ldap_check_group_membership in devise.rb be true
# Can have multiple values, must match all to be authorized
#required_groups:
View devise.rb
# Devise.rb
Devise.setup do |config|
# ==> LDAP Configuration
config.ldap_logger = true
config.ldap_create_user = true
#config.ldap_update_password = true
#config.ldap_config = "#{Rails.root}/config/ldap.yml"
#config.ldap_check_group_membership = true
config.ldap_check_attributes = true
config.ldap_use_admin_to_bind = true
@prathamesh-sonpatki
prathamesh-sonpatki / email.rb
Last active Dec 11, 2015
Shoulda-matchers validation error
View email.rb
class Email < ActiveRecord::Base
scope :by_account, -> account_id { where(account_id: account_id) }
attr_accessible :template_name, :subject, :content, :user_id, :account_id
validates :subject, presence: true
validates :template_name, presence: true
validates :template_name, uniqueness: { :scope => :account_id }
validates :content, presence: true
You can’t perform that action at this time.