Skip to content

Instantly share code, notes, and snippets.

View vparihar01's full-sized avatar

Vivek Parihar vparihar01

View GitHub Profile
@vparihar01
vparihar01 / Gemfile
Created March 8, 2012 22:04
Gemfile configuration for compass and sussy
source 'http://rubygems.org'
gem 'rails', :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'jquery-rails', '>= 1.0.12'
gem "execjs","1.2.13"
gem 'mysql'
#gem 'thinking-sphinx', '2.0.11'
gem 'json','1.6.4'
@vparihar01
vparihar01 / blockUI
Created March 30, 2012 08:10
Loading Screen for Ajax request using jQuery.blockUI.js
jQuery(function(){
$.ajax({
async:true,
type:'get',
beforeSend:function(request) {
$.blockUI({ css: {
border: 'none',
padding: '15px',
backgroundColor: '#000',
'-webkit-border-radius': '10px',
@vparihar01
vparihar01 / GEMFILE
Created May 2, 2012 12:29
Compass+susy++rails 3.2.2 working GEMFILE conf
source 'http://rubygems.org'
gem 'rails', '3.2.2'
gem 'acts-as-messageable'
gem 'acts-as-taggable-on'
gem 'mysql'
gem 'haml'
gem 'capistrano'
@vparihar01
vparihar01 / MyWebservices.rb
Created July 2, 2012 08:14
My Service look Model i am trying to create ...
# Webservice Class which call all api like a REST
class UserWebservice
#include Mongoid::Document
def self.client(wsdl_location)
@@client ||= Savon::Client.new(wsdl_location) do |wsdl, http|
#to make sure savon dont try to have certificate and key
http.auth.ssl.verify_mode = :none
#wsdl document location
wsdl.document = wsdl_location.to_s
@vparihar01
vparihar01 / database.yml.example mysql2
Created September 21, 2012 07:11 — forked from erichurst/database.yml.example mysql2
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

Models, Roles, Decorators, and Interactions

A modest alternative to DCI that might be worth further thought

One of the problems with advancing the discussion on DCI is that we lack a comparable alternative pattern that has the same goals, but favors a low ceremony approach. The closest thing we have to that is Rails concerns, but they are more like distant relatives of the DCI concepts rather than first cousins, and that makes comparisions between the two approaches not especially fruitful.

I am considering the idea of experimenting with my own paradigm that captures the intent and purity of DCI, but with the convenience of concerns. Please note that this is just the starting point of a conversation, it is NOT a promise of comercially available cold fusion or a cure for cancer. It's just a gist with an idea on it I'd like to hear your thoughts on.

What if we had a top-level topology that was split into Models, **Rol

load 'deploy'
# ================================================================
# ROLES
# ================================================================
role :app, "173.203.86.155:22", {:primary=>true}
role :db, "173.203.86.155:22", {:primary=>true}
@vparihar01
vparihar01 / route.rb
Created February 12, 2013 09:44
List of gems for development env. That make development quite handy.
# NOTE below gems are only for development purpose can be removed and commented out as per requirement
group :development do
gem 'rails-erd','1.0.0'
gem 'hirb','0.7.0'
gem 'railroady'
gem 'itslog','0.6.1'
gem 'quiet_assets'
gem 'sextant'
end
@vparihar01
vparihar01 / confirmation.rb
Created March 20, 2013 14:53
Devise mailer configuration for registration email sending.
#Getting email unscrewed
#First configure Devise email in config/initializers/devise.rb:
config.mailer_sender = "vivek@yopmail.com"
#If you continue to get an error message, did you reboot the server?
#Localhost email testing
#Do this in the shell you’re using to run the Rails server:
#$ export GMAIL_SMTP_USER=username@gmail.com
@vparihar01
vparihar01 / VirtualHost.conf
Created March 22, 2013 05:55
Virtual Host configuration for Ruby On Rails Application with Custom error log configuration.
<virtualhost *:80>
ServerName app.com
ServerAlias www.app.com
DocumentRoot /var/www/html/blog/public # <-- be sure to point to 'public'!
setenv RAILS_ENV production
<Directory /var/www/html/blog/public>
AllowOverride All
RailsEnv production
</Directory
ErrorLog /var/log/apache2/blog_error_log