Skip to content

Instantly share code, notes, and snippets.

@raamdev
raamdev / raamdev-journal-s2-customizations.php
Created September 9, 2014 23:48
s2Member Pro-Form customizations that hide the username field and then auto-generate a username based on the email address. This was used for the Paid Journal subscription I ran on raamdev.com between 2011 and 2014.
<?php
add_action ("login_head", "s2_customize_login", 1000);
function s2_customize_login ()
{
?>
<script type = "text/javascript">
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
<?php
error_reporting(-1);
ini_set('display_errors', TRUE);
/* --- Config. section. ----------------------------------------------------------------------- */
$url = 'http://yoursite.com/'; // Swap this out when testing.
// Install the HTML Compressor locally, and change the following path as necessary.
require_once $_SERVER['WEBSHARK_HOME'].'/websharks/html-compressor/html-compressor/stub.php';
@raamdev
raamdev / update-wp-child-theme-from-github.sh
Created December 30, 2014 17:06
Updates a WordPress theme with the latest code from GitHub
#!/bin/bash
# -------------------------------------------------------------------
#
# This script updates a WordPress theme with the latest code from
# GitHub. You can set it to run as a cronjob to automatically update
# a WordPress theme with the latest code from the master branch (or
# any branch that you want).
#
# Be sure to chmod +x this file so that it can be executed via Cron.
#

Keybase proof

I hereby claim:

  • I am raamdev on github.
  • I am raamdev (https://keybase.io/raamdev) on keybase.
  • I have a public key whose fingerprint is 851B E08D AF38 F6A3 81D1 DF09 92A5 D3E8 7AF3 AA99

To claim this, I am signing this object:

@raamdev
raamdev / browser-caching.htaccess
Created January 27, 2015 03:47
Enable Browser Caching for Apache (add this to the root .htaccess file on your site)
# Browser Caching
FileETag MTime Size
<IfModule expires_module>
ExpiresActive on
ExpiresDefault "access plus 1 week"
</IfModule>
<?php
if(!defined('WPINC')) // MUST have WordPress.
exit('Do NOT access this file directly: '.basename(__FILE__));
add_action('init', 'github_events::init');
class github_events // Event handler.
{
# Configuration ###############################################
@raamdev
raamdev / f.lux-xcode-master-sha256.chk
Last active November 20, 2015 21:49
38f463ee5780a4f2b0160f9fa21dbe3c78c5d80d3c093e4ff553aaca230e2898 f.lux-xcode-master.zip
5dfb0ac3bd39f2830283cd0a5af534c43024207bbec460ca089b8edd595070fa ./.gitignore
a326fb9457de2a31fd23fb98d89f1e83dcab611ea7b85f671680094592e51c54 ./AppIcon29x29@2x.png
d276420548696edcc16610b578907305f54020763e065581f4aa5863b8585c61 ./AppIcon29x29@3x.png
adab888cd5d24313f142e9324f10ff7128d77cb30031122bb3586e333ef399a2 ./AppIcon40x40@2x.png
8fdc77ccf3964c31eb31777479a7ca5c3c056d873da610f2d9b75c99fc363ae9 ./AppIcon40x40@3x.png
eb6f6aa969998b2648ade1ee051d37f01032e6f549fc77b195bf7e4c53bf2624 ./AppIcon60x60@2x.png
626b2f4146996ab876396c4ab797b005801fdf59aa6b57e976386f0572772895 ./AppIcon60x60@3x.png
eadf312d966754f3b8d6542ea8a5db850bcceb81e6f971b7b629bc4b950b8644 ./en.lproj/fluxController_iPhone.nib
9261ecceda608ef174256e5fdc774c1e6e3dcf533409c1bc393d490d01c713f1 ./en.lproj/InfoPlist.strings
ca34f2dc83c31222a73a48053532ad901de55f014c58ffa2fbcf6c202b5448b0 ./flux.beta/AppDelegate.h
@raamdev
raamdev / fpass.sh
Created February 5, 2016 17:29
Script to quickly search password store
#!/bin/bash
PATH_TO_PASS=/usr/local/bin/pass
PATH_TO_PASS_DIR=/Users/raam/.password-store
PATH_TO_FIND=/usr/bin/find
# Trims ".password-store/Personal/example.com.gpg" to
# "Personal/example.com" for use with the pass command
OFFSET=${#PATH_TO_PASS_DIR}
@raamdev
raamdev / testing-wp-access-control-mu-plugin.md
Last active March 9, 2016 18:40
Testing WordPress Access Control using an MU Plugin

Testing WordPress Access Control using an MU Plugin

WARNING - MU plugin file for testing purposes only.

If you don't want to use the plugin and instead want to use a coded solution, the following below could be done for testing purposes. We highly recommend on using a plugin like User Switching over this method. The plugin method is likely to offer better security and it will be easier for most people.

Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled on all sites in the installation. Must-use plugins do not show in the default list of plugins on the Plugins page of wp-admin – although they do appear in a special Must-Use section – and cannot be disabled except by removing the plugin file from the must-use directory, which is found in wp-content/mu-plugins by default.

See: http://codex.wordpress.org/Must_Use_Plugins

<?php
$curl_localhost_test_success = FALSE;
$curl_localhost_test_url = 'http://'.$_SERVER['HTTP_HOST'];
$curl_localhost_test_url_return_string_frag = 'html';
if(is_resource($_curl_test_resource = curl_init()))
{
curl_setopt_array(
$_curl_test_resource, array(
CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 5,