I hereby claim:
- I am sqren on github.
- I am sqren (https://keybase.io/sqren) on keybase.
- I have a public key ASBUUQc0dmZTpHrgymt-8rvKrYuYbPx7R9WnAwNK6-F61wo
To claim this, I am signing this object:
copy( | |
encodeURIComponent(`(function() { | |
function readLocalFile(e) { | |
const file = e.target.files[0]; | |
if (!file) { | |
alert('No file selected!') | |
} | |
const reader = new FileReader(); | |
reader.onload = function(e) { | |
const contents = e.target.result; |
/* | |
The number of changed files (additions/deletions) includes all files. | |
I wanted to see how many files I had changed, excluding tests and test snapshots. | |
This filter will help you do that. | |
To use it, go to the PR, navigate to "Files" and invoke the following | |
*/ | |
(function() { | |
const excludeWords = ['test', 'mock-responses', 'typings']; |
const hypercore = require('hypercore'); | |
const discovery = require('discovery-swarm'); | |
const multifeed = require('multifeed'); | |
const pump = require('pump'); | |
const suffix = process.argv[2]; | |
const db = `./multichat-${suffix}`; | |
console.log(`Using db: ${db}`); | |
const multi = multifeed(hypercore, db, { valueEncoding: 'json' }); |
# yarn add puppeteer | |
# node ./puppeteer-random-page.js | |
const puppeteer = require('puppeteer'); | |
const initialUrl = process.env.url || 'http://localhost:8080'; | |
async function init() { | |
const browser = await puppeteer.launch({ headless: true }); | |
return browser.newPage(); | |
} |
{ | |
"scripts": { | |
"browserify": "browserify --standalone myModuleName ./src/index.js | uglifyjs --compress --source-map --output dist/index.min.js" | |
}, | |
"browserify": { | |
"transform": [ | |
[ | |
"babelify", | |
{ | |
"presets": [ |
// Usage: jscodeshift -t replace-webpack-alias-with-relative-path.js ./kibana/x-pack/plugins ./kibana/src | |
const path = require('path'); | |
const URI = require('urijs'); | |
function getRelativePath(currentFilePath, dependencyPath) { | |
return URI(dependencyPath) | |
.relativeTo(currentFilePath) | |
.toString(); | |
} |
const input = { | |
email: { | |
subject: 'Happy birthday {{name}} 🎂', | |
body: 'Hi {{name}}, you are turning {{age}} today!' | |
} | |
}; | |
const ctx = { name: 'Søren', age: 30 }; | |
const tmpl = renderMustache(input, ctx); | |
// tmpl: {"email": {"subject": "Happy birthday Søren 🎂", "body": "Hi Søren, you are turning 30 today!"}} |
// Deprecated. Use puppeteer instead: https://gist.github.com/sqren/94ab2b9c5e88c1c119182425b19bcd59 | |
const { Chromeless } = require('chromeless'); | |
const initialUrl = process.env.CHROMELESS_URL || 'https://www.dr.dk'; | |
const chromeless = new Chromeless({ | |
launchChrome: true | |
}); | |
function sleep(ms) { |
I hereby claim:
To claim this, I am signing this object:
import { mount } from 'enzyme'; | |
import React from 'react'; | |
import { createMockStore } from 'redux-test-utils'; | |
import { Provider } from 'react-redux'; | |
import { Router } from 'react-router-dom'; | |
import createHistory from 'history/createHashHistory'; | |
import PropTypes from 'prop-types'; | |
export const mountWithRouterAndStore = (Component, storeState = {}) => { | |
const store = createMockStore(storeState); |