Skip to content

Instantly share code, notes, and snippets.

View tdwesten's full-sized avatar

Thomas van der Westen tdwesten

View GitHub Profile
@tdwesten
tdwesten / create_feature_branch.sh
Created May 16, 2024 10:29
Create Git Feature Branch Git CLI
#!/bin/bash
if [ -z "$1" ]; then
echo "Error: Please provide the name of the new branch as the first argument."
exit 1
fi
new_branch_name="feature/$1"
# 1. Check if the main branch exists
@tdwesten
tdwesten / ember-changeset-async-validate-sometimes.js
Last active April 27, 2023 12:08
Ember-Changeset async validate sometimes (promise)
import { get } from '@ember/object'
export default class AsyncValidateSometimes {
constructor(validators, condition) {
this.validators = validators
this.condition = condition
}
async validate(key, newValue, oldValue, changes, content) {
if (Array.isArray(this.validators)) {
@tdwesten
tdwesten / inline-truncate.ts
Created April 18, 2023 19:40
Ember inline-truncate modifier
import { Owner } from '@ember/test-helpers/build-owner';
import Modifier from 'ember-modifier';
export interface InlineTruncateSignature {
Args: null;
Element: HTMLCanvasElement;
}
export default class InlineTruncate extends Modifier<InlineTruncateSignature> {
declare element: HTMLCanvasElement;
@tdwesten
tdwesten / components.check-box\.js
Last active October 11, 2022 20:18
Label checkbox
import Component from '@glimmer/component';
export default class extends Component {
}
@tdwesten
tdwesten / gist:9943de1d1616472ee91ff55839f90d0e
Created December 15, 2021 12:47
Homestead Xdebug 3 VSCODE
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.discover_client_host=0
xdebug.client_port=9003
xdebug.max_nesting_level=512
xdebug.idekey=VSCODE
xdebug.client_host=10.0.2.2
xdebug.start_with_request=yes
xdebug.log = /home/vagrant/code/xdebug.log
xdebug.log_level=1
@tdwesten
tdwesten / acf importer
Created May 14, 2020 11:34
acf importer
<?php
/**
* Created by PhpStorm.
* User: thomasvanderwesten
* Date: 02-11-17
* Time: 11:25
*/
namespace AcfGroups;
<?php
class LocalValetDriver extends WordPressValetDriver {
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
*
* @return string|false
@tdwesten
tdwesten / set_slack_status
Created January 23, 2018 11:11
Set slack status by weekday
launch application "Slack"
set currentDay to weekday of (get current date)
if currentDay = Tuesday then
tell application "System Events"
tell application "Slack" to activate
key code 18 using {command down}
delay 1
keystroke "/status :baby_bottle: Yo, ben druk met poepluiers enzo.."
@tdwesten
tdwesten / Fieldattributes-Cheatsheet.md
Last active February 16, 2023 20:33
Fields attributes cheatsheet

Fields attributes cheatsheet

This is a overview of all default attributes associated with the different ACF(pro) fields. This Cheatsheet is quite handy when creating ACF fields with the StoutLogic Acf Builder.

Last update: 27/09/2017 ACF version: 5.6.2

Text field

$attributes = [
    'default_value' => '',
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>