Skip to content

Instantly share code, notes, and snippets.

import Control.Monad
import Data.Char
import Data.Maybe
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
data State = State { code :: [Char], codeIndex :: Int
, memory :: [Int], memIndex :: Int
, input :: [Char], brackets :: Map Int Int }
main = do
print $ map writeNumber [1..100]
writeNumber :: Int -> String
writeNumber n
| n == 0 = ""
| n == 1 = "one"
| n == 2 = "two"
#include <iostream>
using namespace std;
class Node {
private:
bool hasValue_;
int value_;
Node *left_;
Node *right_;
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <streambuf>
using namespace std;
// TODO: Make dataIx a char*
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Student {
public:
string fName_, sName_;
int id_, grade_;
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
bool sortfunc(pair<int, int> p1, pair<int, int> p2){
return pow(p1.first, 2) + pow(p1.second, 2) <
pow(p2.first, 2) + pow(p2.second, 2);
}
#include <iostream>
#include <clocale>
#include <cmath>
#include <ncurses.h>
#include <unistd.h>
#include <vector>
#include <ctime>
#include <cstdlib>
using namespace std;
// As simple of a starting point as I can make for a console game!
// Aka a very stripped down version of my own project.
// Reads console input as arrow keys and wasd,
// and allows you to move a player around the screen.
// To build, save as starting_point.cpp, then build with
// g++ starting_point.cpp -o starting_point -lncurses
$(document).keydown(function(e) {
switch(e.which) {
case 'h': // left
createjs.Sound.play((wordNumber = (wordNumber %5) + 1) + "_1", createjs.Sound.INTERRUPT_NONE, 0, 0, false, 1);
break;
case 'j': // up
createjs.Sound.play((wordNumber = (wordNumber %5) + 1) + "_2", createjs.Sound.INTERRUPT_NONE, 0, 0, false, 1);
break;
// Program to convert to roman numerals.
//
// I'm going to split the number into digits, and call a function to
// convert each one to roman numerals individually.
#include <string>
#include <iostream>
using namespace std;