This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MIT License | |
| Copyright (c) 2026 Lap Logic Garage | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <string> | |
| using String = std::string; | |
| class Entity { | |
| private: | |
| mutable int m_GetCount; | |
| int m_Age; | |
| String m_Name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #include <vector> | |
| const int dictionarySize = 5; | |
| const char* dictionary[dictionarySize] = { | |
| "programming", | |
| "encouragement", | |
| "possibility", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class QuickFindUF: | |
| def __init__(self, n): | |
| def connected(self, p, q): | |
| def union(self, p, q): | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
NewerOlder