Skip to content

Instantly share code, notes, and snippets.

View muskie9's full-sized avatar

Nic muskie9

View GitHub Profile
@muskie9
muskie9 / SilverstripeDataObject.php
Created May 19, 2016 15:40 — forked from wernerkrauss/SilverstripeDataObject.php
Some PHPStorm / Intellij IDEA file templates for SilverStripe development
<?php
#parse("PHP File Header.php")
class ${NAME} extends DataObject {
private static \$db = array();
private static \$has_one = array();
private static \$has_many = array();
@muskie9
muskie9 / custom-search-acf-wordpress.php
Created May 12, 2016 15:09 — forked from charleslouis/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request
<?php
/**
* [list_searcheable_acf list all the custom fields we want to include in our search query]
* @return [array] [list of custom fields]
*/
function list_searcheable_acf(){
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF");
return $list_searcheable_acf;
}
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAgAElEQVR4Xu2dC5RUxbX397yZ9wxvlaeiQYyPoAGyMKCY6+N+ENGrQFSMgSsmCx8k4ANFVESeIpFEicuIy0RFvTcmXIzGR0QUFRWVEDAQQUBEZIBhgAHm2fOtfzVn7Onpnu6ZOaenTu//WWvWwPTpOrVr79q/ql276qTU1dXVCS+2AFuALcAWYAuwBXzdAinxAL2iokKysrIkJSWlSWFra2ulurpa2rVr1+i+aGXg72lpaZKRkdHgO/g7rkhl+brFWXm2AFuALcAWYAt40AL1QMdEfcGCBXLddddJx44dzaO+/vprmTVrloE0YD5p0iTp27dvxGq899578tRTT5nPiouL5c4775SCgoKoZaDMuXPnyo4dO8x3Lr/8crnooosE9XjmmWfknXfeMX8/88wz5ec//7mkpqZ6ID6LZAuwBdgCbAG2QHK0gAH6rl27DMzLy8vlgQcekA4dOhiIT5kyRbp27Spjx441sAbgf/3rXzeaTe/cuVNmzJghw4YNk+9973uyaNEi6dmzpxkARCtj8eLFsmXLFrnlllvkww8/lBUrVsjUqVNl69at8vzzz8tPf/pTCQQC8oc//EFGjhwpl1xySXK0OKVgC7AF2AJsAbaABy2QEggE6iZPnmxm3mvXrjVgxgx906ZNsnDhQpkzZ44UFRVJWVmZ3HHHHQbQffr0aVCV//3f/5V3333XDAowk16zZo0sWbJEfvGLX8gjjzzSqIybbrpJHn30Ubn22mtl4MCBZlaOOgwdOlQ+/vhjOeGEE+SGG24wz0A5GDBMmzYtZsjfg/ZhkWwBtgBbgC3AFvBFC5gZ+uHDh81a9c033yz33XefAfpHH30kTz75pIExQudHjx41MMdsfdCgQQ2Ee+KJJ2T79u1y7733GqBv3LjRzORHjRolgH14GZdddpn5+8SJE+X00083QL/nnnukc+fO
@muskie9
muskie9 / PhoneNumberField.php
Last active August 29, 2015 14:25 — forked from Zauberfisch/PhoneNumberField.php
Custom SilverStripe PhoneNumberField
<?php
/*
class MyDataObject extends DataObject {
private static $db = [
'FoobarCountryCode' => 'Varchar',
'FoobarAreaCode' => 'Varchar',
'FoobarPhoneNumber' => 'Varchar',
'FoobarExtension' => 'Varchar',
];
<?php
class MaxWidthHeightImageExtension extends DataExtension {
/**
* Crop an image if it exceeds a certain height.
* Use in templates e.g. $Image.SetWidth(200).MaxHeight(200)
*
* @param integer $maxHeight Max height of image
* @return Image
@muskie9
muskie9 / post-merge
Last active August 29, 2015 14:16 — forked from wernerkrauss/post-merge
#!/bin/bash
echo "running git post receive hook..."
DIR=$(git rev-parse --show-toplevel)
if [ -e "$DIR/composer.json" ]; then
if [ -d "$DIR/vendor" ]; then
composer.phar install
else
composer.phar update
fi
@muskie9
muskie9 / Page.php
Last active August 29, 2015 14:06 — forked from wernerkrauss/Page.php
<?php
class Page_Controller extends ContentController
{
private static $cdn_domain = 'cdn.mysite.com';
private static $cdn_rewrite = false;
public function handleRequest(SS_HTTPRequest $request, DataModel $model = null)
{