Skip to content

Instantly share code, notes, and snippets.

Install Homebrew OS X package manager:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install ffmpeg with x265 support:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
Convert video to x265:
ffmpeg -i input -c:v libx265 -preset medium -crf 28 -c:a aac -b:a 128k output.mp4
Uninstall ffmpeg:
<?php
/*
* Note! This is no longer updated here in the Gist. It has been moved to a repo.
*
* @link https://github.com/daggerhart/wp-custom-menu-items
*/
/**
* Class custom_menu_items
@irazasyed
irazasyed / manage-etc-hosts.sh
Created March 7, 2015 09:16
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
@steppohub
steppohub / Hide pages from non-admins
Last active August 29, 2015 14:06
Hide pages from non administrators
// hide specific pages from the All pages list, choose ids manually!
add_action( 'pre_get_posts' ,'exclude_this_page' );
function exclude_this_page( $query ) {
if( !is_admin() )
return $query;
global $pagenow;
if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
@lcherone
lcherone / htaccessCRUD.class.php
Last active September 4, 2018 05:20
PHP .htaccess CRUD class
<?php
/**
* .htaccess writer CRUD class
*
* @author Lawrence Cherone
* @version 1.00
*/
class htaccessCRUD
{
public $file;
@gaspanik
gaspanik / bs-config.js
Created June 3, 2014 09:08
Browser-Sync Config for WordPress Theme Dev.
/*
|--------------------------------------------------------------------------
| Browser-sync config file
|--------------------------------------------------------------------------
|
| Please report any issues you encounter:
| https://github.com/shakyShane/browser-sync/issues
|
| For up-to-date information about the options:
| https://github.com/shakyShane/browser-sync/wiki/Working-with-a-Config-File
@rrgrs
rrgrs / installvagrant
Last active April 22, 2021 12:02
installs brew, virtualbox, and vagrant in osx
if ! type "brew" > /dev/null; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
fi
brew cask install vagrant;
brew cask install virtualbox;
@FernE97
FernE97 / typekit-enqueue.php
Last active April 20, 2019 01:46
PHP: WordPress Typekit wp_enqueue
<?php
function h5bs_enqueue_scripts() {
wp_enqueue_script( 'typekit', '//use.typekit.net/xxxxxxx.js' );
}
add_action( 'wp_enqueue_scripts', 'h5bs_enqueue_scripts' );
function h5bs_typekit_inline() {
@mikeflynn
mikeflynn / etchosts.sh
Created December 13, 2012 19:04
An /etc/hosts manager bash script (v1.1) -- Added import and export commands!
#!/bin/bash
HOSTSFILE="/etc/hosts"
BAKFILE="$HOSTSFILE.bak"
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$"
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$"
backup()
{