Skip to content

Instantly share code, notes, and snippets.

View mbijon's full-sized avatar
🎯
Focusing

Mike Bijon mbijon

🎯
Focusing
View GitHub Profile
@mbijon
mbijon / ssh-known-hosts-mgmt.sh
Last active March 23, 2016 21:03 — forked from bradland/ssh-known-hosts-mgmt.sh
SSH known_hosts tools
# This is a short collection of tools that are useful for managing your
# known_hosts file. In this case, I'm using the '-f' flag to specify the
# global known_hosts file because I'll be adding many deploy users on this
# system. Simply omit the -f flag to operate on ~/.ssh/known_hosts
# Add entry for host
ssh-keyscan -H github.com > /etc/ssh/ssh_known_hosts
# Add IP-based entry for current IP
ip=$(dig +short github.com A)
@mbijon
mbijon / komodo_php_beautifier
Created February 24, 2016 18:50 — forked from florinel-chis/komodo_php_beautifier
Macro for Komodo Edit - PHP Beautifier
try {
if (komodo.view.scintilla) { komodo.view.scintilla.focus(); }
var currentPos = komodo.editor.currentPos;
var ke = komodo.editor;
var file = komodo.interpolate('%F');
var php = komodo.interpolate('%(php)');
var script = "/usr/local/zend/bin/php_beautifier"//this can be changed to the path of php_beautifier, install using PEAR
var cmd = script+" --filters='ArrayNested()' "+file; // add options dialog?
StatusBar_AddMessage("Beautifying "+file,"editor",5000,true);
@mbijon
mbijon / Capfile
Created January 25, 2016 09:04 — forked from paulredmond/Capfile
Capistrano deploy recipe for Media Temple Grid Service. This particular recipe is for a Railsless deploy of WordPress.
require 'rubygems'
require 'railsless-deploy'
load 'config/deploy'
@mbijon
mbijon / class-search.php
Created December 11, 2015 08:19 — forked from arsonus/class-search.php
A PHP script to search a MySQL database
<?php
/**
* Performs a search
*
* This class is used to perform search functions in a MySQL database
*
* @version 1.0
* @author John Morris <support@johnmorrisonline.com>
*/
class search {
@mbijon
mbijon / yolo.php
Last active August 29, 2015 14:12 — forked from staylor/yolo.php
<?php
class React_YOLO {
public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
}
public function admin_menu() {
add_menu_page( 'React', 'React', 'edit_posts', 'react', array( $this, 'page' ) );
}
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
'''
This is a module that defines some helper classes and functions for
expiring groups of related keys at the same time.
Written July 1-2, 2013 by Josiah Carlson
Released into the public domain
'''
import time
#!/usr/bin/env ruby
require 'readline'
def prompt(prompt="> ")
input = nil
prompt += " " unless prompt =~ /\s$/
loop do
input = Readline.readline(prompt)
break if input.length > 0
end
<?php
/**
* Send debug code to the Javascript console
*/
function debug_to_console($data) {
if(is_array($data) || is_object($data))
{
echo("<script>console.log('PHP: ".json_encode($data)."');</script>");
} else {
echo("<script>console.log('PHP: ".$data."');</script>");
#!/bin/bash
# args
MSG=${1-'deploy from git'}
BRANCH=${2-'trunk'}
# paths
SRC_DIR=$(git rev-parse --show-toplevel)
DIR_NAME=$(basename $SRC_DIR)
DEST_DIR=~/svn/wp-plugins/$DIR_NAME/$BRANCH