Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelslurs committed Dec 1, 2024
1 parent 45c24a3 commit 63942cd
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 120 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
This site is a modified version of [AstroPaper](https://github.com/satnaing/astro-paper). It uses [TypeScript](https://www.typescriptlang.org), [ReactJS](https://reactjs.org) for components, [TailwindCSS](https://tailwindcss.com) for styling, and Markdown for blog/work content. It relies on the framework [Astro](https://astro.build) and uses [Fuse.js](https://www.fusejs.io) for search. CMS is [Tina](https://tina.io).

Projects
* [TidyText: Clean ChatGPT Text for Google Docs and Microsoft Word](https://tidytext.cc)

- [TidyText: Clean ChatGPT Text for Google Docs and Microsoft Word](https://tidytext.cc)
20 changes: 19 additions & 1 deletion public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Polymer gives us the ability to create reusable components and taking advantage

The delivery of the data itself gets handled by the `<nutrition-facts-service>`. This service provides a simple API to access nutrition data and update it as needed.

* facts: Returns the list of nutrition facts.
* updateFacts: Retrieves a JSON file, allowing you to easily update or replace the facts.
- facts: Returns the list of nutrition facts.
- updateFacts: Retrieves a JSON file, allowing you to easily update or replace the facts.

```json
{
Expand Down Expand Up @@ -53,7 +53,9 @@ With the service created, we can now build the UI to display the nutrition facts

```html
<nutrition-facts-service id="nutritionService"></nutrition-facts-service>
<nutrition-facts-display facts="[[nutritionService.facts]]"></nutrition-facts-display>
<nutrition-facts-display
facts="[[nutritionService.facts]]"
></nutrition-facts-display>
```

### Step 3: Displaying the Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ The first step is to create your spreadsheet.

## Open your spreadsheet in Google Drive

You can [make a copy of my spreadsheet as a template](https://web.archive.org/web/20160306135950/https://docs.google.com/spreadsheet/ccc?key=0Ar8T1bZPJyrVdGlCTU9USWl0V0pyYzZuMjNYbUQtUmc\&usp=sharing), or note the following when creating a spreadsheet from scratch:
You can [make a copy of my spreadsheet as a template](https://web.archive.org/web/20160306135950/https://docs.google.com/spreadsheet/ccc?key=0Ar8T1bZPJyrVdGlCTU9USWl0V0pyYzZuMjNYbUQtUmc&usp=sharing), or note the following when creating a spreadsheet from scratch:

* Use the first row as your column headers
* Make sure you have a column with the dates you’d like the script to reference.
* Add a tabbed sheet and name it Log
- Use the first row as your column headers
- Make sure you have a column with the dates you’d like the script to reference.
- Add a tabbed sheet and name it Log

Here's [the source on Github](https://github.com/rachelslurs/magic-ticket/) and the [spreadsheet template](https://docs.google.com/spreadsheets/d/15nsjHBojKfwoKhV089I2dsoe48jYGSAvXdw9CWI_6pM/edit?gid=0#gid=0).
6 changes: 3 additions & 3 deletions src/content/blog/ControlGroupcom-Built-Using-Jekyll.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'ControlGroup.com: Built Using Jekyll'
title: "ControlGroup.com: Built Using Jekyll"
description: Using a static-site generator led to huge performance gains
author: Rachel Cantor
pubDatetime: 2012-10-19T04:00:00.000Z
Expand Down Expand Up @@ -36,8 +36,8 @@ Sure, I can run Ruby plugins on my local machine (say, to generate category page

### Markdown is a fickle mistress.

* I used the default markup interpreter engine for Jekyll which is [Maruku](https://web.archive.org/web/20121023030250/http://maruku.rubyforge.org/), but as far as I know, they all have their caveats. Just one seemingly harmless unencoded ampersand was enough to make Jekyll get all Hyde on you.
* Another big markdown offender is allowfullscreen, something you probably never noticed is in every video embed code in existence. Including it will throw you an error. Removing the offending attribute is the simple enough solution, and fortunately, it doesn’t seem to remove the video’s ability to go fullscreen.
- I used the default markup interpreter engine for Jekyll which is [Maruku](https://web.archive.org/web/20121023030250/http://maruku.rubyforge.org/), but as far as I know, they all have their caveats. Just one seemingly harmless unencoded ampersand was enough to make Jekyll get all Hyde on you.
- Another big markdown offender is allowfullscreen, something you probably never noticed is in every video embed code in existence. Including it will throw you an error. Removing the offending attribute is the simple enough solution, and fortunately, it doesn’t seem to remove the video’s ability to go fullscreen.

## Recommended Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,168 +12,190 @@ tags:
I ended up realizing that I didn’t need to [use context for this](https://blog.hellopico.io/passing-a-redux-form-action-creator-from-container-to-component-via-react-context-7563169746f7) after all and used this pattern as an alternative.

```javascript
import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { FieldArray, getFormValues } from 'redux-form' // import the action creator you need
import CountryPicker from '../components/CountryPicker'
import React, { Component } from "react";
import { connect } from "react-redux";
import PropTypes from "prop-types";
import { FieldArray, getFormValues } from "redux-form"; // import the action creator you need
import CountryPicker from "../components/CountryPicker";

class CountriesContainer extends Component {

constructor(props) {
super(props)
this.state = { countries: props.formValues.countries }
super(props);
this.state = { countries: props.formValues.countries };
}

static propTypes = {
formValues: PropTypes.object
}

componentWillReceiveProps = (nextProps) => {
if (nextProps.formValues && nextProps.formValues.countries !== this.props.formValues.countries) {
this.setState({ countries: nextProps.formValues.countries })
formValues: PropTypes.object,
};

componentWillReceiveProps = nextProps => {
if (
nextProps.formValues &&
nextProps.formValues.countries !== this.props.formValues.countries
) {
this.setState({ countries: nextProps.formValues.countries });
}
}
};

shouldComponentUpdate = (nextProps) => {
if (nextProps.formValues) return (nextProps.formValues.countries !== this.props.formValues.countries)
}
shouldComponentUpdate = nextProps => {
if (nextProps.formValues)
return nextProps.formValues.countries !== this.props.formValues.countries;
};

handleCountryChange = () => this.setState({ countries: this.props.formValues.countries })
handleCountryChange = () =>
this.setState({ countries: this.props.formValues.countries });

render() {
const { countries } = this.state
const options = ['United States', 'Canada', 'Mexico']
const { countries } = this.state;
const options = ["United States", "Canada", "Mexico"];

return (
<div>
<FieldArray component={CountryPicker}
name='countries'
<FieldArray
component={CountryPicker}
name="countries"
options={options}
selectedCountries={countries}
onCountryChange={this.handleCountryChange}
/>
</div>
)
);
}
}

const mapStateToProps = (state) => {
const { countries } = state
const mapStateToProps = state => {
const { countries } = state;
return {
countries,
formValues: getFormValues('countriesForm')(state)
}
}
export default connect(
mapStateToProps
)(CountriesContainer)
formValues: getFormValues("countriesForm")(state),
};
};
export default connect(mapStateToProps)(CountriesContainer);
```

```javascript
import React, { Component } from 'react'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { List, Checkbox, Table } from 'semantic-ui-react'
import indexOf from 'lodash/indexOf'
import React, { Component } from "react";
import { connect } from "react-redux";
import PropTypes from "prop-types";
import { List, Checkbox, Table } from "semantic-ui-react";
import indexOf from "lodash/indexOf";

class CountryPicker extends Component {
constructor(props) {
super(props)
super(props);
this.state = {
options: props.options,
selected: props.selectedCountries,
fields: props.fields
}
this.handleCountryChange = this.handleCountryChange.bind(this)
fields: props.fields,
};
this.handleCountryChange = this.handleCountryChange.bind(this);
}

static propTypes = {
options: PropTypes.array.isRequired,
selectedCountries: PropTypes.array.isRequired,
fields: PropTypes.any,
onCountryChange: PropTypes.func.isRequired
}
onCountryChange: PropTypes.func.isRequired,
};

