Skip to content

Instantly share code, notes, and snippets.

View Gesparo's full-sized avatar

Gesparo Gesparo

View GitHub Profile
@Gesparo
Gesparo / check
Last active October 18, 2019 12:44
var check = function() {
if('function' === typeof $) {
// TODO Write code here
}
else {
setTimeout(check, 1000);
}
}
check();
@Gesparo
Gesparo / .phpstorm.meta.php
Created August 21, 2018 06:23
Heps PHPSTORM IDE understard return object from create factory
namespace PHPSTORM_META {
use App\Company;
override(\create(''), map([
Company::class => Company::class
]));
}
@Gesparo
Gesparo / _ide_helper.php
Created January 19, 2017 04:43 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.40 (LTS) on 2016-07-18.
*
* @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@Gesparo
Gesparo / 0_reuse_code.js
Created December 25, 2016 07:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/**
* Calculate time remaining to work hours
*/
$curTimestamp = time(); // сегодняшнее число в unix формате
$curHour = (new DateTime('now', new DateTimeZone('Asia/Yekaterinburg')))->format('G'); // текущий час
$receiveTime = 0; // время получиеня
// если время позднее
if( $curHour >= 19 && $curHour <= 24 )
[xdebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
;PHPSTORM
xdebug.idekey="PHPSTORM"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "C:\xampp\tmp"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
;
@Gesparo
Gesparo / convertSQLResult.php
Last active November 15, 2016 09:31
Convert SQL result into array
/**
* Convert query result into two-dimensional array
* @param $queryResult - sql query result
* @return array
*/
function convertResult($queryResult)
{
$result = [];
while ($row = mysqli_fetch_assoc($queryResult)) {
@Gesparo
Gesparo / prepareSqlQuery.php
Created November 15, 2016 07:51
Prepare array [key => value] into sql query `key` = 'value'
/**
* Convert $fields into column value SQL query
*
* @param $fields [columnName => value]
* @return string
*/
function prepareQuery($fields)
{
$result = '';
@Gesparo
Gesparo / update_fields_via_sql_query.php
Last active November 16, 2016 03:54
Update fields in any table
/**
* Update fields in the table
*
* @param $table
* @param $project
* @param $projectIdColumnName
* @param $fields
* @return bool
* @internal param $projectId
*/