Skip to content

Instantly share code, notes, and snippets.

@jerryasher
jerryasher / browser.md
Last active September 29, 2020 18:30
How to get a create-react-app to open a different browser

I typically use Chrome for everything so my daily Chrome is larded with tons of extensions that may not play well with developing web applications. One example is they often litter the console log with various log messages of their own, or error messages with permissions problems and things like that

So I like to develop web apps in a clean vanilla copy of Chrome Canary or Chrome Beta.

Because of how create-react-app works, it seems as if there is no clear, or easy way to specify the use of a different browser in package.json

Digging into the scripts, it seems you can specify the browser you prefer by setting the BROWSER environment variable in the command line yarn start, that environment variable can be an absolute path or just the application name itself.

So here's how to do that when using WSL2 on Windows 10 and wanting to bring up Windows Chrome Beta pointing at your web app running in WSL2

@jerryasher
jerryasher / pelican unittest output
Created October 26, 2017 22:45
pelican unittest output
$ git pull origin
Updating 71625af8..56a48347
Fast-forward
pelican/tests/support.py | 4 ++--
pelican/tools/pelican_quickstart.py | 10 +++++-----
pelican/tools/pelican_themes.py | 2 +-
Title: Map
Date: 2017-08-31
Tags: spa
stuff
<h1>Finding Me</h1>
<button onclick="getLocation()">Where am I?</button>
<p id="location"></p>
Title: Mapit
Date: 2017-09-02
Tags: spa
stuff
<h1>Finding Me</h1>
<button onclick="getLocation3()">Where am I?</button>
<p id="location3"></p>
Title: MapBetter
Date: 2017-09-01
Tags: spa
stuff
<h1>Finding Me</h1>
<button onclick="getLocation2()">Where am I?</button>
<p id="location2"></p>
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Jerry>cd c:\kivy
c:\kivy>echo $PATH
$PATH
c:\kivy>echo %PATH%
C:\xconda3;C:\xconda3\Scripts;C:\xconda3\Library\bin;C:\Python\Python36-32\Scripts;C:\Python\Python36-32;C:\Python\Python27\Scripts;C:\Python\Python27;C:\PostgreSQL\9.6\bin;C:\Program Files\Docker Too
DISPLAY: 'GetPython2.7.13.amd64.msi' TYPE: DOWNLOAD STATE: TRANSFERRED
PRIORITY: NORMAL FILES: 1 / 1 BYTES: 20082688 / 20082688 (100%)
Transfer complete.
[KivyInstaller] Installing...
Could Not Find C:\kivy\py2.7.13.msi
The system cannot find the file specified.
[KivyInstaller] Python is installed
[KivyInstaller] Installing pip...
Collecting setuptools
Collecting pip
@jerryasher
jerryasher / pages.txt
Created January 11, 2017 10:01
Occurrences of PAGES in pelican
All occurrences of PAGES
./aboutwilson/templates/base.html: {% for page in PAGES %}
./alchemy/alchemy/templates/base.html: {% if LINKS or (DISPLAYON_MENU and PAGES) or ICONS %}
./alchemy/alchemy/templates/base.html: {% for page in PAGES %}
./alchemy/alchemy/templates/base.html: {% if (LINKS or (DISPLAYON_MENU and PAGES)) and loop.first %}
./blue-penguin/templates/base.html: {% for p in PAGES %}
./bluegrasshopper/templates/base.html: {% for page in PAGES %}
./bluegrasshopper/templates/index.html: {% for page in PAGES %}
./blueidea/templates/base.html: {% for pg in PAGES | sort(attribute=SORT_ATTRIBUTE) %}
@jerryasher
jerryasher / gist:d6936d08eec5135fbb0aa8fd4b31dc5c
Last active January 11, 2017 06:18
Occurrences of PAGES in pelican themes
#All Occurrences of PAGES in pelican-themes
./aboutwilson/templates/base.html: {% for page in PAGES %}
./bootlex/templates/base.html: {% if PAGES %}
./bootlex/templates/base.html: {% for p in PAGES %}
./bootstrap/templates/base.html: {% for page in PAGES %}
./bootstrap2/templates/base.html: {% for page in PAGES %}
./bootstrap2/templates/index.html: {% if PAGES %}
./bootstrap2/templates/index.html: {% for page in PAGES %}
./bootstrap2-dark/templates/base.html: {% for page in PAGES %}
@jerryasher
jerryasher / gist:18ff0822f8d511d30516
Created January 25, 2016 02:08
Snippet to parse URL query strings, returning an object whose keys are parameter names and whose values are an array of the parameters themselves
// via http://codereview.stackexchange.com/questions/9574/faster-and-cleaner-way-to-parse-parameters-from-url-in-javascript-jquery
function parseQueryString() {
var query = (window.location.search || '?').substr(1),
map = {};
query.replace(/([^&=]+)=?([^&]*)(?:&+|$)/g, function(match, key, value) {
(map[key] = map[key] || []).push(value);
});
return map;
}