Skip to content

Instantly share code, notes, and snippets.

View solancer's full-sized avatar
🎯
Focusing

Srinivas Gowda solancer

🎯
Focusing
View GitHub Profile
webApp/
β”œβ”€β”€ package.json
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ app.js
β”‚ β”œβ”€β”€ views/
β”‚ β”‚ β”œβ”€β”€ home.html
β”‚ β”‚ └── about.html
β”‚ └── models/
β”‚ β”œβ”€β”€ user.js
β”‚ └── product.js
@solancer
solancer / project-tree.txt
Created January 23, 2024 13:28
project-tree.txt
project/
β”œβ”€β”€ src
β”‚ β”œβ”€β”€ controllers
β”‚ β”‚ └── yourController.js
β”‚ β”œβ”€β”€ models
β”‚ β”‚ └── yourModel.js
β”‚ β”œβ”€β”€ routes
β”‚ β”‚ └── yourRoute.js
β”‚ β”œβ”€β”€ utils
β”‚ β”‚ └── database.js
@solancer
solancer / webProjectv3.txt
Created January 25, 2024 15:21
webProjectv3 tree2dir test
webProjectv3/
β”œβ”€β”€ LICENSE.md
β”œβ”€β”€ README.md
β”œβ”€β”€ archetypes
β”‚ └── default.md
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ gulpfile.js
β”œβ”€β”€ layouts
β”‚ β”œβ”€β”€ 404.html
β”‚ β”œβ”€β”€ blog
@solancer
solancer / redis-setup.js
Created July 11, 2024 07:57
redlock - lock jobs
// In server/boot/redis-setup.js or any relevant file
const Redis = require('ioredis');
const Redlock = require('redlock');
// Initialize Redis
const redis = new Redis(); // Assumes Redis is running on default host and port
// Setup Redlock for distributed locks
const redlock = new Redlock(
@solancer
solancer / convert_lb3_to_lb4.py
Created August 20, 2024 14:01
Convert Loopback 3 to Loopback 4 model
# Updated function to handle missing `base` property in the model JSON files.
def convert_lb3_to_lb4(lb3_model_content):
model_name = lb3_model_content['name']
base_model = lb3_model_content.get('base', 'Entity')
base_model = 'Entity' if base_model == 'PersistedModel' else base_model
# Start building the TypeScript model
ts_model = f"import {{Entity, hasMany, hasOne, belongsTo, model, property}} from '@loopback/repository';\n"
# Collect imports for related models