Skip to content

Instantly share code, notes, and snippets.

View rossriley's full-sized avatar

Ross Riley rossriley

View GitHub Profile
(function($) {
//base function to call and setup everything
$.fn.modal=function(options){
return this.each(function(){
if(this._modal) return; //if already a modal return
if(typeof(options) != "undefined") var params = $.extend({}, $.fn.modal.defaults, options); //if some options are passed in merge them
else var params = $.fn.modal.defaults;
if(typeof(modal_count) == "undefined") modal_count=0; //set the counter to 0
modal_count++;
this._modal=modal_count; //set what modal number this is
@rossriley
rossriley / Configuration.php
Created November 24, 2012 13:13
Trait for defaults and settings
<?php
trait Configuration{
protected static $_defaults;
protected $_settings;
public function settings($key){
if(isset($this->_settings[$key]) && is_callable($this->_settings[$key])) return call_user_func($this->_settings[$key]);
if(isset($this->_settings[$key])) return $this->_settings[$key];
if(isset(self::$_defaults[$key]) && is_callable(self::$_defaults[$key])) return call_user_func(self::$_defaults[$key]);
@rossriley
rossriley / custom.twig
Created August 5, 2014 09:21
Example template
{% extends 'base.twig' %}
{% block title %}Custom Page Title{% endblock %}
{% block css %}
{{ parent() }}
<link rel="stylesheet" type="text/css" href="/my/custom/file.css">
{% endblock %}
{% block content %}
all content goes in here
{% endblock %}
{% block js %}
@rossriley
rossriley / boltS3.php
Last active July 9, 2019 13:34
Adding an S3 filesystem for Bolt
<?php
use Aws\S3\S3Client;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\AwsS3 as Adapter;
$client = S3Client::factory(array(
'key' => '[your key]',
'secret' => '[your secret]',
'region' => '[aws-region]'
));
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
@rossriley
rossriley / gist:9213cc313a2b56830149
Last active August 29, 2015 14:14
Bolt Simple Page Contenttype
pages:
name: Pages
singular_name: Page
fields:
title:
type: text
slug:
type: slug
uses: title
image:
composer install --optimize-autoloader --prefer-dist --no-scripts
./vendor/bin/phpunit
composer install --optimize-autoloader --prefer-dist --no-scripts --no-dev
docker build -t <appname>_img:$CI_BUILD_REF_NAME .
docker tag <appname>_img:$CI_BUILD_REF_NAME quay.io/<username>/<appname>:$CI_BUILD_REF_NAME
docker push quay.io/<username>/<appname>:$CI_BUILD_REF_NAME
@rossriley
rossriley / gist:e9b62205fca6000fd1f7
Last active August 29, 2015 14:15
Custom Thumbnail Responder for retina images
<?php
use Bolt\Thumbs\ThumbnailResponder;
class RetinaThumbnailResponder extends ThumbnailResponder
{
public function parseRequest()
{
parent::parseRequest();
@rossriley
rossriley / gist:0a2dc17108ac9f2f13b3
Created March 1, 2015 11:05
Bolt Contenttypes Using References
pages:
name: Pages
singular_name: Page
field_defaults: &defaults
title:
type: text
class: large
slug:
type: slug
uses: title
@rossriley
rossriley / gist:61fbe845453257c3e39f
Created March 15, 2015 22:25
Public / Private Split Bootstrap
<?php
require_once "../private/vendor/autoload.php";
$configuration = new Bolt\Configuration\Composer(dirname(__DIR__)."/private");
$configuration->setPath("web","../public");
$configuration->setPath("files","../public/files");
$configuration->setPath("themebase","../public/theme");
$configuration->getVerifier()->removeCheck('apache');
$configuration->verify();
$app = new Bolt\Application(array('resources'=>$configuration));
$app->initialize();