Skip to content

Instantly share code, notes, and snippets.

making gems

Stewart McGown stewartmcgown

making gems
View GitHub Profile
matchu /
Last active July 7, 2021 10:29
Fork of Apollo Server's cache-control plugin, with stale-while-revalidate support

Hi! This is a plugin I hacked together, to add another field staleWhileRevalidate to Apollo Server's @cacheControl directive!

To use this, you'll need to disable the built-in plugin by setting cacheControl: false in your Apollo Server config.

Then, add this plugin, and initialize it with the option calculateHttpHeaders: true (which Apollo Server normally enables by default).

const server = new ApolloServer({
    // ...
 cacheControl: false,
View get-response.json
"export": {
"id": "eda61457-f0eb-459a-991f-f8a597bd1a15",
"status": "SUCCEEDED",
"items": [
"id": "1TdFtOzKlGQnckOavxlwgJuW4nc9oGU6U"
"conversions": [
OlegIlyenko / Event-stream based GraphQL
Last active May 18, 2023 08:52
Event-stream based GraphQL subscriptions for real-time updates
View Event-stream based GraphQL

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

View Scaling Cronjobs
Cron Jobs Are Hard To Distribute
Watch out when scaling out instances with cron jobs on them. Cron jobs aren't designed for the cloud. If the machine image holding your cron job scales out to 20 instances, your cron job will be executed 20 times more often.
This is fine if the scope of your cron job is limited to the instance itself, but if the scope is larger, the above becomes a serious problem. And if you single out a machine to run those cron jobs, you run the risk of not having it executed if that machine goes down.
rxaviers / gist:7360908
Last active May 31, 2023 17:39
Complete list of github markdown emoji markup
View gist:7360908


:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: