Skip to content

Instantly share code, notes, and snippets.

View deciduously's full-sized avatar
:bowtie:
Baking a pie

Ben Lovy deciduously

:bowtie:
Baking a pie
View GitHub Profile
```
Error: Failed to evaluate the target expression.
Caused by:
0: Failed to evaluate expression returned by JS process.
1: Failed to evaluate expression returned by JS process.
2: No file system object found at path "/home/tester/.local/share/tangram/server/temps/0c47671a824dccade2aecdda57d05029".
Stack backtrace:
0: tangram::client::checkin::<impl tangram::client::Client>::checkin_object_for_path::{{closure}}::{{closure}}
@deciduously
deciduously / hello.c
Created May 26, 2022 16:17
Basic sanity check for linking libc
#include <stdio.h>
int main(void)
{
char *greeting = "Hello, World!";
printf("%s\n", greeting);
return 0;
}
@deciduously
deciduously / animals.cpp
Last active October 26, 2019 14:33
Discussion post demonstration of dynamic binding and polymorphism
/*
* Discussion post code sample
* Benjamin Lovy
*/
#include <iostream>
class Animal
{
public:
@deciduously
deciduously / sft.dats
Last active October 12, 2019 13:21
Single-file template for ATS programs
(*
**
** A template for single-file ATS programs
**
*)
(* ****** ****** *)
//
#include "share/atspre_staload.hats"
//
@deciduously
deciduously / BenFolds.cpp
Last active October 3, 2019 16:15
The BenFolds Five
#include <iostream>
#include <vector>
class BenFolds {
public:
// fold - Fold a binary operation over a vector
template <typename T, typename R, typename BinOp>
static R fold(std::vector<T> elems, R acc, BinOp func)
{
int length = elems.size();
@deciduously
deciduously / Makefile
Created July 23, 2019 00:58
General makefile template for basic CPP projects
CXX=clang++ -std=c++11
FLAGS=-Wall -Wextra -Werror -pedantic -c -g
BUILDDIR=build
SOURCEDIR=src
EXEC=PROJECT-NAME-HERE
SOURCES=$(wildcard $(SOURCEDIR)/*.cpp)
OBJ=$(patsubst $(SOURCEDIR)/%.cpp,$(BUILDDIR)/%.o,$(SOURCES))
all: dir $(BUILDDIR)/$(EXEC)
namespace Day7
module util =
let thing = 0
module part1 =
let execute inputFile = 0
module part2 =
let execute inputFile = 0
@deciduously
deciduously / stdFolds.hs
Created November 29, 2018 13:29
Some library functions implemented in terms of foldr
module StdFolds where
myOr :: [Bool] -> Bool
myOr = foldr (||) False
myAny :: (a -> Bool) -> [a] -> Bool
myAny = flip foldr False . ((||) .)
myElem :: Eq a => a -> [a] -> Bool
myElem = myAny.(==)
@deciduously
deciduously / Makefile
Created January 11, 2018 22:57
Makefile providing boot-clj via make deps
# Makefile
.PHONY: help deps
SHELL := /bin/bash
export PATH := bin:$(PATH)
help:
@echo "Usage: make {deps|help}" 1>&2 && false
bin/boot:
(defn optify
"Helper that examines paths with the supplied prefix and either subs
in their cache-busting URLs or returns them unchanged."
[req prefix]
(fn [^String src]
(or (and (.startsWith src prefix)
(not-empty (link/file-path req src)))
src)))