Skip to content

Instantly share code, notes, and snippets.

View davepagurek's full-sized avatar

Dave Pagurek davepagurek

View GitHub Profile
@davepagurek
davepagurek / openletter.md
Last active October 2, 2017 16:23
An open letter to CS247.

Open Letter to CS247

The past two assignments in this course have had what I feel to be significant issues that impede learning. I disagree with the philosophy behind the assignments' design decisions, and I feel like my opinions need to be voiced in order to help improve the quality of the course and, by extension, our education.

Counter-productive requirements

For a course about learning good C++ design, the decision to disallow all of STL, templating, arrays, and multiple files confuses me. The first assignment requires the creation of multiple container types, many of which can have very similar implementations. We are marked on not repeating ourselves, so every student completing this assignment needs to refactor their collections into some sort of heirarchy to achieve this and avoid simply copy-and-pasting code. There are a few ways to do this without using the tools we are restricted from using, and all of them lead to poor C++ code:

  • Void pointer casting: One can make a generic container c
@davepagurek
davepagurek / .gitignore
Created April 7, 2016 17:39
Xcode .gitignore sample
.DS_Store
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
1. initially all registers are set to 0x0 except
$1 = 3
$2 = 1
$31 = something
what registers have changed (from beginning to end)
DIV(2,1) ; sets lo,hi = (1/3),1%3 = 0,1
ADD(0,1,1) ; $0 = $1 + $1, but this doesn't do anything ($0 stays 0)
SUB(3,1,2) ; $3 = $1 - $2, so $3 = 2
This line of actionscript:
swivelJob.duration = RecordingDuration.frameRange(2, swivelJob.duration.params[1]);
...is this in bytecode:
getlocal0
pushscope
findpropstrict swivelJob //nameIndex = 7
getproperty swivelJob //nameIndex = 7
findpropstrict RecordingDuration //nameIndex = 9
getproperty RecordingDuration //nameIndex = 9
@davepagurek
davepagurek / query.php
Created June 29, 2015 22:12
PDO example
$DBH = new PDO("mysql:host=$host;dbname=$database", $username, $password);
$DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$STH=$DBH->prepare("SELECT * FROM jokes WHERE id=:joke");
$STH->setFetchMode(PDO::FETCH_ASSOC);
$STH->execute(array(":joke" => $joke));
$result = $STH->fetchAll();
@davepagurek
davepagurek / scraper.pl
Created June 23, 2015 23:38
Get NATA entry info
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
use URI;
use Web::Scraper;
use Encode;
use Data::Dumper;
//Module to communicate between background and app scripts
var Messenger = (function() {
var m = {};
var responses = {};
m.current = chrome.runtime.id;
m.extension = "hkgihfhfbmabgamjpbgkkdjcmicmheap";
m.app = "neoalcniaoimlmhmibbccponldlhnnee";
@davepagurek
davepagurek / Expression-Calculator.markdown
Created September 15, 2013 16:54
A Pen by Dave Pagurek.

Expression Calculator

Parses a string and evaluates the expression. I didn't realize how hard doing this actually was.

A Pen by Dave Pagurek on CodePen.

License.