Skip to content

Instantly share code, notes, and snippets.

Rodney Rehm rodneyrehm

Block or report user

Report or block rodneyrehm

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
@rodneyrehm
rodneyrehm / sentry-clean-debug-information-files.js
Created Jul 17, 2019
Sentry Cleanup: Debug Information Files
View sentry-clean-debug-information-files.js
const axios = require('axios')
const LinkHeader = require('http-link-header')
const nextPage = (header) => {
const link = LinkHeader.parse(header)
const [ next ] = link.get('rel', 'next')
return next && next.results === 'true' ? next.uri : null
}
@rodneyrehm
rodneyrehm / README.md
Last active Jan 30, 2019
execute batches of HTTP requests in parallel
View README.md

Parallel HTTP request execution

  • Takes values from a text file and converts them into HTTP requests (against an echo service with a request execution time of 150ms - 200ms).
  • splits the text file into chunks of $CHUNKS number of items which get executed in sequence by a single curl invocation that reuses the connection (reducing TCP and TLS overhead)
  • $PARALLEL number of chunks are executed concurrently by sem (of GNU parallel)

Example

The demo generates 100 requests. Each request's response is stored to disk (because why not).

@rodneyrehm
rodneyrehm / browser.js
Last active Aug 14, 2018
Looking to find low powered devices to disable animations and stuff
View browser.js
// https://github.com/bestiejs/platform.js
import platform from 'platform'
export const OS = (platform.os.family || '').toLowerCase()
export const ANDROID = OS === 'android'
export const IOS = OS === 'ios'
export const VERSION = parseFloat(platform.version)
export const MAJOR_VERSION = Math.floor(VERSION)
View README.md

How best to encapsulate data retrieval and conversion stuff as shown in the gustav.mixin.js demo, so that it can be easily used in multiple components like gustav.vue?

The problem here is that from the component's perspective we're only interested in providing ottoId and receiving gustav. All other properties from data, computed, methods are at best irrelevant to the component - at worst may cause conflicts.

Is there any sane way I can stay in the "how a mixin would do it" kind of code, but achieve only the export of computed.gustav, watch.ottoId and created?

@rodneyrehm
rodneyrehm / polyfill-intl.js
Created Aug 21, 2017
Webpack: load Intl polyfill with languages
View polyfill-intl.js
const needsPolyfill = !window.Intl
/* eslint-disable import/no-webpack-loader-syntax */
const intl = require('bundle-loader?lazy&name=intl!intl')
/* eslint-enable import/no-webpack-loader-syntax */
const polyfilled = needsPolyfill && new Promise(resolve => {
intl(resolve)
})
@rodneyrehm
rodneyrehm / selenium-ondemand-testinfo.js
Created Jun 19, 2017
Sentry Raven injected test metadata
View selenium-ondemand-testinfo.js
function addSeleniumTags () {
if (!window._SELENIUM_TEST_BUILD) {
return
}
Raven.setTagsContext({
'test.url': window._SELENIUM_BUILD_URL,
'test.job': window._SELENIUM_TEST_JOB,
'test.build': window._SELENIUM_TEST_BUILD,
'test.name': window._SELENIUM_TEST_NAME,
@rodneyrehm
rodneyrehm / output.txt
Last active Jun 12, 2017
vue-i18n - running the unit tests
View output.txt
os: macOS 10.12.5
node: 8.1.0
npm: 5.0.3
-----
➜ npm run test:unit
> vue-i18n@7.0.2 test:unit /Users/rodneyrehm/projects/test.dev/htdocs/vue-i18n
> BABEL_ENV=test karma start config/karma.unit.conf.js
@rodneyrehm
rodneyrehm / system-font.scss
Created Jun 2, 2017
Using system fonts on the web
View system-font.scss
html {
// 12px base unit (others usually make this 10px to simplify their calculations)
font-size: 75%;
}
body {
// will be 16px default font-size
font-size: 1.33rem;
line-height: 1.2;
// See: https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/
@rodneyrehm
rodneyrehm / manual-overflow-scroll.js
Created Jan 10, 2017
Android 4.4 / Chrome 30 WebView: Manual Scrolling of overflow elements
View manual-overflow-scroll.js
// see https://bugs.chromium.org/p/chromium/issues/detail?id=294514 for an explanation of the problem, with a very helpful automatic archival
// If you use this "code" you're going to burn in a very special level of hell.
// A level they reserve for child molesters and people who talk at the theater.
function engageManualScrolling(element) {
var start = 0;
var handleStart = function(event) {
start = element.scrollTop + event.touches[0].pageY;
};
@rodneyrehm
rodneyrehm / full-height-column.css
Created Nov 16, 2016
CSS: full height column, allowing fixed-height header and footer and scrollable content
View full-height-column.css
/*
<article class="full-height-column">
<header></header>
<section></section>
<footer></footer>
</article>
*/
.full-height-column {
display: flex;
You can’t perform that action at this time.