Skip to content

Instantly share code, notes, and snippets.

View pocha's full-sized avatar

Ashish Sharma pocha

View GitHub Profile

Hybrid App for WiFi connectivity & Data accounting

Hybrid - as this app needs porting to other platforms. Basically - the UI part needs to be in hybrid (phonegap/ionic) - the core parts anyway need to be done in native (as phonegap plugins)

Work scope - PoC app preferably working on an Android phone

This app is going to be open source & (mostly) will be used for a free WiFi Gujrat Govt project . Details at https://gil.gujarat.gov.in/tendercms/TenderDocs/2017123145318973.pdf

If interested to work on this project - drop me a word at pocha.sharma at gmail / 9 5 3 8 3 8 4 5 4 5

AnOpenLetter V2.0

Aim - people should be able to

  1. Create & edit post
  2. Post creation elements - heading, date, time & location of event, concerned department/brand/officer identifier, post details, image attachment
  3. The system should tweet to concerned officer/brand after post creation
  4. User should be able to post updates/responses. It all should appear as timeline one after another including comments. Each update/comment/edit to the post should get tweeted to concerned officer. The officer's reply to the tweet should also show up in the timeline.
  5. Post should be creatable using mobile phone
@pocha
pocha / lru-cache-ttl-priority.md
Last active September 17, 2022 23:24
LRU cache with TTL & priority

Design LRU Cache with TTL & priority

An interview question that is becoming popular (apparently British Petroleum folks have been asking in their interview) is design LRU cache. The catch is - each item has a TTL & a certain priority specified while the key, value is put into the cache. The eviction policy when cache is full is in the order

  • evict all (or just the oldest expired value) based on TTL, if this makes space, good enough
  • if nothing to evict as nothing has expired, remove the one with the lowest priority
  • if there are multiple items with the lowest priority, remove the one that was accessed the first

The problem is pretty hard to even come up with a solution in an hour. You also need to write code of whatever solution you could find. The tradition LRU cache is designed as hashmap & a doubly linked linkedlist. Doubly linked linkedlist helps because the access time of keys are linear & you need to move the accessed key to the top of the linked list & remove the oldest item.

In this cas

import { assertFails, assertSucceeds } from "@firebase/rules-unit-testing"
import {
getDoc,
setDoc,
collection,
doc,
connectFirestoreEmulator,
CollectionReference,
DocumentData,
import { initializeTestEnvironment } from "@firebase/rules-unit-testing"
import { setLogLevel } from "firebase/firestore"
const FIREBASE_PROJECT_ID = "xxxx"
export const USER_COLLECTION = "users-main"
export const APPLICATION_COLLECTION = "applications"
export const ASHISH_ID = "xxxx"
export const BETTS_ID = "xxxx"
export const ZUKA_ID = "xxxx"