Skip to content

Instantly share code, notes, and snippets.

export type ClassType<T = any> = new (...args: any[]) => T;
interface IPaginated {
limit?: number;
offset?: number;
}
export function PaginatedRequestDto<T extends ClassType>(ResourceCls: T) {
class Paginated extends ResourceCls implements IPaginated {
@ApiModelPropertyOptional({ default: 100 })
fixing the character /ufeff in json response of the default wordpress rest api
in the file /wp-includes/rest-api.php
in function rest_send_allow_header( $response, $server, $request )
add ob_clean(); before return $response;
and for custom rest api
add ob_clean(); before returning the results
@Hazix00
Hazix00 / app.config c# proj
Created April 15, 2021 11:07
add to the .csproj to separate release config from debug
<PropertyGroup>
<AppConfig>App.$(Configuration).config</AppConfig>
</PropertyGroup>
@Hazix00
Hazix00 / convertPdf
Created April 12, 2021 15:52
convert multiple pdf to jpg images with imagemagick
magick convert *.pdf -background white -alpha remove -set filename:base "%[basename]" ".\jpg\%[filename:base]_%0d.jpg"
https://winscp.net/eng/docs/library_examples
Sub test()
Dim i As Long
Dim typeCol As String
Dim orgNameCol As String
Dim newNameCol As String
typeCol = "J"
orgNameCol = "K"
newNameCol = "L"
For i = 2 To Range(orgNameCol & 1, Range(orgNameCol & 1).End(xlDown)).Rows.Count
Sub test()
Dim i As Long
For i = 2 To Range("C1", Range("C1").End(xlDown)).Rows.Count
Dim LArray() As String
Dim ln As Integer
LArray() = Split(Range("C" & i).Value, "\")
ln = UBound(LArray) - LBound(LArray)
Range("D" & i) = LArray(ln)
Next
$excel = New-Object -ComObject excel.application
#$excel.visible = $True
$wb = $excel.Workbooks.Add()
$ws = $wb.Worksheets.Item(1)
$ws.Cells.Item(1,1) = 'Titre'
$ws.Cells.Item(1,2) = 'Indice'
$ws.Columns.Item('a').HorizontalAlignment = -4108
$ws.Columns.Item('b').HorizontalAlignment = -4108
$ws.columns.item('b').NumberFormat = "@"
Sub Test()
Dim MyFile As String
Dim cmp As Long
Dim colpath As String
Dim colcimage As String
Dim check As String
'A remplir
colpath = "B" 'la colonne des chemins
@Hazix00
Hazix00 / ExcelCountPdfPages.vba
Last active August 15, 2019 16:54
Count pdf and tiff pages in excel
Option Explicit
Sub Test()
Dim MyFile As String
Dim cmp As Long
Dim colpath As String
Dim colcimage As String
Dim i As Integer
'A remplir