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 / 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>
@tdwesten
tdwesten / Gulp.js
Last active January 12, 2020 05:37
Extract glyphs from a font and build a icon-font with gulp
var opentype = require( 'opentype.js' );
var fs = require( 'fs' );
var _ = require( 'lodash' );
gulp.task( 'icons', function() {
var icons = [];
var scss = '[class^="my-icon-"], [class*=" my-icon-"] { display: inline-block; font: normal normal normal 14px/1 "mylaps-icons"; font-size: inherit; text-rendering: auto; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }';
opentype.load( manifest.dependencies.icons.font[ 0 ], function( err, font ) {