Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Holmberg mark-d-holmberg

View GitHub Profile
@mark-d-holmberg
mark-d-holmberg / 3310-binary-coins.cpp
Created May 26, 2014
This demonstrates how a binary monetary system is clearly superior to our USD.
View 3310-binary-coins.cpp
/* {{{
**************************
* Mark Holmberg : tiggers.no.tail@gmail.com
* Purpose: calculate the average number of coins needed to make change
* Tue Oct 13 15:46:34 MDT 2009
* CS 3310 : Discrete Math
* }}} */
#include <iostream>
#include <vector>
View Default(OSX).sublime-keymap
[
{ "keys": ["super+shift+down"], "command": "select_lines", "args": {"forward": true} },
]
@mark-d-holmberg
mark-d-holmberg / scraper-copy.sh
Created Sep 11, 2014
Copy files recursively
View scraper-copy.sh
for i in `find . -name "feature-*" -type d`; do
nice=`echo $i | sed 's!^\.\/!\/!g'`;
pushd /Users/mark/Desktop/test$nice;
mv *.html ~/dev/stuff/app/views/feature/;
mv *.js ~/dev/stuff/app/assets/javascripts/;
mv css *.css ~/dev/stuff/app/assets/stylesheets/;
mv *.jpg *.png *.gif ~/dev/stuff/app/assets/images/;
popd;
done
@mark-d-holmberg
mark-d-holmberg / gVim _vimrc
Created Aug 2, 2011
gVim's .vimrc file for Windows.
View gVim _vimrc
nmap <C-V> "+gP
imap <C-V> <ESC><C-V>i
vmap <C-C> "+y
set nu
@mark-d-holmberg
mark-d-holmberg / eq2_prolog.txt
Created Sep 7, 2011
Eight Queens as a List Help (Prolog)
View eq2_prolog.txt
Mark Holmberg, Dixie State College of Utah
CS 3520, Programming Languages
7 Sept. 2011
Some help with 8-queens so you don't have to type as much.
If you want to test your 8-Queens predicate you can NOT write a test predicate
like Russ said. Although it does work, it only returns true or false NOT the
list of the proper queen locations. The following is the test case I used.
@mark-d-holmberg
mark-d-holmberg / mwgc.pl
Created Sep 7, 2011
The Man, The Wolf, The Goat, and The Cabbage
View mwgc.pl
% See the Gist Here
% https://gist.github.com/1201748
change(e,w).
change(w,e).
move([X,X,Goat,Cabbage],wolf,[Y,Y,Goat,Cabbage]) :-
change(X,Y).
move([X,Wolf,X,Cabbage],goat,[Y,Wolf,Y,Cabbage]) :-
change(X,Y).
@mark-d-holmberg
mark-d-holmberg / mwgc_tests.txt
Created Sep 7, 2011
Man, Wolf, Goat, Cabbage Tests
View mwgc_tests.txt
Mark Holmberg, Dixie State College of Utah
CS 3520, Programming Languages
7 Sept. 2011
Some help with the Man, the Wolf, the Goat, and the Cabbage.
Since the solution is given on the site, but not how to invoke a solution
I searched through the slides to come up with this to actually test it
length(X,7), solution([w,w,w,w],X).
@mark-d-holmberg
mark-d-holmberg / sudoku_pretty.rb
Created Sep 9, 2011
How to generate Sudoku boards for the Solver
View sudoku_pretty.rb
# Mark Holmberg, Dixie State College of Utah
# CS 3520, Programming Languages
# 8 Sept. 2011
# http://www.sudoku-solutions.com/
# Purpose: Generate 'unsolved' sudoku puzzles for the sudoku
# solver to solve.
# Step One: Go to the URL above and hit the 'Random' button.
# Step Two: After the board is formed hit the 'Save' button and open the
View assert.prolog
Mark Holmberg, Dixie State College of Utah
CS 3520, Programming Languages
9 Sept. 2011
Some help with the adventure game
% Lets assert some things
assert(bag(key)), assert(bag(candle)), assert(bag(sword)), assert(bag(bow)).
% do we have a candle?
bag(candle).
@mark-d-holmberg
mark-d-holmberg / clojure_quicksort.cjl
Created Sep 12, 2011
Clojure Quicksort and More!
View clojure_quicksort.cjl
//Mark Holmberg tiggers.no.tail@gmail.com
//CS350, Programming Languages
//date: Mon Sep 12 09:33:11 MDT 2011
//Clojure
//http://en.wikipedia.org/wiki/Quicksort
((fn [x] (* x x)) 5)
//calling a function with only one parameter
#(* % %)
You can’t perform that action at this time.