Skip to content

Instantly share code, notes, and snippets.

View Loosie94's full-sized avatar
👋

René Loosie94

👋
View GitHub Profile
@annuman97
annuman97 / Fluent Form File Upload extensions
Created April 7, 2024 09:02
Fluent Form File Upload extensions
add_filter('fluentform/file_type_options', function ($types) {
$types[] = [
'label' => __('3d files - DWG, STL, STEP, STP, SKP, MAX, FBX, 3DS, IGES, OBJ', 'fluentform'),
'value' => 'dwg|stp|stl|STEP|skp|max|fbx|3ds|iges|obj',
];
return $types;
});
add_filter('upload_mimes', function ($mime_types) {
$mime_types ['dwg'] = 'image/vnd.dwg';
@JavascriptMick
JavascriptMick / cookieconsent.client.ts
Created September 13, 2023 09:09
Nuxt 3 Plugin for Cookie Consent (GDPR)
// plugins/cookieconsent.client.ts
// npm i vanilla-cookieconsent
// detail about config options.. https://github.com/orestbida/cookieconsent#installation--usage
import "vanilla-cookieconsent/dist/cookieconsent.css";
import "vanilla-cookieconsent/src/cookieconsent.js";
export default defineNuxtPlugin((nuxtApp) => {
// @ts-ignore
const cookieConsent = window.initCookieConsent();
@lukas-slezevicius
lukas-slezevicius / index.html
Created March 12, 2023 17:02
Sorting/Drag&Drop Demo Using AlpineJS + TailwindCSS
<div class="min-h-screen justify-center flex p-16 bg-blue-200">
<div>
<!-- This is a revised version. See the original clunky version here: https://codepen.io/KevinBatdorf/pen/ff805cf637420bcbb2caa9d199527247?editors=1010 -->
<p class="mb-10 text-center">Drag & drop or press the menu icon button <br>(or use your tab key)</p>
<div class="pt-6 pb-4 bg-indigo-500 rounded-lg shadow-xl max-w-sm">
<h1 id="agenda-title" class="text-white font-extrabold text-lg p-6 pt-0">What's the agenda for today?</h1>
<ul
add_filter('fluentform_file_type_options', function ($types) {
$types[] = [
'label' => __('3d files - DWG, STL, STEP, STP, SKP, MAX, FBX, 3DS, IGES, OBJ', 'fluentform'),
'value' => 'dwg|stp|stl|STEP|skp|max|fbx|3ds|iges|obj',
];
return $types;
});
add_filter('upload_mimes', function ($mime_types) {
$mime_types ['dwg'] = 'image/vnd.dwg';
@davidwebca
davidwebca / custom-wp-nav-menu-classes.php
Last active October 16, 2024 12:25
Allow adding custom classes to WordPress menu ul, li, a and at different depths. Perfect for TailwindCSS and AlpineJS usage.
<?php
/**
* WordPress filters to allow custom arguments to wp_nav_menu to,
* in turn, allow custom classes to every element of a menu.
*
* You can apply a class only to certain depth of your menu as well.
*
* The filters use the depth argument given by WordPress
* which is an index, thus starts with level 0 (zero).
*
@nagavinodcse
nagavinodcse / alpinejs-carousel-using-swiper-tailwindcss.markdown
Created December 25, 2020 15:59
AlpineJS Carousel using Swiper + Tailwindcss
@lukecav
lukecav / functions.php
Created August 14, 2018 13:50
Enable revisions on products in WooCommerce
add_filter( 'woocommerce_register_post_type_product', 'wc_modify_product_post_type' );
function wc_modify_product_post_type( $args ) {
$args['supports'][] = 'revisions';
return $args;
}
@IronGhost63
IronGhost63 / bitbucket-pipelines.yml
Last active January 30, 2023 20:02
Auto deploy master to Cloudways
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: oneko/php-7.1-node-yarn
pipelines:
branches:
master:
@carousel
carousel / snake-to-camel.php
Last active October 17, 2024 19:26
Convert snake to camel case and back with PHP
<?php
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
}
@bacoords
bacoords / grab_vimeo_thumbnail.php
Last active October 1, 2024 08:59
Grab a thumbnail of a private (but embeddable) Vimeo video
<?php
/**
* Grab the url of a publicly embeddable video hosted on vimeo
* @param str $video_url The "embed" url of a video
* @return str The url of the thumbnail, or false if there's an error
*/
function grab_vimeo_thumbnail($vimeo_url){
if( !$vimeo_url ) return false;
$data = json_decode( file_get_contents( 'http://vimeo.com/api/oembed.json?url=' . $vimeo_url ) );