Skip to content

Instantly share code, notes, and snippets.

View m99coder's full-sized avatar
👨‍🚀
Where no human has gone before

Marco Lehmann m99coder

👨‍🚀
Where no human has gone before
View GitHub Profile
// data
var data = [
{timestamp: 1, value: 7},
{timestamp: 2, value: 8},
{timestamp: 3, value: 12},
{timestamp: 4, value: 16},
{timestamp: 5, value: 21},
{timestamp: 6, value: 22},
{timestamp: 7, value: 13},
{timestamp: 8, value: 8},
@m99coder
m99coder / index.html
Last active August 29, 2015 14:24
D3 Multiline Chart
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Pure D3 Charts</title>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
@m99coder
m99coder / index.html
Last active August 29, 2015 14:24
D3 Multiline Chart with Transform Interpolation
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Pure D3 Charts</title>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700">
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
@m99coder
m99coder / data-generator.js
Last active August 29, 2015 14:25
D3 Multiline Chart with Data Generator and Path Translation
/**
* Data Generator
*/
var DataGenerator = (function() {
// number of series
var _numberOfSeries = 1;
// number of data points
var _numberOfDataPoints = 40;
@m99coder
m99coder / reactive-01-streams.js
Last active July 13, 2016 16:01
Reactive Programming
// https://jsbin.com/naleno/1/edit
// array
var source = ['1', '1', 'foo', '2', '3', '5', 'bar', '8', '13'];
var result1 = source;
console.log(result1);
result2 = source
.map(x => parseInt(x))
@m99coder
m99coder / formatter.js
Last active August 30, 2016 11:52
Formatter using string manipulation
/**
* Created by marco on 30.08.16.
*/
/**
* formats text as following:
* - 2-character words are inverted in case for each character
* - 3-character words are returned in reverse order
* @param {string} text
* @returns {string} formatted text
@m99coder
m99coder / non-blocking.js
Last active November 1, 2016 12:43
Non-blocking execution of expensive function
var data = [1, 2, 3];
var REFRESH_RATE = 16.67;
function veryExpensive(item) {
// ...
}
function forEachExpensive(data, callback) {
var index = 0;
var dataLength = data.length;
@m99coder
m99coder / content-script.js
Created November 30, 2016 00:25
Content Script to remove certain blog posts from Confluence Startpage
// black lists
var linkBlackList = [
// start of the URI you want to black list, e.g. '/display/~marco.lehmann'
];
var userBlackList = [
// user name you want to black list, e.g. 'marco.lehmann'
];
@m99coder
m99coder / control.sh
Last active May 23, 2017 08:20
Kafka/Zookeeper running in Docker – Control Bash Script
#!/usr/bin/env bash
# get platform to determine IP address accordingly
PLATFORM=$(uname -s)
if [ "$PLATFORM" == "Darwin" ]; then
IP=$(ipconfig getifaddr en0)
elif [ "$PLATFORM" == "Linux" ]; then
IP=$(hostname -I)
else
echo "Unknown platform. Can not determine IP address that way."
@m99coder
m99coder / server.js
Last active December 2, 2022 12:30
Node.js: Proxy multipart/form-data file upload to application/octet-stream REST API call
#!/usr/bin/env node
// dependencies
const https = require('https');
const express = require('express');
const multer = require('multer');
// app
const app = express();
const storage = multer.memoryStorage();