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 / .gitignore
Created September 29, 2012 08:11 — forked from redoPop/.gitignore
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@mbijon
mbijon / jsdiff.js
Created October 9, 2012 07:27
File-diff algorithm: diffString( String oldFile, String newFile ) calculates the differences between two strings and exports a diff-marked HTML file. Implemented by John Resig, http://ejohn.org/projects/javascript-diff-algorithm/, based on the paper: P. H
/*
* Javascript Diff Algorithm
* By John Resig (http://ejohn.org/)
* Modified by Chu Alan "sprite"
*
* Released under the MIT license.
*
* More Info:
* http://ejohn.org/projects/javascript-diff-algorithm/
*/
@mbijon
mbijon / WP_rolling_transient.php
Created November 4, 2012 07:52
Rolling expiration with WordPress Transients: Each time the transient is accessed the expiration is delayed. Intended for rate-limiting (be careful not to share a transient btw multiple users). Might work better for micro-caching in the event a flood is n
$call_limit = 350; // API calls (in an hour)
$time_limit = 60 * 60; // 1 hour (in seconds)
$transient_name = $host . "_rate_limit"; // Using their host name as the unique identifier
// Check to see if there are any transients that match the name, if not create a new one
if ( false === ( $calls = get_transient( $transient_name ) ) ) {
$calls[] = time();
set_transient( $transient, $calls, $time_limit ); // Use an array of time() stamps for rolling effect
} else {
// There is already a transient with this name
Date: Thu, 20 Dec 2012 16:28:50 -0500
From: Daryl Koopersmith <koop@wordpress.org>
Subject: Re: [wp-hackers] Javascript bind event for 3.5's new
uploader?
To: wp-hackers@lists.automattic.com
Message-ID: <DB193711A3AC46F1AA76AAE5940586BA@gmail.com>
Content-Type: text/plain; charset="utf-8"
> I'm trying to add an action when the uploader is displayed, but I
> can't seem to call the .on or .bind from external code.
@mbijon
mbijon / README.md
Created January 2, 2013 21:25 — forked from oodavid/README.md

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@mbijon
mbijon / phpinfo-after.txt
Last active December 11, 2015 08:49
For: http://core.trac.wordpress.org/ticket/23085 phpinfo() from XAMPP before & after upgrade: * WP test 'test_is_image_positive' fails on before with "mysql_error() expects parameter 1 to be resource, integer given" * Same test passes after upgrade
PHP Version 5.4.7
System Windows NT ALPHA7 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) i586
Build Date Sep 12 2012 23:44:56
Compiler MSVC9 (Visual C++ 2008)
Architecture x86
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"
Server API Apache 2.4 Handler Apache Lounge
Virtual Directory Support enabled
@mbijon
mbijon / gist:4668746
Last active December 11, 2015 22:19
Enabling auto-update of nginx, Stable on Ubuntu
To enable automatic updates of Linux packages set up the apt repository for the Debian/Ubuntu distributions.
For Debian/Ubuntu, in order to authenticate the nginx repository signature and to eliminate warnings about missing gpg key during installation of the nginx package, it is necessary to add the key used to sign the nginx packages and repository to the apt program keyring. Please download this key from our web site, and add it to the apt program keyring with the following command:
sudo apt-key add nginx_signing.key
For Ubuntu replace codename with Ubuntu distribution codename, and append the following to the end of the /etc/apt/sources.list file:
deb http://nginx.org/packages/ubuntu/ codename nginx
deb-src http://nginx.org/packages/ubuntu/ codename nginx
@mbijon
mbijon / gist:4671581
Last active December 11, 2015 22:39
Symlinks - the Windows version. * Using 'mklink' allows Windows to use git sub-folders in dev server paths
ADD LINK:
mklink /D {local link/folder-name} {full path to resources}
REMOVE LINK (w/o deleting files):
rmdir {folder-name}
@mbijon
mbijon / taxonomy-archive,php
Created January 30, 2013 11:10
WordPress taxonomy archive loop for Amanda CORRECT: while ( $sushi_group_query->have_posts() ) : $sushi_group_query->the_post(); OLD: while ( $sushi_group_query->have_posts() ) : the_post();
<?php
global $wp_query;
$sushi_group_terms = get_terms( 'Sushi Type' );
foreach ( $sushi_group_terms as $sushi_group_term ) {
$taxonomy_term = $sushi_group_term->slug;
$sushi_group_query = new WP_Query( array(
'post_type' => 'sushi',
'tax_query' => array(
array(
@mbijon
mbijon / gist:4678740
Last active December 11, 2015 23:48
Installing MariaDB 5.5 on Ubuntu 12.04
Add MariaDB to your system:
(from: https://downloads.mariadb.org/mariadb/repositories/)
sudo apt-get install python-software-properties
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main'
---
Once the key is imported and the repository added you can install MariaDB with: