Skip to content

Instantly share code, notes, and snippets.

View aeisenberg's full-sized avatar
:octocat:

Andrew Eisenberg aeisenberg

:octocat:
View GitHub Profile
import java.util.Collection;
public class Ambiguity {
public void foo(CriteriaBuilder builder) {
// change Object -> Number (or any other type) and it compiles
Expression<Object> objectExpression = null;
Expression<Collection<Object>> collectionOfObjectExpression = null;
builder.isNotMember(objectExpression, collectionOfObjectExpression);
}
@aeisenberg
aeisenberg / git-clone-gerrit
Created June 26, 2018 20:53
Clones a repository from gerrit and includes a default /refs/for/* clause
#! /bin/sh -e
server=gerrit.example.com # change to your own server
username=$1
project=$2
url=ssh://${username}@${server}:29418/${project}
git clone ${url}
cd ${project}
git config gerrit.createchangeid true
git config remote.origin.url ${url}
git config remote.origin.push HEAD:refs/for/master
@aeisenberg
aeisenberg / VSCODE-CODEQL-in-workspaces.md
Last active March 9, 2022 21:58
How to get codeql working in codespaces

About Codespaces

Codespaces is a product from GitHub that allows users to use a hosted version of VS Code to edit their GitHub repositories online.

Getting CodeQL running in codespaces

  1. Fork the vscode-codeql-starter repo.
  2. Create and open a codespace on the main branch.
    vscode-codeql-starter
  3. Open the workspace file vscode-codeql-starter.code-workspace and make sure codespaces reloads so that it is using that workspace file. (This may happen automatically.)
@aeisenberg
aeisenberg / Eratosthenes.js
Last active May 6, 2020 15:36
Sieve of Eratosthenes
/**
* This function implements the Sieve of Eratosthenes.
* https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
*
* @param {number} lastNumber The upper bound of the number to check
* @return {number[]} An array of prime numbers less than lastNumber
*/
function sieve(lastNumber = 1000) {
// Create an array and fill it with true
// Important! the array's length is one more than lastNumber so that