Skip to content

Instantly share code, notes, and snippets.

View jcottrell's full-sized avatar

Joshua Cottrell jcottrell

  • The Southern Baptist Theological Seminary
  • Louisville, KY
  • X @joshuacottrell
View GitHub Profile
@jcottrell
jcottrell / chatgpt-racket-solution-eventually.rkt
Created March 17, 2023 19:06
ChatGPT trying to write Racket
#lang racket
(require rackunit)
#|
Comments are wrapped in #|with comments in between|# and commented out code starts with #;
The parts wrapped in square brackets [are my thoughts/comments on the results and general interaction.
ChatGPT prompt:
Me: I want you to create a racket program that will search a list of lists for an atom and either
@jcottrell
jcottrell / docker-compose.yml
Last active July 13, 2022 15:41
Minecraft Bedrock on home wifi
version: '3.4'
services:
cc1:
image: itzg/minecraft-bedrock-server
environment:
ALLOW_CHEATS: "true"
DEFAULT_PLAYER_PERMISSION_LEVEL: operator
DIFFICULTY: easy
EULA: "TRUE"
@jcottrell
jcottrell / events.json
Created February 24, 2021 22:57
Fake database for ajax testing
[
{
"id": 123,
"category": "animal welfare",
"title": "Cat Adoption Day",
"description": "Find your new feline friend at this event.",
"location": "Meow Town",
"date": "January 28, 2022",
"time": "12:00",
"organizer": "Kat Laydee"
@jcottrell
jcottrell / encode.hs
Created July 10, 2019 21:39
Practicing haskell with a short encoding problem to help me create alphabet shifts for my children. Loaded into ghci you would do `encode 1 "Welcome to spy class!"` and get `23-5-12-3-15-13-5 20-15 19-16-25 3-12-1-19-19!`
module Encode (encode) where
import Data.Char (isAlpha, isDigit, isUpper, toLower)
switchChar :: Int -> Char -> String
-- needs to wrap around if shift is greater than alphabet ??
switchChar shift x =
show
$ head
$ map snd
@jcottrell
jcottrell / index.js
Created June 4, 2019 19:59
Lambda Calculus in Javascript: Two Lectures by Gabriel Lebec (glebec); notes by jcottrell
// Lambda Calculus - Fundamentals of Lambda Calculus & Functional Programming
// Part 1
// https://www.youtube.com/watch?v=3VQ382QG-y4
const inspect = Symbol.for('nodejs.util.inspect.custom')
// Idiot or Identity or Haskell's id
const I = a => a
// Mockingbird (Haskell cannot implement)
@jcottrell
jcottrell / COFFEE-voter.js
Created October 24, 2018 22:46
Vote for COFFEE
javascript:(function(w,d){if(w.location.href==='https://docs.google.com/forms/d/e/1FAIpQLSf-SbtOs4DL6zj_Y4A7gKPsQDk045y8N7ZI8Hi9yD1ZkmRtfw/viewform'){d.querySelectorAll('label')[0].click();d.querySelectorAll('form')[0].submit()}setTimeout(()=>{w.location='https://docs.google.com/forms/d/e/1FAIpQLSf-SbtOs4DL6zj_Y4A7gKPsQDk045y8N7ZI8Hi9yD1ZkmRtfw/viewform'},500)}(window, document))
@jcottrell
jcottrell / unique-array-from-object-array.js
Created March 23, 2017 20:46
This is a function I wanted to keep somewhere until I found the library that did it better or had the time to implement ramdajs. It takes a couple functions and an array of objects. It returns an array of objects / values / results based on a unique value.
/* ok, ok, I needed a way to get unique values from objects
getUniqueIdFun should be a function that returns the value of what
you want to be unique
getUniquePartFun should be a function that returns the part of the
object you are interested in; it can be undefined, null, empty if
you want the whole object back
objAr should be an array of objects to cull from
*/
const getUniqueObjectsFromArray = (getUniqueIdFun, getUniquePartFun, objAr) => {
const getU = (typeof getUniquePartFun === 'function') ?
@jcottrell
jcottrell / asana-bookmarklet.js
Last active September 27, 2016 14:02
Asana Unicorn Creator Bookmarklet
/* globals AsanaRainbow,env,CommonUrl */
/* jshint camelcase: false */
// https://app.asana.com/-/static/apps/asana/media/celebration_unicorn.png
// https://app.asana.com/-/static/apps/asana/media/celebration_phoenix.png
// https://app.asana.com/-/static/apps/asana/media/celebration_narwhal.png
// https://app.asana.com/-/static/apps/asana/media/celebration_yeti.png
(function (win) {
'use strict';
var r,
celebrants,
@jcottrell
jcottrell / jquery-boyce-nav.js
Last active August 16, 2016 21:34
Using detach to fix View All in navigation
var viewAll1 = function (e) {
e.preventDefault();
$me = $(this);
$kids = $me.parent().find('.children').detach();
$me.closest('.children').
find('li:hidden').
show().
end().
after($kids).

Keybase proof

I hereby claim:

  • I am jcottrell on github.
  • I am jcottrell (https://keybase.io/jcottrell) on keybase.
  • I have a public key whose fingerprint is 1327 7E16 21BB 71AE C8FF 70AA 91BB A621 2504 0A85

To claim this, I am signing this object: