Skip to content

Instantly share code, notes, and snippets.

View ahsansher's full-sized avatar
¯\_(ツ)_/¯

Ahsan Sher ahsansher

¯\_(ツ)_/¯
View GitHub Profile
@ahsansher
ahsansher / sw.js
Created January 6, 2023 04:20 — forked from logaretm/sw.js
Caching GraphQL responses with Service Workers
const QUERY_CACHE_KEY = 'CACHE_V_0';
const GRAPHQL_URL = 'https://example.com/graphql';
self.addEventListener('fetch', e => {
if (isGraphql(e.request)) {
handleGraphQL(e);
}
});
@ahsansher
ahsansher / donotuse3.py
Created September 22, 2020 20:42 — forked from MineRobber9000/donotuse3.py
How to NEVER use lambdas - Python 3 edition
###########################################################
# How to NEVER use lambdas. An inneficient and yet educa- #
# tonal [sic] guide to the proper misuse of the lambda #
# construct in Python 3.x. [DO NOT USE ANY OF THIS EVER] #
# original by (and apologies to): e000 (13/6/11) #
# now in Python 3 courtesy of: khuxkm (17/9/20) #
###########################################################
## Part 1. Basic LAMBDA Introduction ##
# If you're reading this, you've probably already read e000's
@ahsansher
ahsansher / database.rules.json
Created August 26, 2020 00:34 — forked from codediodeio/database.rules.json
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}