Skip to content

Instantly share code, notes, and snippets.

Avatar
📟
Recording videos for NodeCLI.com

Ahmad Awais ⚡️ ahmadawais

📟
Recording videos for NodeCLI.com
View GitHub Profile
@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
View index.js
const visit = require('unist-util-visit')
module.exports = () => (tree, file) => {
visit(tree, 'heading', node => {
console.log('node: ', node);
visit(node, 'text', textNode => {
console.log('textNode: ', textNode);
const text = textNode.value ? textNode.value.trim() : ''
// const textNoWidows = text.replace(/\s+([\S]*)(\s*)$/gm, "\xA0$1$2");
@ahmadawais
ahmadawais / .zshrc
Created Jul 26, 2020
🦄 Shades of Purple theme for fzf
View .zshrc
# fzf theme.
# Base16 Atelier Plateau Light
_gen_fzf_default_opts() {
local color00='#2D2B55'
local color01='#1E1E3F'
local color02='#A599E9'
local color03='#A599E9'
local color04='#A599E9'
local color05='#A599E9'
@ahmadawais
ahmadawais / .zshrc
Created Jul 3, 2020
manpdf opens man pages as PDF
View .zshrc
# Open man page as PDF.
# USAGE: manpdf cat
function manpdf() {
man -t "${1}" | open -f -a /Applications/Preview.app/
}
@ahmadawais
ahmadawais / javascript.json
Last active Jun 29, 2020
VSCode Console Log Snippets
View javascript.json
{
"Console Log with Name": {
"prefix": "lg",
"body": ["console.log(`${1:variable}`, ${1:variable});"],
"description": "Console Log with name of a variable"
},
"Console Log with String": {
"prefix": "lgs",
"body": ["console.log(`${1:STRING_HERE}`);"],
"description": "Console Log string"
@ahmadawais
ahmadawais / getTwitterImage.js
Created Jun 21, 2020
Scrape a twitter image with JavaScript.
View getTwitterImage.js
const cheerio = require('cheerio')
const got = require('got')
// https://dev.twitter.com/basics/user-profile-images-and-banners
const REGEX_IMG_MODIFIERS = /_(?:bigger|mini|normal)\./
const ORIGINAL_IMG_SIZE = '_400x400'
const getAvatarUrl = url =>
url.replace(REGEX_IMG_MODIFIERS, `${ORIGINAL_IMG_SIZE}.`)
@ahmadawais
ahmadawais / .zshrc
Created Nov 26, 2019
#OneDevMinute: Git archive the current directory and ignore everything in .gitignore file.
View .zshrc
# Git archive the current directory
# and ignore everything in .gitignore file.
# Usage: garc zipname
alias garc="git archive -o $1.zip HEAD"
@ahmadawais
ahmadawais / .zshrc
Last active Oct 22, 2019
🔥 #OneDevMinute: Type `git open` to open the GitHub page or website for a repository.
View .zshrc
# Type `git open` to open the GitHub page or website for a repository.
# Step #1: npm install -g git-open
# Step #2: cd local_repo_directory
# Strep #3 git open
# More examples: https://github.com/paulirish/git-open
# Bonus use the following aliases
# @usage gio
alias gio="git open"
You can’t perform that action at this time.