Skip to content

Instantly share code, notes, and snippets.

View svycka's full-sized avatar
🏠
Working from home

Vytautas Stankus svycka

🏠
Working from home
View GitHub Profile
@svycka
svycka / WorkingTimeCounter.php
Created June 9, 2015 07:55
Working time counter
<?php
class WorkingTimeCounter
{
const LARGEST_GAP_BETWEEN_RECORDS = 57600; // 16*60*60 = 57600
const RECORD_TYPE_EXIT = 0;
public function getAll($records)
{
$records = $this->sortByTime($records);
@svycka
svycka / gist:89a914286fbd8d7c83f8
Created April 20, 2015 10:00
remove duplicates from table
create temporary table tmpTable (id int);
insert tmpTable
(id)
select id
from disease_products yt
where exists
(
select *
from disease_products yt2
@svycka
svycka / apache nodejs proxy
Created March 12, 2015 08:03
apache nodejs proxy config
// Virtual host add 3 lines.
ProxyPreserveHost On
ProxyPass /[linkName] http://localhost:[PortNumber]
ServerName localhost
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_ajp
a2enmod rewrite
a2enmod deflate
@svycka
svycka / matlab.m
Last active August 29, 2015 14:07
lab1
function pvz_2
clc, close all, clear all
%KONSTRUKCIJOS DUOMENYS
% MAZGU (MASIU) KONSTANTOS
m1 = 1; m2 = 3;
% ELEMENTU (SPYRUOKLIU) KONSTANTOS
k1 = 2000;
% VEIKIANCIU JEGOS (N)
f1=800; f2=400;
@svycka
svycka / test.php
Last active August 29, 2015 13:57
public function getByCategoryAndCulture($category, $culture)
{
$rsm = new ResultSetMapping;
$rsm->addEntityResult('FarmCatalog\Entity\Product', 'p');
$rsm->addFieldResult('p', 'id', 'id');
$rsm->addFieldResult('p', 'name', 'name');
$rsm->addMetaResult('p', 'category', 'category_id', true);
$sql = "SELECT p.* FROM products p";