Skip to content

Instantly share code, notes, and snippets.

View Slackwise's full-sized avatar
🛸
Evangelizing Lisp

Adam Flanczewski Slackwise

🛸
Evangelizing Lisp
View GitHub Profile
@Slackwise
Slackwise / gist:51947209915a5bd1647982c2891a21ac
Created October 17, 2024 00:18 — forked from jackrusher/gist:5139396
Hofstadter on Lisp: Atoms and Lists, re-printed in Metamagical Themas.

Hofstadter on Lisp

In the mid-80s, while reading through my roommate's collection of Scientific American back issues, I encountered this introduction to Lisp written by Douglas Hofstadter. I found it very charming at the time, and provide it here (somewhat illegally) for the edification of a new generation of Lispers.

In a testament to the timelessness of Lisp, you can still run all the examples below in emacs if you install these aliases:

(defalias 'plus #'+)
(defalias 'quotient #'/)
(defalias 'times #'*)
(defalias 'difference #'-)
@Slackwise
Slackwise / npm_version_cheatsheet.md
Created September 27, 2024 16:19 — forked from jonlabelle/npm_version_cheatsheet.md
npm version cheatsheet

npm version cheatsheet

npm uses Semantic Versioning

npm uses Semantic Versioning. Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards compatible manner, and
  3. PATCH version when you make backwards compatible bug fixes.
@Slackwise
Slackwise / oledtest.pde
Created July 16, 2024 03:18 — forked from marcedwards/oledtest.pde
OLED black smearing test for Processing 3.4
// OLED black smearing test for Processing 3.4.
// Black smearing = changing pixels to and from pure black is slower than changing to and from other colours.
//
// Code by @marcedwards from @bjango.
void setup() {
size(360, 360, P2D);
frameRate(60);
smooth(8);
noStroke();
@Slackwise
Slackwise / gist:f7594c993d84f8707d30ae49471d765d
Last active June 12, 2023 01:52 — forked from dangerous/gist:98b2b158b5625f837b8bdce43a965b3f
First 10000 reddit users sourced from karmalb
1. kn0thing
2. spez
3. third
4. fifth
5. fourth
6. agentorange
7. chickenlittle
8. erzengel
9. fizzypop
10. madmax2
@Slackwise
Slackwise / compile-less.js
Created March 30, 2023 20:15
NPM script to compile LESS files because the Visual Studio "Web Compiler" extension doesn't work anymore.
import fs from 'fs';
import { exec } from 'child_process';
const compilationConfig = JSON.parse(fs.readFileSync('compilerconfig.json', 'utf8'));
compilationConfig
.filter(fileConfig => fileConfig.inputFile.endsWith('.less'))
.map(({outputFile, inputFile, minify}) => {
try {
console.log("LESS\tInput:\t" + inputFile);
@Slackwise
Slackwise / getByPath.js
Created January 19, 2023 21:23
Recursively navigates into nested collections inside `collection` by following a sequence of properties `pathArray`, executing any methods along the way, and returning the first `undefined` encountered.
/**
* Recursively navigates into nested collections inside `collection` by
* following a sequence of properties `pathArray`, executing any methods
* along the way, and returning the first `undefined` encountered.
* @param {any} collection - The collection to traverse.
* @param {Array<string|number|function()>} pathArray - A sequence of
* property names, indexes, or functions to traverse into the `collection`.
* @returns {any|undefined} The final value found,
* otherwise the first `undefined` encountered.
* @example
@Slackwise
Slackwise / Fallout76Custom.ini
Created November 1, 2021 17:47
My Fallout 76 config to disable junk like vsync, mouse accel, DOF, etc.
[General]
bGamepadEnable=0
sIntroSequence=0
bSkipSplash=1
bDisableAllGore=0
[Display]
uiOrthoShadowFilter=3
bVolumetricLightingEnable=0
iSize H=1080
iSize W=1920
@Slackwise
Slackwise / advise.js
Last active October 6, 2021 17:59
Example advising function and use.
const advise = (fn, preFn = (...args) => args, postFn = (...args) => args) =>
(...args) =>
postFn(fn(...preFn(...args)));
add = (x, y) =>
x + y;
advisedAdd = advise(
add,
using System;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Data;
public class EnumBindingSourceExtension : System.Windows.Markup.MarkupExtension
{
private Type _enumType;
public Type EnumType
{
@Slackwise
Slackwise / aoc2020_day1_part1.js
Created December 2, 2020 15:32
Run this in the Chrome console (Ctrl-Shift-J) on the input file.
const numbers = document.body.textContent.trim().split('\n').map(Number);
const set = new Set(numbers);
const goalSum = 2020;
const difference = n => goalSum - n;
const subtrahend = numbers.find(n => set.has(difference(n)));
const minuend = difference(subtrahend);
const product = subtrahend * minuend;
console.log(product);