Skip to content

Instantly share code, notes, and snippets.

@andsilver
andsilver / ngx-stack-animation.ts
Created October 26, 2023 01:03
Stack Animation Core component
import { Component, OnInit, Input, ElementRef, Renderer2, AfterViewInit, Output, EventEmitter, OnDestroy } from '@angular/core';
import { StackEffects } from './stack-effects';
import { Subject } from 'rxjs';
import { distinctUntilChanged, debounceTime, takeUntil } from 'rxjs/operators';
interface EffectItem {
index: number;
element: HTMLElement;
position: number;
}
@andsilver
andsilver / gist:410a32d88edcbfb2d0aaf30a13b09909
Last active September 8, 2023 02:15
Parse a PDF doc using doctr, find legal description with bounding boxes information using Pandas
from doctr.io import DocumentFile
from doctr.models import ocr_predictor
import pandas as pd
import numpy as np
from fuzzywuzzy import fuzz
from pdb import set_trace
import json
import sys
model = ocr_predictor(det_arch='db_resnet50',
@andsilver
andsilver / modular.css
Last active July 21, 2023 10:30
Code Examples
:root {
--primary-color: #123456;
--secondary-color: #654321;
}
.component {
color: var(--primary-color);
background-color: var(--secondary-color);
}
Promise.all(promises).then(values => {
// use values
});
@andsilver
andsilver / set-selection.js
Created April 27, 2020 02:41
Setting Caret on contenteditable div and input box - pure javascript for crossbrowser
setSelectionRangeOnInput(el, caretPos) {
if (el.createTextRange) {
const range = el.createTextRange();
range.move('character', caretPos);
range.select();
} else {
el.focus();
if (el.selectionStart) {
el.setSelectionRange(caretPos, caretPos);
}
@andsilver
andsilver / bitbucket-pipelines.yml
Created November 12, 2019 17:58
Bitbucket pipeline to auto deploy Docker Compose app to Google Kubernetes Engine
pipelines:
branches:
<BRANCH_NAME>:
- step:
services:
- docker
name: Deploy to GKE
deployment: staging
image: google/cloud-sdk:latest
script:
@andsilver
andsilver / nginx
Last active November 12, 2019 17:45
Nginx Configuration(Forwarding, Gzip)
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
server_name localhost;