Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
gen_html () {
mkdir -p test_compile
file_name=$1
name="${1%.*}"
ext="${1##*.}"
echo "[${name}](./${name}.html)" >> index.md
echo "" >> index.md
pandoc -f markdown -t html --mathjax --metadata title="questions" -s -o ./test_compile/${name}.html $file_name
@jnduli
jnduli / php_unused_functions.sh
Created September 23, 2019 12:11
This helps find unused or rarely used functions in a php project
## This script is used to check for unused or rarely used function in php
## It has been tested on a laravel project
## It outputs a list containing all functions plus number of occurences in the project
## It can be used together with sort e.g. php_unused_functions.sh | sort -h
for f in $(grep --exclude-dir=tests -rho -P '^.*public .*function .*(?=\()'| awk -F' ' '{print $NF}'); do
echo $(grep -ro $f * | wc -l) $f
done

Keybase proof

I hereby claim:

  • I am jnduli on github.
  • I am jnduli (https://keybase.io/jnduli) on keybase.
  • I have a public key ASAeymvB4I87Uf1JXH5YXqq4YCdS14ZBOdC2qtzalYOPvAo

To claim this, I am signing this object:

@jnduli
jnduli / pre-commit
Last active June 10, 2019 05:33
php-cs-fixer pre-commit hook for git
#!/bin/sh
# php-cs-fixer should be installed in the folder ./vendor/bin/
# Get installation instructions here: https://github.com/FriendsOfPHP/PHP-CS-Fixer
STAGED_FILES=$(git diff --cached --name-only --diff-filter=d | grep ".*\.php$")
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
@jnduli
jnduli / time_calculations.gs
Created March 31, 2018 14:18
Google Sheets function to calculate time averages and best times
/**
* Averages time provide in formate minutes:seconds:millisec
*
* @param {range} input The value to multiply.
* @return The average of input range.
* @customfunction
*/
function AVERAGETIME(input) {
if (!input.map) //test if it is not an array
return input
@jnduli
jnduli / EdittingChanges.gs
Last active December 16, 2017 08:53
Google Sheets Script to send and email alert and color a row when a task is late. It assumes the sheet has the following columnsLabels: Features, Status,DateDue.
function onEdit(e) {
var activeSheet = e.source.getActiveSheet();
if (activeSheet.getName() !== 'lookup') {
var range = activeSheet.getDataRange();
editTasksSheet(range, e);
}
}
function editTasksSheet(range, e){