Skip to content

Instantly share code, notes, and snippets.

View b-adams's full-sized avatar

Prof. Bryant E Adams b-adams

  • Wells College
  • Aurora NY
View GitHub Profile
@b-adams
b-adams / ProgramADD.pepl
Created July 30, 2012 17:50
CS225 Day 4 notes
-------------------------------------------------------------------------------
Object
Addr code Symbol Mnemon Operand Comment
-------------------------------------------------------------------------------
0000 C1000D LDA 0x000D,d ;Load Num1 to A
0003 C9000F LDX 0x000F,d ;Load Num2 to X (not needed to do next op!)
0006 71000F ADDA 0x000F,d ;Add Num2 to contents of A (leave in A)
0009 E10111 STA 0x0111,d ;store result in Result space
000C 00 STOP
@b-adams
b-adams / program9_starter.pep
Created July 30, 2012 01:21
Main code for Program 9
BR main
;Do not modify code before this point!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN INPUTTO (get user input by reference)
inputTo: nop0 ;pretty input getter
;any equates you need for local variables
;CODE formal parameter #2h
@b-adams
b-adams / 101020-arguments_fail1.pep
Created July 29, 2012 13:10
Example Pep/8 Programs
;Trying to use a global variable to allow function arguments
BR main
usrInput: .BLOCK 2 ;global variable #2d
showChar: NOP0
charo '\n',i
deco usrInput,d
RET0
@b-adams
b-adams / unionSet.m
Created July 11, 2012 03:13
Objective-C test snippets
// unionSet respects counted set counts
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
NSCountedSet* cSet = [NSCountedSet set];
@b-adams
b-adams / ldap_connect.php
Created May 17, 2012 16:16
PHP code for LDap connection
<?php
// using ldap bind
$ldaprdn = 'name'; // ldap rdn or dn
$ldappass = 'pass'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("ldap.server.edu")
or die("Could not connect to LDAP server.");
@b-adams
b-adams / connect.php
Created March 26, 2012 21:32
Turning on PHP display_errors
<?php
ini_set('display_errors', 1);
$db_handle = pg_connect("dbname=CS325_astudent user=astudent password=apassword");
$query = "SELECT * FROM schemaname.tablename";
$result = pg_exec($db_handle, $query);
echo "Number of rows: " . pg_numrows($result);
pg_freeresult($result);
pg_close($db_handle);
?>
@b-adams
b-adams / doxblox.c
Created March 19, 2012 07:05
Documentation and sample output for Linked List program.
//This documentation should be put with the appropriate class/method/function declarations.
//Remember to add file documentation blocks to all your files!
/**
Entry point for the program. Tests that list operations are working.
*/
/**
Represents a node in a singly linked list
*/
@b-adams
b-adams / ComplexFraction.m
Created March 5, 2012 04:24
CS132 Program 3 code
/********************************/
/* WARNING! These are snippets */
/* and NOT the entire code! */
/* You'll need to implement the */
/* designated initializer and */
/* most of the arithmetic. */
/********************************/
-(id) initWithReal:(int)reNum
over:(int)reDen
@b-adams
b-adams / Doxyfile
Created February 17, 2012 17:01
Doxygen file to put in the root of your directory (not in a program_N folder)
# Doxyfile 1.7.4
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
@b-adams
b-adams / samplestub.m
Created February 12, 2012 20:53
Smart stub notification
// TODO: Implement method
#warning Method still a stub
-(double) congratulate:(NSString*)whom manyTimes:(int)n
{
NSLog(@"\n\tStatus=<%@> Class=<%@> Selector=<%@>", @"Stub", NSStringFromClass([self class]), NSStringFromSelector(_cmd));
return NAN;
}
// TODO: Implement method
#warning Method still a stub