working on it ...

Filters

Explore Public Snippets

Sort by

Found 7 snippets

    public by markcl modified Aug 6, 2014  2473  1  6  0

    Add Image Gallery to Page

    <?php
    class PortfolioItem extends Page {
        private static $db = array(
            'TrailerVideoURL' => 'Text',
        );
    
        private static $has_many = array(
            'Still' => 'Image'
        );
    
        function getCMSFields() {
    
            $fields = parent::getCMSFields();
    
            $fields->addFieldToTab(
                'Root.Upload',
                $uploadField = new UploadField(
                    $name = 'GalleryImages',
                    $title = 'Upload one or more images (max 10 in total)'
                )
            );
            $uploadField->setAllowedMaxFileNumber(10);
    
            return $fields;
        }
    }
    class PortfolioItem_Controller extends Page_Controller {
    }
    
    class GalleryImageExtension extends DataExtension {
        private static $belongs_one_many = array('Galleries' => 'GalleryPage');
    }
    
    Image::add_extension('GalleryImageExtension');

    public by markcl modified Jul 23, 2014  2735  7  5  2

    Change Directory and File Permissions Properly For Linux Web Server

    Sets file permissions to 644 and directory permissions to 755.
    find [YOURDIR] -type d -exec chmod 755 {} \;
    find [YOURDIR] -type f -exec chmod 644 {} \;

    public by markcl modified Jul 22, 2014  3087  7  5  1

    Git Clone into non empty directory

    git init
    git remote add origin PATH/TO/REPO
    git fetch
    git reset --hard origin/master  

    public by markcl modified Jul 22, 2014  2571  9  5  1

    Linux Sort Folders By Size

    du --max-depth=1 -h | sort -hr

    public by markcl modified Aug 13, 2013  2582  0  5  0

    Send Email

    PHP
    public static function appMail($subject, $message, $recipient){
    		$to      = $recipient;
    		$subject = $subject;
    		$message = $message;
    		$headers = 'From: admin@careel.com' . "\r\n" .
    			'Reply-To: admin@careel.com' . "\r\n" .
    			'X-Mailer: PHP/' . phpversion();
    
    		mail($to, $subject, $message, $headers);
    	}

    public by markcl modified Aug 11, 2013  3321  1  5  0

    HTML Upload File Form

    Upload file
    <form action="" method="post" enctype="multipart/form-data">
    	<input name="file" type="file">
    	<button type="submit">Submit</button>
    </form>

    public by markcl modified Aug 11, 2013  2521  0  5  0

    Laravel 4 Sentry Redirect Users to Dasboard Snippet

    $jobseekers = Sentry::getGroupProvider()->findByName('Jobseekers');
    $employers = Sentry::getGroupProvider()->findByName('Employers');
    	if($user->inGroup($jobseekers))
    	    return Redirect::to('employerDashboard');
    	// If user is in employers group, go to Jobhunter's Dashboard
    	if($user->inGroup($employers))
    	    return Redirect::to('employerDashboard');

    List Complete ( 7 snippets total )

    • Public Snippets
    • Channels Snippets