Skip to content

Instantly share code, notes, and snippets.

View hendrikeng's full-sized avatar

Hendrik Werner hendrikeng

  • WeWereYoung
  • Hamburg, Germany
View GitHub Profile
@gisu
gisu / image.vue
Created March 16, 2019 16:04
Vue Wrapper for Imgix
<template>
<figure
class="eg-image relative"
@clicks="clickTransfer()"
>
<div
:class="[bgColorClass, { 'h-full w-full': background, rounded, 'skeleton': showSkeleton}]"
:style="[presized ? styleObject : '']"
>
<no-ssr>
<?php
namespace modules;
use Craft;
use craft\elements\Entry;
use craft\events\ModelEvent;
use DateTime;
use yii\base\Event;
@dennisfrank
dennisfrank / Buddy-craft3-atomic-deployment-pipeline.yml
Last active July 31, 2019 18:09
Buddy.works Craft 3 Atomic Deployment Pipeline
- pipeline: "Build and deploy to [environment]"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "develop"
actions:
- action: "Init: Atomic Deployment"
type: "SSH_COMMAND"
working_directory: "${remote_path}/"
login: "${user}"
host: "${host}"
port: "22"
@croxton
croxton / post-deploy.md
Last active June 6, 2019 17:44
Buddy Works Craft 3 post-deployment atomic deployment action

atomic-deploy-pipeline

if [ -d "releases/${execution.to_revision.revision}" ] && [ "${execution.refresh}" = "true" ]; then echo "Removing: releases/${execution.to_revision.revision}" && rm -rf releases/${execution.to_revision.revision}; fi
if [ ! -d "releases/${execution.to_revision.revision}" ]; then echo "Creating: releases/${execution.to_revision.revision}" && cp -dR deploy-cache releases/${execution.to_revision.revision}; fi
echo "Creating: persistence directories"
mkdir -p storage/craft
mkdir -p storage/cpresources
mkdir -p storage/uploads
{% extends '_layouts/standard' %}
{% set cacheContentBlock = true %}
{% block content %}
{# ...content worth caching #}
{% endblock %}
@martinherweg
martinherweg / DepartmentFile.json
Last active November 13, 2017 13:12
Create new Sections based on a Base JSON
{
"sections": [
{
"name": "A New Section",
"handle": "a_new_section_handle"
}
]
}
@adamwathan
adamwathan / promise-take-at-least.js
Last active February 26, 2023 14:25
Promise.takeAtLeast
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@martinherweg
martinherweg / downloadCraftPlugins.js
Last active July 24, 2017 12:20
Allows you to install new Craft
/**
* Download Craft Plugins
*
* @package generator-mh-boilerplate
* @author Martin Herweg <info@martinherweg.de>
*/
const inquirer = require('inquirer');
const download = require('download');
const ProgressBar = require('progress');
@martinherweg
martinherweg / browserSync.js
Last active May 29, 2021 08:07
Webpack + BrowserSync + HMR
/**
|--------------------------------------------------------------------------
| gulp browser-sync
|--------------------------------------------------------------------------
*
* Browser Sync
* @description Refresh the Brwoser after File Change.
* Combined with webpack for HMR or Content Reload
*
* @package generator-mh-boilerplate
@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