Skip to content

Instantly share code, notes, and snippets.

View janbiasi's full-sized avatar
🌐
Just building

Jan R. Biasi janbiasi

🌐
Just building
View GitHub Profile
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle" version="13">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>

Keybase proof

I hereby claim:

  • I am janbiasi on github.
  • I am janbiasi (https://keybase.io/janbiasi) on keybase.
  • I have a public key ASCtE8AeCKptUGp691KbULr8_s9F9RhzyFKF9ieeYdm9vwo

To claim this, I am signing this object:

@janbiasi
janbiasi / navigation-trigger-handler.js
Created November 30, 2020 18:41
Simple snippet for creating a mobile navigation with pure vanilla JavaScript
// Replace this with your burger icon element ID
var trigger = document.getElementById('mobile-navigation-trigger');
// Replace this with with your navigation element ID
var navigationList = document.getElementById('navigation-list');
// open or close the mobile flyout
function toggleNavigation() {
if (navigationList.classList.contains('is-open')) {
navigationList.classList.remove('is-open');
@janbiasi
janbiasi / MyComponent.gondel.ts
Last active June 26, 2020 10:18
[Gondel Angular Component Playground] Example implementation of an Angular Component with Gondel integration in mind. #gondel #angular
import { Component, EventListener, GondelBaseComponent } from '@gondel/core';
@Component()
export class UIMyComponent extends GondelBaseComponent {
static componentName = 'MyComponent';
@EventListener('click', '.js-a-my-component__button')
_handleClick(ev: any) {
alert('Button clicked!');
}
@janbiasi
janbiasi / sigterm.js
Last active January 15, 2018 12:17
Handle node.js process quit by user (Command+Q on MacOS, Control+C on Windows)
['SIGINT', 'SIGTERM'].forEach(sig => {
process.on(sig, () => process.exit());
});

Events

  • http:error = Server Errors with code 500
  • http:timeout = Requests which exceeded the max. timeout of 10s

Param Signature

window.__REACT_SHARED_EVENTS__.on('http:error', (code, response, config) => { });
window.__REACT_SHARED_EVENTS__.on('http:timeout', (code, response, config) => { });
const DATASOURCE = 'data.json';
const fs = require('fs');
const parser = require('body-parser');
const app = require('express')();
app.use(parser.json());
// HTTP GET /api/data
app.get('/api/data', (req, res, next) => {
@janbiasi
janbiasi / cluster.js
Created February 16, 2016 07:48
Zukunft. Namics. Snippets für das Node.js Clustermodul (Part 2)
var cluster = require('cluster');
var numCPUs = require('os').cpus().length;
var proxy = require('./proxy');
if (cluster.isMaster) {
for (var i = 0; i < numCPUs; i++) {
// Erstellt pro Kern einen neuen Worker
cluster.fork();
}
} else {
@janbiasi
janbiasi / proxy.js
Last active February 16, 2016 07:48
Zukunft. Namics. Snippets für das Node.js Clustermodul (Part 1)
var http = require('http');
var httpProxy = require('http-proxy');
exports.createServer = function(host, proxyPort, httpPort) {
proxyPort = proxyPort || 8000;
httpPort = httpPort || 9000;
host = host || 'localhost';
// Erstellt den Proxy-Server
httpProxy.createServer(httpPort, host).listen(proxyPort);
@janbiasi
janbiasi / microp.js
Created February 9, 2016 10:31
Micro sized promise library for Node.js and the Browser
(function() {
var root = this;
var giveBackOldPromise = Promise;
var isNode = typeof process === 'object' || window === undefined;
var asap = function(handler) {
if(isNode) {
process.nextTick(handler);
} else {