Skip to content

Instantly share code, notes, and snippets.

View benallfree's full-sized avatar

Ben Allfree benallfree

  • Reno, NV
View GitHub Profile
@benallfree
benallfree / iOS Compile & Debug
Created November 6, 2015 14:43
AppleScript to launch iOS Simulator and Safari debugger using iTerm
#!/usr/bin/osascript
# AppleScript to automatically compile Cordova and open the Safari debugger
set maxWait to 20
set hasClicked to false
set x to 0
set device_name to "Simulator"
# delay fix for yosemite
@benallfree
benallfree / custom-post-type-ui.diff
Created December 13, 2013 12:47
Add import/export to CPT.
Index: custom-post-type-ui.php
===================================================================
--- custom-post-type-ui.php (revision 821057)
+++ custom-post-type-ui.php (working copy)
@@ -59,6 +59,7 @@
add_submenu_page( 'cpt_main_menu', __( 'Add New', 'cpt-plugin' ), __( 'Add New', 'cpt-plugin' ), 'manage_options', 'cpt_sub_add_new', 'cpt_add_new' );
add_submenu_page( 'cpt_main_menu', __( 'Manage Post Types', 'cpt-plugin' ), __( 'Manage Post Types', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_cpt', 'cpt_manage_cpt' );
add_submenu_page( 'cpt_main_menu', __( 'Manage Taxonomies', 'cpt-plugin' ), __( 'Manage Taxonomies', 'cpt-plugin' ), 'manage_options', 'cpt_sub_manage_taxonomies', 'cpt_manage_taxonomies' );
+ add_submenu_page( 'cpt_main_menu', __( 'Import/Export', 'cpt-plugin' ), __( 'Import/Export', 'cpt-plugin' ), 'manage_options', 'cpt_sub_import_export', 'cpt_import_export' );
}
@benallfree
benallfree / iconify
Last active May 28, 2020 12:10
electron-react-boilerplate icon generation
#!/bin/bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/..
RSC="$ROOT/resources"
SRC="${RSC}/icons/1024x1024.png"
echo $SRC
if [ ! -f "$SRC" ]; then
echo "Please create resources/icons/1024x1024.png before running this script."
@benallfree
benallfree / fields-form.js
Created March 20, 2019 12:43
Toolset types plugin allow duplicate labels across repeating field groups
/* ./vendor/toolset/types/resources/js/fields-form.js */
/**
* Static Data
*/
var fieldFormStaticData;
/**
* fields edit
*/
jQuery(document).ready(function($){
@benallfree
benallfree / setup.sh
Last active August 15, 2018 01:03
Ubuntu LAMP++ (Ubuntu 18.04.1 LTS / Apache / PHP 7.2 / Beanstalk / Certbot / git / composer / git-lfs)
#!/bin/bash
SSHPK="..."
MYSQLP="..."
MYSQLDB="..."
USERP="..."
ufw allow http
ufw allow https
ufw allow mysql
ufw allow ssh
echo y | ufw enable
<div>*|FEEDBLOCK:http://ctoguy.com/feed.rss?pw=asdf|*<br />
*|FEEDITEMS:[$count=4]|*
<h4><a href="*|FEEDITEM:URL|*">*|FEEDITEM:TITLE|*</a></h4>
<div style="clear: both; word-break: keep-all"><a href="*|FEEDITEM:URL|*"><img src="*|FEEDITEM:ENCLOSURE_URL|*" style="border: 0px initial;
width: 250px;
margin: 0px;
border-radius: 3px;
float: left;
margin-right: 15px;
@benallfree
benallfree / trellis-tools.sh
Created July 15, 2017 01:18
Command line tools installation
# If you need HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Yarn
brew install yarn
# Install Hugo
brew install hugo
# Sublime command line shortcut
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /home/user/public_html
ErrorLog /home/user/public_html/error.log
CustomLog /home/user/public_html/access.log combined
<Directory /home/user/public_html>
Options Indexes FollowSymLinks
AllowOverride All
@benallfree
benallfree / bootstrap-and-responsive-laravel.md
Last active August 3, 2016 06:42
Add Bootstrap theme & responsive support to Laravel

Add bootstrapper to composer.json and follow setup instructions and documentation

"require": {
    "patricktalmadge/bootstrapper": "dev-develop"
}

Add to app/config/app.php providers:

@benallfree
benallfree / easy-theme-and-plugin-upgrades.diff
Created December 21, 2013 14:15
Zip files which do not contain a bare parent directory entry were not being detected correctly.
Index: modify-installer.php
===================================================================
--- modify-installer.php (revision 826618)
+++ modify-installer.php (working copy)
@@ -134,7 +134,7 @@
$contents = $archive->listContent();
foreach ( (array) $contents as $content ) {
- if ( preg_match( '|^([^/]+)/$|', $content['filename'], $matches ) ) {
+ if ( preg_match( '|^([^/]+)/|', $content['filename'], $matches ) ) {