This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://www.nginx.com/resources/wiki/start/topics/tutorials/install/ | |
# Switch to root | |
sudo su | |
# Add the mainline release | |
echo "deb http://nginx.org/packages/mainline/ubuntu/ xenial nginx | |
deb-src http://nginx.org/packages/mainline/ubuntu/ xenial nginx" > /etc/apt/sources.list.d/nginx.list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Generates a single row in a csv from an array of | |
* data by writing the array to a temporary file and | |
* returning it's contents | |
* | |
* @param array $row Row data | |
* @return mixed string with the row in csv-syntax, false on fputcsv or fwrite failure | |
*/ | |
protected function _generateRow($row = null) { | |
static $fp = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function deleteAllNonRequestableByPayrollPeriodId($payrollPeriodID) { | |
$conditions = [ | |
$this->alias . '.payroll_period_id' => $payrollPeriodID, | |
$this->alias . '.is_approved' => false, | |
$this->alias . '.is_closed' => false | |
]; | |
$ids = $this->find( | |
'all', | |
array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public $validate = array( | |
'employee_id' => array( | |
'required' => array( | |
'rule' => array('notBlank'), | |
'required' => true, | |
'allowEmpty' => false, | |
'message' => 'Employee ID must be specified!' | |
), | |
), | |
'email' => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We need to write a little shell script to wrap wkhtmltopdf in xvfb. Make a file called wkhtmltopdf.sh and add the following: | |
xvfb-run -a -s "-screen 0 1024x768x24" wkhtmltopdf "$@" | |
Move this shell script to /usr/local/bin, and set permissions: | |
sudo chmod a+x /usr/local/bin/wkhtmltopdf.sh | |
Check to see if it works once again: run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Quotes and prepares fields and values for an SQL UPDATE statement | |
* | |
* @param Model $Model The model to prepare fields for. | |
* @param array $fields The fields to update. | |
* @param bool $quoteValues If values should be quoted, or treated as SQL snippets | |
* @param bool $alias Include the model alias in the field name | |
* @return array Fields and values, quoted and prepared | |
*/ | |
protected function _prepareUpdateFields(Model $Model, $fields, $quoteValues = true, $alias = false) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen [::]:80; | |
rewrite ^(.*) http://cube.example.com$1 permanent; | |
root /var/www/cube.example.com/html/app/webroot; | |
# Add index.php to the list if you are using PHP | |
index index.php index.html index.htm index.nginx-debian.html; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Flash Component | |
* | |
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org) | |
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) | |
* | |
* Licensed under The MIT License | |
* For full copyright and license information, please see the LICENSE.txt | |
* Redistributions of files must retain the above copyright notice. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Magic method for verbose flash methods based on element names. | |
* | |
* For example: $this->Flash->success('My message') would use the | |
* success.ctp element under `app/View/Element/Flash` for rendering the | |
* flash message. | |
* | |
* @param string $name Element name to use. | |
* @param array $args Parameters to pass when calling `FlashComponent::set()`. | |
* @return void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public $components = array( | |
'Paginator', | |
'RequestHandler', | |
'DataTable.DataTable' => array( | |
'Employee' => array( | |
'columns' => array( | |
'id' => false, // bSearchable and bSortable will be false | |
'last_name' => array('label' => 'Last Name', 'bSearchable' => true, 'bSortable' => true), // bSearchable and bSortable will be true, with a custom label `Name` | |
'first_name' => array('label' => 'First Name', 'bSearchable' => true, 'bSortable' => true,), | |
'nic_number' => array('label' => 'NIC #', 'bSearchable' => true, 'bSortable' => true), |
NewerOlder