This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function powerset(input) { | |
let accum = []; | |
// This loop which index in the array you begin pulling from | |
for (let start = 0; start < input.length; ++start) { | |
// This loop determines *how many* elements to add to your accumulator | |
for (let baseLength = 1; start + baseLength <= input.length; ++baseLength) { | |
const base = input.slice(start, start + baseLength); | |
accum.push(base); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
;; Reads the first few lines of a Markdown file. If it begins with Jekyll metadata | |
;; (i.e. ---\nTitle:...\n---) then we parse it, re-write it to Frog metadata, then | |
;; re-write the file. | |
;; Stores date/title. We ignore all other tags (categories, comments, etc.) | |
(struct metadata (title bad-date good-date)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
FILENAME = "this_many_pushes.txt" | |
PUSH_IT_DIR = "/Users/pmeier/Desktop/projects/push_it" | |
command = "git push " | |
ARGV.each { |x| command += x + " " } | |
puts command | |
success = system(command) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
%% Top Level | |
main(Num_Wins) :- | |
open(hands, read, Fb), | |
read(Fb, ListOfHands), | |
play(ListOfHands, Num_Wins). | |
play([],0). | |
play([[Hand1,Hand2]|Rst], Num_Wins) :- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% A question is a [[question number,answer], correctness]. | |
%% Example: | |
%% [[1,a], correct] | |
%% A test is a list of questions. | |
%% We create a rule that every correct answer is 10 points. | |
points([_, correct], 10). points([_, incorrect], 0). | |
%% Create rules flip solutions and whether or not they are incorrect. |