Skip to content

Instantly share code, notes, and snippets.

View ivanmercedes's full-sized avatar
:octocat:

Ivan Mercedes ivanmercedes

:octocat:
View GitHub Profile
@ivanmercedes
ivanmercedes / ImageOptimizer.php
Created January 30, 2026 15:17
Laravel Image Optimizer Service (Intervention Image)
<?php
namespace App\Services;
use Intervention\Image\Drivers\Imagick\Driver;
use Intervention\Image\ImageManager;
class ImageOptimizer
{
@props([
'title' => 'Coming Soon',
'description' => "We're working hard to bring you this feature. Stay tuned for updates!",
'estimatedDate' => null,
'showNotifyButton' => true,
'className' => '',
'progress' => 75
])
<div
@ivanmercedes
ivanmercedes / laravelProjectDetector.js
Last active June 6, 2025 20:47
Detecta si el proyecto en el Workspace actual de VS Code está basado en Laravel.
import * as vscode from 'vscode';
export class LaravelProjectDetector {
async isLaravelProject(): Promise<boolean> {
const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
if (!workspaceFolder) {
return false;
}
try {
<?php
header('Content-Type: application/json');
header("Access-Control-Allow-Origin: *");
$username = 'TU_USERNAME';
$password = 'TU_PASSWORD';
$api_url = "https://el-api-de-pepe-donis.com/auth";
---
import { getImage } from "astro:assets";
const { imageUrl, alt = "" } = Astro.props;
const imageImports = import.meta.glob("../assets/**/*.{png,jpg,jpeg,webp}", {
eager: true,
});
interface ImageModule {
default: ImageMetadata;
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
@ivanmercedes
ivanmercedes / BottomSheetGlobal.tsx
Last active March 24, 2025 17:28
Global BottomSheet react native
import { useBottomSheetStore } from "@/store/useBottomSheetStore";
import { BottomSheetModal, BottomSheetView } from "@gorhom/bottom-sheet";
import { useEffect, useRef } from "react";
export default function BottomSheetGlobal() {
const bottomSheetRef = useRef<BottomSheetModal>(null);
const { isOpen, content, closeBottomSheet } = useBottomSheetStore();
useEffect(() => {
if (isOpen) {
@ivanmercedes
ivanmercedes / changeSenderNameWPEmail.php
Created May 12, 2022 15:40
Change Sender Name in Outgoing WordPress Email
<?php
// Function to change sender email
function wpb_sender_email( $original_email_address ) {
return 'no-replay@example.com';
}
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
return 'Example Name';
@ivanmercedes
ivanmercedes / babel.config.js
Created March 24, 2022 16:06
babel.config.js React Native dotenv
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module:react-native-dotenv",
{
moduleName: "@env",
path: ".env",
@ivanmercedes
ivanmercedes / wc-logout-one-click.php
Created February 10, 2021 13:36
Remove WooCommerce Logout Confirmation with Template Redirect
<?php
//The following is the code that you should add to the functions.php
//file of your theme to remove the WooCommerce logout confirmation message:
add_action( 'template_redirect', 'logout_confirmation' );
function logout_confirmation() {
global $wp;
if ( isset( $wp->query_vars['customer-logout'] ) ) {