Skip to content

Instantly share code, notes, and snippets.

View ChristianPeters's full-sized avatar

Christian Peters ChristianPeters

View GitHub Profile
@ChristianPeters
ChristianPeters / zweitag.tpondemand.com.js
Created November 24, 2016 17:26
TargetProcess buttons to convert Iteration print view to documentation for contracts
$(function() {
addPerformModificationsButton = function(mode, showComplexity) {
var button;
button = $('<a class="button-box x-button user-action button small ui-print__controls__print" role="button"></a>');
var withComplexity;
withComplexity = showComplexity ? '(mit Komplexität) ' : '';
if (mode == 'planning') {
button.append('<span class="">Zu Planungsdokumentation ' + withComplexity + 'konvertieren</span>');
} else if (mode == 'review')
button.append('<span class="">Zu Abnahmedokumentation ' + withComplexity + 'konvertieren</span>');
@ChristianPeters
ChristianPeters / zweitag.tpondemand.com.js
Last active December 10, 2015 14:39
Export eines Sprints aus Targetprocess zur Dokumentation von Sprintplanung und Sprintreview/Abnahme
$(function() {
addPerformModificationsButton = function(mode) {
var button;
button = $('<a class="button-box x-button user-action button small ui-print__controls__print" role="button"></a>');
if (mode == 'planning')
button.append('<span class="">Zu Planungsdokumentation konvertieren</span>');
else if (mode == 'review')
button.append('<span class="">Zu Abnahmedokumentation konvertieren</span>');
$('body').prepend(button);
button.click(function() {
@ChristianPeters
ChristianPeters / example_feature_spec.rb
Created June 27, 2014 14:03
Wait longer in Capybara
around { |example| with_wait_time(6) { example.run } }
@ChristianPeters
ChristianPeters / config-application.rb
Created April 16, 2012 12:29
Adapted for Rails Asset Pipeline: Split CSS files so that there are no more than a given number of selectors in one style sheet. This is a tool to cope with Internet Explorer's limitation of max. 4095 selectors per stylesheet.
#...
module MyProject
class Application < Rails::Application
config.assets.precompile += %w( ie6.css ie6_portion2.css ie7.css ie7_portion2.css ie8.css ie8_portion2.css ie9.css ie9_portion2.css)
#...
@ChristianPeters
ChristianPeters / selectivizr-ajax-hover-fix.js.coffee
Last active October 1, 2015 14:28
selectivizr does not support ajax. These listeners add live support for the CSS :hover pseudo selector for links and buttons, so that they are styled in IE < 9 even if they are dynamically injected.
$ ->
$('body')
.on 'mouseenter', 'a, button, input[type=submit]', ->
$(this).addClass('slvzr-hover')
.on 'mouseleave', 'a, button, input[type=submit]', ->
$(this).removeClass('slvzr-hover')
/* jQuery Radiofy
* ==============
* Turns a select into a hidden text input and
* a set of radio buttons that resemble the options.
* This is used to enable client_side_validations for radio buttons.
* ---
* Daniel Kirsch
* (c) 2012 Zweitag GmbH
*/
(function($){
@ChristianPeters
ChristianPeters / Zuordnung von fashmob Kategorien zu Google Kategorien.yml
Created January 9, 2012 13:45
Anleitung zum Bearbeiten: Siehe unten (Kommentar)
# men (men)
men: "Bekleidung & Accessoires > Bekleidung"
# Accessoires (men > Accessoires)
men_accessoires: "Bekleidung & Accessoires > Bekleidungsaccessoires > Gürtel"
# Gürtel (men > Accessoires > Gürtel)
men_accessoires_guertel: "Bekleidung & Accessoires > Bekleidungsaccessoires"
# Hüte & Mützen (men > Accessoires > Hüte & Mützen)
men_accessoires_huete_muetzen: "Bekleidung & Accessoires > Bekleidungsaccessoires"
# Schals & Tücher (men > Accessoires > Schals & Tücher)
men_accessoires_schals_tuecher: "Bekleidung & Accessoires > Bekleidungsaccessoires"
@ChristianPeters
ChristianPeters / css_splitter.rake
Created August 8, 2011 10:22
Split CSS files so that there are no more than a given number of selectors in one style sheet. This is a tool to cope with Internet Explorer's limitation of max. 4095 selectors per stylesheet.
require 'rake'
require 'css_splitter'
desc 'split css files'
namespace :css do
task :split do
infile = ENV['infile'] || raise("missing infile")
outdir = ENV['outdir'] || File.dirname(infile)
max_selectors = ENV['max_selectors'] || 4095
def javascript(print_tag = false, &block)
content_for(:javascript) do
if print_tag
js = Proc.new { block.call }
javascript_tag(&js)
else
capture(&block)
end
end
end
@ChristianPeters
ChristianPeters / gist:703357
Created November 17, 2010 12:52
This script implements a register of calls in order to have guarded access on a (shared) single dom element. In particular, the flash message div (user notification banner) should only fade out if the last user notification has been displayed for 5-6 secs
// Module that encapsulates access to numberOfCalls and numberOfCompletedCalls.
// Facilitates the ensurance that every flash message is displayed for 5-6 sec.
// Use registerOne() to register a flash message (before calling fade!).
// Use completeOne() once to indicate that a flash message has passed its display time.
// Use allowFade() in order to ask whether the flash div can be faded out now.
Register = function () {
var numberOfCalls = 0;
var numberOfCompletedCalls = 0;
return {