Skip to content

Instantly share code, notes, and snippets.

View ZachMassia's full-sized avatar

Zach Massia ZachMassia

  • MacEwen Petroleum Inc.
  • Ontario, Canada
View GitHub Profile
int ExampleRunner::ex4_2_3()
{
using namespace std;
vector<StudentInfo> students;
StudentInfo record;
string::size_type maxlen = 0;
// Read and store all the records, and find the length of the longets name
while (read(cin, record)) {
maxlen = max(maxlen, record.name.size());
@ZachMassia
ZachMassia / ex5_10.cpp
Created August 17, 2012 04:43
Accelerated C++ Exercise 5-10
int ExerciseRunner::ex5_10()
{
// Write a program to find all the palindromes in a dictionary.
// Next find the longest one.
typedef std::vector<std::string> str_vec;
str_vec palindromes;
str_vec dict = {"civic", // x
"hello",
"zachary"
"deleveled",// x
@ZachMassia
ZachMassia / main.go
Created October 18, 2012 21:09
Golang Perfect Numbers
package main
import (
"fmt"
)
func isPerfect(num uint64) {
sum := calcDiv(num)
if sum == num {
fmt.Println(num)
@ZachMassia
ZachMassia / gist:3925452
Created October 21, 2012 02:00
Perfect Number Error
throw: all goroutines are asleep - deadlock!
goroutine 1 [select]:
main.main()
/home/zachary/Dev/Go/perfect_numbers/main.go:31 +0x26f
goroutine 2 [syscall]:
created by runtime.main
/build/buildd/golang-1/src/pkg/runtime/proc.c:221
exit status 2
@ZachMassia
ZachMassia / gist:3929846
Created October 22, 2012 05:32
No global
g_list = [1, 2, 3]
class Test:
def testing(self):
print g_list
a = Test()
a.testing()
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: unrecognized option: -f
at OptionParser.parse (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/optparse.js:50:19)
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:463:29
at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:53:5)
at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/bin/coffee:7:41)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
Error: Forbidden
at Object.error (/home/zachary/node_modules/connect/lib/utils.js:43:13)
at Object.directory [as handle] (/home/zachary/node_modules/connect/lib/middleware/directory.js:73:52)
at next (/home/zachary/node_modules/connect/lib/proto.js:190:15)
at Function.handle (/home/zachary/node_modules/connect/lib/proto.js:198:3)
at Server.app (/home/zachary/node_modules/connect/lib/connect.js:66:31)
at Server.emit (events.js:70:17)
at HTTPParser.onIncoming (http.js:1610:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
at Socket.ondata (http.js:1506:22)
@ZachMassia
ZachMassia / gist:4035388
Created November 7, 2012 23:36
melonJS error
Browser error:
Uncaught TypeError: object is not a function melonJS-0.9.5.js:411
Object.extend melonJS-0.9.5.js:411
obj.newInstanceOf melonJS-0.9.5.js:4960
api.addEntity melonJS-0.9.5.js:1326
api.loadTMXLevel melonJS-0.9.5.js:1273
obj.loadLevel melonJS-0.9.5.js:11212
me.ScreenObject.extend.onResetEvent main.js:64
me.ScreenObject.Object.extend.reset melonJS-0.9.5.js:1801
@ZachMassia
ZachMassia / Error
Created November 9, 2012 01:56
Parent Dir JS
melonJS: 'tiles/Cliff_tileset_0.png' file for tileset 'Cliff_tileset_0' not found! melonJS-0.9.5.js:9303
melonJS: 'tiles/graphics-tiles-waterflow.png' file for tileset 'graphics-tiles-waterflow' not found! melonJS-0.9.5.js:9303
melonJS: 'tiles/desert_1_0_6.png' file for tileset 'desert_1_0_6' not found! melonJS-0.9.5.js:9303
melonJS: 'tiles/ground_tiles.png' file for tileset 'ground_tiles' not found! melonJS-0.9.5.js:9303
melonJS: 'tiles/object- layer_1.png' file for tileset 'object- layer_1' not found! melonJS-0.9.5.js:9303
melonJS: '../metatiles32x32.png' file for tileset 'metatiles32x32' not found! melonJS-0.9.5.js:9303
// Bounds check
if(posX < 0)
posX = 0;
else if(posX > (screenW - boundX))
posX = screenW - boundX;
if(posY < 0)
posY = 0;
else if(posY > (screenH - boundY))
posY = screenH - boundY;