Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View eeriksp's full-sized avatar

Eerik Sven Puudist eeriksp

View GitHub Profile
# TÖÖJAAM
# See eelsätetefail on loodud toetudes dokumentatsioonile:
# https://help.ubuntu.com/lts/installation-guide/amd64/apbs04.html
# Kuna tegemist on “Töölaua” versiooniga, siis kasutan debian-installer käske ubiquity formaadis. Ubiquity on live-paigaldus keskkond.
# Kettajagude loomine
# Esimese SCSI/SATA ketta kasutamise valimine
ubiquity partman-auto/disk string /dev/sda
# Kettajagude loomise meetodi valimine. Variandid kas “regular” , “lvm” või “crypto”. Viimasel kahel juhul kasutatakse LVM kettajagude süsteemi. Viimasel juhul kasutatakse ka krüpteeringut.
ubiquity partman-auto/method string regular
from factoryman import create_populated_modelfactory
ProjectFactory = create_populated_modelfactory(Project)
ExpiredProjectFactory = create_populated_modelfactory(Project, deadline='1999-04-04')
from factory.django import DjangoModelFactory as ModelFactory
class ProjectFactory(ModelFactory):
class Meta:
model = Project
director = factory.SubFactory(VolunteerFactory) # Creates dependency
warehouse = factory.Sequence(lambda n: f'Project__name-{n}') # Guarantees uniqueness
deadline = factory.LazyFunction(datetime.date.today)
def project_factory(director, name='Project__name', deadline=datetime.date.today()):
return Project.objects.create(
director=director,
name=name,
deadline=deadline
)
class Charity(models.Model):
name = models.CharField(max_length=50, unique=True)
webpage = models.URLField(unique=True)
def __str__(self):
return self.name
class Volunteer(models.Model):
charity = models.ForeignKey(Charity, on_delete=models.PROTECT)
@eeriksp
eeriksp / tests.py
Last active July 13, 2018 12:09
A TestCase for Django admin, witch checks whether all admin pages work.
import re
from django.test import TestCase, Client
from django.contrib.auth.models import User
LINK_PATTERN = re.compile(r'<a href="(/admin/[^ ]+)"')
class TestDjangoAdmin(TestCase):
@eeriksp
eeriksp / proxyTable-conf
Last active May 5, 2018 15:52
Vue proxyTable configuration to allow access to Django backend development server in development mode
proxyTable: {
'/api': {
target: 'http://127.0.0.1:8000',
changeOrigin: true
},
'/haldus': {
target: 'http://127.0.0.1:8000',
changeOrigin: true
},
'/static': {
@eeriksp
eeriksp / gist:7c492baf80cf563a3d488ee6574940b9
Created May 5, 2018 15:46
Vue proxyTable configuration to allow access to Django backend development server in development mode
proxyTable: {
'/api': {
target: 'http://127.0.0.1:8000',
changeOrigin: true
},
'/haldus': {
target: 'http://127.0.0.1:8000',
changeOrigin: true
},
'/static': {
@eeriksp
eeriksp / vue-html.json
Last active January 17, 2018 21:31
This code provides Vuetify.js support for Visual Studio Code. To use it, open File > Preferences > User Snippets and choose language vue-html.
{
"Complete v-flex": { "prefix": "flex", "body": ["<v-flex>$0</v-flex>"], "description": "complete <v-flex>" },
"Complete v-avatar": { "prefix": "avatar", "body": ["<v-avatar>$0</v-avatar>"], "description": "complete <v-avatar>" },
"Complete v-badge": { "prefix": "badge", "body": ["<v-badge>$0</v-badge>"], "description": "complete <v-badge>" },
"Complete v-breadcrumbs": { "prefix": "breadcrumbs", "body": ["<v-breadcrumbs>$0</v-breadcrumbs>"], "description": "complete <v-breadcrumbs>" },
"Complete v-breadcrumbs-item": { "prefix": "breadcrumbs-item", "body": ["<v-breadcrumbs-item>$0</v-breadcrumbs-item>"], "description": "complete <v-breadcrumbs-item>" },
@eeriksp
eeriksp / vue-html.json
Created January 17, 2018 21:24
This code provides Veutify.js support for Visual Studio Code.
{
/*
// Place your snippets for Vue-html here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [