Skip to content

Instantly share code, notes, and snippets.

View muskie9's full-sized avatar

Nic muskie9

View GitHub Profile
<?php
class MyUserForm extends UserDefinedForm{
private static $db = array(
'Template' => 'Enum("Template1","Template2","Template3")'
);
public funciton getCMSFields(){
$fields = parent::getCMSFields();
(function($) {
$(.cms-container).entwine(function($) {
onmatch: function(){
alert('Yay!!!');
}
});
});
<?php
public function CurrentLevel() {
$page = $this->owner;
$level = 1;
while(1) {
if($page->Parent) {
$level++;
$page = $page->Parent();
}else {
<?php
public function ProductTypeBrands(){
//list to return
$brands = ArrayList::create();
$addToBrands = function($product) use (&$brands){
if(!$brands->find($product->BrandID)){
$brands->push($Product->Brand());//Assuming the relation name for the has_one is Brand
}
var $mycolumns = $('.casestudies .study');
var height = 0;
$mycolumns.each(function () {
if ($(this).height() > height) {
height = $(this).height();
}
});
$mycolumns.height(height);
<?php
// TinyMCE Config
$config = HtmlEditorConfig::get('cms');
$config->disablePlugins('emotions', 'fullscreen');
$config->setButtonsForLine(1, 'formatselect,separator,bullist,numlist,
separator,bold,italic,sup,sub,separator,sslink,unlink,anchor,separator,ssmedia,pasteword,
separator,spellchecker,undo,redo,code');
$config->setButtonsForLine(2, 'tablecontrols');
$config->setButtonsForLine(3, '');
<?php
class FileUpdateTask extends BuildTask{
protected $title = 'File Update Task';
protected $enabled = true;
protected $description = 'Update files from cloud files to normal';
public function run($request){
<?
class YourObjectTest extends FunctionalTest{
public function testCanCreate(){
$nullMember = Member::create();
$nullMember->write();
$this->assertTrue(singleton('YourObject')->canCreate($nullMember));
$nullMember->delete();
}
<?php
class My_Controller extends Page_Controller
{
private static $allowed_actions = array(
'index',
'TestFunction',
);
<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