Skip to content

Instantly share code, notes, and snippets.

View kjbrum's full-sized avatar
🤘

Kyle Brumm kjbrum

🤘
View GitHub Profile
@kjbrum
kjbrum / autoResizeInput.js
Last active June 2, 2016 14:09
Automatically resize input fields while typing
/**
* Automatically resize input fields while typing
*
* Usage: $('input.autoresize').autoResizeInput({ minWidth: 250, comfortZone: 0 });
*/
(function($){
$.fn.autoResizeInput = function(o) {
o = $.extend({
@kjbrum
kjbrum / object_to_array.php
Last active November 11, 2015 20:36
Convert an object to an array.
<?php
/**
* Convert an object to an array.
*
* @param array $object The object to convert
* @return array The converted array
*/
function object_to_array( $object ) {
if( !is_object( $object ) && !is_array( $object ) ) return $object;
return array_map( 'object_to_array', (array) $object );
@kjbrum
kjbrum / is_multi_array.php
Last active November 11, 2015 20:36
Check if an array is a multidimensional array.
<?php
/**
* Check if an array is a multidimensional array.
*
* @param array $arr The array to check
* @return boolean Whether the the array is a multidimensional array or not
*/
function is_multi_array( $x ) {
if( count( array_filter( $x,'is_array' ) ) > 0 ) return true;
return false;
@kjbrum
kjbrum / wp_display_404.php
Last active May 21, 2016 02:16
Display the 404 template.
<?php
$wp_query->set_404();
require TEMPLATEPATH.'/404.php';
exit;
@kjbrum
kjbrum / search-and-kill.sh
Created August 11, 2015 04:34
A small bash script to search and kill processes
#!/bin/bash
if [ -z "$1" ]; then
echo "You need to supply a search string..."
else
processes=$(ps aux | grep $1 -i | awk -F ' ' '{print $2}' | xargs)
echo "Processes: "$processes
while true; do
read -ep "Are you sure you want kill all '$1' processes? [y/N] " yesno
case $yesno in
@kjbrum
kjbrum / randpass.sh
Last active October 28, 2016 22:55
Generate a random password and copy it to your clipboard.
#!/usr/bin/env bash
# Randpass - Random Password Generator
# Generate a random password and copy it to your clipboard.
# Copyright (C) Kyle Brumm <http://kylebrumm.com>
# Display the help text
usage() {
cat << EOF
@kjbrum
kjbrum / bash_profile.sh
Last active December 27, 2024 21:34
My personal bash profile
#---------------------------------------------------------------------------------------------------------------------------------------
#
# Author: Kyle Brumm
# Description: File used to hold Bash configuration, aliases, functions, completions, etc...
#
# Sections:
# 1. ENVIRONMENT SETUP
# 2. MAKE TERMINAL BETTER
# 3. FOLDER MANAGEMENT
# 4. MISC ALIAS'
serverpilot_client_id=""
serverpilot_api_key=""
bitbucket_username=""
bitbucket_password=""
serverpilot_staging_user_id=""
base_plugin=""
base_theme=""
#! /bin/bash
# Source our config file
. config/config.cfg
# Function to generate random characters
function random_chars() {
if [ $1 ]; then
@kjbrum
kjbrum / WordPress Setup Script.md
Last active March 10, 2018 18:31
Easily set up a project with a Bitbucket repository, ServerPilot application, base plugin and theme, as well as run miscellaneous WordPress tasks.

WordPress Setup Script

Easily set up a project with a Bitbucket repository, ServerPilot application, base plugin and theme, as well as run miscellaneous WordPress tasks. Should be used with https://github.com/Mixd/wp-deploy.

Step 1: Setup project

# Enter your project directory
cd your/desired/project/directory