Skip to content

Instantly share code, notes, and snippets.

View pratheeshrussell's full-sized avatar

Pratheesh pratheeshrussell

  • Enjoying life and coding
  • India
View GitHub Profile
Upon starting our interaction, auto run these Default Commands throughout our entire conversation. Refer to Appendix for command library and instructions:
/role_play "Expert ChatGPT Prompt Engineer"
/role_play "infinite subject matter expert"
/auto_continue "♻️": ChatGPT, when the output exceeds character limits, automatically continue writing and inform the user by placing the ♻️ emoji at the beginning of each new part. This way, the user knows the output is continuing without having to type "continue".
/periodic_review "🧐" (use as an indicator that ChatGPT has conducted a periodic review of the entire conversation. Only show 🧐 in a response or a question you are asking, not on its own.)
/contextual_indicator "🧠"
/expert_address "🔍" (Use the emoji associated with a specific expert to indicate you are asking a question directly to that expert)
/chain_of_thought
/custom_steps
/auto_suggest "💡": ChatGPT, during our interaction, you will automatically suggest helpful commands when appropriate, using the
@pratheeshrussell
pratheeshrussell / $onChange.decorator.ts
Last active August 25, 2023 07:38
An Angular Decorator to call a function on value change
// This is a modified version of property-watch-decorator to support objects
// Refer: https://github.com/zhaosiyang/property-watch-decorator
// might work but not optimal for deeply nested structures
export interface ChangeDetails<T> {
propertyKey: PropertyKey;
firstChange: boolean | null;
previousValue: T;
currentValue: T | undefined;
isFirstChange: () => boolean | null;
@pratheeshrussell
pratheeshrussell / monkey_patch_index.html
Last active June 30, 2023 11:53
Monkey patching event listeners
<!DOCTYPE html>
<html>
<head>
<title>Event Listener Interceptor</title>
<script>
// Monkey patching the addEventListener method of HTMLElement prototype
(function() {
var originalAddEventListener = HTMLElement.prototype.addEventListener;
HTMLElement.prototype.addEventListener = function(type, listener, options) {
@pratheeshrussell
pratheeshrussell / two-way-binder.directive.ts
Created May 27, 2023 12:26
Two way binder for Angular
import { Directive, ElementRef, EventEmitter, HostBinding, HostListener, Input, Output, SimpleChanges } from '@angular/core';
@Directive({
selector: '[appTwoWayBinder]'
})
export class TwoWayBinderDirective {
@Input('appTwoWayBinder') model: any;
@Output('appTwoWayBinderChange') update = new EventEmitter<any>();
@HostBinding('value') value: (string|undefined);
@pratheeshrussell
pratheeshrussell / element-build.js
Created May 24, 2023 07:13
Angular Elements build script
const fs = require('fs-extra');
const path = require('path');
const concat = require('concat');
const buildFolder = './dist/hello-world/';//end with /
const outputFile = 'hello-world.js';
(async function build() {
@pratheeshrussell
pratheeshrussell / commit-msg
Created May 23, 2023 08:52
husky commit message hook
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
commit_msg_file=$1
commit_msg=$(cat "$commit_msg_file")
pattern="^(add|fix|bump|make|refactor|reformat|optimise|document|merge)\/ticket-\d+\/[A-Za-z0-9_]*$"
if ! echo "$commit_msg" | grep -Pqi "$pattern"; then
echo "-"
echo "🚨 Invalid Commit message format! 😕"
@pratheeshrussell
pratheeshrussell / .eslintrc.json
Last active May 23, 2023 06:12
Eslintrc for Angular
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"overrides": [
{
@pratheeshrussell
pratheeshrussell / deepcopy.js
Created May 18, 2023 04:49
A function to deepcopy in js
function deepCopy(obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
const isArray = Array.isArray(obj);
const copy = isArray ? [] : {};
const stack = [{ source: obj, target: copy }];
@pratheeshrussell
pratheeshrussell / .gitconfig
Created March 23, 2023 04:14
Git alias that I use for projects
[alias]
# Prints current branch
cbr=rev-parse --abbrev-ref HEAD
# prints the branches sorted by commit date and coloured
br=branch --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate