Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
@AndyNovo
AndyNovo / gist:54316619049dae6ab3c8
Created June 27, 2014 01:54
Print ASCII 0 in Brainf..k
+++++ +++++ ++ > ++++ < [->[->+>+<<]>>[-<<+>>]<<<]>>.
@AndyNovo
AndyNovo / gist:24649188ab110ff1a5fd
Created June 27, 2014 02:16
Abstract Backbone Collection View
//This uses requirejs style definition
//require this file as a class and extend to make a collection view
define(
function(){
//This is a generic collection view,
//overwrite as you see fit
//viewOptions, ModelView, template should all change
return Backbone.View.extend({
startListeners : function(){
@AndyNovo
AndyNovo / mongooseCRUD.js
Created July 9, 2015 04:44
To play with mongoose and mongo in CISC437
var mongoose = require('mongoose');
var db = mongoose.connection;
db.on('error', console.error);
db.once('open', function(){
var studSchema = new mongoose.Schema({
name: String
}, { strict: false });
var Student = mongoose.model('Student', studSchema, 'student');
@AndyNovo
AndyNovo / generic.js
Created July 14, 2015 12:35
Mongoose API for any project
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/generic');
var genericSchema = new mongoose.Schema({}, { strict: false });
var createDoc = function(document, collection, callback){
var Model = mongoose.model('Model', genericSchema, collection);
Model.create(document, function(err, document){
if(!err){
callback(document);
@AndyNovo
AndyNovo / schema.js
Last active August 29, 2015 14:24
Simple Mongoose Schema
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/schematest');
var animalSchema = new mongoose.Schema({
type: {type: String, required: true},
age: Number,
lastInspected: {type: Date, default: Date.now},
name: {type: String, required: false}
});
@AndyNovo
AndyNovo / popuate.js
Created July 14, 2015 17:19
Stolen Example of Mongoose Populate
var mongoose = require('mongoose')
, Schema = mongoose.Schema
var personSchema = Schema({
_id : Number,
name : String,
age : Number,
stories : [{ type: Schema.Types.ObjectId, ref: 'Story' }]
});
@AndyNovo
AndyNovo / README.md
Last active August 28, 2015 15:08 — forked from phatak-dev/README.md
Functional Programming in C++

#Compilng You need g++ 4.9 to compile this code. Follow these steps to install g++-4.9

After installing run the following command to compile

/usr/bin/g++-4.9 -std=c++11 lambda.cpp

#Running

./a.out
@AndyNovo
AndyNovo / convo.cpp
Last active April 4, 2021 00:50
A simple function example
#include<iostream>
using namespace std;
string prompt_user(string input_prompt){
string reply;
cout << input_prompt << endl;
cin >> reply; //only use one of these two lines.
//getline(cin, reply);
return reply;
};
@AndyNovo
AndyNovo / nonStdConvo.cpp
Created August 31, 2015 23:42
Simple prompt, but without using standard namespace.
#include<iostream>
std::string prompt_user(std::string input_prompt){
std::string reply;
std::cout << input_prompt << std::endl;
//std::getline(std::cin, reply);
std::cin >> reply;
return reply;
};
x = 2 * (4 + 12)
y = x + 8
z = y * y
w = "hi"
u = w * 3
print(x,y,z,w,u)