Skip to content

Instantly share code, notes, and snippets.

@FerraBraiZ
FerraBraiZ / .htaccess
Last active July 1, 2019 02:18
HTACCESS
# Allow with + or - listing folder's content
Options +Indexes
##enable CORS and credentials
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Origin http://www.vknyvz.com
Header set Access-Control-Allow-Credentials true
</IfModule>
@FerraBraiZ
FerraBraiZ / sql
Last active April 27, 2018 13:10
MySQL - 5.6.5 2, 2 TIMESTAMP column / CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
Why there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause?
in MySQL 5.6.5 (2012-04-10, Milestone 8) is possible to have 2 fields, as follows:
CREATE TABLE `foo` (
`id` INT(10) UNSIGNED NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at ` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=INNODB;
@FerraBraiZ
FerraBraiZ / jQuery_ajax_promise_when_then.js
Last active April 27, 2021 12:32
jQuery $.ajax promise, $.when then()
let promisedData = function() {
let deferredQuery = $.Deferred();
$.ajax({
type: "GET",
crossDomain: true,
dataType: "json",
cache: false,
data: "data=data",
@FerraBraiZ
FerraBraiZ / PHP POST Webhook
Last active June 28, 2023 16:52
POST Webhook
<?php
if ('POST' !== $_SERVER['REQUEST_METHOD']) {
http_response_code(405);
exit( json_encode([ 'Client Error 405' => 'Method not allowed!' ]) );
}
try {