To run the example:
npm install -g nwb
react run example.js --auto-install
import * as path from 'https://deno.land/x/fs/path.ts' | |
export { path } |
{ | |
"presets": [ | |
"@babel/env", | |
], | |
"plugins": [ | |
"add-module-exports" | |
] | |
} |
function sha1(input) { | |
let converter = Components.classes['@mozilla.org/intl/scriptableunicodeconverter'] | |
.createInstance(Components.interfaces.nsIScriptableUnicodeConverter) | |
converter.charset = 'UTF-8' | |
let data = converter.convertToByteArray(input) | |
let ch = Components.classes['@mozilla.org/security/hash;1'] | |
.createInstance(Components.interfaces.nsICryptoHash) | |
ch.init(ch.SHA1) | |
ch.update(data, data.length) | |
let hash = ch.finish(false) |
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); | |
/* Remove the gap to the left of the title tab bar */ | |
#TabsToolbar hbox.titlebar-placeholder[type="pre-tabs"] { | |
display: none !important; | |
} | |
/* Remove the buttons on the right of the location bar */ | |
#page-action-buttons { | |
display: none !important; |
function updatePasswords() { | |
let oldPassword = prompt('Old password:') | |
if (!oldPassword) return | |
let loginManager = Components.classes['@mozilla.org/login-manager;1'] | |
.getService(Components.interfaces.nsILoginManager) | |
let matchingLogins = loginManager.getAllLogins().filter(l => l.password === oldPassword) | |
let matchCount = matchingLogins.length | |
if (matchCount === 0) return alert('No matching logins found') |
html { | |
height: 100%; | |
} | |
body { | |
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; | |
height: 100%; | |
margin: 0; | |
} |
To run the example:
npm install -g nwb
react run example.js --auto-install
import spawn from 'cross-spawn' | |
import ora from 'ora' | |
/** | |
* Get the latest version of a package from npm. | |
*/ | |
export function getLatestVersion(pkg, cb) { | |
let spinner = ora(`Checking for latest version of ${pkg}`).start() | |
let npm = spawn('npm', ['dist-tag', 'ls', pkg, '--no-progress'], {stdio: ['ignore', 'pipe', 'inherit']}) | |
let stdout = '' |
import React from 'react' | |
import {render} from 'react-dom' | |
let Board = React.createClass({ | |
getInitialState() { | |
return { | |
x: 150, | |
y: 150, | |
} | |
}, |
// Matches the naming convention for functions which select from Redux state | |
const SELECTOR_NAME_RE = /^get[A-Z]/ | |
/** | |
* Creates a function which creates same-named action dispatchers from an object | |
* whose function properties are action creators, passing along any arguments. | |
* Function properties whose names start with "get" will be ignored, as these | |
* are assumed to be selectors by convention. | |
* Also makes the dispatch function itself available. | |
* (If this was Java, it'd be a class named ActionDispatcherFactoryFactory). |