Skip to content

Instantly share code, notes, and snippets.

// http://malsup.github.io/min/jquery.form.min.js
// <script type="text/javascript" src="{}jquery.form.min.js"></script>
function showRequest(formData, jqForm, options) {
var queryString = jQuery.param(formData);
jQuery(".afterSend").empty().html("sending...");
return true;
}
function showResponse(responseText, statusText, xhr, jQueryform) {
<?php
# https://github.com/PHPMailer/PHPMailer/archive/master.zip
# set_include_path(__DIR__);
# include('./libs/PHPMailer-master/PHPMailerAutoload.php');
$mail = new PHPMailer(true);
$mail->IsSMTP();
$mail->CharSet = "UTF-8";
<?php
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS');
header("Access-Control-Allow-Headers: Origin, Request, X-Requested-With, Content-Type, Accept, Methods");
?>
HTMLDivElement.prototype.relocate = function ( where ) {
var t = this;
where.appendChild( t );
t.parentNode.removeChild( t );
}
var div1 = document.getElementById( '#urbanDiv' );
var div2 = document.getElementById( '#villageDiv' );
div1.relocate( div2 );
console.error // For logging errors in your code. I use console.error within error callbacks on AJAX requests and anywhere else an error can print out a Javascript representation of an Object in your console window. Can be quite handy.
console.group(title) // This allows you to create a group of console logging commands with an optional title. Meaning you can group similar logging messages together say for example when a section of code is responsible for one task.
console.groupCollapsed // Exactly the same as the above method, except for the fact the initial group is collapsed and not opened.
console.groupEnd // This allows you to end the group defined above.
console.time(label) // Allows you to benchmark how long a particular block of Javascript code takes in milliseconds. Especially helpful for benchmarking possible bottleneck methods.
console.timeEnd(label) // Similar to the groupEnd method, this allows you to stop the timer logging function and the elapsed time will be printed out in the console.
var bsVersion = ( typeof jQuery.fn.typeahead !== 'undefined' ? '2.3.2' : '3.0.0' );
<?php
ob_start(); // start buffer capture
var_dump( $VARIABLE ); // dump the values
$VARIABLE_CONTENTS = ob_get_contents(); // put the buffer into a variable
ob_end_clean(); // end capture
error_log( $VARIABLE_CONTENTS ); // log contents of the result of var_dump( $object )
/*
add to php.ini
<?php
function delFolder($dirPath) {
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dirPath, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST) as $path) {
$path->isDir() ? rmdir($path->getPathname()) : unlink($path->getPathname());
}
rmdir($dirPath);
}
delFolder('demo');
SELECT create_time FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = '[db_name]'
ORDER BY create_time ASC
LIMIT 1
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2015-05-23T22:00:17.027709</Date>
<Author>folmert-dell\folmert</Author>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT1H</Interval>