Skip to content

Instantly share code, notes, and snippets.

$.ajax({
url : action_url,
type : 'POST',
crossDomain : true,
data : $form.serialize(),
beforeSend: function(request) {
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
}
});

Keybase proof

I hereby claim:

  • I am mrksdiehl on github.
  • I am mrksdiehl (https://keybase.io/mrksdiehl) on keybase.
  • I have a public key ASB-WA93FZKVvCAIsEUb2LUGLBYfLQQesL47ywG3OmG5rQo

To claim this, I am signing this object:

@mrksdiehl
mrksdiehl / carbon_fields_sync_posts.php
Created March 15, 2018 15:32
Sync two posts if both use carbon fields association
<?php
/**
* Sync the association field between a post and the associated
* post_tpes. To be used during carbon_fields_post_meta_container_saved
*
* @param string $post_id The post id of the post that is being saved
* @param string $key The carbon fields key of the association field
* @param array $target carbon fields 'key' and 'post_type' of the target
* @return void
*/
@mrksdiehl
mrksdiehl / cloudSettings
Last active September 28, 2019 08:27
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-09-28T08:27:06.281Z","extensionVersion":"v3.4.3"}
@mrksdiehl
mrksdiehl / get-timestamp-string.js
Last active October 25, 2017 03:28
Get the timestamp set the timezone and return a string with all glued together
var timezoneOffset = 8;
var d = new Date();
var utc = d.getTime() + (d.getTimezoneOffset() * 60000);
var timestamp = new Date(utc + (3600000*timezoneOffset));
var time_string = timestamp.getFullYear().toString()
time_string += timestamp.getMonth() < 10 ? '0' + timestamp.getMonth().toString() : timestamp.getMonth().toString();
time_string += timestamp.getDate() < 10 ? '0' + timestamp.getDate().toString() : timestamp.getDate().toString();
time_string += timestamp.getHours() < 10 ? '0' + timestamp.getHours().toString() : timestamp.getHours().toString();
time_string += timestamp.getMinutes() < 10 ? '0' + timestamp.getMinutes().toString() : timestamp.getMinutes().toString();
time_string += timestamp.getSeconds() < 10 ? '0' + timestamp.getSeconds().toString() : timestamp.getSeconds().toString();
@mrksdiehl
mrksdiehl / 0_reuse_code.js
Created August 15, 2017 07:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mrksdiehl
mrksdiehl / vesta_ssl
Created July 28, 2017 15:01
Script to automatically check and renew vesta ssl certificate if outdated
#!/bin/bash
# first run
# v-add-letsencrypt-domain or add them from control panel
# vi /etc/cron.daily/vesta_ssl
# chmod +x /etc/cron.daily/vesta_ssl
cert_src="/home/[USER]/conf/web/ssl.[DOMAIN].pem"
key_src="/home/[USER]/conf/web/ssl.[DOMAIN].key"
cert_dst="/usr/local/vesta/ssl/certificate.crt"
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
<?php
/**
* require this file in wp-config.php before "require_once(ABSPATH . 'wp-settings.php');"
**/
define ('WP_CONTENT_FOLDERNAME', 'assets');
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME) ;
// For SSL change to https
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME);