Skip to content

Instantly share code, notes, and snippets.

@nciske
nciske / speedmail.applescript
Last active February 8, 2021 20:03 — forked from ttscoff/speedmail.applescript
Speed up Mail.app
(*
Speed up Mail.app by vacuuming the Envelope Index
Code from: http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012
Updated by Mathias Törnblom 2015 to support V3 in El Capitan and still keep backwards compability
Updated by @lbutlr for V5 and Container folder in High Sierra and use du
Updated by @nciske for V6 in Mojave
NOTE: Mojave users will need to grant Terminal.app or Automator.app (wherever you run the script) full disk access for the script to run successfully

Keybase proof

I hereby claim:

  • I am nciske on github.
  • I am nciske (https://keybase.io/nciske) on keybase.
  • I have a public key ASB7t0EWCIBKKd78Pn8E9eLBX8J-NpP-_diJHTGvUp4LBgo

To claim this, I am signing this object:

@nciske
nciske / admin-me.php
Created February 22, 2018 03:02
Add an admin account for yourself to a WordPress site you have S/FTP or Git push access to
<?php
// add this to functions.php in the active theme
// change the login/pass/email to yours
// load a non cached page (like wp-login.php)
// log in
// delete the code
function add_admin_acct(){
$login = "{your username}";
$passw = "{your password}";
@nciske
nciske / functions.php
Last active October 6, 2017 18:20 — forked from About2git/functions.php
Full width Soliloquy slider in Genesis
<?php
//* Do NOT include the opening php tag
//* This is optional if you don't want to use a widget for display (e.g. a shortcode or ACF will handle output)
//* Register Home Slider widget area
genesis_register_sidebar( array(
'id' => 'home-slider',
'name' => 'Home Slider',
'description' => 'This is the home slider section'
) );
@nciske
nciske / salesforce_w2l_after_submit_send_email.php
Last active March 30, 2017 17:28
Send an email post submission
<?php
add_action('salesforce_w2l_after_submit', 'salesforce_w2l_after_submit_send_email', 10, 3 );
function salesforce_w2l_after_submit_send_email( $post, $form_id, $form_type ){
$form_number = 1; // ID of the form to send this email for
if( $form_id == $form_number ){
@nciske
nciske / salesforce_w2l_field_value_querystring_multiple_example.php
Last active March 25, 2017 03:01
Autofill fields based on the query string (using Google Analytics tracking variables in this example)
<?php
// Autofill fields based on the query string (using Google Analytics tracking variables in this example)
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_querystring_multiple_example', 10, 3 );
function salesforce_w2l_field_value_querystring_multiple_example( $val, $field, $form ){
$form_id = 1; // form id to act upon
if( $form != $form_id ){
@nciske
nciske / wpdb-transactions
Last active September 13, 2024 19:02 — forked from 5iDS/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
<?php
global $wpdb;
// Start Transaction
$wpdb->query( "START TRANSACTION" );
// Do some expensive/related queries here
//$wpdb->query("DELETE FROM table WHERE form_id = '1' ");
//$wpdb->query("DELETE FROM data WHERE form_id = '1' ");
// set $error variable value in error handling after $wpdb modifications
@nciske
nciske / gist:50e22c0a01f197d12ad5e9baad476f02
Created January 30, 2017 18:26
Allow waze:// links in WordPress custom menus
// Ideally, replace prefix_ with a prefix unique to your site
function prefix_allow_waze_protocol( $protocols ) {
$protocols[] = 'waze';
return $protocols;
}
add_filter( 'prefix_allowed_protocols', 'wpse_allow_waze_protocol' );
@nciske
nciske / example_widget_title_filter.php
Created September 19, 2015 02:49
Quick filter to allow you to add a "note" to the widget title that doesn’t display on the front end.
<?php
add_filter( 'widget_title', 'example_widget_title_filter' );
function example_widget_title_filter( $title ){
if( is_admin() )
return;
if( strpos( $title, '|') !== false ){
@nciske
nciske / custom-simple-sidebar.php
Last active November 29, 2016 22:29
Add a custom simple sidebar to a page, CPT archive, singular post, etc.
<?php
// Hooks to remove default sidebar and add our custom one
// Place me in functions.php or above genesis(); on a page template (in which case, no conditional is needed)
add_action('get_header','example_change_genesis_sidebar');
function example_change_genesis_sidebar() {
// change the conditional to determine where the swap occurs
// https://codex.wordpress.org/Conditional_Tags