Skip to content

Instantly share code, notes, and snippets.

View RickEyre's full-sized avatar
💭
👑 the crown is in the code base

Rick Eyre RickEyre

💭
👑 the crown is in the code base
View GitHub Profile
@RickEyre
RickEyre / TFExample
Created November 22, 2012 19:31
Test Fixture Example
public CueVerticalTest : public testing::Test
{
protected:
virtual void SetUp()
{
}
virtual void SetFile(char * fileName)
{
@RickEyre
RickEyre / NumToString.cpp
Last active January 4, 2016 21:09
Convert Number to String Without Convenience Methods
#include <iostream>
#include <string>
using namespace std;
class NumToString
{
private:
struct Comparator
{
bool operator()(int x, int y) const
@RickEyre
RickEyre / poker.cpp
Created February 16, 2014 03:55
Play some poker.
#include <ctime>
#include <string>
#include <iostream>
#include <vector>
using namespace std;
class Suit
{
private:
@RickEyre
RickEyre / index.html
Created April 22, 2014 13:56
Test Parser
<!DOCTYPE html>
<html>
<head>
<script src="vtt.js"></script>
<script src="parse.js"></script>
</head>
<body>
</body>
</html>
@RickEyre
RickEyre / project.cpp
Last active August 29, 2015 14:02
Lawrence Project
// Implement this class fully, including virtual functions.
class Score {
int mScore;
string mName;
public:
Score(int score, int name);
virtual string getName() const;
virtual int getScore() const;
@RickEyre
RickEyre / json.js
Last active August 29, 2015 14:03
JSON
var obj = JSON.stringify(getMyJson());
console.log(obj.results.geomentry.location);
@RickEyre
RickEyre / angularapp.js
Last active August 29, 2015 14:15
Basic Angular app
// Top level app folder
// app/js/app.js
angular.module('App', [ 'Components' ]);
// Top level components folder
// app/js/components/_module.js
angular.module('Components', [ 'Person' ]);
function UserFactory($http) {
var factory = {};
var users = {};
factory.load = function load() {
// Return promise returned by $http.get
return $http.get('http://localhost:3000/users')
.success(function(data) {
angular.forEach(data, function(item, index) {
users[data.id] = data;
@RickEyre
RickEyre / prototype.js
Created February 25, 2015 16:22
Example of prototype JS
function Foo() {}
Foo.prototype.myState = {};
Foo.prototype.myBehaviour = function() {
console.log('Doing something');
}
foo = new Foo();
console.log(foo.state);
@RickEyre
RickEyre / pubsub.js
Last active August 29, 2015 14:16
Simple Pub Sub
var events = {}
function publish(e, message) {
var subscribers = events[e];
subscribers.map(function(sub) {
sub(message);
});
}
function on(e, cb) {