Skip to content

Instantly share code, notes, and snippets.

@savasda
savasda / gist:644d1b62cee93fc1ec35552f2cbd1fc0
Created May 3, 2025 08:44
standalone migration to Angular 19
const fs = require('fs');
const path = require('path');
function findAllTsFiles(dir) {
let results = [];
const list = fs.readdirSync(dir);
list.forEach(file => {
const fullPath = path.join(dir, file);
const stat = fs.statSync(fullPath);
if (stat.isDirectory()) {
@savasda
savasda / playwright.txt
Created September 14, 2022 18:10
playwright test env
script command
"vscode-debug": "playwright test apps/batch-journey-e2e/src/specs/csv-upload/csv-upload-select-template.e2e-spec.ts --config ./playwright.config.ts --workers=1"
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
getDateArray() {
const arrAfter = new Array();
const arrBefore = new Array();
const dateAfter = new Date();
const dateBefore = new Date();
const dateFrom = moment(new Date()).subtract(7, 'd');
const dateTo = moment(new Date()).add(7, 'd');
while (dateBefore >= dateFrom.toDate()) {
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'bcEllipsis' })
export class EllipsisPipe implements PipeTransform {
transform(str: string, strLength: number = 250) {
const withoutHtml = str.replace(/(<([^>]+)>)/gi, '');
if (str.length >= strLength) {
return `${withoutHtml.slice(0, strLength)}...`;
}
declOfNum(n, titles): string {
return titles[(n % 10 === 1 && n % 100 !== 11) ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2]
}
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* стили только для IE10 */
}
try {
for (var i = 0; i < item.length; i++) {
var e = item[i].getElementsByTagName('img');
var attr = e[0].attributes;
var link = "";
for (var z = 0; z < attr.length; z++) {
if (attr[z].name === "data-src") {
@savasda
savasda / gist:447af9009c96c143a91bcb67596f56a4
Created April 6, 2017 05:08
hide .map .js file vd code
In VS Code go to Code (or File for Windows users) > Preferences > Workspace Settings and add this code snippet:
{
"files.exclude": {
"**/*.js": {
"when": "$(basename).ts"
},
"**/*.map": {
"when": "$(basename).map"
}
.line-clamp
-webkit-line-clamp: 3
-webkit-box-orient: vertical
display: -webkit-box
overflow: hidden
//для изпользования добавить animate css и waypoints
setTimeout(function(){//применение анимацмм к маркерам при загрузке
$('.ymaps-2-1-42-placemark-overlay').each(function(i, elem){
$(this).css({
'animation-delay':'0.'+i*12+'s',
}).find('[class*=71x71],[class*=46x46],[class*=58x58]').css({
'borderRadius': '50%',
'boxShadow': 'rgba(0, 0, 0, 0.298039) 5px -2px 5px -3px'
});