Skip to content

Instantly share code, notes, and snippets.

View felipeabajo's full-sized avatar

@felipeabajo felipeabajo

View GitHub Profile
@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 / 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 / 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 / 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 / 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);
/*Versión con Emojis sin fotos*/
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="189" style="width:auto;border-top:none;border-bottom:none;border-left:none;border-right:1.5pt solid rgb(91,155,213);padding-right: 1rem; vertical-align: middle; min-width: 250px;">
<h3 style="margin:0cm 0cm 0.0001pt; font-family:Arial,sans-serif;color:black">Felipe
de Abajo Aragón</h3>
<p style="margin:0cm 0cm 0.0001pt;line-height:16.5pt; font-family:Arial,sans-serif;color:black">Informático y formador</p>
</td>
<td width="378" valign="top" style="auto;padding-left: 1rem; vertical-align: middle; min-width: 200px;">
@felipeabajo
felipeabajo / wordpress-sharing-buttons
Created February 9, 2024 22:38
Sharing buttons for WordPress
add_filter( 'the_content', function ( $content ) { if ( is_singular( 'post' ) ) {
/*********************
* choose icons
**********************/
$facebook = 1;
$twitter = 1;
$LinkedIn = 1;
$threads = 1;
$email = 1;
@felipeabajo
felipeabajo / snippets-for-github
Created December 20, 2023 08:58
Snippets for GitHub
Merge from branch not possible because branches do not share the same history:
git checkout [BRANCH]
git branch master [BRANCH] -f
git checkout master
git push origin master -f
@felipeabajo
felipeabajo / navigation-blazor-syncfusion
Created November 16, 2023 12:39
Snippets for navigation in Blazor using SyncFusion
/*NAVIGATION BETWEEN PAGES*/
/*Navigation to Razor pages from SyncFussion buttons*/
@inject NavigationManager NavigationManager
<SfButton Content="To CsHtml page from Sf Button" OnClick="@(() = NavigateToRazorPage("/REPLACEWITHCSHTMLPAGE"))"></SfButton>
@code{
async Task NavigateToRazorPage(string page) {
NavigationManager.NavigateTo(page);
}
}
@felipeabajo
felipeabajo / exiting-winforms-applications
Created November 14, 2023 15:39
Snippets for exiting WinForms applications
this.Close(); //If called in the main form, it closes the app too.
Application.Exit();
System.Diagnostics.Process.GetCurrentProcess().Kill(); // Causes an abnormal process termination and should only used when necessary.