shouldComponentUpdate(nextProps) {
if (nextProps.selectedCountries !== this.props.selectedCountries) {
this.handleCountryChange()
return true
this.handleCountryChange();
return true;
}
return false
return false;
}

componentWillReceiveProps(nextProps) {
this.setState({
selected: nextProps.selectedCountries
})
selected: nextProps.selectedCountries,
});
}

handleCountryChange() {
this.props.onCountryChange(this.state.regionKey)
this.props.onCountryChange(this.state.regionKey);
}

handleSelectAll = () => {
const { options, selected, fields } = this.state
let fieldsToAdd, fieldsToRemove
const { options, selected, fields } = this.state;
let fieldsToAdd, fieldsToRemove;
if (selected.length === options.length) {
// deselect all
fieldsToRemove = selected.map((country) => indexOf(selected, country))
fieldsToRemove = selected.map(country => indexOf(selected, country));

// Making sure the removal of indices won't be affected by race conditions
// by sorting them in descending order
fieldsToRemove.sort((a, b) => b - a)
fieldsToRemove.forEach((countryIndex) => fields.remove(countryIndex))
fieldsToRemove.sort((a, b) => b - a);
fieldsToRemove.forEach(countryIndex => fields.remove(countryIndex));
} else {
fieldsToAdd = options.reduce((result, country) => {
if (indexOf(selected, country) === -1) result.push(country)
return result
}, [])
fieldsToAdd.forEach((country) => fields.push(country))
if (indexOf(selected, country) === -1) result.push(country);
return result;
}, []);
fieldsToAdd.forEach(country => fields.push(country));
}
}
};

