Skip to content

Instantly share code, notes, and snippets.

Gergo Bogdan gergob

  • @Accedo.tv
  • Budapest
Block or report user

Report or block gergob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.py
from projects_repository import ProjectsRepository
from project import Project
def load_all_items_from_database(repository):
print("Loading all items from database:")
projects = repository.read()
at_least_one_item = False
for p in projects:
at_least_one_item = True
View project.py
from bson.objectid import ObjectId
class Project(object):
"""A class for storing Project related information"""
def __init__(self, project_id=None, title=None, description=None, price=0.0, assigned_to=None):
if project_id is None:
self._id = ObjectId()
else:
self._id = project_id
View projects_repository.py
from pymongo import MongoClient
from bson.objectid import ObjectId
from project import Project
class ProjectsRepository(object):
""" Repository implementing CRUD operations on projects collection in MongoDB """
def __init__(self):
# initializing the MongoClient, this helps to
# access the MongoDB databases and collections
@gergob
gergob / hello2.html
Created Oct 23, 2013
FLOSSzine - Programozás Kezdőkenk - Bevezető - Hello Világ!
View hello2.html
<!DOCTYPE html>
<html>
<!-- HTML dokumentum fej része -->
<head>
<!-- Erre azért van szükség, hogy a böngésző meg tudja jeleníteni az ékezetes magyar betüket -->
<meta charset="utf-8">
<!-- Hivatkozunk a hello_vilag2.js kódfájlra -->
<script src="hello_vilag2.js" type="text/javascript"></script>
</head>
@gergob
gergob / hello_vilag2.js
Created Oct 23, 2013
FLOSSzine - Programozás Kezdőkenk - Bevezető - Hello Világ!
View hello_vilag2.js
console.log("Hello Világ");
@gergob
gergob / hello.html
Created Oct 23, 2013
FLOSSzine - Programozás Kezdőkenk - Bevezető - Hello Világ!
View hello.html
<!-- HTML fájlokba ezen jelek közzé lehet kommentárokat tenni -->
<!DOCTYPE html>
<html>
<!-- HTML dokumentum fej része -->
<head>
<!-- Erre azért van szükség, hogy a böngésző meg tudja jeleníteni az ékezetes magyar betüket -->
<meta charset="utf-8">
<!-- Hivatkozunk az előzőekben megírt JavaScript kódfájlunkra -->
<script src="hello_vilag.js" type="text/javascript"></script>
@gergob
gergob / hello_vilag.js
Created Oct 23, 2013
FLOSSzine - Programozás Kezdőkenk - Bevezető - Hello Világ!
View hello_vilag.js
//minden szöveg, amelyet // előz meg,
//illetve /* ... */ jelek közzé teszünk
//a JavaScript kommentként kezeli és figyelmen kívül hagyja
alert("Hello Világ!");
@gergob
gergob / fstat.js
Created Jul 26, 2013
contains the node.js fstat methods
View fstat.js
//
// Method names taken from: http://nodejs.org/api/fs.html#fs_class_fs_stats
//
//stats is the return value if fs.statsync(PATH_TO_FILE) method
stats.isFile();
stats.isDirectory();
stats.isBlockDevice();
stats.isCharacterDevice();
stats.isSymbolicLink(); //(only valid with fs.lstat())
@gergob
gergob / wc.js
Created Jul 26, 2013
Contains the implementation of the wc linux command using node.js
View wc.js
#!/usr/bin/env node
/*
This small node.js app should do exactly what the wc linux command does.
Quote from man wc:
Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified. With no FILE, or when FILE is -, read standard
input. A word is a non-zero-length sequence of characters delimited by white space. The options below may be used to select which counts are printed,
always in the following order: newline, word, character, byte, maximum line length.
@gergob
gergob / yes.js
Created Jul 18, 2013
Contains the implementation of linux's yes command.
View yes.js
#!/usr/bin/env node
/*
This small node.js app should do exactly what the yes linux command does.
Quote from man yes:
Repeatedly output a line with all specified STRING(s), or `y'.
*/
You can’t perform that action at this time.