Tutorial and tips for GitHub Actions workflows
| 1000001-x 86 56 64 95 | |
| 1000002-y 81 67 63 53 | |
| 1000003-x 45 46 97 67 | |
| 1000004-x 75 68 95 72 | |
| 1000005-y 89 54 72 66 | |
| 1000006-z 66 70 84 90 | |
| 1000007-x 68 76 84 89 | |
| 1000008-z 97 62 56 53 | |
| 1000009-y 76 48 90 51 | |
| 1000010-y 62 67 92 70 |
| class BenfordCounter | |
| def initialize | |
| @num_count = {} | |
| # Set all values to zero | |
| (1..9).each {|num| @num_count[num] = 0 } | |
| @total_records = 0 | |
| @min_value = 9999999999 | |
| @max_value = 0 |
| function hexToRgb(hex) { | |
| // Expand shorthand form ("#FFF") to full form ("#FFFFF") | |
| var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; | |
| hex = hex.replace(shorthandRegex, function(m, r, g, b) { | |
| return r + r + g + g + b + b; | |
| }); | |
| // return hex values | |
| var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | |
| return result ? { | |
| r: parseInt(result[1], 16), |
First, take a look at the ESLint rule documentation. Just skim it for now. It's very long and boring. You can come back to it later.
ESLint rules works on the AST (Abstract Syntax Tree) representation of the code. In short, this is a tree structure that describes the code in a very verbose form. ESLint walks this tree and rules can subscribe to be notified when it hits a specific node type, like a Literal type, which could be the "hello" part of const welcome = "hello";.
Go ahead and play around with some code in AST Explorer (Make sure the parser is espree). It's a great tool!
Here are some good articles on the subject (ignore the scaffolding parts):
The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'instead ofconst foo = require('foo')to import the package. You also need to put"type": "module"in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)from CommonJS instead ofrequire(…). - Stay on the existing version of the package until you can move to ESM.
| const MY_DOMAIN = "agodrich.com" | |
| const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2" | |
| const DISQUS_SHORTNAME = "agodrich" | |
| addEventListener('fetch', event => { | |
| event.respondWith(fetchAndApply(event.request)) | |
| }) | |
| const corsHeaders = { | |
| "Access-Control-Allow-Origin": "*", |
| var film = this.props.data.slice(0, 5).map((item) => { | |
| return <FilmItem key={item.id} film={item} /> | |
| }); | |
| return film; |