Skip to content

Instantly share code, notes, and snippets.

#-------------------------------------------------------------------------------------------------------------------#
# Version 1.00
#
# This schript is to take a csv file and convert it to ldif format
# dependant on the requirement please ensure the csv is in the format as shown in code below else output will
# be wrong, current format of csv is:
# - First field: FullName
# - Second field: Mobile number
# - Third field: Email address
# - Fourth field: UserName
@deltafactory
deltafactory / dir.py
Last active August 29, 2015 14:23
Use python to list directory as tab-separated values
"""
List directory as tab-separated values
* Written, annotated, and hastily bug-checked by Jeff Brand (@deltafactory)
* Inspired by Rudy Trujillo, https://plus.google.com/u/0/+RudyTrujillo/posts/7yWsPXVvKmt
"""
# Import os and sys packages since we'll be using them. (Look for sys.* and os.* below.)
# More info: https://docs.python.org/3/reference/import.html
import os, sys
@deltafactory
deltafactory / nxs-woobridge.php
Created May 22, 2015 16:31
Untested proof of concept for a refactored Nexus WooCommerce Bridge plugin main file.
<?php
/*
Plugin Name: Nexus WooCommerce bridge
Version: 1.1.0
Plugin URI: http://nexusthemes.com
Description: Add widgets/plugins and other functionality from WooCommerce into Nexus Framework
Author: Gert-Jan Bark, Jeff Brand
Author URI: http://nexusthemes.com
*/
@deltafactory
deltafactory / index.html
Created September 2, 2014 21:44
Create a flip clock effect in pure CSS. Inspired by http://battleforthenet.com/sept10th/. View demo at http://bl.ocks.org/deltafactory/6e1cb71cfc8bb169181d
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial;
}
@deltafactory
deltafactory / lazy-load-WC_Countries.diff
Last active December 28, 2015 22:29
Lazy load WooCommerce WC_Countries patch - proof of concept.
Index: classes/class-wc-countries.php
===================================================================
--- classes/class-wc-countries.php (revision 799848)
+++ classes/class-wc-countries.php (working copy)
@@ -1,4 +1,30 @@
<?php
+
+class WC_Countries_Loader {
+
+ private $instance;
@deltafactory
deltafactory / fix-nextgen-lightbox-path.php
Created October 2, 2013 04:57
Fix stored URLs for Lightbox assets in NextGEN Gallery 2.x. If you find that your lightbox images are missing or are pointing to the old location for the site, then this script will help.
<?php
/*
INSTRUCTIONS:
Use at your own risk. Backup your database before continuing.
1. Copy code to a file in the root of your website.
2. Change YOUR_SITE_ROOT to a value that makes sense.
3. Execute by visiting the page. Verify before/after results.
4. Change MAKE_CHANGES_TO_SITE to true and execute it again.
@deltafactory
deltafactory / df_active_all_users.php
Last active December 22, 2015 21:09
Standalone script for WordPress/BuddyPress to activate all users. Now, with debugging.
<?php
// Place in a file in the main folder (same as wp-load.php).
// Code is completely untested. Use at your own risk.
require( 'wp-load.php' );
df_activate_all_users();
function df_activate_all_users() {
header( 'Content-type: text/plain' );
@deltafactory
deltafactory / gist:6531278
Last active December 22, 2015 21:09
BuddyPress snippet to remove "affiliate" users from the list of active users.
<?php
//Code is completely untested, may contain errors.
function affiliate_user_stealth_mode() {
if ( ! is_user_logged_in() )
return;
$user = wp_get_current_user();
if ( get_user_meta( $user->ID, 'affiliate', true ) ) {
@deltafactory
deltafactory / dk-image-rotator-widget.php.patch
Created August 19, 2013 20:36
Patch file for http://wordpress.org/plugins/dk-new-medias-image-rotator-widget/dk-image-rotator-widget.php. It fixes mixed content warnings in browsers like Firefox. Some minor redundant or non-performant calls have also been removed.
Index: dk-image-rotator-widget.php
===================================================================
--- dk-image-rotator-widget.php (revision 758674)
+++ dk-image-rotator-widget.php (working copy)
@@ -40,16 +40,13 @@
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
-
+