Skip to content

Instantly share code, notes, and snippets.

View mmintel's full-sized avatar
👋
Looking for awesome opportunities

Marc Mintel mmintel

👋
Looking for awesome opportunities
View GitHub Profile
export default class Manager {
constructor() {
// Speicher alle Instanzen im Manager
this.instances = [];
}
// Filtere HTML Elemente nach einem Attribut.
// So können wir die Komponenten Gruppen ausmachen.
static filterNodesByAttribute(nodes, attribute, value) {
return [...nodes].filter(node =>
// Importiere ein Modul (bspw. modals) und exportiere es direkt.
// Dient nur dafür die ganzen Module unter einer Datei zu bündeln.
// So lässt sich leicht durch alle Module itererieren.
export { default as modals } from './modals';
// Importiere das Modul aus der Lib.
import Modal from '../lib/modal';
// Exportiere eine init function in der alles nötige für das Modul initialisiert wird.
export default function init() {
return new Modal({
nodes: document.querySelectorAll('[data-modal]'),
overlay: document.querySelectorAll('[data-modal-overlay]')[0],
triggers: {
open: document.querySelectorAll('[data-modal-open]'),
@mmintel
mmintel / app.js
Last active May 11, 2018 13:22
Code snippets für eine Javascript Architektur
// Lade alle Module aus dem Ordner und speicher Sie in der Variable ab
import * as modules from './modules';
class App {
constructor() {
// Speicher die Module in der App
this.modules = {};
}
init() {
@mmintel
mmintel / .htaccess
Last active August 26, 2016 12:59
Kirby with Dokku
# Kirby .htaccess
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
Images.allow({
'insert': function() {
// add custom authentication code here
return true;
},
'update': function() {
// add custom authentication code here
return true;
},
'remove': function() {
var createThumb = function(fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize('256', '256').stream().pipe(writeStream);
};
var createMedium = function(fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize('800', '800').stream().pipe(writeStream);
};
Images = new FS.Collection("images", {
stores: [
@mmintel
mmintel / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mmintel
mmintel / SassMeister-input-HTML.html
Created September 24, 2014 14:35
Generated by SassMeister.com.
<div class="class">asd</div>