Skip to content

Instantly share code, notes, and snippets.

View pablo-meier's full-sized avatar
🆒
Animal rock band 🎺🐬 🎤🦕 🦉🎸 🎷🐉

Pablo Meier pablo-meier

🆒
Animal rock band 🎺🐬 🎤🦕 🦉🎸 🎷🐉
View GitHub Profile
@pablo-meier
pablo-meier / powerset.js
Created August 5, 2017 15:24
JS powerset, got bored
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);
}
@pablo-meier
pablo-meier / md-cleaner.rkt
Created August 31, 2013 05:31
Considering a move to Frog (https://github.com/greghendershott/frog), and my old Octopress blog has markdown from Jekyll's Blogger migration tool and whatever Jekyll uses. This cleans up the metadata to Frog style.
#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))
#!/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)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Top Level
main(Num_Wins) :-
open(hands, read, Fb),
read(Fb, ListOfHands),
play(ListOfHands, Num_Wins).
play([],0).
play([[Hand1,Hand2]|Rst], Num_Wins) :-
%% 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.