Skip to content

Instantly share code, notes, and snippets.

View michaeldeboeve's full-sized avatar

Michael de Boevé michaeldeboeve

View GitHub Profile
@michaeldeboeve
michaeldeboeve / input.scss
Created June 3, 2023 12:46
Generated by SassMeister.com.
@use 'sass:math';
@use 'sass:meta';
@use "sass:list";
@function strip-units($number) {
@if meta.type-of($number) == 'number' and not math.is-unitless($number) {
@return $number / ($number * 0 + 1);
}
@return $number;
}
@michaeldeboeve
michaeldeboeve / custom-properties.scss
Last active October 24, 2020 09:35
Generated by SassMeister.com.
@mixin setProp($prop, $val) {
--#{$prop}: #{$val};
}
@mixin prop($customProp, $renderedValue) {
// #{$customProp}: map-get($VariablesMap, $renderedValue);
#{$customProp}: var(unquote('--#{$renderedValue}'));
}
// Colors
<?php
function my_shortcode_attr( $atts, $content = null) {
$a = shortcode_atts( array(
'url' => '#',
'class' => ''
), $atts );
return '<a class="' . $a["class"] . '" href="' . $a["url"] . '">' . $content . '</a>';
}
add_shortcode( 'myshortcode', 'my_shortcode_attr' );
?>
@michaeldeboeve
michaeldeboeve / simple-shortcode.php
Created September 18, 2019 08:22
Simple shortcode
<?php
function my_shortcode( $atts, $content = null ) {
return '<span class="myshortcode-class">' . $content . '</span>';
}
add_shortcode( 'myshortcode', 'my_shortcode' );
?>
@michaeldeboeve
michaeldeboeve / wp-config.default.php
Created September 16, 2019 08:35
Wordpress multiple environments config
<?php
/**
* Default config settings
*
* Enter any WordPress config settings that are nonspecific to any environment
* in this file.
*/
/** Database Charset to use in creating database tables. */
@michaeldeboeve
michaeldeboeve / get_global_option.php
Last active October 9, 2023 08:01
wordpress - Fetch an ACF Options field value from the default language when empty (WPML/ACF)
<?php
/**
* Advanced Custom Fields Options function
* Fetch an Options field value from the default language when empty
*/
function cl_acf_set_language() {
return acf_get_setting('default_language');
}
@michaeldeboeve
michaeldeboeve / post-type-function.php
Last active September 16, 2019 08:45
Wordpress "is post type" function
<?php
function is_post_type($type){
global $wp_query;
if($type == get_post_type($wp_query->post->ID)) return true;
return false;
}
?>
{ item.url.length > 1 && <div className="hover-target">
<Button to={item.url} text={item.button} />
</div>
}
import React, { Component } from 'react';
class MyComponent extends Component {
constructor(props) {
super();
this.state = [{
}]
}
@michaeldeboeve
michaeldeboeve / Linux Mint Remove redundant packages.sh
Last active April 16, 2018 20:18
Stuff to do after Linux Mint Install
sudo apt-get remove mono-runtime-common gnome-orca virtualbox-guest*