Skip to content

Instantly share code, notes, and snippets.

View hofmannsven's full-sized avatar
🦖
Beast Mode

Sven hofmannsven

🦖
Beast Mode
View GitHub Profile
@translate3d
translate3d / index.js
Last active March 28, 2024 09:56
Run a Node.js script directly from GitHub Gist
#!/usr/bin/env node
console.log("\n");
console.log('👋 from GitHub Gist');
console.log("\n");
@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).
*
@WaseemMansour
WaseemMansour / inc\helpers\single-related-posts.php
Last active January 23, 2023 23:43
Related Posts Without Plugins
@offroadkev
offroadkev / functions.php
Created July 20, 2018 22:05
Change Gravity Forms Spinner to CSS Spinner
// Changes Gravity Forms Ajax Spinner (next, back, submit) to a transparent image
// this allows you to target the css and create a pure css spinner like the one used below in the style.css file of this gist.
add_filter( 'gform_ajax_spinner_url', 'spinner_url', 10, 2 );
function spinner_url( $image_src, $form ) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; // relative to you theme images folder
}
@jeffochoa
jeffochoa / Response.php
Last active November 26, 2024 13:38
Laravel HTTP status code
<?php
// This can be found in the Symfony\Component\HttpFoundation\Response class
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
@achmadfatoni
achmadfatoni / guzzle_raw_post_request.php
Created August 29, 2017 09:21
Guzzle Raw POST request
$client = new Client();
$array = [];
$res = $client->request('POST', $url, [
'body' => json_encode($array),
'headers' => [
'Content-Type' => 'application/json',
]
]);
@hofmannsven
hofmannsven / README.md
Last active January 25, 2023 10:47
Notes on Favicons, Tile Icon and Tab Icons

Favicons and more

Favicon

Install imagemagick: brew install imagemagick

Creating the .ico file with multiple sizes:

@hofmannsven
hofmannsven / README.md
Last active December 20, 2023 09:46
Notes on working with JetBrains PhpStorm IDE on macOS.
@benlk
benlk / 0-toc.md
Last active July 29, 2024 21:58
Collection of notes on WP_UnitTestCase
  1. Table of contents
  2. General information
    1. Terms
    2. General structure of a test
    3. WordPress-specific assertions and test functions
      • enqueues
      • creating posts
      • creating terms
      • attaching images
  • ?
@vishaltelangre
vishaltelangre / blur.css
Created April 17, 2014 09:34
cross browser blur filter using css
.blur {
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-ms-filter: blur(3px);
-o-filter: blur(3px);
/* FF doesn't support blur filter, but SVG */
filter: url("data:image/svg+xml;utf8,<svg height='0' xmlns='http://www.w3.org/2000/svg'><filter id='svgBlur' x='-5%' y='-5%' width='110%' height='110%'><feGaussianBlur in='SourceGraphic' stdDeviation='5'/></filter></svg>#svgBlur");
filter: progid: DXImageTransform.Microsoft.Blur(PixelRadius = '3');
filter: blur(3px);
}