Skip to content

Instantly share code, notes, and snippets.

View beck03076's full-sized avatar

senthil kumar muthamizhan beck03076

View GitHub Profile
class BranchesDatatable
delegate :image_tag,:edit_branch_path,:params, :h, :link_to, :number_to_currency, to: :@view
def initialize(view)
@view = view
end
def as_json(options = {})
{
sEcho: params[:sEcho].to_i,
class CitiesDatatable
delegate :image_tag,:edit_city_path,:params, :h, :link_to, :number_to_currency, to: :@view
def initialize(view)
@view = view
end
def as_json(options = {})
{
sEcho: params[:sEcho].to_i,
class EnrollmentsDatatable
delegate :edit_enrollment_path,:image_url,:image?,:image_tag,:params, :h, :link_to, :number_to_currency, to: :@view
def initialize(view)
@view = view
end
def as_json(options = {})
{
sEcho: params[:sEcho].to_i,
@beck03076
beck03076 / diff.rb
Last active December 22, 2015 18:39
#==================================
# Author : Senthil
# Author Nick : beck03076
# Description : Given N integers, Count the total pairs of Integers that have a difference of k
#==================================
# Getting input from console
puts "Enter comma separated numbers"
a = gets.chomp.split(",").map(&:to_i)
puts "Enter the value of K(difference)"
k = gets.chomp.to_i
def fset(f,name,elem,mad = nil,label = false)
html = String.new
cl = "frbox "
cl += mad.to_s
html = ("<div class='#{cl}'>" + f.label(name.to_sym,label) + f.send(elem,name.to_sym) + "</div>").html_safe
end
in your view
<div class="col6">
<%= javascript_include_tag 'common' %>
<%= nested_form_for(@enquiry) do |f| %>
<div class="frbox">
<%= f.label :date_of_birth %>
<%= f.text_field :date_of_birth,{class: "dateField"} %>
</div>
<% end %>
root@IECTest:/var/www/organizor# bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-2.0.0-p195/bin/ruby /usr/local/rvm/gems/ruby-2.0.0-p195@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
class NotificationObserver < ActiveRecord::Observer
observe :enquiry,:registration,:todo,:follow_up
def after_save(record)
if record.assigned_to != record.assigned_by
PrivatePub.publish_to("/notify/" + record.assigned_to.to_s,
message: "#{record.class.name} has been assigned to you",
class EnquiriesDatatable < DeviseController
delegate :params, :h, :link_to,
:number_to_currency,:image_tag,
:can?,:edit_enquiry_path,:check_box_tag,
:current_user,to: :@view
def initialize(view,cols,sFil)
@view = view
@cols = cols
@sFilter = sFil
@beck03076
beck03076 / price_updater.rb
Created March 10, 2014 23:25
A Rake task that Scraps Data based on the input Pattern and Updates the Table
# Files are used to write success and error logs
require "fileutils"
# Mechanize is used to scrap data from urls and patterns
require 'mechanize'
# to connect to a remote database
require 'rubygems'
require 'active_record'
require 'mysql2'
require 'net/ssh/gateway'
# to check if a port is open