Skip to content

Instantly share code, notes, and snippets.

View chrisvogt's full-sized avatar
🌸
✿◕‿◕

Chris Vogt chrisvogt

🌸
✿◕‿◕
View GitHub Profile
@chrisvogt
chrisvogt / bootstrap-featurette-shortcode.php
Last active December 16, 2015 17:09
First pass at a Bootstrap Featurette shortcode.
<?php
/*
| -------------------------------------------------------------------
| Featurette Shortcode
| -------------------------------------------------------------------
|*/
function lp_featurette( $atts, $content = null ) {
// --- wordpress shortcode processing ---
<?php
/**
* The Wyzant Search schema
*/
protected $_schema = array(
'SearchString' => array(
'type' => 'string',
'null' => true,
'default' => null,
'length' => 255,
@chrisvogt
chrisvogt / filter-param-array.php
Created May 27, 2013 14:21
$acceptableParams contains those NOT to be filtered out of the $params array.
<?php
* Process params passed to the search controller, stripping out
* any that are not relevant to the query at hand.
*
* @param array $params Query string parameters pulled from $this->params->query
* @return array Query string parameters with the garbage removed
*/
private function _extractQueryParams(array $params) {
if (isset($params) && is_array($params)) {
$acceptableParams = array('SearchString', 'MinHourly', 'MaxHourly', 'Zip', 'IsMale', 'Distance');
@chrisvogt
chrisvogt / cakephp-appfog-database.php
Last active June 18, 2018 05:06
Example showing how to connect CakePHP database config to AppFog's VCAP_SERVICES environment array.
<?php
class DATABASE_CONFIG {
public $default = array();
function __construct() {
## --- APPFOG --- ##
// Read in the VCAP_SERVICES environment variable, parse the json, and
// check to see if it exists. If it does, use the settings for our default
<?php
/**
* Records
*
* @var array
*/
public $records = array(
array( ## USER account
'id' => 1,
'uuid' => '51ab1e7b-6c5c-4079-ac4d-333232770b3e',
@chrisvogt
chrisvogt / cakephp-more-tag.php
Created June 26, 2013 20:44
CakePHP function to trim a string at the `<!-- more -->` tag.
<?php
/**
* Trim a string at the <!-- more --> tag, for CakePHP
*
* @author Chris Vogt <http://chrisvogt.me>
* @param string $content
* @return string $trimmed
*/
protected function _trimTheContent($content) {
$marker = '<!-- more -->';
@chrisvogt
chrisvogt / recursive-clean-directories.sh
Created July 25, 2013 15:32
Too often I have been given files with a history of SVN and OS X attribute garbage. This strips .DS_Store and .svn files from your project directory. May not be what you need or want if you have Subversion access.
find . -name .svn -exec echo {} \;
find . -name .DS_Store -exec echo {} \;
<div class="letter">
<p>Dear Friends,</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent euismod porta tempor. Donec pulvinar turpis nec velit pellentesque quis rhoncus sapien facilisis. Mauris quis massa dui, rhoncus viverra quam. Nulla tempus, augue ut consectetur facilisis, arcu elit pellentesque arcu, sed rutrum orci turpis pulvinar augue. Donec eget arcu mauris. Vestibulum tristique consequat lacus eget laoreet. Integer sed nisl sed nibh pulvinar ornare quis nec quam. Aenean rhoncus ligula ut lectus placerat a commodo quam vulputate. In eu metus turpis.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus facilisis erat in nibh auctor at aliquet velit vestibulum. Curabitur turpis diam, malesuada eu consequat eget, ultricies sed nunc. Aenean sed odio massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ornare vulputate congue. Quisque leo metus, condimentum nec molestie et, egestas luctus libero.</p>
<p>M
@chrisvogt
chrisvogt / bootstrap-cdn-starter-template.html
Created August 16, 2013 23:07
Starter HTML template for Bootstrap 3 hosted by BootstrapCDN.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link rel="shortcut icon" href="http://placehold.it/16x16&amp;text=HI">
<title>Yet Another Bootstrap Bootstrap</title>
@chrisvogt
chrisvogt / Save-HABTM-POST-data.php
Last active December 22, 2015 23:08
HABTM POST data
<?php
/**
* Events Controller: assign() method
*/
public function assign() {
if ($this->request->is('post')) {
if ($this->Event->saveAll($this->request->data)) {
$this->Session->setFlash(__('The attendee list has been updated.'), 'flash/success');
$this->redirect(array('action' => 'index'));
} else {