handleChange = (e, { value }) => {
const { selected, fields } = this.state
const { selected, fields } = this.state;
if (indexOf(selected, value) !== -1) {
fields.remove(indexOf(selected, value))
fields.remove(indexOf(selected, value));
} else {
fields.push(value)
fields.push(value);
}
}
};

render() {
const { options, selected } = this.state
const { options, selected } = this.state;
return (
<Table compact>
<Table.Header>
<Table.Row>
<Table.HeaderCell>
<Checkbox checked={options.length > 0 && selected.length === options.length} label='Countries'
indeterminate={0 !== selected.length && selected.length < options.length} onChange={this.handleSelectAll} onClick={this.handleSelectAll}
disabled={options.length === 0} />
<Checkbox
checked={
options.length > 0 && selected.length === options.length
}
label="Countries"
indeterminate={
0 !== selected.length && selected.length < options.length
}
onChange={this.handleSelectAll}
onClick={this.handleSelectAll}
disabled={options.length === 0}
/>
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
<List verticalAlign='middle' relaxed style={{ height: '180px', overflowY: 'auto' }}>
{options.map((country, i) =>
<List
verticalAlign="middle"
relaxed
style={{ height: "180px", overflowY: "auto" }}
>
{options.map((country, i) => (
<List.Item key={i}>
<List.Content>
<Checkbox label={country} name='countries' value={country} checked={indexOf(selected, country) !== -1} onChange={this.handleChange} />
<Checkbox
label={country}
name="countries"
value={country}
checked={indexOf(selected, country) !== -1}
onChange={this.handleChange}
/>
</List.Content>
</List.Item>
)}
))}
</List>
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
)
);
}
}

export default CountryPicker
export default CountryPicker;
```
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ I built it using React, Vite, Web Workers (to handle processing of the markdown

### 🔧 Why build this?

* I saw a simple problem I could solve for myself and make it simple and delightful.
* I love a good mini app as a way of trying out something new (like Vite) and brushing up on my Web Workers skills.
* Also I want to get more contracting clients.
- I saw a simple problem I could solve for myself and make it simple and delightful.
- I love a good mini app as a way of trying out something new (like Vite) and brushing up on my Web Workers skills.
- Also I want to get more contracting clients.

### 💡 What’s next?

Expand Down
Loading

0 comments on commit 63942cd

Please sign in to comment.