Skip to content

Instantly share code, notes, and snippets.

🤖
Working

Dominik Wilkowski dominikwilkowski

🤖
Working
Block or report user

Report or block dominikwilkowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View delete-old-files.js
var https = require('https');
// CONFIGURATION #######################################################################################################
var token = '';
var delay = 300; // delay between delete operations in millisecond
// GLOBALS #############################################################################################################
var baseApiUrl = 'https://slack.com/api/';
@dominikwilkowski
dominikwilkowski / Readme.md
Last active Jan 7, 2018
How to install a man page into a node.js app
View Readme.md

How to install a man page into a node.js app

Cuttlebelle man page

Installing a man page is not easy as there are little infos out there about it.

After a lot of trial and error, google searches and alpha publishing my app I finally have a collection of things I need to do to get it working:

@kitze
kitze / conditionalwrap.js
Created Oct 25, 2017
one-line React component for conditionally wrapping children
View conditionalwrap.js
import React from 'react';
const ConditionalWrap = ({condition, wrap, children}) => condition ? wrap(children) : children;
const Header = ({shouldLinkToHome}) => (
<div>
<ConditionalWrap
condition={shouldLinkToHome}
wrap={children => <a href="/">{children}</a>}
>
@m-richo
m-richo / cf-app-audit.sh
Last active Dec 12, 2017
query Cloud Foundry environment for all running applications and dump them into a CSV file
View cf-app-audit.sh
#!/bin/bash
set -eu
set -o pipefail
API_ENDPOINT=$(cf api |grep "endpoint" |awk -F "https://" '{print $2}')
rm -f $API_ENDPOINT.csv
echo "Running audit for $API_ENDPOINT"
echo "Output is in $API_ENDPOINT.csv"
@slightlyoff
slightlyoff / push_payloads_userland.md
Last active Apr 17, 2019
Delivering H/2 Push Payloads To Userland
View push_payloads_userland.md

Background

One of the biggest missed opportunities thus far with HTTP/2 ("H/2") is that we are not yet able to sunset WebSockets in favor of H/2. Web Sockets and H/2 both support multiplexing messages bi-directionally and can send both textual and binary data.

Server Sent Events ("SSE"), by contrast, are not bi-directional (they're a "server-push-only" channel) and binary data cannot be sent easily. They are, however, very simple to implement. Adding to the menagerie of options, RTCPeerConnection can also be used to signal data to applications in a low-latency (but potentially lossy) way.

Because H/2 [does not support the handshake (upgrade) that WebSockets use to negotiate a connection](https://daniel.haxx.se/blog/2016/06/15/no-websockets-

@guilhermepontes
guilhermepontes / shuffle.js
Last active Jun 7, 2019
Shuffle Array - JavaScript ES2015, ES6
View shuffle.js
// original gist
const shuffleArray = arr => arr.sort(() => Math.random() - 0.5);
// fully random by @BetonMAN
const shuffleArray = arr => arr
.map(a => [Math.random(), a])
.sort((a, b) => a[0] - b[0])
.map(a => a[1]);
shuffleArray([1, 2, 3]) //[3, 1, 2]
@dominikwilkowski
dominikwilkowski / README.md
Created Feb 22, 2017
Flatten javascript objects into a single-depth object with ES6
View README.md

Flatten a deep javascript object into single-depth object with ES6

Call it via:

const flat = flatten( realDeepObject );

Test case:

@simonswiss
simonswiss / index.js
Last active Jan 26, 2017
Hipster Scraper
View index.js
const fs = require('fs')
const axios = require('axios')
const cheerio = require('cheerio')
const URLS = require('./urls')
const TARGET_FILE = './data.js'
function scrapeData(url) {
axios.get(url).then(response => {
View three-ways-same-UI.js
// component state
class LedgerContainer extends React.Component {
state = {
debits: null,
credits: null,
creditsError: null,
debitsError: null
}
componentDidMount() {
You can’t perform that action at this time.