Skip to content

Instantly share code, notes, and snippets.

View horiajurcut's full-sized avatar

Horia Jurcut horiajurcut

View GitHub Profile
#include <iostream>
#include <string>
using String = std::string;
class Entity {
private:
mutable int m_GetCount;
int m_Age;
String m_Name;
@horiajurcut
horiajurcut / hangman.cpp
Created April 15, 2019 13:32
Hangman CPP
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <vector>
const int dictionarySize = 5;
const char* dictionary[dictionarySize] = {
"programming",
"encouragement",
"possibility",
@horiajurcut
horiajurcut / references.rs
Created May 6, 2018 19:44
Rust References
fn main() {
println!("References");
let mut alpha = String::from("hello");
let len = calculate_length(&alpha);
println!("The length of '{}' is {}.", alpha, len);
change(&mut alpha);
class QuickFindUF:
def __init__(self, n):
self.id = []
for i in range(0, n):
self.id.append(i)
def connected(self, p, q):
return self.id[p] == self.id[q]
class QuickFindUF:
def __init__(self, n):
def connected(self, p, q):
def union(self, p, q):
# In the model you decide what to expose
__collections__ = [Bookmark]
# In the Model View base class the relationship is exposed
@route('/<int:entity_id>')
@route('/<int:entity_id>/<string:relationship>')
def get(self, entity_id, relationship=None):
query = self.model.query
from flask.ext.classy import route
class ModelView(BaseView):
@route('/<int:entity_id>')
@route('/<int:entity_id>/<string:relationship>')
def get(self, entity_id, relationship=None):
# Available routes will be:
# http://domain.com/<prefix>/<model_view_subclass>/<id>
# http://domain.com/<prefix>/<model_view_subclass>/<id>/<relationship>
for endpoint in ModelView.__subclasses__():
def relationships(self, id):
print id
for key in endpoint.model.__dict__:
if key.endswith('_id'):
setattr(endpoint, 'related_%s' % (key), types.MethodType(
route(
rule='/<id>/related_%s' % (key),
endpoint='related_%s' % (key),
import json
from functools import wraps
from flask import request
from utils.exceptions import HttpNotFound
from utils.validators import Required
def require(f):
@wraps(f)
from __future__ import absolute_import
from celery import Celery
app = Celery('workers',
broker='amqp://user:pass@localhost:5000/vhost',
include=['workers.tasks'])
app.conf.update(
CELERY_TASK_RESULT_EXPIRES=3600,