Skip to content

Instantly share code, notes, and snippets.

Avatar

Joshua Cottrell jcottrell

  • The Southern Baptist Theological Seminary
  • Louisville, KY
View GitHub Profile
@jcottrell
jcottrell / docker-compose.yml
Last active Jul 13, 2022
Minecraft Bedrock on home wifi
View docker-compose.yml
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 Feb 24, 2021
Fake database for ajax testing
View events.json
[
{
"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 Jul 10, 2019
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!`
View encode.hs
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 Jun 4, 2019
Lambda Calculus in Javascript: Two Lectures by Gabriel Lebec (glebec); notes by jcottrell
View index.js
// 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)
View COFFEE-voter.js
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 Mar 23, 2017
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.
View unique-array-from-object-array.js
/* 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 / jquery-boyce-nav.js
Last active Aug 16, 2016
Using detach to fix View All in navigation
View jquery-boyce-nav.js
var viewAll1 = function (e) {
e.preventDefault();
$me = $(this);
$kids = $me.parent().find('.children').detach();
$me.closest('.children').
find('li:hidden').
show().
end().
after($kids).
View keybase.md

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:

@jcottrell
jcottrell / forticlient-helper.sh
Created Jun 20, 2016
Run FortiClient on MacOSX and then run El Capitan repair script
View forticlient-helper.sh
#!/bin/bash
sudo echo "Starting FortiClient ..."
/Applications/FortiClient.app/Contents/MacOS/FortiClient > /dev/null 2>&1 &
secs=30
while [ $secs -gt 0 ]; do
echo -ne "Waiting for you to log into FortiClient: $secs\033[0K\r"
sleep 1
: $((secs--))
done
echo ""
View Functional Friend Messenger.markdown