Skip to content

Instantly share code, notes, and snippets.

View destinydriven's full-sized avatar

destinydriven destinydriven

View GitHub Profile
<?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.
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;
@destinydriven
destinydriven / DboSource.php
Last active October 18, 2017 02:08 — forked from anonymous/gist:e8a986aba73db0375ec91c7cc7411839
_prepareUpdateFields()
/**
* 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) {
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
public $validate = array(
'employee_id' => array(
'required' => array(
'rule' => array('notBlank'),
'required' => true,
'allowEmpty' => false,
'message' => 'Employee ID must be specified!'
),
),
'email' => array(
@destinydriven
destinydriven / Timesheet.php
Last active July 26, 2018 17:36
method deleteAllNonRequestableByPayrollPeriodId()
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(
/**
* 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;
@destinydriven
destinydriven / install-nginx-latest.sh
Created September 23, 2018 23:11 — forked from craigvantonder/install-nginx-latest.sh
Install Nginx Mainline / Stable on Ubuntu 16.04
#!/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