Skip to content

Instantly share code, notes, and snippets.

cd C:\LOCALHOST\SQL_BACKUP
@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a-%%b)
mysqldump -u root --all-databases > %mydate%.sql
7z a -tzip %mydate%_%mytime%.zip %mydate%.sql
<?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>
SELECT create_time FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = '[db_name]'
ORDER BY create_time ASC
LIMIT 1
<?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');
<?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
var bsVersion = ( typeof jQuery.fn.typeahead !== 'undefined' ? '2.3.2' : '3.0.0' );
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.
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 );
<?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");
?>
<?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";