Skip to content

Instantly share code, notes, and snippets.

View therealparmesh's full-sized avatar
🦮

Parmesh Krishen therealparmesh

🦮
  • Austin, Texas
  • 15:43 (UTC -06:00)
View GitHub Profile
@therealparmesh
therealparmesh / ExtJSEventLogging.js
Last active September 1, 2017 18:53
Ext JS component-level event logging
Ext.onReady(function () {
Ext.define('Ext.override.eventLogging.Component', {
override: 'Ext.Component',
initComponent: function () {
var self = this
Ext.util.Observable.capture(self, function (eventName) {
console.log(eventName, self.getId(), self)
})
self.callParent(arguments)
}
@therealparmesh
therealparmesh / example.js
Created January 24, 2019 00:02
Redux Saga example
const { REQUEST, SUCCESS, FAILURE } = makeApiActionTypes('GET_USERS');
// register the reducer somewhere
const usersReducer = makeApiReducer({ REQUEST, SUCCESS, FAILURE });
const makeSelectUserById = id => state => state.users.byId[id];
function* getUsersSaga() {
try {
const { data } = yield call(axios, {
@therealparmesh
therealparmesh / helpers.js
Created January 26, 2019 00:10
Redux Saga helpers
import { call, cancel, fork, take } from 'redux-saga/effects';
export function takeLatestPerKey(patternOrChannel, worker, keySelector, ...args) {
return fork(function*() {
const tasks = {};
while (true) {
const action = yield take(patternOrChannel);
const key = yield call(keySelector, action);
@therealparmesh
therealparmesh / .zshrc
Created February 19, 2019 02:40
macOS zsh configuration using Antigen
export ANTIGEN_PATH=~/.antigen
source $ANTIGEN_PATH/antigen.zsh
antigen use oh-my-zsh
antigen theme robbyrussell
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-completions
antigen bundle zsh-users/zsh-history-substring-search
antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply
bindkey "^[[A" history-substring-search-up
@therealparmesh
therealparmesh / google-photos-takeout-metadata-fix.sh
Last active February 23, 2025 03:23
Google Photos Takeout Metadata Fix
exiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" "-FileCreateDate<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json .
@therealparmesh
therealparmesh / .eslintrc
Created November 11, 2021 03:47
ESLint configuration for React with TypeScript
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
@therealparmesh
therealparmesh / bear-tags-regex.txt
Created December 26, 2021 23:08
Bear tags regex
\{\\field\{\\\*\\fldinst\{HYPERLINK "bear://x-callback-url/open-tag\?name=.*"\}\}\{\\fldrslt (.*)\}\}\}
export async function retryAsync<T>(
asyncFn: () => Promise<T>,
maxRetries: number,
): Promise<T> {
let retries = 0;
while (retries < maxRetries) {
try {
return await asyncFn();
} catch (error) {
@therealparmesh
therealparmesh / Makefile
Created March 16, 2024 22:23
Go + Bun + HTMX + Tailwind Makefile
.PHONY: setup dev build
setup:
@echo "Checking for go..."
@command -v go >/dev/null 2>&1 || { echo >&2 "go is not installed. Aborting."; exit 1; }
@echo "Checking for bun..."
@command -v bun >/dev/null 2>&1 || { echo >&2 "bun is not installed. Aborting."; exit 1; }
@echo "Checking for air..."
@command -v air >/dev/null 2>&1 || { echo >&2 "air is not installed. Please install it by running 'go install github.com/cosmtrek/air@latest'. Aborting."; exit 1; }
@echo "Running go mod tidy..."
@therealparmesh
therealparmesh / slides.html
Created May 22, 2024 17:16
reveal.js boilerplate
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<title>reveal.js</title>
<link