Skip to content

Instantly share code, notes, and snippets.

View stockenberg's full-sized avatar

Marten Stockenberg stockenberg

  • Leipzig, Germany
View GitHub Profile
@stockenberg
stockenberg / js_upload.html
Created April 9, 2019 12:04
JS Upload + Axios and Progress
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
@stockenberg
stockenberg / slice.call.js
Created February 13, 2019 10:09
Javascript convert HTML Collection to Array
/* Converts an HTML Collection to an regular Array */
let arr = [].slice.call(ev.target.parentElement.parentElement.children);
@stockenberg
stockenberg / User.php
Created February 4, 2019 17:21
An Example class to Eager load Tables and Pivot Data
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Alumni extends Model
{
//
protected $fillable = ['birthdate', 'firstname', 'lastname', 'country', 'teaser', 'fulltext', 'img'];
protected $with = ['companies', 'products', 'social_platforms', 'campuses', 'departments'];
public static function validationRules(): array
@stockenberg
stockenberg / Generate PHPDTOS.groovy
Last active December 12, 2018 12:17
A PHPStorm database script to generate DTOs out of table definition
import com.intellij.database.model.DasTable
import com.intellij.database.util.Case
import com.intellij.database.util.DasUtil
/*
* Available context bindings:
* SELECTION Iterable<DasObject>
* PROJECT project
* FILES files helper
*/
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 12,
center: { lat: 51.3400481, lng: 12.3720687 }
});
var _loop = function _loop(i) {
var name = _this.companies[i].name + " - H:" + _this.companies[i].histories.length + " S:" + _this.companies[i].students.length;
@stockenberg
stockenberg / Storage.js
Created October 10, 2018 23:19
LocalStorage
class Storage {
/**
* Add to LocalStorage
* @param {*} key
* @param {*} value
*/
static add(key, value) {
let storage = this.get(key);
if (storage !== null) {
@stockenberg
stockenberg / Vagrantfile
Created January 9, 2018 11:01
Vagrant Example
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@stockenberg
stockenberg / index.html
Created December 1, 2017 17:11
JavaScript Workshop
<!doctype html>
<head>
<meta charset="utf8">
<title>
JavaScript für Programmieranfänger
</title>
</head>
@stockenberg
stockenberg / progress-bar.html
Created November 29, 2017 11:04
ProgressBar
<!doctype html>
<head>
<title>Titel</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<script>
var initialWidth = window.innerWidth;
// Value in Milliseconds
var attrValue = 20000;