Skip to content

Instantly share code, notes, and snippets.

View dead23angel's full-sized avatar

David Ange dead23angel

View GitHub Profile
@dead23angel
dead23angel / gist:7b3b4e2d1bb33015159efd02a2aeb1c6
Created April 2, 2022 09:27 — forked from timohausmann/gist:5003280
Javascript Math: get the distance between two points.
/**
* return the distance between two points.
*
* @param {number} x1 x position of first point
* @param {number} y1 y position of first point
* @param {number} x2 x position of second point
* @param {number} y2 y position of second point
* @return {number} distance between given points
*/
Math.getDistance = function( x1, y1, x2, y2 ) {
function calculate_age($birthday) {
$birthday_timestamp = strtotime($birthday);
$age = date('Y') - date('Y', $birthday_timestamp);
if (date('md', $birthday_timestamp) > date('md')) {
$age--;
}
return $age;
}
//вызов функции

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting & zsh-artisan)

  • Download zsh-autosuggestions by
@dead23angel
dead23angel / helpers.php
Created September 14, 2016 02:07 — forked from Ellrion/helpers.php
Showing all database queries in Laravel 5.2+
<?php
if (! function_exists('dbd')) {
/**
* Showing all database queries.
* Отображение всех запросов в базу.
*
* @param null|\Illuminate\Console\Command|\Psr\Log\LoggerInterface $channel
*/
function dbd($channel = null)
@dead23angel
dead23angel / helpers.php
Created February 10, 2016 15:49 — forked from Ellrion/helpers.php
extended laravel escaping with exclusion some tags
<?php
/**
* use in blade template `{!! ex($message, ['br', 'strong']) !!}`
*/
if (!function_exists('ex')) {
function ex($str, array $excluded)
{
$patterns = $tags = [];
foreach ($excluded as $ex) {
$open_tag = '<' . $ex . '>';
@dead23angel
dead23angel / artisan.php
Created February 1, 2016 15:56 — forked from vkbansal/artisan.php
Tying to use artisan migrate commands outside laravel
<?php
require_once "vendor/autoload.php";
use Symfony\Component\Console\Application;
use Illuminate\Database\Console\Migrations;
use Pimple\Container;
$container = new Container();
$container['migration-table'] = 'migration';