Skip to content

Instantly share code, notes, and snippets.

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

Alexandr Zhuravlev alezhu

🏠
Working from home
View GitHub Profile
@alezhu
alezhu / 0_reuse_code.js
Created September 29, 2015 10:23
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
* .-'---`-.
*,' `.
*| \
*| \
*\ _ \
*,\ _ ,'-,/-)\
*( * \ \,' ,' ,'-)
* `._,) -',-')
* \/ ''/
* ) / /
@alezhu
alezhu / CheckAction.php
Created October 7, 2016 06:44
Simple Doctrine Annotation
use Doctrine\Common\Annotations\Annotation;
use Doctrine\Common\Annotations\Annotation\Target;
/**
* Class Action
* @package App\Core
* @Annotation()
* @Target("METHOD")
*/
class CheckAction
@alezhu
alezhu / app.php
Created October 7, 2016 06:46
Allow doctrine annotations to use standard class loader
AnnotationRegistry::registerLoader('class_exists');
@alezhu
alezhu / ActionMiddleware.php
Last active October 7, 2016 06:53
Lumen middleware for check contoller methods availability via Doctrine annotation
<?php
/*
in app.php add
$app->routeMiddleware([
'action' =>\App\Http\Middleware\ActionMiddleware::class,
]);
AnnotationRegistry::registerLoader('class_exists');
in route add something like
$app->group([
@alezhu
alezhu / GetCellWidth.excel.vba
Created November 30, 2016 06:42
Excel ColumnWidth for merged cells too
Function GetCellWidth(ra As range) As Double
Dim vColWidth As Double
Dim cell As range
vColWidth = ra.ColumnWidth
If ra.MergeCells Then
vColWidth = 0
For Each cell In ra.MergeArea.Cells
vColWidth = vColWidth + cell.ColumnWidth
Next
End If
@alezhu
alezhu / GetCellPage.excel.vba
Created November 30, 2016 06:43
Page number for cell
Function GetCellPage(ra As range) As Long
Dim ws As Worksheet
GetCellPage = 0
Set ws = ra.Parent
Dim iRow As Long
If ws.HPageBreaks.Count > 0 Then
iRow = ra.Row
Do
GetCellPage = GetCellPage + 1
@alezhu
alezhu / zcl_call_fbl1n.abap
Created December 16, 2016 13:39
Call FBL1N with multi lifnr, bukrs, belnrs via batch input
CLASS zcl_call_fbl1n DEFINITION
PUBLIC
ABSTRACT
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
TYPES:
tt_bukrs TYPE STANDARD TABLE OF bukrs WITH DEFAULT KEY .
class-methods SY2RETURN
exporting
!ES_RETURN type BAPIRET2
changing
!CT_RETURN type BAPIRET2_T optional .
METHOD sy2return.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
*DEFINITION
private section.
types:
begin of ts_dest,
bskey type SLD_BSKEY,
logsys type TBLSYSDEST-logsys,
dest type TBLSYSDEST-rfcdest,
end of ts_dest,
tt_dest type HASHED TABLE OF ts_dest with UNIQUE key bskey.