Skip to content

Instantly share code, notes, and snippets.

View JonnyFunFun's full-sized avatar

Jonathan Enzinna JonnyFunFun

View GitHub Profile
if __name__ == '__main__':
try:
client.run('token')
except KeyboardInterrupt:
print('Interrupted')
finally:
client.close()
@JonnyFunFun
JonnyFunFun / comment_reverse.js
Created March 18, 2015 18:31
comment reverse mashup
/*
* Placeholder: footerPlaceholder
*/
tau.mashups
.addDependency("jQuery")
.addDependency('app.bus')
.addMashup(function($, $deferred, config) {
/* our reused placement function */
$deferred.then(function(bus) {
bus.on('afterRender', $.proxy(function(e, obj, data) {
#!/bin/bash
UP=$(pgrep mysql | wc -l);
if [ "$UP" -ne 1 ];
then
echo "MySQL is down.";
sudo service mysql start
else
echo "All is well.";
@JonnyFunFun
JonnyFunFun / card_focus.js
Last active August 29, 2015 14:05
Card Focus mashup
tau.mashups
.addDependency('jQuery')
.addDependency('Underscore')
.addDependency('libs/parseUri')
.addDependency('tau/core/class')
.addDependency('tau/configurator')
.addMashup(function($, _, parseUri, Class, configurator) {
'use strict';
from functools import wraps
from django.db.models.signals import pre_save
def full_clean_on_save(cls):
"""
Class decorator that automatically calls full_clean() when a model is saved.
"""
def connect(signal, func):
cls.func = staticmethod(func)
@wraps(func)
@JonnyFunFun
JonnyFunFun / tp api example.php
Created November 25, 2013 15:14
Example on how to consume Targetprocess' REST API with PHP
<?php
define('TP_URL', 'http://enzinna.tpondemand.com/');
define('TP_USER', 'admin');
define('TP_PASS', 'admin');
# GET a story
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, TP_URL."api/v1/UserStories/201?format=json");
@JonnyFunFun
JonnyFunFun / reocurring_task.py
Created August 27, 2013 13:42
Simple decorator to use to schedule a function to occur every X seconds
import threading
class ReoccuringTask(object):
def __init__(self, recurrence):
self.schedule = recurrence
def __call__(self, orig_func):
decorator_self = self
@JonnyFunFun
JonnyFunFun / Impediment CF Colorer.js
Created July 9, 2013 14:55
Custom-Field version of the TP3 class of service mashup that works with Impediments
tau.mashups
.addDependency('tp/mashups')
.addDependency('user/mashups')
.addDependency('jQuery')
.addDependency('Underscore')
.addDependency('tp3/mashups/context')
.addDependency('tau/core/bus.reg')
.addDependency('tau/configurator')
.addMashup(function (m, um, $, _, context, busRegistry, configurator) {
@JonnyFunFun
JonnyFunFun / Column Hider-All Projects.js
Last active December 19, 2015 12:49
A corrected version of the Kanban Column Hider that will work globally across all projects
tau.mashups
.addDependency('libs/jquery/jquery')
.addMashup(function ($, config) {
// Put states' names that you want to hide here
var statesToHide = ["In Progress", "Fixed"];
for (var i = 0; i < statesToHide.length; i++) {
var headers = $(".kanban-swimlane-header-wrap span:contains('"+statesToHide[i]+"')").filter(function() {
return $(this).text().match("^"+statesToHide[i]) != null;
@JonnyFunFun
JonnyFunFun / TP3-Project-Specific-COS-Mashup.js
Created July 1, 2013 13:13
TP3 Classes of Service (tag highlighter) mashup with per-project capabilities
tau.mashups
.addDependency('tp/mashups')
.addDependency('user/mashups')
.addDependency('jQuery')
.addDependency('Underscore')
.addDependency('tp3/mashups/context')
.addDependency('tau/core/bus.reg')
.addDependency('tau/configurator')
.addMashup(function (m, um, $, _, context, busRegistry, configurator) {