Skip to content

Instantly share code, notes, and snippets.

@pmsanford
pmsanford / override.cs
Created July 25, 2012 08:36
Demonstrate the difference between method hiding and overriding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MethodHiding
{
class Program
{
@pmsanford
pmsanford / cmdloop.sic
Created March 3, 2013 08:50
A program that tests if two strings in memory are equal and prints whether or not to the terminal.
. PRNTST
. Output a null-terminated string to the console.
. Args:
. 1. Address of output string, WORD
. 2. Max Length, WORD
. 3. Device ID, BYTE
PRNTST START
STS BASADD
LDA @BASADD
STA STROUT
@pmsanford
pmsanford / test_colors.rs
Created November 6, 2014 19:10
A small file to test if you can change colors in your terminal.
extern crate ncurses;
use ncurses as nc;
fn main() {
nc::initscr();
nc::start_color();
if nc::can_change_color() {
nc::printw("Can change! :)");
}
@pmsanford
pmsanford / colors.py
Created November 6, 2014 19:16
A small python file to display all curses-supported colors on your terminal.
import curses
def main(stdscr):
curses.start_color()
curses.use_default_colors()
for i in range(0, curses.COLORS):
curses.init_pair(i+1, i, -1)
colorno = 0
trait Fooable { fn foo(&mut self); }
trait Barable { fn bar(&mut self); }
struct StructA;
struct StructB;
impl Fooable for StructA { fn foo(&mut self) {} }
impl Barable for StructA { fn bar(&mut self) {} }
impl Fooable for StructB { fn foo(&mut self) {} }
#![feature(globs)]
extern crate ncurses;
use ncurses::*;
fn main()
{
initscr();
use std::os;
use std::io::fs;
use std::io::fs::PathExtensions;
const LIB_PATH_REL: &'static str = "../libs/libtcod";
fn main() {
let out_dir = os::getenv("OUT_DIR").unwrap();
let dst = Path::new(out_dir.clone());
let src = Path::new(LIB_PATH_REL);
~/dev $ mkdir sandbox
~/dev $ cd sandbox
~/dev/sandbox $ virtualenv --python=python3 venv
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix '/usr/local/Cellar/python3/3.4.0_1/Frameworks/Python.framework/Versions/3.4'
New python executable in venv/bin/python3.4
Also creating executable in venv/bin/python
Installing setuptools, pip...done.
~/dev/sandbox $ source venv/bin/activate
(venv)~/dev/sandbox $ pip install pandas
@pmsanford
pmsanford / makefile-osx
Created December 18, 2014 19:48
OSX libtcod makefile
# libtcod makefile
# to build debug version, run "make -f makefile-linux debug"
# to build release version, run "make -f makefile-linux release"
SRCDIR=src
INCDIR=include
#dependencies
# SDL
SDL_FLAGS=`sdl-config --cflags`
SDL_LIBS=`sdl-config --libs`
extern crate syntax;
extern crate rustc;
use syntax::diagnostic::SpanHandler;
use syntax::codemap::Span;
use syntax::ast::{Item, Item_};
struct StructPkg {
pub name: String,
pub def: Item,
pub impls: Vec<Item>