Skip to content

Instantly share code, notes, and snippets.

View jasonvarga's full-sized avatar
🇦🇺

Jason Varga jasonvarga

🇦🇺
View GitHub Profile
@jasonvarga
jasonvarga / mod.trim_at.php
Last active August 29, 2015 14:21
ltrim_at Statamic Modifier
<?php
class Modifier_trim_at extends Modifier
{
public function index($value, $parameters=array())
{
return ltrim($value, '@');
}
}
/*
@jasonvarga
jasonvarga / _readme.md
Last active August 29, 2015 14:23
Restricting an account to specific sections in the CP

Simple Statamic CP edit restrictions

  • Add the hooks file to _add-ons/restrict_to/hooks.restrict_to.php.
  • Add the restrict_to tags field to your _config/bundles/member/fields.yaml.
  • To restrict pages, add them to the restrict_to field. eg. /blog, /calendar. They will only be allowed to edit pages that begin with this url.

Warning

If your member listing is visible, (it is by default), they can edit their own restricted pages.

title overview id
Laravel Blade
Blade is the templating engine supplied with Laravel. We think its neat and we won't even be offended if you want to use it. Here's how.
efa34b0d-b4c3-43fc-bb91-a6d331dc6026

The Blade Templating Language

You can find out how to use Blade, the templating language over on the Laravel docs.

@jasonvarga
jasonvarga / readme.md
Created May 24, 2016 22:01
Statamic Docs

Statamic Documentation

We allow users to contribute to the Statamic docs. The content is stored separate from the actual site so our users view and modify content but the site can be hidden.

Folder structure

/
|— /docs.statamic.com
| |— statamic
@jasonvarga
jasonvarga / protect.md
Created September 23, 2016 16:48
Statamic 2 Content Protection

Protecting Content {#protecting-content}

You may protect your content from unwanted visitors with the protect variable. By setting this variable you can allow or deny people in various ways. There are a number of schemes used for protecting content:

The protect variable can be placed in a number of places:

@jasonvarga
jasonvarga / aliases
Last active May 2, 2017 15:36
Interchangeable "please" and "artisan" regardless of Laravel/Statamic project type.
alias artisan='art_plz'
alias please='art_plz'
alias art='art_plz'
alias plz='art_plz'
function art_plz {
if [ -e artisan ]; then
php artisan "$@"
elif [ -e please ]; then
php please "$@"
<?php
namespace App\Factories;
abstract class Factory
{
public function instance()
{
return $this;
}
@jasonvarga
jasonvarga / aliases.sh
Created January 8, 2019 17:30
Turn off xdebug while running phpunit
# First, copy ext-xdebug.ini to ext-xdebug.ini.bak
alias xdebug-disable='echo "" > /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini'
alias xdebug-restore='cat /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini.bak > /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini'
function phpunit {
xdebug-disable
./vendor/bin/phpunit "$@"
xdebug-restore
}
@jasonvarga
jasonvarga / ClickHandler.js
Created February 6, 2019 18:39
Vue component that handles single and double clicks
export default {
render() {
return this.$scopedSlots.default({});
},
data() {
return {
listener: null,
timer: null,
@jasonvarga
jasonvarga / statamic2-vs-3.md
Last active March 5, 2021 18:53
Statamic 2 vs 3

Tests run on a 2013 Macbook Pro with 2.8GHz Intel Core i7, 16 GB 1600 MHz DDR3 using Laravel Valet.

Statamic 2 with 5000 entries

On a template listing 10 posts sorted by date.

Concurrency 1