Skip to content

Instantly share code, notes, and snippets.

import { Octokit } from "https://cdn.skypack.dev/@octokit/core?dts";
import { Kind, parse, visit } from "https://cdn.skypack.dev/graphql?dts";
interface PaginationItem {
location: string;
cursorVariableName: string;
}
const extractPaginatedItems = (query: string): PaginationItem[] => {
const ast = parse(query, { noLocation: true });

General info

Wikipedia:

Go or Weiqi, Weichi (simplified Chinese: 围棋; traditional Chinese: 圍棋; pinyin: wéiqí) is an abstract strategy board game for two players in which the aim is to surround more territory than the opponent. The game was invented in China more than 2,500 years ago and is believed to be the oldest board game continuously played to the present day.

Rules

@laughedelic
laughedelic / scalatest-parallelism.md
Created August 18, 2021 15:56
ScalaTest parallel testing

Docs

  • Async testing
  • Using the runner:

    If you include -P on the command line, Runner will pass a Distributor to the Suites you specify with -s. Runner will set up a thread pool to execute any Suites passed to the Distributor's put method in parallel. Trait Suite's implementation of runNestedSuites will place any nested Suites into this Distributor. Thus, if you have a Suite of tests that must be executed sequentially, you should override runNestedSuites as described in the documentation for Distributor.

> The -P option may optionally be appended with a number (e.g. "-P10" -- no intervening space) to specify the number of threads to be created in the thread pool. If no number (or 0) is specified, the number of threads will be decided based on the num

#!/usr/bin/env deno run --allow-read --allow-net
import getopts from "https://cdn.skypack.dev/getopts";
import { request } from "https://cdn.skypack.dev/@octokit/request";
import { create, getNumericDate } from "https://deno.land/x/djwt/mod.ts";
const opts = getopts(Deno.args);
const { _, appId, installationId, privateKey, ...params } = opts as any;
const endpoint = _.join(" ");
@laughedelic
laughedelic / keyboards-intro.md
Last active November 27, 2020 13:04
keeb-notes

Introduction to the world of mechanical keyboards

Dramatic intro

Motivation

Why care about keyboards?

  • an input device you interact with for many hours a day
  • choose your weapon tools! personalize your equipment
@laughedelic
laughedelic / diff.sql
Created April 8, 2019 10:41
See the difference between two tables on the given column
SELECT DISTINCT
a.column AS a_column,
b.column AS b_column
FROM
a FULL JOIN b
ON a.column = b.column
WHERE
a.column IS NULL OR
b.column IS NULL
@laughedelic
laughedelic / sbt-dependency-management-guide.md
Last active April 25, 2024 19:06
Explicit dependency management in sbt

Some of these practices might be based on wrong assumptions and I'm not aware of it, so I would appreciate any feedback.

  1. avoiding some dependency conflicts:

    • install sbt-explicit-dependencies globally in your ~/.sbt/{0.13,1.0}/plugins/plugins.sbt
    • run undeclaredCompileDependencies and make the obvious missing dependencies explicit by adding them to libraryDependencies of each sub-project
    • (optionally) run unusedCompileDependencies and remove some obvious unused libraries. This has false positives, so ; reload; Test/compile after each change and ultimately run all tests to see that it didn't break anything
    • (optionally) add undeclaredCompileDependenciesTest to the CI pipeline, so that it will fail if you have some undeclared dependencies
  2. keeping dependencies up to date and resolving conflicts:

    • install sbt-updates globally in your `~/.sbt/{0.13,1.0}/plugins/plugins.
/* This object contains some generic collections ops that can be useful for filtering */
object CollectionOps {
implicit class IteratorOps[V](val iterator: Iterator[V]) extends AnyVal {
/* Similar to the Stream's .groupBy, but assuming that groups are contiguous. Another difference is that it returns the key corresponding to each group. */
// NOTE: The original iterator should be discarded after calling this method
def contiguousGroupBy[K](getKey: V => K): Iterator[(K, Seq[V])] = new Iterator[(K, Seq[V])] {
/* The definition is very straightforward: we keep the `rest` of values and on each `.next()` call bite off the longest prefix with the same key */

Keybase proof

I hereby claim:

  • I am laughedelic on github.
  • I am aalekhinera7 (https://keybase.io/aalekhinera7) on keybase.
  • I have a public key ASCPt2YV_CQSKdMib-02pGklxFn_qBnDhvWmC_2QweXWLwo

To claim this, I am signing this object:

@laughedelic
laughedelic / failure1.pc.stdout.log
Last active November 21, 2017 16:05
ENSIME server failure on start
Exception in thread "main" java.util.concurrent.TimeoutException: Futures timed out after [5 seconds]
at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:255)
at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:259)
at scala.concurrent.Await$.$anonfun$result$1(package.scala:215)
at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)
at scala.concurrent.Await$.result(package.scala:142)
at org.ensime.lsp.ensime.EnsimeLanguageServer.$anonfun$hoverRequest$6(EnsimeLanguageServer.scala:392)
at scala.Option.map(Option.scala:146)
at org.ensime.lsp.ensime.EnsimeLanguageServer.hoverRequest(EnsimeLanguageServer.scala:392)
at org.ensime.lsp.core.LanguageServer$ResponseHandler$$anonfun$buildHandler$1.applyOrElse(LanguageServer.scala:54)