Skip to content

Instantly share code, notes, and snippets.

Josh Goldberg JoshuaKGoldberg

View GitHub Profile
@JoshuaKGoldberg
JoshuaKGoldberg / angular.js
Created May 10, 2020
Basic Angular tslint-to-eslint-config converter generator
View angular.js
const { promisify } = require("util");
const { appendFile, writeFile } = require("fs").promises;
const inquirer = require("inquirer");
const exec = promisify(require("child_process").exec);
const execAndPrint = async (command) => {
console.log(`> ${command}`);
const { stdout, stderr } = await exec(command);
@JoshuaKGoldberg
JoshuaKGoldberg / .eslintrc.json
Created Mar 29, 2020
ESLint Import Restrictions
View .eslintrc.json
{
"extends": ["../../../.eslintrc.json"],
"rules": {
"no-restricted-syntax": [
"error",
{
"message": "Don't import from /platform into /portal: if you need, move the shared component to /components instead.",
"selector": "ImportDeclaration[source.value=/(^|(\\\\.\\\\.\\\\u002F*))platform\\\\u002F(.*)/]"
}
]
@JoshuaKGoldberg
JoshuaKGoldberg / svg.d.ts
Created Mar 29, 2020
SVG Declaration File
View svg.d.ts
/**
* @example
* import happy from './assets/happy.svg';
*/
declare module "*.svg" {
const fileName: string;
export default fileName;
}
@JoshuaKGoldberg
JoshuaKGoldberg / index.tsx
Last active Mar 29, 2020
React Components Options
View index.tsx
// Option one??
interface MyThingProps { /* ... */ };
function MyThing({ text }: MyThingProps { /* ... */ };
// Option two??
type MyThingProps = { /* ... */ };
@JoshuaKGoldberg
JoshuaKGoldberg / line.sh
Created Mar 29, 2020
Chart generation for TypeScript: auxillary file
View line.sh
printf "$(git log -1 --format=%ad --date=short),"
printf "$(find webpack/assets/ -type f | grep '.js' | grep -v 'node_modules' | grep -v '.json' | wc -l | sed 's/ //g'),"
printf "$(find webpack/assets/ -type f | grep '.tsx\\?$' | grep -v 'node_modules' | wc -l | sed 's/ //g')"
echo ""
@JoshuaKGoldberg
JoshuaKGoldberg / generate.sh
Last active Apr 3, 2020
Chart generation for TypeScript: main file
View generate.sh
git log --pretty=format:"%h" > commits.txt
echo "Date,JavaScript,TypeScript" > output.csv
xargs < commits.txt -n 1 | xargs -I % sh -c "git reset --hard %; sh line.sh >> output.csv"
echo "Done 🎉"
@JoshuaKGoldberg
JoshuaKGoldberg / babel.config.js.diff
Last active Mar 29, 2020
Babel configuration diff
View babel.config.js.diff
const presets = [
'codecademy',
+ '@babel/preset-typescript',
];
@JoshuaKGoldberg
JoshuaKGoldberg / log.txt
Created Mar 11, 2020
turtle CLI output
View log.txt
This file has been truncated, but you can view the full file.
View Cheese-test.jsx
describe("Cheese", () => {
it("renders milk when aging is not yet complete", () => {
const wrapped = mount(<Cheese />);
expect(wrapped.text()).toBe("🥛");
});
it("renders cheese when aging has completed", () => {
const wrapped = mount(<Cheese />);
const { clock } = useGlobals();
@JoshuaKGoldberg
JoshuaKGoldberg / README.md
Last active Nov 25, 2019
Codecademy Public CLA
View README.md

Contribution License Agreement

This Contribution License Agreement ("Agreement") is agreed to by the party signing below (“You”), and conveys certain license rights to Ryzac, Inc and its affiliates (“RyzacInc”) for Your contributions to RyzacInc open source projects. This Agreement is effective as of the latest signature date below.

1. Definitions

"Code" means the computer software code, whether in human-readable or machine-executable form, that is delivered by You to RyzacInc under this Agreement. “Project” means any of the projects owned or managed by RyzacInc in which software is offered under a license approved by the Open Source Initiative (OSI) (www.opensource.org) and documentation offered under an OSI or a Creative Commons license (https://creativecommons.org/licenses). “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any Project, including but not limited to communication on electronic mailing lists, source code control systems, and

You can’t perform that action at this time.