Skip to content

Instantly share code, notes, and snippets.

View AndyNovo's full-sized avatar

Andy Novocin AndyNovo

View GitHub Profile
import sys
import email
import dateutil.parser
import sqlite3
mail = sys.stdin.read()
msg = email.message_from_string(mail)
datetime = dateutil.parser.parse(msg["DATE"])
thedata = {
"subject" : msg["SUBJECT"],
import urllib.request
filename, headers = urllib.request.urlretrieve('http://api.icndb.com/jokes/random')
response = open(filename)
json = eval(response.read())
print(json['value']['joke'])
#My opening explanation
print("""
Welcome to the Green Room. Where you can have
coffee but not tea, a muffin but not cake, and
pet a giraffe but not a cat.
Please ask me about an object and I'll tell you
if it is allowed. Tell me "quit" to stop the game.
You'll have to decide for yourself when you've won.
""")
@AndyNovo
AndyNovo / input.py
Last active September 3, 2015 18:49
birthday = input('What is your birthday (yyyy/mm/dd)? ')
print("You entered:",birthday)
x = 2 * (4 + 12)
y = x + 8
z = y * y
w = "hi"
u = w * 3
print(x,y,z,w,u)
@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;
};
@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 / 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 / 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 / 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}
});