Skip to content

Instantly share code, notes, and snippets.

View hofmannsven's full-sized avatar
🌴
Coding

Sven hofmannsven

🌴
Coding
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@jeffochoa
jeffochoa / Response.php
Last active April 30, 2024 10:45
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;
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@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 February 11, 2024 01:35
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).
*
@hofmannsven
hofmannsven / README.md
Last active December 20, 2023 09:46
Notes on working with JetBrains PhpStorm IDE on macOS.
@henriquemoody
henriquemoody / phpunit.bash
Last active May 10, 2023 02:52
PHPUnit Bash Completion. sudo curl -L https://gist.githubusercontent.com/henriquemoody/5014805/raw/phpunit.bash -o /etc/bash_completion.d/phpunit && source /etc/bash_completion.d/phpunit
# Bash-Completion script for PHPUnit
#
# Created by Henrique Moody <henriquemoody@gmail.com>
#
_phpunit()
{
COMPREPLY=()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}"
@benlk
benlk / 0-toc.md
Last active March 29, 2023 13:13
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
  • ?
@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:

@WaseemMansour
WaseemMansour / inc\helpers\single-related-posts.php
Last active January 23, 2023 23:43
Related Posts Without Plugins