Skip to content

Instantly share code, notes, and snippets.

View vladimir-light's full-sized avatar
🎯
Focusing

Vladimir L vladimir-light

🎯
Focusing
View GitHub Profile
@vladimir-light
vladimir-light / get_all_constraints_from_current_db.sql
Last active August 29, 2015 14:11
Find / Check All Foreign Keys of a DataBase
SELECT
constraint_name,
table_name
FROM
information_schema.table_constraints
WHERE
constraint_type = 'FOREIGN KEY'
AND table_schema = DATABASE()
ORDER BY
constraint_name;
@vladimir-light
vladimir-light / count_all_tables_in_db.sql
Created July 13, 2012 18:53
Count all tables in a specific SCHEMA - MySQL
--
-- Only TABLES
--
SELECT COUNT(*) AS `all_tables`
FROM information_schema.`TABLES`
WHERE table_schema = '<schema_name>'
AND table_type = 'BASE TABLE'
--
-- EVERYTHING: TABLES, VIEWS, ETC
<nav>
<ul>
<li><a href="#">home</a></li>
<li><a href="#">portfolio</a></li>
<li><a href="#">images</a></li>
<li><a href="#">contact</a></li>
<li><a href="#">map</a></li>
</ul>
</nav><!-- content to be placed inside <body>…</body> -->
@vladimir-light
vladimir-light / onlyForAjax.php
Last active December 11, 2015 02:59
Checks if request is a AJAX-Request
<?php
$ajax = false;
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest')
{
$ajax = true;
}
if (!$ajax)
SELECT p.customer_id,
i.inventory_id,
f.title,
f.rental_duration,
f.rental_rate,
r.rental_id,
r.rental_date,
r.return_date,
p.payment_id,
p.amount,
@vladimir-light
vladimir-light / sakila_paiment_amount.sql
Last active January 3, 2016 11:59
Sakila re-calculating paiment amount (by days and hours)
SELECT i.inventory_id,
f.title,
@rental_duration_in_days := f.rental_duration as 'rental_duration_in_DAYS',
@rental_duration_in_hours := (@rental_duration_in_days * 24) as 'rental_duration_in_HOURS',
f.rental_rate,
p.amount as 'amount_paid',
r.rental_date,
r.return_date,
@total_days_rented := DATEDIFF(r.return_date, r.rental_date) AS 'total_DAYS_rented',
@rental_ratio_days := CAST((@total_days_rented / @rental_duration_in_days) AS DECIMAL(11,4)) AS 'rental_ratio_by_DAYS',
@vladimir-light
vladimir-light / xdebug.ini
Created September 3, 2018 11:26
X-Debug php.ini
[xdebug]
zend_extension ="C:/wamp64/bin/php/php7.1.12/zend_ext/php_xdebug-2.5.5-7.1-vc14-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=0
@vladimir-light
vladimir-light / langfiles2database.php
Last active November 8, 2018 08:46
FuelPHP lang-files to DB task (dirty)
<?php
/*
* @author Vladimir Leitenberger (vLight)
*/
namespace Fuel\Tasks;
class Langfiles2database
{
@vladimir-light
vladimir-light / index.php
Created June 15, 2020 10:38
AdminerPHP -> index.php with version and plugins (themes)
<?php
/**
* For https://github.com/pematon/adminer-theme
*
* root
* ├───css
* ├───fonts
* ├───images
* ├───lib
* └───plugins
[core]
autocrlf = input
whitespace = cr-at-eol
[alias]
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
co = checkout
ci = commit
st = status
br = branch
bra = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'