Skip to content

Instantly share code, notes, and snippets.

View mh-github's full-sized avatar

Mahboob Hussain mh-github

View GitHub Profile
include RoleModel
roles_attribute :roles_mask
roles :guest, :executive, :manager, :sales, :cxo, :admin
before_create :set_roles_mask
def set_roles_mask
emp = Employee.find_by(email: self.email)
if emp == nil
if user.has_role? :commercial_officer
can :claimsForChecking, ExpensesClaim
end
def second_or_fourth_saturday?(date)
date.saturday? && ((date.day - 1) / 7).odd?
end
def second_or_fourth_saturday?(date)
return false unless date.saturday?
(8..14).include?(date.day) || (22..28).include?(date.day)
end
def fourth_saturday?(date)
saturdays = (date.beginning_of_month..date.end_of_month).select { |date| date.wday == 6 }
[saturdays.second, saturdays.fourth].include?(date)
end
require 'prawn'
require 'prawn/table'
def bullet_item string
indent 15, 0 do
text "* " + string, :align => :justify
end
end
def bullet_item_2 string
def bullet_item string
indent 15, 0 do
text "* " + string, :align => :justify
end
end
<p>
<strong>Terms & Conditions:</strong><br>
<% if @offer.tnc != nil %>
<% @offer.tnc.split("\n").each do |t| %>
<span class="bordered-span"> <%= t %> </span><br>
<% end %>
<% end %>
</p>
<html>
<head>
<title> Dynamically add / delete rows in HTML page </title>
<style>
.dropdown {
position: relative;
width: 200px;
}
.dropdown select
<html>
<head>
<title> Dynamically add / delete rows in HTML page </title>
<script language="javascript">
var globalRowCount = 2;
function addScreenRow(tableID)
{
var table = document.getElementById(tableID);
var rowCount = table.rows.length;