Skip to content

Instantly share code, notes, and snippets.

View reatlat's full-sized avatar
🍋
Life gave me lemons, I forked.

Alex Zappa reatlat

🍋
Life gave me lemons, I forked.
View GitHub Profile
@reatlat
reatlat / .serverstatus.sh
Created June 18, 2018 22:13 — forked from seyDoggy/.serverstatus.sh
Shell script to monitor HTTP server status and email me when the server is not responding.
#!/bin/bash
NAME=Adam
TESTDATE=`date "+%B %e, %Y"`
TESTTIME=`date "+%H:%M:%S"`
auto_init() {
runTest
}
runTest() {
@reatlat
reatlat / get-browser-language.php
Created June 17, 2018 08:05 — forked from LucaRosaldi/get-browser-language-code.php
PHP: Detect Browser Language
<?php
/**
* Get browser language, given an array of avalaible languages.
*
* @param [array] $availableLanguages Avalaible languages for the site
* @param [string] $default Default language for the site
* @return [string] Language code/prefix
*/
function get_browser_language( $available = [], $default = 'en' ) {
if ( isset( $_SERVER[ 'HTTP_ACCEPT_LANGUAGE' ] ) ) {
@reatlat
reatlat / docker-compose-daemon.sh
Created June 2, 2018 20:35 — forked from domachine/docker-compose-daemon.sh
run docker-compose in daemon mode and attach to web container
docker-compose up -d
docker attach myapp_web_1
@reatlat
reatlat / install-yaourt.sh
Created June 2, 2018 20:20 — forked from blakek/install-yaourt.sh
An easy yaourt install script for Arch Linux (and variants). Made so I can set up Arch either offline or online without having to remember what I need.
#!/bin/bash -e
make_a_pkg() {
printf '** Making package "%s"...\n' "$1"
tar zxf "$1.tar.gz"
cd "$1"
makepkg -si
cd ..
}
@reatlat
reatlat / theme-options.php
Created April 23, 2018 13:04 — forked from mfields/theme-options.php
Sample theme options page for WordPress Themes.
<?php
/**
* _s Theme Options
*
* @package _s
* @since _s 1.0
*/
/**
* Register the form setting for our _s_options array.
@reatlat
reatlat / style.css
Created January 22, 2018 21:39
DIVI: Changing the Breakpoint of the Mobile Menu
/* Setting the breakpoint of the mobile menu */
@media only screen and ( max-width: 981px ) {
#top-menu-nav, #top-menu {display: none;}
#et_top_search {display: none;}
#et_mobile_nav_menu {display: block;}
}
@reatlat
reatlat / html-languages.txt
Created December 18, 2017 11:21 — forked from JamieMason/html-languages.txt
HTML lang attribute / ISO language code reference / Culture names
CULTURE SPEC.CULTURE ENGLISH NAME
--------------------------------------------------------------
Invariant Language (Invariant Country)
af af-ZA Afrikaans
af-ZA af-ZA Afrikaans (South Africa)
ar ar-SA Arabic
ar-AE ar-AE Arabic (U.A.E.)
ar-BH ar-BH Arabic (Bahrain)
ar-DZ ar-DZ Arabic (Algeria)
ar-EG ar-EG Arabic (Egypt)
@reatlat
reatlat / gist:d7d0b8b9754c0b74669b2c058771530d
Created December 8, 2017 02:21 — forked from fabiofl/gist:5873100
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@reatlat
reatlat / remove-docker-containers.md
Created November 26, 2017 22:55 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@reatlat
reatlat / remove-theme-mods-keep-menus
Created October 29, 2017 22:25 — forked from wpexplorer/remove-theme-mods-keep-menus
Remove all WordPress theme_mods but keep menu locations
// Get menu locations and save to array
$locations = get_theme_mod( 'nav_menu_locations' );
$save_menus = array();
foreach( $locations as $key => $val ) {
$save_menus[$key] = $val;
}
// Remove all mods
remove_theme_mods();
// Re-add the menus
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $save_menus ) );