Skip to content

Instantly share code, notes, and snippets.

Avatar
🙉
Focusing

Oleg Gorbunov gorbunov

🙉
Focusing
View GitHub Profile
@gorbunov
gorbunov / .js
Created Nov 6, 2021
safari p-in-p
View .js
javascript:document.querySelector(%22video%22).webkitSetPresentationMode(%22picture-in-picture%22);
@gorbunov
gorbunov / DG-SQL-Export-Updates-By-First-Key.sql.groovy
Created Nov 1, 2021
DataGrip exporter for query results without ID key, uses first column as matcher
View DG-SQL-Export-Updates-By-First-Key.sql.groovy
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col); getTypeName(Object, col); isStringLiteral(Object, col); }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
View advent-of-code-01.php
<?php declare(strict_types=1);
$modules = array_map('\intval', file('./modules.txt', FILE_IGNORE_NEW_LINES));
/**
* Takes mass and returns required fuel for that
*
* @param int $mass
*
* @return int
*/
View flow.html
<html>
<body>
<p>
Some Content
<div>Paragraph ended already</div>
</p>
View gist:3169365
<?php
class Model_Task extends ORM {
protected $_has_one = array(
'status' => array(
'model' => 'task_status',
'foreign_key' => 'id' // PK таблицы-справочника
)
);
protected $_has_many = array(
View gist:961662
<?php
class Model implements ArrayAccess {
protected $_table = '';
protected $_pkey_column = 'id';
protected $_pkey_value = null;
protected $_data = array();
protected $_changes = array();
public function __construct($table, $pkey)
{
View gist:855724
<?php
class User_Model extends Generic_Model {
public function __construct($id = false)
{
parent::__construct('users', $id);
return;
}
public function can_register($data)
View gist:855686
<?php
class User_Model extends Generic_Model {
public function __construct($id = false)
{
$this->set_table('users');
if (!$id)
{
$this->load($id);
}
}
View gist:855681
<?php
class Generic_Model implements ArrayAccess {
protected $values = array();
protected $changes = array();
protected $field = 'id';
protected $value = 0;
protected $table = '';
public function set_table($table)
{
View gist:809180
<?php
abstract class Attack_Type {
// Basic types
const PIERCING = 1;
const CUTTING = 2;
const BLUNT = 4;
const FIRE = 8;
const WATER = 16;
const ICE = 32;
const EARTH = 64;