Skip to content

Instantly share code, notes, and snippets.

View auctumnus's full-sized avatar
🌱

autumn auctumnus

🌱
View GitHub Profile
@auctumnus
auctumnus / eval.ml
Created December 26, 2023 04:56
evaluate math expressions from string
(*
E ::= <factor> + <E>
| <factor> - <E>
| <factor>
factor ::= <terminal> * <factor>
| <terminal> / <factor>
| <terminal>
<terminal> ::= <number> | '(' <E> ')'

Keybase proof

I hereby claim:

  • I am auctumnus on github.
  • I am auctumnus (https://keybase.io/auctumnus) on keybase.
  • I have a public key whose fingerprint is 1401 1438 0142 A5F4 2BE5 0384 4E7B 6274 6725 9C47

To claim this, I am signing this object:

function findastargraph(x1, y1, x2, y2, topleftx, toplefty) { // finds the top left, length, and width of the smallest rectangle containing the two points and then turns it into a 2d array of the map data
var length = 1;
var width = 1; // the farther one is the one more to the right, and we need the farthest left; if they're the same, default value is 1
if(x2 > x1) {
length = x2 - x1;
} else if(x1 > x2) {
length = x1 - x2;
}
if(y2 > y1) {
width = y2 - y1;
@auctumnus
auctumnus / _reply.html.erb
Created August 18, 2018 00:59
undefined method `images' for nil:NilClass
<p>
<strong>Title:</strong>
<%= reply.title %>
</p>
<p>
<strong>Files:</strong><br>
<div>
<%= @reply.images.each do |image| %>
<% if image.variable? %>