Skip to content

Instantly share code, notes, and snippets.

@Gkiokan
Gkiokan / .htaccess
Created September 12, 2017 10:58
The WPMS non-www to www but grant access to wp-* problem in htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/wp-admin
RewriteCond %{REQUEST_URI} !^/wp-json
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
@Gkiokan
Gkiokan / alias.sh
Last active September 14, 2017 08:23
Alias mapping in terminal
echo " > Loading Aliases "
# Basics
alias ..="cd .."
alias lsa="ls -al"
alias swatch="sass --watch "
alias sfull="sass --watch sass:css --style=compressed"
alias sf="sfull"
alias m="~/.dotfiles/mount.sh"
alias s="source ~/.dotfiles/server.sh"
@Coopeh
Coopeh / get_domain_mapped_url.php
Created December 18, 2012 19:25
Get Domain Mapped URL From BlogID
<?php
// Function to get a blog/site's domain mapped url.
//
// You need to call it with a blog ID
//
// Example:
// $custom_blog_id = '14';
// echo get_domain_mapped_url( $custom_blog_id );
//
@pythoninthegrass
pythoninthegrass / cask_gist.txt
Last active May 2, 2020 18:17 — forked from jitendravyas/gist:8d35b092dd9102a05ea3
Brew Cask installation with Laptop script
#!/bin/sh
# homebrew taps
brew tap caskroom/cask
brew tap caskroom/versions
brew tap homebrew/boneyard
brew tap caskroom/fonts
# Updated grep
@kucrut
kucrut / nav-menu-item-custom-fields.php
Created September 29, 2012 15:39 — forked from westonruter/nav-menu-item-custom-fields.php
Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
<?php
/**
* Proof of concept for how to add new fields to nav_menu_item posts in the WordPress menu editor.
* @author Weston Ruter (@westonruter), X-Team
*/
add_action( 'init', array( 'XTeam_Nav_Menu_Item_Custom_Fields', 'setup' ) );
class XTeam_Nav_Menu_Item_Custom_Fields {
static $options = array(
@levymetal
levymetal / functions.php
Last active November 1, 2022 02:39
Similar to https://gist.github.com/levymetal/5064699, except this displays all sub-pages as well.
<?php
function my_custom_submenu() {
global $post;
$menu_items = wp_get_nav_menu_items('Menu');
$current_menu_id = 0;
// get current top level menu item id
foreach ( $menu_items as $item ) {
@AlCalzone
AlCalzone / how-to-async.md
Last active February 7, 2023 10:38
JavaScript: How to Async? (german)

How to? - Asynchroner Code

Kapitel 1: Synchroner Code

Ausgangslage: Synchroner Code. Einfach zu lesen, klarer Programmablauf:

const ergebnis1 = synchroneFunktion1();
const ergebnis2 = synchroneFunktion2();
tueWasMitErgebnis(ergebnis1, ergebnis2);
@coreywelch
coreywelch / LowercaseRoutes.php
Last active April 28, 2023 19:19
Here is a middleware class for laravel 5 that takes incoming routes and forces them to lowercase.
<?php
namespace App\Http\Middleware;
use Closure;
use \Illuminate\Support\Facades\Redirect;
class LowercaseRoutes
{
/**
@Gkiokan
Gkiokan / json-encode-decode-class.php
Created January 8, 2018 10:04
JSON full encode decode with UTF-8 support
/*
Data Class
* * * * * * *
Author: Gkiokan
Comment:
Encode and Decode Your String / Object / Array with utf-8 force.
*/
class Data {
// Encode
@fvosberg
fvosberg / install-composer.sh
Created April 19, 2016 20:24
Install composer oneliner for bash with curl
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer