Skip to content

Instantly share code, notes, and snippets.

View dimitrov's full-sized avatar

Dimitar Dimitrov dimitrov

View GitHub Profile
@dimitrov
dimitrov / gist:11290347
Created April 25, 2014 13:53
django-rosetta - Gunicorn auto reload
import os
from django.dispatch import receiver
from rosetta.signals import post_save
@receiver(post_save)
def restart_server(sender, **kwargs):
os.system('supervisorctl pid <gunicorn process> | xargs kill -HUP')
import os
from django.dispatch import receiver
from rosetta.signals import post_save
@receiver(post_save)
def restart_server(sender, **kwargs):
os.system('initctl reload <myapp>')
@dimitrov
dimitrov / Preferences.sublime-settings
Last active August 29, 2015 14:03
Preferences.sublime-settings
{
"auto_complete_triggers":
[
{
"characters": ".",
"selector": "source.python"
}
],
"close_windows_when_empty": false,
"color_scheme": "Packages/User/Tomorrow-Night (SL).tmTheme",
@dimitrov
dimitrov / watch.py
Last active August 29, 2015 14:06
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,
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)
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
#!/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>
@dimitrov
dimitrov / Gruntfile.js
Last active August 29, 2015 14:17
grunt-sass + grunt-contrib-watch
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'
<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 %}
// compile using valac app.vala -o app --pkg gtk+-2.0
using Gtk;
namespace MyApp
{
class MyApp: Gtk.Window
{
public MyApp()
{