Skip to content

Instantly share code, notes, and snippets.

View leevigraham's full-sized avatar
🍹

Leevi Graham leevigraham

🍹
View GitHub Profile
@leevigraham
leevigraham / Explanation.md
Last active October 19, 2021 10:42
Stimulus + Typescript Types

In stimulusjs you can define a component (known as a controller) like so:

import { Controller } from "stimulus";

export default class extends Controller {
  static targets = ["item"];
  
  function connect() {
 if(this.hasItemTarget) {
@leevigraham
leevigraham / AbstractRepository.php
Last active April 18, 2018 22:01
AbstractRepository::filterByCriteria - Parses a nested array and adds expressions to a query builder
<?php
namespace App\Doctrine\ORM\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\QueryBuilder;
abstract class AbstractRepository extends ServiceEntityRepository
{
/**
@leevigraham
leevigraham / example.html
Last active October 18, 2018 11:24
Renderless Flyout.Vue component
<flyout v-cloak>
<div slot-scope="props">
<button
v-on:click="props.toggle()"
v-bind:class="'border-2 p-1 ' + (props.isActive ? 'bg-green': 'bg-red')"
data-reference
>…</button>
<div
v-show="props.isActive"
class="list-reset bg-white border p-4 shadow z-10"
<template>
<div>
<div ref="trigger">
<slot name="trigger"
v-bind:isActive="isActive"
v-bind:toggle="toggle"
>
<button v-on:click="toggle">Toggle</button>
</slot>
</div>
@leevigraham
leevigraham / example.php
Last active April 8, 2018 01:49
Support for verb requests in craftcms v2
<?php
// Example in your plugin file
public function registerSiteRoutes(): array {
return [
'api/.*+' => ['action' => 'nCIG/preFlight', 'verb' => 'OPTIONS'],
];
}
0xab13d6983e7fe97b0c873f58536ad33412edc0a2
DOMAIN.buildbox.newism.com.au,
www.DOMAIN.buildbox.newism.com.au,
dev.DOMAIN.buildbox.newism.com.au,
stage.DOMAIN.buildbox.newism.com.au,
master.DOMAIN.buildbox.newism.com.au
@leevigraham
leevigraham / Generate ssl certificates with Subject Alt Names on OSX.md
Last active June 11, 2024 09:48
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

We're going to generate a key per project which includes multiple fully qualified domains. This key can be checked into the project repo as it's intended for local development but never used on production servers.

Save ssl.conf to your my_project directory.

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

#!/bin/bash
set -eu
echo "steps:"
echo "
- label: \":hammer: dev\"
command: |-
source .env
#!/bin/bash
set -eu
echo "steps:"
echo "
- label: \":hammer: dev\"
command: |-
source .env