Skip to content

Instantly share code, notes, and snippets.

@jonasvp
jonasvp / harvest_monthly_budgets.py
Created November 1, 2011 09:20
Monthly budgets for harvest: cronjob for rotating projects
#!/usr/bin/env python
'''
Harvest (www.getharvest.com) does not support setting monthly budgets for projects.
The recommended workaround is creating a new project every month. This script is
supposed to run on the first of every month and uses the Harvest API in order to
archive last month's projects and create new ones for the current month. Members
and tasks are automatically copied over to the new project.
Projects with monthly budgets need to fulfill two requirements:
1. They need to have a budget set

Keybase proof

I hereby claim:

  • I am jonasvp on github.
  • I am jonasvp (https://keybase.io/jonasvp) on keybase.
  • I have a public key ASA7qVGmSQIT31YAbXu9OFjPGm-dIpcop6YZhQPPvlAwaQo

To claim this, I am signing this object:

@jonasvp
jonasvp / show.html.erb
Last active October 13, 2015 07:27
Integrate Harvest Platform into redmine
<div style="position:absolute;left:1230px;" class="harvest-timer" data-project='{"id":"<%= @project.id %>", "name": "<%=j @project.name %>"}' data-item='{"id": "<%= @issue.id %>", "name":"<%=j @issue.subject %>"'></div>
<script>
(function() {
window._harvestPlatformConfig = {
"applicationName": "Redmine",
"permalink": "https://YOUR.REDMINE.DOMAIN/issues/%ITEM_ID%"
};
var s = document.createElement('script');
s.src = '//platform.harvestapp.com/assets/platform.js';
s.async = true;
@jonasvp
jonasvp / pre-commit
Created March 7, 2011 08:29
My .git/hooks/pre-commit - save yourself from embarassment using pyflakes
#!/bin/bash
TMPDIR=`mktemp -d`
TMPFILE=`mktemp`
git diff --cached --name-only --diff-filter=ACMR | xargs git checkout-index --prefix=$TMPDIR/ --
pyflakes $TMPDIR >$TMPFILE 2>&1
grep -v "unable to detect undefined names" $TMPFILE >$TMPFILE.2
egrep -v "migrations.*'(datetime|models)' imported but unused" $TMPFILE.2 >$TMPFILE
grep -rn "pdb.set_trace" $TMPDIR >>$TMPFILE
sed "s/^${TMPDIR//\//.}.//" $TMPFILE >$TMPFILE.2