Skip to content

Instantly share code, notes, and snippets.

public function _getHolidayList() {
$newArray = array();
$dt = new \DateTime();
$newArray[] = $dt->modify("First day of January")->format('Y-m-d');
$newArray[] = $dt->modify("Third Monday of January")->format('Y-m-d');
$newArray[] = $dt->modify("Third Monday of February")->format('Y-m-d');
$newArray[] = $dt->modify("Last Monday of May")->format("Y-m-d");
$newArray[] = $dt->modify("July 4")->format("Y-m-d");
$newArray[] = $dt->modify("First Monday of September")->format("Y-m-d");
public $ourDate;
public function _getLastBusinessDay() {
// lets figure out the business days..
$holidayList = array('2013-02-06');
$this->ourDate = date('Y-m-d', strtotime('-5 weekdays'));
foreach ($holidayList as $holiday) {
$timestamp = strtotime($holiday);// holiday lists..
$tmp = strtotime($this->ourDate); // todays date - 5 weekdays
$tmp1 = strtotime(date('Y-m-d')); // todays date
public function _getLastBusinessDay() {
// lets figure out the business days..
$holidayList = array();
$ourDate = date('Y-m-d', strtotime('-5 weekdays'));
if (in_array($ourDate, $holidayList)) {
$ourDate = date('Y-m-d', strtotime('-1 weekday', strtotime($ourDate)));
}
return $ourDate;
<?php
function replacer($array) {
$newArray = array();
foreach ($array as $key => $val) {
foreach ($val as $k=>$v) {
if ($v == "" || $v === null) {
$newArray[$key][$k] = "empty";
} else {
<?php
function replacer($array) {
$newArray = array();
foreach ($array as $key=>$val) {
if (preg_grep('/^$/', $val)) {
$newArray[$key] = "empty";
} else {
$newArray[$key] = $val;
}
@jblac
jblac / gist:4756430
Last active December 12, 2015 10:08 — forked from donaldallen/gist:4756420
$count = $this->bookings->where('archive != 0')->where('status', Status::get('accepted')->id)->count_all()
$config['base_url'] = site_url('admin/creatives/manage');
$config['uri_segment'] = 4;
$config['total_rows'] = $count;
$config['per_page'] = '20';
$config['num_links'] = '10';
$this->pagination->initialize($config);
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/custom.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/sessions.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/static_pages.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/users.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-transition.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-affix.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-alert.js?body=1" type="text/javascript"></script>
<%= link_to "delete", micropost, method: :delete,
data: { confirm: "You sure?" },
title: micropost.content %>
<a href="<%= user_path(current_user) %>">
<%= gravatar_for current_user, size: 52 %>
</a>
<h1>
<%= current_user.name %>
</h1>
<span>
<%= link_to "view my profile", current_user %>
</span>
<span>
<% if signed_in? %>
<div class="row">
<aside class="span4">
<section>
<%= render 'shared/user_info' %>
</section>
<section>
<%= render 'shared/micropost_form' %>
</section>
</aside>