Skip to content

Instantly share code, notes, and snippets.


Gregor Martynus gr2m

View GitHub Profile
gr2m / github-action-cypress-against-now-deployment.yaml
Created Mar 2, 2020
Example GitHub Action workflow which runs Cypress using now's deployment for the current commit. See
View github-action-cypress-against-now-deployment.yaml
name: End-to-end tests
on: [push]
runs-on: ubuntu-latest
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
node-version: 12
gr2m /
Last active Oct 8, 2019
I found myself create new Octokit repositories all the time, due to its decomposable and extendable architecture. Here is how I do it for future reference. Ideally, this would all be automated using an `npm init octokit` script

Create new Octokit (JS) repository


  • repository name: action.js
  • description: GitHub API client for GitHub Actions
# create new folder and change into it
mkdir action.js
gr2m /
Last active Oct 9, 2019
Living document to make the Octokit JS libraries ( work with ECMAScript Modules, Common JS and modern browsers

My usecase: Universal JavaScript libraries for GitHub's APIs for Node.js and modern browsers.

All libraries are written in Typescript, so a build step is necessary which makes it easier to seperate the source code structure from the distribution code structure. I rely heavily on for creating browser bundles and distributing them via their CDN. Example:

I use @pika/pack to create a ./pkg folder with multiple distributions right before publishing to npm. Example:

Currently, the dist-web/ folder is the ECMAScript Module export, it's referenced using the "module" key in its package.json. The dist-node/ folder is referenced using the "main" key in its package.json.

Besides the differentiation of common

gr2m / worker.js
Created Aug 27, 2019
A Cloudflare worker to exchange an OAuth Web Flow code for an access token. Configure your CLIENT_ID and CLIENT_SECRET and you are all set.
View worker.js
addEventListener('fetch', event => {
const CLIENT_ID = '<your client ID>'
const CLIENT_SECRET = '<your client Secret>'
async function handleRequest(request) {
if (request.method === 'GET') {
return new Response(`$ curl -XPOST -H'Content-Type: application/json' -d'{"code": "<your oauth code>"}' ${request.url}`)
gr2m /
Last active Aug 16, 2019
This is a living document on JavaScript Octokit’s build setup using pika pack and semantic-release on GitHub Actions

Octokit.js build setup using @pika/pack

Install @pika/pack and build plugins

npm install --save-dev @pika/pack @pika/plugin-build-node @pika/plugin-build-web @pika/plugin-ts-standard-pkg



Local setup

git clone github-lock-issue-test
cd github-lock-issue-test
npm install
node github-lock-issue-test.js

Should log

gr2m / list_offlinefirst_posts.graphql
Created Jul 19, 2017
With GitHub’s new GraphQL API, you can send a single request to list of files with their content. Try it out on
View list_offlinefirst_posts.graphql
organization(login: "offlinefirst") {
repository(name: "") {
object(expression: "gh-pages:_posts/") {
... on Tree {
entries {
object {
... on Blob {
gr2m / linked_in_delete_all_messages.js
Created Mar 2, 2017
This will delete all your messages on linked in. Run on You are welcome :)
View linked_in_delete_all_messages.js

November was a Dev Beaver-kind of month. Lots of development in preparation for the Hoodie Village release. Dale from Appback started working on Hoodie’s Task Module, the last big piece left to finish for Hoodie’s new plugin architecture. Benjamin did not only get 4 pull requests merged, he is also working on enabling app-specific plugins, very soon: If you are interested how a plugin will look like, we created an example:

You can’t perform that action at this time.