Skip to content

Instantly share code, notes, and snippets.

Avatar
☢️
approach with caution, might meltdown

Fahad Hossain fa7ad

☢️
approach with caution, might meltdown
View GitHub Profile
@dethi
dethi / unused-files.sh
Last active Mar 15, 2021
create-react-app: find files not used in the app bundle, i.e. unused source code
View unused-files.sh
#!/bin/bash
# Launch inside a create-react-app project after building the production build.
# Require `jq`.
diff \
<(find src -type f \( -name '*.js' -o -name '*.jsx' -o -name '*.css' \) | sort) \
<(cat build/**/*.map | jq --raw-output '.sources | join("\n")' \
| grep -v '\.\./' | grep -E '\.(js|jsx|css)$' \
| sed "s#^#src/#" | sort | uniq) \
@ralfr
ralfr / README.md
Created Jan 15, 2017 — forked from pdanford/README.md
Applescript to launch iTerm2 Version 3+ from OS X Finder via keyboard shortcut or Toolbar
View README.md

Description

Based on info from http://peterdowns.com/posts/open-iterm-finder-service.html but with modified behavior and fixed to work with iTerm2 version 3 or later. It will not work with older versions of iTerm. The modified behavior is to open a new terminal window for each invocation instead of reusing an already open window. Update - The original author released a build script for the newer iTerm2 versions at https://github.com/peterldowns/iterm2-finder-tools that keeps the original behavior of reusing an open iTerm2 window.

To open iTerm2 at selected folder with keyboard shortcut

  1. Run Automator, select a new Service
  2. Select Utilities -> Run AppleScript
  3. Service receives selected 'folders' in 'finder.app'
  4. Paste script:
@hasinhayder
hasinhayder / charlie-foxtrot.go
Last active May 20, 2020
converts a string to NATO phonetic alphabet equivalents
View charlie-foxtrot.go
/* Charlie Foxtrot - If You Know What It Means ;) */
package main
import (
"fmt"
"strings"
"bufio"
"os"
)
@pdanford
pdanford / README.md
Last active Jul 19, 2021
Launching iTerm2 from macOS Finder
View README.md

Launching iTerm2 from macOS Finder

(Based on info from Peter Downs' gitub but with modified behavior to open a new terminal window for each invocation instead of reusing an already open window.)

The following three ways to launch an iTerm2 window from Finder have been tested on iTerm2 version 3+ running on macOS Mojave+.

pdanford - April 2020


@hasinhayder
hasinhayder / functions.php
Created Oct 29, 2014
Redirect WordPress posts to the editor if someone types /edit at the end of the permalink
View functions.php
<?php
function init_url_rewrite_rule(){
add_rewrite_endpoint( 'edit',EP_PERMALINK | EP_PAGES | EP_ATTACHMENT );
if(get_option("EDIT_REWRITE_RULE")!=1){
flush_rewrite_rules();
update_option("EDIT_REWRITE_RULE",1);
}
}
function redirect_edit_url(){