Skip to content

Instantly share code, notes, and snippets.

View jathak's full-sized avatar

Jennifer Thakar jathak

View GitHub Profile
@jathak
jathak / input.scss
Created January 25, 2021 21:48
Generated by SassMeister.com.
@use "sass:string";
@use "sass:color";
@function hex-digit($char) {
$char: string.to-lower-case($char);
@return if($char == "0", 0,
if($char == "1", 1,
if($char == "2", 2,
if($char == "3", 3,

Keybase proof

I hereby claim:

  • I am jathak on github.
  • I am jathak (https://keybase.io/jathak) on keybase.
  • I have a public key ASD14x4YxarKk0t1MaSPSmVPLvStExBXcQzr79T_BJ0N0Qo

To claim this, I am signing this object:

; Adapted from John DeNero's NLP lecture from Python to Logic
; Run at logic.cs61a.org
; Helpers
(fact (append () ?lst ?lst))
(fact (append (?f . ?r) ?x (?f . ?s))
(append ?r ?x ?s))
; Types of Leaves
(fact (leaf N))
; Treat these four procedures as black boxes. You don't need to
; understand how they work.
(define (display-test code actual expected)
(define passed (equal? actual expected))
(display code) (display " -> ") (display actual)
(if passed
(display " PASS")
(begin
(display " FAIL - expected ")
(display expected)))
@jathak
jathak / testing.scm
Created July 16, 2018 21:02
Macros to add doctest-style tests to Scheme
(define-macro (test . tests)
`(reduce (lambda (a b) (cons (+ (car a) (car b))
(+ (cdr a) (cdr b))))
(map (lambda (test)
(define expr (car test))
(define expect (car (cdr test)))
(define actual (eval expr))
(display expr)
(display " -> ")
(display actual)
@jathak
jathak / csv_to_prolog.py
Last active November 27, 2018 10:48
Converts a CSV of availabilities into Prolog code that can make assignments
# csv_to_prolog.py
#
# Takes a CSV from stdin in the following format:
# <Any>, Time1, Time2, Time3, Time4...
# counts, 2, 3, 4, 5... (number of spots for each time)
# Person1, Yes, Maybe, Yes, No... (Yes, Maybe, or No for availability)
# Person2, Yes, Maybe, Yes, No...
#
# and outputs Prolog to do assignments.
#
/* CS 61A Sp18 Grade Calculation Script */
/* Run in JS console at https://okpy.org/cal/cs61a/sp18 */
GRADES = ['F', 'D-', 'D', 'D+', 'C-', 'C', 'C+', 'B-', 'B', 'B+', 'A-', 'A', 'A+'];
BUCKETS = [0, 165, 170, 175, 180, 190, 200, 210, 230, 250, 270, 285, 298];
function log() {
document.querySelector('#log').innerHTML += [].slice.call(arguments).join('') + '\n';
}