Skip to content

Instantly share code, notes, and snippets.

View fdcore's full-sized avatar
🦄
Работаю круглосуточно

Dmitriy Nyashkin fdcore

🦄
Работаю круглосуточно
View GitHub Profile
@fdcore
fdcore / is_mobile.js
Created August 31, 2017 20:08
Check is on mobile view
/*
#mobile_element {
display: none;
}
@media (max-width: 768px) {
#mobile_element {
display: block;
}
}
*/
@fdcore
fdcore / random_priority.php
Last active September 27, 2017 23:32
Функция случайности с приоритетом
<?php
/*
Функция случайности с приоритетом
@author Dmitriy Nyashkin
@param (array) arr - Array with priority key
@param (string) priority_key - Array key for use priority
@return array - single array
*/
function random_priority($arr, $priority_key = 'priority')
{
<div id="app">
<div>
<button @click="sort_by='name'">name</button>
<button @click="sort_by='price'">price</button>
<button @click="sort_by='count'">count</button>
</div>
<hr>
<div>
<button @click="by_desc=true">ASC</button>
@fdcore
fdcore / array_median.php
Created January 21, 2018 13:29
Высчитываение средней медианы
<?php
/*
Высчитываение средней медианы
@params array массив чисел
*/
function array_median($array) {
// perhaps all non numeric values should filtered out of $array here?
$iCount = count($array);
if ($iCount == 0) {
throw new Exception('Median of an empty array is undefined');
<?php
function redirect_no_referral($url)
{
echo '<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<?php
$data = array(
[
'measurement' => 'time',
'tags' => [
"host" => 'server02',
],
'fields' => ['value' => mt_rand(1, 100)],
'timestamp' => exec('date +%s%N')

Keybase proof

I hereby claim:

  • I am fdcore on github.
  • I am nyashkin (https://keybase.io/nyashkin) on keybase.
  • I have a public key ASA_th1q1SEqIGZDtAgr3Cr7ZcEdBTtx1QWrt7sjv3MCWQo

To claim this, I am signing this object: