Skip to content

Instantly share code, notes, and snippets.

View kristof-mattei's full-sized avatar
🦀
Rusting?

Kristof Mattei kristof-mattei

🦀
Rusting?
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kristof-mattei on github.
  • I am kristofmattei (https://keybase.io/kristofmattei) on keybase.
  • I have a public key ASAevan0fX1gq59VqKbRa6hprCvpUredN30hzoe7fBhaaQo

To claim this, I am signing this object:

@kristof-mattei
kristof-mattei / python_lambda_closure.py
Last active October 29, 2021 18:02
Comparing lambda closure capturing in Python and javascript
# sorry, python doesn't have a built-in table printer
from tabulate import tabulate
max = 3
def get_functions():
lst = []
for i in range(0, max):
lst.append(lambda: i)
return lst
@kristof-mattei
kristof-mattei / cleanup_all_workflow_runs.js
Created October 29, 2021 16:42
Clean up all workflow runs.
const { Octokit } = require("@octokit/rest");
const { serializeError } = require("serialize-error");
const octokit = new Octokit({
auth: "PUT TOKEN HERE"
});
const baseRef = {
owner: "Kristof-Mattei",
@kristof-mattei
kristof-mattei / javascript_lambda_closure.js
Last active October 29, 2021 17:04
Comparing lambda closure capturing in Python and javascript
const max = 3;
function get_functions() {
lst = []
for (const i of [...Array(max).keys()]) {
lst.push(() => i)
}
return lst
}
function* get_functions_yield() {
module Engine.Functions
let rec Calculate columns =
match columns with
| h::[] -> [ [ h ] ]
| h::t ->
let x = Calculate t
List.fold (fun acc elem -> (h::elem)::acc) ([h]::x) x
| [] -> []