Skip to content

Instantly share code, notes, and snippets.

Paul O’Shannessy zpao

Block or report user

Report or block zpao

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
View add-to-npm.js
#!/usr/bin/env node
const util = require('util');
const execp = util.promisify(require('child_process').exec);
main(process.argv[2], process.argv[3]);
async function main(pkg, user) {
const whoamioutput = await execp(`npm whoami`);
const whoami = whoamioutput.stdout.trim();
View blame.js
// inspired by https://github.com/tj/git-extras/blob/master/bin/git-line-summary
const util = require("util");
const exec = util.promisify(require("child_process").exec);
const execSync = require("child_process").execSync;
const DIR = "/Users/poshannessy/FB/code/react-clean";
const REF = "origin/master";
const AUTHOR = "Paul O’Shannessy";
const PERIOD_DAYS = 1;
View foo.diff
diff --git a/opensource.html b/opensource.html
index 043dd2c..27382bf 100644
--- a/opensource.html
+++ b/opensource.html
@@ -100,14 +100,14 @@
<div id="trending" class="project-group">
<div class="container">
<div class="group-content">
- <h2>trending</h2>
+ <h2>Trending</h2>
View foo.diff
diff --git a/opensource.html b/opensource.html
index 043dd2c..affea25 100644
--- a/opensource.html
+++ b/opensource.html
@@ -100,14 +100,14 @@
<div id="trending" class="project-group">
<div class="container">
<div class="group-content">
- <h2>trending</h2>
+ <h2>Trending</h2>
View gist:4883b0084f0a0e098490748560293b4d
diff --git a/opensource.html b/opensource.html
index 043dd2c..affea25 100644
--- a/opensource.html
+++ b/opensource.html
@@ -100,14 +100,14 @@
<div id="trending" class="project-group">
<div class="container">
<div class="group-content">
- <h2>trending</h2>
+ <h2>Trending</h2>
@zpao
zpao / 0-NaiveQRCode.js
Last active Jun 10, 2018
Making QRCodes with SVG smaller (using React)
View 0-NaiveQRCode.js
// This will generate 31329 <rect>s for a level 40 QR Code (177x177).
// This approach is totally fine in <canvas> (but should learn from Smarter impl below)
// Lorem Ipsum test content was ~2MB
class QRCodeSVG extends React.Component<Props> {
render() {
var {value, size, level, bgColor, fgColor} = this.props;
var qrcode = new QRCodeImpl(-1, ErrorCorrectLevel[level]);
qrcode.addData(value);
qrcode.make();
View .babelrc
{
"presets": ["./.babelrc.js"],
}
View .babelrc
{
"plugins": [
["babel-preset-fbjs/plugins/rewrite-modules", {
map: {
'./original': './rewritten'
},
prefix: '',
}]
],
}
View .babelrc
{
"plugins": [
["babel-preset-fbjs/plugins/rewrite-modules", {
map: {
'./original/foo': './rewritten/foo'
},
prefix: '',
}]
],
}
View foo.diff
diff --git a/package.json b/package.json
index 7747f0d5..1b490635 100644
--- a/package.json
+++ b/package.json
@@ -31,25 +31,25 @@
"babel-traverse": "6.25.0",
"babel-types": "6.25.0",
"babylon": "6.17.3",
"chalk": "^1.1.3",
"del": "2.2.2",
You can’t perform that action at this time.