Skip to content

Instantly share code, notes, and snippets.

Avatar

Dimitar Dimitrov dimitrov

View GitHub Profile
View salesorder.json
{
"TxnID": "667B-1055542407",
"TimeCreated": "2003-06-13T15:13:27-08:00",
"TimeModified": "2019-12-14T11:35:28-08:00",
"EditSequence": "1576351936",
"TxnNumber": "1276",
"CustomerRef": {
"ListID": "6D0000-1046201334",
"FullName": "Pete Harbin Contractor:Oak Street"
},
View _pagination.html
<nav>
<ul class="pagination pull-right">
<li {% if not page_obj.has_previous %}class="disabled"{% endif %}>
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
{% else %}
<a href="#" aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
{% endif %}
@dimitrov
dimitrov / messages.html
Created Apr 26, 2015
Bootstrap Alerts for Django
View messages.html
{% if messages %}
{% for message in messages %}
<div class="alert alert-{{ message.tags }} alert-dismissible text-center" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}Error{% else %}{{ message.tags|title }}{% endif %}!</strong> {{ message }}
</div>
{% endfor %}
{% endif %}
@dimitrov
dimitrov / Gruntfile.js
Last active Aug 29, 2015
grunt-sass + grunt-contrib-watch
View Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'styles/css/widgets.css': 'styles/sass/widgets.scss'
@dimitrov
dimitrov / Mapping Script
Created Mar 9, 2015
Jenkins Warnings Plugin mapping script for flake8
View Mapping Script
import hudson.plugins.warnings.parser.Warning
import hudson.plugins.analysis.util.model.Priority
String fileName = matcher.group(1)
String type = matcher.group(4)
String lineNumber = matcher.group(2)
String message = matcher.group(5)
String typeCategory = String.valueOf(type.charAt(0));
String category
Priority priority = Priority.NORMAL
View build.sh
#!/usr/bin/env bash
pip install -r requirements-dev.txt
python manage.py migrate
coverage run manage.py test
coverage xml
flake8 --ignore=E121,E123,E124,E125,E126,E127,E128,E501,E402 --exit-zero <package>
View gist:d96d3b303fcff87eb2cb
Django - 1.5.4 - active
Fabric - 1.5.3 - active
GeoIP - 1.2.9 - active
Hoover - 0.6.0 - active
Pillow - 2.0.0 - active
Python - 2.7.3 - active development (/usr/lib/python2.7/lib-dynload)
South - 0.8 - active
Unidecode - 0.04.14 - active
amqp - 1.0.11 - active
anyjson - 0.3.3 - active
View gist:c6b0b3afab6f758aac0a
Django 1.6.5 has no metadata
Fabric - 1.5.3 - active
PIL - 1.1.7 - active
Pillow - 2.0.0 - active
PyYAML - 3.11 - active
Python - 2.7.6 - active development (/usr/lib/python2.7/lib-dynload)
South - 0.7.6 - active
Unidecode - 0.04.14 - active
argh - 0.24.1 - active
argparse - 1.2.1 - active development (/usr/lib/python2.7)
View watch.py
#!/usr/bin/env python
import os
import time
import logging
import subprocess
from watchdog.observers import Observer
from watchdog.events import (
PatternMatchingEventHandler, EVENT_TYPE_MODIFIED, EVENT_TYPE_MOVED,
@dimitrov
dimitrov / Preferences.sublime-settings
Last active Aug 29, 2015
Preferences.sublime-settings
View Preferences.sublime-settings
{
"auto_complete_triggers":
[
{
"characters": ".",
"selector": "source.python"
}
],
"close_windows_when_empty": false,
"color_scheme": "Packages/User/Tomorrow-Night (SL).tmTheme",