Skip to content

Instantly share code, notes, and snippets.

Avatar
📟
Automating everything with NodeCLI.com

Ahmad Awais ⚡️ ahmadawais

📟
Automating everything with NodeCLI.com
View GitHub Profile
@ahmadawais
ahmadawais / node-mac.sh
Created Jul 1, 2022
The best way to install Node.js on Mac
View node-mac.sh
# Node.
brew install node
brew install n
n lts
brew uninstall node # Not needed anymore from brew.
npm i -g git-open
View Sendy NGNIX Config 2022.md

Bascially all you really need is this

location / {
		try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
	}

But to be on the safe side I added everything below:

@ahmadawais
ahmadawais / sendy-install-digital-ocean.md
Last active Nov 30, 2022
Install Sendy on DigitalOcean 2022
View sendy-install-digital-ocean.md

You can open the Marketplace tab and search for the current LAMP stack.

We will use the LAMP stack on a Basic plan for 5$/month.

php -v

# if php 8 then
View esm-package.md

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
View attribution.js
https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/
let YOUR_DOMAIN = "YOUR_DOMAIN.TLD" // ex: scrapingbee.com
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@ahmadawais
ahmadawais / tailwind.config.js
Created Jan 4, 2021
Tailwind Text Decoration Color Utilities Plugin
View tailwind.config.js
const decoration = plugin(function ({ e, addUtilities, theme }) {
colors = theme('colors');
const decorationColors = Object.keys(colors).reduce((acc, key) => {
if (typeof colors[key] === 'string') {
return {
...acc,
[`.decoration-${e(key)}`]: {
'text-decoration-color': colors[key],
},
@ahmadawais
ahmadawais / README.md
Created Dec 5, 2020 — forked from kentcdodds/README.md
user-package-stats
View README.md

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:

@ahmadawais
ahmadawais / notion2blog.js
Created Nov 3, 2020 — forked from mayneyao/notion2blog.js
Notion.so > Personal Blog | custom domain + disqus comment
View notion2blog.js
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": "*",
@ahmadawais
ahmadawais / no-follow-back-twitter.js
Created Aug 27, 2020
TWITTER: Remove the followers from twitter following tab to see the people who don't follow you back. Hacky as heck :P
View no-follow-back-twitter.js
document.querySelectorAll("div[role=\"button\"]").forEach(el => {
const follower = /Follows you/g.test(el.textContent);
follower && el.parentNode.parentNode.remove();
});
@ahmadawais
ahmadawais / .profile
Created Aug 27, 2020 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
View .profile
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else