Skip to content

Instantly share code, notes, and snippets.

View grantmcconnaughey's full-sized avatar

Grant McConnaughey grantmcconnaughey

View GitHub Profile
@grantmcconnaughey
grantmcconnaughey / gvm-check.sh
Last active May 2, 2019 19:42
A Bash script that informs you when a Grails version is available on GVM
#!/bin/bash
# Usage:
# ./gvm-check.sh grails_version
[[ -s "$HOME/.gvm/bin/gvm-init.sh" ]] && source "$HOME/.gvm/bin/gvm-init.sh"
CHECK=""
GRAILS_VERSION=$1
while [ true ]; do
@grantmcconnaughey
grantmcconnaughey / gitconfig
Last active March 14, 2016 15:03
My .gitconfig
[user]
name = Grant McConnaughey
email = grantmcconnaughey@gmail.com
[color]
ui = true
[core]
excludesfile = ~/.gitignore_global
autocrlf = input
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
@grantmcconnaughey
grantmcconnaughey / pdf.py
Last active February 8, 2021 21:50 — forked from zyegfryed/pdf.py
Outputting PDFs with Django 1.8 and FDFgen
# -*- coding: utf-8 -*-
import codecs
import subprocess
from fdfgen import forge_fdf
from django.core.exceptions import ImproperlyConfigured
from django.template import engines
from django.template.backends.base import BaseEngine
from django.template.engine import Engine, _dirs_undefined
syntax on
filetype indent on
set number
set autoindent
set tabstop=4
set expandtab
set shiftwidth=4
highlight LineNr ctermfg=grey
def lint_entire_project(self, local_repo_path):
"""Runs quality checks on the local repo and returns the output as a string."""
self.state = BUILD_RUNNING
self.save()
process = subprocess.Popen(['flake8', local_repo_path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=False)
def __init__(self):
self.linter = self.get_linter()
def lint_entire_project(self):
"""Lints the local repo and returns the violations found."""
self.state = BUILD_RUNNING
self.save()
violations = self.linter.lint()
@login_required
def dashboard(request, service):
projects = request.user.get_projects(service)
return render(request, 'project/dashboard.html', {'projects': projects})
<a href="{% url "project:add_projects" "gh" %}" class="btn btn-primary">
<em class="icon-plus"></em> Add Projects
</a>
# Future git services will go here
GITHUB = 'gh'
DUMMY = 'dummy'
def service(request):
services = (GITHUB, DUMMY)
the_service = None
for _service in services:
if request.path.startswith('/{}/'.format(_service)):
the_service = _service
<a href="{% url "project:add_projects" service %}" class="btn btn-primary">
<em class="icon-plus"></em> Add Projects
</a>