Skip to content

Instantly share code, notes, and snippets.

View goaround's full-sized avatar

Johannes Kinast goaround

View GitHub Profile
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@hlashbrooke
hlashbrooke / function.php
Created February 28, 2014 08:41
WordPress: Add post types to the 'At a glance' widget
<?php
add_filter( 'dashboard_glance_items', 'custom_glance_items', 10, 1 );
function custom_glance_items( $items = array() ) {
$post_types = array( 'post_type_1', 'post_type_2' );
foreach( $post_types as $type ) {
if( ! post_type_exists( $type ) ) continue;

Add to Buffer (in iframe)

Use this handy javascript snippet to add an "Add to Buffer" bookmark. Then you can add anything to your Buffer, anytime, all without leaving the page.

How it works

First, copy the following into your clipboard (it's the attached Javascript, but formatted as a bookmarklet):

javascript:(function()%7Bfunction%20c(a%2Cb)%7BbaseUrl%3D%22%2F%2Fbufferapp.com%2Fadd%3F%22%3Breturn%20baseUrl%2B%22url%3D%22%2Bd(a)%2B%22%26text%3D%22%2Bd(b)%7Dvar%20d%3DencodeURIComponent%3Bc(window.location.href%2Cwindow.document.title)%3Bvar%20a%3Ddocument.createElement(%22iframe%22)%3Ba.setAttribute(%22style%22%2C%22width%3A%20900px%3B%20height%3A%20500px%3B%20position%3A%20fixed%3B%20top%3A%2050%25%3B%20left%3A%2050%25%3B%20margin-left%3A%20-450px%3B%20margin-top%3A%20-250px%3B%20background%3A%20%23fff%3B%20border%3A%20solid%201px%20%23000%3B%20z-index%3A%201000%3B%22)%3Ba.setAttribute(%22frameborder%22%2C%220%22)%3Burl%3Dc(document.location.href%2Cdocument.title)%3Ba.src%3Durl%3Bdocument.body.a
@a-vasyliev
a-vasyliev / example.com.conf
Created March 25, 2015 11:42
Nginx: proxy cache without utm_* parameters (remove query parameter, remove utm tags nginx)
server {
listen 443;
server_name example.com;
error_log /var/log/nginx/example_com_error.log warn;
ssl on;
ssl_certificate /etc/nginx/ssl/your.crt; #certificate chains
ssl_certificate_key /etc/nginx/ssl/your.key; #private key
@rap2hpoutre
rap2hpoutre / laravel-forge-deploy.sh
Last active March 28, 2024 15:45
Laravel Forge deploy script without downtime
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/deploy" ]; then
rm -R /home/forge/deploy
fi
if [ -d "/home/forge/backup" ]; then
rm -R /home/forge/backup
fi
@cyberwani
cyberwani / contact-form-7-assets-on-form-page.php
Created July 15, 2017 04:36
Contact Form 7 plugin: Load Javascript and CSS on Pages, Posts and CPTs where Contact Form 7 shortcode is used.
<?php
// Unload CF7 assests
add_filter( 'wpcf7_load_js', '__return_false' );
add_filter( 'wpcf7_load_css', '__return_false' );
add_action( 'the_content', 'load_cf7_assets' );
function load_cf7_assets($content){
global $post;
@shospodarets
shospodarets / Chrome headless Puppeteer- capture DOM element screenshot using
Last active January 17, 2023 18:52
Chrome headless Puppeteer- capture DOM element screenshot using
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// Adjustments particular to this page to ensure we hit desktop breakpoint.
page.setViewport({width: 1000, height: 600, deviceScaleFactor: 1});
await page.goto('https://www.chromestatus.com/samples', {waitUntil: 'networkidle'});
const WordpressPurgeCSS = {
whitelist: [
"rtl",
"home",
"blog",
"archive",
"date",
"error404",
"logged-in",
"admin-bar",
@Zodiac1978
Zodiac1978 / projekt26-2020.md
Last active January 21, 2022 22:55
Teilnehmerinnen und Teilnehmer sowie alle Beiträge zur #Projekt26 Challenge im Jahr 2020

Am 28.12. habe ich mit einem Tweet zur #Projekt26 Challenge herausgefordert. Alle zwei Wochen bloggen und kommentieren, über Wordpress oder Verwandtes, in Deutsch oder Englisch. Alle Details dazu in diesem Artikel: https://torstenlandsiedel.de/2019/12/28/projekt26-jetzt-erst-recht/

Für 2021 geht es hier weiter: https://gist.github.com/Zodiac1978/2f13339f8431d1e5edf3365c39bdb12d

KW 1+2

@danielstgt
danielstgt / imagick3.4.4-PHP7.4-forge.sh
Last active April 19, 2024 11:33
Install ImageMagick / Imagick 3.4.4 on PHP 7.4 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.4.tgz
tar xvzf imagick-3.4.4.tgz