Skip to content

Instantly share code, notes, and snippets.

View davidgilbertson's full-sized avatar

David Gilbertson davidgilbertson

  • Sydney, Australia
View GitHub Profile

First of all, this is not my brilliant effort to get react-native working on Windows, it is the collation of work by others, particularly @mqli and @Bernd Wessels. I've just summarised what worked for me.

If you would prefer to read what I've plagerised, head over to mqli's great gist

Disclaimer

  • The below is tested with react-native-cli 0.1.5, react-native 0.12.0 on Windows 10, node 4.1.1, and Android (physical Nexus 6 and AVD with API v22)
  • I hope this will all be redundant in a few weeks. Please comment on stuff that is now fixed and I will update this to keep it relevant.
  • Sprinkle a bit of YMMV around

Keep this github issue handy, it’s the bucket for all Windows/Linux related tricks to get RN working.

body.user-is-tabbing *:focus {
outline: 2px solid #7AACFE !important; /* for non-webkit browsers */
outline: 5px auto -webkit-focus-ring-color !important;
}
function handleFirstTab(e) {
if (e.keyCode === 9) {
document.body.classList.add('user-is-tabbing');
window.removeEventListener('keydown', handleFirstTab);
window.addEventListener('mousedown', handleMouseDownOnce);
}
}
function handleMouseDownOnce() {
// Copy/paste this into your Dev Tools console while on https://medium.com/me/stats
// You can save it as a snippet in Chrome if you like: https://developers.google.com/web/tools/chrome-devtools/snippets
console.clear();
(() => {
console.info('Remember to scroll down first to load all your articles');
const formatPercent = rawValue => `${(rawValue * 100).toFixed(1)}%`;
const tableHeaderCell = document.querySelector('.sortableTableHeaders tr').insertCell();
tableHeaderCell.textContent = 'Fans/views';
@davidgilbertson
davidgilbertson / Neato npx commands
Created November 22, 2017 21:06
npx is installed with npm 5.2. Here are some useful commands
# list lines of code by file type:
`npx sloc --format cli-table src/`
# print out update/version info about your project's packages
`npx npm-check`
# display a breakdown of package contents by size (for a CRA page)
`npx source-map-explorer build/static/js/main.*`
@davidgilbertson
davidgilbertson / gzipped-size.js
Last active October 8, 2018 00:53
Get the size a file will be when gzipped
const fs = require('fs');
const zlib = require('zlib');
const file = fs.readFileSync('./some_file.js');
const rawSize = file.length;
const gzippedSize = zlib.gzipSync(file).length;
console.log('Raw size: ', (rawSize / 1000), 'KB');
console.log('Gzipped size: ', (gzippedSize / 1000), 'KB');
console.log('Compression: ', `${100 - Math.round(gzippedSize / rawSize * 1000) / 10}%`);
function logColor(color, args) {
console.log(`%c ${args.join(' ')}`, `color: ${color}`);
}
const log = {
aliceblue: (...args) => { logColor('aliceblue', args)},
antiquewhite: (...args) => { logColor('antiquewhite', args)},
aqua: (...args) => { logColor('aqua', args)},
aquamarine: (...args) => { logColor('aquamarine', args)},
azure: (...args) => { logColor('azure', args)},
@jhaddix
jhaddix / cloud_metadata.txt
Last active May 19, 2024 01:19 — forked from BuffaloWill/cloud_metadata.txt
Cloud Metadata Dictionary useful for SSRF Testing
## AWS
# from http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html#instancedata-data-categories
http://169.254.169.254/latest/user-data
http://169.254.169.254/latest/user-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/iam/security-credentials/[ROLE NAME]
http://169.254.169.254/latest/meta-data/ami-id
http://169.254.169.254/latest/meta-data/reservation-id
http://169.254.169.254/latest/meta-data/hostname
http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
@davidgilbertson
davidgilbertson / http2.js
Last active October 9, 2023 06:09
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
/*
Adapted from https://github.com/sindresorhus/github-markdown-css
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights