Skip to content

Instantly share code, notes, and snippets.

View gartmeier's full-sized avatar

Joshua Gartmeier gartmeier

  • Pitcher AG
  • Switzerland
View GitHub Profile
@gartmeier
gartmeier / forms.py
Last active September 11, 2024 11:53
Soublick Assessment - Aufgabe 1
from django import forms
from django.core.validators import RegexValidator
from django.utils.translation import gettext_lazy as _
class ContactForm(forms.Form):
street_and_number = forms.CharField(
max_length=200,
label=_('Street and house number')
)
(() => {
let file = null
let iframe = null
let version = 'v2'
window.initPersonalAdmin = () => {
file = window.serverJSON.files.find(f => f.vUrl == `zip/pitcher_personal_admin_${version}.zip`)
if (file) {
iframe = document.createElement('iframe')
@gartmeier
gartmeier / cloudSettings
Last active November 13, 2020 09:58 — forked from elibolonur/cloudSettings
VS Code settings - Public
{"lastUpload":"2020-11-13T09:58:04.931Z","extensionVersion":"v3.4.3"}
@gartmeier
gartmeier / upload-pitcher-file.sh
Last active June 18, 2020 16:58
Upload Vue.JS project with slides to Pitcher Admin
#!/usr/bin/env bash
FILE=875483
SLIDES=(1 2 3 4)
WORKING_DIR=/tmp/875483_1592496241
if [[ ! -d $WORKING_DIR ]]; then
mkdir /tmp/875483_1592496241
fi
var urlPieces = window.location.href.split('/');
var slideFolder = urlPieces[urlPieces.length - 2];
function gotoPage(p) {
for (var i = 0; i < slideOrder.length; i++) {
var pieces = slideOrder[i].split('|');
if (pieces[0] == slideFolder && pieces[1] == "" + p) {
Ti.App.fireEvent('gotoVSlide', {p: i});
}
}
@gartmeier
gartmeier / parser.py
Created November 6, 2019 17:01
CamelCaseJSONParser with skip_keys
# -*- coding: utf-8 -*-
import json
import six
from django.conf import settings
from django.core.files import File
from django.http import QueryDict
from django.utils import six
from djangorestframework_camel_case.settings import api_settings
from djangorestframework_camel_case.util import _get_iterable, camel_to_underscore, is_iterable
@gartmeier
gartmeier / cloudwatch_ecs_container.py
Last active January 5, 2019 12:29
CloudWatch metric for AWS ECS container storage
#!/usr/bin/python
import subprocess
import boto3
cw = boto3.client('cloudwatch', region_name='eu-west-1')
ctn_ip = subprocess.check_output('curl --silent ifconfig.co', shell=True).strip()
stats_lines = subprocess.check_output([
'/usr/bin/docker',
'stats',
Vue.component('chapters', {
template: `<div v-if="chapters.length > 0" class="field">
<h2 class="ui header">Rearrange Chapters</h2>
<p><i class="arrows alternate icon"></i> Tap on chapter to start moving</p>
<div class="ui grid">
<div v-for="c in chapters" class="four wide column">
<div class="ui grid">
<div class="chapter" :class="{ 'twelve wide column': moving, 'sixteen wide column': !moving }">
<div class="ui card" @click="startMoving(c)">
<div class="image">
function addHook(hook, eventName) {
let event = window[eventName];
window[eventName] = function() {
setTimeout(() => {
try {
hook.apply(null, arguments);
} catch (e) {
console.error(e);
}
@gartmeier
gartmeier / event.js
Last active November 23, 2018 09:58
$(function() {
$.fireEvent = function(name, data) {
var deferred = $.Deferred(),
callback = 'cb' + Math.random().toString(36).substring(7);
if (data) {
data.callBackFunc = callback;
data.callBack = callback;
data.source = $.fireEvent.defaults.source;
}