Skip to content

Instantly share code, notes, and snippets.

View speedmail.applescript
(*
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
View keybase.md

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 Feb 22, 2018
Add an admin account for yourself to a WordPress site you have S/FTP or Git push access to
View admin-me.php
<?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 Oct 6, 2017 — forked from About2git/functions.php
Full width Soliloquy slider in Genesis
View functions.php
<?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'
) );
View salesforce_w2l_after_submit_send_email.php
<?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 Mar 25, 2017
Autofill fields based on the query string (using Google Analytics tracking variables in this example)
View salesforce_w2l_field_value_querystring_multiple_example.php
<?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 Oct 5, 2021 — forked from 5iDS/wpdb-transactions
MySQL database transaction, using the WordPress database object $wpdb. Requires the InnoDB table format.
View wpdb-transactions
<?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 Jan 30, 2017
Allow waze:// links in WordPress custom menus
View gist:50e22c0a01f197d12ad5e9baad476f02
// 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 Sep 19, 2015
Quick filter to allow you to add a "note" to the widget title that doesn’t display on the front end.
View example_widget_title_filter.php
<?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 Nov 29, 2016
Add a custom simple sidebar to a page, CPT archive, singular post, etc.
View custom-simple-sidebar.php
<?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