Skip to content

Instantly share code, notes, and snippets.

@nikolaygit
nikolaygit / main_menu
Created September 24, 2013 17:58
Django main menu template
{% load cms_tags menu_tags %}
{# Add to your template with {% show_menu 0 100 0 100 "your_folder/main_menu.html" %} #}
{% spaceless %}
<ul>
{% for child in children %}
<li{% if child.children %} class="has-subnavi"{% endif %}>
<a{% if child.attr.reverse_id %} class="{{ child.attr.reverse_id }}"{% endif %}
href="{{ child.get_absolute_url }}">{{ child.get_menu_title }}</a>
{% if child.children %}
<div class="subnavi">
@nikolaygit
nikolaygit / admin.py
Last active December 25, 2015 02:49
Add additional fields to the Django user profile.
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.db import models
from .models import UserProfile
@nikolaygit
nikolaygit / pagination-previous-next.html
Last active December 25, 2015 12:49
Add previous next pagination. 1) requirements.txt 2) settings.py 3) template.html 4) style.css 5) pagination-previous-next.html Uses Django Endless Pagination: http://django-endless-pagination.readthedocs.org/en/latest/index.html#
{% load endless %}
{% get_pages %}
<div class="pagination-previous-next">
<span class="pagination-previous-next__previous">{{ pages.previous }}</span>
<span class="pagination-previous-next__next">{{ pages.next }}</span>
</div>
@nikolaygit
nikolaygit / README.md
Last active December 25, 2015 15:49
Create bootstrap contact form in Django. Uses cmsplugin-contact and django-widget-tweaks.

Create bootstrap contact form in Django. Uses cmsplugin-contact and django-widget-tweaks.

@nikolaygit
nikolaygit / models.py
Created October 16, 2013 15:14
Django Model Choices
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
class YourModel(models.Model):
CATEGORY_CHOICES = (
('id1', _('Your Text 1')),
{% load url from future %}
{% block content %}
<p>You are logged in as {{ user.username }}!</p>
{% endblock %}
@nikolaygit
nikolaygit / geolocation.js
Created November 18, 2013 12:32
geolocation.js - get latitude and longitude
/* Modernizr 2.6.3 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-geolocation
*/
;window.Modernizr=function(a,b,c){function t(a){i.cssText=a}function u(a,b){return t(prefixes.join(a+";")+(b||""))}function v(a,b){return typeof a===b}function w(a,b){return!!~(""+a).indexOf(b)}function x(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:v(f,"function")?f.bind(d||b):f}return!1}var d="2.6.3",e={},f=b.documentElement,g="modernizr",h=b.createElement(g),i=h.style,j,k={}.toString,l={},m={},n={},o=[],p=o.slice,q,r={}.hasOwnProperty,s;!v(r,"undefined")&&!v(r.call,"undefined")?s=function(a,b){return r.call(a,b)}:s=function(a,b){return b in a&&v(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=p.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(p.call(arguments)));return Object(g)===g?g:f}retur
@nikolaygit
nikolaygit / requests.py
Created November 20, 2013 17:49
Always defined the Content-Type header: http://docs.python-requests.org/en/latest/index.html
headers = {'Content-type': 'application/json', 'Accept-Charset': 'UTF-8', 'Accept': 'application/json'}
result = requests.post(URL, data=json.dumps(payload), headers=headers, auth=(USER, PASS))
@nikolaygit
nikolaygit / Gruntfile.js
Created April 28, 2014 08:35
Wordpress Theme Translation
'use strict';
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
var base = 'static';
// Project configuration.

10.10.2014

Nikolay:

  • created an ECG GitHub account. The idea is to have all open source ECG software projects in this organizational account. If you know anyone within the ECG movement who would like to participate, please let him contact Nikolay.
  • refactored and improved the quick test: http://ecogood.github.io/ecg-quicktest-app/#/
    • New features: you can navigate between the questions and see at the same time a progress bar.
    • New modular and decoupled software architecture
    • Added automated tests for the whole quick test.
      • Found an incorrect calculation in the 1.2 PDF version: the maximum points are not 126 but 128. Concretely, for a company 128 and for self-employed 122 points.
  • It would be very productive, if the creators of the future quick tests communicate test cases with the software developers, because the develo