Instantly share code, notes, and snippets.

# dharmatech

Last active September 26, 2021 14:38
porting hackernews -> org-mode from js to elisp https://gist.github.com/dharmatech/2ef271907cb73298318fdb50a4ee7d54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ;;; hn.el --- convert hacker news post into org-mode buffer -*- lexical-binding: t -*- ;; Copyright (C) 2018- Free Software Foundation, Inc. ;; Author: Johan Ponin ;; Version: 0.0.1 ;; Package-Version: 20181103.0001 ;; Keywords: hackernews, org-mode ;; This program is free software; you can redistribute it and/or modify
Last active September 7, 2024 17:03
How to add a collapsible section in markdown.

# How to add a collapsible section in markdown

## 1. Example

Click me

1. Foo
2. Bar
• Baz
• Qux
Last active January 4, 2017 13:20

# Acceleration of Two Objects Connected by a Cord

A ball of mass m1 and a block of mass m2 are attached by a lightweight cord that passes over a frictionless pulley of negligible mass, as shown in the figure below. The block lies on a frictionless incline of angle θ. Find the magnitude of the acceleration of the two objects and the tension in the cord.

Let's solve this problem using Symbolism, a computer algebra library for C#.

Free-body diagram for the ball:

Last active November 10, 2023 01:24

Let's solve the following physics problem using Symbolism, a computer algebra library for C#.

One strategy in a snowball fight is to throw a first snowball at a high angle over level ground. While your opponent is watching the first one, you throw a second one at a low angle and timed to arrive at your opponent before or at the same time as the first one.

Assume both snowballs are thrown with a speed of 25.0 m/s.

The first one is thrown at an angle of 70.0° with respect to the horizontal.

Last active March 4, 2022 06:41

# The problem to solve

An example problem from the textbook Physics for Scientists and Engineers by Serway and Jewett:

Let's solve this using Symbolism, a C# library for computer algebra and symbolic computation.

# Symbol definitions

Last active December 14, 2022 16:02

# Neo4j inspired graph database in Microsoft Access

Here I've clicked on the `Book` label. The nodes list displays nodes with the `Book` label. I then clicked on `Dune`, so the relationships list shows that the `AUTHOR` of `Dune` is `Frank Herbert` who was `BORN_IN` Tacoma.

Now I've selected the `Album` label and `TheJoyOfMotion` node. The relationship lists show that `AnimalsAsLeaders` `RELEASED` this album, that `Lippincott` is a `TRACK` on this album, and that this track was inspired by Tom Lippincott.

Last active December 20, 2015 13:19

# Quotation

Assuming a document system involving multiple authors each with their own documents:

A user should be able to select text in another document and use it as a quotation in their own document.

This quotation should be a link which will take a user back to the referenced text.

This quotation should link to the particular version of the document that is referenced.

Created October 30, 2010 04:52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 ;; Generics with return types #| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; \$ petite --script generics.scm |# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (gen-id template-id . args)
Created October 17, 2010 23:37

# Generics in Scheme

In a previous note I demonstrated polymorphism in Scheme using Chez Scheme's compile time values and properties.

The code in that example is pretty raw; you might not want to code each generic in that manner. One approach is to decouple the signature/method table. We can do this by factoring out some code into a 'make-generic' procedure:

```(define (make-generic table)
(lambda (stx)
(lambda (lookup)
```
Created September 18, 2010 07:59

# Polymorphism in Scheme via compile time dispatch

Here's an example of polymorphism in C++:

``````int nth ( int a[] , int i ) { return a[i] ; }

double nth ( double a[] , int i ) { return a[i] ; }
``````

One way to think of this is that there are two functions called `nth`. One can be called with an int array and the other can be called with a double array. The function that is called is determined at compile time by looking at the type of the expression of the first argument.