Skip to content

Instantly share code, notes, and snippets.

View nmyers's full-sized avatar

Nicolas nmyers

View GitHub Profile
@nmyers
nmyers / patch-permissions.sh
Created May 10, 2019 08:34
Patch permission changes
#see https://stackoverflow.com/questions/2517339/how-to-restore-the-permissions-of-files-and-directories-within-git-if-they-have
git diff -p -R --no-color \
| grep -E "^(diff|(old|new) mode)" --color=never \
| git apply
@nmyers
nmyers / webfaction-wp-cli.md
Created June 1, 2018 10:43 — forked from raquelmsmith/webfaction-wp-cli.md
How to install WP-CLI on WebFaction

I had difficulty installing WP-CLI properly on my WebFaction server because of the inability to use the sudo command to move the .phar file to the proper wp directory. The WebFaction support team was helpful as usual with some good instructions.

  1. Log in to your WebFaction account via SSH: https://docs.webfaction.com/user-guide/access.html
  2. Run the following command on the root directory: curl -so ~/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar It's probably a good idea to check the download URL there with the official WP-CLI installation instructions to make sure it hasn't changed.
  3. Run the following command: chmod u+x ~/bin/wp
  4. Check to make sure it's installed correctly with wp --info.
@nmyers
nmyers / bash_profile.sh
Last active June 1, 2018 08:39 — forked from aliang/Mac SSH Autocomplete
Add auto complete to your ssh, put into your .bash_profile - Mac SSH Autocomplete
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@nmyers
nmyers / addkey.sh
Last active June 1, 2018 08:58
Adding local ssh key to authorized key on a remote server
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'
@nmyers
nmyers / .htaccess
Created April 6, 2018 08:34
redirect images to another server .htaccess #htaccess #wordpress
# local settings
RewriteEngine On
RewriteRule ^(wp-content/uploads/.*) https://lansons.com/$1 [L]
@nmyers
nmyers / functions.php
Created March 6, 2018 11:11
Custom tinymce editor wordpress #wp
function custom_tiny_mce( $settings ) {
$settings['toolbar1'] = 'styleselect,bold,italic,bullist,blockquote,hr,alignleft,aligncenter,link,unlink';
$style_formats = array(
array(
'title' => 'Content Block',
'block' => 'span',
'classes' => 'content-block',
'wrapper' => true,
),
array(
@nmyers
nmyers / _wpb_menu-icons.md
Last active March 6, 2018 11:09
Wordpress menu with icons #wp

Menu icons block

@nmyers
nmyers / gist-get-files.sh
Created June 23, 2017 11:10
Get files only from gist
git clone --depth 1 https://gist.github.com/d5d78fc32e458d309eab4fb89a258f1b.git social-share; cd social-share ; rm -rf .git
@nmyers
nmyers / inc-social-share.php
Last active March 6, 2018 11:09
Social Share #wp
<?php
function add_opengraph_markup() {
if (is_single()) {
global $post;
$twitter_handle = '';
$image = get_image(get_field('main_image'),'692x410');
$description = substr(strip_tags($post->post_content),0,200) . '...';
?>
<meta property="og:title" content="<?php the_title(); ?>" />
@nmyers
nmyers / fluidbricks.js
Last active August 29, 2015 14:18
Fuidbricks - basic masonry alternative
/**
* Requires imagesLoaded
*
*/
(function($) {
$.fluidbricks = function(element, options) {
var defaults = {
'itemClass': '.element',