Skip to content

Instantly share code, notes, and snippets.

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

Chris Vogt chrisvogt

🌸
✿◕‿◕
View GitHub Profile
<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 / 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 {} \;
@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 -->';
<?php
/**
* Records
*
* @var array
*/
public $records = array(
array( ## USER account
'id' => 1,
'uuid' => '51ab1e7b-6c5c-4079-ac4d-333232770b3e',
@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
@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');
<?php
/**
* The Wyzant Search schema
*/
protected $_schema = array(
'SearchString' => array(
'type' => 'string',
'null' => true,
'default' => null,
'length' => 255,
@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 ---
@chrisvogt
chrisvogt / wordpress-clean-header.php
Created April 25, 2013 19:10
Cleans up the Wordpress header
<?php
// Clean up the wordpress header by filtering out the following items from WP_HEAD():
function NAMESPACE_header_cleanup() {
// Really Simple Discovery
remove_action('wp_head', 'rsd_link');
// Windows Live Writer
remove_action('wp_head', 'wlwmanifest_link');
@chrisvogt
chrisvogt / cake-user-language.php
Last active December 16, 2015 10:49
A stab at user language localization by `User.user_lang`, a passed query param, or a stored session variable. This belongs in your AppController and should be called from the beforeFilter() method.
<?php
/**
* Language Handler.
*
* Sets the app's configured language based on passed parameter or language
* configuration stored in session variable.
*
* @author C1V0
*/
protected function _langHandler() {