Kod HTML/CSS napisany w poprawny sposób powinnien być:
- semantyczny
- zorientowany na komponenty
- łatwy w modyfikacji
| #! /usr/bin/env python3 | |
| import os | |
| import sys | |
| import subprocess | |
| if len(sys.argv) == 1: | |
| files = os.listdir('.') | |
| else: | |
| files = sys.argv[1:] |
| import os | |
| from fabric.api import run, cd, env, abort | |
| from fabric.contrib.console import confirm | |
| from fabric.context_managers import prefix | |
| from fabric.tasks import Task | |
| env.hosts = ['[email protected]'] | |
| env.settings = ['staging', 'production'] |
| class UserFactory(factory.Factory): | |
| password = 'test' | |
| @classmethod | |
| def _prepare(cls, create, **kwargs): | |
| password = kwargs.pop('password', None) | |
| user = super(UserFactory, cls)._prepare(create, **kwargs) | |
| if password: | |
| user.raw_password = password | |
| user.set_password(password) |
| from fabric.contrib import files | |
| def append(): | |
| files.append( '~/append_test', ['line']) | |
| files.append( '~/append test with space', ['line']) | |
| def exists(): | |
| print(files.exists('~/exists_test')) | |
| print(files.exists('~/exists test with space')) |
| from django.views.generic import View | |
| from django.core.exceptions import ImproperlyConfigured | |
| from django.contrib.auth.views import login | |
| class WrapperView(View): | |
| @property | |
| def view_function(self): | |
| raise ImproperlyConfigured("You must define a 'view_function'.") |
| def refresh(instance): | |
| return instance.__class__._default_manager.get(pk=instance.pk) |
| def view_example(request): | |
| print(request) | |
| class ViewTestCase(object): | |
| view_function = view_example | |
| def __init__(self): | |
| self.view = self.__class__.__dict__['view_function'] | |
| var LICENSE = 'License: For reuse of this video under a more permissive license please get in touch with us. The speakers retain the copyright for their performances.'; | |
| var WEBSITE = 'http://summit.pywaw.org'; | |
| var result = []; | |
| $(".speaker-modal").each(function() { | |
| var $speakerModal = $(this); | |
| var $talkDetails = $speakerModal.find('.speaker-modal__talk-title'); | |
| var speakerName = $speakerModal.find('.speaker-modal__name').text(); | |
| var speakerBio = $speakerModal.find('p:not(.speaker-modal__twitter)').first().text(); | |
| var mixedTalksDescription = $speakerModal.find('p:not(.speaker-modal__twitter)').slice(1).text(); |
| # return double of first number from collection which is greater than 3 and even | |
| # this is Python 3 srcipt, in Python 2 you have to use itertools.imap and itertools.ifilter | |
| def is_gt_3(number): | |
| print('is_gt_3 called...') | |
| return number > 3 | |
| def is_even(number): | |
| print('is_even called...') | |
| return number % 2 == 0 |