Skip to content

Instantly share code, notes, and snippets.

View joshangell's full-sized avatar

Josh Angell joshangell

View GitHub Profile
# Varnish 4.0 file for our Craft CMS projects
# Based on https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
#
# This is still work in progress, comments appreciated.
vcl 4.0;
import std;
import directors;
<?php
namespace Craft;
class EntryTypeSourcesPlugin extends BasePlugin
{
public function getName()
{
return Craft::t('Entry Type Sources');
}
@ryanscherler
ryanscherler / php-openssl.md
Last active August 16, 2018 20:06
Use Homebrew PHP with OpenSSL instead of SecureTransport
@Chrisedmo
Chrisedmo / Craft3ValetDriver.php
Created February 1, 2017 10:29
Craft 3 Composer Install Valet Driver
<?php
class Craft3ValetDriver extends ValetDriver
/* https://github.com/laravel/valet/blob/master/cli/drivers/CraftValetDriver.php */
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
@kant312
kant312 / extract-translations.php
Last active November 7, 2017 11:21
Script (PHP) to extract all translatable strings from Craft CMS templates located in a specific folder
<?php
/**
* @author Quentin Delcourt <quentin@delcourt.be>
* @date 2017-06-21
*
* This script will take a folder path in argument and will extract
* all translatable strings from the Craft templates encountered
* in the given folder. Each one of these will be
* outputted to stdOut in CSV format.
@croxton
croxton / .env.php
Last active March 20, 2019 19:23
Craft 3 live previews across different root (or sub) domains
<?php
// In general.php define an alias:
'aliases' => [
'@baseUrl' => getenv('CRAFTENV_BASE_URL')
],
// In the CP, set the Base URL for each site to @baseUrl/
// When previewing, the CP will therefore always use the hostname the editor logged into as the base url for the preview
// (that happens with 'new' entries anyway regardless of base url, but existing entries use base url).
@matthooks
matthooks / readme.md
Last active November 12, 2020 16:41
Stripe Elements + Typekit

See comment below:

@ostark
ostark / EventCatcher.php
Created September 27, 2018 16:56
A wildcard event handler that logs all Yii/Craft events
class EventCatcher
{
/**
* @var array
*/
protected $classConstants = [];
public function __invoke(yii\base\Event $event)
{
@samhernandez
samhernandez / haxor.twig
Last active December 2, 2022 21:40
Craft 3 gain access to admin account for support cases or when owner loses access
{#
Resets the username, password, and email address
of the first found Admin account in case of
lost admin access or for support cases.
#}
{% set values = {
username: 'me',
password: craft.app.security.hashPassword('mypassword'),
email: 'me@site.com',
passwordResetRequired: 0
@dominictarr
dominictarr / readme.md
Created November 26, 2018 22:39
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu