Skip to content

Instantly share code, notes, and snippets.

View farskid's full-sized avatar
🎯
Focusing

Farzad Yousefzadeh farskid

🎯
Focusing
View GitHub Profile
@farskid
farskid / TreeIterator.js
Created June 10, 2022 19:46 — forked from sonyseng/TreeIterator.js
Playing around with the Iterators from ES6 to walk a tree non-recursively (babeljs)
// Test tree with contrived data
let testTree = {
value: 1,
child: [
{value: 2, child: [
{value: 7, child: []},
{value: 8, child: []},
{value: 9, child: []},
]},
{value: 3, child: []},
@farskid
farskid / stepForm.js
Last active September 30, 2021 19:18 — forked from waldothedeveloper/stepForm.js
Step Online Form
import { createMachine, assign } from "xstate"
import {
zipCodeRegex,
verifyZipcode,
formatPhoneNumber,
validatePhoneNumber,
} from "../../utils/quiz_form_validation"
//
export const stepMachine = createMachine(
@farskid
farskid / gitzip.sh
Created June 1, 2021 13:54 — forked from LeonardoCardoso/gitzip.sh
Zip folder ignoring files listed on .gitignore
#...
function gitzip() {
git archive -o $@.zip HEAD
}
#... gitzip ZIPPED_FILE_NAME
@farskid
farskid / what-forces-layout.md
Created December 14, 2020 12:30 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@farskid
farskid / README.md
Last active December 4, 2020 20:43 — forked from kentcdodds/README.md
user-package-stats

user-package-stats

I was poking around trying to figure out all the packages I have access to publish and got curious. So I write this little script to determine the download stats for all the packages I have publish access to.

Feel free to try it yourself. Just change the username passed to getUserDownloadStats.

By default, the stats are sorted by their average daily downloads (descending). That should give you an idea of the most "popular" package of a given user relative to how long that package has been around.

You can use it with npx like so:

@farskid
farskid / quick-argument-parser.js
Created March 16, 2020 11:13 — forked from binoculars/quick-argument-parser.js
Node.js quick CLI arguments parser for key-value pair arguments
/**
* Takes arguments in the form of --arg-name value and puts them into an object (argMap).
* Argument keys begin with double hyphens and additional hyphens are converted to camelCase.
*
* E.g. `node quick-argument-parser.js --test-arg1 'value1' --test-arg2 'value2'` will create argMap with the value:
* ```
* {
* testArg1: 'value1',
* testArg2: 'value2'
* }
@farskid
farskid / parse_dotenv.bash
Created August 19, 2019 08:45 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)

I bundled these up into groups and wrote some thoughts about why I ask them!

If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email carl.vitullo@gmail.com

Onboarding and the workplace

https://blog.vcarl.com/interview-questions-onboarding-workplace/

  • How long will it take to deploy my first change? To become productive? To understand the codebase?
  • What kind of equipment will I be provided? Will the company pay/reimburse me if I want something specific?
@farskid
farskid / remove_tuxera.sh
Last active June 13, 2019 19:40 — forked from miguelmota/remove_tuxera.sh
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs
sudo rm -rf /Library/Filesystems/tuxera_ntfs.fs
@farskid
farskid / readme.md
Created November 27, 2018 11:02 — forked from dominictarr/readme.md
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu