Skip to content

Instantly share code, notes, and snippets.

View felipeabajo's full-sized avatar

@felipeabajo felipeabajo

View GitHub Profile
@felipeabajo
felipeabajo / JS for checking special characters in a field of a form in a model driven Power App
Created June 20, 2024 10:01
JS for checking special characters in a field of a form in a model driven Power App
function CheckForSpecialCharacters(executionContext) {
'use strict';
var formContext = executionContext.getFormContext();
var StreetAddressField = formContext.getAttribute("crf8e_nombre").getValue();
const specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
if (StreetAddressField === null) return;
if (specialChars.test(StreetAddressField)) {
formContext.getControl("crf8e_nombre").setNotification("The following characters are not allowed: [`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]", 102);
@felipeabajo
felipeabajo / Change color of text for lookup columns in SharePoint lists
Last active July 14, 2024 19:02
Change color of text for lookup columns in SharePoint lists
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField.lookupValue",
"attributes": {
"target": "_blank",
"href": {
"operator": "+",
"operands": [
"/sites/REPLACE WITH SITE/Lists/REPLACE WITH LIST/DispForm.aspx?ID=",
@felipeabajo
felipeabajo / Change color of text for hyperlink columns in SharePoint lists
Created July 14, 2024 19:02
Change color of text for hyperlink columns in SharePoint lists
@felipeabajo
felipeabajo / String replacement with media queries in jQuery
Created November 12, 2024 20:33
String replacement with media queries in jQuery
jQuery(document).ready(function( $ ){
if (window.matchMedia('(min-width: 767px)').matches) {
var test = jQuery(".hide-text:nth-of-type(2)").html(); jQuery(".hide-text:nth-of-type(2)").html(test.replace('text',''));
var test = jQuery(".hide-text:nth-of-type(1)").html(); jQuery(".hide-text:nth-of-type(1)").html(test.replace('text',''));
@felipeabajo
felipeabajo / Allow ICO Mime type in WordPress (functions.php)
Created November 14, 2024 22:02
Allow ICO Mime type in WordPress (functions.php)
/*upload ico files */
function upload_ico_files( $types, $file, $filename, $mimes ) {
if ( false !== strpos( $filename, '.ico' ) ) {
$types['ext'] = 'ico';
$types['type'] = 'image/ico';
}
return $types;
}
add_filter( 'wp_check_filetype_and_ext', 'upload_ico_files', 10, 4 );
@felipeabajo
felipeabajo / Simple-lightbox sample
Created March 10, 2025 22:25
Simple-lightbox sample
<a href="https://fabagon.com/wp-content/uploads/Captura-de-pantalla-Model-driven-Power-Apps-Aplicacion-de-demostracion.webp">
<figure class="wp-block-image size-full">
<img src="https://fabagon.com/wp-content/uploads/Captura-de-pantalla-Model-driven-Power-Apps-Aplicacion-de-demostracion.webp" alt="" class="wp-image-1350"/><figcaption class="wp-element-caption">Captura de pantalla de una aplicación de demostración hecha con Model-driven Power Apps</figcaption></figure>
</a>