Skip to content

Instantly share code, notes, and snippets.

View infostreams's full-sized avatar

Edward Akerboom infostreams

View GitHub Profile
@infostreams
infostreams / php.sh
Created November 8, 2021 10:20
Change PHP version on MacOS
#!/bin/bash
available=$(brew list --formula -1 | egrep '^php@|^php$')
syntax () {
echo "SYNTAX: $0 <version>"
echo ""
echo -n "<version> needs to be one of: "
echo $available
echo ""
@vielhuber
vielhuber / functions.php
Last active March 18, 2023 06:37
disable category / tag / date / author / archive pages / attachments #wordpress
<?php
function disable_uneeded_archives() {
if( is_category() || is_tag() || is_date() || is_author() || is_attachment() ) {
header("Status: 404 Not Found");
global $wp_query;
$wp_query->set_404();
status_header(404);
nocache_headers();
}
}
@infostreams
infostreams / record.sh
Created November 8, 2016 09:21
Collect details about internet / wifi availability (macOS)
#!/bin/sh
SCRIPTPATH=$(cd "$(dirname "$0")"; pwd -P)
while [ true ]
do
${SCRIPTPATH}/status.sh >> ${SCRIPTPATH}/log.txt
sleep 10
done
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@wadey
wadey / iterm2.zsh
Last active March 10, 2024 00:32
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"