Skip to content

Instantly share code, notes, and snippets.

View nicokosi's full-sized avatar

Nicolas Kosinski nicokosi

View GitHub Profile
@joshcho
joshcho / reactive_render.cljc
Last active January 5, 2024 06:02
Delight, Generating Interactive Controls over Electric Code
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
;; means.
;;
;; In jurisdictions that recognize copyright laws, the author or authors
;; of this software dedicate any and all copyright interest in the
;; software to the public domain. We make this dedication for the benefit
/*
* This code snippet is an extract of a private codebase. Though it relies on many dependencies to
* the rest of the codebase, I believe that the code carries enough intension so that one can get
* the overall idea (see: https://blog.mathieueveillard.com/monkey-testing-et-property-based-testing-une-exploration)
*/
import fc from "fast-check";
const ALL_REDUCERS: HasName<Reducer<ApplicationState>>[] = [
withName("selectPhotograph")(pickRandomIndex(getNumberOfPhotographs)(selectionReducers.selectPhotograph)),
@adrienjoly
adrienjoly / run-npx-with-specific-nodejs-version-thru-nvm.sh
Last active June 19, 2023 08:02
Run a node.js CLI from a github repository, using a specific version of Node.js installed locally with NVM. Addresses `nvm: command not found` error, when `nvm` is invoked from a bash script.
#!/usr/bin/env bash
# Run index.js (or the script specified in package.json's "bin" entry)
# from https://github.com/adrienjoly/notion-backup,
# with the version of 18 of Node.js, installed locally with NVM.
NODE_VERSION=18 ~/.nvm/nvm-exec npx --yes github:adrienjoly/notion-backup
# Why you may need this?
# - If, like me, you have not setup a default version of node.js, on NVM.
# - If you don't want to (or can't) include a `.nvmrc` file.
@jeeger
jeeger / bookstats.clj
Last active November 26, 2022 15:37
Sum up page counts of books from Calibre library with babashka
#!/usr/bin/env bb
(ns bookstats
(:require [babashka.pods :as pods]
[clojure.pprint :as pprint]))
(pods/load-pod 'org.babashka/go-sqlite3 "0.1.0")
(pods/load-pod 'retrogradeorbit/bootleg "0.1.9")
(require '[pod.babashka.go-sqlite3 :as sqlite]
'[pod.retrogradeorbit.hickory.select :as s]
'[pod.retrogradeorbit.bootleg.utils :as utils])
(import [java.net URLEncoder]
@tastapod
tastapod / .github-workflows-release-website.yml
Last active December 20, 2021 15:53
GitHub Action to build and push Hugo website to a separate GitHub Pages repo
name: Release website
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
@ifyoumakeit
ifyoumakeit / github-conventional-comments.js
Last active March 21, 2024 14:52
GitHub Conventional Comments (instructions to install in comment below code)
(async function generateReplies(document) {
// https://conventionalcomments.org/#labels
const LABEL = {
praise: "praise",
nitpick: "nitpick",
suggestion: "suggestion",
issue: "issue",
todo: "todo",
question: "question",
thought: "thought",
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.

Poker hand ranking

Write a function that tells you the best scoring for a given poker hand of 5 cards. For instance:

(score [[3 :diamonds] [3 :hearts] [3 :spades] [5 :hearts] [:king :clubs]])
=> :three-of-a-kind ;; three 3s

Cards are represented as a tuple of rank (number or name if it's a face card) and suit. Face card names are the keywords :ace, :king, :queen, :jack. Suits are :diamonds, :spades, :hearts, :clubs.

@yogthos
yogthos / clojure-beginner.md
Last active April 29, 2024 10:56
Clojure beginner resources

Introductory resources

@swlaschin
swlaschin / fsharpjobs.md
Last active February 23, 2024 03:23
My suggestions on how to look for F# jobs

How to find F# jobs

People often ask me how to find F# jobs. I don't have any special connections to companies using F#, and I don't have any special tricks either. I wish I did!

So, given that, here's my take on F# jobs.

Job hunting

For job hunting my suggestions are: