Skip to content

Instantly share code, notes, and snippets.

View lukecav's full-sized avatar
Infinite data generation engine

Luke Cavanagh lukecav

Infinite data generation engine
View GitHub Profile
@ses4j
ses4j / incrementalmr.py
Created March 29, 2012 03:42
Periodically-updating pymongo/MongoDB incremental MapReduce example
def incremental_map_reduce(
map_f,
reduce_f,
db,
source_table_name,
target_table_name,
source_queued_date_field_name,
counter_table_name = "IncrementalMRCounters",
counter_key = None,
max_datetime = None,
@kingkool68
kingkool68 / Related WordPress Posts
Last active January 8, 2016 18:20
This plugin features a smarty-pants set of functions to determine what content is related to what.
<?php
class ACF_File_Custom {
private static $instance;
public static function register() {
if ( self::$instance == null ) {
self::$instance = new ACF_File_Custom();
}
}
@isotrope
isotrope / meta-update-query.php
Last active February 22, 2016 19:29
WP: Adjustment loop
<?php
/*
* Include this inside your functions.php with an include_once() or something
*
* DEFINITELY do a DB backup first!!
*/
function iso_adjustment_query() {
add_action( 'wp_enqueue_scripts', 'my_strength_meter_localize_script' );
function my_strength_meter_localize_script() {
wp_localize_script( 'password-strength-meter', 'pwsL10n', array(
'empty' => __( 'But... it\'s empty!', 'theme-domain' ),
'short' => __( 'Too short!', 'theme-domain' ),
'bad' => __( 'Not even close!', 'theme-domain' ),
'good' => __( 'You are getting closer...', 'theme-domain' ),
'strong' => __( 'Now, that\'s a password!', 'theme-domain' ),
'mismatch' => __( 'They are completely different, come on!', 'theme-domain' )
) );
@maxkostinevich
maxkostinevich / functions.php
Created July 15, 2015 08:08
Restrict access to WP-Admin dashboard in WordPress
<?php
// RESTRICT ACCESS TO WP-ADMIN DASHBOARD
function restrict_admin_access(){
if( !current_user_can( 'edit_posts' ) ) {
wp_redirect( home_url() );
die();
}
}
add_action( 'admin_init', restrict_admin_access, 1 );
?>
@maxkostinevich
maxkostinevich / functions.php
Last active March 18, 2016 06:31
Allow to open password protected pages with the password in URL
<?php
/**
* Allow to open password protected pages with the password in URL
* For example: http://examle.com/my-protected-page?access_token=2341223 (GET param: ?access_token=[POST PASSWORD])
* Feel free to replace 'access_token' with any other string
*
* Author: Max Kostinevich
* Author URI: https://maxkostinevich.com
*/
@lots0logs
lots0logs / epanel-integration-body.html
Created February 25, 2016 20:41
WordPress :: Divi Theme :: Social Profile Links Open In New Tab
<script>
(function($) {
$(window).load(function() {
setTimeout(function() {
$('.et-social-icon').each(function() {
$(this).children('a').attr('target', '_blank');
});
}, 1500);
});
})(jQuery);
public static function delete_signup( $key ) {
// get signup from $key ##
$signup = GFSignup::get( $key );
// return error, if nothing found ##
if( is_wp_error( $signup ) ) {
return $signup;
@lukecav
lukecav / gist:13f5d0e55a006cf88619e950ba3bfd0b
Created April 5, 2016 16:13
Fix Logo and Menu Issue on Desktop
@media screen and (min-width: 981px) and (max-width: 1230px) {
.et_header_style_left .logo_container {
position: relative;
}
#main-header #et-top-navigation {
float: none;
padding-top: 0;
}
#main-header #logo {
margin: 0px 0 0 12px;